Datasets:
Add README.md
Browse files
README.md
ADDED
|
@@ -0,0 +1,121 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: cc-by-4.0
|
| 3 |
+
language:
|
| 4 |
+
- en
|
| 5 |
+
task_categories:
|
| 6 |
+
- text2text-generation
|
| 7 |
+
- table-question-answering
|
| 8 |
+
tags:
|
| 9 |
+
- text-to-sql
|
| 10 |
+
- clinical
|
| 11 |
+
- fhir
|
| 12 |
+
- healthcare
|
| 13 |
+
- synthetic
|
| 14 |
+
- duckdb
|
| 15 |
+
- synthea
|
| 16 |
+
size_categories:
|
| 17 |
+
- 10K<n<100K
|
| 18 |
+
configs:
|
| 19 |
+
- config_name: default
|
| 20 |
+
data_files:
|
| 21 |
+
- split: train
|
| 22 |
+
path: train.jsonl
|
| 23 |
+
- split: heldout_familiar
|
| 24 |
+
path: heldout_familiar.jsonl
|
| 25 |
+
- split: heldout_unseen
|
| 26 |
+
path: heldout_unseen.jsonl
|
| 27 |
+
---
|
| 28 |
+
|
| 29 |
+
# FHIR-to-SQL with Database-Resolved Clinical Terminology
|
| 30 |
+
|
| 31 |
+
Natural-language hospital questions paired with a **structured JSON query plan and compiled DuckDB
|
| 32 |
+
SQL**, over a FHIR-derived clinical schema. Built entirely from **synthetic** Synthea patients — no
|
| 33 |
+
real patient data.
|
| 34 |
+
|
| 35 |
+
Companion to the paper *Plan-Then-Compile: Turning a General-Purpose Coder Model into a FHIR Data
|
| 36 |
+
Analyst*.
|
| 37 |
+
|
| 38 |
+
- **Code & paper:** https://github.com/adelelsayed/fhirsql-reasoning-sql
|
| 39 |
+
- **Adapters:** https://huggingface.co/adelelsayed1991/fhirsql-reasoning-sql-adapters
|
| 40 |
+
|
| 41 |
+
## What makes this dataset different
|
| 42 |
+
|
| 43 |
+
Gold SQL **never embeds a literal clinical code**. Every query resolves its concept at runtime
|
| 44 |
+
through a lookup against a `valuesets` terminology table:
|
| 45 |
+
|
| 46 |
+
```sql
|
| 47 |
+
WITH resolved AS (
|
| 48 |
+
SELECT code, code_system FROM valuesets
|
| 49 |
+
WHERE table_name = 'procedure' AND display ILIKE '%Depression screening (procedure)%'
|
| 50 |
+
)
|
| 51 |
+
SELECT DISTINCT patient_id
|
| 52 |
+
FROM procedure, resolved
|
| 53 |
+
WHERE procedure.code = resolved.code AND procedure.system = resolved.code_system
|
| 54 |
+
AND status = 'completed'
|
| 55 |
+
```
|
| 56 |
+
|
| 57 |
+
This turns terminology resolution from a memorization problem into a queryable one, and makes
|
| 58 |
+
generalization to clinical concepts absent from training measurable.
|
| 59 |
+
|
| 60 |
+
## Splits
|
| 61 |
+
|
| 62 |
+
| Split | Rows | Answerable | Abstention |
|
| 63 |
+
|---|---:|---:|---:|
|
| 64 |
+
| `train` | 10,696 | 9,680 | 1,016 |
|
| 65 |
+
| `heldout_familiar` | 9,300 | 8,284 | 1,016 |
|
| 66 |
+
| `heldout_unseen` | 2,156 | 1,140 | 1,016 |
|
| 67 |
+
|
| 68 |
+
Held-out splits come from a **disjoint 6,383-patient population** (training: 18,999 patients; zero
|
| 69 |
+
`patient_id` overlap).
|
| 70 |
+
|
| 71 |
+
- **`heldout_familiar`** — clinical concepts also used in training, different patients. Isolates
|
| 72 |
+
population generalization. **96.5% of its answerable rows are byte-identical `(question, gold_sql)`
|
| 73 |
+
pairs from `train`**, so it measures whether learned queries stay correct on new data; it cannot
|
| 74 |
+
distinguish memorization from generalization.
|
| 75 |
+
- **`heldout_unseen`** — 84 clinical concepts appearing **nowhere** in training (verified by set
|
| 76 |
+
intersection; zero shared question/query pairs). This is the split for measuring transfer.
|
| 77 |
+
|
| 78 |
+
⚠️ **The 1,016 abstention rows are the same rows in all three splits.** Unanswerable questions
|
| 79 |
+
reference no patient data, so an identical set was reused. Abstention metrics computed on the
|
| 80 |
+
held-out splits therefore measure *retention* of trained refusal behavior, not held-out refusal
|
| 81 |
+
generalization.
|
| 82 |
+
|
| 83 |
+
⚠️ **Execution match is weakly discriminative on `heldout_unseen`.** Its concepts are rare (1–3
|
| 84 |
+
patients each) and gold answers are small integers: 53.9% of within-archetype concept pairs return
|
| 85 |
+
identical results, so a wrong concept can go undetected. Text-match metrics are not subject to this.
|
| 86 |
+
|
| 87 |
+
## Fields
|
| 88 |
+
|
| 89 |
+
| Field | Description |
|
| 90 |
+
|---|---|
|
| 91 |
+
| `question` | Natural-language question, phrased for one of 11 hospital roles |
|
| 92 |
+
| `target` | Training target: `json.dumps(plan, indent=2)` + fenced ` ```sql ` block |
|
| 93 |
+
| `gold_plan` | Structured query plan (entities, joins, constraints, aggregation, abstain) |
|
| 94 |
+
| `gold_sql` | Compiled DuckDB SQL, or the literal `UNANSWERABLE` token |
|
| 95 |
+
| `archetype_id` | Query archetype (82 total: 64 answerable + 18 unanswerable) |
|
| 96 |
+
| `tier` | Difficulty tier 1–4, or 5 for unanswerable |
|
| 97 |
+
| `persona` | Hospital role the phrasing targets |
|
| 98 |
+
| `concept_display` | The clinical concept instantiated (empty for structural/unanswerable) |
|
| 99 |
+
| `schema_ref` | Schema the query is written against |
|
| 100 |
+
|
| 101 |
+
## Provenance
|
| 102 |
+
|
| 103 |
+
Every answerable row's gold SQL was **executed against the real database** and kept only if it ran
|
| 104 |
+
without error and returned at least one row, then checked for repeated-execution stability.
|
| 105 |
+
Questions come from 160 role-appropriate phrasings authored with LLM assistance under the author's
|
| 106 |
+
direction, then parameterized by concept.
|
| 107 |
+
|
| 108 |
+
`schema.sql` is the exact schema injected into every prompt. `valuesets_ddl.sql` is an ablation
|
| 109 |
+
fragment that was **not** part of the prompt during the published runs — see the paper, §5.6.
|
| 110 |
+
|
| 111 |
+
## Limitations
|
| 112 |
+
|
| 113 |
+
Synthetic data only; one question-generation distribution (templated phrasing, not free-form
|
| 114 |
+
clinician language); terminology resolution is substring matching against a corpus-derived
|
| 115 |
+
dictionary with one display string per code, so synonymy, hierarchy, and ambiguity are out of scope
|
| 116 |
+
(ambiguous concepts are excluded from gold). Some regulatory questions say "dispensed" but are
|
| 117 |
+
answered from `MedicationRequest` (prescription orders). Full discussion in the paper's §7.
|
| 118 |
+
|
| 119 |
+
## Citation
|
| 120 |
+
|
| 121 |
+
See `CITATION.cff` in the GitHub repository.
|