{
  "resourceType": "Bundle",
  "id": "library-deps-EXM104-FHIR3-8.1.000-bundle",
  "type": "transaction",
  "entry": [
    {
      "resource": {
        "resourceType": "Library",
        "id": "library-FHIRHelpers-3.0.0",
        "text": {
          "status": "generated",
          "div": "<div xmlns=\"http://www.w3.org/1999/xhtml\"><table class=\"grid dict\"><tr><th scope=\"row\"><b>Id: </b></th><td style=\"padding-left: 25px; padding-right: 25px;\">library-FHIRHelpers-3.0.0</td></tr><tr><th scope=\"row\"><b>Type: </b></th><td style=\"padding-right: 25px;\"> Logic Library </td></tr><tr><th scope=\"row\"><b>Version: </b></th><td style=\"padding-left: 25px; padding-right: 25px;\">3.0.0</td></tr><tr><th scope=\"row\"><b>Status: </b></th><td style=\"padding-left: 25px; padding-right: 25px;\">active</td></tr><tr style=\"vertical-align: top;\"><th scope=\"row\"><b>Content: </b></th><td style=\"padding-left: 25px; padding-right: 25px;\"><b>type: </b><span>text/cql</span></td></tr><tr><td colspan=\"2\" style=\"padding-left: 25px; padding-right: 25px;\"><pre><code class=\"language-cql\">library FHIRHelpers version '3.0.0'\n\nusing FHIR version '3.0.0'\n\ndefine function ToInterval(period FHIR.Period):\n    if period is null then\n        null\n    else\n        Interval[period.&quot;start&quot;.value, period.&quot;end&quot;.value]\n\ndefine function ToQuantity(quantity FHIR.Quantity):\n    if quantity is null then\n        null\n    else\n        System.Quantity { value: quantity.value.value, unit: quantity.unit.value }\n\ndefine function ToInterval(range FHIR.Range):\n    if range is null then\n        null\n    else\n        Interval[ToQuantity(range.low), ToQuantity(range.high)]\n\ndefine function ToCode(coding FHIR.Coding):\n    if coding is null then\n        null\n    else\n        System.Code {\n          code: coding.code.value,\n          system: coding.system.value,\n          version: coding.version.value,\n          display: coding.display.value\n        }\n\ndefine function ToConcept(concept FHIR.CodeableConcept):\n    if concept is null then\n         null\n    else\n        System.Concept {\n            codes: concept.coding C return ToCode(C),\n            display: concept.text.value\n        }\n\ndefine function ToString(value FHIR.uuid): value.value\ndefine function ToString(value FHIR.TestScriptRequestMethodCode): value.value\ndefine function ToString(value FHIR.ProvenanceEntityRole): value.value\ndefine function ToString(value FHIR.UnitsOfTime): value.value\ndefine function ToString(value FHIR.AddressType): value.value\ndefine function ToString(value FHIR.AllergyIntoleranceCategory): value.value\ndefine function ToString(value FHIR.SpecimenStatus): value.value\ndefine function ToString(value FHIR.RestfulCapabilityMode): value.value\ndefine function ToString(value FHIR.DetectedIssueSeverity): value.value\ndefine function ToString(value FHIR.IssueSeverity): value.value\ndefine function ToString(value FHIR.CareTeamStatus): value.value\ndefine function ToString(value FHIR.DataElementStringency): value.value\ndefine function ToString(value FHIR.VisionEyes): value.value\ndefine function ToString(value FHIR.EncounterStatus): value.value\ndefine function ToString(value FHIR.StructureDefinitionKind): value.value\ndefine function ToString(value FHIR.PublicationStatus): value.value\ndefine function ToString(value FHIR.ConsentDataMeaning): value.value\ndefine function ToString(value FHIR.StructureMapSourceListMode): value.value\ndefine function ToString(value FHIR.RequestStatus): value.value\ndefine function ToString(value FHIR.QuestionnaireResponseStatus): value.value\ndefine function ToString(value FHIR.SearchComparator): value.value\ndefine function ToString(value FHIR.ChargeItemStatus): value.value\ndefine function ToString(value FHIR.ActionParticipantType): value.value\ndefine function ToString(value FHIR.AllergyIntoleranceType): value.value\ndefine function ToString(value FHIR.DocumentRelationshipType): value.value\ndefine function ToString(value FHIR.AllergyIntoleranceClinicalStatus): value.value\ndefine function ToString(value FHIR.CarePlanActivityStatus): value.value\ndefine function ToString(value FHIR.ActionList): value.value\ndefine function ToString(value FHIR.ParticipationStatus): value.value\ndefine function ToString(value FHIR.TestReportResult): value.value\ndefine function ToString(value FHIR.ConceptMapGroupUnmappedMode): value.value\ndefine function ToDateTime(value FHIR.instant): value.value\ndefine function ToDateTime(value FHIR.dateTime): value.value\ndefine function ToDate(value FHIR.date): value.value\ndefine function ToString(value FHIR.DocumentMode): value.value\ndefine function ToString(value FHIR.AssertionOperatorType): value.value\ndefine function ToString(value FHIR.DaysOfWeek): value.value\ndefine function ToString(value FHIR.IssueType): value.value\ndefine function ToString(value FHIR.ContentType): value.value\ndefine function ToString(value FHIR.StructureMapContextType): value.value\ndefine function ToString(value FHIR.FamilyHistoryStatus): value.value\ndefine function ToInteger(value FHIR.positiveInt): value.value\ndefine function ToString(value FHIR.ClinicalImpressionStatus): value.value\ndefine function ToString(value FHIR.AssertionResponseTypes): value.value\ndefine function ToString(value FHIR.RequestIntent): value.value\ndefine function ToString(value FHIR.NarrativeStatus): value.value\ndefine function ToString(value FHIR.MeasmntPrinciple): value.value\ndefine function ToString(value FHIR.ConsentExceptType): value.value\ndefine function ToString(value FHIR.string): value.value\ndefine function ToString(value FHIR.ActionRequiredBehavior): value.value\ndefine function ToString(value FHIR.EndpointStatus): value.value\ndefine function ToString(value FHIR.GuidePageKind): value.value\ndefine function ToString(value FHIR.GuideDependencyType): value.value\ndefine function ToString(value FHIR.ResourceVersionPolicy): value.value\ndefine function ToString(value FHIR.MedicationRequestStatus): value.value\ndefine function ToString(value FHIR.MedicationAdministrationStatus): value.value\ndefine function ToString(value FHIR.ActionCardinalityBehavior): value.value\ndefine function ToString(value FHIR.MedicationRequestIntent): value.value\ndefine function ToString(value FHIR.NamingSystemIdentifierType): value.value\ndefine function ToString(value FHIR.ImmunizationStatusCodes): value.value\ndefine function ToString(value FHIR.AccountStatus): value.value\ndefine function ToString(value FHIR.MedicationDispenseStatus): value.value\ndefine function ToString(value FHIR.ConfidentialityClassification): value.value\ndefine function ToString(value FHIR.IdentifierUse): value.value\ndefine function ToString(value FHIR.DigitalMediaType): value.value\ndefine function ToString(value FHIR.StructureMapTargetListMode): value.value\ndefine function ToString(value FHIR.TestReportParticipantType): value.value\ndefine function ToString(value FHIR.BindingStrength): value.value\ndefine function ToString(value FHIR.RequestPriority): value.value\ndefine function ToString(value FHIR.ParticipantRequired): value.value\ndefine function ToString(value FHIR.DiscriminatorType): value.value\ndefine function ToString(value FHIR.XPathUsageType): value.value\ndefine function ToString(value FHIR.StructureMapInputMode): value.value\ndefine function ToString(value FHIR.InstanceAvailability): value.value\ndefine function ToString(value FHIR.id): value.value\ndefine function ToString(value FHIR.LinkageType): value.value\ndefine function ToString(value FHIR.ReferenceHandlingPolicy): value.value\ndefine function ToString(value FHIR.MedicationStatus): value.value\ndefine function ToString(value FHIR.FilterOperator): value.value\ndefine function ToString(value FHIR.NamingSystemType): value.value\ndefine function ToString(value FHIR.ResearchStudyStatus): value.value\ndefine function ToString(value FHIR.ExtensionContext): value.value\ndefine function ToString(value FHIR.FHIRDefinedType): value.value\ndefine function ToString(value FHIR.AuditEventOutcome): value.value\ndefine function ToString(value FHIR.ActionRelationshipType): value.value\ndefine function ToString(value FHIR.ConstraintSeverity): value.value\ndefine function ToString(value FHIR.EventCapabilityMode): value.value\ndefine function ToString(value FHIR.ContractResourceStatusCodes): value.value\ndefine function ToString(value FHIR.ResearchSubjectStatus): value.value\ndefine function ToString(value FHIR.UDIEntryType): value.value\ndefine function ToString(value FHIR.DeviceMetricCategory): value.value\ndefine function ToString(value FHIR.TestReportActionResult): value.value\ndefine function ToString(value FHIR.StructureMapTransform): value.value\ndefine function ToString(value FHIR.ResponseType): value.value\ndefine function ToDecimal(value FHIR.decimal): value.value\ndefine function ToString(value FHIR.AggregationMode): value.value\ndefine function ToString(value FHIR.CapabilityStatementKind): value.value\ndefine function ToString(value FHIR.AllergyIntoleranceVerificationStatus): value.value\ndefine function ToString(value FHIR.EventTiming): value.value\ndefine function ToString(value FHIR.GoalStatus): value.value\ndefine function ToString(value FHIR.SearchParamType): value.value\ndefine function ToString(value FHIR.SystemRestfulInteraction): value.value\ndefine function ToString(value FHIR.ActionGroupingBehavior): value.value\ndefine function ToString(value FHIR.StructureMapModelMode): value.value\ndefine function ToString(value FHIR.TaskStatus): value.value\ndefine function ToString(value FHIR.AdverseEventCausality): value.value\ndefine function ToString(value FHIR.SubscriptionChannelType): value.value\ndefine function ToString(value FHIR.GraphCompartmentRule): value.value\ndefine function ToString(value FHIR.AssertionDirectionType): value.value\ndefine function ToString(value FHIR.CarePlanIntent): value.value\ndefine function ToString(value FHIR.SlicingRules): value.value\ndefine function ToString(value FHIR.ExplanationOfBenefitStatus): value.value\ndefine function ToString(value FHIR.ConsentState): value.value\ndefine function ToString(value FHIR.AdverseEventCategory): value.value\ndefine function ToString(value FHIR.LinkType): value.value\ndefine function ToString(value FHIR.AllergyIntoleranceCriticality): value.value\ndefine function ToString(value FHIR.MedicationRequestPriority): value.value\ndefine function ToString(value FHIR.ConceptMapEquivalence): value.value\ndefine function ToString(value FHIR.FHIRAllTypes): value.value\ndefine function ToString(value FHIR.PropertyRepresentation): value.value\ndefine function ToString(value FHIR.AuditEventAction): value.value\ndefine function ToString(value FHIR.TriggerType): value.value\ndefine function ToString(value FHIR.SearchModifierCode): value.value\ndefine function ToString(value FHIR.CompositionStatus): value.value\ndefine function ToString(value FHIR.AppointmentStatus): value.value\ndefine function ToString(value FHIR.MessageSignificanceCategory): value.value\ndefine function ToString(value FHIR.EventStatus): value.value\ndefine function ToString(value FHIR.OperationParameterUse): value.value\ndefine function ToString(value FHIR.ListMode): value.value\ndefine function ToString(value FHIR.ActionConditionKind): value.value\ndefine function ToString(value FHIR.ObservationStatus): value.value\ndefine function ToString(value FHIR.qualityType): value.value\ndefine function ToString(value FHIR.AdministrativeGender): value.value\ndefine function ToString(value FHIR.ResourceType): value.value\ndefine function ToString(value FHIR.QuestionnaireItemType): value.value\ndefine function ToBoolean(value FHIR.boolean): value.value\ndefine function ToString(value FHIR.StructureMapGroupTypeMode): value.value\ndefine function ToString(value FHIR.DeviceMetricCalibrationType): value.value\ndefine function ToString(value FHIR.code): value.value\ndefine function ToString(value FHIR.SupplyRequestStatus): value.value\ndefine function ToString(value FHIR.ActionSelectionBehavior): value.value\ndefine function ToString(value FHIR.EncounterLocationStatus): value.value\ndefine function ToString(value FHIR.SupplyDeliveryStatus): value.value\ndefine function ToString(value FHIR.DiagnosticReportStatus): value.value\ndefine function ToString(value FHIR.FlagStatus): value.value\ndefine function ToString(value FHIR.CarePlanStatus): value.value\ndefine function ToString(value FHIR.ConditionClinicalStatusCodes): value.value\ndefine function ToString(value FHIR.ListStatus): value.value\ndefine function Tobase64Binary(value FHIR.base64Binary): value.value\ndefine function ToString(value FHIR.DeviceUseStatementStatus): value.value\ndefine function ToString(value FHIR.AuditEventAgentNetworkType): value.value\ndefine function ToString(value FHIR.AddressUse): value.value\ndefine function ToString(value FHIR.ConditionalDeleteStatus): value.value\ndefine function ToString(value FHIR.ContactPointUse): value.value\ndefine function ToString(value FHIR.DeviceMetricOperationalStatus): value.value\ndefine function ToString(value FHIR.NutritionOrderStatus): value.value\ndefine function ToString(value FHIR.uri): value.value\ndefine function ToString(value FHIR.ContributorType): value.value\ndefine function ToString(value FHIR.ReferenceVersionRules): value.value\ndefine function ToString(value FHIR.Use): value.value\ndefine function ToString(value FHIR.IdentityAssuranceLevel): value.value\ndefine function ToString(value FHIR.MeasureReportStatus): value.value\ndefine function ToString(value FHIR.DeviceMetricColor): value.value\ndefine function ToString(value FHIR.SearchEntryMode): value.value\ndefine function ToTime(value FHIR.time): value.value\ndefine function ToString(value FHIR.ConditionalReadStatus): value.value\ndefine function ToString(value FHIR.ConditionVerificationStatus): value.value\ndefine function ToString(value FHIR.AllergyIntoleranceSeverity): value.value\ndefine function ToString(value FHIR.FinancialResourceStatusCodes): value.value\ndefine function ToString(value FHIR.OperationKind): value.value\ndefine function ToString(value FHIR.ObservationRelationshipType): value.value\ndefine function ToInteger(value FHIR.unsignedInt): value.value\ndefine function ToString(value FHIR.NameUse): value.value\ndefine function ToString(value FHIR.SubscriptionStatus): value.value\ndefine function ToString(value FHIR.DocumentReferenceStatus): value.value\ndefine function ToString(value FHIR.LocationMode): value.value\ndefine function ToInteger(value FHIR.integer): value.value\ndefine function ToString(value FHIR.repositoryType): value.value\ndefine function ToString(value FHIR.LocationStatus): value.value\ndefine function ToString(value FHIR.FHIRSubstanceStatus): value.value\ndefine function ToString(value FHIR.UnknownContentCode): value.value\ndefine function ToString(value FHIR.NoteType): value.value\ndefine function ToString(value FHIR.TestReportStatus): value.value\ndefine function ToString(value FHIR.HTTPVerb): value.value\ndefine function ToString(value FHIR.CodeSystemContentMode): value.value\ndefine function ToString(value FHIR.EpisodeOfCareStatus): value.value\ndefine function ToString(value FHIR.RemittanceOutcome): value.value\ndefine function ToString(value FHIR.FHIRDeviceStatus): value.value\ndefine function ToString(value FHIR.ContactPointSystem): value.value\ndefine function ToString(value FHIR.SlotStatus): value.value\ndefine function ToString(value FHIR.PropertyType): value.value\ndefine function ToString(value FHIR.markdown): value.value\ndefine function ToString(value FHIR.TypeDerivationRule): value.value\ndefine function ToString(value FHIR.MedicationStatementStatus): value.value\ndefine function ToString(value FHIR.GuidanceResponseStatus): value.value\ndefine function ToString(value FHIR.QuantityComparator): value.value\ndefine function ToString(value FHIR.RelatedArtifactType): value.value\ndefine function ToString(value FHIR.oid): value.value\ndefine function ToString(value FHIR.MeasureReportType): value.value\ndefine function ToString(value FHIR.ActionPrecheckBehavior): value.value\ndefine function ToString(value FHIR.SampledDataDataType): value.value\ndefine function ToString(value FHIR.MedicationStatementTaken): value.value\ndefine function ToString(value FHIR.CompartmentType): value.value\ndefine function ToString(value FHIR.CompositionAttestationMode): value.value\ndefine function ToString(value FHIR.DeviceMetricCalibrationState): value.value\ndefine function ToString(value FHIR.GroupType): value.value\ndefine function ToString(value FHIR.TypeRestfulInteraction): value.value\ndefine function ToString(value FHIR.CodeSystemHierarchyMeaning): value.value\ndefine function ToString(value FHIR.VisionBase): value.value\ndefine function ToString(value FHIR.BundleType): value.value\ndefine function ToString(value FHIR.SystemVersionProcessingMode): value.value\n</code></pre>\n                    \n                    \n                </td>\n            </tr>\n        \n    </table>\n</div>"
        },
        "version": "3.0.0",
        "name": "FHIRHelpers",
        "status": "active",
        "experimental": true,
        "type": {
          "coding": [
            {
              "system": "http://hl7.org/fhir/library-type",
              "code": "logic-library"
            }
          ]
        },
        "content": [
          {
            "contentType": "application/elm+xml",
            "data": "[encoded data, 122448 characters]"
          },
          {
            "contentType": "text/cql",
            "data": "[encoded data, 20760 characters]"
          }
        ]
      },
      "request": {
        "method": "PUT",
        "url": "Library/library-FHIRHelpers-3.0.0"
      }
    },
    {
      "resource": {
        "resourceType": "Library",
        "id": "library-MATGlobalCommonFunctions-FHIR3-4.0.000",
        "text": {
          "status": "generated",
          "div": "<div xmlns=\"http://www.w3.org/1999/xhtml\"><table class=\"grid dict\"><tr><th scope=\"row\"><b>Id: </b></th><td style=\"padding-left: 25px; padding-right: 25px;\">library-MATGlobalCommonFunctions-FHIR3-4.0.000</td></tr><tr><th scope=\"row\"><b>Type: </b></th><td style=\"padding-right: 25px;\"> Logic Library </td></tr><tr><th scope=\"row\"><b>Version: </b></th><td style=\"padding-left: 25px; padding-right: 25px;\">4.0.000</td></tr><tr><th scope=\"row\"><b>Status: </b></th><td style=\"padding-left: 25px; padding-right: 25px;\">active</td></tr><tr style=\"vertical-align: top;\"><th rowspan=\"1\" scope=\"row\"><b>Related: </b></th><td style=\"padding-left: 25px; padding-right: 25px;\"><p style=\"margin-bottom: 5px;\"><b>type: </b><span>depends-on</span></p><p style=\"margin-bottom: 5px;\"><b>Resource: </b><br/><span><span style=\"padding-left: 25px;\"><b>reference: </b><span>Library/library-FHIRHelpers-3.0.0</span></span></span></p></td></tr><tr style=\"vertical-align: top;\"><th rowspan=\"9\" scope=\"row\"><b>Data Requirements: </b></th><td style=\"padding-left: 25px; padding-right: 25px;\"><div xmlns=\"http://www.w3.org/1999/xhtml\"><p style=\"margin-bottom: 5px;\"><b>type: </b><span>Encounter</span></p><p style=\"margin-bottom: 5px;\"><b>code filter:</b><br/><span style=\"padding-left: 25px;\"><b>path: </b><span>type</span></span><br/><span style=\"padding-left: 25px;\"><b>valueset: </b><span>http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.666.5.307</span></span></p></div></td></tr><tr style=\"vertical-align: top;\"><td style=\"padding-left: 25px; padding-right: 25px;\"><div xmlns=\"http://www.w3.org/1999/xhtml\"><p style=\"margin-bottom: 5px;\"><b>type: </b><span>Encounter</span></p><p style=\"margin-bottom: 5px;\"><b>code filter:</b><br/><span style=\"padding-left: 25px;\"><b>path: </b><span>type</span></span><br/><span style=\"padding-left: 25px;\"><b>valueset: </b><span>http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.292</span></span></p></div></td></tr><tr style=\"vertical-align: top;\"><td style=\"padding-left: 25px; padding-right: 25px;\"><div xmlns=\"http://www.w3.org/1999/xhtml\"><p style=\"margin-bottom: 5px;\"><b>type: </b><span>Encounter</span></p><p style=\"margin-bottom: 5px;\"><b>code filter:</b><br/><span style=\"padding-left: 25px;\"><b>path: </b><span>type</span></span><br/><span style=\"padding-left: 25px;\"><b>valueset: </b><span>http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1111.143</span></span></p></div></td></tr><tr style=\"vertical-align: top;\"><td style=\"padding-left: 25px; padding-right: 25px;\"><div xmlns=\"http://www.w3.org/1999/xhtml\"><p style=\"margin-bottom: 5px;\"><b>type: </b><span>Encounter</span></p><p style=\"margin-bottom: 5px;\"><b>code filter:</b><br/><span style=\"padding-left: 25px;\"><b>path: </b><span>type</span></span><br/><span style=\"padding-left: 25px;\"><b>valueset: </b><span>http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.292</span></span></p></div></td></tr><tr style=\"vertical-align: top;\"><td style=\"padding-left: 25px; padding-right: 25px;\"><div xmlns=\"http://www.w3.org/1999/xhtml\"><p style=\"margin-bottom: 5px;\"><b>type: </b><span>Condition</span></p></div></td></tr><tr style=\"vertical-align: top;\"><td style=\"padding-left: 25px; padding-right: 25px;\"><div xmlns=\"http://www.w3.org/1999/xhtml\"><p style=\"margin-bottom: 5px;\"><b>type: </b><span>Condition</span></p></div></td></tr><tr style=\"vertical-align: top;\"><td style=\"padding-left: 25px; padding-right: 25px;\"><div xmlns=\"http://www.w3.org/1999/xhtml\"><p style=\"margin-bottom: 5px;\"><b>type: </b><span>Location</span></p></div></td></tr><tr style=\"vertical-align: top;\"><td style=\"padding-left: 25px; padding-right: 25px;\"><div xmlns=\"http://www.w3.org/1999/xhtml\"><p style=\"margin-bottom: 5px;\"><b>type: </b><span>Provenance</span></p><p style=\"margin-bottom: 5px;\"><b>code filter:</b><br/><span style=\"padding-left: 25px;\"><b>path: </b><span>target</span></span></p></div></td></tr><tr style=\"vertical-align: top;\"><td style=\"padding-left: 25px; padding-right: 25px;\"><div xmlns=\"http://www.w3.org/1999/xhtml\"><p style=\"margin-bottom: 5px;\"><b>type: </b><span>Medication</span></p><p style=\"margin-bottom: 5px;\"><b>code filter:</b><br/><span style=\"padding-left: 25px;\"><b>path: </b><span>id</span></span></p></div></td></tr><tr style=\"vertical-align: top;\"><th scope=\"row\"><b>Content: </b></th><td style=\"padding-left: 25px; padding-right: 25px;\"><b>type: </b><span>text/cql</span></td></tr><tr><td colspan=\"2\" style=\"padding-left: 25px; padding-right: 25px;\"><pre><code class=\"language-cql\">library MATGlobalCommonFunctions_FHIR3 version '4.0.000'\n\n/*\nThis example is a work in progress and should not be considered a final specification\nor recommendation for guidance. This example will help guide and direct the process\nof finding conventions and usage patterns that meet the needs of the various stakeholders\nin the measure development community.\n*/\n\nusing FHIR version '3.0.0'\n\ninclude FHIRHelpers version '3.0.0' called FHIRHelpers\n\ncodesystem &quot;LOINC&quot;: 'http://loinc.org'\ncodesystem &quot;SNOMEDCT&quot;: 'http://snomed.info/sct/731000124108'\ncodesystem &quot;RoleCode&quot;: 'http://hl7.org/fhir/v3/RoleCode'\ncodesystem &quot;Diagnosis Role&quot;: 'http://hl7.org/fhir/diagnosis-role'\n\nvalueset &quot;Encounter Inpatient&quot;: 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.666.5.307'\nvalueset &quot;Emergency Department Visit&quot;: 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.292'\nvalueset &quot;Observation Services&quot;: 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1111.143'\n\ncode &quot;Birthdate&quot;: '21112-8' from &quot;LOINC&quot; display 'Birth date'\ncode &quot;Dead&quot;: '419099009' from &quot;SNOMEDCT&quot; display 'Dead'\ncode &quot;ER&quot;: 'ER' from &quot;RoleCode&quot; display 'Emergency room'\ncode &quot;ICU&quot;: 'ICU' from &quot;RoleCode&quot; display 'Intensive care unit'\ncode &quot;Billing&quot;: 'billing' from &quot;Diagnosis Role&quot; display 'Billing'\n\nparameter &quot;Measurement Period&quot; Interval&lt;DateTime&gt;\n\ncontext Patient\n\ndefine &quot;Inpatient Encounter&quot;:\n\t[Encounter: &quot;Encounter Inpatient&quot;] EncounterInpatient\n\t\twhere EncounterInpatient.status = 'finished'\n\t\t  and &quot;LengthInDays&quot;(EncounterInpatient.period) &lt;= 120\n\t\t\tand EncounterInpatient.period ends during &quot;Measurement Period&quot;\n\ndefine function &quot;ToDate&quot;(Value DateTime):\n\tDateTime(year from Value, month from Value, day from Value, 0, 0, 0, 0, timezone from Value)\n\ndefine function &quot;CalendarAgeInDaysAt&quot;(BirthDateTime DateTime, AsOf DateTime):\n\tdays between ToDate(BirthDateTime)and ToDate(AsOf)\n\ndefine function &quot;CalendarAgeInDays&quot;(BirthDateTime DateTime):\n\tCalendarAgeInDaysAt(BirthDateTime, Today())\n\ndefine function &quot;CalendarAgeInMonthsAt&quot;(BirthDateTime DateTime, AsOf DateTime):\n\tmonths between ToDate(BirthDateTime)and ToDate(AsOf)\n\ndefine function &quot;CalendarAgeInMonths&quot;(BirthDateTime DateTime):\n\tCalendarAgeInMonthsAt(BirthDateTime, Today())\n\ndefine function &quot;CalendarAgeInYearsAt&quot;(BirthDateTime DateTime, AsOf DateTime):\n\tyears between ToDate(BirthDateTime)and ToDate(AsOf)\n\ndefine function &quot;CalendarAgeInYears&quot;(BirthDateTime DateTime):\n\tCalendarAgeInYearsAt(BirthDateTime, Today())\n\ndefine function &quot;LengthInDays&quot;(Value Interval&lt;DateTime&gt;):\n\tdifference in days between start of Value and end of Value\n\ndefine function &quot;ED Visit&quot;(TheEncounter FHIR.Encounter):\n    singleton from (\n        [Encounter: &quot;Emergency Department Visit&quot;] EDVisit\n            where EDVisit.status = 'finished'\n                and EDVisit.period ends 1 hour or less on or before start of FHIRHelpers.ToInterval(TheEncounter.period)\n    )\n\ndefine function &quot;Hospitalization&quot;(TheEncounter FHIR.Encounter):\n\t( &quot;ED Visit&quot;(TheEncounter) ) X\n    return\n        if X is null then TheEncounter.period\n        else Interval[start of FHIRHelpers.ToInterval(X.period), end of FHIRHelpers.ToInterval(TheEncounter.period)]\n\ndefine function &quot;Hospitalization Locations&quot;(TheEncounter FHIR.Encounter):\n\t( &quot;ED Visit&quot;(TheEncounter) ) EDEncounter\n    return\n        if EDEncounter is null then TheEncounter.location\n        else flatten { EDEncounter.location, TheEncounter.location }\n\ndefine function &quot;Hospitalization Length of Stay&quot;(TheEncounter FHIR.Encounter):\n\tLengthInDays(&quot;Hospitalization&quot;(TheEncounter))\n\ndefine function &quot;Hospital Admission Time&quot;(TheEncounter FHIR.Encounter):\n\tstart of &quot;Hospitalization&quot;(TheEncounter)\n\ndefine function &quot;Hospital Discharge Time&quot;(TheEncounter FHIR.Encounter):\n\tend of FHIRHelpers.ToInterval(TheEncounter.period)\n\ndefine function &quot;Hospital Arrival Time&quot;(TheEncounter FHIR.Encounter):\n\tstart of FHIRHelpers.ToInterval(First(\n\t    ( &quot;Hospitalization Locations&quot;(TheEncounter) ) HospitalLocation\n\t\t\tsort by start of FHIRHelpers.ToInterval(period)\n\t).period)\n\ndefine function &quot;HospitalizationWithObservation&quot;(TheEncounter FHIR.Encounter):\n\tTheEncounter Visit\n\t\tlet ObsVisit: Last([Encounter: &quot;Observation Services&quot;] LastObs\n\t\t\t\twhere LastObs.period ends 1 hour or less on or before start of Visit.period\n\t\t\t\tsort by end of period\n\t\t\t),\n\t\t\tVisitStart: Coalesce(start of ObsVisit.period, start of Visit.period),\n\t\t\tEDVisit: Last([Encounter: &quot;Emergency Department Visit&quot;] LastED\n\t\t\t\twhere LastED.period ends 1 hour or less on or before VisitStart\n\t\t\t\tsort by end of period\n\t\t\t)\n\t\treturn Interval[Coalesce(start of EDVisit.period, VisitStart), end of Visit.period]\n\ndefine function &quot;HospitalizationWithObservationLengthofStay&quot;(Encounter FHIR.Encounter):\n\t&quot;LengthInDays&quot;(&quot;HospitalizationWithObservation&quot;(Encounter))\n\n// TODO - fix these (must fetch Location resources and compare id to reference)\n/*define function &quot;Hospital Departure Time&quot;(TheEncounter FHIR.Encounter):\n\tend of FHIRHelpers.ToInterval(Last(\n\t    ( &quot;Hospitalization Locations&quot;(TheEncounter) ) HospitalLocation\n\t\t\tsort by start of FHIRHelpers.ToInterval(period)\n\t).period)\n\ndefine function &quot;Emergency Department Arrival Time&quot;(TheEncounter FHIR.Encounter):\n\tstart of FHIRHelpers.ToInterval((\n\t    singleton from (\n\t        ( &quot;Hospitalization Locations&quot;(TheEncounter) ) HospitalLocation\n\t\t\t\twhere HospitalLocation.type ~ &quot;ER&quot;\n\t\t)\n\t).period)\n\ndefine function &quot;First Inpatient Intensive Care Unit&quot;(TheEncounter FHIR.Encounter):\n\tFirst(\n\t    ( TheEncounter.location ) HospitalLocation\n\t\t\twhere HospitalLocation.type ~ &quot;ICU&quot;\n\t\t\t\tand HospitalLocation.period during TheEncounter.period\n\t\t\tsort by start of FHIRHelpers.ToInterval(period)\n\t)*/\n\n/*\n*\n*    CQFMeasures Common Logic\n*\n*/\n\ndefine function &quot;Normalize Onset&quot;(onset Choice&lt;FHIR.dateTime, FHIR.Age, FHIR.Period, FHIR.Range, FHIR.string&gt;):\n  if onset is FHIR.dateTime then\n\t  Interval[FHIRHelpers.ToDateTime(onset as FHIR.dateTime), FHIRHelpers.ToDateTime(onset as FHIR.dateTime)]\n\telse if onset is FHIR.Period then\n\t  FHIRHelpers.ToInterval(onset as FHIR.Period)\n\telse if onset is FHIR.Age then\n\t  Interval[FHIRHelpers.ToDate(Patient.birthDate) + FHIRHelpers.ToQuantity(onset as FHIR.Age),\n\t\t  FHIRHelpers.ToDate(Patient.birthDate) + FHIRHelpers.ToQuantity(onset as FHIR.Age) + 1 year)\n\telse null\n\ndefine function &quot;Normalize Abatement&quot;(condition Condition):\n\tif condition.abatement is FHIR.dateTime then\n\t  Interval[FHIRHelpers.ToDateTime(condition.abatement as FHIR.dateTime), FHIRHelpers.ToDateTime(condition.abatement as FHIR.dateTime)]\n\telse if condition.abatement is FHIR.Period then\n\t  FHIRHelpers.ToInterval(condition.abatement as FHIR.Period)\n\telse if condition.abatement is FHIR.Age then\n\t\tInterval[FHIRHelpers.ToDate(Patient.birthDate) + FHIRHelpers.ToQuantity(condition.abatement as FHIR.Age),\n\t\t\tFHIRHelpers.ToDate(Patient.birthDate) + FHIRHelpers.ToQuantity(condition.abatement as FHIR.Age) + 1 year)\n\telse if condition.abatement is FHIR.boolean then\n\t  Interval[end of &quot;Normalize Onset&quot;(condition.onset), condition.assertedDate)\n\telse null\n\ndefine function &quot;GetPrevalencePeriod&quot;(condition Condition):\n  Interval[start of &quot;Normalize Onset&quot;(condition.onset), end of &quot;Normalize Abatement&quot;(condition))\n\ndefine function &quot;Normalize Interval&quot;(choice Choice&lt;FHIR.dateTime, FHIR.Period&gt;):\n  if choice is FHIR.dateTime then\n\t  Interval[FHIRHelpers.ToDateTime(choice as FHIR.dateTime), FHIRHelpers.ToDateTime(choice as FHIR.dateTime)]\n\telse\n\t  FHIRHelpers.ToInterval(choice as FHIR.Period)\n\ndefine function &quot;GetId&quot;(uri String):\n\tLast(Split(uri, '/'))\n\ndefine function &quot;EncounterDiagnosis&quot;(Encounter Encounter):\n  Encounter.diagnosis D\n    return singleton from ([Condition] Condition where Condition.id.value = &quot;GetId&quot;(D.condition.reference))\n\n// Returns the condition that is specified as the principal diagnosis for the encounter\ndefine function &quot;PrincipalDiagnosis&quot;(Encounter Encounter):\n\t(singleton from (Encounter.diagnosis D where D.role ~ ToConcept(&quot;Billing&quot;) and D.rank = 1)) PD\n\t//&quot;GetId&quot;(uri String): returns the last String of a Split by / List therefor cannot use in\n\t\treturn singleton from ([Condition] Condition where Condition.id.value = &quot;GetId&quot;(PD.condition.reference))\n\n// Returns the location for the given location reference\ndefine function GetLocation(reference Reference):\n  singleton from (\n    [Location] Location where Location.id.value = GetId(reference.reference)\n  )\n\n/*\nNOTE: Extensions are not the preferred approach, but are used as a way to access\ncontent that is defined by extensions but not yet surfaced in the\nCQL model info.\n*/\ndefine function &quot;GetExtensions&quot;(domainResource DomainResource, url String):\n  domainResource.extension E\n\t  where E.url = ('http://hl7.org/fhir/us/qicore/StructureDefinition/' + url)\n\t\treturn E\n\ndefine function &quot;GetExtension&quot;(domainResource DomainResource, url String):\n  singleton from &quot;GetExtensions&quot;(domainResource, url)\n\n/*\nNOTE: Extensions are not the preferred approach, but are used as a way to access\ncontent that is defined by extensions but not yet surfaced in the\nCQL model info.\n*/\ndefine function &quot;GetBaseExtensions&quot;(domainResource DomainResource, url String):\n  domainResource.extension E\n\t  where E.url = ('http://hl7.org/fhir/StructureDefinition/' + url)\n\t\treturn E\n\ndefine function &quot;GetBaseExtension&quot;(domainResource DomainResource, url String):\n  singleton from &quot;GetBaseExtensions&quot;(domainResource, url)\n\n/*\nNOTE: Provenance is not the preferred approach, this is provided only as an illustration\nfor what using Provenance could look like, and is not a tested pattern\n*/\ndefine function &quot;GetProvenance&quot;(resource Resource):\n  singleton from ([Provenance: target in resource.id])\n\ndefine function &quot;GetMedicationCode&quot;(request MedicationRequest):\n  if request.medication is CodeableConcept then\n\t  request.medication as CodeableConcept\n\telse\n\t  (singleton from ([Medication: id in GetId((request.medication as Reference).reference)])).code\n</code></pre>\n                    \n                    \n                </td>\n            </tr>\n        \n    </table>\n</div>"
        },
        "version": "4.0.000",
        "name": "MATGlobalCommonFunctions_FHIR3",
        "status": "active",
        "experimental": true,
        "type": {
          "coding": [
            {
              "system": "http://hl7.org/fhir/library-type",
              "code": "logic-library"
            }
          ]
        },
        "relatedArtifact": [
          {
            "type": "depends-on",
            "resource": {
              "reference": "Library/library-FHIRHelpers-3.0.0"
            }
          }
        ],
        "dataRequirement": [
          {
            "type": "Encounter",
            "codeFilter": [
              {
                "path": "type",
                "valueSetString": "http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.666.5.307"
              }
            ]
          },
          {
            "type": "Encounter",
            "codeFilter": [
              {
                "path": "type",
                "valueSetString": "http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.292"
              }
            ]
          },
          {
            "type": "Encounter",
            "codeFilter": [
              {
                "path": "type",
                "valueSetString": "http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1111.143"
              }
            ]
          },
          {
            "type": "Encounter",
            "codeFilter": [
              {
                "path": "type",
                "valueSetString": "http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.292"
              }
            ]
          },
          {
            "type": "Condition"
          },
          {
            "type": "Condition"
          },
          {
            "type": "Location"
          },
          {
            "type": "Provenance",
            "codeFilter": [
              {
                "path": "target"
              }
            ]
          },
          {
            "type": "Medication",
            "codeFilter": [
              {
                "path": "id"
              }
            ]
          }
        ],
        "content": [
          {
            "contentType": "application/elm+xml",
            "data": "[encoded data, 98464 characters]"
          },
          {
            "contentType": "text/cql",
            "data": "[encoded data, 13216 characters]"
          }
        ]
      },
      "request": {
        "method": "PUT",
        "url": "Library/library-MATGlobalCommonFunctions-FHIR3-4.0.000"
      }
    },
    {
      "resource": {
        "resourceType": "Library",
        "id": "library-SupplementalDataElements-FHIR3-1.0.0",
        "text": {
          "status": "generated",
          "div": "<div xmlns=\"http://www.w3.org/1999/xhtml\"><table class=\"grid dict\"><tr><th scope=\"row\"><b>Id: </b></th><td style=\"padding-left: 25px; padding-right: 25px;\">library-SupplementalDataElements-FHIR3-1.0.0</td></tr><tr><th scope=\"row\"><b>Type: </b></th><td style=\"padding-right: 25px;\"> Logic Library </td></tr><tr><th scope=\"row\"><b>Version: </b></th><td style=\"padding-left: 25px; padding-right: 25px;\">1.0.0</td></tr><tr><th scope=\"row\"><b>Status: </b></th><td style=\"padding-left: 25px; padding-right: 25px;\">active</td></tr><tr style=\"vertical-align: top;\"><th rowspan=\"1\" scope=\"row\"><b>Related: </b></th><td style=\"padding-left: 25px; padding-right: 25px;\"><p style=\"margin-bottom: 5px;\"><b>type: </b><span>depends-on</span></p><p style=\"margin-bottom: 5px;\"><b>Resource: </b><br/><span><span style=\"padding-left: 25px;\"><b>reference: </b><span>Library/library-FHIRHelpers-3.0.0</span></span></span></p></td></tr><tr style=\"vertical-align: top;\"><th rowspan=\"1\" scope=\"row\"><b>Data Requirements: </b></th><td style=\"padding-left: 25px; padding-right: 25px;\"><div xmlns=\"http://www.w3.org/1999/xhtml\"><p style=\"margin-bottom: 5px;\"><b>type: </b><span>Coverage</span></p><p style=\"margin-bottom: 5px;\"><b>code filter:</b><br/><span style=\"padding-left: 25px;\"><b>path: </b><span>type</span></span><br/><span style=\"padding-left: 25px;\"><b>valueset: </b><span>http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.114222.4.11.3591</span></span></p></div></td></tr><tr style=\"vertical-align: top;\"><th scope=\"row\"><b>Content: </b></th><td style=\"padding-left: 25px; padding-right: 25px;\"><b>type: </b><span>text/cql</span></td></tr><tr><td colspan=\"2\" style=\"padding-left: 25px; padding-right: 25px;\"><pre><code class=\"language-cql\">library SupplementalDataElements_FHIR3 version '1.0.0'\n\nusing FHIR version '3.0.0'\n\ninclude FHIRHelpers version '3.0.0' called FHIRHelpers\n\nvalueset &quot;ONC Administrative Sex&quot;: 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1'\nvalueset &quot;Race&quot;: 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.114222.4.11.836'\nvalueset &quot;Ethnicity&quot;: 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.114222.4.11.837'\nvalueset &quot;Payer&quot;: 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.114222.4.11.3591'\n\ncontext Patient\n\ndefine &quot;SDE Ethnicity&quot;:\n  (flatten (\n    Patient.extension Extension\n      where Extension.url = 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-ethnicity'\n        return Extension.extension\n  )) E\n    where E.url = 'ombCategory'\n      or E.url = 'detailed'\n    return E.value as Coding\n\ndefine &quot;SDE Payer&quot;:\n    [Coverage: type in &quot;Payer&quot;] Payer\n      return {\n        code: Payer.type,\n        period: Payer.period\n      }\n\ndefine &quot;SDE Race&quot;:\n  (flatten (\n    Patient.extension Extension\n      where Extension.url = 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-race'\n        return Extension.extension\n  )) E\n    where E.url = 'ombCategory'\n      or E.url = 'detailed'\n    return E.value as Coding\n\ndefine &quot;SDE Sex&quot;:\n  case\n    when Patient.gender = 'male' then Code { code: 'M', system: 'http://hl7.org/fhir/v3/AdministrativeGender', display: 'Male' }\n    when Patient.gender = 'female' then Code { code: 'F', system: 'http://hl7.org/fhir/v3/AdministrativeGender', display: 'Female' }\n    else null\n  end\n</code></pre>\n                    \n                    \n                </td>\n            </tr>\n        \n    </table>\n</div>"
        },
        "version": "1.0.0",
        "name": "SupplementalDataElements_FHIR3",
        "status": "active",
        "experimental": true,
        "type": {
          "coding": [
            {
              "system": "http://hl7.org/fhir/library-type",
              "code": "logic-library"
            }
          ]
        },
        "relatedArtifact": [
          {
            "type": "depends-on",
            "resource": {
              "reference": "Library/library-FHIRHelpers-3.0.0"
            }
          }
        ],
        "dataRequirement": [
          {
            "type": "Coverage",
            "codeFilter": [
              {
                "path": "type",
                "valueSetString": "http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.114222.4.11.3591"
              }
            ]
          }
        ],
        "content": [
          {
            "contentType": "application/elm+xml",
            "data": "[encoded data, 11480 characters]"
          },
          {
            "contentType": "text/cql",
            "data": "bGlicmFyeSBTdXBwbGVtZW50YWxEYXRhRWxlbWVudHNfRkhJUjMgdmVyc2lvbiAnMS4wLjAnCgp1c2luZyBGSElSIHZlcnNpb24gJzMuMC4wJwoKaW5jbHVkZSBGSElSSGVscGVycyB2ZXJzaW9uICczLjAuMCcgY2FsbGVkIEZISVJIZWxwZXJzCgp2YWx1ZXNldCAiT05DIEFkbWluaXN0cmF0aXZlIFNleCI6ICdodHRwOi8vY3RzLm5sbS5uaWguZ292L2ZoaXIvVmFsdWVTZXQvMi4xNi44NDAuMS4xMTM3NjIuMS40LjEnCnZhbHVlc2V0ICJSYWNlIjogJ2h0dHA6Ly9jdHMubmxtLm5paC5nb3YvZmhpci9WYWx1ZVNldC8yLjE2Ljg0MC4xLjExNDIyMi40LjExLjgzNicKdmFsdWVzZXQgIkV0aG5pY2l0eSI6ICdodHRwOi8vY3RzLm5sbS5uaWguZ292L2ZoaXIvVmFsdWVTZXQvMi4xNi44NDAuMS4xMTQyMjIuNC4xMS44MzcnCnZhbHVlc2V0ICJQYXllciI6ICdodHRwOi8vY3RzLm5sbS5uaWguZ292L2ZoaXIvVmFsdWVTZXQvMi4xNi44NDAuMS4xMTQyMjIuNC4xMS4zNTkxJwoKY29udGV4dCBQYXRpZW50CgpkZWZpbmUgIlNERSBFdGhuaWNpdHkiOgogIChmbGF0dGVuICgKICAgIFBhdGllbnQuZXh0ZW5zaW9uIEV4dGVuc2lvbgogICAgICB3aGVyZSBFeHRlbnNpb24udXJsID0gJ2h0dHA6Ly9obDcub3JnL2ZoaXIvdXMvY29yZS9TdHJ1Y3R1cmVEZWZpbml0aW9uL3VzLWNvcmUtZXRobmljaXR5JwogICAgICAgIHJldHVybiBFeHRlbnNpb24uZXh0ZW5zaW9uCiAgKSkgRQogICAgd2hlcmUgRS51cmwgPSAnb21iQ2F0ZWdvcnknCiAgICAgIG9yIEUudXJsID0gJ2RldGFpbGVkJwogICAgcmV0dXJuIEUudmFsdWUgYXMgQ29kaW5nCgpkZWZpbmUgIlNERSBQYXllciI6CiAgICBbQ292ZXJhZ2U6IHR5cGUgaW4gIlBheWVyIl0gUGF5ZXIKICAgICAgcmV0dXJuIHsKICAgICAgICBjb2RlOiBQYXllci50eXBlLAogICAgICAgIHBlcmlvZDogUGF5ZXIucGVyaW9kCiAgICAgIH0KCmRlZmluZSAiU0RFIFJhY2UiOgogIChmbGF0dGVuICgKICAgIFBhdGllbnQuZXh0ZW5zaW9uIEV4dGVuc2lvbgogICAgICB3aGVyZSBFeHRlbnNpb24udXJsID0gJ2h0dHA6Ly9obDcub3JnL2ZoaXIvdXMvY29yZS9TdHJ1Y3R1cmVEZWZpbml0aW9uL3VzLWNvcmUtcmFjZScKICAgICAgICByZXR1cm4gRXh0ZW5zaW9uLmV4dGVuc2lvbgogICkpIEUKICAgIHdoZXJlIEUudXJsID0gJ29tYkNhdGVnb3J5JwogICAgICBvciBFLnVybCA9ICdkZXRhaWxlZCcKICAgIHJldHVybiBFLnZhbHVlIGFzIENvZGluZwoKZGVmaW5lICJTREUgU2V4IjoKICBjYXNlCiAgICB3aGVuIFBhdGllbnQuZ2VuZGVyID0gJ21hbGUnIHRoZW4gQ29kZSB7IGNvZGU6ICdNJywgc3lzdGVtOiAnaHR0cDovL2hsNy5vcmcvZmhpci92My9BZG1pbmlzdHJhdGl2ZUdlbmRlcicsIGRpc3BsYXk6ICdNYWxlJyB9CiAgICB3aGVuIFBhdGllbnQuZ2VuZGVyID0gJ2ZlbWFsZScgdGhlbiBDb2RlIHsgY29kZTogJ0YnLCBzeXN0ZW06ICdodHRwOi8vaGw3Lm9yZy9maGlyL3YzL0FkbWluaXN0cmF0aXZlR2VuZGVyJywgZGlzcGxheTogJ0ZlbWFsZScgfQogICAgZWxzZSBudWxsCiAgZW5kCg=="
          }
        ]
      },
      "request": {
        "method": "PUT",
        "url": "Library/library-SupplementalDataElements-FHIR3-1.0.0"
      }
    },
    {
      "resource": {
        "resourceType": "Library",
        "id": "library-TJCOverall-FHIR3-3.6.000",
        "text": {
          "status": "generated",
          "div": "<div xmlns=\"http://www.w3.org/1999/xhtml\"><table class=\"grid dict\"><tr><th scope=\"row\"><b>Id: </b></th><td style=\"padding-left: 25px; padding-right: 25px;\">library-TJCOverall-FHIR3-3.6.000</td></tr><tr><th scope=\"row\"><b>Type: </b></th><td style=\"padding-right: 25px;\"> Logic Library </td></tr><tr><th scope=\"row\"><b>Version: </b></th><td style=\"padding-left: 25px; padding-right: 25px;\">3.6.000</td></tr><tr><th scope=\"row\"><b>Status: </b></th><td style=\"padding-left: 25px; padding-right: 25px;\">active</td></tr><tr style=\"vertical-align: top;\"><th rowspan=\"3\" scope=\"row\"><b>Related: </b></th><td style=\"padding-left: 25px; padding-right: 25px;\"><p style=\"margin-bottom: 5px;\"><b>type: </b><span>depends-on</span></p><p style=\"margin-bottom: 5px;\"><b>Resource: </b><br/><span><span style=\"padding-left: 25px;\"><b>reference: </b><span>Library/library-FHIRHelpers-3.0.0</span></span></span></p></td></tr><tr style=\"vertical-align: top;\"><td style=\"padding-left: 25px; padding-right: 25px;\"><p style=\"margin-bottom: 5px;\"><b>type: </b><span>depends-on</span></p><p style=\"margin-bottom: 5px;\"><b>Resource: </b><br/><span><span style=\"padding-left: 25px;\"><b>reference: </b><span>Library/library-MATGlobalCommonFunctions-FHIR3-4.0.000</span></span></span></p></td></tr><tr style=\"vertical-align: top;\"><td style=\"padding-left: 25px; padding-right: 25px;\"><p style=\"margin-bottom: 5px;\"><b>type: </b><span>depends-on</span></p><p style=\"margin-bottom: 5px;\"><b>Resource: </b><br/><span><span style=\"padding-left: 25px;\"><b>reference: </b><span>Library/library-SupplementalDataElements-FHIR3-1.0.0</span></span></span></p></td></tr><tr style=\"vertical-align: top;\"><th rowspan=\"4\" scope=\"row\"><b>Data Requirements: </b></th><td style=\"padding-left: 25px; padding-right: 25px;\"><div xmlns=\"http://www.w3.org/1999/xhtml\"><p style=\"margin-bottom: 5px;\"><b>type: </b><span>ProcedureRequest</span></p><p style=\"margin-bottom: 5px;\"><b>code filter:</b><br/><span style=\"padding-left: 25px;\"><b>path: </b><span>code</span></span><br/><span style=\"padding-left: 25px;\"><b>valueset: </b><span>http://cts.nlm.nih.gov/fhir/ValueSet/1.3.6.1.4.1.33895.1.3.0.45</span></span></p></div></td></tr><tr style=\"vertical-align: top;\"><td style=\"padding-left: 25px; padding-right: 25px;\"><div xmlns=\"http://www.w3.org/1999/xhtml\"><p style=\"margin-bottom: 5px;\"><b>type: </b><span>Procedure</span></p><p style=\"margin-bottom: 5px;\"><b>code filter:</b><br/><span style=\"padding-left: 25px;\"><b>path: </b><span>code</span></span><br/><span style=\"padding-left: 25px;\"><b>valueset: </b><span>http://cts.nlm.nih.gov/fhir/ValueSet/1.3.6.1.4.1.33895.1.3.0.45</span></span></p></div></td></tr><tr style=\"vertical-align: top;\"><td style=\"padding-left: 25px; padding-right: 25px;\"><div xmlns=\"http://www.w3.org/1999/xhtml\"><p style=\"margin-bottom: 5px;\"><b>type: </b><span>Encounter</span></p><p style=\"margin-bottom: 5px;\"><b>code filter:</b><br/><span style=\"padding-left: 25px;\"><b>path: </b><span>type</span></span><br/><span style=\"padding-left: 25px;\"><b>valueset: </b><span>http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.424</span></span></p></div></td></tr><tr style=\"vertical-align: top;\"><td style=\"padding-left: 25px; padding-right: 25px;\"><div xmlns=\"http://www.w3.org/1999/xhtml\"><p style=\"margin-bottom: 5px;\"><b>type: </b><span>Patient</span></p></div></td></tr><tr style=\"vertical-align: top;\"><th scope=\"row\"><b>Content: </b></th><td style=\"padding-left: 25px; padding-right: 25px;\"><b>type: </b><span>text/cql</span></td></tr><tr><td colspan=\"2\" style=\"padding-left: 25px; padding-right: 25px;\"><pre><code class=\"language-cql\">library TJCOverall_FHIR3 version '3.6.000'\n\nusing FHIR version '3.0.0'\ninclude FHIRHelpers version '3.0.0' called FHIRHelpers\n//TODO: MATGlobalCommonFunctions_FHIR version '2.0.000' need to be updated to 4.0\ninclude MATGlobalCommonFunctions_FHIR3 version '4.0.000' called Global\ninclude SupplementalDataElements_FHIR3 version '1.0.0' called SDE\n\ncodesystem &quot;SNOMEDCT&quot;: 'http://snomed.info/sct/731000124108'\ncodesystem &quot;LOINC&quot;: 'http://loinc.org'\n\nvalueset &quot;Comfort Measures&quot;: 'http://cts.nlm.nih.gov/fhir/ValueSet/1.3.6.1.4.1.33895.1.3.0.45'\nvalueset &quot;Discharge To Acute Care Facility&quot;: 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.87'\nvalueset &quot;Discharged to Health Care Facility for Hospice Care&quot;: 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.207'\nvalueset &quot;Discharged to Home for Hospice Care&quot;: 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.209'\nvalueset &quot;Emergency Department Visit&quot;: 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.292'\nvalueset &quot;Encounter Inpatient&quot;: 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.666.5.307'\nvalueset &quot;Hemorrhagic Stroke&quot;: 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.212'\nvalueset &quot;Ischemic Stroke&quot;: 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.247'\nvalueset &quot;Left Against Medical Advice&quot;: 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.308'\nvalueset &quot;Non-Elective Inpatient Encounter&quot;: 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.424'\nvalueset &quot;Patient Expired&quot;: 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.309'\nvalueset &quot;Ticagrelor Therapy&quot;: 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1110.39'\nvalueset &quot;Observation Services&quot;: 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1111.143'\n\ncode &quot;Birth date&quot;: '21112-8' from &quot;LOINC&quot; display 'Birth date'\n\nparameter &quot;Measurement Period&quot; Interval&lt;DateTime&gt;\n\ncontext Patient\n\ndefine &quot;Intervention Comfort Measures&quot;:\n\t([&quot;ProcedureRequest&quot;: &quot;Comfort Measures&quot;] P\n\t\twhere P.intent = 'order')\n\t\tunion\n\t\t([&quot;Procedure&quot;: &quot;Comfort Measures&quot;] InterventionPerformed\n\t\twhere InterventionPerformed.status = 'completed')\n\ndefine &quot;All Stroke Encounter&quot;:\n\t&quot;Non Elective Inpatient Encounter&quot; NonElectiveEncounter\n    where Global.PrincipalDiagnosis(NonElectiveEncounter).code in &quot;Hemorrhagic Stroke&quot;\n      or Global.PrincipalDiagnosis(NonElectiveEncounter).code in &quot;Ischemic Stroke&quot;\n\ndefine &quot;Ischemic Stroke Encounter&quot;:\n\t&quot;Encounter with Principal Diagnosis and Age&quot; EncounterWithAge\n\t\twhere Global.PrincipalDiagnosis(EncounterWithAge).code in &quot;Ischemic Stroke&quot;\n\ndefine &quot;Non Elective Inpatient Encounter&quot;:\n\t[&quot;Encounter&quot;: &quot;Non-Elective Inpatient Encounter&quot;] NonElectiveEncounter\n\t\twhere Global.&quot;LengthInDays&quot;(NonElectiveEncounter.period)&lt;= 120\n\t\t\tand NonElectiveEncounter.period ends during &quot;Measurement Period&quot;\n\ndefine &quot;Ischemic Stroke Encounters with Discharge Disposition&quot;:\n\t( ( &quot;Ischemic Stroke Encounter&quot; IschemicStrokeEncounter\n\t\t\t\twhere IschemicStrokeEncounter.hospitalization.dischargeDisposition in &quot;Discharge To Acute Care Facility&quot;\n\t\t\t\t\tor IschemicStrokeEncounter.hospitalization.dischargeDisposition in &quot;Left Against Medical Advice&quot;\n\t\t\t\t\tor IschemicStrokeEncounter.hospitalization.dischargeDisposition in &quot;Patient Expired&quot;\n\t\t\t\t\tor IschemicStrokeEncounter.hospitalization.dischargeDisposition in &quot;Discharged to Home for Hospice Care&quot;\n\t\t\t\t\tor IschemicStrokeEncounter.hospitalization.dischargeDisposition in &quot;Discharged to Health Care Facility for Hospice Care&quot;\n\t\t)\n\t)\n\ndefine &quot;Comfort Measures during Hospitalization&quot;:\n\t&quot;Ischemic Stroke Encounter&quot; IschemicStrokeEncounter\n\t\twith &quot;Intervention Comfort Measures&quot; ComfortMeasure\n\t\t\tsuch that Coalesce(start of FHIRHelpers.ToInterval(ComfortMeasure.performed), ComfortMeasure.authoredOn)during Global.&quot;HospitalizationWithObservation&quot;(IschemicStrokeEncounter)\n\ndefine &quot;Encounter with Principal Diagnosis and Age&quot;:\n\t&quot;All Stroke Encounter&quot; AllStrokeEncounter\n\t\twith [&quot;Patient&quot;] BirthDate\n\t\t\tsuch that Global.&quot;CalendarAgeInYearsAt&quot;(FHIRHelpers.ToDate(BirthDate.birthDate), start of FHIRHelpers.ToInterval(AllStrokeEncounter.period)) &gt;= 18\n\ndefine function &quot;CalendarDayOfOrDayAfter&quot;(StartValue DateTime ):\n\tInterval(Global.&quot;ToDate&quot;(StartValue), Global.&quot;ToDate&quot;(StartValue + 2 days))\n</code></pre>\n                    \n                    \n                </td>\n            </tr>\n        \n    </table>\n</div>"
        },
        "version": "3.6.000",
        "name": "TJCOverall_FHIR3",
        "status": "active",
        "experimental": true,
        "type": {
          "coding": [
            {
              "system": "http://hl7.org/fhir/library-type",
              "code": "logic-library"
            }
          ]
        },
        "relatedArtifact": [
          {
            "type": "depends-on",
            "resource": {
              "reference": "Library/library-FHIRHelpers-3.0.0"
            }
          },
          {
            "type": "depends-on",
            "resource": {
              "reference": "Library/library-MATGlobalCommonFunctions-FHIR3-4.0.000"
            }
          },
          {
            "type": "depends-on",
            "resource": {
              "reference": "Library/library-SupplementalDataElements-FHIR3-1.0.0"
            }
          }
        ],
        "dataRequirement": [
          {
            "type": "ProcedureRequest",
            "codeFilter": [
              {
                "path": "code",
                "valueSetString": "http://cts.nlm.nih.gov/fhir/ValueSet/1.3.6.1.4.1.33895.1.3.0.45"
              }
            ]
          },
          {
            "type": "Procedure",
            "codeFilter": [
              {
                "path": "code",
                "valueSetString": "http://cts.nlm.nih.gov/fhir/ValueSet/1.3.6.1.4.1.33895.1.3.0.45"
              }
            ]
          },
          {
            "type": "Encounter",
            "codeFilter": [
              {
                "path": "type",
                "valueSetString": "http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.424"
              }
            ]
          },
          {
            "type": "Patient"
          }
        ],
        "content": [
          {
            "contentType": "application/elm+xml",
            "data": "[encoded data, 23028 characters]"
          },
          {
            "contentType": "text/cql",
            "data": "[encoded data, 5792 characters]"
          }
        ]
      },
      "request": {
        "method": "PUT",
        "url": "Library/library-TJCOverall-FHIR3-3.6.000"
      }
    }
  ]
}