Open theGOTOguy opened 3 years ago
Just change the parameter setting to use batch bundles.
exporter.fhir.transaction_bundle = false
You can change that in the src/main/resources/synthea.properties
file, or using --exporter.fhir.transaction_bundle=false
as an extra command line parameter.
Setting --exporter.fhir.transaction_bundle=false
outputs a collection-type bundle, not a batch-type bundle. From the perspective of a backend and from the FHIR spec itself, this is not the same thing. You can straightforwardly confirm that your proposed solution doesn't work:
Start a vanilla HAPI FHIR server in Docker:
docker run -p 8080:8080 hapiproject/hapi:latest
Create some Synthea data:
git clone https://github.com/synthetichealth/synthea.git
cd synthea
./gradlew build check test
./run_synthea -p 100 -exporter.fhir.transaction_bundle=false
Attempt to upload any of the generated files. This will fail because a collection-type Bundle does not include any information on how the server is to process it, as opposed to a batch-type or transaction-type bundle.
for file in output/fhir/hospitalInformation*; do curl -X POST --header "Content-Type: application/json" -d @$file http://localhost:8080/fhir/; done
for file in output/fhir/practitionerInformation*; do curl -X POST --header "Content-Type: application/json" -d @$file http://localhost:8080/fhir/; done
for file in output/fhir/[A-Z]*.json; do curl -X POST --header "Content-Type: application/json" -d @$file http://localhost:8080/fhir/; done
Does anyone have a solution to this problem after 3 years?
For anyone using Python, hereby a script to convert the collection-bundles to transaction bundles: https://gist.github.com/kwuite/5f2230965a00566635e798af36d241ea
Some FHIR backends do not support transaction bundles, and it doesn't appear that there's any reason that Synthea couldn't directly output batch bundles for backend testing or for faster ingestion.
If anyone is aware of an active, well-documented, open-source tool that can convert Synthea's transaction bundles to batch bundles, I would welcome that information.