Skip to main content
FHIR for Data Science Logo

FHIR for Data Science

v0.0.26

Production-Scale FHIR Analytics. Running Anywhere.

The first SQL-native clinical reasoning engine. Translate CQL to DuckDB SQL for blazing fast, auditable population health analytics with zero server infrastructure.

Get Started β†’πŸŒ Live DemoπŸŽ“ Learn CQL
~6.9msSQL median / patient
ZeroServer infrastructure
2,943Tests passing
FullAudit Evidence

Native FHIR Analytics

FHIR4DS treats FHIR as a first-class citizen in the analytical stack. No pre-flattening, no complex ETLβ€”just standard SQL powered by high-performance DuckDB extensions.

Query FHIR resources using native FHIRPath expressions directly in SQL.

python
import fhir4ds

con = fhir4ds.create_connection()
con.execute("""
  SELECT fhirpath_text(resource, 'Patient.name.family') 
  FROM resources
""")
⚑

Columnar Speed

Process entire populations in a single SQL scan. ~83Γ— faster than traditional engines by utilizing vectorized execution and SIMD.
🌐

Zero Infrastructure

No JVM, no Docker, no servers. Runs locally in notebooks or 100% client-side via WebAssembly for secure SMART on FHIR apps.
πŸ”

Full Auditability

Every decision includes a human-readable narrative and a logical breadcrumb trail through the logic tree. No more "black box" results.
πŸ”¬

Inspectable SQL

Logic compiles to standard, optimisable DuckDB SQL. Debug, index, or export to Parquetβ€”you own the query and the data pipeline.
πŸ“š

Terminology-Aware

Expand ValueSets, auto-code text-only concepts, and derive Conditions from clinical notes via medterm4ds β€” over HTTP or embedded in-process.
Learn more β†’
🎯

Standards Compliant

  • 100% CQL (1,706 tests)
  • 100% FHIRPath (935 tests)
  • 100% SQL-on-FHIR v2 (144 tests)
  • 47/47 + 73/73 eCQM measures (2025 QI-Core + 2025 US-Core suites)

How It Works

Clinical logic compiles to a single, self-contained DuckDB SQL query. Query raw FHIR JSON directly without pre-flattening or ETL.

CQL Source→Parser→SQL Translator→DuckDB SQL→Results

FHIR4DS vs CQF Clinical Reasoning

Same accuracy target. Radically different performance.

CapabilityFHIR4DSCQF Clinical Reasoning
Cohort execution at scale (5,000 patients, Synthea)0.045 – 1.1 ms/patientper-patient cost unchanged at scale
Speedup at scale (5,000 patients, extrapolated)~23Γ— to ~16,000Γ— per measurebaseline
SQL execution per patient, median (all 47 measures)~6.9msN/A
SQL execution per patient, median (46 shared measures)~6.9ms~575ms
Speedup, median (46 shared measures)~83Γ— fasterbaseline
Zero server infrastructureβœ… DuckDB-WASM❌ Requires JVM + server
Audit evidence trailβœ… Full narrative❌ Aggregate counts only
Output is inspectableβœ… Plain SQL❌ Black-box engine
Columnar scalabilityβœ… Vectorized⚠️ Sequential loop
SQL-on-FHIR v2 supportβœ… 100% compliance❌ Not supported

At-scale rows: Synthea 5,000-patient cohorts, DuckDB 2.0.0 (100–5,000-patient ladder in the benchmarking report); the Java column is a per-patient linear extrapolation β€” its actual cost grows with data volume. Per-patient figures measured on DuckDB 2.0.0 against the cqframework 2025 QI-Core test bundles (46 of 47 measures succeed in both engines) β€” small cohorts where fixed per-query costs dominate, i.e. the conservative end of the range.

Ready to scale your FHIR analytics?

Join the modern healthcare data stack. Open-source, standards-compliant, and built for high-performance clinical quality measurement.

Install fhir4dsExplore User Guide⭐ GitHub