Skip to content

Commit

Permalink
exporter.fhir.personal_data
Browse files Browse the repository at this point in the history
  • Loading branch information
awatson1978 committed Aug 15, 2023
1 parent 3d14806 commit 7c802c9
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/main/java/org/mitre/synthea/export/Exporter.java
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,17 @@ private static boolean exportRecord(Person person, String fileTag, long stopTime
String entryJson = parser.encodeResourceToString(entry.getResource());
appendToFile(outFilePath, entryJson);
}
// } else if (Config.getAsBoolean("exporter.fhir.longitudinal_data")) {
} else if (Config.getAsBoolean("exporter.fhir.personal_data")) {
org.hl7.fhir.r4.model.Bundle bundle = FhirR4.convertToFHIR(person, stopTime);
//IParser parser = FhirR4.getContext().newNdJsonParser().setPrettyPrint(false);
IParser parser = FhirR4.getContext().newJsonParser().setPrettyPrint(false);
for (org.hl7.fhir.r4.model.Bundle.BundleEntryComponent entry : bundle.getEntry()) {
String filename = entry.getResource().getResourceType().toString() + ".ndjson";
Path outFilePath = outDirectory.toPath().resolve(filename);
String entryJson = parser.encodeResourceToString(entry.getResource());
appendToFile(outFilePath, entryJson);
}
} else {
String bundleJson = FhirR4.convertToFHIRJson(person, stopTime);
Path outFilePath = outDirectory.toPath().resolve(filename(person, fileTag, "json"));
Expand Down

0 comments on commit 7c802c9

Please sign in to comment.