Showing results for 
Search instead for 
Did you mean: 

Join the community at Nodes 2022, our free virtual event on November 16 - 17.

Importing SNOMED CT International data into neo4j using the neo4j python driver

Hello everyone, I have been working on importing SNOMED CT International into neo4j. Currently I'm trying to create two types of Nodes namely Concept Nodes and Description Nodes and one type of relationship between concepts and descriptions.

Here is a code snippet :

def insert_data(query, rows, batch_size = 10000):
    # Function to handle the updating the Neo4j database in batch mode.
    total = 0
    batch = 0
    # start = time.time()
    result = None
    while batch * batch_size < len(rows):

        res = conn.cypher(query, 
                         parameters = {'rows': rows[batch*batch_size:(batch+1)*batch_size].to_dict('records')})
        # print(rows[batch*batch_size:(batch+1)*batch_size])
        batch += 1

def add_concepts(rows):
    # print(rows)
    query=""""UNWIND $rows AS row
              MERGE (:Concept {, effectiveTime:row.effectiveTime,, moduleId:row.moduleId, definitionStatusId:row.definitionStatusId})
              RETURN COUNT(*) AS total
    return insert_data(query, rows)

The data looks something like this for the concept table :

id effectiveTime active moduleId definitionStatusId
0 208008 20210731 0 900000000000207008 900000000000074008
1 300004 20210731 0 900000000000207008 900000000000074008
2 400003 20210731 0 900000000000207008 900000000000074008

All the dtypes are int64.

I'm getting the following error and I'm unable to understand where I'm going wrong.

Query Failed: {code: Neo.DatabaseError.General.UnknownError} {message: Lexical error at line 4, column 11. Encountered: after : ""}

I would really appreciate any and all help. Thank you.

DATASET : SnomedCT_InternationalRF2_PRODUCTION_20210731T120000Z
all files are tsv values in utf-8 encoding.



This query works for me. Which neo4j version are you using?

I'm currently using version 4.4.0