Data
Generate synthetic patients
Use Synthea to create realistic patient histories as FHIR bundles, with control over size, age and repeatability.
Synthea simulates people from birth to now: encounters, conditions, medications, observations, immunisations and claims. The patients are realistic but entirely fictional.
The current dataset was generated with seed 42: 50 living patients plus 11 who died during the simulation, so 61 patients in total, placed in Massachusetts.
Generate a new population#
Synthea is a Java jar. The lab box has no Java installed, so run it in a throwaway Java container:
cd ~/fhir-lab/synthea
docker run --rm -u $(id -u):$(id -g) -v "$PWD":/s -w /s eclipse-temurin:21-jre \
java -jar synthea.jar -p 20 -s 2026 -a 18-65 Massachusetts| Option | Meaning |
|---|---|
-p 20 |
20 living patients (people who died in the simulation are added on top) |
-s 2026 |
Random seed. The same seed gives the same people every time |
-a 18-65 |
Age range |
-g F |
Only female (or M) |
-m diabetes |
Only run the module(s) whose name matches, for example diabetes |
Massachusetts "Boston" |
State and optional city. Synthea only ships US geography |
Output lands in output/fhir/:
- One transaction Bundle per patient, named
Given###_Family###_<uuid>.json. hospitalInformation<timestamp>.jsonandpractitionerInformation<timestamp>.json, which hold the Organizations and Practitioners the patient bundles refer to. Load these first.
Keep runs separate
Move the old output/ aside before a new run (mv output output-$(date +%F)). Otherwise the hospital and practitioner files from different runs pile up in one folder and get mixed together.
What Synthea data looks like#
- Names have digits on the end, such as
Agnes294. That's deliberate, so nobody mistakes them for real people. The HL7 sender strips the digits. - US-flavoured content: US Core profiles, race and ethnicity extensions, US addresses, SSN identifiers, and two Synthea-only extensions (
disability-adjusted-life-years,quality-adjusted-life-years). - Terminology is real: SNOMED CT, LOINC, RxNorm and CVX codes.
Turning this into Australian-looking data is a good exercise in itself; see Make a patient pass AU Core.
Useful config overrides#
Pass --key=value to override synthea.properties:
java -jar synthea.jar -p 10 \
--exporter.fhir.transaction_bundle=true \
--exporter.fhir.use_us_core_ig=false \
--exporter.hospital.fhir.export=true \
--exporter.practitioner.fhir.export=true \
--exporter.years_of_history=5use_us_core_ig=false stops Synthea labelling resources with US Core profiles. years_of_history=5 keeps only the last five years of history, which makes bundles much smaller.