diff --git a/plugin/cr/src/main/java/org/opencds/cqf/ruler/cr/dstu3/provider/DataOperationsProvider.java b/plugin/cr/src/main/java/org/opencds/cqf/ruler/cr/dstu3/provider/DataOperationsProvider.java index 0c4624fac..5705dd075 100644 --- a/plugin/cr/src/main/java/org/opencds/cqf/ruler/cr/dstu3/provider/DataOperationsProvider.java +++ b/plugin/cr/src/main/java/org/opencds/cqf/ruler/cr/dstu3/provider/DataOperationsProvider.java @@ -33,6 +33,8 @@ import org.opencds.cqf.ruler.utility.Ids; import org.opencds.cqf.ruler.utility.Libraries; import org.opencds.cqf.ruler.utility.Searches; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import ca.uhn.fhir.rest.annotation.IdParam; @@ -44,6 +46,8 @@ import org.springframework.util.StringUtils; public class DataOperationsProvider extends DaoRegistryOperationProvider { + private Logger myLog = LoggerFactory.getLogger(DataOperationsProvider.class); + @Autowired private JpaLibraryContentProviderFactory jpaLibraryContentProviderFactory; @@ -97,7 +101,13 @@ public Library getLibraryFromMeasure(Measure measure, RequestDetails theRequestD } } - Library library = read(new IdType(libraryIdOrCanonical), theRequestDetails); + Library library = null; + + try { + read(new IdType(libraryIdOrCanonical), theRequestDetails); + } catch (Exception e) { + myLog.info("Library read failed as measure.getLibrary() is not an ID, fall back to search as canonical"); + } if (library == null) { library = search(Library.class, Searches.byCanonical(libraryIdOrCanonical), theRequestDetails).firstOrNull(); diff --git a/plugin/cr/src/main/java/org/opencds/cqf/ruler/cr/r4/provider/DataOperationsProvider.java b/plugin/cr/src/main/java/org/opencds/cqf/ruler/cr/r4/provider/DataOperationsProvider.java index 0175d6d44..0bb89dd52 100644 --- a/plugin/cr/src/main/java/org/opencds/cqf/ruler/cr/r4/provider/DataOperationsProvider.java +++ b/plugin/cr/src/main/java/org/opencds/cqf/ruler/cr/r4/provider/DataOperationsProvider.java @@ -36,6 +36,8 @@ import org.opencds.cqf.ruler.utility.Canonicals; import org.opencds.cqf.ruler.utility.Libraries; import org.opencds.cqf.ruler.utility.Searches; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import ca.uhn.fhir.rest.annotation.IdParam; @@ -47,6 +49,8 @@ public class DataOperationsProvider extends DaoRegistryOperationProvider { + private Logger myLog = LoggerFactory.getLogger(DataOperationsProvider.class); + @Autowired private JpaLibraryContentProviderFactory jpaLibraryContentProviderFactory; @@ -111,8 +115,13 @@ public Library getLibraryFromMeasure(Measure measure, RequestDetails theRequestD } } - Library library = read(new IdType(libraryIdOrCanonical), theRequestDetails); + Library library = null; + try { + library = read(new IdType(libraryIdOrCanonical), theRequestDetails); + } catch (Exception e) { + myLog.info("Library read failed as measure.getLibrary() is not an ID, fall back to search as canonical"); + } if (library == null) { library = search(Library.class, Searches.byCanonical(libraryIdOrCanonical), theRequestDetails).firstOrNull(); } diff --git a/plugin/cr/src/test/java/org/opencds/cqf/ruler/cr/dstu3/provider/DataOperationProviderIT.java b/plugin/cr/src/test/java/org/opencds/cqf/ruler/cr/dstu3/provider/DataOperationProviderIT.java index 81a2410a1..44e3234b6 100644 --- a/plugin/cr/src/test/java/org/opencds/cqf/ruler/cr/dstu3/provider/DataOperationProviderIT.java +++ b/plugin/cr/src/test/java/org/opencds/cqf/ruler/cr/dstu3/provider/DataOperationProviderIT.java @@ -21,14 +21,15 @@ public class DataOperationProviderIT extends RestIntegrationTest { @Test public void testDstu3DataRequirementsOperation() throws IOException { - String bundleAsText = stringFromResource( "DataReqLibraryTransactionBundle.json"); + String bundleAsText = stringFromResource( "DataReqLibraryTransactionBundleDstu3.json"); Bundle bundle = (Bundle)getFhirContext().newJsonParser().parseResource(bundleAsText); getClient().transaction().withBundle(bundle).execute(); Parameters params = new Parameters(); params.addParameter().setName("target").setValue(new StringType("dummy")); - Library returnLibrary = getClient().operation().onInstance(new IdType("Library", "LibraryEvaluationTest")) + Library returnLibrary = getClient().operation() + .onInstance(new IdType("Library", "LibraryEvaluationTest")) .named("$data-requirements") .withParameters(params) .returnResourceType(Library.class) diff --git a/plugin/cr/src/test/java/org/opencds/cqf/ruler/cr/r4/provider/DataOperationProviderIT.java b/plugin/cr/src/test/java/org/opencds/cqf/ruler/cr/r4/provider/DataOperationProviderIT.java index 31d70692d..5ae5d5358 100644 --- a/plugin/cr/src/test/java/org/opencds/cqf/ruler/cr/r4/provider/DataOperationProviderIT.java +++ b/plugin/cr/src/test/java/org/opencds/cqf/ruler/cr/r4/provider/DataOperationProviderIT.java @@ -22,14 +22,15 @@ public class DataOperationProviderIT extends RestIntegrationTest { @Test public void testR4LibraryDataRequirementsOperation() throws IOException { - String bundleAsText = stringFromResource( "DataReqLibraryTransactionBundle.json"); + String bundleAsText = stringFromResource( "DataReqLibraryTransactionBundleR4.json"); Bundle bundle = (Bundle)getFhirContext().newJsonParser().parseResource(bundleAsText); getClient().transaction().withBundle(bundle).execute(); Parameters params = new Parameters(); params.addParameter().setName("target").setValue(new StringType("dummy")); - Library returnLibrary = getClient().operation().onInstance(new IdType("Library", "LibraryEvaluationTest")) + Library returnLibrary = getClient().operation() + .onInstance(new IdType("Library", "LibraryEvaluationTest")) .named("$data-requirements") .withParameters(params) .returnResourceType(Library.class) diff --git a/plugin/cr/src/test/resources/DataReqLibraryTransactionBundleDstu3.json b/plugin/cr/src/test/resources/DataReqLibraryTransactionBundleDstu3.json new file mode 100644 index 000000000..45384b183 --- /dev/null +++ b/plugin/cr/src/test/resources/DataReqLibraryTransactionBundleDstu3.json @@ -0,0 +1,284 @@ +{ + "resourceType": "Bundle", + "type": "transaction", + "id": "LibraryTransactionBundleDstu3", + "entry": [ + { + "resource": { + "resourceType": "Patient", + "id": "example-opioidcds", + "meta": { + "versionId": "1", + "lastUpdated": "2017-11-25T17:26:27.040-07:00" + }, + "identifier": [ + { + "use": "official", + "type": { + "coding": [ + { + "system": "http://hl7.org/fhir/identifier-type", + "code": "SB", + "display": "Social Beneficiary Identifier" + } + ], + "text": "US Social Security Number" + }, + "system": "http://hl7.org/fhir/sid/us-ssn", + "value": "000002341" + } + ], + "active": true, + "name": [ + { + "family": "Goodwall", + "given": [ + "Jerry", + "Phillip" + ] + } + ], + "telecom": [ + { + "system": "phone", + "value": "248-555-7834", + "use": "home" + }, + { + "system": "phone", + "value": "248-555-7845", + "use": "mobile" + } + ], + "gender": "male", + "birthDate": "1936-05-29", + "address": [ + { + "use": "home", + "type": "postal", + "line": [ + "751 E Apple Drive" + ], + "city": "Novi", + "district": "Oakland County", + "state": "MI", + "postalCode": "48376" + } + ] + }, + "request": { + "method": "PUT", + "url": "Patient/example-opioidcds/_history/1" + } + }, + { + "resource": { + "resourceType": "Observation", + "id": "example-opioidcds", + "status": "final", + "code": { + "coding": [ + { + "system": "http://loinc.org", + "code": "3779-6" + } + ] + }, + "subject": { + "reference": "Patient/example-opioidcds" + }, + "effectiveDateTime": "2017-12-12", + "interpretation": { + "coding": [ + { + "system": "https://www.hl7.org/fhir/v2/0078", + "code": "POS" + } + ] + } + }, + "request": { + "method": "PUT", + "url": "Observation/example-opioidcds" + } + }, + { + "resource": { + "resourceType": "Library", + "id": "LibraryEvaluationTestDependency", + "extension": [ + { + "url": "http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/cqfm-softwaresystem", + "valueReference": { + "reference": "Device/cqf-tooling" + } + }, + { + "url": "http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/cqfm-softwaresystem", + "valueReference": { + "reference": "cqf-tooling" + } + } + ], + "url": "http://localhost:8080/fhir/Library/LibraryEvaluationTestDependency", + "version": "1.0.000", + "name": "LibraryEvaluationTestDependency", + "relatedArtifact": [ + { + "type": "depends-on", + "display": "FHIR model information", + "resource": "http://fhir.org/guides/cqf/common/Library/FHIR-ModelInfo|4.0.1" + } + ], + "parameter": [ + { + "name": "Patient", + "use": "out", + "min": 0, + "max": "1", + "type": "Patient" + }, + { + "name": "Encounters", + "use": "out", + "min": 0, + "max": "*", + "type": "Encounter" + } + ], + "dataRequirement": [ + { + "type": "Patient", + "profile": [ + "http://hl7.org/fhir/StructureDefinition/Patient" + ] + }, + { + "type": "Encounter", + "profile": [ + "http://hl7.org/fhir/StructureDefinition/Encounter" + ] + } + ], + "content": [ + { + "contentType": "text/cql", + "data": "bGlicmFyeSBMaWJyYXJ5RXZhbHVhdGlvblRlc3REZXBlbmRlbmN5IHZlcnNpb24gJzEuMC4wMDAnCgp1c2luZyBGSElSIHZlcnNpb24gJzMuMC4wJwoKY29udGV4dCBQYXRpZW50CgpkZWZpbmUgIkVuY291bnRlcnMiOgogIFtFbmNvdW50ZXJdCg==" + } + ] + }, + "request": { + "method": "PUT", + "url": "Library/LibraryEvaluationTestDependency" + } + }, + { + "resource": { + "resourceType": "Library", + "id": "LibraryEvaluationTest", + "extension": [ + { + "url": "http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/cqfm-softwaresystem", + "valueReference": { + "reference": "Device/cqf-tooling" + } + }, + { + "url": "http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/cqfm-softwaresystem", + "valueReference": { + "reference": "cqf-tooling" + } + } + ], + "url": "http://localhost:8080/fhir/Library/LibraryEvaluationTest", + "version": "1.0.000", + "name": "LibraryEvaluationTest", + "relatedArtifact": [ + { + "type": "depends-on", + "display": "FHIR model information", + "resource": "http://fhir.org/guides/cqf/common/Library/FHIR-ModelInfo|4.0.1" + }, + { + "type": "depends-on", + "resource": "http://fhir.org/guides/cqf/common/Library/LibraryEvaluationTestDependency|1.0.000" + } + ], + "parameter": [ + { + "name": "Patient", + "use": "out", + "min": 0, + "max": "1", + "type": "Patient" + }, + { + "name": "Has Bone Narrowing Conditions", + "use": "out", + "min": 0, + "max": "1", + "type": "boolean" + }, + { + "name": "Has Osteonecrosis Knee Conditions", + "use": "out", + "min": 0, + "max": "1", + "type": "boolean" + }, + { + "name": "Has Angular Deformity Knee Conditions", + "use": "out", + "min": 0, + "max": "1", + "type": "boolean" + }, + { + "name": "Has Presence of significant radiographic findings, which may include knee joint destruction, angular deformity, or severe narrowing", + "use": "out", + "min": 0, + "max": "1", + "type": "boolean" + }, + { + "name": "Has Failure of Previous Proximal Tibial or Distal Femoral Osteotomy", + "use": "out", + "min": 0, + "max": "1", + "type": "boolean" + } + ], + "dataRequirement": [ + { + "type": "Patient", + "profile": [ + "http://hl7.org/fhir/StructureDefinition/Patient" + ] + }, + { + "type": "Condition", + "profile": [ + "http://hl7.org/fhir/StructureDefinition/Condition" + ] + }, + { + "type": "Procedure", + "profile": [ + "http://hl7.org/fhir/StructureDefinition/Procedure" + ] + } + ], + "content": [ + { + "contentType": "text/cql", + "data": "bGlicmFyeSBMaWJyYXJ5RXZhbHVhdGlvblRlc3QgdmVyc2lvbiAnMS4wLjAwMCcKCnVzaW5nIEZISVIgdmVyc2lvbiAnMy4wLjAnCgppbmNsdWRlIExpYnJhcnlFdmFsdWF0aW9uVGVzdERlcGVuZGVuY3kgdmVyc2lvbiAnMS4wLjAwMCcgY2FsbGVkIExFVDIKCmNvbnRleHQgUGF0aWVudAoKLy8gVGhpcyBleHByZXNzaW9uIGRvZXMgbm90IGRpcmVjdGx5IHJldHJpZXZlIGRhdGEgYW5kIHNvIGl0IGlzIG5vdCBuZWNlc3NhcnkgZm9yCi8vIERhdGFSZXF1aXJlbWVudCBpZGVudGlmaWNhdGlvbi4gSXQgaXMgY29tcG9zZWQgdGhpcyB3YXMgaW4gdGhlIGluZGljYXRpb25zIHRob3VnaAovLyBhbmQgc28gaXQgc2VlbXMgdGhhdCBpdCBfaXNfIHRoZSAicXVlc3Rpb24iIGFzIG9wcG9zZWQgdG8gdGhlIHVuZGVybHlpbmcgcmV0cmlldmFscwovLyBiZWluZy4KLyogN0FFQjMyRDdCRDhFNTJDNy1GMUNGQzExNTc5NjJDMUYzLTVEQjBEMERBNTM3OTA4RTUgKi8KZGVmaW5lICJIYXMgUHJlc2VuY2Ugb2Ygc2lnbmlmaWNhbnQgcmFkaW9ncmFwaGljIGZpbmRpbmdzLCB3aGljaCBtYXkgaW5jbHVkZSBrbmVlIGpvaW50IGRlc3RydWN0aW9uLCBhbmd1bGFyIGRlZm9ybWl0eSwgb3Igc2V2ZXJlIG5hcnJvd2luZyI6CiAgIkhhcyBCb25lIE5hcnJvd2luZyBDb25kaXRpb25zIgogICAgb3IgIkhhcyBPc3Rlb25lY3Jvc2lzIEtuZWUgQ29uZGl0aW9ucyIKICAgIG9yICJIYXMgQW5ndWxhciBEZWZvcm1pdHkgS25lZSBDb25kaXRpb25zIgoKZGVmaW5lICJIYXMgQm9uZSBOYXJyb3dpbmcgQ29uZGl0aW9ucyI6CiAgZXhpc3RzIChbQ29uZGl0aW9uXSkKCmRlZmluZSAiSGFzIE9zdGVvbmVjcm9zaXMgS25lZSBDb25kaXRpb25zIjoKICBleGlzdHMgKFtDb25kaXRpb25dKQoKZGVmaW5lICJIYXMgQW5ndWxhciBEZWZvcm1pdHkgS25lZSBDb25kaXRpb25zIjoKICBleGlzdHMgKFtDb25kaXRpb25dKQoKLyogIlBhdGhJZCI6ICI3QUVCMzJEN0JEOEU1MkM3LUQ5RTkxMDRBQkQ0OEIzRUQiICovCmRlZmluZSAiSGFzIEZhaWx1cmUgb2YgUHJldmlvdXMgUHJveGltYWwgVGliaWFsIG9yIERpc3RhbCBGZW1vcmFsIE9zdGVvdG9teSI6CiAgZXhpc3RzIChbUHJvY2VkdXJlXSkKCmRlZmluZSAiRW5jb3VudGVycyBmcm9tIERlcGVuZGVuY3kgTGlicmFyeSI6CiAgTEVUMi4iRW5jb3VudGVycyIKCmRlZmluZSAiSGFzIEVuY291bnRlcnMiOgogICAgZXhpc3RzICgiRW5jb3VudGVycyBmcm9tIERlcGVuZGVuY3kgTGlicmFyeSIpCg==" + } + ] + }, + "request": { + "method": "PUT", + "url": "Library/LibraryEvaluationTest" + } + } + ] +} diff --git a/plugin/cr/src/test/resources/DataReqLibraryTransactionBundle.json b/plugin/cr/src/test/resources/DataReqLibraryTransactionBundleR4.json similarity index 99% rename from plugin/cr/src/test/resources/DataReqLibraryTransactionBundle.json rename to plugin/cr/src/test/resources/DataReqLibraryTransactionBundleR4.json index e54ed9082..79a89489b 100644 --- a/plugin/cr/src/test/resources/DataReqLibraryTransactionBundle.json +++ b/plugin/cr/src/test/resources/DataReqLibraryTransactionBundleR4.json @@ -1,7 +1,7 @@ { "resourceType": "Bundle", "type": "transaction", - "id": "LibraryTrsnsactionBundle", + "id": "LibraryTrsnsactionBundleR4", "entry": [ { "resource": { diff --git a/plugin/cr/src/test/resources/Exm105Dstu3MeasureBundle.json b/plugin/cr/src/test/resources/Exm105Dstu3MeasureBundle.json index cb4249c6f..a3ef3e4af 100644 --- a/plugin/cr/src/test/resources/Exm105Dstu3MeasureBundle.json +++ b/plugin/cr/src/test/resources/Exm105Dstu3MeasureBundle.json @@ -2579,6 +2579,7 @@ "resource": { "resourceType": "Library", "id": "EXM105-FHIR3-8.0.000", + "url": "http://hl7.org/fhir/us/cqfmeasures/Library/EXM105-FHIR3-8.0.000", "text": { "status": "generated", "div": "
\n \n \n
Id: library-EXM105-FHIR3-8.0.000
Type: Logic Library
Version: 8.0.000
Status: active
Related:

type: depends-on

Resource:
reference: Library/FHIRHelpers-3.0.0

type: depends-on

Resource:
reference: Library/MATGlobalCommonFunctions-FHIR3-4.0.000

type: depends-on

Resource:
reference: Library/SupplementalDataElements-FHIR3-1.0.0

type: depends-on

Resource:
reference: Library/TJCOverall-FHIR3-3.6.000

Data Requirements:

type: Encounter

code filter:
path: type
valueset: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.424

type: Patient

type: AllergyIntolerance

code filter:
path: code
valueset: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.423

type: MedicationRequest

type: MedicationRequest

type: Observation

code filter:
path: code
valueset: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.215

type: ProcedureRequest

code filter:
path: code
valueset: http://cts.nlm.nih.gov/fhir/ValueSet/1.3.6.1.4.1.33895.1.3.0.45

type: Procedure

code filter:
path: code
valueset: http://cts.nlm.nih.gov/fhir/ValueSet/1.3.6.1.4.1.33895.1.3.0.45

Content: type: text/cql
library EXM105_FHIR3 version '8.0.000'\n\n/*\nBased on CMS105v8 - Discharged on Statin Medication\nAuthor: TJC\n*/\n\nusing FHIR version '3.0.0'\n\ninclude FHIRHelpers version '3.0.0'\ninclude MATGlobalCommonFunctions_FHIR3 version '4.0.000' called Global\ninclude SupplementalDataElements_FHIR3 version '1.0.0' called SDE\ninclude TJCOverall_FHIR3 version '3.6.000' called TJC\n\ncodesystem "LOINC": 'http://loinc.org'\ncodesystem "SNOMEDCT": 'http://snomed.info/sct/731000124108'\ncodesystem "Diagnosis Role": 'http://hl7.org/fhir/diagnosis-role'\ncodesystem "RequestIntent": 'http://hl7.org/fhir/request-intent'\n\nvalueset "Comfort Measures": 'http://cts.nlm.nih.gov/fhir/ValueSet/1.3.6.1.4.1.33895.1.3.0.45'\nvalueset "Discharged to Health Care Facility for Hospice Care": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.207'\nvalueset "Discharge To Acute Care Facility": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.87'\nvalueset "Discharged to Home for Hospice Care": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.209'\nvalueset "Emergency Department Visit": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.292'\nvalueset "Ethnicity": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.114222.4.11.837'\nvalueset "Ischemic Stroke": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.247'\nvalueset "Hemorrhagic Stroke": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.212'\nvalueset "LDL-c": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.215'\nvalueset "Left Against Medical Advice": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.308'\nvalueset "Medical Reason": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.473'\nvalueset "Non-Elective Inpatient Encounter": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.424'\nvalueset "Observation Services": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1111.143'\nvalueset "ONC Administrative Sex": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1'\nvalueset "Patient Expired": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.309'\nvalueset "Patient Refusal": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.93'\nvalueset "Payer": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.114222.4.11.3591'\nvalueset "Race": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.114222.4.11.836'\nvalueset "Statin Allergen": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.423'\nvalueset "Statin Grouper": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1110.19'\n\n// TODO: Use NLM VSAC Canonical URLs\ncode "Birthdate": '21112-8' from "LOINC" display 'Birth date'\ncode "Dead": '419099009' from "SNOMEDCT" display 'Dead'\n//code "Medication-dischargeMedication": '8654-6' from "LOINC" display 'Hospital Discharge medications'\n\ncode "Billing": 'billing' from "Diagnosis Role" display 'Billing'\ncode "Order": 'order' from "RequestIntent" display 'Order'\n\nparameter "Measurement Period" Interval<DateTime>\n  default Interval[@2019-01-01T00:00:00.0, @2020-01-01T00:00:00.0)\n\ncontext Patient\n\ndefine "SDE Ethnicity":\n  SDE."SDE Ethnicity"\n\ndefine "SDE Payer":\n\tSDE."SDE Payer"\n\ndefine "SDE Race":\n  SDE."SDE Race"\n\ndefine "SDE Sex":\n\tSDE."SDE Sex"\n\ndefine "Initial Population":\n\t"Encounter with Principal Diagnosis and Age"\n\ndefine "Encounter with Principal Diagnosis and Age":\n\t"All Stroke Encounter" AllStrokeEncounter\n\t\twith ["Patient"] BirthDate\n\t\t\tsuch that AgeInYearsAt(AllStrokeEncounter.period.start) >= 18\n\ndefine "All Stroke Encounter":\n\t"Non Elective Inpatient Encounter" NonElectiveEncounter\n\t\twhere Global.PrincipalDiagnosis(NonElectiveEncounter).code in "Hemorrhagic Stroke"\n\t\tor Global.PrincipalDiagnosis(NonElectiveEncounter).code in "Ischemic Stroke"\n\ndefine "Non Elective Inpatient Encounter":\n\t["Encounter": "Non-Elective Inpatient Encounter"] NonElectiveEncounter\n\t\twhere Global."LengthInDays"(NonElectiveEncounter.period)<= 120\n\t\t\tand NonElectiveEncounter.period ends during "Measurement Period"\n\ndefine "Denominator":\n\tTJC."Ischemic Stroke Encounter"\n\ndefine "Statin Allergy":\n\t["AllergyIntolerance": "Statin Allergen"]\n\ndefine "Numerator":\n\t"Ischemic Stroke Encounter" IschemicStrokeEncounter\n\t\twith "Statin at Discharge" DischargeStatin\n\t\t\tsuch that DischargeStatin.authoredOn during IschemicStrokeEncounter.period\n\ndefine "Ischemic Stroke Encounter":\n\t"Encounter with Principal Diagnosis and Age" EncounterWithAge\n\t\twhere Global.PrincipalDiagnosis(EncounterWithAge).code in "Ischemic Stroke"\n\n// Medication orders at discharge, how do we know that these are ordered with the intent to be taken discharge rather than the inpatient stay.\ndefine "Statin at Discharge":\n\t["MedicationRequest"] Statin\n\t\twhere (Statin.medication as CodeableConcept) in "Statin Grouper"\n\t\t\tand Statin.intent = 'order'\n\ndefine "Statin Not Given at Discharge":\n\t["MedicationRequest"] NoStatin\n\t\twhere (NoStatin.medication as CodeableConcept) in "Statin Grouper"\n\t\t\tand (singleton from NoStatin.reasonCode in "Medical Reason"\n\t\t\t\tor singleton from NoStatin.reasonCode in "Patient Refusal")\n\n//Folling function copied from MATGlobalCommonFunctions 2.0 in cqf-measures github repo\ndefine function "Normalize Onset"(onset Choice<FHIR.dateTime, FHIR.Age, FHIR.Period, FHIR.Range, FHIR.string>):\n\tif onset is FHIR.dateTime then Interval[onset.value, onset.value]\n\telse if onset is FHIR.Period then FHIRHelpers.ToInterval(onset as FHIR.Period)\n\telse null\n\ndefine "Encounter with Max LDL less than 70 mg per dL":\n\t"Ischemic Stroke Encounter" IschemicStrokeEncounter\n\t\twhere Max(["Observation": "LDL-c"] Ldl\n\t\t\t\twhere Ldl.issued during Interval[IschemicStrokeEncounter.period.start - 30 days,IschemicStrokeEncounter.period.end]\n\t\t\t\treturn (Ldl.value as Quantity)\n\t\t) < 70\n\ndefine "Denominator Exception":\n\t("Ischemic Stroke Encounter" IschemicStrokeEncounter\n\t\twith "Statin Not Given at Discharge" NoDischargeStatin\n\t\t\tsuch that NoDischargeStatin.authoredOn during IschemicStrokeEncounter.period\n\t)\n\tunion\n\t("Ischemic Stroke Encounter" IschemicStrokeEncounter\n\t\twith "Statin Allergy" StatinAllergy\n\t\t\tsuch that "Normalize Onset"(StatinAllergy.onset) on or before end of IschemicStrokeEncounter.period)\n\ndefine "Denominator Exclusion":\n\t"Ischemic Stroke Encounters with Discharge Status"\n\tunion\n\t"Comfort Measures during Hospitalization"\n\ndefine "Ischemic Stroke Encounters with Discharge Status":\n\t("Ischemic Stroke Encounter" IschemicStrokeEncounter\n\t\twhere IschemicStrokeEncounter.hospitalization.dischargeDisposition in "Discharge To Acute Care Facility"\n\t\t\tor IschemicStrokeEncounter.hospitalization.dischargeDisposition in "Left Against Medical Advice"\n\t\t\tor IschemicStrokeEncounter.hospitalization.dischargeDisposition in "Patient Expired"\n\t\t\tor IschemicStrokeEncounter.hospitalization.dischargeDisposition in "Discharged to Home for Hospice Care"\n\t\t\tor IschemicStrokeEncounter.hospitalization.dischargeDisposition in "Discharged to Health Care Facility for Hospice Care"\n\t)\n\ndefine "Comfort Measures during Hospitalization":\n\t"Ischemic Stroke Encounter" IschemicStrokeEncounter\n\t\twith "Intervention Comfort Measures" ComfortMeasure\n\t\t\tsuch that ComfortMeasure.authoredOn during Global."Hospitalization"(IschemicStrokeEncounter)\n\n/*\ndefine "Intervention Comfort Measures":\n\t(["ProcedureRequest": "Comfort Measures"] P\n\t\twhere P.intent = 'order')\n\t\tunion ["Procedure": "Comfort Measures"]\n*/\n\ndefine "Intervention Comfort Measures":\n\t(["ProcedureRequest": "Comfort Measures"] P\n\t\twhere P.intent in {'plan', 'order'})\n\t\tunion\n\t\t(["Procedure": "Comfort Measures"] IntervetionPerformed\n\t\twhere IntervetionPerformed.status in {'complete', 'in progress'})\n
\n \n \n
\n
" @@ -3148,7 +3149,7 @@ "citation": "Weiss, R., Harder, M., & Rowe, J. (2003, May). The relationship between nonfasting and fasting lipid measurements in patients with or without type 2 diabetes mellitus receiving treatment with 3-hydroxy-3-methylglutaryl-coenzyme a reductase inhibitors. Clinical Therapeutics, 25(5), 1490-1497." } ], "library": [ { - "reference": "Library/EXM105-FHIR3-8.0.000" + "reference": "http://hl7.org/fhir/us/cqfmeasures/Library/EXM105-FHIR3-8.0.000" } ], "disclaimer": "These performance measures are not clinical guidelines and do not establish a standard of medical care, and have not been tested for all potential applications. The measures and specifications are provided without warranty.", "scoring": {