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: Cardiovascular Disease Patients

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

Returns each condition whose code is a member of the http://example.org/ValueSet/cardiovascular-disease|2026 value set. The value set is declared as a dependency and the runner exposes it under the cvd_codes label as a relation with the columns system, version, code, display and inactive (see Terminology in SQL). Because the conditions view carries no code system version, membership is tested on system and code with a semi-join, which cannot multiply rows.

SELECT conditions.patient_id, conditions.code
FROM conditions
WHERE EXISTS (
  SELECT 1
  FROM cvd_codes
  WHERE cvd_codes.system = conditions.system
    AND cvd_codes.code = conditions.code
)
Metadata
Title Cardiovascular Disease Patients
Version 3.0.0-ballot
Identifier urn:oid:2.16.840.1.113883.4.642.40.77.28.7
Jurisdiction World
Steward (Publisher) HL7 International / FHIR Infrastructure
Steward Contact HL7 International / FHIR Infrastructure
Description

Returns each condition whose code is a member of the http://example.org/ValueSet/cardiovascular-disease|2026 value set. The value set is declared as a dependency and the runner exposes it under the cvd_codes label as a relation with the columns system, version, code, display and inactive (see Terminology in SQL). Because the conditions view carries no code system version, membership is tested on system and code with a semi-join, which cannot multiply rows.

SELECT conditions.patient_id, conditions.code
FROM conditions
WHERE EXISTS (
  SELECT 1
  FROM cvd_codes
  WHERE cvd_codes.system = conditions.system
    AND cvd_codes.code = conditions.code
)
Type http://hl7.org/fhir/uv/sql-on-fhir/CodeSystem/LibraryTypesCodes#sql-query
Parameters
Parameter None
Library Content
application/sqlContent
Encoded data 
Citations and References
Dependency Description: Condition view with patient_id, system, version and code columns
Resource: https://example.org/ViewDefinition/conditions
Canonical URL: https://example.org/ViewDefinition/conditions
Dependency Description: Cardiovascular disease value set, exposed as a relation
Resource: http://example.org/ValueSet/cardiovascular-disease|2026
Canonical URL: http://example.org/ValueSet/cardiovascular-disease|2026
Generated using version 0.5.6 of the sample-content-ig Liquid templates