I have a compound flow in neo4j and unable to understand how to keep this flow unique.
patient-1
visit date 29-03
-- visit time
--- treatment
Let us say I have inserted these nodes with some data in each . what I exactly want to update the same record and from the visit, date adds a new node of-course for time and treatment as well.
So i will have all visit dates and time with treatment details.
when I am trying to add the second patient in the same date,
patient-2
-visit date 29-03
-- visit time
--- treatment
cypher is not creating a separate date node for each patient, but it creates a relation with the existing node, which is for patient 1.
also, i can have multiple time treatment nodes on a single date. Please share the syntax of query. which can add this
patient node (unique )
- date (single patient can have multiple visit so can be multiple)
--- time (in single date there can be multiple time nodes)
---treatment (in single date there can be multiple treatments)
all patient should not have any relation with each other in any term
sample query
MERGE (nodepatient:ip { ip: "%s"})
MERGE(nodeDate:visitDate { date: "%s"})
MERGE(nodeTime:visitTime { time: "%s"})
MERGE(nodetreatment:treatment { treatment: "%s"})
WITH nodepatient ,nodeDate, nodeTime, nodetreatment
MERGE(nodepatient)-[:visitDate]->(nodeDate)-[:visitTime]->(nodeTime)-[:treatment]->(nodetreatment)