-
Notifications
You must be signed in to change notification settings - Fork 2
Export Formats
Roberto Cruz edited this page May 15, 2026
·
2 revisions
Synthea can export synthetic patient data in three formats: FHIR R4, CSV, and JSON. Each is controlled independently in synthea.properties.
FHIR R4 is enabled by default. Each patient is exported as a transaction Bundle containing all their clinical resources.
exporter.fhir.export = trueoutput/fhir/
├── hospitalInformation<timestamp>.json # Organization / Location resources
├── practitionerInformation<timestamp>.json # Practitioner resources
├── Ada_Howell_<uuid>.json # One Bundle per patient
└── ...
Each patient bundle includes:
| Resource | Description |
|---|---|
Patient |
Demographics, identifiers, address |
Encounter |
All clinical visits |
Condition |
Active and historical diagnoses |
MedicationRequest |
Prescriptions |
Observation |
Labs, vitals, social history |
Procedure |
Surgical and clinical procedures |
Immunization |
Vaccination history |
AllergyIntolerance |
Known allergies |
CarePlan |
Active care plans |
DiagnosticReport |
Lab and imaging reports |
ImagingStudy |
Radiology studies |
Claim |
Insurance claims |
ExplanationOfBenefit |
EOB records |
Coverage |
Insurance coverage periods |
Organization |
Providers and payers |
Practitioner |
Clinicians |
exporter.fhir.server_url = https://fhir.example.com/r4
exporter.fhir.transaction_bundle = trueimport json
from pathlib import Path
bundle_path = Path("output/fhir/Jane_Doe_abc123.json")
bundle = json.loads(bundle_path.read_text())
for entry in bundle["entry"]:
rt = entry["resource"]["resourceType"]
print(rt)CSV export produces one table per resource type — useful for database ingestion and analytics.
exporter.csv.export = true| File | Contents |
|---|---|
patients.csv |
One row per patient |
encounters.csv |
All encounters |
conditions.csv |
All diagnoses |
medications.csv |
All medication orders |
observations.csv |
Labs and vitals |
procedures.csv |
All procedures |
immunizations.csv |
Vaccines |
allergies.csv |
Allergy records |
careplans.csv |
Care plan entries |
claims.csv |
Insurance claims |
claims_transactions.csv |
Line items |
payers.csv |
Payer / insurance info |
providers.csv |
Provider info |
organizations.csv |
Facility info |
devices.csv |
Medical device records |
import pandas as pd
patients = pd.read_csv("output/csv/patients.csv")
conditions = pd.read_csv("output/csv/conditions.csv")
diabetic = conditions[conditions["DESCRIPTION"].str.contains("diabetes", case=False)]
diabetic_ids = diabetic["PATIENT"].unique()
diabetic_patients = patients[patients["Id"].isin(diabetic_ids)]
print(diabetic_patients[["FIRST", "LAST", "BIRTHDATE", "GENDER"]].head())Raw JSON export writes the internal Synthea patient object, before FHIR mapping. Useful for debugging modules or building custom exporters.
exporter.json.export = trueOutput: output/json/<PatientName>_<uuid>.json
# Where files are written
exporter.baseDirectory = ./output/
# Use UUID filenames (avoids special characters in patient names)
exporter.use_uuid_filenames = false
# Append to existing CSV files (false = overwrite each run)
exporter.append_mode = false
# Skip living patients (emit deceased only)
exporter.only_living = falseuv run synthea -p 100 -c <(cat <<EOF
exporter.fhir.export = true
exporter.csv.export = true
exporter.json.export = true
exporter.baseDirectory = ./output/
EOF
)