diff --git a/Terminus/test.py b/Terminus/test.py
index c57ee59..6dca3b8 100644
--- a/Terminus/test.py
+++ b/Terminus/test.py
@@ -1,40 +1,2 @@
-import csv
-from itertools import islice
-from schema import ImpactArea, Blockchain, Topic, Web3, Organization
-from terminusdb_client import WOQLClient
-from datetime import datetime
-import pytz
-import re
-import emoji
-
-# we keep all the information in dictionaries with Employee id as keys
-orgs = {}
-
-client = WOQLClient("https://cloud.terminusdb.com/Myseelia/")
-client.connect(db="playground3", team="Myseelia", use_token=True)
-
-import re
-
-
-orgs[0] = Organization(
- # assignee = "",
- # blockchainecosystem = set(),
- # description = "",
- # logo = "",
- name = "darren"
- # preJan20thUpvotes = 0,
- # reviewed = "",
- # submittedbyemail = "",
- # submittedbyname = "",
- # submittedbyowner = "",
- # subscribed = "",
- # topic = set(),
- # upvotes = 0,
- # web3 = set(),
- # impactarea = set(),
- # datecreated = datetime.min
-)
-
-client.insert_document(list(orgs.values()), commit_msg="Adding 4 orgs")
-
-
+[{'@id': 'Organization/85405b13178f8e090cbcd58fd22111c0f72f77b59cbe00bb389ecd04c41d0e90', '@type': 'Organization', 'assignee': 'https://2local.io/', 'blockchainecosystem': ['BinanceSmartChain'], 'datecreated': '2022-05-07T11:03:00Z', 'description': '2local loyalty platform with the goal to achieve a sustainable world with prosperity for all. The cashback system supports sustainable and local-to-local working businesses. This cashback is generated from the profit from Yield Farms and Staking Pools. 2local doesn’t profit from its users but creates value with its users.', 'impactarea': ['SocialJustice'], 'name': '2local.io',
+ 'preJan20thUpvotes': '4', 'reviewed': 'checked', 'topic': ['Marketplace'], 'upvotes': '4'}, {'@id': 'Organization/f2dd1e11327e68d3ca3550cdec338186032d4fc4de4e9924ff97a8260a549be7', '@type': 'Organization', 'assignee': 'https://www.acredaos.com/', 'blockchainecosystem': ['Ethereum'], 'datecreated': '2022-05-07T11:03:00Z', 'description': 'ACRE DAOs is a decentralized impact investment club and Web3 access portal to the community of ACRE Invest token holders.', 'impactarea': ['SocialJustice'], 'name': 'ACRE DAOs\n', 'preJan20thUpvotes': '2', 'reviewed': 'checked', 'topic': ['Investing', 'Land'], 'upvotes': '2', 'web3': ['DAO']}]
diff --git a/src/components/CTA/CTA copy.svelte b/src/components/CTA/CTA copy.svelte
new file mode 100644
index 0000000..57767f4
--- /dev/null
+++ b/src/components/CTA/CTA copy.svelte
@@ -0,0 +1,290 @@
+
+
+
+ {
+ if (event.keyCode === 13) {
+ entered(event)
+ }
+ }}
+ />
+
+
+
+
diff --git a/src/components/CTA/CTA.svelte b/src/components/CTA/CTA.svelte
index 57767f4..5d32906 100644
--- a/src/components/CTA/CTA.svelte
+++ b/src/components/CTA/CTA.svelte
@@ -41,20 +41,6 @@
let edges: IEdge[] = []
onMount(async () => {
- nodes = knowledgeGraphJson.entities.map((entity: any) => ({
- data: { id: entity.id, label: entity.label }
- }))
-
- edges = knowledgeGraphJson.relations.map(
- (relation: any, index: string) => ({
- data: {
- id: index,
- source: relation.source,
- target: relation.target,
- label: relation.type
- }
- })
- )
cy = cytoscape({
container: document.getElementById('cy'),
@@ -113,6 +99,51 @@
}
})
+ const searchclient = new MeiliSearch({
+ host: 'https://ms-9ea4a96f02a8-1969.sfo.meilisearch.io',
+ apiKey: '117c691a34b21a6651798479ebffd181eb276958'
+ })
+ const index = searchclient.index('people')
+ // this will search both keys and values
+ // const search = await index.search(e.target.value.toString(), { q: '*' });
+ // const searchResult = await index.search('orgs', {
+ // attributesToRetrieve: ['id']
+ // })
+ const searchResult = await index.getDocuments(
+ {
+ limit: 1000
+ }
+ )
+ console.log(searchResult)
+ // need to turn the search results into an array of ids which can be used to query the knowledge graph
+ const resultsgraph = await generateKnowledgeGraph(searchResult.results).then(
+ resultsgraph => {
+
+ console.log(resultsgraph)
+ const allNodes = resultsgraph.entities.map((entity: any) => ({
+ data: { id: entity.id, label: entity.label }
+ }))
+
+ const allEdges = resultsgraph.relations.map(
+ (relation: any, index: string) => ({
+ data: {
+ id: index,
+ source: relation.source,
+ target: relation.target,
+ label: relation.type
+ }
+ })
+ )
+ cy.remove(cy.elements())
+ cy.add(allNodes)
+ cy.add(allEdges)
+ cy.layout({
+ name: 'cose'
+ // other layout options here
+ }).run()
+ }
+ )
+
cy.nodes().forEach(function (node) {
node.data({
degree: node.connectedEdges().length
diff --git a/src/components/CTA/cytoscape.ts b/src/components/CTA/cytoscape.ts
index 66af2f9..37f69ba 100644
--- a/src/components/CTA/cytoscape.ts
+++ b/src/components/CTA/cytoscape.ts
@@ -5,17 +5,24 @@ import * as fs from 'fs'
const WOQL = TerminusClient.WOQL
+function findNameById(ids: object[], id: string): string {
+ console.log('finding id ' + id);
+ const document = ids.find(doc => 'person/' + doc['id'] === id);
+ console.log('found name ' + JSON.parse(document['name']));
+ return document ? JSON.parse(document['name']) : '';
+}
+
export async function generateKnowledgeGraph(ids: object[]): Promise