SQL on FHIR
2.1.0-pre - release
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
This content is an example of the View Definition Logical Model and is not a FHIR Resource
This view acts on the Observation resource to produce a table named "us_core_blood_pressures" where code.coding.exists(system='http://loinc.org' and code=%bp_code).
Constants:
| Name | Value |
|---|---|
| systolic_bp | 8480-6 |
| diastolic_bp | 8462-4 |
| bp_code | 85354-9 |
Selection Rules:
| Item | Coll | Type | Description |
|---|---|---|---|
![]() |
Observation | ||
![]() ![]() |
|||
![]() ![]() ![]() |
getResourceKey() | ||
![]() ![]() ![]() |
subject.getReferenceKey(Patient)Can be used to join to patient tables created by other views. | ||
![]() ![]() ![]() |
effective.ofType(dateTime) | ||
![]() ![]() |
for each component.where(code.coding.exists(system='http://loinc.org' and code=%systolic_bp)).first() | ||
![]() ![]() ![]() |
value.ofType(Quantity).system | ||
![]() ![]() ![]() |
value.ofType(Quantity).code | ||
![]() ![]() ![]() |
value.ofType(Quantity).unit | ||
![]() ![]() ![]() |
value.ofType(Quantity).value | ||
![]() ![]() |
for each component.where(code.coding.exists(system='http://loinc.org' and code=%diastolic_bp)).first() | ||
![]() ![]() ![]() |
value.ofType(Quantity).system | ||
![]() ![]() ![]() |
value.ofType(Quantity).code | ||
![]() ![]() ![]() |
value.ofType(Quantity).unit | ||
![]() ![]() ![]() |
value.ofType(Quantity).value |
This will result in a “us_core_blood_pressures” table that looks like this:
| id | patient_id | effective_date_time | sbp_quantity_system | sbp_quantity_code | sbp_quantity_unit | sbp_quantity_value | dbp_quantity_system | dbp_quantity_code | dbp_quantity_unit | dbp_quantity_value |
|---|---|---|---|---|---|---|---|---|---|---|
| 1 | 1 | 2020-01-01T00:00:00 | http://unitsofmeasure.org | mmHg | mm[Hg] | 120 | http://unitsofmeasure.org | mmHg | mm[Hg] | 80 |
| 2 | 1 | 2020-01-02T00:00:00 | http://unitsofmeasure.org | mmHg | mm[Hg] | 130 | http://unitsofmeasure.org | mmHg | mm[Hg] | 90 |
| 3 | 2 | 2020-01-03T00:00:00 | http://unitsofmeasure.org | mmHg | mm[Hg] | 140 | http://unitsofmeasure.org | mmHg | mm[Hg] | 100 |
| 4 | 3 | 2020-01-04T00:00:00 | http://unitsofmeasure.org | mmHg | mm[Hg] | 150 | http://unitsofmeasure.org | mmHg | mm[Hg] | 110 |
| 5 | 3 | 2020-01-05T00:00:00 | http://unitsofmeasure.org | mmHg | mm[Hg] | 160 | http://unitsofmeasure.org | mmHg | mm[Hg] | 120 |