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

## : Shared Resource Creation - XML Representation

Page standards status: Trial-use | Maturity Level: 1

Raw xml | Download

    <Library xmlns="http://hl7.org/fhir">
      <id value="SharedResourceCreation"/>
      <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;">SharedResourceCreation</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-SharedResourceCreation.html">SharedResourceCreation</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-15 12:53:39-0400</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>
              <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 SharedResourceCreation version '0.1.010'

    include FHIRHelpers version '4.0.2'

    using FHIR version '4.0.1'

    define function &quot;GetIdExtensions&quot;(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

    define function &quot;GetPatientExtensions&quot;(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

    define function &quot;MetaElement&quot;(resource Resource, profileURLs List&lt;FHIR.canonical&gt;):
      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
      }

    define function ConditionStage(stage List&lt;FHIR.Condition.Stage&gt;):
      stage s
      return FHIR.Condition.Stage{
        summary: s.summary,
        assessment: s.assessment,
        type: s.type
      }

    define function ConditionEvidence(evidence List&lt;FHIR.Condition.Evidence&gt;):
      evidence e
      return FHIR.Condition.Evidence{
        code: e.code,
        detail: e.detail
      }

    define function ConditionResource(condition Condition, profileURLs List&lt;FHIR.canonical&gt;, acceptedCategories List&lt;System.Code&gt;):
      condition c
      return Condition{
        id: FHIR.id {value: 'LCR-' + c.id},
        meta: MetaElement(c, profileURLs),
        extension: c.extension,
        clinicalStatus: c.clinicalStatus,
        verificationStatus: c.verificationStatus,
        category: c.category,
        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: ConditionStage(c.stage),
        evidence: ConditionEvidence(c.evidence),
        note: c.note
      }

    define function CoverageClass(class List&lt;FHIR.Coverage.Class&gt;):
      class c
      return FHIR.Coverage.Class{
        value: c.value,
        name: c.name
      }

    define function CoverageResource(coverage Coverage, profileURLs List&lt;FHIR.canonical&gt;):
      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
      }

    define function DiagnosticReportCoding(coding List&lt;Coding&gt;):
      coding c
      return Coding{
        system: c.system,
        version: c.version,
        code: c.code,
        display: c.display,
        userSelected: c.userSelected
      }

    define function DiagnosticReportCategory(category List&lt;CodeableConcept&gt;):
      category c
      return CodeableConcept{
        coding: DiagnosticReportCoding(c.coding)
      }

    define function DiagnosticReportLabResource(diagnosticReport DiagnosticReport, profileURLs List&lt;FHIR.canonical&gt;):
      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
      }

    define function EncounterIdentifier(identifier List&lt;FHIR.Identifier&gt;):
      identifier i
      return FHIR.Identifier{
        use: i.use,
        type: i.type,
        system: i.system,
        value: i.value,
        period: i.period
      }

    define function EncounterStatusHistory(statusHistory List&lt;FHIR.Encounter.StatusHistory&gt;):
      statusHistory sH
      return FHIR.Encounter.StatusHistory{
        status: sH.status,
        period: sH.period
      }

    define function EncounterClassHistory(classHistory List&lt;FHIR.Encounter.ClassHistory&gt;):
      classHistory cH
      return FHIR.Encounter.ClassHistory{
        class: cH.class,
        period: cH.period
      }

    /*No longer needed but saving for potential future use
    define function EncounterParticipant(participant List&lt;FHIR.Encounter.Participant&gt;):
      participant p
      return FHIR.Encounter.Participant{
        type: p.type,
        period: p.period,
        individual: p.individual
      }*/

    define function EncounterDiagnosis(diagnosis List&lt;FHIR.Encounter.Diagnosis&gt;):
      diagnosis d
      return FHIR.Encounter.Diagnosis{
        condition: d.condition,
        use: d.use,
        rank: d.rank
      }

    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
      }

    define function EncounterLocation(location List&lt;FHIR.Encounter.Location&gt;):
      location l
      return FHIR.Encounter.Location{
        location: l.location,
        status: l.status,
        physicalType: l.physicalType,
        period: l.period
      }

    define function EncounterResource(encounter Encounter, profileURLs List&lt;FHIR.canonical&gt;):
      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
      }

    define function ObservationLabCoding(coding List&lt;Coding&gt;):
      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
      }

    define function ObservationLabCategory(category List&lt;CodeableConcept&gt;):
      category c
      return CodeableConcept{
        coding: ObservationLabCoding(c.coding),
        text: c.text
      }

    define function ObservationReferenceRange(referenceRange List&lt;FHIR.Observation.ReferenceRange&gt;):
      referenceRange rR
      return FHIR.Observation.ReferenceRange{
        low: rR.low,
        high: rR.high,
        type: rR.type,
        appliesTo: rR.appliesTo,
        age: rR.age,
        text: rR.text
      }

    define function ObservationComponent(component List&lt;FHIR.Observation.Component&gt;):
      component c
      return FHIR.Observation.Component{
        code: c.code,
        value: c.value,
        dataAbsentReason: c.dataAbsentReason,
        interpretation: c.interpretation,
        referenceRange: c.referenceRange
      }

    define function ObservationLabResource(observation Observation, profileURLs List&lt;FHIR.canonical&gt;):
      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)
      }

    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
      }

    define function LocationPosition(position FHIR.Location.Position):
      position p
      return FHIR.Location.Position{
        longitude: p.longitude,
        latitude: p.latitude,
        altitude: p.altitude
      }

    define function LocationHoursOfOperation(hoursOfOperation List&lt;FHIR.Location.HoursOfOperation&gt;):
      hoursOfOperation hOO
      return FHIR.Location.HoursOfOperation{
        daysOfWeek: hOO.daysOfWeek,
        allDay: hOO.allDay,
        openingTime: hOO.openingTime,
        closingTime: hOO.closingTime
      }

    define function LocationResource(location Location, profileURLs List&lt;FHIR.canonical&gt;):
      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
      }

    define function MedicationIngredient(ingredient List&lt;FHIR.Medication.Ingredient&gt;):
      ingredient i
      return FHIR.Medication.Ingredient{
        item: i.item,
        strength: i.strength
      }

    define function MedicationBatch(batch FHIR.Medication.Batch):
      batch b
      return FHIR.Medication.Batch{
        lotNumber: b.lotNumber,
        expirationDate: b.expirationDate
      }

    define function MedicationResource(medication Medication, profileURLs List&lt;FHIR.canonical&gt;):
      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)
      }

    define function MedicationAdministrationPerformer(performer List&lt;FHIR.MedicationAdministration.Performer&gt;):
      performer p
      return FHIR.MedicationAdministration.Performer{
        function: p.function,
        actor: p.actor
      }

    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
      }

    define function MedicationAdministrationResource(medicationAdministration MedicationAdministration, profileURLs List&lt;FHIR.canonical&gt;):
      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
      }

    define function MedicationRequestDoseAndRate(doseAndRate List&lt;FHIR.Dosage.DoseAndRate&gt;):
      doseAndRate dR
      return FHIR.Dosage.DoseAndRate{
        type: dR.type,
        dose: dR.dose,
        rate: dR.rate
      }

    define function MedicationRequestDosageInstruction(dosageInstruction List&lt;FHIR.Dosage&gt;):
      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)
      }

    define function MedicationRequestResource(medicationRequest MedicationRequest, profileURLs List&lt;FHIR.canonical&gt;):
      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)
      }

    /* No longer needed but saving in case it's useful later
    define function PatientIdentifier(identifier List&lt;FHIR.Identifier&gt;):
      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&lt;FHIR.HumanName&gt;):
      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
      }

    define function PatientTelecom(telecom List&lt;FHIR.ContactPoint&gt;):
      telecom t
      return FHIR.ContactPoint{
        system: t.system,
        value: t.value,
        use: t.use,
        rank: t.rank,
        period: t.period
      }

    define function PatientAddress(address List&lt;FHIR.Address&gt;):
      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
      }

    define function PatientContact(contact List&lt;FHIR.Patient.Contact&gt;):
      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
      }

    define function PatientCommunication(communication List&lt;FHIR.Patient.Communication&gt;):
      communication c
      return FHIR.Patient.Communication{
        id: c.id,
        extension: c.extension,
        language: c.language,
        preferred: c.preferred
      }

    define function PatientLink(link List&lt;FHIR.Patient.Link&gt;):
      link l
      return FHIR.Patient.Link{
        id: l.id,
        extension: l.extension,
        modifierExtension: l.modifierExtension,
        other: l.other,
        type: l.type
      }

    define function PatientResource(patient Patient, profileURLs List&lt;FHIR.canonical&gt;):
      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)
      }

    define function ProcedurePerformer(performer List&lt;FHIR.Procedure.Performer&gt;):
      performer p
      return FHIR.Procedure.Performer{
        function: p.function,
        actor: p.actor,
        onBehalfOf: p.onBehalfOf
      }

    define function ProcedureFocalDevice(device List&lt;FHIR.Procedure.FocalDevice&gt;):
      device d
      return FHIR.Procedure.FocalDevice{
        action: d.action,
        manipulated: d.manipulated
      }

    define function ProcedureResource(procedure Procedure, profileURLs List&lt;FHIR.canonical&gt;):
      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
      }

    define function ServiceRequestResource(serviceRequest ServiceRequest, profileURLs List&lt;FHIR.canonical&gt;):
      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
      }

    define function SpecimenCollection(collection FHIR.Specimen.Collection):
      collection c
      return FHIR.Specimen.Collection{
        collector: c.collector,
        collected: c.collected,
        &quot;duration&quot;: c.&quot;duration&quot;,
        quantity: c.quantity,
        method: c.method,
        bodySite: c.bodySite,
        fastingStatus: c.fastingStatus
      }

    define function SpecimenProcessing(processing List&lt;FHIR.Specimen.Processing&gt;):
      processing p
      return FHIR.Specimen.Processing{
        description: p.description,
        procedure: p.procedure,
        additive: p.additive,
        time: p.time
      }

    define function SpecimenContainer(container List&lt;FHIR.Specimen.Container&gt;):
      container c
      return FHIR.Specimen.Container{
        description: c.description,
        type: c.type,
        capacity: c.capacity,
        specimenQuantity: c.specimenQuantity,
        additive: c.additive
      }

    define function SpecimenResource(specimen Specimen, profileURLs List&lt;FHIR.canonical&gt;):
      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
      }

    define function &quot;OperationOutcomeResource&quot;(errorId String, resourceId FHIR.id, message String):
      OperationOutcome{
          id: FHIR.id{value: errorId},
          issue: {
              FHIR.OperationOutcome.Issue{
              severity: FHIR.IssueSeverity{value: 'error'},
              code: FHIR.IssueType{value: 'exception'},
              details:
                  FHIR.CodeableConcept{
                      coding: {
                          Coding{
                          system: uri{value: 'https://lantanagroup.com/validation-error'},
                          code: code{value: 'Error'},
                          display: string{value: 'Resource ' + resourceId + ' failed validation: ' + message}
                          }
                      }
                  }
              }
          }
      }</code></pre></td></tr>
                </table>
              </td>
            </tr>

        </table>
    </div>
    </div>
      </text>
      <contained>
        <Parameters>
          <id value="options"/>
          <parameter>
            <name value="translatorVersion"/>
            <valueString value="3.25.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>
      <url
           value="http://www.cdc.gov/nhsn/fhirportal/dqm/ig/Library/SharedResourceCreation"/>
      <version value="1.0.0"/>
      <name value="SharedResourceCreation"/>
      <status value="draft"/>
      <type>
        <coding>
          <system value="http://terminology.hl7.org/CodeSystem/library-type"/>
          <code value="logic-library"/>
        </coding>
      </type>
      <date value="2025-09-15T12:53:39-04: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>
      <content>
        <contentType value="text/cql"/>
        <data
              value=" "/>
      </content>
    </Library>