Datasets:
Add README.md
Browse files123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121---license: cc-by-4.0language: - entask_categories: - text2text-generation - table-question-answeringtags: - text-to-sql - clinical - fhir - healthcare - synthetic - duckdb - syntheasize_categories: - 10K<n<100Kconfigs: - config_name: default data_files: - split: train path: train.jsonl - split: heldout_familiar path: heldout_familiar.jsonl - split: heldout_unseen path: heldout_unseen.jsonl---
# FHIR-to-SQL with Database-Resolved Clinical Terminology
Natural-language hospital questions paired with a **structured JSON query plan and compiled DuckDBSQL**, over a FHIR-derived clinical schema. Built entirely from **synthetic** Synthea patients — noreal patient data.
Companion to the paper *Plan-Then-Compile: Turning a General-Purpose Coder Model into a FHIR DataAnalyst*.
- **Code & paper:** https://github.com/adelelsayed/fhirsql-reasoning-sql- **Adapters:** https://huggingface.co/adelelsayed1991/fhirsql-reasoning-sql-adapters
## What makes this dataset different
Gold SQL **never embeds a literal clinical code**. Every query resolves its concept at runtimethrough a lookup against a `valuesets` terminology table:
```sqlWITH resolved AS ( SELECT code, code_system FROM valuesets WHERE table_name = 'procedure' AND display ILIKE '%Depression screening (procedure)%')SELECT DISTINCT patient_idFROM procedure, resolvedWHERE procedure.code = resolved.code AND procedure.system = resolved.code_system AND status = 'completed'```
This turns terminology resolution from a memorization problem into a queryable one, and makesgeneralization to clinical concepts absent from training measurable.
## Splits
| Split | Rows | Answerable | Abstention ||---|---:|---:|---:|| `train` | 10,696 | 9,680 | 1,016 || `heldout_familiar` | 9,300 | 8,284 | 1,016 || `heldout_unseen` | 2,156 | 1,140 | 1,016 |
Held-out splits come from a **disjoint 6,383-patient population** (training: 18,999 patients; zero`patient_id` overlap).
- **`heldout_familiar`** — clinical concepts also used in training, different patients. Isolates population generalization. **96.5% of its answerable rows are byte-identical `(question, gold_sql)` pairs from `train`**, so it measures whether learned queries stay correct on new data; it cannot distinguish memorization from generalization.- **`heldout_unseen`** — 84 clinical concepts appearing **nowhere** in training (verified by set intersection; zero shared question/query pairs). This is the split for measuring transfer.
⚠️ **The 1,016 abstention rows are the same rows in all three splits.** Unanswerable questionsreference no patient data, so an identical set was reused. Abstention metrics computed on theheld-out splits therefore measure *retention* of trained refusal behavior, not held-out refusalgeneralization.
⚠️ **Execution match is weakly discriminative on `heldout_unseen`.** Its concepts are rare (1–3patients each) and gold answers are small integers: 53.9% of within-archetype concept pairs returnidentical results, so a wrong concept can go undetected. Text-match metrics are not subject to this.
## Fields
| Field | Description ||---|---|| `question` | Natural-language question, phrased for one of 11 hospital roles || `target` | Training target: `json.dumps(plan, indent=2)` + fenced ` ```sql ` block || `gold_plan` | Structured query plan (entities, joins, constraints, aggregation, abstain) || `gold_sql` | Compiled DuckDB SQL, or the literal `UNANSWERABLE` token || `archetype_id` | Query archetype (82 total: 64 answerable + 18 unanswerable) || `tier` | Difficulty tier 1–4, or 5 for unanswerable || `persona` | Hospital role the phrasing targets || `concept_display` | The clinical concept instantiated (empty for structural/unanswerable) || `schema_ref` | Schema the query is written against |
## Provenance
Every answerable row's gold SQL was **executed against the real database** and kept only if it ranwithout error and returned at least one row, then checked for repeated-execution stability.Questions come from 160 role-appropriate phrasings authored with LLM assistance under the author'sdirection, then parameterized by concept.
`schema.sql` is the exact schema injected into every prompt. `valuesets_ddl.sql` is an ablationfragment that was **not** part of the prompt during the published runs — see the paper, §5.6.
## Limitations
Synthetic data only; one question-generation distribution (templated phrasing, not free-formclinician language); terminology resolution is substring matching against a corpus-deriveddictionary with one display string per code, so synonymy, hierarchy, and ambiguity are out of scope(ambiguous concepts are excluded from gold). Some regulatory questions say "dispensed" but areanswered from `MedicationRequest` (prescription orders). Full discussion in the paper's §7.
## Citation
See `CITATION.cff` in the GitHub repository.README.mdAdded+121