SQL on FHIR
3.0.0-ballot - STU 3 Ballot International flag

SQL on FHIR, published by HL7 International / FHIR Infrastructure. This guide is not an authorized publication; it is the continuous build for version 3.0.0-ballot built by the FHIR (HL7® FHIR® Standard) CI Build. This version is based on the current content of https://github.com/HL7/sql-on-fhir/ and changes regularly. See the Directory of published versions

Example ViewDefinition: Patient and Contact Address Union

This view acts on the Patient resource to produce a table named "patient_and_contact_addresses".

The table contains the following columns:

NameFhir TypeSQL TypeCollection
resource_idstringString
streetstringString
citystringString
zipstringString
is_patientbooleanBoolean

Selection Rules:

ItemCollTypeDescription
patient_and_contact_addressesPatient
patient_and_contact_addresses / Select
patient_and_contact_addresses / Select / resource_idgetResourceKey()

Notes:

This will result in a "patient_and_contact_addresses" table that looks like this:

resource_idstreetcityzipis_patient
28

123 Main St Apt 1

San Diego921011
28

456 Maplewood Dve Apt 2

New York100011
28

456 Maplewood Dve Apt 2

New York100010
29

789 Brookside Ave Apt 3

Los Angeles900011
29

987 Pinehurst Rd Apt 4

Chicago606010
30

987 Pinehurst Rd Apt 4

Chicago606011
30

654 Evergreen Tce Apt 5

Houston770011