diff --git a/dataloader/load_data_expanded_access.cypher b/dataloader/load_data_expanded_access.cypher index 03aac6b..217f6fa 100644 --- a/dataloader/load_data_expanded_access.cypher +++ b/dataloader/load_data_expanded_access.cypher @@ -1,4 +1,4 @@ -call apoc.load.json('https://clinicaltrials.gov/api/query/study_fields?expr=COVID+AND+NOT+AREA%5BStudyType%5DInterventional+AND+NOT+AREA%5BStudyType%5DObservational&fields=NCTId&fmt=json&max_rnk=1000') yield value + call apoc.load.json('https://clinicaltrials.gov/api/query/study_fields?expr=COVID+AND+NOT+AREA%5BStudyType%5DInterventional+AND+NOT+AREA%5BStudyType%5DObservational&fields=NCTId&fmt=json&max_rnk=1000') yield value with value.StudyFieldsResponse.NStudiesFound as NStudies, RANGE(0,(value.StudyFieldsResponse.NStudiesFound/1000)) as nloop UNWIND nloop as i with range(1+1000*i,1000+1000*i,999) as RANGES @@ -21,8 +21,9 @@ ON CREATE set t.officialTitle=OfficialTitle MERGE (si)-[:HAS_TITLE]->(t) with si, study_metadata UNWIND study_metadata.Acronym as Acronym -set si.acronym=Acronym; -call apoc.load.json('https://clinicaltrials.gov/api/query/study_fields?expr=COVID+AND+NOT+AREA%5BStudyType%5DInterventional+AND+NOT+AREA%5BStudyType%5DObservational&fields=NCTId&fmt=json&max_rnk=1000') yield value +set si.acronym=Acronym +; + call apoc.load.json('https://clinicaltrials.gov/api/query/study_fields?expr=COVID+AND+NOT+AREA%5BStudyType%5DInterventional+AND+NOT+AREA%5BStudyType%5DObservational&fields=NCTId&fmt=json&max_rnk=1000') yield value with value.StudyFieldsResponse.NStudiesFound as NStudies, RANGE(0,(value.StudyFieldsResponse.NStudiesFound/1000)) as nloop UNWIND nloop as i with range(1+1000*i,1000+1000*i,999) as RANGES @@ -45,8 +46,9 @@ MERGE (ct)-[:COMPLETED_AT]->(e) with ct, s, study_metadata UNWIND study_metadata.WhyStopped as WhyStopped MERGE(ct)-[:WAS_STOPPED]->(r:StopReason{reason:WhyStopped}) -MERGE(s)-[:HAS_REASON]->(r); -call apoc.load.json('https://clinicaltrials.gov/api/query/study_fields?expr=COVID+AND+NOT+AREA%5BStudyType%5DInterventional+AND+NOT+AREA%5BStudyType%5DObservational&fields=NCTId&fmt=json&max_rnk=1000') yield value +MERGE(s)-[:HAS_REASON]->(r) +; + call apoc.load.json('https://clinicaltrials.gov/api/query/study_fields?expr=COVID+AND+NOT+AREA%5BStudyType%5DInterventional+AND+NOT+AREA%5BStudyType%5DObservational&fields=NCTId&fmt=json&max_rnk=1000') yield value with value.StudyFieldsResponse.NStudiesFound as NStudies, RANGE(0,(value.StudyFieldsResponse.NStudiesFound/1000)) as nloop UNWIND nloop as i with range(1+1000*i,1000+1000*i,999) as RANGES @@ -73,13 +75,25 @@ FOREACH(ignoreMe IN CASE WHEN r.type='Principal Investigator' THEN [1] ELSE [] E FOREACH(ignoreMe IN CASE WHEN r.type='Sponsor-Investigator' THEN [1] ELSE [] END | MERGE(r)-[:IS_RESPOSIBLE]->(k) MERGE(r)-[:IS_RESPOSIBLE]->(i)) -with ct, study_metadata +; + call apoc.load.json('https://clinicaltrials.gov/api/query/study_fields?expr=COVID+AND+NOT+AREA%5BStudyType%5DInterventional+AND+NOT+AREA%5BStudyType%5DObservational&fields=NCTId&fmt=json&max_rnk=1000') yield value +with value.StudyFieldsResponse.NStudiesFound as NStudies, RANGE(0,(value.StudyFieldsResponse.NStudiesFound/1000)) as nloop +UNWIND nloop as i +with range(1+1000*i,1000+1000*i,999) as RANGES +with RANGES, RANGES[1] as urange, RANGES[0] as lrange +call apoc.load.json('https://clinicaltrials.gov/api/query/study_fields?expr=COVID+AND+NOT+AREA%5BStudyType%5DInterventional+AND+NOT+AREA%5BStudyType%5DObservational&fields=NCTId,ResponsiblePartyType,ResponsiblePartyInvestigatorFullName,ResponsiblePartyInvestigatorAffiliation,LeadSponsorName,CollaboratorName&min_rnk='+lrange+'&max_rnk='+urange+'&fmt=json') yield value +with value.StudyFieldsResponse.StudyFields as coll unwind coll as study_metadata +UNWIND study_metadata.NCTId as Id +match(ct:ClinicalTrial{NCTId:Id}) UNWIND study_metadata.CollaboratorName as CollaboratorName MERGE(sp:Collaborator{name:CollaboratorName}) -MERGE(ct)-[:IS_SUPPORTED_BY]->(sp); -MERGE(r:Response{YN:'Yes'}); -MERGE(k:Response{YN:'No'}); -call apoc.load.json('https://clinicaltrials.gov/api/query/study_fields?expr=COVID+AND+NOT+AREA%5BStudyType%5DInterventional+AND+NOT+AREA%5BStudyType%5DObservational&fields=NCTId&fmt=json&max_rnk=1000') yield value +MERGE(ct)-[:IS_SUPPORTED_BY]->(sp) +; + MERGE(r:Response{YN:'Yes'}) +; + MERGE(k:Response{YN:'No'}) +; + call apoc.load.json('https://clinicaltrials.gov/api/query/study_fields?expr=COVID+AND+NOT+AREA%5BStudyType%5DInterventional+AND+NOT+AREA%5BStudyType%5DObservational&fields=NCTId&fmt=json&max_rnk=1000') yield value with value.StudyFieldsResponse.NStudiesFound as NStudies, RANGE(0,(value.StudyFieldsResponse.NStudiesFound/1000)) as nloop UNWIND nloop as i with range(1+1000*i,1000+1000*i,999) as RANGES @@ -96,8 +110,9 @@ UNWIND study_metadata.NCTId as Id match(ct:ClinicalTrial{NCTId:Id}),(r:Response{YN:'No'}) UNWIND study_metadata.IsUnapprovedDevice as IsUnapprovedDevice FOREACH(ignoreMe IN CASE WHEN IsUnapprovedDevice='No' THEN [1] ELSE [] END | -MERGE(ct)-[:IS_FDA_REGULATED_DEVICE]->(r)); -call apoc.load.json('https://clinicaltrials.gov/api/query/study_fields?expr=COVID+AND+NOT+AREA%5BStudyType%5DInterventional+AND+NOT+AREA%5BStudyType%5DObservational&fields=NCTId&fmt=json&max_rnk=1000') yield value + MERGE(ct)-[:IS_FDA_REGULATED_DEVICE]->(r)) +; + call apoc.load.json('https://clinicaltrials.gov/api/query/study_fields?expr=COVID+AND+NOT+AREA%5BStudyType%5DInterventional+AND+NOT+AREA%5BStudyType%5DObservational&fields=NCTId&fmt=json&max_rnk=1000') yield value with value.StudyFieldsResponse.NStudiesFound as NStudies, RANGE(0,(value.StudyFieldsResponse.NStudiesFound/1000)) as nloop UNWIND nloop as i with range(1+1000*i,1000+1000*i,999) as RANGES @@ -114,8 +129,9 @@ UNWIND study_metadata.NCTId as Id UNWIND study_metadata.IsFDARegulatedDrug as IsFDARegulatedDrug match(ct:ClinicalTrial{NCTId:Id}),(r:Response{YN:'No'}) FOREACH(ignoreMe IN CASE WHEN IsFDARegulatedDrug='No' THEN [1] ELSE [] END | - MERGE(ct)-[:IS_FDA_REGULATED_DRUG]->(r)); -call apoc.load.json('https://clinicaltrials.gov/api/query/study_fields?expr=COVID+AND+NOT+AREA%5BStudyType%5DInterventional+AND+NOT+AREA%5BStudyType%5DObservational&fields=NCTId&fmt=json&max_rnk=1000') yield value + MERGE(ct)-[:IS_FDA_REGULATED_DRUG]->(r)) +; + call apoc.load.json('https://clinicaltrials.gov/api/query/study_fields?expr=COVID+AND+NOT+AREA%5BStudyType%5DInterventional+AND+NOT+AREA%5BStudyType%5DObservational&fields=NCTId&fmt=json&max_rnk=1000') yield value with value.StudyFieldsResponse.NStudiesFound as NStudies, RANGE(0,(value.StudyFieldsResponse.NStudiesFound/1000)) as nloop UNWIND nloop as i with range(1+1000*i,1000+1000*i,999) as RANGES @@ -132,8 +148,9 @@ UNWIND study_metadata.NCTId as Id match(ct:ClinicalTrial{NCTId:Id}),(r:Response{YN:'No'}) UNWIND study_metadata.IsFDARegulatedDevice as IsFDARegulatedDevice FOREACH(ignoreMe IN CASE WHEN IsFDARegulatedDevice='No' THEN [1] ELSE [] END | - MERGE(ct)-[:IS_FDA_REGULATED_DEVICE]->(r)); -call apoc.load.json('https://clinicaltrials.gov/api/query/study_fields?expr=COVID+AND+NOT+AREA%5BStudyType%5DInterventional+AND+NOT+AREA%5BStudyType%5DObservational&fields=NCTId&fmt=json&max_rnk=1000') yield value + MERGE(ct)-[:IS_FDA_REGULATED_DEVICE]->(r)) +; + call apoc.load.json('https://clinicaltrials.gov/api/query/study_fields?expr=COVID+AND+NOT+AREA%5BStudyType%5DInterventional+AND+NOT+AREA%5BStudyType%5DObservational&fields=NCTId&fmt=json&max_rnk=1000') yield value with value.StudyFieldsResponse.NStudiesFound as NStudies, RANGE(0,(value.StudyFieldsResponse.NStudiesFound/1000)) as nloop UNWIND nloop as i with range(1+1000*i,1000+1000*i,999) as RANGES @@ -150,8 +167,9 @@ UNWIND study_metadata.NCTId as Id match(ct:ClinicalTrial{NCTId:Id}),(r:Response{YN:'No'}) UNWIND study_metadata.HasExpandedAccess as HasExpandedAccess FOREACH(ignoreMe IN CASE WHEN HasExpandedAccess='No' THEN [1] ELSE [] END | - MERGE(ct)-[:HAS_EXPANDED_ACCESS]->(r)); -call apoc.load.json('https://clinicaltrials.gov/api/query/study_fields?expr=COVID+AND+NOT+AREA%5BStudyType%5DInterventional+AND+NOT+AREA%5BStudyType%5DObservational&fields=NCTId&fmt=json&max_rnk=1000') yield value + MERGE(ct)-[:HAS_EXPANDED_ACCESS]->(r)) +; + call apoc.load.json('https://clinicaltrials.gov/api/query/study_fields?expr=COVID+AND+NOT+AREA%5BStudyType%5DInterventional+AND+NOT+AREA%5BStudyType%5DObservational&fields=NCTId&fmt=json&max_rnk=1000') yield value with value.StudyFieldsResponse.NStudiesFound as NStudies, RANGE(0,(value.StudyFieldsResponse.NStudiesFound/1000)) as nloop UNWIND nloop as i with range(1+1000*i,1000+1000*i,999) as RANGES @@ -170,8 +188,9 @@ UNWIND study_metadata.Keyword as Keyword MERGE(ct)-[:IS_STUDYING]->(k:Keyword{word:Keyword}) with ct, t, study_metadata UNWIND study_metadata.DetailedDescription as DetailedDescription -set t.description=DetailedDescription; -call apoc.load.json('https://clinicaltrials.gov/api/query/study_fields?expr=COVID+AND+NOT+AREA%5BStudyType%5DInterventional+AND+NOT+AREA%5BStudyType%5DObservational&fields=NCTId&fmt=json&max_rnk=1000') yield value +set t.description=DetailedDescription +; + call apoc.load.json('https://clinicaltrials.gov/api/query/study_fields?expr=COVID+AND+NOT+AREA%5BStudyType%5DInterventional+AND+NOT+AREA%5BStudyType%5DObservational&fields=NCTId&fmt=json&max_rnk=1000') yield value with value.StudyFieldsResponse.NStudiesFound as NStudies, RANGE(0,(value.StudyFieldsResponse.NStudiesFound/1000)) as nloop UNWIND nloop as i with range(1+1000*i,1000+1000*i,999) as RANGES @@ -182,8 +201,9 @@ UNWIND study_metadata.NCTId as Id UNWIND study_metadata.DesignObservationalModel as Model match(ct:ClinicalTrial{NCTId:Id}) MERGE(m:Design{model:Model}) -MERGE (ct)-[:HAS_STUDY_DESIGN]->(m); -call apoc.load.json('https://clinicaltrials.gov/api/query/study_fields?expr=COVID+AND+NOT+AREA%5BStudyType%5DInterventional+AND+NOT+AREA%5BStudyType%5DObservational&fields=NCTId&fmt=json&max_rnk=1000') yield value +MERGE (ct)-[:HAS_STUDY_DESIGN]->(m) +; + call apoc.load.json('https://clinicaltrials.gov/api/query/study_fields?expr=COVID+AND+NOT+AREA%5BStudyType%5DInterventional+AND+NOT+AREA%5BStudyType%5DObservational&fields=NCTId&fmt=json&max_rnk=1000') yield value with value.StudyFieldsResponse.NStudiesFound as NStudies, RANGE(0,(value.StudyFieldsResponse.NStudiesFound/1000)) as nloop UNWIND nloop as i with range(1+1000*i,1000+1000*i,999) as RANGES @@ -194,8 +214,9 @@ UNWIND study_metadata.NCTId as Id UNWIND study_metadata.DesignTimePerspective as DesignTimePerspective match(ct:ClinicalTrial{NCTId:Id}) MERGE(t:ObservationPeriod{time:DesignTimePerspective}) -MERGE (ct)-[:HAS_OBSERVATION_PERIOD]->(t); -call apoc.load.json('https://clinicaltrials.gov/api/query/study_fields?expr=COVID+AND+NOT+AREA%5BStudyType%5DInterventional+AND+NOT+AREA%5BStudyType%5DObservational&fields=NCTId&fmt=json&max_rnk=1000') yield value +MERGE (ct)-[:HAS_OBSERVATION_PERIOD]->(t) +; + call apoc.load.json('https://clinicaltrials.gov/api/query/study_fields?expr=COVID+AND+NOT+AREA%5BStudyType%5DInterventional+AND+NOT+AREA%5BStudyType%5DObservational&fields=NCTId&fmt=json&max_rnk=1000') yield value with value.StudyFieldsResponse.NStudiesFound as NStudies, RANGE(0,(value.StudyFieldsResponse.NStudiesFound/1000)) as nloop UNWIND nloop as i with range(1+1000*i,1000+1000*i,999) as RANGES @@ -209,8 +230,9 @@ MERGE(b:BioSpecimen{retension:BioSpecRetention}) MERGE(ct)-[:HAS_SMAPLES_RETAINED_IN_BIOREPOSITORY]->(b) with b, study_metadata UNWIND study_metadata.BioSpecDescription as BioSpecDescription -SET b.description=BioSpecDescription; -call apoc.load.json('https://clinicaltrials.gov/api/query/study_fields?expr=COVID+AND+NOT+AREA%5BStudyType%5DInterventional+AND+NOT+AREA%5BStudyType%5DObservational&fields=NCTId&fmt=json&max_rnk=1000') yield value +SET b.description=BioSpecDescription +; + call apoc.load.json('https://clinicaltrials.gov/api/query/study_fields?expr=COVID+AND+NOT+AREA%5BStudyType%5DInterventional+AND+NOT+AREA%5BStudyType%5DObservational&fields=NCTId&fmt=json&max_rnk=1000') yield value with value.StudyFieldsResponse.NStudiesFound as NStudies, RANGE(0,(value.StudyFieldsResponse.NStudiesFound/1000)) as nloop UNWIND nloop as i with range(1+1000*i,1000+1000*i,999) as RANGES @@ -226,8 +248,9 @@ MERGE(a:Arm{name:study_metadata.ArmGroupLabel[i]}) ON CREATE SET a.description=study_metadata.ArmGroupDescription[i] ON CREATE SET a.type=study_metadata.ArmGroupType[i] MERGE(ct)-[:HAS_STUDY_ARMS]->(a)-[:BELONGS_TO_MODEL]->(m) - ); -call apoc.load.json('https://clinicaltrials.gov/api/query/study_fields?expr=COVID+AND+NOT+AREA%5BStudyType%5DInterventional+AND+NOT+AREA%5BStudyType%5DObservational&fields=NCTId&fmt=json&max_rnk=1000') yield value + ) +; + call apoc.load.json('https://clinicaltrials.gov/api/query/study_fields?expr=COVID+AND+NOT+AREA%5BStudyType%5DInterventional+AND+NOT+AREA%5BStudyType%5DObservational&fields=NCTId&fmt=json&max_rnk=1000') yield value with value.StudyFieldsResponse.NStudiesFound as NStudies, RANGE(0,(value.StudyFieldsResponse.NStudiesFound/1000)) as nloop UNWIND nloop as i with range(1+1000*i,1000+1000*i,999) as RANGES @@ -241,8 +264,9 @@ FOREACH(i in nelem | MERGE(ct)-[:INVESTIGATES_INTERVENTION]->(e:Intervention{name:study_metadata.InterventionName[i]}) ON CREATE SET e.description=study_metadata.InterventionDescription[i] ON CREATE SET e.type=study_metadata.InterventionType[i] - ); -call apoc.load.json('https://clinicaltrials.gov/api/query/study_fields?expr=COVID+AND+NOT+AREA%5BStudyType%5DInterventional+AND+NOT+AREA%5BStudyType%5DObservational&fields=NCTId&fmt=json&max_rnk=1000') yield value + ) +; + call apoc.load.json('https://clinicaltrials.gov/api/query/study_fields?expr=COVID+AND+NOT+AREA%5BStudyType%5DInterventional+AND+NOT+AREA%5BStudyType%5DObservational&fields=NCTId&fmt=json&max_rnk=1000') yield value with value.StudyFieldsResponse.NStudiesFound as NStudies, RANGE(0,(value.StudyFieldsResponse.NStudiesFound/1000)) as nloop UNWIND nloop as i with range(1+1000*i,1000+1000*i,999) as RANGES @@ -256,8 +280,9 @@ FOREACH(i in npout | MERGE(ct)-[:HAS_PRIMARY_OUTCOME]->(a:Outcome{name:study_metadata.PrimaryOutcomeMeasure[i]}) ON CREATE SET a.description=study_metadata.PrimaryOutcomeDescription[i] ON CREATE SET a.time=study_metadata.PrimaryOutcomeTimeFrame[i] - ); -call apoc.load.json('https://clinicaltrials.gov/api/query/study_fields?expr=COVID+AND+NOT+AREA%5BStudyType%5DInterventional+AND+NOT+AREA%5BStudyType%5DObservational&fields=NCTId&fmt=json&max_rnk=1000') yield value + ) +; + call apoc.load.json('https://clinicaltrials.gov/api/query/study_fields?expr=COVID+AND+NOT+AREA%5BStudyType%5DInterventional+AND+NOT+AREA%5BStudyType%5DObservational&fields=NCTId&fmt=json&max_rnk=1000') yield value with value.StudyFieldsResponse.NStudiesFound as NStudies, RANGE(0,(value.StudyFieldsResponse.NStudiesFound/1000)) as nloop UNWIND nloop as i with range(1+1000*i,1000+1000*i,999) as RANGES @@ -271,8 +296,9 @@ FOREACH(i in nsout | MERGE(ct)-[:HAS_SECONDARY_OUTCOME]->(a:Outcome{name:study_metadata.SecondaryOutcomeMeasure[i]}) ON CREATE SET a.description=study_metadata.SecondaryOutcomeDescription[i] ON CREATE SET a.time=study_metadata.SecondaryOutcomeTimeFrame[i] - ); -call apoc.load.json('https://clinicaltrials.gov/api/query/study_fields?expr=COVID+AND+NOT+AREA%5BStudyType%5DInterventional+AND+NOT+AREA%5BStudyType%5DObservational&fields=NCTId&fmt=json&max_rnk=1000') yield value + ) +; + call apoc.load.json('https://clinicaltrials.gov/api/query/study_fields?expr=COVID+AND+NOT+AREA%5BStudyType%5DInterventional+AND+NOT+AREA%5BStudyType%5DObservational&fields=NCTId&fmt=json&max_rnk=1000') yield value with value.StudyFieldsResponse.NStudiesFound as NStudies, RANGE(0,(value.StudyFieldsResponse.NStudiesFound/1000)) as nloop UNWIND nloop as i with range(1+1000*i,1000+1000*i,999) as RANGES @@ -286,8 +312,9 @@ FOREACH(i in noout | MERGE(ct)-[:HAS_OTHER_OUTCOME]->(a:Outcome{name:study_metadata.OtherOutcomeMeasure[i]}) ON CREATE SET a.description=study_metadata.OtherOutcomeDescription[i] ON CREATE SET a.time=study_metadata.OtherOutcomeTimeFrame[i] - ); -call apoc.load.json('https://clinicaltrials.gov/api/query/study_fields?expr=COVID+AND+NOT+AREA%5BStudyType%5DInterventional+AND+NOT+AREA%5BStudyType%5DObservational&fields=NCTId&fmt=json&max_rnk=1000') yield value + ) +; + call apoc.load.json('https://clinicaltrials.gov/api/query/study_fields?expr=COVID+AND+NOT+AREA%5BStudyType%5DInterventional+AND+NOT+AREA%5BStudyType%5DObservational&fields=NCTId&fmt=json&max_rnk=1000') yield value with value.StudyFieldsResponse.NStudiesFound as NStudies, RANGE(0,(value.StudyFieldsResponse.NStudiesFound/1000)) as nloop UNWIND nloop as i with range(1+1000*i,1000+1000*i,999) as RANGES @@ -301,8 +328,9 @@ MERGE (p:StudyPopulation{name:StudyPopulation}) MERGE (ct)-[:HAS_STUDY_POPULATION]->(p) with study_metadata, ct, p UNWIND study_metadata.SamplingMethod as SamplingMethod -SET p.sampling=SamplingMethod; -call apoc.load.json('https://clinicaltrials.gov/api/query/study_fields?expr=COVID+AND+NOT+AREA%5BStudyType%5DInterventional+AND+NOT+AREA%5BStudyType%5DObservational&fields=NCTId&fmt=json&max_rnk=1000') yield value +SET p.sampling=SamplingMethod +; + call apoc.load.json('https://clinicaltrials.gov/api/query/study_fields?expr=COVID+AND+NOT+AREA%5BStudyType%5DInterventional+AND+NOT+AREA%5BStudyType%5DObservational&fields=NCTId&fmt=json&max_rnk=1000') yield value with value.StudyFieldsResponse.NStudiesFound as NStudies, RANGE(0,(value.StudyFieldsResponse.NStudiesFound/1000)) as nloop UNWIND nloop as i with range(1+1000*i,1000+1000*i,999) as RANGES @@ -316,8 +344,9 @@ UNWIND study_metadata.Gender as Gender MERGE (ct)-[:INCLUDES_GENDER]->(g:Gender{name:Gender}) with ct, g, study_metadata UNWIND study_metadata.GenderDescription as GenderDescription -set g.description=GenderDescription; -call apoc.load.json('https://clinicaltrials.gov/api/query/study_fields?expr=COVID+AND+NOT+AREA%5BStudyType%5DInterventional+AND+NOT+AREA%5BStudyType%5DObservational&fields=NCTId&fmt=json&max_rnk=1000') yield value +set g.description=GenderDescription +; + call apoc.load.json('https://clinicaltrials.gov/api/query/study_fields?expr=COVID+AND+NOT+AREA%5BStudyType%5DInterventional+AND+NOT+AREA%5BStudyType%5DObservational&fields=NCTId&fmt=json&max_rnk=1000') yield value with value.StudyFieldsResponse.NStudiesFound as NStudies, RANGE(0,(value.StudyFieldsResponse.NStudiesFound/1000)) as nloop UNWIND nloop as i with range(1+1000*i,1000+1000*i,999) as RANGES @@ -329,8 +358,9 @@ match(ct:ClinicalTrial{NCTId:Id}) with study_metadata, ct UNWIND study_metadata.MinimumAge as MinAge UNWIND study_metadata.MaximumAge as MaxAge -MERGE (ct)-[:INCLUDES_AGE_RANGE]->(a:AgeRange{minAge:MinAge,maxAge:MaxAge}); -call apoc.load.json('https://clinicaltrials.gov/api/query/study_fields?expr=COVID+AND+NOT+AREA%5BStudyType%5DInterventional+AND+NOT+AREA%5BStudyType%5DObservational&fields=NCTId&fmt=json&max_rnk=1000') yield value +MERGE (ct)-[:INCLUDES_AGE_RANGE]->(a:AgeRange{minAge:MinAge,maxAge:MaxAge}) +; + call apoc.load.json('https://clinicaltrials.gov/api/query/study_fields?expr=COVID+AND+NOT+AREA%5BStudyType%5DInterventional+AND+NOT+AREA%5BStudyType%5DObservational&fields=NCTId&fmt=json&max_rnk=1000') yield value with value.StudyFieldsResponse.NStudiesFound as NStudies, RANGE(0,(value.StudyFieldsResponse.NStudiesFound/1000)) as nloop UNWIND nloop as i with range(1+1000*i,1000+1000*i,999) as RANGES @@ -340,15 +370,16 @@ with value.StudyFieldsResponse.StudyFields as coll unwind coll as study_metadata UNWIND study_metadata.NCTId as Id match(ct:ClinicalTrial{NCTId:Id}) UNWIND study_metadata.EligibilityCriteria as EligibilityCriteria -with study_metadata, ct, split(replace(replace(trim(substring(EligibilityCriteria,length(split(EligibilityCriteria,"Exclusion")[0])+19,size(EligibilityCriteria))),'\n','#'),'##','#'),'#') as Exclusion, -split(replace(replace(trim(substring(EligibilityCriteria,19,length(split(EligibilityCriteria,"Exclusion")[0])-19)),'\n','#'),'##','#'),'#') as Inclusion -with study_metadata, ct, Inclusion, Exclusion, RANGE(0,size(Inclusion)-1) as nincl +with study_metadata, ct, split(replace(replace(trim(substring(EligibilityCriteria,length(split(EligibilityCriteria,"Exclusion")[0]),size(EligibilityCriteria))),'\n','#'),'##','#'),'#') as Exclusion, +split(replace(replace(trim(substring(EligibilityCriteria,0,length(split(EligibilityCriteria,"Exclusion")[0]))),'\n','#'),'##','#'),'#') as Inclusion +with study_metadata, ct, Inclusion, Exclusion, RANGE(1,size(Inclusion)-1) as nincl FOREACH(i in nincl | MERGE(ct)-[:HAS_INCLUSION_CRITERIA]->(incl:InclusionCriteria{criteria:Inclusion[i]})) -with study_metadata, ct, Inclusion, Exclusion, RANGE(0,size(Exclusion)-1) as nexcl +with study_metadata, ct, Inclusion, Exclusion, RANGE(1,size(Exclusion)-1) as nexcl FOREACH(i in nexcl | -MERGE(ct)-[:HAS_EXCLUSION_CRITERIA]->(excl:ExclusionCriteria{criteria:Exclusion[i]})); -call apoc.load.json('https://clinicaltrials.gov/api/query/study_fields?expr=COVID+AND+NOT+AREA%5BStudyType%5DInterventional+AND+NOT+AREA%5BStudyType%5DObservational&fields=NCTId&fmt=json&max_rnk=1000') yield value +MERGE(ct)-[:HAS_EXCLUSION_CRITERIA]->(excl:ExclusionCriteria{criteria:Exclusion[i]})) +; + call apoc.load.json('https://clinicaltrials.gov/api/query/study_fields?expr=COVID+AND+NOT+AREA%5BStudyType%5DInterventional+AND+NOT+AREA%5BStudyType%5DObservational&fields=NCTId&fmt=json&max_rnk=1000') yield value with value.StudyFieldsResponse.NStudiesFound as NStudies, RANGE(0,(value.StudyFieldsResponse.NStudiesFound/1000)) as nloop UNWIND nloop as i with range(1+1000*i,1000+1000*i,999) as RANGES @@ -359,8 +390,9 @@ UNWIND study_metadata.NCTId as Id match(ct:ClinicalTrial{NCTId:Id}) UNWIND study_metadata.CentralContactName as Name UNWIND study_metadata.CentralContactEMail as Email -MERGE (ct)-[:HAS_CONTACT_PERSON]->(c:Contact{name:Name,email:Email}); -call apoc.load.json('https://clinicaltrials.gov/api/query/study_fields?expr=COVID+AND+NOT+AREA%5BStudyType%5DInterventional+AND+NOT+AREA%5BStudyType%5DObservational&fields=NCTId&fmt=json&max_rnk=1000') yield value +MERGE (ct)-[:HAS_CONTACT_PERSON]->(c:Contact{name:Name,email:Email}) +; + call apoc.load.json('https://clinicaltrials.gov/api/query/study_fields?expr=COVID+AND+NOT+AREA%5BStudyType%5DInterventional+AND+NOT+AREA%5BStudyType%5DObservational&fields=NCTId&fmt=json&max_rnk=1000') yield value with value.StudyFieldsResponse.NStudiesFound as NStudies, RANGE(0,(value.StudyFieldsResponse.NStudiesFound/1000)) as nloop UNWIND nloop as i with range(1+1000*i,1000+1000*i,999) as RANGES @@ -382,8 +414,9 @@ FOREACH(i in ncity | MERGE(ci:City{name:study_metadata.LocationCity[i]}) MERGE(c:Country{name:study_metadata.LocationCountry[i]}) MERGE(ci)-[:LOCATED_IN]->(c) - ); -call apoc.load.json('https://clinicaltrials.gov/api/query/study_fields?expr=COVID+AND+NOT+AREA%5BStudyType%5DInterventional+AND+NOT+AREA%5BStudyType%5DObservational&fields=NCTId&fmt=json&max_rnk=1000') yield value + ) +; + call apoc.load.json('https://clinicaltrials.gov/api/query/study_fields?expr=COVID+AND+NOT+AREA%5BStudyType%5DInterventional+AND+NOT+AREA%5BStudyType%5DObservational&fields=NCTId&fmt=json&max_rnk=1000') yield value with value.StudyFieldsResponse.NStudiesFound as NStudies, RANGE(0,(value.StudyFieldsResponse.NStudiesFound/1000)) as nloop UNWIND nloop as i with range(1+1000*i,1000+1000*i,999) as RANGES @@ -405,6 +438,9 @@ FOREACH(i in nref | with ct, study_metadata UNWIND study_metadata.SeeAlsoLinkURL as URL MERGE(l:Link{url:URL}) -MERGE(ct)-[:REFERS_TO_URL]->(l); -match(i:InclusionCriteria) where i.criteria in ['-', 'none'] DETACH DELETE i; -match(e:ExclusionCriteria) where e.criteria in ['-', 'none'] DETACH DELETE e; +MERGE(ct)-[:REFERS_TO_URL]->(l) +; + match(i:InclusionCriteria) where i.criteria in ['-', 'none'] DETACH DELETE i +; + match(e:ExclusionCriteria) where e.criteria in ['-', 'none'] DETACH DELETE e +;