Giter Site home page Giter Site logo

Comments (2)

codebanesr avatar codebanesr commented on May 26, 2024

Trello Example

import networkx as nx
def create_trello_graph(json_data):
    # Create an empty directed graph
    graph = nx.DiGraph()

    def traverse_list(list_data, parent_board_id):
        for card in list_data.get("cards", []):
            # Add cards as nodes and connect them to their parent lists
            graph.add_node(card["id"], label="Card", title=card["title"], description=card["description"])
            graph.add_edge(parent_board_id, card["id"], label="Contains")

    for board in json_data.get("boards", []):
        # Add boards as nodes
        graph.add_node(board["id"], label="Board", title=board["title"])
        
        for trello_list in board.get("lists", []):
            # Add lists as nodes and connect them to their parent boards
            graph.add_node(trello_list["id"], label="List", title=trello_list["title"])
            graph.add_edge(board["id"], trello_list["id"], label="Contains")
            traverse_list(trello_list, board["id"])

    return graph

# Example JSON data

trello_data = {
    "boards": [
        {
            "id": "board1",
            "title": "Project X",
            "lists": [
                {
                    "id": "list1",
                    "title": "To Do",
                    "cards": [
                        {
                            "id": "card1",
                            "title": "Task 1",
                            "description": "This is the first task."
                        }
                    ]
                }
            ]
        }
    ]
}

# Create and display the graph
graph = create_trello_graph(trello_data)
print("Nodes:", graph.nodes(data=True))
print("Edges:", graph.edges(data=True))

from opencopilot.

codebanesr avatar codebanesr commented on May 26, 2024

Input: To create a Trello card in the "ToDo" list of the "trello" board, the agent traverses the graph structure.
Agent locates the board with the name "trello" and then identifies the "ToDo" list. Subsequently, it initiates the "generate_openapi" function call to complete the task.

It's important to note that this functionality has been tested and verified using a non-optimized version of the code found in the "integration" folder.

from opencopilot.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.