Skip to content

Instantly share code, notes, and snippets.

@citizenrich
Created February 22, 2021 17:26
Show Gist options
  • Save citizenrich/3a0d897e10a6c5e40964fcdbd6620684 to your computer and use it in GitHub Desktop.
Save citizenrich/3a0d897e10a6c5e40964fcdbd6620684 to your computer and use it in GitHub Desktop.
Troubleshooting observation in CQL
{
"fullUrl": "urn:uuid:b04ccc37-bc08-d37e-5b67-746a8d65aa14",
"resource": {
"resourceType": "Observation",
"id": "b04ccc37-bc08-d37e-5b67-746a8d65aa14",
"meta": {
"profile": [ "http://hl7.org/fhir/us/core/StructureDefinition/us-core-observation-lab" ]
},
"status": "final",
"category": [ {
"coding": [ {
"system": "http://terminology.hl7.org/CodeSystem/observation-category",
"code": "laboratory",
"display": "laboratory"
} ]
} ],
"code": {
"coding": [ {
"system": "http://loinc.org",
"code": "75622-1",
"display": "HIV 1 and 2 tests - Meaningful Use set"
} ],
"text": "HIV 1 and 2 tests - Meaningful Use set"
},
"subject": {
"reference": "urn:uuid:0ae954fa-eff8-0d38-c840-3af401abc9fd"
},
"encounter": {
"reference": "urn:uuid:e4e11f0b-4e2e-4005-9005-d6552de634df"
},
"effectiveDateTime": "1993-09-11T11:01:17-04:00",
"issued": "1993-09-11T11:01:17.230-04:00",
"valueCodeableConcept": {
"coding": [ {
"system": "http://snomed.info/sct",
"code": "165816005",
"display": "HIV Positive"
} ],
"text": "HIV Positive"
}
},
"request": {
"method": "POST",
"url": "Observation"
}
},
library HIVIndicators version '0.1.0'
using FHIR version '4.0.1'
include FHIRHelpers version '4.0.1'
include FHIRCommon called FC
// SNOMED-CT, International Edition
codesystem "SNOMED-CT": 'http://snomed.info/sct' version 'http://snomed.info/sct/900000000000207008'
// LOINC, 2.63+
codesystem "LOINC": 'http://loinc.org'
// HIV Test Results
code "HIV Negative": '165815009' from "SNOMED-CT" display 'HIV Negative'
code "HIV Positive": '165816005' from "SNOMED-CT" display 'HIV Positive'
code "HIV 1 and 2 tests - Meaningful Use set": '75622-1' from "LOINC" display 'HIV 1 and 2 tests - Meaningful Use set'
context Patient
define "HIV Positive Observation":
[Observation: "HIV 1 and 2 tests - Meaningful Use set"] O
where O.value = 'HIV Positive'
define "HIV Negative Observation":
[Observation: "HIV 1 and 2 tests - Meaningful Use set"] O
where O.value = 'HIV Negative'
define "Is HIV Positive":
exists ("HIV Positive Observation")
define "Is HIV Negative":
exists ("HIV Negative Observation")
define "Sex": Patient.gender
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment