SQL on FHIR
2.1.0-pre - release International flag

SQL on FHIR - Local Development build (v2.1.0-pre) built by the FHIR (HL7® FHIR® Standard) Build Tools. See the Directory of published versions

Artifacts Summary

This page provides a list of the FHIR artifacts defined as part of this implementation guide.

Behavior: Operation Definitions

These are custom operations that can be supported by and/or invoked by systems conforming to this implementation guide.

SQLQuery Run

Execute a SQLQuery Library against ViewDefinition tables.

ViewDefinition Export

Export a view definition. User can provide view definition references and/or resources as part of the input parameters.

ViewDefinition Run

Execute a view definition against supplied or server data.

Structures: Logical Models

These define data models that represent the domain covered by this implementation guide in more business-friendly terms than the underlying FHIR resources.

Shareable View Definition

A profile for View Definitions intended to be shared between multiple systems. This requires that the View Definition have a defined URL and name. It also requires declaration of the FHIR version that the view is intended to be executed over, and the FHIR type of each column. This ensures consistent interpretation of the view across different view runner implementations.

Tabular View Definition

A profile for View Definitions where each resulting field must contain only a simple scalar value. This is sometimes referred to as ‘CSV Mode’, but applies to any system that explicitly constrains its views or tables to tabular data.

View Definition

A ViewDefinition represents a tabular projection of a FHIR resource, where the columns and inclusion criteria are defined by FHIRPath expressions.

Structures: Resource Profiles

These define constraints on FHIR resources for systems conforming to this implementation guide.

SQL Query Library

The SQLQuery profile represents a SQL query that runs against ViewDefinition tables. It bundles the SQL, dependencies, and parameters for sharing and versioning.

Structures: Extension Definitions

These define constraints on FHIR data types for systems conforming to this implementation guide.

SQL Text

Plain-text SQL query for human readability. Supplements the base64-encoded Attachment.data.

Terminology: Value Sets

These define sets of codes used by systems conforming to this implementation guide.

All SQL Content Type Codes

ValueSet of all codes from SQL Content Type Codes codesystem

Export Status Codes

ValueSet of all codes from Export Status Codes codesystem

Output Format Codes

ValueSet of all codes from Output Format Codes codesystem

Terminology: Code Systems

These define new code systems used by systems conforming to this implementation guide.

Export Status Code System

Export status codes for SQL on FHIR.

Output Format Codes

Output format codes for SQL on FHIR.

SQL Content Type Codes

Permitted contentType values for SQLQuery attachments, including dialect-specific variants.

SQL Library Types Code System

Library types for SQL on FHIR.

Example: Example Instances

These are example instances that show what data produced and consumed by systems conforming with this implementation guide might look like.

Blood Pressure Trend Report

Annotated SQL query example demonstrating how tooling can derive Library metadata.

ConditionFlat

A simple view for flattening a Condition resource. Some of the more commonly used fields are included in this flat view. A notable point is flattening of category.coding fields with one forEach construct as FHIRPath will take care of handling of nested arrays.

EncounterFlat

A simple view for flattening an Encounter resource. Some of the more commonly used fields are included in this flat view. Note this is valid for an R4 Encounter resource but not R5 (hence the fhirVersion).

OMOP/FHIR Patient Match with Diagnoses

Disambiguates OMOP and FHIR Patient views and joins diagnoses for context.

PatientAddresses

An example of unnesting patient addresses into multiple rows.

This view uses forEach to indicate we are unrolling these into separate rows. The join function is used to create a single address line.

PatientAndContactAddressUnion

An example of unnesting patient addresses and contact addresss into multiple rows, which are unioned together into a single table.

PatientDemographics

A minimal example of a patient demographics view. This view uses the first ‘official’ patient name for our demographics table.

PatientNamesWithIndex

An example demonstrating the use of %rowIndex to capture the position of elements within a collection. This is useful for preserving FHIR ordering semantics and creating surrogate keys that combine resource ID with element position.

ShareablePatientDemographics

Creates the same view as the ‘PatientDemographics’ example, but applies both the ShareableViewDefinition and TabularViewDefinition profiles.

Unique Patient Addresses

A SQL query that retrieves the most recent address per patient with a city filter.

UsCoreBloodPressures

A simple view of blood pressure observations, with separate columns for systolic and diastolic values.