CDC National Healthcare Safety Network (NHSN) Digital Quality Measures (dQM) Content Package IG
1.0.0 - Release 1
CDC National Healthcare Safety Network (NHSN) Digital Quality Measures (dQM) Content Package IG - Local Development build (v1.0.0) built by the FHIR (HL7® FHIR® Standard) Build Tools. See the Directory of published versions
Page standards status: Trial-use | Maturity Level: 1 |
<Library xmlns="http://hl7.org/fhir">
<id value="NHSNAcuteCareHospitalMonthlyInitialPopulation"/>
<text>
<status value="extensions"/>
<div xmlns="http://www.w3.org/1999/xhtml">
<div>
<table class="grid dict">
<tr>
<th scope="row"><b>Id: </b></th>
<td style="padding-left: 4px;">NHSNAcuteCareHospitalMonthlyInitialPopulation</td>
</tr>
<tr>
<th scope="row"><b>Version: </b></th>
<td style="padding-left: 4px;">1.0.0</td>
</tr>
<tr>
<th scope="row"><b>Url: </b></th>
<td style="padding-left: 4px;"><a href="Library-NHSNAcuteCareHospitalMonthlyInitialPopulation.html">NHSNAcuteCareHospitalMonthlyInitialPopulation</a></td>
</tr>
<tr>
<th scope="row"><b>Status: </b></th>
<td style="padding-left: 4px;">draft</td>
</tr>
<tr>
<th scope="row"><b>Type: </b></th>
<td style="padding-left: 4px;">
<p style="margin-bottom: 5px;">
<b>system: </b> <span><a href="http://terminology.hl7.org/6.5.0/CodeSystem-library-type.html">http://terminology.hl7.org/CodeSystem/library-type</a></span>
</p>
<p style="margin-bottom: 5px;">
<b>code: </b> <span>logic-library</span>
</p>
</td>
</tr>
<tr>
<th scope="row"><b>Date: </b></th>
<td style="padding-left: 4px;">2025-09-28 15:20:22+0000</td>
</tr>
<tr>
<th scope="row"><b>Publisher: </b></th>
<td style="padding-left: 4px;">CDC National Healthcare Safety Network (NHSN)</td>
</tr>
<tr>
<th scope="row"><b>Jurisdiction: </b></th>
<td style="padding-left: 4px;">US</td>
</tr>
<tr>
<th scope="row"><b>Related Artifacts: </b></th>
<td style="padding-left: 4px;">
<p><b>Dependencies</b></p>
<ul>
<li><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></li>
<li><code>http://www.cdc.gov/nhsn/fhirportal/dqm/ig/Library/FHIRHelpers|4.0.2</code></li>
<li><code>http://www.cdc.gov/nhsn/fhirportal/dqm/ig/Library/NHSNHelpers|0.0.002</code></li>
<li><code>http://www.cdc.gov/nhsn/fhirportal/dqm/ig/Library/SharedResourceCreation|0.1.010</code></li>
<li><a href="http://terminology.hl7.org/6.5.0/CodeSystem-v3-ActCode.html">ActCodeversion: null9.0.0)</a></li>
<li><a href="http://terminology.hl7.org/6.5.0/CodeSystem-observation-category.html">Observation Category Codesversion: null1.0.1)</a></li>
<li><a href="http://terminology.hl7.org/6.5.0/CodeSystem-v3-loinc.html">Logical Observation Identifiers, Names and Codes (LOINC)</a></li>
<li><a href="http://terminology.hl7.org/5.0.0/CodeSystem-v2-0074.html">diagnosticServiceSectionIdversion: null2.5.0)</a></li>
<li><a href="http://terminology.hl7.org/6.5.0/CodeSystem-condition-category.html">Condition Category Codesversion: null1.0.1)</a></li>
<li><a href="http://hl7.org/fhir/us/core/STU6.1/CodeSystem-condition-category.html">US Core Condition Category Extension Codesversion: null6.1.0)</a></li>
<li><a href="http://terminology.hl7.org/6.5.0/CodeSystem-condition-clinical.html">Condition Clinical Status Codesversion: null3.0.0)</a></li>
<li><a href="http://hl7.org/fhir/R4/codesystem-snomedct.html">SNOMED CT (all versions)</a></li>
<li><a href="http://terminology.hl7.org/6.5.0/CodeSystem-medicationrequest-category.html">MedicationRequest Category Codesversion: null1.0.0)</a></li>
<li><a href="https://vsac.nlm.nih.gov/valueset/2.16.840.1.113762.1.4.1046.265/expansion">Inpatient, Emergency, and Observation Locations</a></li>
<li><a href="https://vsac.nlm.nih.gov/valueset/2.16.840.1.113883.3.117.1.7.1.292/expansion">Emergency Department Visitversion: null20210611)</a></li>
<li><a href="https://vsac.nlm.nih.gov/valueset/2.16.840.1.113883.3.666.5.307/expansion">Encounter Inpatient</a></li>
<li><a href="https://vsac.nlm.nih.gov/valueset/2.16.840.1.113762.1.4.1111.143/expansion">Observation Servicesversion: null20210611)</a></li>
<li><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></li>
</ul>
</td>
</tr>
<tr>
<th scope="row"><b>Parameters: </b></th>
<td style="padding-left: 4px;">
<table class="grid-dict">
<tr><th><b>Name</b></th><th><b>Type</b></th><th><b>Min</b></th><th><b>Max</b></th><th><b>In/Out</b></th></tr>
<tr><th>Measurement Period</th><th>Period</th><th>0</th><th>1</th><th>In</th></tr>
<tr><th>Patient</th><th>Patient</th><th>0</th><th>1</th><th>Out</th></tr>
<tr><th>Qualifying Encounters During Measurement Period</th><th>Encounter</th><th>0</th><th>*</th><th>Out</th></tr>
<tr><th>Encounters</th><th>Encounter</th><th>0</th><th>*</th><th>Out</th></tr>
<tr><th>Encounters with Patient Hospital Locations</th><th>Encounter</th><th>0</th><th>*</th><th>Out</th></tr>
<tr><th>Initial Population</th><th>Encounter</th><th>0</th><th>*</th><th>Out</th></tr>
<tr><th>Conditions</th><th>Condition</th><th>0</th><th>*</th><th>Out</th></tr>
<tr><th>DiagnosticReports</th><th>DiagnosticReport</th><th>0</th><th>*</th><th>Out</th></tr>
<tr><th>Observations</th><th>Observation</th><th>0</th><th>*</th><th>Out</th></tr>
<tr><th>Get Locations from IP Encounters in Measurement Period</th><th>Location</th><th>0</th><th>*</th><th>Out</th></tr>
<tr><th>SDE Condition</th><th>Condition</th><th>0</th><th>*</th><th>Out</th></tr>
<tr><th>SDE Device</th><th>Device</th><th>0</th><th>*</th><th>Out</th></tr>
<tr><th>SDE DiagnosticReport Lab</th><th>DiagnosticReport</th><th>0</th><th>*</th><th>Out</th></tr>
<tr><th>SDE DiagnosticReport Note</th><th>DiagnosticReport</th><th>0</th><th>*</th><th>Out</th></tr>
<tr><th>SDE DiagnosticReport Others</th><th>DiagnosticReport</th><th>0</th><th>*</th><th>Out</th></tr>
<tr><th>SDE Encounter</th><th>Encounter</th><th>0</th><th>*</th><th>Out</th></tr>
<tr><th>SDE IP Encounters</th><th>Encounter</th><th>0</th><th>*</th><th>Out</th></tr>
<tr><th>SDE Location</th><th>Location</th><th>0</th><th>*</th><th>Out</th></tr>
<tr><th>SDE Medication Administration</th><th>MedicationAdministration</th><th>0</th><th>*</th><th>Out</th></tr>
<tr><th>SDE Medication Request</th><th>MedicationRequest</th><th>0</th><th>*</th><th>Out</th></tr>
<tr><th>SDE Medication</th><th>Medication</th><th>0</th><th>*</th><th>Out</th></tr>
<tr><th>SDE Observation Lab Category</th><th>Observation</th><th>0</th><th>*</th><th>Out</th></tr>
<tr><th>SDE Observation Vital Signs Category</th><th>Observation</th><th>0</th><th>*</th><th>Out</th></tr>
<tr><th>SDE Observation Category</th><th>Observation</th><th>0</th><th>*</th><th>Out</th></tr>
<tr><th>SDE Coverage</th><th>Coverage</th><th>0</th><th>*</th><th>Out</th></tr>
<tr><th>SDE Procedure</th><th>Procedure</th><th>0</th><th>*</th><th>Out</th></tr>
<tr><th>SDE Specimen</th><th>Specimen</th><th>0</th><th>*</th><th>Out</th></tr>
<tr><th>SDE Service Request</th><th>ServiceRequest</th><th>0</th><th>*</th><th>Out</th></tr>
<tr><th>SDE Minimal Patient</th><th>Patient</th><th>0</th><th>1</th><th>Out</th></tr>
</table>
</td>
</tr>
<tr>
<th scope="row"><b>Data Requirements:</b></th>
<td style="padding-left: 4px;">
<table class="grid-dict">
<tr><th><b>Type</b></th><th><b>Profile</b></th><th><b>MS</b></th><th><b>Code Filter</b></th></tr>
<tr>
<th>Patient</th>
<th>http://hl7.org/fhir/StructureDefinition/Patient</th>
<th>;;;;;;;;;;;;;;;;;</th>
<th>
</th>
</tr>
<tr>
<th>Encounter</th>
<th>http://hl7.org/fhir/StructureDefinition/Encounter</th>
<th>;;;;;;;;;;;;;;;;;;;;</th>
<th>
<b>code filter: </b>
<br/>
<span style="padding-left: 4px;">
<b>path: </b><span>type</span>
</span>
<br/>
<span style="padding-left: 4px;">
<b>value set: </b><span>http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.666.5.307</span>
</span>
</th>
</tr>
<tr>
<th>Encounter</th>
<th>http://hl7.org/fhir/StructureDefinition/Encounter</th>
<th>;;;;;;;;;;;;;;;;;;;;</th>
<th>
<b>code filter: </b>
<br/>
<span style="padding-left: 4px;">
<b>path: </b><span>type</span>
</span>
<br/>
<span style="padding-left: 4px;">
<b>value set: </b><span>http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.292|20210611</span>
</span>
</th>
</tr>
<tr>
<th>Encounter</th>
<th>http://hl7.org/fhir/StructureDefinition/Encounter</th>
<th>;;;;;;;;;;;;;;;;;;;;</th>
<th>
<b>code filter: </b>
<br/>
<span style="padding-left: 4px;">
<b>path: </b><span>type</span>
</span>
<br/>
<span style="padding-left: 4px;">
<b>value set: </b><span>http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1111.143|20210611</span>
</span>
</th>
</tr>
<tr>
<th>Encounter</th>
<th>http://hl7.org/fhir/StructureDefinition/Encounter</th>
<th>;;;;;;;;;;;;;;;;;;;;</th>
<th>
<b>code filter: </b>
<br/>
<span style="padding-left: 4px;">
<b>path: </b><span>class</span>
</span>
<br/>
<span style="padding-left: 4px;">
<b>value set: </b><span>http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1046.274</span>
</span>
</th>
</tr>
<tr>
<th>Encounter</th>
<th>http://hl7.org/fhir/StructureDefinition/Encounter</th>
<th>;;;;;;;;;;;;;;;;;;;;</th>
<th>
<b>code filter: </b>
<br/>
<span style="padding-left: 4px;">
<b>path: </b><span>class</span>
</span>
<br/>
<p style="margin-bottom: 5px;">
<b>system: </b> <span><a href="http://terminology.hl7.org/6.5.0/CodeSystem-v3-ActCode.html">http://terminology.hl7.org/CodeSystem/v3-ActCode</a></span>
</p>
<p style="margin-bottom: 5px;">
<b>code: </b> <span>EMER</span>
</p>
<p style="margin-bottom: 5px;">
<b>display: </b> <span>emergency</span>
</p>
</th>
</tr>
<tr>
<th>Encounter</th>
<th>http://hl7.org/fhir/StructureDefinition/Encounter</th>
<th>;;;;;;;;;;;;;;;;;;;;</th>
<th>
<b>code filter: </b>
<br/>
<span style="padding-left: 4px;">
<b>path: </b><span>class</span>
</span>
<br/>
<p style="margin-bottom: 5px;">
<b>system: </b> <span><a href="http://terminology.hl7.org/6.5.0/CodeSystem-v3-ActCode.html">http://terminology.hl7.org/CodeSystem/v3-ActCode</a></span>
</p>
<p style="margin-bottom: 5px;">
<b>code: </b> <span>OBSENC</span>
</p>
<p style="margin-bottom: 5px;">
<b>display: </b> <span>observation encounter</span>
</p>
</th>
</tr>
<tr>
<th>Encounter</th>
<th>http://hl7.org/fhir/StructureDefinition/Encounter</th>
<th>;;;;;;;;;;;;;;;;;;;;</th>
<th>
</th>
</tr>
<tr>
<th>Location</th>
<th>http://hl7.org/fhir/StructureDefinition/Location</th>
<th>;;;;;;;;;;;;;;;;;;</th>
<th>
</th>
</tr>
<tr>
<th>Condition</th>
<th>http://hl7.org/fhir/StructureDefinition/Condition</th>
<th>;;;;;;;;;;;;;;;;;</th>
<th>
</th>
</tr>
<tr>
<th>DiagnosticReport</th>
<th>http://hl7.org/fhir/StructureDefinition/DiagnosticReport</th>
<th>;;;;;;;;;;;;;;;;</th>
<th>
</th>
</tr>
<tr>
<th>Observation</th>
<th>http://hl7.org/fhir/StructureDefinition/Observation</th>
<th>;;;;;;;;;;;;;;;;;;;;;;;;</th>
<th>
</th>
</tr>
<tr>
<th>Device</th>
<th>http://hl7.org/fhir/StructureDefinition/Device</th>
<th>;;;;;;;;;;;</th>
<th>
</th>
</tr>
<tr>
<th>MedicationAdministration</th>
<th>http://hl7.org/fhir/StructureDefinition/MedicationAdministration</th>
<th>;;;;;;;;;;;;;;;;;;;;</th>
<th>
</th>
</tr>
<tr>
<th>MedicationRequest</th>
<th>http://hl7.org/fhir/StructureDefinition/MedicationRequest</th>
<th>;;;;;;;;;;;;;;;;;;;;;</th>
<th>
</th>
</tr>
<tr>
<th>Medication</th>
<th>http://hl7.org/fhir/StructureDefinition/Medication</th>
<th>;;;;;;;;;</th>
<th>
</th>
</tr>
<tr>
<th>Coverage</th>
<th>http://hl7.org/fhir/StructureDefinition/Coverage</th>
<th>;;;;;;;;;;;;;;;;;</th>
<th>
</th>
</tr>
<tr>
<th>Procedure</th>
<th>http://hl7.org/fhir/StructureDefinition/Procedure</th>
<th>;;;;;;;;;;;;;;</th>
<th>
</th>
</tr>
<tr>
<th>Specimen</th>
<th>http://hl7.org/fhir/StructureDefinition/Specimen</th>
<th>;;;;;;;;;;;;;;;;</th>
<th>
</th>
</tr>
<tr>
<th>ServiceRequest</th>
<th>http://hl7.org/fhir/StructureDefinition/ServiceRequest</th>
<th>;;;;;;;;;;;;;;;;;</th>
<th>
</th>
</tr>
</table>
</td>
</tr>
<tr>
<td colspan="2">
<table>
<tr><th><a id="cql-content"><b>Content: </b></a> text/cql</th></tr>
<tr><td><pre><code class="language-cql">library NHSNAcuteCareHospitalMonthlyInitialPopulation version '1.0.0-dev'
using FHIR version '4.0.1'
include FHIRHelpers version '4.0.2' called FHIRHelpers
include NHSNHelpers version '0.0.002' called NHSNHelpers
include SharedResourceCreation version '0.1.010' called SharedResource
codesystem "ActCode": 'http://terminology.hl7.org/CodeSystem/v3-ActCode'
codesystem "Observation Category": 'http://terminology.hl7.org/CodeSystem/observation-category'
codesystem "LOINC": 'http://loinc.org'
codesystem "V2-0074": 'http://terminology.hl7.org/CodeSystem/v2-0074'
codesystem "Condition Category": 'http://terminology.hl7.org/CodeSystem/condition-category'
codesystem "US Core Condition Category": 'http://hl7.org/fhir/us/core/CodeSystem/condition-category'
codesystem "Condition Clinical Status": 'http://terminology.hl7.org/CodeSystem/condition-clinical'
codesystem "SNOMEDCT": 'http://snomed.info/sct'
codesystem "MedicationRequest Category": 'http://terminology.hl7.org/CodeSystem/medicationrequest-category'
valueset "Inpatient, Emergency, and Observation Locations": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1046.265'
valueset "Emergency Department Visit": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.292'
valueset "Encounter Inpatient": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.666.5.307'
valueset "Observation Services": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1111.143'
valueset "NHSN Inpatient Encounter Class Codes": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1046.274'
//code for Observation Category
code "laboratory": 'laboratory' from "Observation Category" display 'Laboratory'
code "social-history": 'social-history' from "Observation Category" display 'Social History'
code "vital-signs": 'vital-signs' from "Observation Category" display 'Vital Signs'
code "imaging": 'imaging' from "Observation Category" display 'Imaging'
code "procedure": 'procedure' from "Observation Category" display 'Procedure'
code "survey": 'survey' from "Observation Category" display 'Survey'
//code for Condition category
//code "problem-list-item": 'problem-list-item' from "Condition Category" display 'Problem List Item'
code "encounter-diagnosis": 'encounter-diagnosis' from "Condition Category" display 'Encounter Diagnosis'
//code "health-concern": 'health-concern' from "US Core Condition Category" display 'Health Concern'
//code for Diagnostic Report Category
code "LAB": 'LAB' from "V2-0074" display 'Laboratory'
code "Radiology": 'LP29684-5' from "LOINC" display 'Radiology'
code "Pathology": 'LP7839-6' from "LOINC" display 'Pathology'
code "Cardiology": 'LP29708-2' from "LOINC" display 'Cardiology'
//code for Emergency Encounter Class
code "emergency": 'EMER' from "ActCode" display 'emergency'
code "observation encounter": 'OBSENC' from "ActCode" display 'observation encounter'
//code for Condition clinicalStatus
code "active": 'active' from "Condition Clinical Status" display 'active'
//code for Procedure category
code "Surgical procedure": '3877713003' from "SNOMEDCT" display 'Surgical procedure'
code "Diagnostic procedure": '103693007' from "SNOMEDCT" display 'Diagnostic procedure'
//code for MedicationRequest category
code "inpatient": 'inpatient' from "MedicationRequest Category" display 'Inpatient'
code "outpatient": 'outpatient' from "MedicationRequest Category" display 'Outpatient'
//code for ServiceRequest category (also uses Surgical procedure from Procedure categories)
code "Laboratory procedure": '108252007' from "SNOMEDCT" display 'Laboratory procedure'
code "Imaging": '363679005' from "SNOMEDCT" display 'Imaging'
parameter "Measurement Period"
default Interval[@2022-01-01T00:00:00.0, @2022-01-31T23:59:59.0)
context Patient
define "Qualifying Encounters During Measurement Period":
( [Encounter: "Encounter Inpatient"]
union [Encounter: "Emergency Department Visit"]
union [Encounter: "Observation Services"]
union [Encounter: class in "NHSN Inpatient Encounter Class Codes"]
union [Encounter: class ~ "emergency"]
union [Encounter: class ~ "observation encounter"]) QualifyingEncounters
where QualifyingEncounters.status in {'in-progress', 'finished', 'triaged', 'onleave', 'entered-in-error'}
and QualifyingEncounters.period overlaps "Measurement Period"
define "Encounters with Patient Hospital Locations":
"Encounters" Encounters
where exists(
Encounters.location EncounterLocation
where NHSNHelpers.GetLocation(EncounterLocation.location).type in "Inpatient, Emergency, and Observation Locations"
and EncounterLocation.period overlaps Encounters.period
)
and Encounters.status in {'in-progress', 'finished', 'triaged', 'onleave', 'entered-in-error'}
and Encounters.period overlaps "Measurement Period"
define "Initial Population":
"Qualifying Encounters During Measurement Period"
union "Encounters with Patient Hospital Locations"
define "Encounters":
[Encounter]
define "Conditions":
[Condition]
define "DiagnosticReports":
[DiagnosticReport]
define "Observations":
[Observation]
define "Get Locations from IP Encounters in Measurement Period":
flatten("Initial Population" IP
let locationElements: IP.location
return
locationElements LE
let locationReference: LE.location
return NHSNHelpers.GetLocation(locationReference))
//============================================================================
//Supplemental Data Element
//When FHIR.canonical value is present, US Core 3.1.1 profiles are used
//When FHIR.canonical value is not present, FHIR Base profiles are used
//============================================================================
define "SDE Condition":
"Conditions" Conditions
where exists(
"Initial Population" IP
//Check for Problem List Conditions that were recorded before or during IP
where
(exists(IP.diagnosis Diagnoses
where GetCondition(Diagnoses.condition).id = Conditions.id
)
or GetEncounter(Conditions.encounter).id = IP.id
)
and exists (Conditions.category categories
where categories ~ "encounter-diagnosis"
)
)
return ConditionResource(Conditions,
{FHIR.canonical{value: 'http://www.cdc.gov/nhsn/fhirportal/dqm/ig/StructureDefinition/ach-monthly-condition'}},
{"encounter-diagnosis"})
define "SDE Device":
[Device] Devices
where exists("Initial Population")
return DeviceResource(Devices,
{FHIR.canonical{value: 'http://www.cdc.gov/nhsn/fhirportal/dqm/ig/StructureDefinition/ach-monthly-device'}})
//This block collects all DiagnosticReport resources while also marking Lab and Note DiagnosticReports with the appropriate profiles
//#Start DiagnosticReport block
define "SDE DiagnosticReport Lab":
"DiagnosticReports" DiagnosticReports
where (exists(DiagnosticReports.category Category where Category ~ "LAB")
and exists(
"Initial Population" IP
where NHSNHelpers."Normalize Interval"(DiagnosticReports.effective) overlaps IP.period))
return DiagnosticReportLabResource(DiagnosticReports,
{FHIR.canonical{value: 'http://www.cdc.gov/nhsn/fhirportal/dqm/ig/StructureDefinition/ach-monthly-diagnosticreport-lab'}},
{"LAB", "Radiology", "Pathology", "Cardiology"})
define "SDE DiagnosticReport Note":
"DiagnosticReports" DiagnosticReports
where ((exists(DiagnosticReports.category Category where Category ~ "Radiology"))
or exists((DiagnosticReports.category Category where Category ~ "Pathology"))
or exists((DiagnosticReports.category Category where Category ~ "Cardiology")))
and exists(
"Initial Population" IP
where NHSNHelpers."Normalize Interval"(DiagnosticReports.effective) overlaps IP.period)
return DiagnosticReportResource(DiagnosticReports,
{FHIR.canonical{value: 'http://www.cdc.gov/nhsn/fhirportal/dqm/ig/StructureDefinition/ach-monthly-diagnosticreport-note'}})
define "SDE DiagnosticReport Others":
[DiagnosticReport] DiagnosticReports
where not ((exists(DiagnosticReports.category Category where Category ~ "Radiology"))
or exists((DiagnosticReports.category Category where Category ~ "Pathology"))
or exists((DiagnosticReports.category Category where Category ~ "Cardiology"))
or exists(DiagnosticReports.category Category where Category ~ "LAB"))
and exists("Initial Population" IP
where NHSNHelpers."Normalize Interval"(DiagnosticReports.effective) overlaps IP.period)
return DiagnosticReportResource(DiagnosticReports,
{FHIR.canonical{value: 'http://www.cdc.gov/nhsn/fhirportal/dqm/ig/StructureDefinition/ach-monthly-diagnosticreport'}})
//#End DiagnosticReport block
define "SDE Encounter":
"Encounters" Encounters
where not CheckIP(Encounters)
and exists(
"Initial Population" IP
where Encounters.period overlaps IP.period)
return SharedResource.EncounterResource(Encounters,
{FHIR.canonical{value: 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-encounter'}})
define "SDE IP Encounters":
"Initial Population" IP
return SharedResource.EncounterResource(IP,
{FHIR.canonical{value: 'http://www.cdc.gov/nhsn/fhirportal/dqm/ig/StructureDefinition/ach-monthly-encounter'}})
define "SDE Location":
"Get Locations from IP Encounters in Measurement Period" Locations
where exists("Initial Population")
and Locations is not null
return SharedResource.LocationResource(Locations,
{FHIR.canonical{value: 'http://www.cdc.gov/nhsn/fhirportal/dqm/ig/StructureDefinition/ach-monthly-location'}})
define "SDE Medication Administration":
[MedicationAdministration] MedicationAdministrations
where exists(
"Initial Population" IP
where NHSNHelpers."Normalize Interval"(MedicationAdministrations.effective) overlaps IP.period)
return MedicationAdministrationResource(MedicationAdministrations,
{FHIR.canonical{value: 'http://www.cdc.gov/nhsn/fhirportal/dqm/ig/StructureDefinition/ach-monthly-medicationadministration'}},
{"inpatient", "outpatient"})
define "SDE Medication Request":
[MedicationRequest] MedicationRequests
where exists(
"Initial Population" IP
where MedicationRequests.authoredOn during IP.period)
return MedicationRequestResource(MedicationRequests,
{FHIR.canonical{value: 'http://www.cdc.gov/nhsn/fhirportal/dqm/ig/StructureDefinition/ach-monthly-medicationrequest'}},
{"inpatient", "outpatient"})
define "SDE Medication":
("SDE Medication Request"
union "SDE Medication Administration") MedReqOrAdmin
where MedReqOrAdmin.medication is FHIR.Reference
and exists("Initial Population") //No longer need to check for timing here because it's checked in SDE Medication Request/Administriation
return SharedResource.MedicationResource(GetMedicationFrom(MedReqOrAdmin.medication),
{FHIR.canonical{value: 'http://www.cdc.gov/nhsn/fhirportal/dqm/ig/StructureDefinition/ach-monthly-medication'}})
define "SDE Observation Lab Category":
"Observations" Observations
where (exists(Observations.category Category where Category ~ "laboratory"))
and exists(
"Initial Population" IP
where NHSNHelpers."Normalize Interval"(Observations.effective) overlaps IP.period)
return ObservationLabResource(Observations,
{FHIR.canonical{value: 'http://www.cdc.gov/nhsn/fhirportal/dqm/ig/StructureDefinition/ach-monthly-observation-lab'}},
{"imaging", "procedure", "vital-signs", "laboratory"})
//Vital Signs Observation has its own profile in FHIR Base
define "SDE Observation Vital Signs Category":
"Observations" Observations
where (exists(Observations.category Category where Category ~ "vital-signs"))
and exists(
"Initial Population" IP
where NHSNHelpers."Normalize Interval"(Observations.effective) overlaps IP.period)
return ObservationVitalSignsResource(Observations,
{FHIR.canonical{value: 'http://www.cdc.gov/nhsn/fhirportal/dqm/ig/StructureDefinition/ach-monthly-observation-vitals'}},
{"imaging", "procedure", "vital-signs", "laboratory"})
//Defaulting to base FHIR profile as there are no individual profiles in US Core 3.1.1 that cover these Observation categories
define "SDE Observation Category":
"Observations" Observations
where (/*(exists(Observations.category Category where Category ~ "social-history"))
or (exists(Observations.category Category where Category ~ "survey"))
or */(exists(Observations.category Category where Category ~ "imaging"))
or (exists(Observations.category Category where Category ~ "procedure")))
and exists(
"Initial Population" IP
where NHSNHelpers."Normalize Interval"(Observations.effective) overlaps IP.period)
return ObservationResource(Observations,
{FHIR.canonical{value: 'http://www.cdc.gov/nhsn/fhirportal/dqm/ig/StructureDefinition/ach-monthly-observation'}},
{"imaging", "procedure", "vital-signs", "laboratory"})
define "SDE Coverage":
[Coverage] Coverages
where exists(
"Initial Population" IP
where Coverages.period overlaps IP.period)
return SharedResource.CoverageResource(Coverages,
{FHIR.canonical{value: 'http://www.cdc.gov/nhsn/fhirportal/dqm/ig/StructureDefinition/ach-monthly-coverage'}})
define "SDE Procedure":
[Procedure] Procedures
where exists(
"Initial Population" IP
where NHSNHelpers."Normalize Interval"(Procedures.performed) overlaps IP.period)
return ProcedureResource(Procedures,
{FHIR.canonical{value: 'http://www.cdc.gov/nhsn/fhirportal/dqm/ig/StructureDefinition/ach-monthly-procedure'}},
{"Surgical procedure", "Diagnostic procedure"})
define "SDE Specimen":
[Specimen] Specimens
where exists(
"Initial Population" IP
where NHSNHelpers."Normalize Interval"(Specimens.collection.collected) overlaps IP.period
)
return SharedResource.SpecimenResource(Specimens,
{FHIR.canonical{value: 'http://www.cdc.gov/nhsn/fhirportal/dqm/ig/StructureDefinition/ach-monthly-specimen'}})
define "SDE Service Request":
[ServiceRequest] ServiceRequests
where exists("Initial Population" IP
where ServiceRequests.authoredOn during IP.period)
return ServiceRequestResource(ServiceRequests,
{FHIR.canonical{value: 'http://www.cdc.gov/nhsn/fhirportal/dqm/ig/StructureDefinition/ach-monthly-servicerequest'}},
{"Laboratory procedure", "Surgical procedure", "Imaging"})
define "SDE Minimal Patient":
Patient p
return SharedResource.PatientResource(p,
{FHIR.canonical{value: 'http://www.cdc.gov/nhsn/fhirportal/dqm/ig/StructureDefinition/cross-measure-patient'}})
//
//Functions
//
define function "CheckIP"(encounter Encounter):
exists("Initial Population" IP
where encounter.id = IP.id)
define function "GetMedicationFrom"(choice Choice<FHIR.CodeableConcept, FHIR.Reference>):
case
when choice is FHIR.Reference then
GetMedication(choice as FHIR.Reference)
else
null
end
define function "GetMedication"(reference Reference):
singleton from (
[Medication] Medications
where Medications.id = NHSNHelpers.GetId(reference.reference)
)
define function "GetCondition"(reference Reference):
singleton from (
"Conditions" Conditions
where Conditions.id = NHSNHelpers.GetId(reference.reference)
)
define function "GetEncounter"(reference Reference):
singleton from (
"Encounters" Encounters
where Encounters.id = NHSNHelpers.GetId(reference.reference)
)
define function RemoveUnaccepted(codes List<FHIR.CodeableConcept>, accepted List<System.Code>):
codes c
where exists(
accepted a
where c ~ a
)
define function FilterCodeableConcepts(codes List<FHIR.CodeableConcept>, accepted List<System.Code>):
if Count(accepted) > 0
then RemoveUnaccepted(codes, accepted)
else codes
//
//Measure Specific Resource Creation Functions
//
define function ConditionResource(condition Condition, profileURLs List<FHIR.canonical>, acceptedCategories List<System.Code>):
condition c
return Condition{
id: FHIR.id {value: 'LCR-' + c.id},
meta: SharedResource.MetaElement(c, profileURLs),
extension: c.extension,
clinicalStatus: c.clinicalStatus,
verificationStatus: c.verificationStatus,
category: FilterCodeableConcepts(c.category, acceptedCategories),
code: c.code,
subject: c.subject,
encounter: c.encounter,
onset: c.onset,
abatement: c.abatement,
recordedDate: c.recordedDate
}
define function DeviceResource(device Device, profileURLs List<FHIR.canonical>):
device d
return Device{
id: FHIR.id{value: 'LCR-' + d.id},
meta: SharedResource.MetaElement(d, profileURLs),
extension: d.extension,
status: d.status,
expirationDate: d.expirationDate,
lotNumber: d.lotNumber,
serialNumber: d.serialNumber,
modelNumber: d.modelNumber,
partNumber: d.partNumber,
type: d.type,
patient: d.patient,
parent: d.parent
}
define function DiagnosticReportCoding(coding List<Coding>):
coding c
return Coding{
system: c.system,
version: c.version,
code: c.code,
display: c.display
}
define function DiagnosticReportCategory(category List<CodeableConcept>):
category c
return CodeableConcept{
coding: DiagnosticReportCoding(c.coding)
}
define function DiagnosticReportLabResource(diagnosticReport DiagnosticReport, profileURLs List<FHIR.canonical>, acceptedCategories List<System.Code>):
diagnosticReport d
return DiagnosticReport{
id: FHIR.id{value: 'LCR-' + d.id},
meta: SharedResource.MetaElement(d, profileURLs),
extension: d.extension,
basedOn: d.basedOn,
status: d.status,
category: FilterCodeableConcepts(DiagnosticReportCategory(d.category), acceptedCategories),
code: d.code,
subject: d.subject,
encounter: d.encounter,
effective: d.effective,
issued: d.issued,
specimen: d.specimen,
result: d.result,
conclusion: d.conclusion,
conclusionCode: d.conclusionCode
}
define function DiagnosticReportResource(diagnosticReport DiagnosticReport, profileURLs List<FHIR.canonical>):
diagnosticReport d
return DiagnosticReport{
id: FHIR.id{value: 'LCR-' + d.id},
meta: SharedResource.MetaElement(d, profileURLs),
extension: d.extension,
basedOn: d.basedOn,
status: d.status,
category: d.category,
code: d.code,
subject: d.subject,
encounter: d.encounter,
effective: d.effective,
issued: d.issued,
performer: d.performer,
resultsInterpreter: d.resultsInterpreter,
specimen: d.specimen,
result: d.result,
conclusion: d.conclusion,
conclusionCode: d.conclusionCode
}
define function EncounterHospitalization(hospitalization FHIR.Encounter.Hospitalization):
hospitalization h
return FHIR.Encounter.Hospitalization{
origin: h.origin,
admitSource: h.admitSource,
reAdmission: h.reAdmission,
dietPreference: h.dietPreference,
dischargeDisposition: h.dischargeDisposition
}
define function EncounterResource(encounter Encounter, profileURLs List<FHIR.canonical>):
encounter e
return Encounter{
id: FHIR.id{value: 'LCR-' + e.id},
meta: SharedResource.MetaElement(e, profileURLs),
extension: e.extension,
identifier: SharedResource.EncounterIdentifier(e.identifier),
status: e.status,
statusHistory: SharedResource.EncounterStatusHistory(e.statusHistory),
class: e.class,
classHistory: SharedResource.EncounterClassHistory(e.classHistory),
type: e.type,
subject: e.subject,
period: e.period,
reasonCode: e.reasonCode,
diagnosis: SharedResource.EncounterDiagnosis(e.diagnosis),
hospitalization: EncounterHospitalization(e.hospitalization),
location: SharedResource.EncounterLocation(e.location),
partOf: e.partOf
}
define function LocationResource(location Location, profileURLs List<FHIR.canonical>):
location l
return Location{
id: FHIR.id {value: 'LCR-' + l.id},
meta: SharedResource.MetaElement(l, profileURLs),
extension: l.extension,
status: l.status,
name: l.name,
alias: l.alias,
type: l.type,
physicalType: l.physicalType,
managingOrganization: l.managingOrganization,
partOf: l.partOf
}
define function MedicationRequestResource(medicationRequest MedicationRequest, profileURLs List<FHIR.canonical>, acceptedCategories List<System.Code>):
medicationRequest m
return MedicationRequest{
id: FHIR.id {value: 'LCR-' + m.id},
meta: SharedResource.MetaElement(medicationRequest, profileURLs),
extension: m.extension,
status: m.status,
statusReason: m.statusReason,
intent: m.intent,
category: FilterCodeableConcepts(m.category, acceptedCategories),
priority: m.priority,
doNotPerform: m.doNotPerform,
reported: m.reported,
medication: m.medication,
subject: m.subject,
encounter: m.encounter,
authoredOn: m.authoredOn,
requester: m.requester,
recorder: m.recorder,
reasonCode: m.reasonCode,
reasonReference: m.reasonReference,
instantiatesCanonical: m.instantiatesCanonical,
instantiatesUri: m.instantiatesUri,
courseOfTherapyType: m.courseOfTherapyType,
dosageInstruction: SharedResource.MedicationRequestDosageInstruction(m.dosageInstruction)
}
define function MedicationAdministrationResource(medicationAdministration MedicationAdministration, profileURLs List<FHIR.canonical>, acceptedCategories List<System.Code>):
medicationAdministration m
return MedicationAdministration{
id: FHIR.id {value: 'LCR-' + m.id},
meta: SharedResource.MetaElement(m, profileURLs),
extension: m.extension,
instantiates: m.instantiates,
partOf: m.partOf,
status: m.status,
statusReason: m.statusReason,
category: FilterCodeableConcepts({m.category}, acceptedCategories)[0],
medication: m.medication,
subject: m.subject,
context: m.context,
supportingInformation: m.supportingInformation,
effective: m.effective,
performer: SharedResource.MedicationAdministrationPerformer(m.performer),
reasonCode: m.reasonCode,
reasonReference: m.reasonReference,
request: m.request,
device: m.device,
note: m.note,
dosage: SharedResource.MedicationAdministrationDosage(m.dosage),
eventHistory: m.eventHistory
}
define function ObservationLabReferenceRange(referenceRange List<FHIR.Observation.ReferenceRange>):
referenceRange rR
return FHIR.Observation.ReferenceRange{
low: rR.low,
high: rR.high,
type: rR.type,
appliesTo: rR.appliesTo,
age: rR.age
}
define function ObservationLabResource(observation Observation, profileURLs List<FHIR.canonical>, acceptedCategories List<System.Code>):
observation o
return Observation{
id: FHIR.id {value: 'LCR-' + o.id},
meta: SharedResource.MetaElement(o, profileURLs),
extension: o.extension,
partOf: o.partOf,
status: o.status,
category: FilterCodeableConcepts(SharedResource.ObservationLabCategory(o.category), acceptedCategories),
code: o.code,
subject: o.subject,
encounter: o.encounter,
effective: o.effective,
issued: o.issued,
value: o.value,
dataAbsentReason: o.dataAbsentReason,
interpretation: o.interpretation,
bodySite: o.bodySite,
method: o.method,
specimen: o.specimen,
referenceRange: ObservationLabReferenceRange(o.referenceRange),
hasMember: o.hasMember,
derivedFrom: o.derivedFrom,
component: SharedResource.ObservationComponent(o.component)
}
define function ObservationReferenceRange(referenceRange List<FHIR.Observation.ReferenceRange>):
referenceRange rR
return FHIR.Observation.ReferenceRange{
low: rR.low,
high: rR.high,
type: rR.type,
appliesTo: rR.appliesTo,
age: rR.age
}
define function ObservationResource(observation Observation, profileURLs List<FHIR.canonical>, acceptedCategories List<System.Code>):
observation o
return Observation{
id: FHIR.id {value: 'LCR-' + o.id},
meta: SharedResource.MetaElement(o, profileURLs),
extension: o.extension,
partOf: o.partOf,
status: o.status,
category: FilterCodeableConcepts(o.category, acceptedCategories),
code: o.code,
subject: o.subject,
encounter: o.encounter,
effective: o.effective,
issued: o.issued,
value: o.value,
dataAbsentReason: o.dataAbsentReason,
interpretation: o.interpretation,
bodySite: o.bodySite,
method: o.method,
specimen: o.specimen,
referenceRange: ObservationReferenceRange(o.referenceRange),
hasMember: o.hasMember,
derivedFrom: o.derivedFrom,
component: SharedResource.ObservationComponent(o.component)
}
define function ObservationVitalSignsCoding(coding List<Coding>):
coding c
return Coding{
system: c.system,
version: c.version,
code: c.code,
display: c.display,
userSelected: c.userSelected
}
define function ObservationVitalSignsCategory(category List<CodeableConcept>):
category c
return CodeableConcept{
coding: ObservationVitalSignsCoding(c.coding),
text: c.text
}
define function ObservationVitalSignsComponent(component List<FHIR.Observation.Component>):
component c
return FHIR.Observation.Component{
code: c.code,
value: c.value,
dataAbsentReason: c.dataAbsentReason,
interpretation: c.interpretation,
referenceRange: SharedResource.ObservationReferenceRange(c.referenceRange)
}
define function ObservationVitalSignsResource(observation Observation, profileURLs List<FHIR.canonical>, acceptedCategories List<System.Code>):
observation o
return Observation{
id: FHIR.id {value: 'LCR-' + o.id},
meta: SharedResource.MetaElement(o, profileURLs),
extension: o.extension,
partOf: o.partOf,
status: o.status,
category: FilterCodeableConcepts(ObservationVitalSignsCategory(o.category), acceptedCategories),
code: o.code,
subject: o.subject,
focus: o.focus,
encounter: o.encounter,
effective: o.effective,
issued: o.issued,
performer: o.performer,
value: o.value,
dataAbsentReason: o.dataAbsentReason,
interpretation: o.interpretation,
note: o.note,
bodySite: o.bodySite,
method: o.method,
specimen: o.specimen,
device: o.device,
referenceRange: SharedResource.ObservationReferenceRange(o.referenceRange),
hasMember: o.hasMember,
derivedFrom: o.derivedFrom,
component: ObservationVitalSignsComponent(o.component)
}
define function ProcedureResource(procedure Procedure, profileURLs List<FHIR.canonical>, acceptedCategories List<System.Code>):
procedure p
return Procedure{
id: FHIR.id {value: 'LCR-' + p.id},
meta: SharedResource.MetaElement(p, profileURLs),
extension: p.extension,
basedOn: p.basedOn,
partOf: p.partOf,
status: p.status,
category: FilterCodeableConcepts({p.category}, acceptedCategories)[0],
code: p.code,
subject: p.subject,
encounter: p.encounter,
performed: p.performed,
location: p.location,
reasonCode: p.reasonCode,
reasonReference: p.reasonReference,
bodySite: p.bodySite
}
define function ServiceRequestResource(serviceRequest ServiceRequest, profileURLs List<FHIR.canonical>, acceptedCategories List<System.Code>):
serviceRequest sR
return ServiceRequest{
id: FHIR.id {value: 'LCR-' + sR.id},
meta: SharedResource.MetaElement(sR, profileURLs),
extension: sR.extension,
basedOn: sR.basedOn,
status: sR.status,
intent: sR.intent,
category: FilterCodeableConcepts(sR.category, acceptedCategories),
priority: sR.priority,
doNotPerform: sR.doNotPerform,
code: sR.code,
quantity: sR.quantity,
subject: sR.subject,
encounter: sR.encounter,
occurrence: sR.occurrence,
asNeeded: sR.asNeeded,
authoredOn: sR.authoredOn,
requester: sR.requester,
specimen: sR.specimen
}
define function SpecimenCollection(collection FHIR.Specimen.Collection):
collection c
return FHIR.Specimen.Collection{
collector: c.collector,
collected: c.collected,
quantity: c.quantity,
bodySite: c.bodySite
}
define function SpecimenResource(specimen Specimen, profileURLs List<FHIR.canonical>):
specimen s
return Specimen{
id: FHIR.id {value: 'LCR-' + s.id},
meta: SharedResource.MetaElement(s, profileURLs),
extension: s.extension,
identifier: s.identifier,
accessionIdentifier: s.accessionIdentifier,
status: s.status,
type: s.type,
subject: s.subject,
parent: s.parent,
request: s.request,
collection: SpecimenCollection(s.collection),
note: s.note
}</code></pre></td></tr>
</table>
</td>
</tr>
</table>
</div>
</div>
</text>
<contained>
<Parameters>
<id value="options"/>
<parameter>
<name value="translatorVersion"/>
<valueString value="3.11.0"/>
</parameter>
<parameter>
<name value="option"/>
<valueString value="EnableDateRangeOptimization"/>
</parameter>
<parameter>
<name value="option"/>
<valueString value="EnableAnnotations"/>
</parameter>
<parameter>
<name value="option"/>
<valueString value="EnableLocators"/>
</parameter>
<parameter>
<name value="option"/>
<valueString value="DisableListDemotion"/>
</parameter>
<parameter>
<name value="option"/>
<valueString value="DisableListPromotion"/>
</parameter>
<parameter>
<name value="analyzeDataRequirements"/>
<valueBoolean value="false"/>
</parameter>
<parameter>
<name value="collapseDataRequirements"/>
<valueBoolean value="true"/>
</parameter>
<parameter>
<name value="compatibilityLevel"/>
<valueString value="1.5"/>
</parameter>
<parameter>
<name value="enableCqlOnly"/>
<valueBoolean value="false"/>
</parameter>
<parameter>
<name value="errorLevel"/>
<valueString value="Info"/>
</parameter>
<parameter>
<name value="signatureLevel"/>
<valueString value="Overloads"/>
</parameter>
<parameter>
<name value="validateUnits"/>
<valueBoolean value="true"/>
</parameter>
<parameter>
<name value="verifyOnly"/>
<valueBoolean value="false"/>
</parameter>
</Parameters>
</contained>
<extension url="http://hl7.org/fhir/StructureDefinition/cqf-cqlOptions">
<valueReference>
<reference value="#options"/>
</valueReference>
</extension>
<extension
url="http://hl7.org/fhir/uv/crmi/StructureDefinition/crmi-softwaresystem">
<valueReference>🔗
<reference value="Device/cqf-tooling"/>
</valueReference>
</extension>
<url
value="http://www.cdc.gov/nhsn/fhirportal/dqm/ig/Library/NHSNAcuteCareHospitalMonthlyInitialPopulation"/>
<version value="1.0.0"/>
<name value="NHSNAcuteCareHospitalMonthlyInitialPopulation"/>
<status value="draft"/>
<type>
<coding>
<system value="http://terminology.hl7.org/CodeSystem/library-type"/>
<code value="logic-library"/>
</coding>
</type>
<date value="2025-09-28T15:20:22+00:00"/>
<publisher value="CDC National Healthcare Safety Network (NHSN)"/>
<contact>
<name value="CDC National Healthcare Safety Network (NHSN)"/>
<telecom>
<system value="url"/>
<value value="http://www.cdc.gov/nhsn"/>
</telecom>
<telecom>
<system value="email"/>
<value value="nhsn@cdc.gov"/>
</telecom>
</contact>
<jurisdiction>
<coding>
<system value="urn:iso:std:iso:3166"/>
<code value="US"/>
</coding>
</jurisdiction>
<relatedArtifact>
<type value="depends-on"/>
<display value="FHIR model information"/>
<resource
value="http://fhir.org/guides/cqf/common/Library/FHIR-ModelInfo|4.0.1"/>
</relatedArtifact>
<relatedArtifact>
<type value="depends-on"/>
<display value="Library FHIRHelpers"/>
<resource
value="http://www.cdc.gov/nhsn/fhirportal/dqm/ig/Library/FHIRHelpers|4.0.2"/>
</relatedArtifact>
<relatedArtifact>
<type value="depends-on"/>
<display value="Library NHSNHelpers"/>
<resource
value="http://www.cdc.gov/nhsn/fhirportal/dqm/ig/Library/NHSNHelpers|0.0.002"/>
</relatedArtifact>
<relatedArtifact>
<type value="depends-on"/>
<display value="Library SharedResource"/>
<resource
value="http://www.cdc.gov/nhsn/fhirportal/dqm/ig/Library/SharedResourceCreation|0.1.010"/>
</relatedArtifact>
<relatedArtifact>
<type value="depends-on"/>
<display value="Code system ActCode"/>
<resource value="http://terminology.hl7.org/CodeSystem/v3-ActCode|9.0.0"/>
</relatedArtifact>
<relatedArtifact>
<type value="depends-on"/>
<display value="Code system Observation Category"/>
<resource
value="http://terminology.hl7.org/CodeSystem/observation-category|1.0.1"/>
</relatedArtifact>
<relatedArtifact>
<type value="depends-on"/>
<display value="Code system LOINC"/>
<resource value="http://loinc.org"/>
</relatedArtifact>
<relatedArtifact>
<type value="depends-on"/>
<display value="Code system V2-0074"/>
<resource value="http://terminology.hl7.org/CodeSystem/v2-0074|2.5.0"/>
</relatedArtifact>
<relatedArtifact>
<type value="depends-on"/>
<display value="Code system Condition Category"/>
<resource
value="http://terminology.hl7.org/CodeSystem/condition-category|1.0.1"/>
</relatedArtifact>
<relatedArtifact>
<type value="depends-on"/>
<display value="Code system US Core Condition Category"/>
<resource
value="http://hl7.org/fhir/us/core/CodeSystem/condition-category|6.1.0"/>
</relatedArtifact>
<relatedArtifact>
<type value="depends-on"/>
<display value="Code system Condition Clinical Status"/>
<resource
value="http://terminology.hl7.org/CodeSystem/condition-clinical|3.0.0"/>
</relatedArtifact>
<relatedArtifact>
<type value="depends-on"/>
<display value="Code system SNOMEDCT"/>
<resource value="http://snomed.info/sct"/>
</relatedArtifact>
<relatedArtifact>
<type value="depends-on"/>
<display value="Code system MedicationRequest Category"/>
<resource
value="http://terminology.hl7.org/CodeSystem/medicationrequest-category|1.0.0"/>
</relatedArtifact>
<relatedArtifact>
<type value="depends-on"/>
<display
value="Value set Inpatient, Emergency, and Observation Locations"/>
<resource
value="http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1046.265"/>
</relatedArtifact>
<relatedArtifact>
<type value="depends-on"/>
<display value="Value set Emergency Department Visit"/>
<resource
value="http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.292|20210611"/>
</relatedArtifact>
<relatedArtifact>
<type value="depends-on"/>
<display value="Value set Encounter Inpatient"/>
<resource
value="http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.666.5.307"/>
</relatedArtifact>
<relatedArtifact>
<type value="depends-on"/>
<display value="Value set Observation Services"/>
<resource
value="http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1111.143|20210611"/>
</relatedArtifact>
<relatedArtifact>
<type value="depends-on"/>
<display value="Value set NHSN Inpatient Encounter Class Codes"/>
<resource
value="http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1046.274"/>
</relatedArtifact>
<parameter>
<name value="Measurement Period"/>
<use value="in"/>
<min value="0"/>
<max value="1"/>
<type value="Period"/>
</parameter>
<parameter>
<name value="Patient"/>
<use value="out"/>
<min value="0"/>
<max value="1"/>
<type value="Patient"/>
</parameter>
<parameter>
<name value="Qualifying Encounters During Measurement Period"/>
<use value="out"/>
<min value="0"/>
<max value="*"/>
<type value="Encounter"/>
</parameter>
<parameter>
<name value="Encounters"/>
<use value="out"/>
<min value="0"/>
<max value="*"/>
<type value="Encounter"/>
</parameter>
<parameter>
<name value="Encounters with Patient Hospital Locations"/>
<use value="out"/>
<min value="0"/>
<max value="*"/>
<type value="Encounter"/>
</parameter>
<parameter>
<name value="Initial Population"/>
<use value="out"/>
<min value="0"/>
<max value="*"/>
<type value="Encounter"/>
</parameter>
<parameter>
<name value="Conditions"/>
<use value="out"/>
<min value="0"/>
<max value="*"/>
<type value="Condition"/>
</parameter>
<parameter>
<name value="DiagnosticReports"/>
<use value="out"/>
<min value="0"/>
<max value="*"/>
<type value="DiagnosticReport"/>
</parameter>
<parameter>
<name value="Observations"/>
<use value="out"/>
<min value="0"/>
<max value="*"/>
<type value="Observation"/>
</parameter>
<parameter>
<name value="Get Locations from IP Encounters in Measurement Period"/>
<use value="out"/>
<min value="0"/>
<max value="*"/>
<type value="Location"/>
</parameter>
<parameter>
<name value="SDE Condition"/>
<use value="out"/>
<min value="0"/>
<max value="*"/>
<type value="Condition"/>
</parameter>
<parameter>
<name value="SDE Device"/>
<use value="out"/>
<min value="0"/>
<max value="*"/>
<type value="Device"/>
</parameter>
<parameter>
<name value="SDE DiagnosticReport Lab"/>
<use value="out"/>
<min value="0"/>
<max value="*"/>
<type value="DiagnosticReport"/>
</parameter>
<parameter>
<name value="SDE DiagnosticReport Note"/>
<use value="out"/>
<min value="0"/>
<max value="*"/>
<type value="DiagnosticReport"/>
</parameter>
<parameter>
<name value="SDE DiagnosticReport Others"/>
<use value="out"/>
<min value="0"/>
<max value="*"/>
<type value="DiagnosticReport"/>
</parameter>
<parameter>
<name value="SDE Encounter"/>
<use value="out"/>
<min value="0"/>
<max value="*"/>
<type value="Encounter"/>
</parameter>
<parameter>
<name value="SDE IP Encounters"/>
<use value="out"/>
<min value="0"/>
<max value="*"/>
<type value="Encounter"/>
</parameter>
<parameter>
<name value="SDE Location"/>
<use value="out"/>
<min value="0"/>
<max value="*"/>
<type value="Location"/>
</parameter>
<parameter>
<name value="SDE Medication Administration"/>
<use value="out"/>
<min value="0"/>
<max value="*"/>
<type value="MedicationAdministration"/>
</parameter>
<parameter>
<name value="SDE Medication Request"/>
<use value="out"/>
<min value="0"/>
<max value="*"/>
<type value="MedicationRequest"/>
</parameter>
<parameter>
<name value="SDE Medication"/>
<use value="out"/>
<min value="0"/>
<max value="*"/>
<type value="Medication"/>
</parameter>
<parameter>
<name value="SDE Observation Lab Category"/>
<use value="out"/>
<min value="0"/>
<max value="*"/>
<type value="Observation"/>
</parameter>
<parameter>
<name value="SDE Observation Vital Signs Category"/>
<use value="out"/>
<min value="0"/>
<max value="*"/>
<type value="Observation"/>
</parameter>
<parameter>
<name value="SDE Observation Category"/>
<use value="out"/>
<min value="0"/>
<max value="*"/>
<type value="Observation"/>
</parameter>
<parameter>
<name value="SDE Coverage"/>
<use value="out"/>
<min value="0"/>
<max value="*"/>
<type value="Coverage"/>
</parameter>
<parameter>
<name value="SDE Procedure"/>
<use value="out"/>
<min value="0"/>
<max value="*"/>
<type value="Procedure"/>
</parameter>
<parameter>
<name value="SDE Specimen"/>
<use value="out"/>
<min value="0"/>
<max value="*"/>
<type value="Specimen"/>
</parameter>
<parameter>
<name value="SDE Service Request"/>
<use value="out"/>
<min value="0"/>
<max value="*"/>
<type value="ServiceRequest"/>
</parameter>
<parameter>
<name value="SDE Minimal Patient"/>
<use value="out"/>
<min value="0"/>
<max value="1"/>
<type value="Patient"/>
</parameter>
<dataRequirement>
<type value="Patient"/>
<profile value="http://hl7.org/fhir/StructureDefinition/Patient"/>
<mustSupport value="id"/>
<mustSupport value="identifier"/>
<mustSupport value="active"/>
<mustSupport value="name"/>
<mustSupport value="telecom"/>
<mustSupport value="gender"/>
<mustSupport value="birthDate"/>
<mustSupport value="deceased"/>
<mustSupport value="address"/>
<mustSupport value="maritalStatus"/>
<mustSupport value="multipleBirth"/>
<mustSupport value="photo"/>
<mustSupport value="contact"/>
<mustSupport value="communication"/>
<mustSupport value="generalPractitioner"/>
<mustSupport value="managingOrganization"/>
<mustSupport value="link"/>
</dataRequirement>
<dataRequirement>
<type value="Encounter"/>
<profile value="http://hl7.org/fhir/StructureDefinition/Encounter"/>
<mustSupport value="type"/>
<mustSupport value="status"/>
<mustSupport value="period"/>
<mustSupport value="location"/>
<mustSupport value="diagnosis"/>
<mustSupport value="id"/>
<mustSupport value="extension"/>
<mustSupport value="identifier"/>
<mustSupport value="statusHistory"/>
<mustSupport value="class"/>
<mustSupport value="classHistory"/>
<mustSupport value="serviceType"/>
<mustSupport value="priority"/>
<mustSupport value="subject"/>
<mustSupport value="length"/>
<mustSupport value="reasonCode"/>
<mustSupport value="reasonReference"/>
<mustSupport value="account"/>
<mustSupport value="hospitalization"/>
<mustSupport value="partOf"/>
<codeFilter>
<path value="type"/>
<valueSet
value="http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.666.5.307"/>
</codeFilter>
</dataRequirement>
<dataRequirement>
<type value="Encounter"/>
<profile value="http://hl7.org/fhir/StructureDefinition/Encounter"/>
<mustSupport value="type"/>
<mustSupport value="status"/>
<mustSupport value="period"/>
<mustSupport value="location"/>
<mustSupport value="diagnosis"/>
<mustSupport value="id"/>
<mustSupport value="extension"/>
<mustSupport value="identifier"/>
<mustSupport value="statusHistory"/>
<mustSupport value="class"/>
<mustSupport value="classHistory"/>
<mustSupport value="serviceType"/>
<mustSupport value="priority"/>
<mustSupport value="subject"/>
<mustSupport value="length"/>
<mustSupport value="reasonCode"/>
<mustSupport value="reasonReference"/>
<mustSupport value="account"/>
<mustSupport value="hospitalization"/>
<mustSupport value="partOf"/>
<codeFilter>
<path value="type"/>
<valueSet
value="http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.292|20210611"/>
</codeFilter>
</dataRequirement>
<dataRequirement>
<type value="Encounter"/>
<profile value="http://hl7.org/fhir/StructureDefinition/Encounter"/>
<mustSupport value="type"/>
<mustSupport value="status"/>
<mustSupport value="period"/>
<mustSupport value="location"/>
<mustSupport value="diagnosis"/>
<mustSupport value="id"/>
<mustSupport value="extension"/>
<mustSupport value="identifier"/>
<mustSupport value="statusHistory"/>
<mustSupport value="class"/>
<mustSupport value="classHistory"/>
<mustSupport value="serviceType"/>
<mustSupport value="priority"/>
<mustSupport value="subject"/>
<mustSupport value="length"/>
<mustSupport value="reasonCode"/>
<mustSupport value="reasonReference"/>
<mustSupport value="account"/>
<mustSupport value="hospitalization"/>
<mustSupport value="partOf"/>
<codeFilter>
<path value="type"/>
<valueSet
value="http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1111.143|20210611"/>
</codeFilter>
</dataRequirement>
<dataRequirement>
<type value="Encounter"/>
<profile value="http://hl7.org/fhir/StructureDefinition/Encounter"/>
<mustSupport value="class"/>
<mustSupport value="status"/>
<mustSupport value="period"/>
<mustSupport value="location"/>
<mustSupport value="diagnosis"/>
<mustSupport value="id"/>
<mustSupport value="extension"/>
<mustSupport value="identifier"/>
<mustSupport value="statusHistory"/>
<mustSupport value="classHistory"/>
<mustSupport value="type"/>
<mustSupport value="serviceType"/>
<mustSupport value="priority"/>
<mustSupport value="subject"/>
<mustSupport value="length"/>
<mustSupport value="reasonCode"/>
<mustSupport value="reasonReference"/>
<mustSupport value="account"/>
<mustSupport value="hospitalization"/>
<mustSupport value="partOf"/>
<codeFilter>
<path value="class"/>
<valueSet
value="http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1046.274"/>
</codeFilter>
</dataRequirement>
<dataRequirement>
<type value="Encounter"/>
<profile value="http://hl7.org/fhir/StructureDefinition/Encounter"/>
<mustSupport value="class"/>
<mustSupport value="status"/>
<mustSupport value="period"/>
<mustSupport value="location"/>
<mustSupport value="diagnosis"/>
<mustSupport value="id"/>
<mustSupport value="extension"/>
<mustSupport value="identifier"/>
<mustSupport value="statusHistory"/>
<mustSupport value="classHistory"/>
<mustSupport value="type"/>
<mustSupport value="serviceType"/>
<mustSupport value="priority"/>
<mustSupport value="subject"/>
<mustSupport value="length"/>
<mustSupport value="reasonCode"/>
<mustSupport value="reasonReference"/>
<mustSupport value="account"/>
<mustSupport value="hospitalization"/>
<mustSupport value="partOf"/>
<codeFilter>
<path value="class"/>
<code>
<system value="http://terminology.hl7.org/CodeSystem/v3-ActCode"/>
<code value="EMER"/>
<display value="emergency"/>
</code>
</codeFilter>
</dataRequirement>
<dataRequirement>
<type value="Encounter"/>
<profile value="http://hl7.org/fhir/StructureDefinition/Encounter"/>
<mustSupport value="class"/>
<mustSupport value="status"/>
<mustSupport value="period"/>
<mustSupport value="location"/>
<mustSupport value="diagnosis"/>
<mustSupport value="id"/>
<mustSupport value="extension"/>
<mustSupport value="identifier"/>
<mustSupport value="statusHistory"/>
<mustSupport value="classHistory"/>
<mustSupport value="type"/>
<mustSupport value="serviceType"/>
<mustSupport value="priority"/>
<mustSupport value="subject"/>
<mustSupport value="length"/>
<mustSupport value="reasonCode"/>
<mustSupport value="reasonReference"/>
<mustSupport value="account"/>
<mustSupport value="hospitalization"/>
<mustSupport value="partOf"/>
<codeFilter>
<path value="class"/>
<code>
<system value="http://terminology.hl7.org/CodeSystem/v3-ActCode"/>
<code value="OBSENC"/>
<display value="observation encounter"/>
</code>
</codeFilter>
</dataRequirement>
<dataRequirement>
<type value="Encounter"/>
<profile value="http://hl7.org/fhir/StructureDefinition/Encounter"/>
<mustSupport value="status"/>
<mustSupport value="period"/>
<mustSupport value="location"/>
<mustSupport value="diagnosis"/>
<mustSupport value="id"/>
<mustSupport value="extension"/>
<mustSupport value="identifier"/>
<mustSupport value="statusHistory"/>
<mustSupport value="class"/>
<mustSupport value="classHistory"/>
<mustSupport value="type"/>
<mustSupport value="serviceType"/>
<mustSupport value="priority"/>
<mustSupport value="subject"/>
<mustSupport value="length"/>
<mustSupport value="reasonCode"/>
<mustSupport value="reasonReference"/>
<mustSupport value="account"/>
<mustSupport value="hospitalization"/>
<mustSupport value="partOf"/>
</dataRequirement>
<dataRequirement>
<type value="Location"/>
<profile value="http://hl7.org/fhir/StructureDefinition/Location"/>
<mustSupport value="id"/>
<mustSupport value="extension"/>
<mustSupport value="status"/>
<mustSupport value="operationalStatus"/>
<mustSupport value="name"/>
<mustSupport value="alias"/>
<mustSupport value="description"/>
<mustSupport value="mode"/>
<mustSupport value="type"/>
<mustSupport value="telecom"/>
<mustSupport value="address"/>
<mustSupport value="physicalType"/>
<mustSupport value="position"/>
<mustSupport value="managingOrganization"/>
<mustSupport value="partOf"/>
<mustSupport value="hoursOfOperation"/>
<mustSupport value="availabilityExceptions"/>
<mustSupport value="endpoint"/>
</dataRequirement>
<dataRequirement>
<type value="Condition"/>
<profile value="http://hl7.org/fhir/StructureDefinition/Condition"/>
<mustSupport value="id"/>
<mustSupport value="extension"/>
<mustSupport value="clinicalStatus"/>
<mustSupport value="verificationStatus"/>
<mustSupport value="category"/>
<mustSupport value="severity"/>
<mustSupport value="code"/>
<mustSupport value="bodySite"/>
<mustSupport value="subject"/>
<mustSupport value="encounter"/>
<mustSupport value="onset"/>
<mustSupport value="abatement"/>
<mustSupport value="recordedDate"/>
<mustSupport value="stage"/>
<mustSupport value="evidence"/>
<mustSupport value="note"/>
<mustSupport value="encounter.id"/>
</dataRequirement>
<dataRequirement>
<type value="DiagnosticReport"/>
<profile
value="http://hl7.org/fhir/StructureDefinition/DiagnosticReport"/>
<mustSupport value="id"/>
<mustSupport value="extension"/>
<mustSupport value="basedOn"/>
<mustSupport value="status"/>
<mustSupport value="category"/>
<mustSupport value="code"/>
<mustSupport value="subject"/>
<mustSupport value="encounter"/>
<mustSupport value="effective"/>
<mustSupport value="issued"/>
<mustSupport value="specimen"/>
<mustSupport value="result"/>
<mustSupport value="conclusion"/>
<mustSupport value="conclusionCode"/>
<mustSupport value="performer"/>
<mustSupport value="resultsInterpreter"/>
</dataRequirement>
<dataRequirement>
<type value="Observation"/>
<profile value="http://hl7.org/fhir/StructureDefinition/Observation"/>
<mustSupport value="id"/>
<mustSupport value="extension"/>
<mustSupport value="partOf"/>
<mustSupport value="status"/>
<mustSupport value="category"/>
<mustSupport value="code"/>
<mustSupport value="subject"/>
<mustSupport value="encounter"/>
<mustSupport value="effective"/>
<mustSupport value="issued"/>
<mustSupport value="value"/>
<mustSupport value="dataAbsentReason"/>
<mustSupport value="interpretation"/>
<mustSupport value="bodySite"/>
<mustSupport value="method"/>
<mustSupport value="specimen"/>
<mustSupport value="referenceRange"/>
<mustSupport value="hasMember"/>
<mustSupport value="derivedFrom"/>
<mustSupport value="component"/>
<mustSupport value="focus"/>
<mustSupport value="performer"/>
<mustSupport value="note"/>
<mustSupport value="device"/>
</dataRequirement>
<dataRequirement>
<type value="Device"/>
<profile value="http://hl7.org/fhir/StructureDefinition/Device"/>
<mustSupport value="id"/>
<mustSupport value="extension"/>
<mustSupport value="status"/>
<mustSupport value="expirationDate"/>
<mustSupport value="lotNumber"/>
<mustSupport value="serialNumber"/>
<mustSupport value="modelNumber"/>
<mustSupport value="partNumber"/>
<mustSupport value="type"/>
<mustSupport value="patient"/>
<mustSupport value="parent"/>
</dataRequirement>
<dataRequirement>
<type value="MedicationAdministration"/>
<profile
value="http://hl7.org/fhir/StructureDefinition/MedicationAdministration"/>
<mustSupport value="effective"/>
<mustSupport value="id"/>
<mustSupport value="extension"/>
<mustSupport value="instantiates"/>
<mustSupport value="partOf"/>
<mustSupport value="status"/>
<mustSupport value="statusReason"/>
<mustSupport value="category"/>
<mustSupport value="medication"/>
<mustSupport value="subject"/>
<mustSupport value="context"/>
<mustSupport value="supportingInformation"/>
<mustSupport value="performer"/>
<mustSupport value="reasonCode"/>
<mustSupport value="reasonReference"/>
<mustSupport value="request"/>
<mustSupport value="device"/>
<mustSupport value="note"/>
<mustSupport value="dosage"/>
<mustSupport value="eventHistory"/>
</dataRequirement>
<dataRequirement>
<type value="MedicationRequest"/>
<profile
value="http://hl7.org/fhir/StructureDefinition/MedicationRequest"/>
<mustSupport value="authoredOn"/>
<mustSupport value="id"/>
<mustSupport value="extension"/>
<mustSupport value="status"/>
<mustSupport value="statusReason"/>
<mustSupport value="intent"/>
<mustSupport value="category"/>
<mustSupport value="priority"/>
<mustSupport value="doNotPerform"/>
<mustSupport value="reported"/>
<mustSupport value="medication"/>
<mustSupport value="subject"/>
<mustSupport value="encounter"/>
<mustSupport value="requester"/>
<mustSupport value="recorder"/>
<mustSupport value="reasonCode"/>
<mustSupport value="reasonReference"/>
<mustSupport value="instantiatesCanonical"/>
<mustSupport value="instantiatesUri"/>
<mustSupport value="courseOfTherapyType"/>
<mustSupport value="dosageInstruction"/>
</dataRequirement>
<dataRequirement>
<type value="Medication"/>
<profile value="http://hl7.org/fhir/StructureDefinition/Medication"/>
<mustSupport value="id"/>
<mustSupport value="extension"/>
<mustSupport value="code"/>
<mustSupport value="status"/>
<mustSupport value="manufacturer"/>
<mustSupport value="form"/>
<mustSupport value="amount"/>
<mustSupport value="ingredient"/>
<mustSupport value="batch"/>
</dataRequirement>
<dataRequirement>
<type value="Coverage"/>
<profile value="http://hl7.org/fhir/StructureDefinition/Coverage"/>
<mustSupport value="period"/>
<mustSupport value="id"/>
<mustSupport value="extension"/>
<mustSupport value="status"/>
<mustSupport value="type"/>
<mustSupport value="policyHolder"/>
<mustSupport value="subscriber"/>
<mustSupport value="subscriberId"/>
<mustSupport value="beneficiary"/>
<mustSupport value="dependent"/>
<mustSupport value="relationship"/>
<mustSupport value="payor"/>
<mustSupport value="class"/>
<mustSupport value="order"/>
<mustSupport value="network"/>
<mustSupport value="subrogation"/>
<mustSupport value="contract"/>
</dataRequirement>
<dataRequirement>
<type value="Procedure"/>
<profile value="http://hl7.org/fhir/StructureDefinition/Procedure"/>
<mustSupport value="performed"/>
<mustSupport value="id"/>
<mustSupport value="extension"/>
<mustSupport value="basedOn"/>
<mustSupport value="partOf"/>
<mustSupport value="status"/>
<mustSupport value="category"/>
<mustSupport value="code"/>
<mustSupport value="subject"/>
<mustSupport value="encounter"/>
<mustSupport value="location"/>
<mustSupport value="reasonCode"/>
<mustSupport value="reasonReference"/>
<mustSupport value="bodySite"/>
</dataRequirement>
<dataRequirement>
<type value="Specimen"/>
<profile value="http://hl7.org/fhir/StructureDefinition/Specimen"/>
<mustSupport value="collection"/>
<mustSupport value="collection.collected"/>
<mustSupport value="id"/>
<mustSupport value="extension"/>
<mustSupport value="identifier"/>
<mustSupport value="accessionIdentifier"/>
<mustSupport value="status"/>
<mustSupport value="type"/>
<mustSupport value="subject"/>
<mustSupport value="receivedTime"/>
<mustSupport value="parent"/>
<mustSupport value="request"/>
<mustSupport value="processing"/>
<mustSupport value="container"/>
<mustSupport value="condition"/>
<mustSupport value="note"/>
</dataRequirement>
<dataRequirement>
<type value="ServiceRequest"/>
<profile value="http://hl7.org/fhir/StructureDefinition/ServiceRequest"/>
<mustSupport value="authoredOn"/>
<mustSupport value="id"/>
<mustSupport value="extension"/>
<mustSupport value="basedOn"/>
<mustSupport value="status"/>
<mustSupport value="intent"/>
<mustSupport value="category"/>
<mustSupport value="priority"/>
<mustSupport value="doNotPerform"/>
<mustSupport value="code"/>
<mustSupport value="quantity"/>
<mustSupport value="subject"/>
<mustSupport value="encounter"/>
<mustSupport value="occurrence"/>
<mustSupport value="asNeeded"/>
<mustSupport value="requester"/>
<mustSupport value="specimen"/>
</dataRequirement>
<content>
<contentType value="text/cql"/>
<data
value="bGlicmFyeSBOSFNOQWN1dGVDYXJlSG9zcGl0YWxNb250aGx5SW5pdGlhbFBvcHVsYXRpb24gdmVyc2lvbiAnMS4wLjAtZGV2JwoKdXNpbmcgRkhJUiB2ZXJzaW9uICc0LjAuMScKCmluY2x1ZGUgRkhJUkhlbHBlcnMgdmVyc2lvbiAnNC4wLjInIGNhbGxlZCBGSElSSGVscGVycwppbmNsd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yI6CiAgW0VuY291bnRlcl0KCmRlZmluZSAiQ29uZGl0aW9ucyI6CiAgW0NvbmRpdGlvbl0KCmRlZmluZSAiRGlhZ25vc3RpY1JlcG9ydHMiOgogIFtEaWFnbm9zdGljUmVwb3J0XQoKZGVmaW5lICJPYnNlcnZhdGlvbnMiOgogIFtPYnNlcnZhdGlvbl0KCmRlZmluZSAiR2V0IExvY2F0aW9ucyBmcm9tIElQIEVuY291bnRlcnMgaW4gTWVhc3VyZW1lbnQgUGVyaW9kIjoKICBmbGF0dGVuKCJJbml0aWFsIFBvcHVsYXRpb24iIElQCiAgbGV0IGxvY2F0aW9uRWxlbWVudHM6IElQLmxvY2F0aW9uCiAgcmV0dXJuCiAgICBsb2NhdGlvbkVsZW1lbnRzIExFCiAgICBsZXQgbG9jYXRpb25SZWZlcmVuY2U6IExFLmxvY2F0aW9uCiAgICByZXR1cm4gTkhTTkhlbHBlcnMuR2V0TG9jYXRpb24obG9jYXRpb25SZWZlcmVuY2UpKQoKLy89PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09Ci8vU3VwcGxlbWVudGFsIERhdGEgRWxlbWVudAovL1doZW4gRkhJUi5jYW5vbmljYWwgdmFsdWUgaXMgcHJlc2VudCwgVVMgQ29yZSAzLjEuMSBwcm9maWxlcyBhcmUgdXNlZAovL1doZW4gRkhJUi5jYW5vbmljYWwgdmFsdWUgaXMgbm90IHByZXNlbnQsIEZISVIgQmFzZSBwcm9maWxlcyBhcmUgdXNlZAovLz09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0KZGVmaW5lICJTREUgQ29uZGl0aW9uIjoKICAiQ29uZGl0aW9ucyIgQ29uZGl0aW9ucyAKICAgIHdoZXJlIGV4aXN0cygKICAgICJJbml0aWFsIFBvcHVsYXRpb24iIElQCi8vQ2hlY2sgZm9yI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EZISVIuU3BlY2ltZW4uQ29sbGVjdGlvbik6CiAgY29sbGVjdGlvbiBjCiAgcmV0dXJuIEZISVIuU3BlY2ltZW4uQ29sbGVjdGlvbnsKICAgIGNvbGxlY3RvcjogYy5jb2xsZWN0b3IsCiAgICBjb2xsZWN0ZWQ6IGMuY29sbGVjdGVkLAogICAgcXVhbnRpdHk6IGMucXVhbnRpdHksCiAgICBib2R5U2l0ZTogYy5ib2R5U2l0ZQogIH0KCiAgZGVmaW5lIGZ1bmN0aW9uIFNwZWNpbWVuUmVzb3VyY2Uoc3BlY2ltZW4gU3BlY2ltZW4sIHByb2ZpbGVVUkxzIExpc3Q8RkhJUi5jYW5vbmljYWw+KToKICBzcGVjaW1lbiBzCiAgcmV0dXJuIFNwZWNpbWVuewogICAgaWQ6IEZISVIuaWQge3ZhbHVlOiAnTENSLScgKyBzLmlkfSwKICAgIG1ldGE6IFNoYXJlZFJlc291cmNlLk1ldGFFbGVtZW50KHMsIHByb2ZpbGVVUkxzKSwKICAgIGV4dGVuc2lvbjogcy5leHRlbnNpb24sCiAgICBpZGVudGlmaWVyOiBzLmlkZW50aWZpZXIsCiAgICBhY2Nlc3Npb25JZGVudGlmaWVyOiBzLmFjY2Vzc2lvbklkZW50aWZpZXIsCiAgICBzdGF0dXM6IHMuc3RhdHVzLAogICAgdHlwZTogcy50eXBlLAogICAgc3ViamVjdDogcy5zdWJqZWN0LAogICAgcGFyZW50OiBzLnBhcmVudCwKICAgIHJlcXVlc3Q6IHMucmVxdWVzdCwKICAgIGNvbGxlY3Rpb246IFNwZWNpbWVuQ29sbGVjdGlvbihzLmNvbGxlY3Rpb24pLAogICAgbm90ZTogcy5ub3RlCiAgfQ=="/>
<url
value="http://www.cdc.gov/nhsn/fhirportal/dqm/ig/Library-NHSNAcuteCareHospitalMonthlyInitialPopulation.cql"/>
</content>
</Library>