synthetichealth / synthea

Synthetic Patient Population Simulator
https://synthetichealth.github.io/synthea
Apache License 2.0
2.19k stars 655 forks source link

ArrayIndexOutOfBoundsException - FHIR R4 Provenance #718

Open ferret1964 opened 4 years ago

ferret1964 commented 4 years ago

Running the latest master branch with following command I consistently get an ArrayIndexOutOfBounds exeception. The command line is

java -jar build/libs/synthea-with-dependencies.jar --exporter.fhir.use_us_core_ig true --generate.append_numbers_to_person_names=false --exporter.split_records=true --exporter.split_records.duplicate_data=true --exporter.baseDirectory ../synthea_output/test4/san_diego -p 100 --exporter.years_of_history 20 California "San Diego" ... The problem code area is:

// Provenance sources... int last = person.record.encounters.size() - 1; Clinician clinician = person.record.encounters.get(last).clinician; <---- Problem Line String practitionerFullUrl = findPractitioner(clinician, bundle); Provider providerOrganization = person.record.provider;

----- Comments ----- last must be out of bounds. Tested this against the build bundle from Github and don't get the error, but looking inside it it seems to date from November.. It appears to be a side effect of the US Core update.

----- Extract from the console ----- 7 -- Marcell Wilderman (77 y/o F) San Diego, California DECEASED 10 -- Hershel Balistreri (19 y/o M) San Diego, California 11 -- Tobias Larson (22 y/o M) San Diego, California 9 -- Joey Bosco (45 y/o F) San Diego, California java.lang.ArrayIndexOutOfBoundsException: -1 at java.util.ArrayList.elementData(ArrayList.java:418) at java.util.ArrayList.get(ArrayList.java:431) at org.mitre.synthea.export.FhirR4.provenance(FhirR4.java:1721) at org.mitre.synthea.export.FhirR4.convertToFHIR(FhirR4.java:316) at org.mitre.synthea.export.FhirR4.convertToFHIRJson(FhirR4.java:331) at org.mitre.synthea.export.Exporter.exportRecord(Exporter.java:209) at org.mitre.synthea.export.Exporter.export(Exporter.java:131) at org.mitre.synthea.engine.Generator.generatePerson(Generator.java:440) at org.mitre.synthea.engine.Generator.lambda$run$53(Generator.java:315) at org.mitre.synthea.engine.Generator$$Lambda$28/277497558.call(Unknown Source) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745) 12 -- Lourdes Rangel (26 y/o F) San Diego, California

ferret1964 commented 4 years ago

In further testing it seems to be an interaction between split_records and US_Core.