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

CDC National Healthcare Safety Network (NHSN) Digital Quality Measures (dQM) Content Package IG - Local Development build (v3.0.0) built by the FHIR (HL7® FHIR® Standard) Build Tools. See the Directory of published versions

Library: NHSN Helpers

Official URL: http://www.cdc.gov/nhsn/fhirportal/dqm/ig/Library/NHSNHelpers Version: 3.0.0
Standards status: Trial-use Maturity Level: 2 Computable Name: NHSNHelpers
Metadata
Version 3.0.0
Status Draft
Jurisdiction US from urn:iso:std:iso:3166
Steward (Publisher) CDC National Healthcare Safety Network (NHSN)
Steward Contact CDC National Healthcare Safety Network (NHSN)
Type logic-library from http://terminology.hl7.org/CodeSystem/library-type
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
Data Requirement Type: Patient
Profile(s): Patient
Data Requirement Type: Location
Profile(s): Location
Must Support Elements: id
Parameters
Name Use Card. Type Documentation
Patient Out 0..1 Patient
Library Content
CQL Content
library NHSNHelpers version '0.0.002'

using FHIR version '4.0.1'

include FHIRHelpers version '4.0.2'

context Patient

define function "Normalize Interval"(choice Choice<FHIR.dateTime, FHIR.Period, FHIR.Timing, FHIR.instant, FHIR.string, FHIR.Age, FHIR.Range>):
  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<DateTime>, true, '1', 'Error', 'Cannot compute a single interval from a Timing type')
    when choice is FHIR.string then
      Message(null as Interval<DateTime>, true, '1', 'Error', 'Cannot compute an interval from a String value')
		else
			null as Interval<DateTime>
	end

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

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

define function "GetId"(uri String ):
  Last(Split(uri, '/'))
Generated using version 0.5.6-cibuild of the sample-content-ig Liquid templates