DiamondDAO / chainverse-os

Tools for building collective knowledge applications
MIT License
0 stars 0 forks source link

Return graph of user search results #2

Closed liminal-dog closed 2 years ago

liminal-dog commented 2 years ago

Summary Return graph of top-ranking user search results

Requirements

Context

Designs/Wireframaes

liminal-dog commented 2 years ago

Ideally, search results should include (governance Proposals) and Mirror articles (Article label)

clemp commented 2 years ago

I'm starting on this and will post progress setting up the components for this here.

So first, I'm using the d3-force-directed graph as a baseline to configure and display link. Eventually we'll want to work toward better styling with something like this.

Current goal trying to replicate image

GraphQL queries

The process needed is:

  1. GraphQL query of a specific entity (denoted by uuid in the code) that returns JSON response from our Neo4j database with Note, Tag, and Proposal nodes.
  2. Create a function to process that JSON response into an array data structure of nodes and links (example below, but values in there have to change to adhere to our ontology)
    {
    "nodes": [
    {"id": "Diamond DAO", "group": 1},
    {"id": "Chainverse", "group": 1}
    ],
    "links": [
    {"source": "Diamond DAO", "target": "Chainverse", "value": 1}
    ]
    }
  3. Pass the processed JSON to the d3 visualization function. (Here is an Observable notebook with code examples for this graph)
  4. Add extra display details to the graph (labels, relationship types, directed links, etc)
  5. Create a flow for navigating through the graph
clemp commented 2 years ago

For the first step, here's a sample GraphQL query and returned data (that will be passed to Step 2).

Operation

query Entities($where: EntityWhere) {
  entities(where: $where) {
    uuid
    name
    notes {
      uuid
      text
      entities {
        uuid
        name
      }
      tags {
        uuid
        tag
      }
    }
    proposals {
      id
      title
    }
  }
}

Variable

{
  "where": {
    "uuid": "1db9ce70-2416-4e19-b879-20c76c48e307"
  }
}

Response

{
  "data": {
    "entities": [
      {
        "uuid": "1db9ce70-2416-4e19-b879-20c76c48e307",
        "name": "Redstone",
        "notes": [
          {
            "uuid": "d40fb0aa-04de-4f8f-bd03-aff477b6cc75",
            "text": "According to a June 2022 @Permacast tweet, @arweave-feesjs uses the @Redstone oracle to identify cases where a user may not have enough @Arweave token (#AR) to pay for a transaction.\n",
            "entities": [
              {
                "uuid": "4b2244ad-b5f7-4e4f-b0b6-4067f4c469e4",
                "name": "arweave-feesjs"
              },
              {
                "uuid": "730b1db3-6752-45f9-ac60-743ba42cc380",
                "name": "Arweave"
              },
              {
                "uuid": "1db9ce70-2416-4e19-b879-20c76c48e307",
                "name": "Redstone"
              },
              {
                "uuid": "38a88af5-b07e-4295-a87d-2a5ed9d47260",
                "name": "Permacast"
              }
            ],
            "tags": [
              {
                "uuid": "e9b2574c-3d95-4678-8550-95de2deae0e1",
                "tag": "AR"
              }
            ]
          },
          {
            "uuid": "78f9f645-ce10-4533-9393-b2bf5d87f729",
            "text": "According to a LinkedIn page for @PiotrPedziwiatr, Piotr was a #developer for @Redstone.\n",
            "entities": [
              {
                "uuid": "1db9ce70-2416-4e19-b879-20c76c48e307",
                "name": "Redstone"
              },
              {
                "uuid": "892bb7c1-3f8c-4b6f-91c6-a5f181100848",
                "name": "PiotrPedziwiatr"
              }
            ],
            "tags": [
              {
                "uuid": "20236471-1e17-44bf-8a6b-22efd85b7c5a",
                "tag": "developer"
              }
            ]
          },
          {
            "uuid": "d4f39f8a-3e9e-4f4b-acfa-121fdeb20613",
            "text": "According to a Github profile for @hatskier, @AlexSuvorov was a #developer for @Redstone. According to the same profile, Alex Suvorov was the #founder of @codenplay.io.\n\n\n\n\n",
            "entities": [
              {
                "uuid": "f7ecbbeb-5d33-40c1-a28a-00ea81db7c0f",
                "name": "hatskier"
              },
              {
                "uuid": "5c30c2cf-77a1-48ad-9170-3f857c7df86c",
                "name": "codenplay"
              },
              {
                "uuid": "c5f353b2-2d55-4de9-8590-ea2040d12c39",
                "name": "AlexSuvorov"
              },
              {
                "uuid": "1db9ce70-2416-4e19-b879-20c76c48e307",
                "name": "Redstone"
              }
            ],
            "tags": [
              {
                "uuid": "20236471-1e17-44bf-8a6b-22efd85b7c5a",
                "tag": "developer"
              },
              {
                "uuid": "f2a94345-9ebd-49b2-92fb-13c8d5bff170",
                "tag": "founder"
              }
            ]
          },
          {
            "uuid": "27569592-60b2-4b08-b97d-11667bfa5193",
            "text": "According to the @Redstone #Github, @piotruda, @hatskier, and @ppedziwiatr were \"members\" of the Redstone Github.\n",
            "entities": [
              {
                "uuid": "f7ecbbeb-5d33-40c1-a28a-00ea81db7c0f",
                "name": "hatskier"
              },
              {
                "uuid": "66f72d69-a7f0-422a-b08f-cb89e19bcdb0",
                "name": "piotruda"
              },
              {
                "uuid": "1db9ce70-2416-4e19-b879-20c76c48e307",
                "name": "Redstone"
              },
              {
                "uuid": "17b84868-989a-4d86-b550-8a31fa02159d",
                "name": "ppedziwiatr"
              }
            ],
            "tags": [
              {
                "uuid": "2ea9d85d-2b06-4efc-8189-c231fb7cd64f",
                "tag": "Github"
              }
            ]
          },
          {
            "uuid": "35c8d7e3-1a7a-493b-a55b-c6847546d1f6",
            "text": "According to a September 2021 @SynapseNetwork press release, @Redstone entered a #partnership where Redstone would provide pricing data to Synapse's decentralized exchange and Synapse would support Redstone with node infrastructure.\n",
            "entities": [
              {
                "uuid": "1db9ce70-2416-4e19-b879-20c76c48e307",
                "name": "Redstone"
              },
              {
                "uuid": "434e621b-ba65-4112-aa1a-38c84608b6f9",
                "name": "SynapseNetwork"
              }
            ],
            "tags": [
              {
                "uuid": "0cf87985-5491-4d01-9afa-2fdacb929cd3",
                "tag": "partnership"
              }
            ]
          },
          {
            "uuid": "83799327-2979-4bc0-a748-108b82d13c4c",
            "text": "According to LinkedIn, @AsiaZiola was a @Redstone #developer.\n",
            "entities": [
              {
                "uuid": "1db9ce70-2416-4e19-b879-20c76c48e307",
                "name": "Redstone"
              },
              {
                "uuid": "70bc3187-a1d6-48b4-b04b-750b07c22ccd",
                "name": "AsiaZiola"
              }
            ],
            "tags": [
              {
                "uuid": "20236471-1e17-44bf-8a6b-22efd85b7c5a",
                "tag": "developer"
              }
            ]
          },
          {
            "uuid": "523dc04a-2898-455e-b2e1-b0451be0d328",
            "text": "@Redstone #identifiers include !twitter:https://twitter.com/redstone_defi, !linkedin:https://ee.linkedin.com/company/redstone-finance.\n",
            "entities": [
              {
                "uuid": "1db9ce70-2416-4e19-b879-20c76c48e307",
                "name": "Redstone"
              }
            ],
            "tags": [
              {
                "uuid": "2b9e42eb-baaa-447c-8a80-cbaed4082113",
                "tag": "identifiers"
              }
            ]
          },
          {
            "uuid": "b863bb32-c56c-45e8-a5bf-3b3384996d31",
            "text": "According to a July 2021 press release, @Redstone provided data on 151 assets through its decentralized data #oracle.\n",
            "entities": [
              {
                "uuid": "1db9ce70-2416-4e19-b879-20c76c48e307",
                "name": "Redstone"
              }
            ],
            "tags": [
              {
                "uuid": "25589cdd-b201-4ed9-939c-52b0832f0b67",
                "tag": "oracle"
              }
            ]
          },
          {
            "uuid": "8061bdd8-c068-4370-a552-ee18e61d2cb3",
            "text": "According to a July 2021 @Redstone press release, Redstone raised a $525,000 #pre-seed round.\n\n\n\n#Redstone #investors included @Arweave, @ColliderVentures, @Maven11Capital, @Kr1, @1kx, and @BeringWaterVentures.\n",
            "entities": [
              {
                "uuid": "730b1db3-6752-45f9-ac60-743ba42cc380",
                "name": "Arweave"
              },
              {
                "uuid": "1db9ce70-2416-4e19-b879-20c76c48e307",
                "name": "Redstone"
              },
              {
                "uuid": "5d880ed5-f251-441e-8123-bf927e4256dd",
                "name": "BeringWaterVentures"
              },
              {
                "uuid": "a91931eb-76ef-4e9f-a275-d432a01d33e3",
                "name": "ColliderVentures"
              },
              {
                "uuid": "3bbc6419-ce7e-4a3d-b671-570447a998fb",
                "name": "Kr1"
              },
              {
                "uuid": "98bf0f40-34c5-4cb1-bc7f-0ff0f6c88c10",
                "name": "1kx"
              },
              {
                "uuid": "42ca4720-8f00-4f84-9e59-826600dd0b0a",
                "name": "Maven11Capital"
              }
            ],
            "tags": [
              {
                "uuid": "5a9831ff-e085-43e5-b0ff-da04c035d8da",
                "tag": "investors"
              },
              {
                "uuid": "ae4bbb15-56ca-4251-9233-b76c9fb0834e",
                "tag": "pre-seed"
              },
              {
                "uuid": "e6cfa1f3-a2c2-4e2e-adb3-f4f62ef18451",
                "tag": "Redstone"
              }
            ]
          },
          {
            "uuid": "9d3ab7f1-3a9f-49a2-90f5-4842cbe836dd",
            "text": "According to a LinkedIn page for @MarcinKazmierczak, accessed June 2022, Marcin was part of the @Redstone #senior-leadership, serving as #chief-operating-officer.\n",
            "entities": [
              {
                "uuid": "dd53c489-70bb-49a9-895b-79ae71ac38bd",
                "name": "MarcinKazmierczak"
              },
              {
                "uuid": "1db9ce70-2416-4e19-b879-20c76c48e307",
                "name": "Redstone"
              }
            ],
            "tags": [
              {
                "uuid": "514ed42a-2834-4dd4-b705-cb5f92c922a0",
                "tag": "senior-leadership"
              },
              {
                "uuid": "1632734d-a613-4ec4-9155-5aa2500e2146",
                "tag": "chief-operating-officer"
              }
            ]
          },
          {
            "uuid": "8f8dcd89-b0ad-4e35-b390-05cbf9827b4e",
            "text": "According to a website for @Redstone, @JakubWojciechowski leads @Etheroscope, an #ETH #analytics project that has received #grants from the #UnitedKingdom government.\n",
            "entities": [
              {
                "uuid": "34c0ab0e-d120-4d55-a955-433eabc7a964",
                "name": "Etheroscope"
              },
              {
                "uuid": "1db9ce70-2416-4e19-b879-20c76c48e307",
                "name": "Redstone"
              },
              {
                "uuid": "805408b0-eeef-4906-8aa1-c4b9c9e9dfe0",
                "name": "JakubWojciechowski"
              }
            ],
            "tags": [
              {
                "uuid": "87a968c4-ac6e-42f6-9e72-8adc42496bb7",
                "tag": "ETH"
              },
              {
                "uuid": "bc136929-4c3e-47e8-a421-f2a14486e648",
                "tag": "UnitedKingdom"
              },
              {
                "uuid": "a935932b-d5fa-4e79-87a9-8dec7369d0a0",
                "tag": "grants"
              },
              {
                "uuid": "90dc5a15-fce4-47c7-810e-e757104020f2",
                "tag": "analytics"
              }
            ]
          },
          {
            "uuid": "0362ca6f-7b03-4970-b7b1-27338905e0b5",
            "text": "According to a website for @Redstone, @JakubWojciechowski was part of the #senior-leadership of @Alice, an #impact-investing start-up, serving as #CTO.\n",
            "entities": [
              {
                "uuid": "3cb5d12c-b9d9-4b27-964c-f82ed0bde86a",
                "name": "Alice"
              },
              {
                "uuid": "1db9ce70-2416-4e19-b879-20c76c48e307",
                "name": "Redstone"
              },
              {
                "uuid": "805408b0-eeef-4906-8aa1-c4b9c9e9dfe0",
                "name": "JakubWojciechowski"
              }
            ],
            "tags": [
              {
                "uuid": "d1f32119-6550-451f-a772-27f1ffa5015d",
                "tag": "CTO"
              },
              {
                "uuid": "c6e0bc69-e748-4b2a-84cc-7833dd6270da",
                "tag": "impact-investing"
              },
              {
                "uuid": "514ed42a-2834-4dd4-b705-cb5f92c922a0",
                "tag": "senior-leadership"
              }
            ]
          },
          {
            "uuid": "41db9776-c1f4-44a2-8b1c-a77784284f3d",
            "text": "According to a website for @Redstone, @JakubWojciechowski was part of the Redstone #senior-leadership, serving as #founder and #ceo.\n",
            "entities": [
              {
                "uuid": "1db9ce70-2416-4e19-b879-20c76c48e307",
                "name": "Redstone"
              },
              {
                "uuid": "805408b0-eeef-4906-8aa1-c4b9c9e9dfe0",
                "name": "JakubWojciechowski"
              }
            ],
            "tags": [
              {
                "uuid": "1bd18c36-67a5-4028-a38a-92127738626b",
                "tag": "ceo"
              },
              {
                "uuid": "514ed42a-2834-4dd4-b705-cb5f92c922a0",
                "tag": "senior-leadership"
              },
              {
                "uuid": "f2a94345-9ebd-49b2-92fb-13c8d5bff170",
                "tag": "founder"
              }
            ]
          },
          {
            "uuid": "43a71654-7525-4884-ab2a-9c6a1635788b",
            "text": "According to a website for @Redstone, RedStone.Finance is building \"Highly customizable #DeFi #data streams.\"\n\n\nAccording to the same source, Redstone's design allows it to serve \"more data at lower latency\" than other DeFi #oracles.\n",
            "entities": [
              {
                "uuid": "1db9ce70-2416-4e19-b879-20c76c48e307",
                "name": "Redstone"
              }
            ],
            "tags": [
              {
                "uuid": "fa6db4c6-f2e7-4a3a-9e59-f652f9e3dac7",
                "tag": "oracles"
              },
              {
                "uuid": "4ee86c69-3f47-4be4-8098-938a8614acc8",
                "tag": "data"
              },
              {
                "uuid": "fac10373-a2a1-4622-b6fe-8f70f6746551",
                "tag": "DeFi"
              }
            ]
          }
        ],
        "proposals": []
      }
    ]
  }
}
clemp commented 2 years ago

Here is a minimal example of the graph input data formatting Using the first few records from the output above, here is a small dataset to represent how the data needs to be structured when returned from the transform function.

{
    "nodes": [
        {
            "id":  "1db9ce70-2416-4e19-b879-20c76c48e307",
            "text": "Redstone",
            "labels": ["Entity"],
            "rootNode": true
        },
        {
            "id": "d40fb0aa-04de-4f8f-bd03-aff477b6cc75",
            "text": "According to a June 2022 @Permacast tweet, @arweave-feesjs uses the @Redstone oracle to identify cases where a user may not have enough @Arweave token (#AR) to pay for a transaction.\n",
            "labels": ["Note"]
        },
        {
            "id": "4b2244ad-b5f7-4e4f-b0b6-4067f4c469e4",
            "text": "arweave-feesjs",
            "labels": ["Entity"]
        }

    ],
    "links": [
        {
            "source": "d40fb0aa-04de-4f8f-bd03-aff477b6cc75",
            "target": "1db9ce70-2416-4e19-b879-20c76c48e307",
            "labels": ["REFERENCES"]
        },
        {
            "source": "d40fb0aa-04de-4f8f-bd03-aff477b6cc75",
            "target": "4b2244ad-b5f7-4e4f-b0b6-4067f4c469e4",
            "labels": ["REFERENCES"]
        }
    ]
}
liminal-dog commented 2 years ago

We have a similar issue in Chainverse Portal. Should we close this?

liminal-dog commented 2 years ago

we moved this to chainverse-portal