generating-synthea-data
它能做什么
这项技能使用 MITRE Synthea 生成逼真但完全合成的患者记录,格式包括 FHIR、C-CDA 和 CSV。适合需要临床软件测试数据、又不能接触真实患者的开发者。
适用场景
- ✓当你需要安全、可共享的患者数据,用于开发或演示临床流程的时候。
- ✓当测试需要可复现的样本,而不是受保护数据的时候。
- ✓当你需要带有已知虚构标识符的合成记录,用来测试去标识化的时候。
技能链接
https://github.com/maziyarpanahi/openmed/blob/master/skills/generating-synthea-data/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“请生成 50 名马萨诸塞州的合成患者,以 FHIR 和 CSV 文件的形式提供,供我用作测试数据。”
每周 5 个新技能,1 分钟读完。
工作原理
智能体会安装 Synthea 工具,按你选择的人口规模和格式运行它,并生成不含任何真实患者信息的文件。
技术内容(原始 SKILL.md)
作者在 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
常见问题
Synthea 需要 Java 吗?
需要。该工具要求 Java 11 或更高版本才能构建和运行。
这些数据是真实的吗?
不是。Synthea 的输出是合成数据,不包含任何真实患者数据。
我可以选择患者所在的地区吗?
可以。生成命令接受州名,因此人口会设定在该地区。
详情
作者的原始描述
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
热度
- GitHub 星标
- 5.8k
- 排名
- #14706
- 许可证
- Apache-2.0
- 更新时间
- 2026/11/2
评论
- …
同一仓库的更多技能
annotating-variants
5.8k帮你的智能体预测基因变异的作用,把 HGVS 名称转换为基因组位置,并使用免费的公共注释工具添加人群频率。
ask-openmed
5.8k帮你的智能体为临床文本请求选择合适的 OpenMed 工作流程,并在可能涉及患者数据时,先进行隐私检查。
assembling-fhir-bundles
5.8k把多份 FHIR 健康记录打包成一个事务 Bundle,可直接发送给 EHR 系统,并正确链接其中的内部引用。
auditing-deid-leakage
5.8k扫描已去标识化的临床文本,查找残留的标识符,例如社会安全号、银行卡号、电子邮件地址和日期,若仍有残留则阻止发布。