generating-synthea-data
What it does
This skill generates realistic but fully synthetic patient records with MITRE Synthea, in FHIR, C-CDA and CSV formats. It is for developers who need test data for clinical software without touching real patients.
When to use it
- ✓When you need safe, shareable patient data for developing or demoing a clinical pipeline.
- ✓When tests need reproducible fixtures instead of protected data.
- ✓When you need synthetic notes with known fake identifiers to test de-identification.
Skill link
https://github.com/maziyarpanahi/openmed/blob/master/skills/generating-synthea-data/SKILL.mdCopy it and paste it into your AI (Claude, ChatGPT or Cursor), asking it to follow the instructions.
How to use
The easiest way: copy the message and paste it into your AI. It reads the skill and follows the instructions.
Ready-to-paste message
For Claude Code, Codex or Cursor: run it in your project folder and the skill gets installed.
Download the SKILL.md and drop it into your agent’s skills folder.
Example of what to ask your AI
“Generate 50 synthetic patients in Massachusetts as FHIR and CSV files that I can use as test data.”
5 new skills a week. 1 minute to read.
How it works
The agent sets up the Synthea tool, runs it with the population size and formats you choose, and produces files that contain no real patient information.
Technical content (original SKILL.md)
Original text by the author, straight from GitHub.
Generating Synthetic Patient Data with Synthea
You cannot develop, test, or demo a clinical NLP pipeline on real PHI without a mountain of governance — and you shouldn't have to. Synthea (MITRE's Synthetic Patient Population Simulator) generates statistically realistic, fully synthetic patients: complete longitudinal records as FHIR R4 bundles, C-CDA documents, and flat CSV, with zero real-PHI risk. Use it for OpenMed dev fixtures, CI, demos, and — importantly — as held-out test sets for de-identification leakage gates, where you need known-synthetic "PHI" to measure recall.
When to use
- Building or demoing an OpenMed ingestion pipeline (FHIR, C-CDA) and need shareable input that is safe to commit and pass around.
- Creating deterministic CI fixtures so tests don't depend on protected data.
- Producing a leakage-gate test corpus: synthetic notes with known fake
identifiers, so you can score whether
openmed.deidentifyremoved them all. - Teaching/onboarding without a data-use agreement.
Quick start
Synthea is a Java tool. Generate a small population in multiple formats:
# Requires Java 11+. Clone and build once.
git clone https://github.com/synthetichealth/synthea && cd synthea
./gradlew build -x test
# Generate 50 patients in Massachusetts as FHIR R4 + C-CDA + CSV.
./run_synthea -p 50 Massachusetts \
--exporter.fhir.export=true \
--exporter.ccda.export=true \
--exporter.csv.export=true \
--exporter.baseDirectory=./output
# Reproducible runs: fix the seed so fixtures are stable across CI.
./run_synthea -s 12345 -p 20 --exporter.baseDirectory=./fixtures
Output lands under output/fhir/, output/ccda/, and output/csv/. Feed the
FHIR bundles to parsing-... skills, or hand narrative straight to OpenMed:
import json, openmed
bundle = json.load(open("output/fhir/Patient_xyz.json"))
for entry in bundle.get("entry", []):
res = entry.get("resource", {})
div = (res.get("text") or {}).get("div", "") # narrative XHTML
if div.strip():
deid = openmed.deidentify(div, method="replace", policy="hipaa_safe_harbor")
result = openmed.analyze_text(deid.text, output_format="dict")
Synthea data is synthetic, so de-identifying it is exercising the pipeline, not a privacy requirement — which is exactly what makes it a great test bed.
Workflow
- Choose scale & geography.
-p Nsets population; the state/location argument shapes demographics and addresses. Start small (10–50) for fixtures. - Pick formats. Enable FHIR (
exporter.fhir.export), C-CDA (exporter.ccda.export), and/or CSV per your ingestion path. FHIR R4 is the default and pairs withfetching-fhir-resources; C-CDA pairs withparsing-ccda-documents. - Pin a seed (
-s) for reproducible fixtures so test assertions are stable. - Select modules (optional). Synthea ships disease modules
(
-m "diabetes*"to filter); choose modules matching the entities your OpenMed pipeline targets. - Use as a leakage-gate corpus. Synthea emits known fake names, MRNs,
addresses, and dates — inject/collect these as ground-truth PHI spans and
score
openmed.deidentifyrecall withopenmed.eval(evaluating-with-leakage-gates). Because the "PHI" is synthetic and known, you can measure misses without exposing anyone. - Commit fixtures under your test tree (e.g.
tests/fixtures/synthea/) — it is safe to version-control synthetic output.
Hand-off to / from OpenMed
- To OpenMed (as input): Synthea FHIR/C-CDA narrative →
openmed.deidentify→openmed.analyze_text, via thefetching-fhir-resourcesandparsing-ccda-documentsskills. - To OpenMed eval: use Synthea's known synthetic identifiers as ground truth
for
openmed.evalde-identification leakage gates — the daily-release thesis gates on leakage, not F1 alone, and synthetic data lets you build that test set without governance overhead. - Adjacent, not in-pipeline: Synthea is a source of safe data; it does not call OpenMed and OpenMed does not call it. Keep it in dev/CI, never as a production data source.
Edge cases & gotchas
- Synthetic ≠ statistically perfect. Synthea reproduces realistic disease progression and demographics but is not a substitute for real-world distribution validation; never report clinical model accuracy only on synthetic data.
- Narrative is templated. FHIR
text.divnarrative is genera
FAQ
Does Synthea need Java?
Yes. The tool requires Java 11 or newer to build and run.
Is the data real?
No. Synthea outputs are synthetic and contain zero real patient data.
Can I choose the area the patients come from?
Yes. The generator command takes a state name, so the population is set for that area.
Details
Original description by the author
Generates synthetic but realistic patient records (FHIR R4 bundles, C-CDA documents, CSV) with MITRE Synthea for development, CI fixtures, demos, and leakage-gate test sets — zero real PHI. Use when you need safe, shareable test data for an OpenMed pipeline, reproducible fixtures for tests, or a held-out set for de-identification leakage gates, instead of touching real clinical data. Synthea output feeds the FHIR/C-CDA ingestion skills and openmed.eval. Trigger keywords: Synthea, synthetic data, fake patients, test fixtures, demo data, FHIR bundle generator, synthetic EHR, no PHI.
repo: maziyarpanahi/openmed
Popularity
- GitHub stars
- 5.8k
- Ranking position
- #14706
- License
- Apache-2.0
- Updated
- 11/2/2026
Comments
- …
More skills from this repository
annotating-variants
5.8kHelps your agent predict what a genetic variant does, convert HGVS names to genome positions and attach population frequencies, using free public annotators.
ask-openmed
5.8kHelps your agent pick the right OpenMed workflow for a clinical text request, starting with a privacy check whenever patient data may be present.
assembling-fhir-bundles
5.8kPackages several FHIR health records into one transaction Bundle ready to send to an EHR, with the internal references linked correctly.
auditing-deid-leakage
5.8kScans de-identified clinical text for leftover identifiers such as SSNs, card numbers, emails and dates, and blocks release if any remain.
Similar skills
test-driven-development
311kTeaches your agent to write a failing test first, watch it fail, then write the smallest code that passes, before building any feature or fix.
verification-before-completion
311kTeaches your agent to run real checks and read their output before claiming that a task, fix, or build is complete or passing.
migrate-to-shoehorn
310kReplaces risky type casts in your test files with the shoehorn library, so tests can use partial data and still pass type checks.