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 Names with Index

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

The table contains the following columns:

NameFhir TypeSQL TypeCollection
patient_idstringString
name_indexintegerInteger
usestringString
familystringString
givenstringString

Selection Rules:

ItemCollTypeDescription
patient_names_with_indexPatient
patient_names_with_index / Select
patient_names_with_index / Select / patient_idgetResourceKey()
patient_names_with_index / Selectfor each name
patient_names_with_index / Select / name_indexinteger%rowIndex
The 0-based position of this name in the patient's name array.
patient_names_with_index / Select / useuse
patient_names_with_index / Select / familyfamily
patient_names_with_index / Select / givengiven.join(' ')

Notes:

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

patient_idname_indexusefamilygiven
280officialVicarioMalvina Gerda
281usualVicarioMal
290officialBristowYolotzin Adel
300officialAarensJin Gomer