Sunday 19 August 2018

SNOMED & Neo4j


https://github.com/rorydavidson/SNOMED-CT-Database/tree/master/NEO4J

1. Install Neo4J
2. Make sure of installation python version 3.6.x
3. make sure of installation py2neo version 3.1.2: pip install py2neo==3.1.2
4. Download RF2 Full version of SnomedCT
5. In case of International version, ignore language option

running a script from the git. for ex (:

python snomed_g_graphdb_build_tools.py db_build --action create --rf2 C:/Users/ngo010/PWorks/NEO4J/20180731/Full --release_type full --neopw Khongco2016  --output_dir C:/Users/ngo010/PWorks/NEO4J/build

After import RF2 into Neo4J, can connect to the graph database by py2neo:



>>> from py2neo import Graph
>>> graph = Graph("bolt://localhost:7687")
>>> graph.evaluate("MATCH (a:ObjectConcept) RETURN count(a)")
>>> graph.run("MATCH (a:ObjectConcept) RETURN a.id, a.FSN LIMIT 3").data()
>>> from pandas import DataFrame
>>> DataFrame(graph.run("MATCH (a:ObjectConcept) RETURN a.id, a.FSN LIMIT 3").data())