adelelsayed1991/fhirsql-reasoning-sql
FHIR-to-SQL with Database-Resolved Clinical Terminology Natural-language hospital questions paired with a structured JSON query plan and compiled DuckDB SQL, over a FHIR-derived clinical schema. Built entirely from synthetic Synthea patients — no real patient data. Companion to the paper Plan-Then-Compile: Turning a General-Purpose Coder Model into a FHIR Data Analyst. Code & paper: https://github.com/adelelsayed/fhirsql-reasoning-sql Adapters:… See the full description on the dataset page: https://huggingface.co/datasets/adelelsayed1991/fhirsql-reasoning-sql.
0109
1-- Terminology lookup table -- ABLATION FRAGMENT, NOT PART OF THE FROZEN SCHEMA.2--3-- IMPORTANT: this block was NOT present in schema/schema.sql during the published4-- training and evaluation runs. The `valuesets` table existed in both DuckDB5-- databases and every gold query resolved terminology through it, but its DDL was6-- never shown to the model -- fine-tuned models learned its columns implicitly from7-- thousands of training targets, while the frozen baseline had only the table name8-- to go on.9--10-- valuesets_ablation.ipynb prepends this fragment to schema.sql and re-runs the11-- held-out evaluation on the published checkpoints, to measure how much of the12-- frozen model's failure is attributable to the missing table description rather13-- than to reasoning ability. See PAPER.md Section 5.6.14--15-- Do NOT merge this into schema.sql: doing so would break correspondence between16-- the committed schema and the runs reported in the paper.17 18CREATE TABLE valuesets (19 table_name VARCHAR, -- which fact table this concept belongs to20 code VARCHAR,21 code_system VARCHAR, -- joins against that table's `system`-suffixed column22 display VARCHAR, -- human-readable concept name; the ILIKE search target23 lookup_ambiguous BOOLEAN -- display text matches >1 row in the same table under ILIKE containment24);25 