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

Library: Blood Pressure Trend Report

Official URL: http://hl7.org/fhir/uv/sql-on-fhir/Library/SqlOnFhirExample Version: 3.0.0-ballot
Standards status: Informative Computable Name: SqlOnFhirExample
Other Identifiers: OID:2.16.840.1.113883.4.642.40.77.28.4

Demonstrates SQL annotations that tooling can use to generate Library metadata.

/*
@name: SqlOnFhirExample
@title: Blood Pressure Trend Report
@description: Return blood pressure observations for a patient in a date range
@version: 1.0.0
@status: active
@author: Clinical Informatics Team
@publisher: Regional Medical Center
*/

-- @relatedDependency: https://example.org/ViewDefinition/patient_view as patient_view
-- @relatedDependency: https://example.org/ViewDefinition/blood_pressure_view as blood_pressure_view
-- @param: patient_id string Patient identifier
-- @param: from_date date Start date (inclusive)
-- @param: to_date date End date (inclusive)
SELECT
  patient_view.id AS patient_id,
  patient_view.name,
  blood_pressure_view.systolic,
  blood_pressure_view.diastolic,
  blood_pressure_view.effective_date
FROM patient_view
JOIN blood_pressure_view
  ON patient_view.id = blood_pressure_view.patient_id
WHERE patient_view.id = :patient_id
  AND blood_pressure_view.effective_date >= :from_date
  AND blood_pressure_view.effective_date <= :to_date
ORDER BY blood_pressure_view.effective_date

Metadata
Title Blood Pressure Trend Report
Version 3.0.0-ballot
Identifier urn:oid:2.16.840.1.113883.4.642.40.77.28.4
Jurisdiction World
Steward (Publisher) HL7 International / FHIR Infrastructure
Steward Contact HL7 International / FHIR Infrastructure
Developer Clinical Informatics Team
Description

Demonstrates SQL annotations that tooling can use to generate Library metadata.

/*
@name: SqlOnFhirExample
@title: Blood Pressure Trend Report
@description: Return blood pressure observations for a patient in a date range
@version: 1.0.0
@status: active
@author: Clinical Informatics Team
@publisher: Regional Medical Center
*/

-- @relatedDependency: https://example.org/ViewDefinition/patient_view as patient_view
-- @relatedDependency: https://example.org/ViewDefinition/blood_pressure_view as blood_pressure_view
-- @param: patient_id string Patient identifier
-- @param: from_date date Start date (inclusive)
-- @param: to_date date End date (inclusive)
SELECT
  patient_view.id AS patient_id,
  patient_view.name,
  blood_pressure_view.systolic,
  blood_pressure_view.diastolic,
  blood_pressure_view.effective_date
FROM patient_view
JOIN blood_pressure_view
  ON patient_view.id = blood_pressure_view.patient_id
WHERE patient_view.id = :patient_id
  AND blood_pressure_view.effective_date >= :from_date
  AND blood_pressure_view.effective_date <= :to_date
ORDER BY blood_pressure_view.effective_date
Type sql-query from http://hl7.org/fhir/uv/sql-on-fhir/CodeSystem/LibraryTypesCodes
Dependency Resource: https://example.org/ViewDefinition/patient_view
Canonical URL: https://example.org/ViewDefinition/patient_view
Dependency Resource: https://example.org/ViewDefinition/blood_pressure_view
Canonical URL: https://example.org/ViewDefinition/blood_pressure_view
Parameters
Name Use Card. Type Documentation
patient_id In 0..1 string Patient identifier
from_date In 0..1 date Start date for observations
to_date In 0..1 date End date for observations
Library Content
application/sqlContent
Encoded data 
Generated using version 0.5.4 of the sample-content-ig Liquid templates