Skip to main content
FHIR for Data Science Logo

FHIR for Data Science

v0.0.7

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
~3.9msSQL mean / patient
ZeroServer infrastructure
2,822Tests 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. ~137Γ— 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.
πŸ“

SQL-on-FHIR v2

Flatten complex resources into analytical tables using portable ViewDefinitions. 100% compliant with the HL7 specification.
🎯

Standards Compliant

  • 100% CQL (1,706 tests)
  • 100% FHIRPath (935 tests)
  • 100% SQL-on-FHIR v2 (134 tests)
  • 47/47 eCQM measures

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
SQL execution per patient (all 47 measures)~3.9msN/A
SQL execution per patient (12 shared measures)~6.9ms~936ms
Speedup (mean, 12 shared measures)~137Γ— 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

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