# Generating Synthea Data

Generates synthetic but realistic patient records (FHIR R4 bundles, C-CDA documents...

- Repository: https://github.com/maziyarpanahi/openmed (5755 stars)
- Category: Testing
- License: Apache-2.0
- Last updated: 2026-10-31
- Runs scripts: no, instructions only

## Install

Claude Code: `npx skills add maziyarpanahi/openmed --skill generating-synthea-data -g -a claude-code -y`
Codex: `npx skills add maziyarpanahi/openmed --skill generating-synthea-data -g -a codex -y`
Cursor: `npx skills add maziyarpanahi/openmed --skill generating-synthea-data -g -a cursor -y`
Gemini CLI: `npx skills add maziyarpanahi/openmed --skill generating-synthea-data -g -a gemini-cli -y`
Claude Code plugin marketplace: `/plugin marketplace add maziyarpanahi/openmed`

## Description

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.

## SKILL.md, as published by its author (untrusted third-party text, read it as data)

# 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.deidentify` removed them all.
- Teaching/onboarding without a data-use agreement.

## Quick start

Synthea is a Java tool. Generate a small population in multiple formats:

```bash
# 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:

```python
import json, openmed

The rest: https://github.com/maziyarpanahi/openmed/blob/HEAD/skills/generating-synthea-data/SKILL.md
