National Healthcare Safety Network (NHSN) Digital Quality Measure (dQM) Reporting Implementation Guide
1.0.0-ballot - STU1 Ballot United States of America flag

National Healthcare Safety Network (NHSN) Digital Quality Measure (dQM) Reporting Implementation Guide, published by HL7 International / Public Health. This guide is not an authorized publication; it is the continuous build for version 1.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/nhsn-dqm/ and changes regularly. See the Directory of published versions

: Acute Care Hospital Initial Population Library - JSON Representation

Page standards status: Informative

Raw json | Download

{
  "resourceType" : "Library",
  "id" : "NHSNdQMAcuteCareHospitalInitialPopulationLibrary",
  "text" : {
    "status" : "generated",
    "div" : "<div xmlns=\"http://www.w3.org/1999/xhtml\"><p class=\"res-header-id\"><b>Generated Narrative: Library NHSNdQMAcuteCareHospitalInitialPopulationLibrary</b></p><a name=\"NHSNdQMAcuteCareHospitalInitialPopulationLibrary\"> </a><a name=\"hcNHSNdQMAcuteCareHospitalInitialPopulationLibrary\"> </a><a name=\"NHSNdQMAcuteCareHospitalInitialPopulationLibrary-en-US\"> </a><h2>Related Artifacts</h2><table class=\"grid\"><tr><td>Depends On</td><td>FHIR model information</td><td><a href=\"http://fhir.org/guides/cqf/common/4.0.1/4.0.1/Library-FHIR-ModelInfo.html\">http://fhir.org/guides/cqf/common/Library/FHIR-ModelInfo|4.0.1</a></td></tr><tr><td>Depends On</td><td>Library FHIRHelpers</td><td><a href=\"http://fhir.org/guides/cqf/common/4.0.1/4.0.1/Library-FHIRHelpers.html\">http://fhir.org/guides/cqf/common/Library/FHIRHelpers|4.0.1</a></td></tr><tr><td>Depends On</td><td>Library Global</td><td><a href=\"http://hl7.org/fhir/us/cqfmeasures/STU4/Library-MATGlobalCommonFunctions.html\">http://hl7.org/fhir/us/cqfmeasures/Library/MATGlobalCommonFunctions</a></td></tr><tr><td>Depends On</td><td>Library SDE</td><td><a href=\"http://hl7.org/fhir/us/cqfmeasures/STU4/Library-SupplementalDataElements.html\">http://hl7.org/fhir/us/cqfmeasures/Library/SupplementalDataElements</a></td></tr><tr><td>Depends On</td><td>Code system ActCode</td><td><a href=\"http://terminology.hl7.org/5.5.0/CodeSystem-v3-ActCode.html\">ActCode</a></td></tr><tr><td>Depends On</td><td>Code system Observation Category</td><td><a href=\"http://terminology.hl7.org/5.5.0/CodeSystem-observation-category.html\">Observation Category Codes</a></td></tr><tr><td>Depends On</td><td>Code system LOINC</td><td><a href=\"http://terminology.hl7.org/5.5.0/CodeSystem-v3-loinc.html\">Logical Observation Identifiers, Names and Codes (LOINC)</a></td></tr><tr><td>Depends On</td><td>Code system V2-0074</td><td><a href=\"http://terminology.hl7.org/5.2.0/CodeSystem-v2-0074.html\">diagnosticServiceSectionId</a></td></tr><tr><td>Depends On</td><td>Value set Inpatient, Emergency, and Observation Locations</td><td><a href=\"https://vsac.nlm.nih.gov/valueset/2.16.840.1.113762.1.4.1046.265/expansion\">Inpatient, Emergency, and Observation Locations</a></td></tr><tr><td>Depends On</td><td>Value set Emergency Department Visit</td><td><a href=\"https://vsac.nlm.nih.gov/valueset/2.16.840.1.113883.3.117.1.7.1.292/expansion\">Emergency Department Visit</a></td></tr><tr><td>Depends On</td><td>Value set Encounter Inpatient</td><td><a href=\"https://vsac.nlm.nih.gov/valueset/2.16.840.1.113883.3.666.5.307/expansion\">Encounter Inpatient</a></td></tr><tr><td>Depends On</td><td>Value set Observation Services</td><td><a href=\"https://vsac.nlm.nih.gov/valueset/2.16.840.1.113762.1.4.1111.143/expansion\">Observation Services</a></td></tr><tr><td>Depends On</td><td>Value set NHSN Inpatient Encounter Class Codes</td><td><a href=\"https://vsac.nlm.nih.gov/valueset/2.16.840.1.113762.1.4.1046.274/expansion\">http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1046.274</a></td></tr></table><h2>Parameters</h2><table class=\"grid\"><tr><td>Measurement Period</td><td>in</td><td>0</td><td>1</td><td>Period</td></tr><tr><td>Patient</td><td>out</td><td>0</td><td>1</td><td>Patient</td></tr><tr><td>Qualifying Encounters During Measurement Period</td><td>out</td><td>0</td><td>*</td><td>Encounter</td></tr><tr><td>Encounters</td><td>out</td><td>0</td><td>*</td><td>Encounter</td></tr><tr><td>Encounters with Patient Hospital Locations</td><td>out</td><td>0</td><td>*</td><td>Encounter</td></tr><tr><td>Initial Population</td><td>out</td><td>0</td><td>*</td><td>Encounter</td></tr><tr><td>DiagnosticReports</td><td>out</td><td>0</td><td>*</td><td>DiagnosticReport</td></tr><tr><td>Observations</td><td>out</td><td>0</td><td>*</td><td>Observation</td></tr><tr><td>IP Encounters Overlap Measurement Period</td><td>out</td><td>0</td><td>*</td><td>Encounter</td></tr><tr><td>Get Locations from IP Encounters in Measurement Period</td><td>out</td><td>0</td><td>*</td><td>Location</td></tr><tr><td>SDE Condition</td><td>out</td><td>0</td><td>*</td><td>Condition</td></tr><tr><td>SDE Device</td><td>out</td><td>0</td><td>*</td><td>Device</td></tr><tr><td>SDE DiagnosticReport Lab</td><td>out</td><td>0</td><td>*</td><td>DiagnosticReport</td></tr><tr><td>SDE DiagnosticReport Note</td><td>out</td><td>0</td><td>*</td><td>DiagnosticReport</td></tr><tr><td>SDE DiagnosticReport Others</td><td>out</td><td>0</td><td>*</td><td>DiagnosticReport</td></tr><tr><td>SDE Encounter</td><td>out</td><td>0</td><td>*</td><td>Encounter</td></tr><tr><td>SDE Location</td><td>out</td><td>0</td><td>*</td><td>Location</td></tr><tr><td>SDE Medication Administration</td><td>out</td><td>0</td><td>*</td><td>MedicationAdministration</td></tr><tr><td>SDE Medication Request</td><td>out</td><td>0</td><td>*</td><td>MedicationRequest</td></tr><tr><td>SDE Medication</td><td>out</td><td>0</td><td>*</td><td>Medication</td></tr><tr><td>SDE Observation Lab Category</td><td>out</td><td>0</td><td>*</td><td>Observation</td></tr><tr><td>SDE Observation Vital Signs Category</td><td>out</td><td>0</td><td>*</td><td>Observation</td></tr><tr><td>SDE Observation Category</td><td>out</td><td>0</td><td>*</td><td>Observation</td></tr><tr><td>SDE Coverage</td><td>out</td><td>0</td><td>*</td><td>Coverage</td></tr><tr><td>SDE Procedure</td><td>out</td><td>0</td><td>*</td><td>Procedure</td></tr><tr><td>SDE Specimen</td><td>out</td><td>0</td><td>*</td><td>Specimen</td></tr><tr><td>SDE Service Request</td><td>out</td><td>0</td><td>*</td><td>ServiceRequest</td></tr><tr><td>SDE Minimal Patient</td><td>out</td><td>0</td><td>1</td><td>Patient</td></tr></table><h2>Data Requirements</h2><table class=\"grid\"><tr><td colspan=\"2\"><b>Type</b>: <a href=\"http://hl7.org/fhir/R4/patient.html\">Patient</a> (<a href=\"http://hl7.org/fhir/R4/patient.html\">Patient</a>)</td></tr></table><table class=\"grid\"><tr><td colspan=\"2\"><b>Type</b>: <a href=\"http://hl7.org/fhir/R4/encounter.html\">Encounter</a> (<a href=\"http://hl7.org/fhir/R4/encounter.html\">Encounter</a>)</td></tr><tr style=\"background-color: #efefef\"><td>Filter</td><td>Value</td></tr><tr><td>type</td><td>In ValueSet <a href=\"https://vsac.nlm.nih.gov/valueset/2.16.840.1.113883.3.666.5.307/expansion\">Encounter Inpatient</a></td></tr></table><table class=\"grid\"><tr><td colspan=\"2\"><b>Type</b>: <a href=\"http://hl7.org/fhir/R4/encounter.html\">Encounter</a> (<a href=\"http://hl7.org/fhir/R4/encounter.html\">Encounter</a>)</td></tr><tr style=\"background-color: #efefef\"><td>Filter</td><td>Value</td></tr><tr><td>type</td><td>In ValueSet <a href=\"https://vsac.nlm.nih.gov/valueset/2.16.840.1.113883.3.117.1.7.1.292/expansion\">Emergency Department Visit</a></td></tr></table><table class=\"grid\"><tr><td colspan=\"2\"><b>Type</b>: <a href=\"http://hl7.org/fhir/R4/encounter.html\">Encounter</a> (<a href=\"http://hl7.org/fhir/R4/encounter.html\">Encounter</a>)</td></tr><tr style=\"background-color: #efefef\"><td>Filter</td><td>Value</td></tr><tr><td>type</td><td>In ValueSet <a href=\"https://vsac.nlm.nih.gov/valueset/2.16.840.1.113762.1.4.1111.143/expansion\">Observation Services</a></td></tr></table><table class=\"grid\"><tr><td colspan=\"2\"><b>Type</b>: <a href=\"http://hl7.org/fhir/R4/encounter.html\">Encounter</a> (<a href=\"http://hl7.org/fhir/R4/encounter.html\">Encounter</a>)</td></tr><tr style=\"background-color: #efefef\"><td>Filter</td><td>Value</td></tr><tr><td>class</td><td>In ValueSet <a href=\"https://vsac.nlm.nih.gov/valueset/2.16.840.1.113762.1.4.1046.274/expansion\">http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1046.274</a></td></tr></table><table class=\"grid\"><tr><td colspan=\"2\"><b>Type</b>: <a href=\"http://hl7.org/fhir/R4/encounter.html\">Encounter</a> (<a href=\"http://hl7.org/fhir/R4/encounter.html\">Encounter</a>)</td></tr></table><table class=\"grid\"><tr><td colspan=\"2\"><b>Type</b>: <a href=\"http://hl7.org/fhir/R4/location.html\">Location</a> (<a href=\"http://hl7.org/fhir/R4/location.html\">Location</a>)</td></tr></table><table class=\"grid\"><tr><td colspan=\"2\"><b>Type</b>: <a href=\"http://hl7.org/fhir/R4/diagnosticreport.html\">DiagnosticReport</a> (<a href=\"http://hl7.org/fhir/R4/diagnosticreport.html\">DiagnosticReport</a>)</td></tr></table><table class=\"grid\"><tr><td colspan=\"2\"><b>Type</b>: <a href=\"http://hl7.org/fhir/R4/observation.html\">Observation</a> (<a href=\"http://hl7.org/fhir/R4/observation.html\">Observation</a>)</td></tr></table><table class=\"grid\"><tr><td colspan=\"2\"><b>Type</b>: <a href=\"http://hl7.org/fhir/R4/condition.html\">Condition</a> (<a href=\"http://hl7.org/fhir/R4/condition.html\">Condition</a>)</td></tr></table><table class=\"grid\"><tr><td colspan=\"2\"><b>Type</b>: <a href=\"http://hl7.org/fhir/R4/device.html\">Device</a> (<a href=\"http://hl7.org/fhir/R4/device.html\">Device</a>)</td></tr></table><table class=\"grid\"><tr><td colspan=\"2\"><b>Type</b>: <a href=\"http://hl7.org/fhir/R4/medicationadministration.html\">MedicationAdministration</a> (<a href=\"http://hl7.org/fhir/R4/medicationadministration.html\">MedicationAdministration</a>)</td></tr></table><table class=\"grid\"><tr><td colspan=\"2\"><b>Type</b>: <a href=\"http://hl7.org/fhir/R4/medicationrequest.html\">MedicationRequest</a> (<a href=\"http://hl7.org/fhir/R4/medicationrequest.html\">MedicationRequest</a>)</td></tr></table><table class=\"grid\"><tr><td colspan=\"2\"><b>Type</b>: <a href=\"http://hl7.org/fhir/R4/medication.html\">Medication</a> (<a href=\"http://hl7.org/fhir/R4/medication.html\">Medication</a>)</td></tr></table><table class=\"grid\"><tr><td colspan=\"2\"><b>Type</b>: <a href=\"http://hl7.org/fhir/R4/coverage.html\">Coverage</a> (<a href=\"http://hl7.org/fhir/R4/coverage.html\">Coverage</a>)</td></tr></table><table class=\"grid\"><tr><td colspan=\"2\"><b>Type</b>: <a href=\"http://hl7.org/fhir/R4/procedure.html\">Procedure</a> (<a href=\"http://hl7.org/fhir/R4/procedure.html\">Procedure</a>)</td></tr></table><table class=\"grid\"><tr><td colspan=\"2\"><b>Type</b>: <a href=\"http://hl7.org/fhir/R4/specimen.html\">Specimen</a> (<a href=\"http://hl7.org/fhir/R4/specimen.html\">Specimen</a>)</td></tr></table><table class=\"grid\"><tr><td colspan=\"2\"><b>Type</b>: <a href=\"http://hl7.org/fhir/R4/servicerequest.html\">ServiceRequest</a> (<a href=\"http://hl7.org/fhir/R4/servicerequest.html\">ServiceRequest</a>)</td></tr></table><h2>Contents</h2><p><code>text/cql</code></p><pre><code>library NHSNdQMAcuteCareHospitalInitialPopulation version '0.0.014'\n\nusing FHIR version '4.0.1'\n\ninclude FHIRHelpers version '4.0.1' called FHIRHelpers\ninclude MATGlobalCommonFunctionsFHIR4 version '6.1.000' called Global\ninclude SupplementalDataElementsFHIR4 version '2.0.000' called SDE\ninclude SharedResourceCreation version '0.1.005' called SharedResource\n\ncodesystem &quot;ActCode&quot;: 'http://terminology.hl7.org/CodeSystem/v3-ActCode'\ncodesystem &quot;Observation Category&quot;: 'http://terminology.hl7.org/CodeSystem/observation-category'\ncodesystem &quot;LOINC&quot;: 'http://loinc.org' \ncodesystem &quot;V2-0074&quot;: 'http://terminology.hl7.org/CodeSystem/v2-0074'\n\nvalueset &quot;Inpatient, Emergency, and Observation Locations&quot;: 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1046.265'\nvalueset &quot;Emergency Department Visit&quot;: 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.292'\nvalueset &quot;Encounter Inpatient&quot;: 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.666.5.307'\nvalueset &quot;Observation Services&quot;: 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1111.143'\nvalueset &quot;NHSN Inpatient Encounter Class Codes&quot;: 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1046.274'\n\n//code for Observation Category\ncode &quot;laboratory&quot;: 'laboratory' from &quot;Observation Category&quot; display 'Laboratory'\ncode &quot;social-history&quot;: 'social-history' from &quot;Observation Category&quot; display 'Social History'\ncode &quot;vital-signs&quot;: 'vital-signs' from &quot;Observation Category&quot; display 'Vital Signs'\ncode &quot;imaging&quot;: 'imaging' from &quot;Observation Category&quot; display 'Imaging'\ncode &quot;procedure&quot;: 'procedure' from &quot;Observation Category&quot; display 'Procedure'\ncode &quot;survey&quot;: 'survey' from &quot;Observation Category&quot; display 'Survey'\n\n//code for Diagnostic Report Category\ncode &quot;LAB&quot;: 'LAB' from &quot;V2-0074&quot; display 'Laboratory'\ncode &quot;Radiology&quot;: 'LP29684-5' from &quot;LOINC&quot; display 'Radiology'\ncode &quot;Pathology&quot;: 'LP7839-6' from &quot;LOINC&quot; display 'Pathology'\ncode &quot;Cardiology&quot;: 'LP29708-2' from &quot;LOINC&quot; display 'Cardiology'\n\nparameter &quot;Measurement Period&quot; \n    default Interval[@2024-01-01T00:00:00.0, @2024-01-31T00:00:00.0)\n\ncontext Patient \n\ndefine &quot;Qualifying Encounters During Measurement Period&quot;:\n ( [Encounter: &quot;Encounter Inpatient&quot;]\n  union [Encounter: &quot;Emergency Department Visit&quot;]\n  union [Encounter: &quot;Observation Services&quot;]\n  union [Encounter: class in &quot;NHSN Inpatient Encounter Class Codes&quot;]) QualifyingEncounters\n  where QualifyingEncounters.status in {'in-progress', 'finished', 'triaged', 'onleave', 'entered-in-error'}\n    and QualifyingEncounters.period overlaps &quot;Measurement Period&quot; \n\ndefine &quot;Encounters with Patient Hospital Locations&quot;:\n  &quot;Encounters&quot; Encounters\n  where exists(\n    Encounters.location EncounterLocation\n    where Global.GetLocation(EncounterLocation.location).type in &quot;Inpatient, Emergency, and Observation Locations&quot;\n      and EncounterLocation.period overlaps Encounters.period\n  )\n  and Encounters.status in {'in-progress', 'finished', 'triaged', 'onleave', 'entered-in-error'}\n  and Encounters.period overlaps &quot;Measurement Period&quot;\n\ndefine &quot;Initial Population&quot;:\n  &quot;Qualifying Encounters During Measurement Period&quot;\n  union &quot;Encounters with Patient Hospital Locations&quot;\n\ndefine &quot;Encounters&quot;:\n  [Encounter]\n\ndefine &quot;DiagnosticReports&quot;:\n  [DiagnosticReport]\n\ndefine &quot;Observations&quot;:\n  [Observation]\n\n//Double checking for IP's period during MP as IP is created out of qualifying encounters, which checks for it, \n//and encounter's locations, which doesn't\ndefine &quot;IP Encounters Overlap Measurement Period&quot;:\n  &quot;Initial Population&quot; IP\n  where IP.period overlaps &quot;Measurement Period&quot;\n\ndefine &quot;Get Locations from IP Encounters in Measurement Period&quot;:\n  flatten(&quot;IP Encounters Overlap Measurement Period&quot; Encounters\n  let locationElements: Encounters.location\n  return\n    locationElements LE\n    let locationReference: LE.location\n    return Global.GetLocation(locationReference))\n\n//============================================================================\n//Supplemental Data Element\n//When FHIR.canonical value is present, US Core 3.1.1 profiles are used\n//When FHIR.canonical value is not present, FHIR Base profiles are used\n//============================================================================\ndefine &quot;SDE Condition&quot;:\n  [Condition] Conditions \n  where exists(&quot;Initial Population&quot;)\n  return SharedResource.ConditionResource(Conditions,\n  {FHIR.canonical{value: 'http://hl7.org/fhir/us/nhsn-dqm/StructureDefinition/ach-condition'}})\n\ndefine &quot;SDE Device&quot;:\n  [Device] Devices \n  where exists(&quot;Initial Population&quot;)\n  return DeviceResource(Devices,\n  {FHIR.canonical{value: 'http://hl7.org/fhir/us/nhsn-dqm/StructureDefinition/ach-device'}})\n\ndefine &quot;SDE DiagnosticReport Lab&quot;:\n  &quot;DiagnosticReports&quot; DiagnosticReports\n  where (exists(DiagnosticReports.category Category where Category ~ &quot;LAB&quot;)\n    and exists(\n      &quot;Initial Population&quot; IP\n      where Global.&quot;Normalize Interval&quot;(DiagnosticReports.effective) overlaps IP.period))\n  return SharedResource.DiagnosticReportLabResource(DiagnosticReports,\n  {FHIR.canonical{value: 'http://hl7.org/fhir/us/nhsn-dqm/StructureDefinition/ach-diagnosticreport-lab'}})\n \ndefine &quot;SDE DiagnosticReport Note&quot;:\n  &quot;DiagnosticReports&quot; DiagnosticReports\n  where ((exists(DiagnosticReports.category Category where Category ~ &quot;Radiology&quot;))\n    or exists((DiagnosticReports.category Category where Category ~ &quot;Pathology&quot;))\n    or exists((DiagnosticReports.category Category where Category ~ &quot;Cardiology&quot;)))\n    and exists(\n      &quot;Initial Population&quot; IP\n      where Global.&quot;Normalize Interval&quot;(DiagnosticReports.effective) overlaps IP.period)\n  return DiagnosticReportResource(DiagnosticReports,\n  {FHIR.canonical{value: 'http://hl7.org/fhir/us/nhsn-dqm/StructureDefinition/ach-diagnosticreport-note'}})\n\ndefine &quot;SDE DiagnosticReport Others&quot;:\n  [DiagnosticReport] DiagnosticReports\n  where not ((exists(DiagnosticReports.category Category where Category ~ &quot;Radiology&quot;))\n    or exists((DiagnosticReports.category Category where Category ~ &quot;Pathology&quot;))\n    or exists((DiagnosticReports.category Category where Category ~ &quot;Cardiology&quot;))\n    or exists(DiagnosticReports.category Category where Category ~ &quot;LAB&quot;))\n    and exists(&quot;Initial Population&quot; IP\n      where Global.&quot;Normalize Interval&quot;(DiagnosticReports.effective) overlaps IP.period)\n  return DiagnosticReportResource(DiagnosticReports,\n  {FHIR.canonical{value: 'http://hl7.org/fhir/us/nhsn-dqm/StructureDefinition/ach-diagnosticreport'}})\n\ndefine &quot;SDE Encounter&quot;: \n  &quot;Encounters&quot; Encounters\n  where exists(\n    &quot;Initial Population&quot; IP\n    where Encounters.period overlaps IP.period)\n  return EncounterResource(Encounters,\n  {FHIR.canonical{value: 'http://hl7.org/fhir/us/nhsn-dqm/StructureDefinition/ach-encounter'}})\n\ndefine &quot;SDE Location&quot;:\n  &quot;Get Locations from IP Encounters in Measurement Period&quot; Locations\n  where exists(&quot;Initial Population&quot;)\n  and Locations is not null\n  return SharedResource.LocationResource(Locations,\n  {FHIR.canonical{value: 'http://hl7.org/fhir/us/nhsn-dqm/StructureDefinition/ach-location'}})\n \ndefine &quot;SDE Medication Administration&quot;:\n  [MedicationAdministration] MedicationAdministrations \n  where exists(\n    &quot;Initial Population&quot; IP\n    where Global.&quot;Normalize Interval&quot;(MedicationAdministrations.effective) overlaps IP.period)\n  return SharedResource.MedicationAdministrationResource(MedicationAdministrations,\n  {FHIR.canonical{value: 'http://hl7.org/fhir/us/nhsn-dqm/StructureDefinition/ach-medicationadministration'}})\n \ndefine &quot;SDE Medication Request&quot;:\n  [MedicationRequest] MedicationRequests \n  where exists(\n    &quot;Initial Population&quot; IP\n    where MedicationRequests.authoredOn during IP.period)\n  return SharedResource.MedicationRequestResource(MedicationRequests,\n  {FHIR.canonical{value: 'http://hl7.org/fhir/us/nhsn-dqm/StructureDefinition/ach-medicationrequest'}})\n\ndefine &quot;SDE Medication&quot;:\n  (&quot;SDE Medication Request&quot;\n  union &quot;SDE Medication Administration&quot;) MedReqOrAdmin\n  where MedReqOrAdmin.medication is FHIR.Reference\n  and exists(&quot;Initial Population&quot;) //No longer need to check for timing here because it's checked in SDE Medication Request/Administriation\n  return SharedResource.MedicationResource(GetMedicationFrom(MedReqOrAdmin.medication),\n  {FHIR.canonical{value: 'http://hl7.org/fhir/us/nhsn-dqm/StructureDefinition/ach-medication'}})\n\ndefine &quot;SDE Observation Lab Category&quot;:\n  &quot;Observations&quot; Observations \n  where (exists(Observations.category Category where Category ~ &quot;laboratory&quot;))\n    and exists(\n      &quot;Initial Population&quot; IP\n      where Global.&quot;Normalize Interval&quot;(Observations.effective) overlaps IP.period)\n  return SharedResource.ObservationLabResource(Observations,\n  {FHIR.canonical{value: 'http://hl7.org/fhir/us/nhsn-dqm/StructureDefinition/ach-observation-lab'}})\n\n//Vital Signs Observation has its own profile in FHIR Base\ndefine &quot;SDE Observation Vital Signs Category&quot;:\n  &quot;Observations&quot; Observations \n  where (exists(Observations.category Category where Category ~ &quot;vital-signs&quot;))\n    and exists(\n      &quot;Initial Population&quot; IP\n      where Global.&quot;Normalize Interval&quot;(Observations.effective) overlaps IP.period)\n  return ObservationVitalSignsResource(Observations,\n  {FHIR.canonical{value: 'http://hl7.org/fhir/us/nhsn-dqm/StructureDefinition/ach-observation-vitals'}})\n\n//Defaulting to base FHIR profile as there are no individual profiles in US Core 3.1.1 that cover these Observation categories\ndefine &quot;SDE Observation Category&quot;:\n  &quot;Observations&quot; Observations \n  where ((exists(Observations.category Category where Category ~ &quot;social-history&quot;))\n    or (exists(Observations.category Category where Category ~ &quot;survey&quot;))\n    or (exists(Observations.category Category where Category ~ &quot;imaging&quot;))\n    or (exists(Observations.category Category where Category ~ &quot;procedure&quot;)))\n    and exists(\n      &quot;Initial Population&quot; IP\n      where Global.&quot;Normalize Interval&quot;(Observations.effective) overlaps IP.period)\n  return ObservationResource(Observations,\n  {FHIR.canonical{value: 'http://hl7.org/fhir/us/nhsn-dqm/StructureDefinition/ach-observation'}})\n\ndefine &quot;SDE Coverage&quot;: \n\t[Coverage] Coverages\n  where exists(\n    &quot;Initial Population&quot; IP\n    where Coverages.period overlaps IP.period)\n  return SharedResource.CoverageResource(Coverages,\n  {FHIR.canonical{value: 'http://hl7.org/fhir/us/nhsn-dqm/StructureDefinition/ach-coverage'}})\n\ndefine &quot;SDE Procedure&quot;:\n  [Procedure] Procedures \n  where exists(\n    &quot;Initial Population&quot; IP\n    where Global.&quot;Normalize Interval&quot;(Procedures.performed) overlaps IP.period)\n  return SharedResource.ProcedureResource(Procedures,\n  {FHIR.canonical{value: 'http://hl7.org/fhir/us/nhsn-dqm/StructureDefinition/ach-procedure'}})\n\ndefine &quot;SDE Specimen&quot;:\n  [Specimen] Specimens\n  where exists(\n    &quot;Initial Population&quot; IP\n    where Global.&quot;Normalize Interval&quot;(Specimens.collection.collected) overlaps IP.period\n  )\n  return SharedResource.SpecimenResource(Specimens,\n  {FHIR.canonical{value: 'http://hl7.org/fhir/us/nhsn-dqm/StructureDefinition/ach-specimen'}})\n\ndefine &quot;SDE Service Request&quot;:\n  [ServiceRequest] ServiceRequests\n  where exists(&quot;Initial Population&quot; IP\n    where ServiceRequests.authoredOn during IP.period)\n  return SharedResource.ServiceRequestResource(ServiceRequests,\n  {FHIR.canonical{value: 'http://hl7.org/fhir/us/nhsn-dqm/StructureDefinition/ach-servicerequest'}})\n\ndefine &quot;SDE Minimal Patient&quot;:\n  Patient p\n  return SharedResource.PatientResource(p,\n  {FHIR.canonical{value: 'http://hl7.org/fhir/us/nhsn-dqm/StructureDefinition/cross-measure-patient'}})\n\n//\n//Functions\n//\ndefine function &quot;GetMedicationFrom&quot;(choice Choice&lt;FHIR.CodeableConcept, FHIR.Reference&gt;):\n  case\n    when choice is FHIR.Reference then\n      GetMedication(choice as FHIR.Reference)\n    else\n      null\n  end\n\ndefine function &quot;GetMedication&quot;(reference Reference ):\n  singleton from (\n    [Medication] Medications\n    where Medications.id = Global.GetId(reference.reference)\n  )\n\n//\n//Measure Specific Resource Creation Functions\n//\ndefine function DeviceUdiCarrier(udiCarrier List&lt;FHIR.Device.UdiCarrier&gt;):\n  udiCarrier u\n  return FHIR.Device.UdiCarrier{\n    deviceIdentifier: u.deviceIdentifier,\n    issuer: u.issuer,\n    jurisdiction: u.jurisdiction,\n    carrierAIDC: u.carrierAIDC,\n    carrierHRF: u.carrierHRF,\n    entryType: u.entryType\n  }\n\ndefine function DeviceDeviceName(deviceName List&lt;FHIR.Device.DeviceName&gt;):\n  deviceName d\n  return FHIR.Device.DeviceName{\n    name: d.name,\n    type: d.type\n  }\n\ndefine function DeviceSpecialization(specialization List&lt;FHIR.Device.Specialization&gt;):\n  specialization s\n  return FHIR.Device.Specialization{\n    systemType: s.systemType,\n    version: s.version\n  }\n\ndefine function DeviceVersion(version List&lt;FHIR.Device.Version&gt;):\n  version v\n  return FHIR.Device.Version{\n    type: v.type,\n    component: v.component,\n    value: v.value\n  }\n\ndefine function DeviceProperty(deviceProperty List&lt;FHIR.Device.Property&gt;):\n  deviceProperty d\n  return FHIR.Device.Property{\n    id: d.id,\n    type: d.type,\n    valueQuantity: d.valueQuantity,\n    valueCode: d.valueCode\n  }\n\ndefine function DeviceResource(device Device, profileURLs List&lt;FHIR.canonical&gt;):\n  device d\n  return Device{\n    id: FHIR.id{value: 'LCR-' + d.id},\n    meta: SharedResource.MetaElement(d, profileURLs),\n    extension: d.extension,\n    definition: d.definition,\n    udiCarrier: DeviceUdiCarrier(d.udiCarrier),\n    status: d.status,\n    statusReason: d.statusReason,\n    distinctIdentifier: d.distinctIdentifier,\n    manufacturer: d.manufacturer,\n    manufactureDate: d.manufactureDate,\n    expirationDate: d.expirationDate,\n    lotNumber: d.lotNumber,\n    serialNumber: d.serialNumber,\n    deviceName: DeviceDeviceName(d.deviceName),\n    modelNumber: d.modelNumber,\n    partNumber: d.partNumber,\n    type: d.type,\n    specialization: DeviceSpecialization(d.specialization),\n    version: DeviceVersion(d.version),\n    property: DeviceProperty(d.property),\n    patient: d.patient,\n    owner: d.owner,\n    contact: d.contact,\n    location: d.location,\n    url: d.url,\n    note: d.note,\n    safety: d.safety,\n    parent: d.parent\n  }\n\ndefine function DiagnosticReportResource(diagnosticReport DiagnosticReport, profileURLs List&lt;FHIR.canonical&gt;):\n  diagnosticReport d\n  return DiagnosticReport{\n    id: FHIR.id{value: 'LCR-' + d.id},\n    meta: SharedResource.MetaElement(d, profileURLs),\n    extension: d.extension,\n    basedOn: d.basedOn,\n    status: d.status,\n    category: d.category,\n    code: d.code,\n    subject: d.subject,\n    encounter: d.encounter,\n    effective: d.effective,\n    issued: d.issued,\n    performer: d.performer,\n    resultsInterpreter: d.resultsInterpreter,\n    specimen: d.specimen,\n    result: d.result,\n    conclusion: d.conclusion,\n    conclusionCode: d.conclusionCode\n  }\n\ndefine function EncounterResource(encounter Encounter, profileURLs List&lt;FHIR.canonical&gt;):\n  encounter e\n  return Encounter{\n    id: FHIR.id{value: 'LCR-' + e.id},\n    meta: SharedResource.MetaElement(e, profileURLs),\n    extension: e.extension,\n    identifier: SharedResource.EncounterIdentifier(e.identifier),\n    status: e.status,\n    statusHistory: SharedResource.EncounterStatusHistory(e.statusHistory),\n    class: e.class,\n    classHistory: SharedResource.EncounterClassHistory(e.classHistory),\n    type: e.type,\n    serviceType: e.serviceType,\n    priority: e.priority,\n    subject: e.subject,\n    period: e.period,\n    length: e.length,\n    reasonCode: e.reasonCode,\n    reasonReference: e.reasonReference,\n    diagnosis: SharedResource.EncounterDiagnosis(e.diagnosis),\n    account: e.account,\n    hospitalization: SharedResource.EncounterHospitalization(e.hospitalization),\n    location: SharedResource.EncounterLocation(e.location),\n    partOf: e.partOf\n  }\n\ndefine function ObservationResource(observation Observation, profileURLs List&lt;FHIR.canonical&gt;):\n  observation o\n  return Observation{\n    id: FHIR.id {value: 'LCR-' + o.id},\n    meta: SharedResource.MetaElement(o, profileURLs),\n    extension: o.extension,\n    partOf: o.partOf,\n    status: o.status,\n    category: o.category,\n    code: o.code,\n    subject: o.subject,\n    focus: o.focus,\n    encounter: o.encounter,\n    effective: o.effective,\n    issued: o.issued,\n    performer: o.performer,\n    value: o.value,\n    dataAbsentReason: o.dataAbsentReason,\n    interpretation: o.interpretation,\n    note: o.note,\n    bodySite: o.bodySite,\n    method: o.method,\n    specimen: o.specimen,\n    device: o.device,\n    referenceRange: SharedResource.ObservationReferenceRange(o.referenceRange),\n    hasMember: o.hasMember,\n    derivedFrom: o.derivedFrom,\n    component: SharedResource.ObservationComponent(o.component)\n  }\n\ndefine function ObservationVitalSignsCoding(coding List&lt;Coding&gt;):\n  coding c\n  return Coding{\n    system: c.system,\n    version: c.version,\n    code: c.code,\n    display: c.display,\n    userSelected: c.userSelected\n  }\n\ndefine function ObservationVitalSignsCategory(category List&lt;CodeableConcept&gt;):\n  category c\n  return CodeableConcept{\n    coding: ObservationVitalSignsCoding(c.coding),\n    text: c.text\n  }\n\ndefine function ObservationVitalSignsComponent(component List&lt;FHIR.Observation.Component&gt;):\n  component c\n  return FHIR.Observation.Component{\n    code: c.code,\n    value: c.value,\n    dataAbsentReason: c.dataAbsentReason,\n    interpretation: c.interpretation,\n    referenceRange: SharedResource.ObservationReferenceRange(c.referenceRange)\n  }\n\ndefine function ObservationVitalSignsResource(observation Observation, profileURLs List&lt;FHIR.canonical&gt;):\n  observation o\n  return Observation{\n    id: FHIR.id {value: 'LCR-' + o.id},\n    meta: SharedResource.MetaElement(o, profileURLs),\n    extension: o.extension,\n    partOf: o.partOf,\n    status: o.status,\n    category: ObservationVitalSignsCategory(o.category),\n    code: o.code,\n    subject: o.subject,\n    focus: o.focus,\n    encounter: o.encounter,\n    effective: o.effective,\n    issued: o.issued,\n    performer: o.performer,\n    value: o.value,\n    dataAbsentReason: o.dataAbsentReason,\n    interpretation: o.interpretation,\n    note: o.note,\n    bodySite: o.bodySite,\n    method: o.method,\n    specimen: o.specimen,\n    device: o.device,\n    referenceRange: SharedResource.ObservationReferenceRange(o.referenceRange),\n    hasMember: o.hasMember,\n    derivedFrom: o.derivedFrom,\n    component: ObservationVitalSignsComponent(o.component)\n  }</code></pre></div>"
  },
  "contained" : [
    {
      "resourceType" : "Parameters",
      "id" : "ach-options",
      "parameter" : [
        {
          "name" : "translatorVersion",
          "valueString" : "3.5.1"
        },
        {
          "name" : "option",
          "valueString" : "EnableDateRangeOptimization"
        },
        {
          "name" : "option",
          "valueString" : "EnableAnnotations"
        },
        {
          "name" : "option",
          "valueString" : "EnableLocators"
        },
        {
          "name" : "option",
          "valueString" : "DisableListDemotion"
        },
        {
          "name" : "option",
          "valueString" : "DisableListPromotion"
        },
        {
          "name" : "analyzeDataRequirements",
          "valueBoolean" : false
        },
        {
          "name" : "collapseDataRequirements",
          "valueBoolean" : true
        },
        {
          "name" : "compatibilityLevel",
          "valueString" : "1.5"
        },
        {
          "name" : "enableCqlOnly",
          "valueBoolean" : false
        },
        {
          "name" : "errorLevel",
          "valueString" : "Info"
        },
        {
          "name" : "signatureLevel",
          "valueString" : "None"
        },
        {
          "name" : "validateUnits",
          "valueBoolean" : true
        },
        {
          "name" : "verifyOnly",
          "valueBoolean" : false
        }
      ]
    }
  ],
  "extension" : [
    {
      "url" : "http://hl7.org/fhir/StructureDefinition/cqf-cqlOptions",
      "valueReference" : {
        "reference" : "#ach-options"
      }
    }
  ],
  "url" : "http://hl7.org/fhir/us/nhsn-dqm/Library/NHSNdQMAcuteCareHospitalInitialPopulationLibrary",
  "identifier" : [
    {
      "system" : "urn:ietf:rfc:3986",
      "value" : "urn:oid:2.25.316204395913842452684237438142819890580.28.2"
    }
  ],
  "version" : "1.0.0-ballot",
  "name" : "NHSNdQMAcuteCareHospitalInitialPopulation",
  "status" : "active",
  "type" : {
    "coding" : [
      {
        "system" : "http://terminology.hl7.org/CodeSystem/library-type",
        "code" : "logic-library"
      }
    ]
  },
  "date" : "2024-11-14T20:28:17+00:00",
  "publisher" : "HL7 International / Public Health",
  "contact" : [
    {
      "name" : "HL7 International / Public Health",
      "telecom" : [
        {
          "system" : "url",
          "value" : "http://www.hl7.org/Special/committees/pher"
        }
      ]
    }
  ],
  "jurisdiction" : [
    {
      "coding" : [
        {
          "system" : "urn:iso:std:iso:3166",
          "code" : "US",
          "display" : "United States of America"
        }
      ]
    }
  ],
  "relatedArtifact" : [
    {
      "type" : "depends-on",
      "display" : "FHIR model information",
      "resource" : "http://fhir.org/guides/cqf/common/Library/FHIR-ModelInfo|4.0.1"
    },
    {
      "type" : "depends-on",
      "display" : "Library FHIRHelpers",
      "resource" : "http://fhir.org/guides/cqf/common/Library/FHIRHelpers|4.0.1"
    },
    {
      "type" : "depends-on",
      "display" : "Library Global",
      "resource" : "http://hl7.org/fhir/us/cqfmeasures/Library/MATGlobalCommonFunctions"
    },
    {
      "type" : "depends-on",
      "display" : "Library SDE",
      "resource" : "http://hl7.org/fhir/us/cqfmeasures/Library/SupplementalDataElements"
    },
    {
      "type" : "depends-on",
      "display" : "Code system ActCode",
      "resource" : "http://terminology.hl7.org/CodeSystem/v3-ActCode"
    },
    {
      "type" : "depends-on",
      "display" : "Code system Observation Category",
      "resource" : "http://terminology.hl7.org/CodeSystem/observation-category"
    },
    {
      "type" : "depends-on",
      "display" : "Code system LOINC",
      "resource" : "http://loinc.org"
    },
    {
      "type" : "depends-on",
      "display" : "Code system V2-0074",
      "resource" : "http://terminology.hl7.org/CodeSystem/v2-0074"
    },
    {
      "type" : "depends-on",
      "display" : "Value set Inpatient, Emergency, and Observation Locations",
      "resource" : "http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1046.265"
    },
    {
      "type" : "depends-on",
      "display" : "Value set Emergency Department Visit",
      "resource" : "http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.292"
    },
    {
      "type" : "depends-on",
      "display" : "Value set Encounter Inpatient",
      "resource" : "http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.666.5.307"
    },
    {
      "type" : "depends-on",
      "display" : "Value set Observation Services",
      "resource" : "http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1111.143"
    },
    {
      "type" : "depends-on",
      "display" : "Value set NHSN Inpatient Encounter Class Codes",
      "resource" : "http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1046.274"
    }
  ],
  "parameter" : [
    {
      "name" : "Measurement Period",
      "use" : "in",
      "min" : 0,
      "max" : "1",
      "type" : "Period"
    },
    {
      "name" : "Patient",
      "use" : "out",
      "min" : 0,
      "max" : "1",
      "type" : "Patient"
    },
    {
      "name" : "Qualifying Encounters During Measurement Period",
      "use" : "out",
      "min" : 0,
      "max" : "*",
      "type" : "Encounter"
    },
    {
      "name" : "Encounters",
      "use" : "out",
      "min" : 0,
      "max" : "*",
      "type" : "Encounter"
    },
    {
      "name" : "Encounters with Patient Hospital Locations",
      "use" : "out",
      "min" : 0,
      "max" : "*",
      "type" : "Encounter"
    },
    {
      "name" : "Initial Population",
      "use" : "out",
      "min" : 0,
      "max" : "*",
      "type" : "Encounter"
    },
    {
      "name" : "DiagnosticReports",
      "use" : "out",
      "min" : 0,
      "max" : "*",
      "type" : "DiagnosticReport"
    },
    {
      "name" : "Observations",
      "use" : "out",
      "min" : 0,
      "max" : "*",
      "type" : "Observation"
    },
    {
      "name" : "IP Encounters Overlap Measurement Period",
      "use" : "out",
      "min" : 0,
      "max" : "*",
      "type" : "Encounter"
    },
    {
      "name" : "Get Locations from IP Encounters in Measurement Period",
      "use" : "out",
      "min" : 0,
      "max" : "*",
      "type" : "Location"
    },
    {
      "name" : "SDE Condition",
      "use" : "out",
      "min" : 0,
      "max" : "*",
      "type" : "Condition"
    },
    {
      "name" : "SDE Device",
      "use" : "out",
      "min" : 0,
      "max" : "*",
      "type" : "Device"
    },
    {
      "name" : "SDE DiagnosticReport Lab",
      "use" : "out",
      "min" : 0,
      "max" : "*",
      "type" : "DiagnosticReport"
    },
    {
      "name" : "SDE DiagnosticReport Note",
      "use" : "out",
      "min" : 0,
      "max" : "*",
      "type" : "DiagnosticReport"
    },
    {
      "name" : "SDE DiagnosticReport Others",
      "use" : "out",
      "min" : 0,
      "max" : "*",
      "type" : "DiagnosticReport"
    },
    {
      "name" : "SDE Encounter",
      "use" : "out",
      "min" : 0,
      "max" : "*",
      "type" : "Encounter"
    },
    {
      "name" : "SDE Location",
      "use" : "out",
      "min" : 0,
      "max" : "*",
      "type" : "Location"
    },
    {
      "name" : "SDE Medication Administration",
      "use" : "out",
      "min" : 0,
      "max" : "*",
      "type" : "MedicationAdministration"
    },
    {
      "name" : "SDE Medication Request",
      "use" : "out",
      "min" : 0,
      "max" : "*",
      "type" : "MedicationRequest"
    },
    {
      "name" : "SDE Medication",
      "use" : "out",
      "min" : 0,
      "max" : "*",
      "type" : "Medication"
    },
    {
      "name" : "SDE Observation Lab Category",
      "use" : "out",
      "min" : 0,
      "max" : "*",
      "type" : "Observation"
    },
    {
      "name" : "SDE Observation Vital Signs Category",
      "use" : "out",
      "min" : 0,
      "max" : "*",
      "type" : "Observation"
    },
    {
      "name" : "SDE Observation Category",
      "use" : "out",
      "min" : 0,
      "max" : "*",
      "type" : "Observation"
    },
    {
      "name" : "SDE Coverage",
      "use" : "out",
      "min" : 0,
      "max" : "*",
      "type" : "Coverage"
    },
    {
      "name" : "SDE Procedure",
      "use" : "out",
      "min" : 0,
      "max" : "*",
      "type" : "Procedure"
    },
    {
      "name" : "SDE Specimen",
      "use" : "out",
      "min" : 0,
      "max" : "*",
      "type" : "Specimen"
    },
    {
      "name" : "SDE Service Request",
      "use" : "out",
      "min" : 0,
      "max" : "*",
      "type" : "ServiceRequest"
    },
    {
      "name" : "SDE Minimal Patient",
      "use" : "out",
      "min" : 0,
      "max" : "1",
      "type" : "Patient"
    }
  ],
  "dataRequirement" : [
    {
      "type" : "Patient",
      "profile" : [
        🔗 "http://hl7.org/fhir/StructureDefinition/Patient"
      ],
      "mustSupport" : [
        "id",
        "identifier",
        "active",
        "name",
        "telecom",
        "gender",
        "birthDate",
        "deceased",
        "address",
        "maritalStatus",
        "multipleBirth",
        "photo",
        "contact",
        "communication",
        "generalPractitioner",
        "managingOrganization",
        "link"
      ]
    },
    {
      "type" : "Encounter",
      "profile" : [
        🔗 "http://hl7.org/fhir/StructureDefinition/Encounter"
      ],
      "mustSupport" : [
        "type",
        "status",
        "period",
        "location",
        "id",
        "extension",
        "identifier",
        "statusHistory",
        "class",
        "classHistory",
        "serviceType",
        "priority",
        "subject",
        "length",
        "reasonCode",
        "reasonReference",
        "diagnosis",
        "account",
        "hospitalization",
        "partOf"
      ],
      "codeFilter" : [
        {
          "path" : "type",
          "valueSet" : "http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.666.5.307"
        }
      ]
    },
    {
      "type" : "Encounter",
      "profile" : [
        🔗 "http://hl7.org/fhir/StructureDefinition/Encounter"
      ],
      "mustSupport" : [
        "type",
        "status",
        "period",
        "location",
        "id",
        "extension",
        "identifier",
        "statusHistory",
        "class",
        "classHistory",
        "serviceType",
        "priority",
        "subject",
        "length",
        "reasonCode",
        "reasonReference",
        "diagnosis",
        "account",
        "hospitalization",
        "partOf"
      ],
      "codeFilter" : [
        {
          "path" : "type",
          "valueSet" : "http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.292"
        }
      ]
    },
    {
      "type" : "Encounter",
      "profile" : [
        🔗 "http://hl7.org/fhir/StructureDefinition/Encounter"
      ],
      "mustSupport" : [
        "type",
        "status",
        "period",
        "location",
        "id",
        "extension",
        "identifier",
        "statusHistory",
        "class",
        "classHistory",
        "serviceType",
        "priority",
        "subject",
        "length",
        "reasonCode",
        "reasonReference",
        "diagnosis",
        "account",
        "hospitalization",
        "partOf"
      ],
      "codeFilter" : [
        {
          "path" : "type",
          "valueSet" : "http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1111.143"
        }
      ]
    },
    {
      "type" : "Encounter",
      "profile" : [
        🔗 "http://hl7.org/fhir/StructureDefinition/Encounter"
      ],
      "mustSupport" : [
        "class",
        "status",
        "period",
        "location",
        "id",
        "extension",
        "identifier",
        "statusHistory",
        "classHistory",
        "type",
        "serviceType",
        "priority",
        "subject",
        "length",
        "reasonCode",
        "reasonReference",
        "diagnosis",
        "account",
        "hospitalization",
        "partOf"
      ],
      "codeFilter" : [
        {
          "path" : "class",
          "valueSet" : "http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1046.274"
        }
      ]
    },
    {
      "type" : "Encounter",
      "profile" : [
        🔗 "http://hl7.org/fhir/StructureDefinition/Encounter"
      ],
      "mustSupport" : [
        "status",
        "period",
        "location",
        "id",
        "extension",
        "identifier",
        "statusHistory",
        "class",
        "classHistory",
        "type",
        "serviceType",
        "priority",
        "subject",
        "length",
        "reasonCode",
        "reasonReference",
        "diagnosis",
        "account",
        "hospitalization",
        "partOf"
      ]
    },
    {
      "type" : "Location",
      "profile" : [
        🔗 "http://hl7.org/fhir/StructureDefinition/Location"
      ],
      "mustSupport" : [
        "id",
        "extension",
        "status",
        "operationalStatus",
        "name",
        "alias",
        "description",
        "mode",
        "type",
        "telecom",
        "address",
        "physicalType",
        "position",
        "managingOrganization",
        "partOf",
        "hoursOfOperation",
        "availabilityExceptions",
        "endpoint"
      ]
    },
    {
      "type" : "DiagnosticReport",
      "profile" : [
        🔗 "http://hl7.org/fhir/StructureDefinition/DiagnosticReport"
      ],
      "mustSupport" : [
        "id",
        "extension",
        "basedOn",
        "status",
        "category",
        "code",
        "subject",
        "encounter",
        "effective",
        "issued",
        "performer",
        "resultsInterpreter",
        "specimen",
        "result",
        "conclusion",
        "conclusionCode"
      ]
    },
    {
      "type" : "Observation",
      "profile" : [
        🔗 "http://hl7.org/fhir/StructureDefinition/Observation"
      ],
      "mustSupport" : [
        "id",
        "extension",
        "basedOn",
        "partOf",
        "status",
        "category",
        "code",
        "subject",
        "focus",
        "encounter",
        "effective",
        "issued",
        "performer",
        "value",
        "dataAbsentReason",
        "interpretation",
        "note",
        "bodySite",
        "method",
        "specimen",
        "device",
        "referenceRange",
        "hasMember",
        "derivedFrom",
        "component"
      ]
    },
    {
      "type" : "Condition",
      "profile" : [
        🔗 "http://hl7.org/fhir/StructureDefinition/Condition"
      ],
      "mustSupport" : [
        "id",
        "extension",
        "clinicalStatus",
        "verificationStatus",
        "category",
        "severity",
        "code",
        "bodySite",
        "subject",
        "encounter",
        "onset",
        "abatement",
        "recordedDate",
        "stage",
        "evidence",
        "note"
      ]
    },
    {
      "type" : "Device",
      "profile" : [
        🔗 "http://hl7.org/fhir/StructureDefinition/Device"
      ],
      "mustSupport" : [
        "id",
        "extension",
        "definition",
        "udiCarrier",
        "status",
        "statusReason",
        "distinctIdentifier",
        "manufacturer",
        "manufactureDate",
        "expirationDate",
        "lotNumber",
        "serialNumber",
        "deviceName",
        "modelNumber",
        "partNumber",
        "type",
        "specialization",
        "version",
        "property",
        "patient",
        "owner",
        "contact",
        "location",
        "url",
        "note",
        "safety",
        "parent"
      ]
    },
    {
      "type" : "MedicationAdministration",
      "profile" : [
        🔗 "http://hl7.org/fhir/StructureDefinition/MedicationAdministration"
      ],
      "mustSupport" : [
        "effective",
        "id",
        "extension",
        "instantiates",
        "partOf",
        "status",
        "statusReason",
        "category",
        "medication",
        "subject",
        "context",
        "supportingInformation",
        "performer",
        "reasonCode",
        "reasonReference",
        "request",
        "device",
        "note",
        "dosage",
        "eventHistory"
      ]
    },
    {
      "type" : "MedicationRequest",
      "profile" : [
        🔗 "http://hl7.org/fhir/StructureDefinition/MedicationRequest"
      ],
      "mustSupport" : [
        "authoredOn",
        "id",
        "extension",
        "status",
        "statusReason",
        "intent",
        "category",
        "priority",
        "doNotPerform",
        "reported",
        "medication",
        "subject",
        "encounter",
        "requester",
        "recorder",
        "reasonCode",
        "reasonReference",
        "instantiatesCanonical",
        "instantiatesUri",
        "courseOfTherapyType",
        "dosageInstruction"
      ]
    },
    {
      "type" : "Medication",
      "profile" : [
        🔗 "http://hl7.org/fhir/StructureDefinition/Medication"
      ],
      "mustSupport" : [
        "id",
        "extension",
        "code",
        "status",
        "manufacturer",
        "form",
        "amount",
        "ingredient",
        "batch"
      ]
    },
    {
      "type" : "Coverage",
      "profile" : [
        🔗 "http://hl7.org/fhir/StructureDefinition/Coverage"
      ],
      "mustSupport" : [
        "period",
        "id",
        "extension",
        "status",
        "type",
        "policyHolder",
        "subscriber",
        "subscriberId",
        "beneficiary",
        "dependent",
        "relationship",
        "payor",
        "class",
        "order",
        "network",
        "subrogation",
        "contract"
      ]
    },
    {
      "type" : "Procedure",
      "profile" : [
        🔗 "http://hl7.org/fhir/StructureDefinition/Procedure"
      ],
      "mustSupport" : [
        "performed",
        "id",
        "extension",
        "instantiatesCanonical",
        "instantiatesUri",
        "basedOn",
        "partOf",
        "status",
        "statusReason",
        "category",
        "code",
        "subject",
        "encounter",
        "recorder",
        "asserter",
        "performer",
        "location",
        "reasonCode",
        "reasonReference",
        "bodySite",
        "outcome",
        "report",
        "complication",
        "complicationDetail",
        "followUp",
        "note",
        "focalDevice",
        "usedReference",
        "usedCode"
      ]
    },
    {
      "type" : "Specimen",
      "profile" : [
        🔗 "http://hl7.org/fhir/StructureDefinition/Specimen"
      ],
      "mustSupport" : [
        "collection",
        "collection.collected",
        "id",
        "extension",
        "identifier",
        "accessionIdentifier",
        "status",
        "type",
        "subject",
        "receivedTime",
        "parent",
        "request",
        "processing",
        "container",
        "condition",
        "note"
      ]
    },
    {
      "type" : "ServiceRequest",
      "profile" : [
        🔗 "http://hl7.org/fhir/StructureDefinition/ServiceRequest"
      ],
      "mustSupport" : [
        "authoredOn",
        "id",
        "extension",
        "instantiatesCanonical",
        "instantiatesUri",
        "basedOn",
        "replaces",
        "requisition",
        "status",
        "intent",
        "category",
        "priority",
        "doNotPerform",
        "code",
        "orderDetail",
        "quantity",
        "subject",
        "encounter",
        "occurrence",
        "asNeeded",
        "requester",
        "performerType",
        "performer",
        "locationCode",
        "locationReference",
        "reasonCode",
        "reasonReference",
        "insurance",
        "supportingInfo",
        "specimen",
        "bodySite",
        "note",
        "patientInstruction",
        "relevantHistory"
      ]
    }
  ],
  "content" : [
    {
      "contentType" : "text/cql",
      "data" : "bGlicmFyeSBOSFNOZFFNQWN1dGVDYXJlSG9zcGl0YWxJbml0aWFsUG9wdWxhdGlvbiB2ZXJzaW9uICcwLjAuM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