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 - Downloaded Version 1.0.0 See the Directory of published versions

## Measure: NHSN dQM Acute Care Hospital Monthly Initial Population Measure

Official URL: http://www.cdc.gov/nhsn/fhirportal/dqm/ig/Measure/NHSNAcuteCareHospitalMonthlyInitialPopulation | Version: 1.0.0
Standards status: Trial-use | Maturity Level: 1 | Computable Name: NHSNAcuteCareHospitalMonthlyInitialPopulation
Other Identifiers: https://nhsnlink.org#NHSNAcuteCareHospitalMonthlyInitialPopulation
Copyright/Legal: Limited proprietary coding is contained in the Measure specifications for user convenience. Users of proprietary code sets should obtain all necessary licenses from the owners of the code sets.

The Acute Care Hospital Monthly Initial Population includes all encounters for patients of any age in an ED, observation, or inpatient location or all encounters for patients of any age with an ED, observation, inpatient, or short stay status during the measurement period.

Knowledge Artifact Metadata
Name (machine-readable) | NHSNAcuteCareHospitalMonthlyInitialPopulation
Title (human-readable) | NHSN dQM Acute Care Hospital Monthly Initial Population
Status | Draft
Experimental | false
Description | The Acute Care Hospital Monthly Initial Population includes all encounters for patients of any age in an ED, observation, or inpatient location or all encounters for patients of any age with an ED, observation, inpatient, or short stay status during the measurement period.
Measure Steward | CDC National Healthcare Safety Network (NHSN)
Steward Contact Details | CDC National Healthcare Safety Network (NHSN): http://www.cdc.gov/nhsn,nhsn@cdc.gov
Copyright | Limited proprietary coding is contained in the Measure specifications for user convenience. Users of proprietary code sets should obtain all necessary licenses from the owners of the code sets.
Documentation | Description: https://www.cdc.gov/nhsn/index.html [placeholder for link to protocol on CDC website] Content URL: https://www.cdc.gov/nhsn/index.html Document: null @ https://www.cdc.gov/nhsn/index.html
Measure Metadata
Version Number | 1.0.0
Measure Scoring | Cohort
Measure Type | Outcome
Rationale | The NHSN Acute Care Hospital Monthly dQM allows for facilities to report line level patient data electronically to NHSN for the following modules that are reported monthly: Glycemic Control, Hypoglycemia; Healthcare facility-onset, antibiotic-Treated Clostridioides difficile (C. difficile) Infection (HT-CDI); Hospital-Onset Bacteremia & Fungemia (HOB); Venous Thromboembolism (VTE); Late Onset Sepsis / Meningitis. *Please see Acute Care / Critical Access Hospitals (ACH) | NHSN | CDC for the individual measure protocols.
Population Basis | Encounter
Measure Population Criteria
Initial Population | ID: initial-population Description: All encounters for patients of any age in an ED, observation, or inpatient location or all encounters for patients of any age with an ED, observation, inpatient, or short stay status during the measurement period. Logic Definition: Initial Population
Supplemental Data Elements
Supplemental Data Element | ID: sde-condition Usage Code: Supplemental Data Description: SDE Condition Logic Definition: SDE Condition
Supplemental Data Element | ID: sde-device Usage Code: Supplemental Data Description: SDE Device Logic Definition: SDE Device
Supplemental Data Element | ID: sde-diagnosticreport-lab Usage Code: Supplemental Data Description: SDE DiagnosticReport Lab Logic Definition: SDE DiagnosticReport Lab
Supplemental Data Element | ID: sde-diagnosticreport-note Usage Code: Supplemental Data Description: SDE DiagnosticReport Note Logic Definition: SDE DiagnosticReport Note
Supplemental Data Element | ID: sde-diagnosticreport-others Usage Code: Supplemental Data Description: SDE DiagnosticReport Others Logic Definition: SDE DiagnosticReport Others
Supplemental Data Element | ID: sde-encounter Usage Code: Supplemental Data Description: SDE Encounter Logic Definition: SDE Encounter
Supplemental Data Element | ID: sde-location Usage Code: Supplemental Data Description: SDE Location Logic Definition: SDE Location
Supplemental Data Element | ID: sde-medication-administration Usage Code: Supplemental Data Description: SDE Medication Administration Logic Definition: SDE Medication Administration
Supplemental Data Element | ID: sde-medication-request Usage Code: Supplemental Data Description: SDE Medication Request Logic Definition: SDE Medication Request
Supplemental Data Element | ID: sde-medication Usage Code: Supplemental Data Description: SDE Medication Logic Definition: SDE Medication
Supplemental Data Element | ID: sde-observation-lab-category Usage Code: Supplemental Data Description: SDE Observation Lab Category Logic Definition: SDE Observation Lab Category
Supplemental Data Element | ID: sde-observation-vital-signs-category Usage Code: Supplemental Data Description: SDE Observation Vital Signs Category Logic Definition: SDE Observation Vital Signs Category
Supplemental Data Element | ID: sde-observation-category Usage Code: Supplemental Data Description: SDE Observation Category Logic Definition: SDE Observation Category
Supplemental Data Element | ID: sde-coverage Usage Code: Supplemental Data Description: SDE Coverage Logic Definition: SDE Coverage
Supplemental Data Element | ID: sde-procedure Usage Code: Supplemental Data Description: SDE Procedure Logic Definition: SDE Procedure
Supplemental Data Element | ID: sde-specimen Usage Code: Supplemental Data Description: SDE Specimen Logic Definition: SDE Specimen
Supplemental Data Element | ID: sde-service-request Usage Code: Supplemental Data Description: SDE Service Request Logic Definition: SDE Service Request
Supplemental Data Element | ID: sde-minimal-patient Usage Code: Supplemental Data Description: SDE Minimal Patient Logic Definition: SDE Minimal Patient
Supplemental Data Element | ID: sde-ip-encounters Usage Code: Supplemental Data Description: SDE IP Encounters Logic Definition: SDE IP Encounters
Measure Logic
Primary Library | NHSNAcuteCareHospitalMonthlyInitialPopulation
Dependency | Description: Library FHIRHelpers Resource: `http://www.cdc.gov/nhsn/fhirportal/dqm/ig/Library/FHIRHelpers|4.0.2` Canonical URL: `http://www.cdc.gov/nhsn/fhirportal/dqm/ig/Library/FHIRHelpers|4.0.2`
Dependency | Description: Library NHSNHelpers Resource: `http://www.cdc.gov/nhsn/fhirportal/dqm/ig/Library/NHSNHelpers|0.0.002` Canonical URL: `http://www.cdc.gov/nhsn/fhirportal/dqm/ig/Library/NHSNHelpers|0.0.002`
Dependency | Description: Library SharedResource Resource: `http://www.cdc.gov/nhsn/fhirportal/dqm/ig/Library/SharedResourceCreation|0.1.010` Canonical URL: `http://www.cdc.gov/nhsn/fhirportal/dqm/ig/Library/SharedResourceCreation|0.1.010`
Dependency | Description: Code system ActCode Resource: ActCodeversion: null9.0.0) Canonical URL: `http://terminology.hl7.org/CodeSystem/v3-ActCode|9.0.0`
Dependency | Description: Code system Observation Category Resource: Observation Category Codesversion: null1.0.1) Canonical URL: `http://terminology.hl7.org/CodeSystem/observation-category|1.0.1`
Dependency | Description: Code system LOINC Resource: Logical Observation Identifiers, Names and Codes (LOINC) Canonical URL: `http://loinc.org`
Dependency | Description: Code system V2-0074 Resource: diagnosticServiceSectionIdversion: null2.5.0) Canonical URL: `http://terminology.hl7.org/CodeSystem/v2-0074|2.5.0`
Dependency | Description: Code system Condition Category Resource: Condition Category Codesversion: null1.0.1) Canonical URL: `http://terminology.hl7.org/CodeSystem/condition-category|1.0.1`
Dependency | Description: Code system Condition Clinical Status Resource: Condition Clinical Status Codesversion: null3.0.0) Canonical URL: `http://terminology.hl7.org/CodeSystem/condition-clinical|3.0.0`
Dependency | Description: Code system US Core Condition Category Resource: US Core Condition Category Extension Codes Canonical URL: `http://hl7.org/fhir/us/core/CodeSystem/condition-category`
Dependency | Description: Value set Encounter Inpatient Resource: Encounter Inpatient Canonical URL: `http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.666.5.307`
Dependency | Description: Value set Emergency Department Visit Resource: Emergency Department Visit Canonical URL: `http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.292`
Dependency | Description: Value set Observation Services Resource: Observation Services Canonical URL: `http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1111.143`
Dependency | Description: Value set NHSN Inpatient Encounter Class Codes Resource: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1046.274 Canonical URL: `http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1046.274`
Dependency | Description: Value set Inpatient, Emergency, and Observation Locations Resource: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1046.265 Canonical URL: `http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1046.265`
Direct Reference Code | Display: emergency Code: EMER System: `http://terminology.hl7.org/CodeSystem/v3-ActCode`
Direct Reference Code | Display: observation encounter Code: OBSENC System: `http://terminology.hl7.org/CodeSystem/v3-ActCode`
Direct Reference Code | Display: Laboratory Code: laboratory System: `http://terminology.hl7.org/CodeSystem/observation-category`
Direct Reference Code | Display: Vital Signs Code: vital-signs System: `http://terminology.hl7.org/CodeSystem/observation-category`
Direct Reference Code | Display: Radiology Code: LP29684-5 System: `http://loinc.org`
Direct Reference Code | Display: Pathology Code: LP7839-6 System: `http://loinc.org`
Direct Reference Code | Display: Cardiology Code: LP29708-2 System: `http://loinc.org`
Direct Reference Code | Display: Laboratory Code: LAB System: `http://terminology.hl7.org/CodeSystem/v2-0074`
Direct Reference Code | Display: Social History Code: social-history System: `http://terminology.hl7.org/CodeSystem/observation-category`
Direct Reference Code | Display: Survey Code: survey System: `http://terminology.hl7.org/CodeSystem/observation-category`
Direct Reference Code | Display: Imaging Code: imaging System: `http://terminology.hl7.org/CodeSystem/observation-category`
Direct Reference Code | Display: Procedure Code: procedure System: `http://terminology.hl7.org/CodeSystem/observation-category`
Direct Reference Code | Display: Problem List Item Code: problem-list-item System: `http://terminology.hl7.org/CodeSystem/condition-category`
Direct Reference Code | Display: active Code: active System: `http://terminology.hl7.org/CodeSystem/condition-clinical`
Direct Reference Code | Display: Encounter Diagnosis Code: encounter-diagnosis System: `http://terminology.hl7.org/CodeSystem/condition-category`
Direct Reference Code | Display: Health Concern Code: health-concern System: `http://hl7.org/fhir/us/core/CodeSystem/condition-category`
Parameter | Name: Measurement Period Use: In Min Cardinality: 0 Max Cardinality: 1 Type: Period
Parameter | Name: SDE Encounter Use: Out Min Cardinality: 0 Max Cardinality: * Type: Encounter
Parameter | Name: SDE Medication Request Use: Out Min Cardinality: 0 Max Cardinality: * Type: MedicationRequest
Parameter | Name: SDE Coverage Use: Out Min Cardinality: 0 Max Cardinality: * Type: Coverage
Parameter | Name: SDE Procedure Use: Out Min Cardinality: 0 Max Cardinality: * Type: Procedure
Parameter | Name: SDE IP Encounters Use: Out Min Cardinality: 0 Max Cardinality: * Type: Encounter
Parameter | Name: SDE Device Use: Out Min Cardinality: 0 Max Cardinality: * Type: Device
Parameter | Name: SDE Observation Lab Category Use: Out Min Cardinality: 0 Max Cardinality: * Type: Observation
Parameter | Name: SDE Observation Vital Signs Category Use: Out Min Cardinality: 0 Max Cardinality: * Type: Observation
Parameter | Name: SDE DiagnosticReport Others Use: Out Min Cardinality: 0 Max Cardinality: * Type: DiagnosticReport
Parameter | Name: SDE Medication Administration Use: Out Min Cardinality: 0 Max Cardinality: * Type: MedicationAdministration
Parameter | Name: SDE Observation Category Use: Out Min Cardinality: 0 Max Cardinality: * Type: Observation
Parameter | Name: SDE Condition Use: Out Min Cardinality: 0 Max Cardinality: * Type: Condition
Parameter | Name: Initial Population Use: Out Min Cardinality: 0 Max Cardinality: * Type: Encounter
Parameter | Name: SDE DiagnosticReport Lab Use: Out Min Cardinality: 0 Max Cardinality: * Type: DiagnosticReport
Parameter | Name: SDE Location Use: Out Min Cardinality: 0 Max Cardinality: * Type: Location
Parameter | Name: SDE Service Request Use: Out Min Cardinality: 0 Max Cardinality: * Type: ServiceRequest
Parameter | Name: SDE DiagnosticReport Note Use: Out Min Cardinality: 0 Max Cardinality: * Type: DiagnosticReport
Parameter | Name: SDE Minimal Patient Use: Out Min Cardinality: 0 Max Cardinality: 1 Type: Patient
Parameter | Name: SDE Medication Use: Out Min Cardinality: 0 Max Cardinality: * Type: Medication
Parameter | Name: SDE Specimen Use: Out Min Cardinality: 0 Max Cardinality: * Type: Specimen
Measure Logic Data Requirements
Data Requirement | Type: Encounter Profile(s): Encounter Must Support Elements: type, status, period, id, extension, identifier, statusHistory, class, classHistory, serviceType, priority, subject, length, reasonCode, reasonReference, diagnosis, account, hospitalization, location, partOf Code Filter(s): Path: type ValueSet: Encounter Inpatient
Data Requirement | Type: Encounter Profile(s): Encounter Must Support Elements: type, status, period, id, extension, identifier, statusHistory, class, classHistory, serviceType, priority, subject, length, reasonCode, reasonReference, diagnosis, account, hospitalization, location, partOf Code Filter(s): Path: type ValueSet: Emergency Department Visit
Data Requirement | Type: Encounter Profile(s): Encounter Must Support Elements: type, status, period, id, extension, identifier, statusHistory, class, classHistory, serviceType, priority, subject, length, reasonCode, reasonReference, diagnosis, account, hospitalization, location, partOf Code Filter(s): Path: type ValueSet: Observation Services
Data Requirement | Type: Encounter Profile(s): Encounter Must Support Elements: class, status, period, id, extension, identifier, statusHistory, classHistory, type, serviceType, priority, subject, length, reasonCode, reasonReference, diagnosis, account, hospitalization, location, partOf Code Filter(s): Path: class ValueSet: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1046.274
Data Requirement | Type: Encounter Profile(s): Encounter Must Support Elements: class, status, period, id, extension, identifier, statusHistory, classHistory, type, serviceType, priority, subject, length, reasonCode, reasonReference, diagnosis, account, hospitalization, location, partOf Code Filter(s): Path: class Code:
Data Requirement | Type: Encounter Profile(s): Encounter Must Support Elements: class, status, period, id, extension, identifier, statusHistory, classHistory, type, serviceType, priority, subject, length, reasonCode, reasonReference, diagnosis, account, hospitalization, location, partOf Code Filter(s): Path: class Code:
Data Requirement | Type: Encounter Profile(s): Encounter Must Support Elements: status, period, id, extension, identifier, statusHistory, class, classHistory, type, serviceType, priority, subject, length, reasonCode, reasonReference, diagnosis, account, hospitalization, location, partOf
Data Requirement | Type: Location Profile(s): Location Must Support Elements: id, extension, status, operationalStatus, name, alias, description, mode, type, telecom, address, physicalType, position, managingOrganization, partOf, hoursOfOperation, availabilityExceptions, endpoint
Data Requirement | Type: MedicationRequest Profile(s): MedicationRequest Must Support Elements: authoredOn, id, extension, status, statusReason, intent, category, priority, doNotPerform, reported, medication, subject, encounter, requester, recorder, reasonCode, reasonReference, instantiatesCanonical, instantiatesUri, courseOfTherapyType, dosageInstruction
Data Requirement | Type: Coverage Profile(s): Coverage Must Support Elements: period, id, extension, status, type, policyHolder, subscriber, subscriberId, beneficiary, dependent, relationship, payor, class, order, network, subrogation, contract
Data Requirement | Type: Procedure Profile(s): Procedure Must Support Elements: 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
Data Requirement | Type: Device Profile(s): Device Must Support Elements: 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
Data Requirement | Type: Observation Profile(s): Observation Must Support Elements: 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
Data Requirement | Type: DiagnosticReport Profile(s): DiagnosticReport Must Support Elements: category, effective, id, extension, basedOn, status, code, subject, encounter, issued, performer, resultsInterpreter, specimen, result, conclusion, conclusionCode
Data Requirement | Type: MedicationAdministration Profile(s): MedicationAdministration Must Support Elements: effective, id, extension, instantiates, partOf, status, statusReason, category, medication, subject, context, supportingInformation, performer, reasonCode, reasonReference, request, device, note, dosage, eventHistory
Data Requirement | Type: Condition Profile(s): Condition Must Support Elements: id, extension, clinicalStatus, verificationStatus, category, severity, code, bodySite, subject, encounter, onset, abatement, recordedDate, stage, evidence, note, encounter.id
Data Requirement | Type: ServiceRequest Profile(s): ServiceRequest Must Support Elements: 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
Data Requirement | Type: Patient Profile(s): Patient Must Support Elements: id, identifier, active, name, telecom, gender, birthDate, deceased, address, maritalStatus, multipleBirth, photo, contact, communication, generalPractitioner, managingOrganization, link
Data Requirement | Type: Medication Profile(s): Medication Must Support Elements: id, extension, code, status, manufacturer, form, amount, ingredient, batch
Data Requirement | Type: Specimen Profile(s): Specimen Must Support Elements: collection, collection.collected, id, extension, identifier, accessionIdentifier, status, type, subject, receivedTime, parent, request, processing, container, condition, note
Measure Logic Definitions
Logic Definition | Library Name: NHSNAcuteCareHospitalMonthlyInitialPopulation
    define "Encounters":   [Encounter]
Logic Definition | Library Name: NHSNAcuteCareHospitalMonthlyInitialPopulation
    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"
Logic Definition | Library Name: NHSNAcuteCareHospitalMonthlyInitialPopulation
    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"
Logic Definition | Library Name: NHSNAcuteCareHospitalMonthlyInitialPopulation
    define "Initial Population":   "Qualifying Encounters During Measurement Period"   union "Encounters with Patient Hospital Locations"
Logic Definition | Library Name: NHSNAcuteCareHospitalMonthlyInitialPopulation
    //#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'}})
Logic Definition | Library Name: NHSNAcuteCareHospitalMonthlyInitialPopulation
    define "SDE Medication Request":   [MedicationRequest] MedicationRequests    where exists(     "Initial Population" IP     where MedicationRequests.authoredOn during IP.period)   return SharedResource.MedicationRequestResource(MedicationRequests,   {FHIR.canonical{value: 'http://www.cdc.gov/nhsn/fhirportal/dqm/ig/StructureDefinition/ach-monthly-medicationrequest'}})
Logic Definition | Library Name: NHSNAcuteCareHospitalMonthlyInitialPopulation
    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'}})
Logic Definition | Library Name: NHSNAcuteCareHospitalMonthlyInitialPopulation
    define "SDE Procedure":   [Procedure] Procedures    where exists(     "Initial Population" IP     where NHSNHelpers."Normalize Interval"(Procedures.performed) overlaps IP.period)   return SharedResource.ProcedureResource(Procedures,   {FHIR.canonical{value: 'http://www.cdc.gov/nhsn/fhirportal/dqm/ig/StructureDefinition/ach-monthly-procedure'}})
Logic Definition | Library Name: NHSNAcuteCareHospitalMonthlyInitialPopulation
    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'}})
Logic Definition | Library Name: NHSNAcuteCareHospitalMonthlyInitialPopulation
    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'}})
Logic Definition | Library Name: NHSNAcuteCareHospitalMonthlyInitialPopulation
    define "Observations":   [Observation]
Logic Definition | Library Name: NHSNAcuteCareHospitalMonthlyInitialPopulation
    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 SharedResource.ObservationLabResource(Observations,   {FHIR.canonical{value: 'http://www.cdc.gov/nhsn/fhirportal/dqm/ig/StructureDefinition/ach-monthly-observation-lab'}})
Logic Definition | Library Name: NHSNAcuteCareHospitalMonthlyInitialPopulation
    //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'}})
Logic Definition | Library Name: NHSNAcuteCareHospitalMonthlyInitialPopulation
    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'}})
Logic Definition | Library Name: NHSNAcuteCareHospitalMonthlyInitialPopulation
    define "SDE Medication Administration":   [MedicationAdministration] MedicationAdministrations    where exists(     "Initial Population" IP     where NHSNHelpers."Normalize Interval"(MedicationAdministrations.effective) overlaps IP.period)   return SharedResource.MedicationAdministrationResource(MedicationAdministrations,   {FHIR.canonical{value: 'http://www.cdc.gov/nhsn/fhirportal/dqm/ig/StructureDefinition/ach-monthly-medicationadministration'}})
Logic Definition | Library Name: NHSNAcuteCareHospitalMonthlyInitialPopulation
    //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'}})
Logic Definition | Library Name: NHSNAcuteCareHospitalMonthlyInitialPopulation
    define "Conditions":   [Condition]
Logic Definition | Library Name: NHSNAcuteCareHospitalMonthlyInitialPopulation
    //============================================================================ //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 (       Conditions.recordedDate before end of IP.period       and exists(Conditions.category categories         where categories ~ "problem-list-item")       and Conditions.clinicalStatus ~ "active"     )     //Check for Encounter Diagnosis Conditions that reference an IP encounter     or (       (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"           or categories ~ "health-concern")     )   )   return ConditionResource(Conditions,   {FHIR.canonical{value: 'http://www.cdc.gov/nhsn/fhirportal/dqm/ig/StructureDefinition/ach-monthly-condition'}},   {"problem-list-item", "encounter-diagnosis", "health-concern"})
Logic Definition | Library Name: NHSNAcuteCareHospitalMonthlyInitialPopulation
    define "DiagnosticReports":   [DiagnosticReport]
Logic Definition | Library Name: NHSNAcuteCareHospitalMonthlyInitialPopulation
    //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 SharedResource.DiagnosticReportLabResource(DiagnosticReports,   {FHIR.canonical{value: 'http://www.cdc.gov/nhsn/fhirportal/dqm/ig/StructureDefinition/ach-monthly-diagnosticreport-lab'}})
Logic Definition | Library Name: NHSNAcuteCareHospitalMonthlyInitialPopulation
    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))
Logic Definition | Library Name: NHSNAcuteCareHospitalMonthlyInitialPopulation
    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'}})
Logic Definition | Library Name: NHSNAcuteCareHospitalMonthlyInitialPopulation
    define "SDE Service Request":   [ServiceRequest] ServiceRequests   where exists("Initial Population" IP     where ServiceRequests.authoredOn during IP.period)   return SharedResource.ServiceRequestResource(ServiceRequests,   {FHIR.canonical{value: 'http://www.cdc.gov/nhsn/fhirportal/dqm/ig/StructureDefinition/ach-monthly-servicerequest'}})
Logic Definition | Library Name: NHSNAcuteCareHospitalMonthlyInitialPopulation
    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'}})
Logic Definition | Library Name: NHSNAcuteCareHospitalMonthlyInitialPopulation
    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'}})
Logic Definition | Library Name: NHSNAcuteCareHospitalMonthlyInitialPopulation
    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'}})
Logic Definition | Library Name: NHSNAcuteCareHospitalMonthlyInitialPopulation
    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'}})
Logic Definition | Library Name: NHSNAcuteCareHospitalMonthlyInitialPopulation
    // //Functions // define function "CheckIP"(encounter Encounter):   exists("Initial Population" IP   where encounter.id = IP.id)
Logic Definition | Library Name: FHIRHelpers
    define function ToString(value EncounterStatus): value.value
Logic Definition | Library Name: FHIRHelpers
    define function ToInterval(period FHIR.Period):     if period is null then         null      else          if period."start".value is null then             Interval(period."start".value, period."end".value]         else              if time from period."start".value is null and time from period."end".value is not null then                 Interval[                     DateTime(year from period."start".value, month from period."start".value, day from period."start".value,                         0, 0, 0, 0, timezoneoffset from period."end".value),                      period."end".value                 ]         else              if time from period."end".value is null and time from period."start".value is not null then                 Interval[                     period."start".value,                      DateTime(year from period."end".value, month from period."end".value, day from period."end".value,                         23, 59, 59, 999, timezoneoffset from period."start".value)                 ]         else Interval[period."start".value, period."end".value]
Logic Definition | Library Name: NHSNHelpers
    define function "GetLocation"(reference Reference ):   singleton from (  [Location] Locations   where Locations.id = GetId(reference.reference)   )
Logic Definition | Library Name: FHIRHelpers
    define function ToString(value string): value.value
Logic Definition | Library Name: NHSNHelpers
    define function "GetId"(uri String ):   Last(Split(uri, '/'))
Logic Definition | Library Name: FHIRHelpers
    define function ToConcept(concept FHIR.CodeableConcept):     if concept is null then         null     else         System.Concept {             codes: concept.coding C return ToCode(C),             display: concept.text.value         }
Logic Definition | Library Name: FHIRHelpers
    define function ToCode(coding FHIR.Coding):     if coding is null then         null     else         System.Code {           code: coding.code.value,           system: coding.system.value,           version: coding.version.value,           display: coding.display.value         }
Logic Definition | Library Name: SharedResourceCreation
    define function EncounterResource(encounter Encounter, profileURLs List<FHIR.canonical>):   encounter e   return Encounter{     id: FHIR.id{value: 'LCR-' + e.id},     meta: MetaElement(e, profileURLs),     extension: e.extension,     identifier: EncounterIdentifier(e.identifier),     status: e.status,     statusHistory: EncounterStatusHistory(e.statusHistory),     class: e.class,     classHistory: EncounterClassHistory(e.classHistory),     type: e.type,     serviceType: e.serviceType,     priority: e.priority,     subject: e.subject,     period: e.period,     length: e.length,     reasonCode: e.reasonCode,     reasonReference: e.reasonReference,     diagnosis: EncounterDiagnosis(e.diagnosis),     account: e.account,     hospitalization: EncounterHospitalization(e.hospitalization),     location: EncounterLocation(e.location),     partOf: e.partOf   }
Logic Definition | Library Name: SharedResourceCreation
    define function "MetaElement"(resource Resource, profileURLs List<FHIR.canonical>):   resource r   return FHIR.Meta{     extension: r.meta.extension,     versionId: r.meta.versionId,     lastUpdated: r.meta.lastUpdated,     profile: profileURLs,     security: r.meta.security,     tag: r.meta.tag   }
Logic Definition | Library Name: SharedResourceCreation
    define function EncounterIdentifier(identifier List<FHIR.Identifier>):   identifier i   return FHIR.Identifier{     use: i.use,     type: i.type,     system: i.system,     value: i.value,     period: i.period   }
Logic Definition | Library Name: SharedResourceCreation
    define function EncounterStatusHistory(statusHistory List<FHIR.Encounter.StatusHistory>):   statusHistory sH   return FHIR.Encounter.StatusHistory{     status: sH.status,     period: sH.period   }
Logic Definition | Library Name: SharedResourceCreation
    define function EncounterClassHistory(classHistory List<FHIR.Encounter.ClassHistory>):   classHistory cH   return FHIR.Encounter.ClassHistory{     class: cH.class,     period: cH.period   }
Logic Definition | Library Name: SharedResourceCreation
    /*No longer needed but saving for potential future use define function EncounterParticipant(participant List<FHIR.Encounter.Participant>):   participant p   return FHIR.Encounter.Participant{     type: p.type,     period: p.period,     individual: p.individual   }*/  define function EncounterDiagnosis(diagnosis List<FHIR.Encounter.Diagnosis>):   diagnosis d   return FHIR.Encounter.Diagnosis{     condition: d.condition,     use: d.use,     rank: d.rank   }
Logic Definition | Library Name: SharedResourceCreation
    define function EncounterHospitalization(hospitalization FHIR.Encounter.Hospitalization):   hospitalization h   return FHIR.Encounter.Hospitalization{     preAdmissionIdentifier: h.preAdmissionIdentifier,     origin: h.origin,     admitSource: h.admitSource,     reAdmission: h.reAdmission,     dietPreference: h.dietPreference,     specialCourtesy: h.specialCourtesy,     specialArrangement: h.specialArrangement,     destination: h.destination,     dischargeDisposition: h.dischargeDisposition   }
Logic Definition | Library Name: SharedResourceCreation
    define function EncounterLocation(location List<FHIR.Encounter.Location>):   location l   return FHIR.Encounter.Location{     location: l.location,     status: l.status,     physicalType: l.physicalType,     period: l.period   }
Logic Definition | Library Name: FHIRHelpers
    define function ToDateTime(value dateTime): value.value
Logic Definition | Library Name: SharedResourceCreation
    define function MedicationRequestResource(medicationRequest MedicationRequest, profileURLs List<FHIR.canonical>):   medicationRequest m   return MedicationRequest{     id: FHIR.id {value: 'LCR-' + m.id},     meta: MetaElement(medicationRequest, profileURLs),     extension: m.extension,     status: m.status,     statusReason: m.statusReason,     intent: m.intent,     category: m.category,     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: MedicationRequestDosageInstruction(m.dosageInstruction)   }
Logic Definition | Library Name: SharedResourceCreation
    define function MedicationRequestDosageInstruction(dosageInstruction List<FHIR.Dosage>):   dosageInstruction dI   return FHIR.Dosage{     text: dI.text,     patientInstruction: dI.patientInstruction,     timing: dI.timing,     asNeeded: dI.asNeeded,     site: dI.site,     route: dI.route,     method: dI.method,     doseAndRate: MedicationRequestDoseAndRate(dI.doseAndRate)   }
Logic Definition | Library Name: SharedResourceCreation
    define function MedicationRequestDoseAndRate(doseAndRate List<FHIR.Dosage.DoseAndRate>):   doseAndRate dR   return FHIR.Dosage.DoseAndRate{     type: dR.type,     dose: dR.dose,     rate: dR.rate   }
Logic Definition | Library Name: SharedResourceCreation
    define function CoverageResource(coverage Coverage, profileURLs List<FHIR.canonical>):   coverage c   return Coverage{     id: FHIR.id{value: 'LCR-' + c.id},     meta: MetaElement(c, profileURLs),     extension: c.extension,     status: c.status,     type: c.type,     policyHolder: c.policyHolder,     subscriber: c.subscriber,     subscriberId: c.subscriberId,     beneficiary: c.beneficiary,     dependent: c.dependent,     relationship: c.relationship,     period: c.period,     payor: c.payor,     class: CoverageClass(c.class),     order: c.order,     network: c.network,     subrogation: c.subrogation,     contract: c.contract   }
Logic Definition | Library Name: SharedResourceCreation
    define function CoverageClass(class List<FHIR.Coverage.Class>):   class c   return FHIR.Coverage.Class{     value: c.value,     name: c.name   }
Logic Definition | Library Name: SharedResourceCreation
    define function ProcedureResource(procedure Procedure, profileURLs List<FHIR.canonical>):   procedure p   return Procedure{     id: FHIR.id {value: 'LCR-' + p.id},     meta: MetaElement(p, profileURLs),     extension: p.extension,     instantiatesCanonical: p.instantiatesCanonical,     instantiatesUri: p.instantiatesUri,     basedOn: p.basedOn,     partOf: p.partOf,     status: p.status,     statusReason: p.statusReason,     category: p.category,     code: p.code,     subject: p.subject,     encounter: p.encounter,     performed: p.performed,     recorder: p.recorder,     asserter: p.asserter,     performer: ProcedurePerformer(p.performer),     location: p.location,     reasonCode: p.reasonCode,     reasonReference: p.reasonReference,     bodySite: p.bodySite,     outcome: p.outcome,     report: p.report,     complication: p.complication,     complicationDetail: p.complicationDetail,     followUp: p.followUp,     note: p.note,     focalDevice: ProcedureFocalDevice(p.focalDevice),     usedReference: p.usedReference,     usedCode: p.usedCode   }
Logic Definition | Library Name: SharedResourceCreation
    define function ProcedurePerformer(performer List<FHIR.Procedure.Performer>):   performer p   return FHIR.Procedure.Performer{     function: p.function,     actor: p.actor,     onBehalfOf: p.onBehalfOf   }
Logic Definition | Library Name: SharedResourceCreation
    define function ProcedureFocalDevice(device List<FHIR.Procedure.FocalDevice>):   device d   return FHIR.Procedure.FocalDevice{     action: d.action,     manipulated: d.manipulated   }
Logic Definition | Library Name: NHSNAcuteCareHospitalMonthlyInitialPopulation
    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,     definition: d.definition,     udiCarrier: DeviceUdiCarrier(d.udiCarrier),     status: d.status,     statusReason: d.statusReason,     distinctIdentifier: d.distinctIdentifier,     manufacturer: d.manufacturer,     manufactureDate: d.manufactureDate,     expirationDate: d.expirationDate,     lotNumber: d.lotNumber,     serialNumber: d.serialNumber,     deviceName: DeviceDeviceName(d.deviceName),     modelNumber: d.modelNumber,     partNumber: d.partNumber,     type: d.type,     specialization: DeviceSpecialization(d.specialization),     version: DeviceVersion(d.version),     property: DeviceProperty(d.property),     patient: d.patient,     owner: d.owner,     contact: d.contact,     location: d.location,     url: d.url,     note: d.note,     safety: d.safety,     parent: d.parent   }
Logic Definition | Library Name: NHSNAcuteCareHospitalMonthlyInitialPopulation
    define function DeviceUdiCarrier(udiCarrier List<FHIR.Device.UdiCarrier>):   udiCarrier u   return FHIR.Device.UdiCarrier{     deviceIdentifier: u.deviceIdentifier,     issuer: u.issuer,     jurisdiction: u.jurisdiction,     carrierAIDC: u.carrierAIDC,     carrierHRF: u.carrierHRF,     entryType: u.entryType   }
Logic Definition | Library Name: NHSNAcuteCareHospitalMonthlyInitialPopulation
    define function DeviceDeviceName(deviceName List<FHIR.Device.DeviceName>):   deviceName d   return FHIR.Device.DeviceName{     name: d.name,     type: d.type   }
Logic Definition | Library Name: NHSNAcuteCareHospitalMonthlyInitialPopulation
    define function DeviceSpecialization(specialization List<FHIR.Device.Specialization>):   specialization s   return FHIR.Device.Specialization{     systemType: s.systemType,     version: s.version   }
Logic Definition | Library Name: NHSNAcuteCareHospitalMonthlyInitialPopulation
    define function DeviceVersion(version List<FHIR.Device.Version>):   version v   return FHIR.Device.Version{     type: v.type,     component: v.component,     value: v.value   }
Logic Definition | Library Name: NHSNAcuteCareHospitalMonthlyInitialPopulation
    define function DeviceProperty(deviceProperty List<FHIR.Device.Property>):   deviceProperty d   return FHIR.Device.Property{     id: d.id,     type: d.type,     valueQuantity: d.valueQuantity,     valueCode: d.valueCode   }
Logic Definition | Library Name: SharedResourceCreation
    define function ObservationLabResource(observation Observation, profileURLs List<FHIR.canonical>):   observation o   return Observation{     id: FHIR.id {value: 'LCR-' + o.id},     meta: MetaElement(o, profileURLs),     extension: o.extension,     basedOn: o.basedOn,     partOf: o.partOf,     status: o.status,     category: ObservationLabCategory(o.category),     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: ObservationReferenceRange(o.referenceRange),     hasMember: o.hasMember,     derivedFrom: o.derivedFrom,     component: ObservationComponent(o.component)   }
Logic Definition | Library Name: SharedResourceCreation
    define function ObservationLabCategory(category List<CodeableConcept>):   category c   return CodeableConcept{     coding: ObservationLabCoding(c.coding),     text: c.text   }
Logic Definition | Library Name: SharedResourceCreation
    define function ObservationLabCoding(coding List<Coding>):   coding c   return Coding{     id: c.id,     extension: c.extension,     system: c.system,     version: c.version,     code: c.code,     display: c.display,     userSelected: c.userSelected   }
Logic Definition | Library Name: SharedResourceCreation
    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,     text: rR.text   }
Logic Definition | Library Name: SharedResourceCreation
    define function ObservationComponent(component List<FHIR.Observation.Component>):   component c   return FHIR.Observation.Component{     code: c.code,     value: c.value,     dataAbsentReason: c.dataAbsentReason,     interpretation: c.interpretation,     referenceRange: c.referenceRange   }
Logic Definition | Library Name: NHSNAcuteCareHospitalMonthlyInitialPopulation
    define function ObservationVitalSignsResource(observation Observation, profileURLs List<FHIR.canonical>):   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: ObservationVitalSignsCategory(o.category),     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)   }
Logic Definition | Library Name: NHSNAcuteCareHospitalMonthlyInitialPopulation
    define function ObservationVitalSignsCategory(category List<CodeableConcept>):   category c   return CodeableConcept{     coding: ObservationVitalSignsCoding(c.coding),     text: c.text   }
Logic Definition | Library Name: NHSNAcuteCareHospitalMonthlyInitialPopulation
    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   }
Logic Definition | Library Name: NHSNAcuteCareHospitalMonthlyInitialPopulation
    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)   }
Logic Definition | Library Name: NHSNAcuteCareHospitalMonthlyInitialPopulation
    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   }
Logic Definition | Library Name: SharedResourceCreation
    define function MedicationAdministrationResource(medicationAdministration MedicationAdministration, profileURLs List<FHIR.canonical>):   medicationAdministration m   return MedicationAdministration{     id: FHIR.id {value: 'LCR-' + m.id},     meta: MetaElement(m, profileURLs),     extension: m.extension,     instantiates: m.instantiates,     partOf: m.partOf,     status: m.status,     statusReason: m.statusReason,     category: m.category,     medication: m.medication,     subject: m.subject,     context: m.context,     supportingInformation: m.supportingInformation,     effective: m.effective,     performer: MedicationAdministrationPerformer(m.performer),     reasonCode: m.reasonCode,     reasonReference: m.reasonReference,     request: m.request,     device: m.device,     note: m.note,     dosage: MedicationAdministrationDosage(m.dosage),     eventHistory: m.eventHistory   }
Logic Definition | Library Name: SharedResourceCreation
    define function MedicationAdministrationPerformer(performer List<FHIR.MedicationAdministration.Performer>):   performer p   return FHIR.MedicationAdministration.Performer{     function: p.function,     actor: p.actor   }
Logic Definition | Library Name: SharedResourceCreation
    define function MedicationAdministrationDosage(dosage FHIR.MedicationAdministration.Dosage):   dosage d   return FHIR.MedicationAdministration.Dosage{     text: d.text,     site: d.site,     route: d.route,     method: d.method,     dose: d.dose,     rate: d.rate   }
Logic Definition | Library Name: NHSNAcuteCareHospitalMonthlyInitialPopulation
    define function ObservationResource(observation Observation, profileURLs List<FHIR.canonical>):   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: o.category,     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: SharedResource.ObservationComponent(o.component)   }
Logic Definition | Library Name: NHSNAcuteCareHospitalMonthlyInitialPopulation
    define function "GetCondition"(reference Reference):   singleton from (     "Conditions" Conditions     where Conditions.id = NHSNHelpers.GetId(reference.reference)   )
Logic Definition | Library Name: NHSNAcuteCareHospitalMonthlyInitialPopulation
    define function "GetEncounter"(reference Reference):   singleton from (     "Encounters" Encounters     where Encounters.id = NHSNHelpers.GetId(reference.reference)   )
Logic Definition | Library Name: NHSNAcuteCareHospitalMonthlyInitialPopulation
    // //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),     severity: c.severity,     code: c.code,     bodySite: c.bodySite,     subject: c.subject,     encounter: c.encounter,     onset: c.onset,     abatement: c.abatement,     recordedDate: c.recordedDate,     stage: SharedResource.ConditionStage(c.stage),     evidence: SharedResource.ConditionEvidence(c.evidence),     note: c.note   }
Logic Definition | Library Name: NHSNAcuteCareHospitalMonthlyInitialPopulation
    define function FilterCodeableConcepts(codes List<FHIR.CodeableConcept>, accepted List<System.Code>):  if Count(accepted) > 0   then RemoveUnaccepted(codes, accepted)  else codes
Logic Definition | Library Name: NHSNAcuteCareHospitalMonthlyInitialPopulation
    define function RemoveUnaccepted(codes List<FHIR.CodeableConcept>, accepted List<System.Code>):  codes c   where exists(     accepted a     where c ~ a   )
Logic Definition | Library Name: SharedResourceCreation
    define function ConditionStage(stage List<FHIR.Condition.Stage>):   stage s   return FHIR.Condition.Stage{     summary: s.summary,     assessment: s.assessment,     type: s.type   }
Logic Definition | Library Name: SharedResourceCreation
    define function ConditionEvidence(evidence List<FHIR.Condition.Evidence>):   evidence e   return FHIR.Condition.Evidence{     code: e.code,     detail: e.detail   }
Logic Definition | Library Name: SharedResourceCreation
    define function DiagnosticReportLabResource(diagnosticReport DiagnosticReport, profileURLs List<FHIR.canonical>):   diagnosticReport d   return DiagnosticReport{     id: FHIR.id{value: 'LCR-' + d.id},     meta: MetaElement(d, profileURLs),     extension: d.extension,     basedOn: d.basedOn,     status: d.status,     category: DiagnosticReportCategory(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   }
Logic Definition | Library Name: SharedResourceCreation
    define function DiagnosticReportCategory(category List<CodeableConcept>):   category c   return CodeableConcept{     coding: DiagnosticReportCoding(c.coding)   }
Logic Definition | Library Name: SharedResourceCreation
    define function DiagnosticReportCoding(coding List<Coding>):   coding c   return Coding{     system: c.system,     version: c.version,     code: c.code,     display: c.display,     userSelected: c.userSelected   }
Logic Definition | Library Name: SharedResourceCreation
    define function LocationResource(location Location, profileURLs List<FHIR.canonical>):   location l   return Location{     id: FHIR.id {value: 'LCR-' + l.id},     meta: MetaElement(l, profileURLs),     extension: l.extension,     status: l.status,     operationalStatus: l.operationalStatus,     name: l.name,     alias: l.alias,     description: l.description,     mode: l.mode,     type: l.type,     telecom: l.telecom,     address: LocationAddress(l.address),     physicalType: l.physicalType,     position: LocationPosition(l.position),     managingOrganization: l.managingOrganization,     partOf: l.partOf,     hoursOfOperation: LocationHoursOfOperation(l.hoursOfOperation),     availabilityExceptions: l.availabilityExceptions,     endpoint: l.endpoint   }
Logic Definition | Library Name: SharedResourceCreation
    define function LocationAddress(address FHIR.Address):   address a   return FHIR.Address{     use: a.use,     type: a.type,     text: a.text,     line: a.line,     city: a.city,     district: a.district,     state: a.state,     postalCode: a.postalCode,     country: a.country,     period: a.period   }
Logic Definition | Library Name: SharedResourceCreation
    define function LocationPosition(position FHIR.Location.Position):   position p   return FHIR.Location.Position{     longitude: p.longitude,     latitude: p.latitude,     altitude: p.altitude   }
Logic Definition | Library Name: SharedResourceCreation
    define function LocationHoursOfOperation(hoursOfOperation List<FHIR.Location.HoursOfOperation>):   hoursOfOperation hOO   return FHIR.Location.HoursOfOperation{     daysOfWeek: hOO.daysOfWeek,     allDay: hOO.allDay,     openingTime: hOO.openingTime,     closingTime: hOO.closingTime   }
Logic Definition | Library Name: SharedResourceCreation
    define function ServiceRequestResource(serviceRequest ServiceRequest, profileURLs List<FHIR.canonical>):   serviceRequest sR   return ServiceRequest{     id: FHIR.id {value: 'LCR-' + sR.id},     meta: MetaElement(sR, profileURLs),     extension: sR.extension,     instantiatesCanonical: sR.instantiatesCanonical,     instantiatesUri: sR.instantiatesUri,     basedOn: sR.basedOn,     replaces: sR.replaces,     requisition: sR.requisition,     status: sR.status,     intent: sR.intent,     category: sR.category,     priority: sR.priority,     doNotPerform: sR.doNotPerform,     code: sR.code,     orderDetail: sR.orderDetail,     quantity: sR.quantity,     subject: sR.subject,     encounter: sR.encounter,     occurrence: sR.occurrence,     asNeeded: sR.asNeeded,     authoredOn: sR.authoredOn,     requester: sR.requester,     performerType: sR.performerType,     performer: sR.performer,     locationCode: sR.locationCode,     locationReference: sR.locationReference,     reasonCode: sR.reasonCode,     reasonReference: sR.reasonReference,     insurance: sR.insurance,     supportingInfo: sR.supportingInfo,     specimen: sR.specimen,     bodySite: sR.bodySite,     note: sR.note,     patientInstruction: sR.patientInstruction,     relevantHistory: sR.relevantHistory   }
Logic Definition | Library Name: SharedResourceCreation
    define function PatientResource(patient Patient, profileURLs List<FHIR.canonical>):   patient p   return Patient{     id: FHIR.id{value: 'LCR-' + p.id},     meta: MetaElement(p, profileURLs),     extension: GetPatientExtensions(p) union GetIdExtensions(p),     identifier: p.identifier,     active: p.active,     name: PatientName(p.name),     telecom: PatientTelecom(p.telecom),     gender: p.gender,     birthDate: p.birthDate,     deceased: p.deceased,     address: PatientAddress(p.address),     maritalStatus: p.maritalStatus,     multipleBirth: p.multipleBirth,     photo: p.photo,     contact: PatientContact(p.contact),     communication: PatientCommunication(p.communication),     generalPractitioner: p.generalPractitioner,     managingOrganization: p.managingOrganization,     link: PatientLink(p.link)   }
Logic Definition | Library Name: SharedResourceCreation
    define function "GetPatientExtensions"(domainResource DomainResource):   domainResource.extension E   where E.url.value = 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-race'     or E.url.value = 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-ethnicity'     or E.url.value = 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-birthsex'     or E.url.value = 'http://www.cdc.gov/nhsn/fhirportal/dqm/ig/StructureDefinition/link-original-resource-id-extension'   return E
Logic Definition | Library Name: SharedResourceCreation
    define function "GetIdExtensions"(domainResource DomainResource):   domainResource.extension E   where E.url.value = 'http://www.cdc.gov/nhsn/fhirportal/dqm/ig/StructureDefinition/link-original-resource-id-extension'   return E
Logic Definition | Library Name: SharedResourceCreation
    /* No longer needed but saving in case it's useful later define function PatientIdentifier(identifier List<FHIR.Identifier>):   identifier i   return FHIR.Identifier{     id: i.id,     extension: i.extension,     use: i.use,     type: i.type,     system: i.system,     value: i.value,     period: i.period,     assigner: i.assigner   }*/  define function PatientName(name List<FHIR.HumanName>):   name n   return FHIR.HumanName{     id: n.id,     extension: n.extension,     use: n.use,     text: n.text,     family: n.family,     given: n.given,     prefix: n.prefix,     suffix: n.suffix,     period: n.period   }
Logic Definition | Library Name: SharedResourceCreation
    define function PatientTelecom(telecom List<FHIR.ContactPoint>):   telecom t   return FHIR.ContactPoint{     system: t.system,     value: t.value,     use: t.use,     rank: t.rank,     period: t.period   }
Logic Definition | Library Name: SharedResourceCreation
    define function PatientAddress(address List<FHIR.Address>):   address a   return FHIR.Address{     id: a.id,     extension: a.extension,     use: a.use,     type: a.type,     text: a.text,     line: a.line,     city: a.city,     district: a.district,     state: a.state,     postalCode: a.postalCode,     country: a.country,     period: a.period   }
Logic Definition | Library Name: SharedResourceCreation
    define function PatientContact(contact List<FHIR.Patient.Contact>):   contact c   return FHIR.Patient.Contact{     id: c.id,     extension: c.extension,     relationship: c.relationship,     name: c.name,     telecom: c.telecom,     address: c.address,     gender: c.gender,     organization: c.organization,     period: c.period   }
Logic Definition | Library Name: SharedResourceCreation
    define function PatientCommunication(communication List<FHIR.Patient.Communication>):   communication c   return FHIR.Patient.Communication{     id: c.id,     extension: c.extension,     language: c.language,     preferred: c.preferred   }
Logic Definition | Library Name: SharedResourceCreation
    define function PatientLink(link List<FHIR.Patient.Link>):   link l   return FHIR.Patient.Link{     id: l.id,     extension: l.extension,     modifierExtension: l.modifierExtension,     other: l.other,     type: l.type   }
Logic Definition | Library Name: SharedResourceCreation
    define function MedicationResource(medication Medication, profileURLs List<FHIR.canonical>):   medication m   return Medication{     id: FHIR.id {value: 'LCR-' + m.id},     meta: MetaElement(m, profileURLs),     extension: m.extension,     code: m.code,     status: m.status,     manufacturer: m.manufacturer,     form: m.form,     amount: m.amount,     ingredient: MedicationIngredient(m.ingredient),     batch: MedicationBatch(m.batch)   }
Logic Definition | Library Name: SharedResourceCreation
    define function MedicationIngredient(ingredient List<FHIR.Medication.Ingredient>):   ingredient i   return FHIR.Medication.Ingredient{     item: i.item,     strength: i.strength   }
Logic Definition | Library Name: SharedResourceCreation
    define function MedicationBatch(batch FHIR.Medication.Batch):   batch b   return FHIR.Medication.Batch{     lotNumber: b.lotNumber,     expirationDate: b.expirationDate   }
Logic Definition | Library Name: NHSNAcuteCareHospitalMonthlyInitialPopulation
    define function "GetMedicationFrom"(choice Choice<FHIR.CodeableConcept, FHIR.Reference>):   case     when choice is FHIR.Reference then       GetMedication(choice as FHIR.Reference)     else       null   end
Logic Definition | Library Name: NHSNAcuteCareHospitalMonthlyInitialPopulation
    define function "GetMedication"(reference Reference):   singleton from (     [Medication] Medications     where Medications.id = NHSNHelpers.GetId(reference.reference)   )
Logic Definition | Library Name: SharedResourceCreation
    define function SpecimenResource(specimen Specimen, profileURLs List<FHIR.canonical>):   specimen s   return Specimen{     id: FHIR.id {value: 'LCR-' + s.id},     meta: MetaElement(s, profileURLs),     extension: s.extension,     identifier: s.identifier,     accessionIdentifier: s.accessionIdentifier,     status: s.status,     type: s.type,     subject: s.subject,     receivedTime: s.receivedTime,     parent: s.parent,     request: s.request,     collection: SpecimenCollection(s.collection),     processing: SpecimenProcessing(s.processing),     container: SpecimenContainer(s.container),     condition: s.condition,     note: s.note   }
Logic Definition | Library Name: SharedResourceCreation
    define function SpecimenCollection(collection FHIR.Specimen.Collection):   collection c   return FHIR.Specimen.Collection{     collector: c.collector,     collected: c.collected,     "duration": c."duration",     quantity: c.quantity,     method: c.method,     bodySite: c.bodySite,     fastingStatus: c.fastingStatus   }
Logic Definition | Library Name: SharedResourceCreation
    define function SpecimenProcessing(processing List<FHIR.Specimen.Processing>):   processing p   return FHIR.Specimen.Processing{     description: p.description,     procedure: p.procedure,     additive: p.additive,     time: p.time   }
Logic Definition | Library Name: SharedResourceCreation
    define function SpecimenContainer(container List<FHIR.Specimen.Container>):   container c   return FHIR.Specimen.Container{     description: c.description,     type: c.type,     capacity: c.capacity,     specimenQuantity: c.specimenQuantity,     additive: c.additive   }
Generated using version 0.4.6 of the sample-content-ig Liquid templates