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 Addresses

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

The table contains the following columns:

NameFhir TypeSQL TypeCollection
patient_idstringString
streetstringString
usestringString
citystringString
zipstringString

Selection Rules:

ItemCollTypeDescription
patient_addressesPatient
patient_addresses / Select
patient_addresses / Select / patient_idgetResourceKey()
patient_addresses / Selectfor each address
patient_addresses / Select / streetline.join(' ')
The full street address, including newlines if present.
patient_addresses / Select / useuse
patient_addresses / Select / citycity
patient_addresses / Select / zippostalCode

Notes:

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

patient_idstreetusecityzip
28

123 Main St Apt 1

homeSan Diego92101
28

456 Maplewood Dve Apt 2

workNew York10001
29

789 Brookside Ave Apt 3

homeLos Angeles90001
30

987 Pinehurst Rd Apt 4

homeChicago60601
30

654 Evergreen Tce Apt 5

workHouston77001