CDC National Healthcare Safety Network (NHSN) Digital Quality Measures (dQM) Content Package IG
1.0.0 - Release 1 United States of America flag

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

: NHSN Helpers - XML Representation

Page standards status: Trial-use Maturity Level: 1

Raw xml | Download


<Library xmlns="http://hl7.org/fhir">
  <id value="NHSNHelpers"/>
  <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;">NHSNHelpers</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-NHSNHelpers.html">NHSNHelpers</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>
                  
                </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>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>
                </tr>
              
                <tr>
                  <th>Location</th>
                  <th>http://hl7.org/fhir/StructureDefinition/Location</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 NHSNHelpers version '0.0.002'

using FHIR version '4.0.1'

include FHIRHelpers version '4.0.2'

context Patient

define function &quot;Normalize Interval&quot;(choice Choice&lt;FHIR.dateTime, FHIR.Period, FHIR.Timing, FHIR.instant, FHIR.string, FHIR.Age, FHIR.Range&gt;):
  case
	  when choice is FHIR.dateTime then
    	Interval[FHIRHelpers.ToDateTime(choice as FHIR.dateTime), FHIRHelpers.ToDateTime(choice as FHIR.dateTime)]
		when choice is FHIR.Period then
  		FHIRHelpers.ToInterval(choice as FHIR.Period)
		when choice is FHIR.instant then
			Interval[FHIRHelpers.ToDateTime(choice as FHIR.instant), FHIRHelpers.ToDateTime(choice as FHIR.instant)]
		when choice is FHIR.Age then
		  Interval[FHIRHelpers.ToDate(Patient.birthDate) + FHIRHelpers.ToQuantity(choice as FHIR.Age),
			  FHIRHelpers.ToDate(Patient.birthDate) + FHIRHelpers.ToQuantity(choice as FHIR.Age) + 1 year)
		when choice is FHIR.Range then
		  Interval[FHIRHelpers.ToDate(Patient.birthDate) + FHIRHelpers.ToQuantity((choice as FHIR.Range).low),
			  FHIRHelpers.ToDate(Patient.birthDate) + FHIRHelpers.ToQuantity((choice as FHIR.Range).high) + 1 year)
		when choice is FHIR.Timing then
		  Message(null as Interval&lt;DateTime&gt;, true, '1', 'Error', 'Cannot compute a single interval from a Timing type')
    when choice is FHIR.string then
      Message(null as Interval&lt;DateTime&gt;, true, '1', 'Error', 'Cannot compute an interval from a String value')
		else
			null as Interval&lt;DateTime&gt;
	end

define function &quot;ToDateInterval&quot;(period FHIR.Period):
  Interval[date from period.start, date from period.end]

define function &quot;GetLocation&quot;(reference Reference ):
  singleton from (
	[Location] Locations
		where Locations.id = GetId(reference.reference)
  )

define function &quot;GetId&quot;(uri String ):
  Last(Split(uri, '/'))</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/NHSNHelpers"/>
  <version value="1.0.0"/>
  <name value="NHSNHelpers"/>
  <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>
  <parameter>
    <name value="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"/>
  </dataRequirement>
  <dataRequirement>
    <type value="Location"/>
    <profile value="http://hl7.org/fhir/StructureDefinition/Location"/>
    <mustSupport value="id"/>
  </dataRequirement>
  <content>
    <contentType value="text/cql"/>
    <data
          value="bGlicmFyeSBOSFNOSGVscGVycyB2ZXJzaW9uICcwLjAuMDAyJwoKdXNpbmcgRkhJUiB2ZXJzaW9uICc0LjAuMScKCmluY2x1ZGUgRkhJUkhlbHBlcnMgdmVyc2lvbiAnNC4wLjInCgpjb250ZXh0IFBhdGllbnQKCmRlZmluZSBmdW5jdGlvbiAiTm9ybWFsaXplIEludGVydmFsIihjaG9pY2UgQ2hvaWNlPEZISVIuZGF0ZVRpbWUsIEZISVIuUGVyaW9kLCBGSElSLlRpbWluZywgRkhJUi5pbnN0YW50LCBGSElSLnN0cmluZywgRkhJUi5BZ2UsIEZISVIuUmFuZ2U+KToKICBjYXNlCgkgIHdoZW4gY2hvaWNlIGlzIEZISVIuZGF0ZVRpbWUgdGhlbgogICAgCUludGVydmFsW0ZISVJIZWxwZXJzLlRvRGF0ZVRpbWUoY2hvaWNlIGFzIEZISVIuZGF0ZVRpbWUpLCBGSElSSGVscGVycy5Ub0RhdGVUaW1lKGNob2ljZSBhcyBGSElSLmRhdGVUaW1lKV0KCQl3aGVuIGNob2ljZSBpcyBGSElSLlBlcmlvZCB0aGVuCiAgCQlGSElSSGVscGVycy5Ub0ludGVydm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