Clinical Practice Guidelines Example Implementation Guide - Anthrax Post-Exposure Prophylaxis
1.1.0 - ci-build
Clinical Practice Guidelines Example Implementation Guide - Anthrax Post-Exposure Prophylaxis - Local Development build (v1.1.0) built by the FHIR (HL7® FHIR® Standard) Build Tools. See the Directory of published versions
Draft as of 2024-11-18 |
{
"resourceType" : "Library",
"id" : "anthrax-post-exposure-prophylaxis-library",
"text" : {
"status" : "generated",
"div" : "<div xmlns=\"http://www.w3.org/1999/xhtml\"><p class=\"res-header-id\"><b>Generated Narrative: Library anthrax-post-exposure-prophylaxis-library</b></p><a name=\"anthrax-post-exposure-prophylaxis-library\"> </a><a name=\"hcanthrax-post-exposure-prophylaxis-library\"> </a><a name=\"anthrax-post-exposure-prophylaxis-library-en-US\"> </a><h2>Participants</h2><table class=\"grid\"><tr><td>Author</td><td>Alliance to Modernize Healthcare FFRDC</td></tr><tr><td>Endorser</td><td>Centers for Disease Control and Prevention</td></tr></table><h2>Contents</h2><p><code>text/cql</code></p><pre><code>/* Library: Anthrax Post Exposure Prophylaxis (PEP) for Adults, FHIR R4 data model.\n Author: CMS Alliance to Modernize Healthcare, operated by THE MITRE Corporation.\n\n (C) 2019 The MITRE Corporation. All Rights Reserved. Approved for Public Release: 19-2048. Distribution Unlimited.\n\n Change log:\n - Version 1.1.0: Updated output resources to align with draft profiles posted at:\n http://build.fhir.org/ig/HL7/cqf-recommendations/profiles.html\n Also refactored CQL to put CDC-specific functions in a seperate library.\n*/\nlibrary Anthrax_Post_Exposure_Prophylaxis_Adults_FHIRv400 version '1.1.0'\n\n/* ------------- REFERENCES ----------------------------------------------------\n- Hendricks, K.A. et al., Centers for Disease Control and Prevention Expert Panel Meetings on Prevention and Treatment of Anthrax in Adults. Emerg Infect Dis, 20(20), Feb 2014.\n- Hendricks, K.A. et al., Centers for Disease Control and Prevention Expert Panel Meetings on Prevention and Treatment of Anthrax in Adults: Technical Report. Emerg Infect Dis. 20(20), Feb 2014.\n- Emergent BioSolutions, BioThrax Anthrax Vaccine Adsorbed (http://www.biothrax.com/whatisbiothrax/).\n- Centers for Disease Control and Prevention, Ciprofloxacin for Post-Exposure Prophylaxis of Anthrax: Emergency Use Instructions for Healthcare Providers, 2017.\n- Centers for Disease Control and Prevention. Doxycyxcline for Post-Exposure Prophylaxis of Anthrax: Emergency Use Instructions for Healthcare Providers, 2017.\n- Public Health Information Network Vocabulary Access and Distribution System (PHIN VADS), PHVS_SignsSymptoms_Anthrax (OID 2.16.840.1.114222.4.11.3212), 2009.\n- Meanye-Delman D et al., Special Considerations for Prophylaxis for and Treatment of Anthrax in Pregnant and Postpartum Women, Emerg Infect Dis, 20(2), 2014.\n- Meanye-Delman D et al., Special Considerations for Prophylaxis for and Treatment of Anthrax in Pregnant and Postpartum Women: Technical Report, Emerg Infect Dis, 20(2), 2014.\n- Wright, J.G et al., Use of Anthrax Vaccine in the United States: Recommendations of the Advisory Committee on Immunization Practices (ACIP), 2009, Morbidity and Mortality Weekly Report, July 23, 2010 / 59(RR06); 1-30.\n*/\n\n/* ------------- KEY ASSUMPTIONS -----------------------------------------------\n1. Anthrax exposure represented by one of two codes in either a Condition or Observation FHIR R4 resource. The parameter Exposure_Look_Back_Period controls how far back to filter potential exposure resources. Default is 60 days.\n2. Asymptomatic represented by SNOMED-CT code 84387000 in an Observation FHIR R4 resource. Asymptomatic Observation must occur on the same day or after the exposure date.\n3. Existing antimicrobial Rx found by querying MedicationRequest and MedicationStatement FHIR R4 resources.\n4. Administration of the Anthrax vaccine represented by one of the sequential SNOMED-CT procedure codes. This is how past doses are discovered via querying for Procedure FHIR resources.\n5. The recommended spacing between subsequent doses of the vaccine is controlled by the parameter Spacing_Between_Vaccine_Doses, which has a default value of two weeks. A patient undergoing Anthrax PEP will only be recommended their next vaccine dose if two weeks have elapsed since their last and if they have not received the recommended allotmant of three doses.\n6. Pregnancy can be represented as an Observation or a Condition FHIR R4 resource. Both types of resouces are examined to determine if the patient is pregnant.\n7. Allergies are discovered by querying for AllergyIntolerance FHIR R4 resources that contain ingredient/substance codes for any of the potentially recommended PEP treatments. This includes the antimicrobials, the vaccine, and latex.\n8. Alerts are communicated via either DetectedIssue or Flag FHIR resources.\n9. Aside from the alerts, the main output of this CDS is an order set. It is represented via FHIR R4 resources (ActivityDefinition and PlanDefinition).\n10. This CDS outputs various FHIR resource objects. For the purposes of local FHIR references, it is assumed all generated FHIR resources will be returned in a single FHIR bundle.\n*/\n\n// Data model\nusing FHIR version '4.0.0'\n\n// ------------- LIBRARIES --------------------------------------------------\n// The CDS Connect Commons for FHIRv400 library provides functions representing\n// commonly used CDS logic and patterns.\ninclude CDS_Connect_Commons_for_FHIRv400 version '1.3.2' called C3F\n// The FHIRHelpers library provides functions for working with FHIR resources.\ninclude FHIRHelpers version '4.0.0' called FHIRHelpers\n// More common logic for CDC CDS\ninclude CDC_Common_Logic_FHIRv400 version '1.0.0' called CCL\n\n// ------------- CODE SYSTEMS --------------------------------------------------\ncodesystem "LOINC": 'http://loinc.org'\ncodesystem "SNOMED-CT": 'http://snomed.info/sct'\ncodesystem "ICD-10-CM": 'http://hl7.org/fhir/sid/icd-10-cm'\ncodesystem "RXNORM": 'http://www.nlm.nih.gov/research/umls/rxnorm'\ncodesystem "ACTCODE": 'http://terminology.hl7.org/CodeSystem/v3-ActCode'\ncodesystem "CVX": 'http://hl7.org/fhir/sid/cvx'\ncodesystem "FHIR-ACTION-TYPE": 'http://terminology.hl7.org/CodeSystem/action-type'\ncodesystem "FHIR-PLANDEFINITION-TYPE": 'http://terminology.hl7.org/CodeSystem/plan-definition-type'\ncodesystem "FHIR-USAGE-CONTEXT-TYPE": 'http://terminology.hl7.org/CodeSystem/usage-context-type'\ncodesystem "ISO-3166-COUNTRY-CODES": 'urn:iso:std:iso:3166'\n\n// ------------- VALUE SETS ----------------------------------------------------\nvalueset "Ciprofloxacin medications": '2.16.840.1.113762.1.4.1032.67'\nvalueset "Doxycycline medications": '2.16.840.1.113762.1.4.1032.66'\nvalueset "Levofloxacin medications": '2.16.840.1.113762.1.4.1032.69'\nvalueset "Moxifloxacin medications": '2.16.840.1.113762.1.4.1032.70'\nvalueset "Clindamycin medications": '2.16.840.1.113762.1.4.1032.68'\nvalueset "Latex": '2.16.840.1.113762.1.4.1032.76'\nvalueset "Pregnancy": '2.16.840.1.113883.3.526.3.378'\n\n// ------------- CODES ---------------------------------------------------------\n// Exposure codes\ncode "Exposure to Anthrax code": 'Z20.810' from "ICD-10-CM" display 'Exposure to Anthrax'\ncode "Exposure to Bacillus anthracis (event) code": '170475009' from "SNOMED-CT"\n display 'Exposure to Bacillus anthracis (event)'\n\n// Asymptomatic code.\ncode "Asymptomatic code": '84387000' from "SNOMED-CT" display 'Asymptomatic (finding)'\n\n// Pregnancy codes.\ncode "Pregnancy status code": '82810-3' from "LOINC" display 'Pregnancy status'\ncode "Pregnant code": '77386006' from "SNOMED-CT" display 'Patient currently pregnant (finding)'\n\n// Anthrax vaccine represented as four separate codes, one for each sequentially administered dose.\ncode "Anthrax vaccination code": '49598002' from "SNOMED-CT" display 'Anthrax vaccination (procedure)'\ncode "First anthrax vaccination code": '170338000' from "SNOMED-CT" display 'First anthrax vaccination (procedure)'\ncode "Second anthrax vaccination code": '170339008' from "SNOMED-CT" display 'Second anthrax vaccination (procedure)'\ncode "Third anthrax vaccination code": '170340005' from "SNOMED-CT" display 'Third anthrax vaccination (procedure)'\ncode "Fourth anthrax vaccination code": '170341009' from "SNOMED-CT" display 'Fourth anthrax vaccination (procedure)'\n\n// Recommended antimicrobials each represented by a single RxNorm code.\ncode "Ciprofloxacin Rx code": '309309' from "RXNORM" display 'Ciprofloxacin 500 MG Oral Tablet'\ncode "Doxycycline Rx code": '1650143' from "RXNORM" display 'doxycycline hyclate 100 MG Oral Tablet'\ncode "Levofloxacin Rx code": '311296' from "RXNORM" display 'Levofloxacin 750 MG Oral Tablet'\ncode "Moxifloxacin Rx code": '311787' from "RXNORM" display 'moxifloxacin HCl 400 MG Oral Tablet'\ncode "Clindamycin Rx code": '284215' from "RXNORM" display 'clindamycin HCl 300 MG Oral Capsule'\n\n// Codes for substances, needed to help check for certain allergies.\ncode "Ciprofloxacin substance code": '2551' from "RXNORM" display 'Ciprofloxacin (substance/ingredient)'\ncode "Doxycycline substance code": '3640' from "RXNORM" display 'Doxycycline (substance/ingredient)'\ncode "Levofloxacin substance code": '82122' from "RXNORM" display 'Levofloxacin (substance/ingredient)'\ncode "Moxifloxacin substance code": '139462' from "RXNORM" display 'Moxifloxacin (substance/ingredient)'\ncode "Clindamycin substance code": '2582' from "RXNORM" display 'Clindamycin (substance/ingredient)'\ncode "Latex substance code": '1314891' from "RXNORM" display 'Latex (substance/ingredient)'\ncode "Anthrax vaccine substance code": '404774' from "RXNORM" display 'Anthrax Vaccine Absorbed (substance/ingredient)'\ncode "Anthrax vaccine CVX code": '24' from "CVX" display 'Anthrax vaccine'\n\n// Alert codes\ncode "Device code": '701002007' from "SNOMED-CT" display 'Clinical data collection/management information system application software (physical object)'\ncode "Document signs and symptoms code": '223447008' from "SNOMED-CT" display 'Recommendation to document signs and symptoms (procedure)'\ncode "Medication review code": '314529007' from "SNOMED-CT" display 'Medication review due (situation)'\ncode "Not equivalent alert code": 'NOTEQUIV' from "ACTCODE" display 'Not equivalent alert'\ncode "Timing detected issue code": 'TIME' from "ACTCODE" display 'Timing detected issue'\ncode "Verify allergy status code": '370860007' from "SNOMED-CT" display 'Verification of allergy status (procedure)'\n\n// Order set codes\ncode "FHIR ActionType create code": 'create' from "FHIR-ACTION-TYPE" display 'Create'\ncode "FHIR PlanDefinition eca-rule code": 'eca-rule' from "FHIR-PLANDEFINITION-TYPE" display 'ECA Rule'\ncode "FHIR PlanDefinition order-set code": 'order-set' from "FHIR-PLANDEFINITION-TYPE" display 'Order Set'\ncode "FHIR age range usage context code": 'age' from "FHIR-USAGE-CONTEXT-TYPE" display 'Age Range'\ncode "FHIR clinical focus usage context code": 'focus' from "FHIR-USAGE-CONTEXT-TYPE" display 'Clinical Focus'\ncode "FHIR clinical venue usage context code": 'venue' from "FHIR-USAGE-CONTEXT-TYPE" display 'Clinical Venue'\ncode "SNOMED outpatient code": '440655000' from "SNOMED-CT" display 'Outpatient environment'\ncode "United States code": 'US' from "ISO-3166-COUNTRY-CODES" display 'United States of America'\ncode "Oral route code": '26643006' from "SNOMED-CT" display 'Oral Route'\ncode "Swallow dosing instruction code": '421521009' from "SNOMED-CT" display 'Swallow - dosing instruction imperative (qualifier value)'\ncode "Subcutaneous route code": '34206005' from "SNOMED-CT" display 'Subcutaneous route'\n\n// ------------- CONCEPTS ------------------------------------------------------\n// Exposure is represented by two codes, one from ICD10 one from SNOMED-CT.\nconcept "Anthrax exposure": { "Exposure to Anthrax code", "Exposure to Bacillus anthracis (event) code" } display 'Anthrax exposure'\n\n// Asymptomatic is represented by a single SNOMED-CT code.\nconcept "AsymptomaticConcept": { "Asymptomatic code" } display 'Asymptomatic'\nconcept "Anthrax vaccine": { "Anthrax vaccine substance code", "Anthrax vaccine CVX code"} display 'Anthrax vaccine'\n\n// Pregnancy can be represented as a status, an observation, or a condition (see valueset above).\nconcept "Pregnancy status": { "Pregnancy status code" } display 'Pregnancy status'\nconcept "Pregnant": { "Pregnant code" } display 'Patient currently pregnant (finding)'\n\n// ------------- PARAMETERS ----------------------------------------------------\n// Lookback period for defining "recent" exposure (default: 60 days).\nparameter Exposure_Look_Back_Period default 60 days\n\n// Recommended spacing between vacccine doses\nparameter Spacing_Between_Vaccine_Doses default 2 weeks\n\n// ------------- PATIENT CONTEXT -----------------------------------------------\ncontext Patient\n\n// Version of this CQL\ndefine CqlVersion: '1.1.0'\n\n// ------------- INCLUSIONS & EXCLUSIONS ---------------------------------------\n// Must be 18 years or older.\ndefine Is18orOlder:\n AgeInYears() >= 18\n\n// ------------- ANTHRAX EXPOSURE ----------------------------------------------\n/* Exposure to Anthrax can be represented as either a Condition or an Observation\nresource. We need to look for recent (<= Exposure_Look_Back_Period) indications\nof exposure in order to decide if the patient needs to be treated with PEP. See\nAssumption 1. */\n\n// Confirmed, recent (<= Exposure_Look_Back_Period), and active or recurring Conditions.\ndefine RecentAnthraxExposureConditions:\n C3F.Confirmed(C3F.ConditionLookBack(C3F.ActiveOrRecurring([Condition: "Anthrax exposure"]), Exposure_Look_Back_Period))\n\n// The most recent exposure Condition from within the exposure lookback period.\ndefine MostRecentAnthraxExposureCondition:\n (CCL.MostRecentCondition(RecentAnthraxExposureConditions)) C\n return {\n Type: 'Condition',\n Id: C.id.value,\n Date: CCL.FindConditionDate(C)\n }\n\n// Verified and recent (<= Exposure_Look_Back_Period) Observations.\ndefine RecentAnthraxExposureObservations:\n C3F.Verified(C3F.ObservationLookBack([Observation: "Anthrax exposure"], Exposure_Look_Back_Period))\n\n// The most recent exposure Observation.\ndefine MostRecentAnthraxExposureObservation:\n (C3F.MostRecent(RecentAnthraxExposureObservations)) O\n return {\n Type: 'Observation',\n Id: O.id.value,\n Date: C3F.FindDate(O)\n }\n\n// Form the union of all the resources that could be used to indicate exposure.\ndefine RecentAnthraxExposureResources:\n ( MostRecentAnthraxExposureCondition union MostRecentAnthraxExposureObservation ) L\n where L.Date is not null\n sort by Date desc\n\n// Determine if there is a recent (<= Exposure_Look_Back_Period) exposure to Anthrax.\ndefine RecentlyExposedToAnthrax:\n exists(RecentAnthraxExposureResources)\n\n// The most recent (<= Exposure_Look_Back_Period) exposure resource.\ndefine MostRecentAnthraxExposureResource:\n Coalesce(RecentAnthraxExposureResources)\n\n// Date of most recent (<= Exposure_Look_Back_Period) exposure.\ndefine MostRecentAnthraxExposureDate:\n MostRecentAnthraxExposureResource.Date\n\n// ------------- ASYMPTOMATIC --------------------------------------------------\n/* Asymptomatic must be represented as an Observation resource. In order for a patient\nto be determined to be asymptomatic, the asymptomatic Observation must occur on\nor after the date of exposure. See Assumption 2. */\n\n// Check for recent and verified Observations that patient is asymptomatic.\ndefine RecentAsymptomaticObservations:\n C3F.Verified(C3F.ObservationLookBack([Observation: "AsymptomaticConcept"], Exposure_Look_Back_Period))\n\n// Most recent (<= Exposure_Look_Back_Period) asymptomatic Observation.\ndefine MostRecentAsymptomaticObservation:\n C3F.MostRecent(RecentAsymptomaticObservations)\n\n// Date of the most recent (<= Exposure_Look_Back_Period) asymptomatic Observation.\ndefine MostRecentAsymptomaticObservationDate:\n C3F.FindDate(MostRecentAsymptomaticObservation)\n\n// Determine if the patient is asymptomatic, checking to ensure asymptomatic observation\n// occurs **after** exposure.\ndefine Asymptomatic:\n MostRecentAsymptomaticObservationDate is not null and\n MostRecentAsymptomaticObservationDate same day or after MostRecentAnthraxExposureDate\n\n// ------------- PREGNANCY -----------------------------------------------------\n/* Pregnancy can be represented as an Observation or a Condition. Both types of\nresouces are examined to determine if the patient is pregnant. */\n\n// Confirmed, active or recurring, Conditions from the last 42 weeks indicating pregnancy.\ndefine PregnancyConditions:\n C3F.Confirmed(C3F.ConditionLookBack(C3F.ActiveOrRecurring([Condition: "Pregnancy"]), 42 weeks))\n\n// Verified Observations on pregnancy status from the last 42 weeks.\ndefine PregnancyObservations:\n C3F.Verified(C3F.ObservationLookBack([Observation: "Pregnancy status"], 42 weeks))\n\n// The most recent pregnancy Observation from the last 42 weeks.\ndefine MostRecentPregnancyObservation:\n C3F.MostRecent(PregnancyObservations)\n\n// Boolean indicating whether the most recent pregnancy Observation in the past\n// 42 weeks indicates a pregnancy.\ndefine MostRecentPregnancyObservationIsPositive:\n C3F.ConceptValue(MostRecentPregnancyObservation) ~ "Pregnant"\n\n// Pregnancy status is defined by either a confirmed, active or recurring, and recent\n// (< 42 weeks) pregnancy Condition, or a verified pregnancy Observation within the\n// the past 42 weeks indicating a pregnancy\ndefine IsPregnant:\n exists(PregnancyConditions)\n or MostRecentPregnancyObservationIsPositive\n\n// ------------- EXISTING PEP TREATMENTS ---------------------------------------\n\n// Check patient record for current Rx of any of the recommended antimicrobials.\n// Need to exmaine both MedicationRequest and MedicationStatement resources.\n\n// Active MedicationRequests for any of the recommended antimicrobials.\ndefine ActiveCiprofloxacinRequests:\n C3F.ActiveMedicationRequest([MedicationRequest: "Ciprofloxacin medications"])\n\ndefine ActiveDoxycyclineRequests:\n C3F.ActiveMedicationRequest([MedicationRequest: "Doxycycline medications"])\n\ndefine ActiveLevofloxacinRequests:\n C3F.ActiveMedicationRequest([MedicationRequest: "Levofloxacin medications"])\n\ndefine ActiveMoxifloxacinRequests:\n C3F.ActiveMedicationRequest([MedicationRequest: "Moxifloxacin medications"])\n\ndefine ActiveClindamycinRequests:\n C3F.ActiveMedicationRequest([MedicationRequest: "Clindamycin medications"])\n\ndefine ActiveAntimicrobialMedicationRequests:\n ActiveCiprofloxacinRequests\n union ActiveDoxycyclineRequests\n union ActiveLevofloxacinRequests\n union ActiveMoxifloxacinRequests\n union ActiveClindamycinRequests\n\n// Active MedicationStatements for any of the recommended antimicrobials.\ndefine ActiveCiprofloxacinStatements:\n C3F.ActiveMedicationStatement([MedicationStatement: "Ciprofloxacin medications"])\n\ndefine ActiveDoxycyclineStatements:\n C3F.ActiveMedicationStatement([MedicationStatement: "Doxycycline medications"])\n\ndefine ActiveLevofloxacinStatements:\n C3F.ActiveMedicationStatement([MedicationStatement: "Levofloxacin medications"])\n\ndefine ActiveMoxifloxacinStatements:\n C3F.ActiveMedicationStatement([MedicationStatement: "Moxifloxacin medications"])\n\ndefine ActiveClindamycinStatements:\n C3F.ActiveMedicationStatement([MedicationStatement: "Clindamycin medications"])\n\ndefine ActiveAntimicrobialMedicationStatements:\n ActiveCiprofloxacinStatements\n union ActiveDoxycyclineStatements\n union ActiveLevofloxacinStatements\n union ActiveMoxifloxacinStatements\n union ActiveClindamycinStatements\n\n// Need to keep track of the specifics of which of the antimicrobials have active Rx.\ndefine HasCiprofloxacinRx:\n exists(ActiveCiprofloxacinRequests) or exists(ActiveCiprofloxacinStatements)\n\ndefine HasDoxycyclineRx:\n exists(ActiveDoxycyclineRequests) or exists(ActiveDoxycyclineStatements)\n\ndefine HasLevofloxacinRx:\n exists(ActiveLevofloxacinRequests) or exists(ActiveLevofloxacinStatements)\n\ndefine HasMoxifloxacinRx:\n exists(ActiveMoxifloxacinRequests) or exists(ActiveMoxifloxacinStatements)\n\ndefine HasClindamycinRx:\n exists(ActiveClindamycinRequests) or exists(ActiveClindamycinStatements)\n\n// Format and sort the antimicrobial MedicationRequest list.\ndefine FormattedAntimicrobialMedicationRequests:\n (ActiveAntimicrobialMedicationRequests) O\n return {\n Type: 'MedicationRequest',\n Id: O.id.value,\n Date: CCL.DateTimeText(O.authoredOn)\n }\n sort by Date desc\n\n// Format and sort the antimicrobial MedicationStatement list.\ndefine FormattedAntimicrobialMedicationStatements:\n (ActiveAntimicrobialMedicationStatements) S\n return {\n Type: 'MedicationStatement',\n Id: S.id.value,\n Date: CCL.MedicationStatementDate(S)\n }\n sort by Date desc\n\n// Combine the formatted MedicationRequest and MedicationStatement lists.\ndefine FormattedAntimicrobialMedicationResources:\n (FormattedAntimicrobialMedicationRequests\n union FormattedAntimicrobialMedicationStatements) M\n sort by Date desc\n\n// Boolean indicating whether patient has an exisiting antimicrobial Rx.\ndefine HasExistingAntimicrobialRx:\n exists(FormattedAntimicrobialMedicationResources)\n\n// Check patient record for any recent doses of the vaccine.\n// Each dose in the vaccine sequence has its own SNOMED-CT procedure code.\n\n// Look for completed Produres for administering the first dose.\ndefine ProceduresForFirstVaccineDose:\n C3F.Completed([Procedure: "First anthrax vaccination code"])\n\n// Look for completed Produres for administering the second dose.\ndefine ProceduresForSecondVaccineDose:\n C3F.Completed([Procedure: "Second anthrax vaccination code"])\n\n// Look for completed Produres for administering the third dose.\ndefine ProceduresForThirdVaccineDose:\n C3F.Completed([Procedure: "Third anthrax vaccination code"])\n\n// Look for completed Produres for administering the fourth dose.\ndefine ProceduresForFourthVaccineDose:\n C3F.Completed([Procedure: "Fourth anthrax vaccination code"])\n\n// ------------- VACCINE LOGIC -------------------------------------------------\n/* How many doses has the patient had? Cases of interest to the logic are:\n- 0 doses\n- 1-2 doses\n- >=3 doses\n*/\n\n// Has the patient had the first dose administered?\ndefine HasFirstVaccineDose:\n exists(ProceduresForFirstVaccineDose)\n\n// Has the patient had the second dose administered?\ndefine HasSecondVaccineDose:\n exists(ProceduresForSecondVaccineDose)\n\n// Has the patient had the third dose administered?\ndefine HasThirdVaccineDose:\n exists(ProceduresForThirdVaccineDose)\n\n// Has the patient had the fourth dose administered?\ndefine HasFourthVaccineDose:\n exists(ProceduresForFourthVaccineDose)\n\n/* What is the next dose in the vaccine sequence that the patient should receive?\nNote that this logic is very strict, and will miss things like non-sequential dosing.\nThis and another data inconsistency is detected below and alerted on later on.\n*/\ndefine NextVaccineDoseNumber:\n case\n when not HasFirstVaccineDose and not HasSecondVaccineDose and not HasThirdVaccineDose and not HasFourthVaccineDose\n then 1 // The next dose will be the first.\n when HasFirstVaccineDose and not HasSecondVaccineDose and not HasThirdVaccineDose and not HasFourthVaccineDose\n then 2 // The next dose will be the second.\n when HasFirstVaccineDose and HasSecondVaccineDose and not HasThirdVaccineDose and not HasFourthVaccineDose\n then 3 // The next does will be third (last).\n else null // There is no fourth dose for PEP.\n end\n\n// The most recent vaccine Procedure.\ndefine MostRecentVaccineProcedure:\n case\n when HasFourthVaccineDose // They have their fourth dose.\n then CCL.MostRecentProcedure(ProceduresForFourthVaccineDose)\n when HasThirdVaccineDose // They have their third dose.\n then CCL.MostRecentProcedure(ProceduresForThirdVaccineDose)\n when HasSecondVaccineDose // They have their second dose.\n then CCL.MostRecentProcedure(ProceduresForSecondVaccineDose)\n when HasFirstVaccineDose // They have first dose.\n then CCL.MostRecentProcedure(ProceduresForFirstVaccineDose)\n else null // Patient has not had a previous dose.\n end\n\n// When was the last vaccine Procedure?\ndefine DateOfLastVaccineDose:\n CCL.FindProcedureDate(MostRecentVaccineProcedure)\n\n/* Has enough time elasped since the last vaccine dose that the next one can be\napplied? */\ndefine ReadyForNextVaccineDose:\n if (DateOfLastVaccineDose is not null) then\n if (NextVaccineDoseNumber is not null) then\n if (Spacing_Between_Vaccine_Doses is not null) then\n if (NextVaccineDoseNumber in {2,3}\n and (DateOfLastVaccineDose same day or before (Today() - Spacing_Between_Vaccine_Doses))) then true\n else false\n else false\n else false\n else\n if (NextVaccineDoseNumber is not null) then\n if (NextVaccineDoseNumber = 1) then true // Need their first dose.\n else false\n else false\n\n/* Logic to detect whether or not the last vaccine Procedure is missing a date.\nIf this is the case, then the above logic will fail. So an alert is generated\nlater on to notify the provider of this potential issue.\n*/\ndefine LastVaccineProcedureMissingDate:\n if (NextVaccineDoseNumber is not null and DateOfLastVaccineDose is null) then\n if (NextVaccineDoseNumber = 1) then false\n else true\n else false\n\n/* Logic to detect missing Vaccine doses. An example would be if the patient record\nshows the patient receiving the second vaccine dose but not the first. If this is\nthe case, then the above logic will fail. So an alert is generated later on to notify\nthe provider of this potential issue.\n*/\ndefine MissingVaccineDose:\n if (NextVaccineDoseNumber is null) then\n if (HasFirstVaccineDose and HasSecondVaccineDose and HasThirdVaccineDose) then false\n else true\n else false\n\n// ------------- ALLERGIES -----------------------------------------------------\n/* Check patient record for allergies to any of the recommended PEP treatments, plus\n// latex. Patient allergies are discovered by querying AllergyIntolerance resources. */\n\n// Active or confirmed AllergyIntolerance for Ciprofloxacin.\ndefine CiprofloxacinAllergyIntolerances:\n C3F.ConfirmedAllergyIntolerance([AllergyIntolerance: "Ciprofloxacin substance code"])\n\n// Active or confirmed AllergyIntolerance for Doxycycline.\ndefine DoxycyclineAllergyIntolerances:\n C3F.ConfirmedAllergyIntolerance([AllergyIntolerance: "Doxycycline substance code"])\n\n// Active or confirmed AllergyIntolerance for Levofloxacin.\ndefine LevofloxacinAllergyIntolerances:\n C3F.ConfirmedAllergyIntolerance([AllergyIntolerance: "Levofloxacin substance code"])\n\n// Active or confirmed AllergyIntolerance for Moxifloxacin.\ndefine MoxifloxacinAllergyIntolerances:\n C3F.ConfirmedAllergyIntolerance([AllergyIntolerance: "Moxifloxacin substance code"])\n\n// Active or confirmed AllergyIntolerance for Clindamycin.\ndefine ClindamycinAllergyIntolerances:\n C3F.ConfirmedAllergyIntolerance([AllergyIntolerance: "Clindamycin substance code"])\n\n// Active or confirmed AllergyIntolerance for BioThrax.\ndefine VaccineAllergyIntolerances:\n C3F.ConfirmedAllergyIntolerance([AllergyIntolerance: "Anthrax vaccine"])\n\n// Active or confirmed AllergyIntolerance for Latex.\ndefine LatexAllergyIntolerances:\n C3F.ConfirmedAllergyIntolerance([AllergyIntolerance: "Latex substance code"]\n union [AllergyIntolerance: "Latex"])\n\n// Create a formatted list of all the antimicrobial AllergyIntolerance resources.\ndefine AntimicrobialAllergyList:\n (CiprofloxacinAllergyIntolerances\n union DoxycyclineAllergyIntolerances\n union LevofloxacinAllergyIntolerances\n union MoxifloxacinAllergyIntolerances\n union ClindamycinAllergyIntolerances) A\n return {\n Type: 'AllergyIntolerance',\n Id: A.id.value,\n DateRecorded: CCL.DateTimeText(A.recordedDate)\n }\n sort by DateRecorded desc\n\n// Create a formatted list of all the vaccine AllergyIntolerance resources.\ndefine VaccineAllergyList:\n (VaccineAllergyIntolerances) A\n return {\n Type: 'AllergyIntolerance',\n Id: A.id.value,\n DateRecorded: CCL.DateTimeText(A.recordedDate)\n }\n sort by DateRecorded desc\n\n// Create a formatted list of all the latex AllergyIntolerance resources.\ndefine LatexAllergyList:\n (LatexAllergyIntolerances) A\n return {\n Type: 'AllergyIntolerance',\n Id: A.id.value,\n DateRecorded: CCL.DateTimeText(A.recordedDate)\n }\n sort by DateRecorded desc\n\n// Any allergies to any of the antimicrobials?\ndefine HasAntimicrobialAllergy:\n exists(AntimicrobialAllergyList)\n\n// Any allergies to the vaccine?\ndefine HasVaccineAllergy:\n exists(VaccineAllergyList)\n\n// Any allergies to latex?\ndefine HasLatexAllergy:\n exists(LatexAllergyList)\n\n// ------------- ALERTS --------------------------------------------------------\n/* There are currently five alerts that can potentially be generated by this CDS:\n1. Exposed but not asymptomatic.\n2. Existing antimicrobial Rx.\n3. Potential antimicrobial allergy.\n4. Potential vaccine allergy.\n5. Potential latex allergy.\n6. Inconsistencies in patient BioThrax dosing history.\n\nThese alerts are represented using either a DetectedIssue or Flag FHIR R4 resource.\nThey each make reference to FHIR resources that have been discovered by querying the\npatient record (e.g., an AllergyIntolerance resource indicating a patient allergy to\nthe vaccine).\n*/\n\n// Define a Device resource for referring to this CQL within the alert resources.\ndefine Device: {\n resourceType: 'Device',\n id: '1',\n type: {\n coding: { CCL.FormatCode("Device code") }\n },\n identifier: {\n {\n value: 'Anthrax_Post_Exposure_Prophylaxis_FHIRv400.cql'\n }\n },\n manufacturer: 'Centers for Disease Control and Prevention',\n version: { {\n value: CqlVersion\n } }\n}\n\n/* Alert 1: Patient is exposed to anthrax but does not have an asymptomatic Observation.\nIf this is the case, a Flag resource will be generated below to highlight this issue\nsince post exposure prophylaxis is only recommended for asymptomatic patients. A\nflag-detail extension reference to the resource indicating exposure and a code for\ndocumenting signs and symptoms are also included. If patient is both exposed and asymptomatic,\nthen this Flag resource will be empty (null). */\ndefine FlagNoAsymptomaticObservation:\n if (RecentlyExposedToAnthrax and Is18orOlder and not Asymptomatic) then {\n resourceType: 'Flag',\n id: '2',\n text: {\n status: 'generated',\n "div": '<div xmlns=\\"http://www.w3.org/1999/xhtml\\">If patient has signs or symptoms consistent with anthrax, conduct a full diagnostic evaluation for anthrax. Signs and symptoms of anthrax include fever, chills, headache, malaise, nausea, vomiting, diarrhea, abdominal pain, diaphoresis, anorexia, nonproductive cough, difficulty breathing, dyspnea, stridor, hypoxemia, hypotension, shock, cyanosis, chest pain, lymphadenopathy, cutaneous ulcer and black eschar. If patient has NO signs or symptoms consistent with anthrax, document “asymptomatic SNOMEDCT 84387000.</div>'\n },\n subject: {\n reference: 'Patient/' + Patient.id.value\n },\n author: {\n reference: CCL.GenerateLocalReference('Device', Device.id)\n },\n status: 'active',\n code: {\n coding: { CCL.FormatCode("Document signs and symptoms code") }\n },\n extension: {\n { // flag-detail extension that references the exposure resource.\n url: 'http://hl7.org/fhir/StructureDefinition/flag-detail',\n valueReference: {\n reference: CCL.GenerateLocalReference(\n MostRecentAnthraxExposureResource.Type,\n MostRecentAnthraxExposureResource.Id)\n }\n }\n }\n }\n else null\n\n// List of references needed for Alert 2 (DetectedIssueExistingAntimicrobialRx).\ndefine ImplicatedExistingMedicationResources:\n (FormattedAntimicrobialMedicationResources) L\n return {\n reference: CCL.GenerateLocalReference(L.Type, L.Id)\n }\n\n// Strings needed to build message for Alert 2 (DetectedIssueExistingAntimicrobialRx).\ndefine CiprofloxacinRxText:\n if (HasCiprofloxacinRx) then {\n name: 'Ciprofloxacin',\n rx: 'Ciprofloxacin 500 mg by mouth every 12 hours for 60 days' } else null\n\ndefine DoxycyclineRxText:\n if (HasDoxycyclineRx) then {\n name: 'Doxycycline',\n rx: 'Doxycycline 100 mg by mouth every 12 hours for 60 days' } else null\n\ndefine LevofloxacinRxText:\n if (HasLevofloxacinRx) then {\n name: 'Levofloxacin',\n rx: 'Levofloxacin 750 mg by mouth once daily for 60 days' } else null\n\ndefine MoxifloxacinRxText:\n if (HasMoxifloxacinRx) then {\n name: 'Moxifloxacin',\n rx: 'Moxifloxacin 400 mg by mouth once daily for 60 days' } else null\n\ndefine ClindamycinRxText:\n if (HasClindamycinRx) then {\n name: 'Clindamycin',\n rx: 'Clindamycin 600 mg by mouth every 8 hours for 60 days]' } else null\n\n// Text string to be displayed in Alert 2 (DetectedIssueExistingAntimicrobialRx).\ndefine ExistingAntimicrobialText:\n Combine({\n 'The patient has an active prescription for [',\n Combine(\n CCL.CullNullStrings({\n CiprofloxacinRxText.name,\n DoxycyclineRxText.name,\n LevofloxacinRxText.name,\n MoxifloxacinRxText.name,\n ClindamycinRxText.name}), ' , '),\n ']. Evaluate the dosage and duration to ensure a 60-day regimen of appropriate antibiotic post-anthrax exposure: [',\n Combine(\n CCL.CullNullStrings({\n CiprofloxacinRxText.rx,\n DoxycyclineRxText.rx,\n LevofloxacinRxText.rx,\n MoxifloxacinRxText.rx,\n ClindamycinRxText.rx}), ' , '),\n '].'})\n\n/* Alert 2: Patient has at least one existing prescription to one of the recommended\nantimicrobials. If the patient is exposed, asymptomatic, and has an active Rx for\na pertinent antimicrobial, a DetectedIssue resource will be generated which will\nreference the most recent Medication resource for one of the antimicrobials. The\nsuggested mitigation will be to review the patient's medication to ensure it appropriately\nmeets CDC recommended dosage and duration. If the patient does not have an existing\nRx, then this DetectedIssue resource will be empty (null). */\ndefine DetectedIssueExistingAntimicrobialRx:\n if (RecentlyExposedToAnthrax and Is18orOlder and Asymptomatic and HasExistingAntimicrobialRx) then {\n resourceType: 'DetectedIssue',\n id: '3',\n detail: ExistingAntimicrobialText,\n author: {\n reference: CCL.GenerateLocalReference('Device', Device.id)\n },\n code: {\n coding: { CCL.FormatCode("Not equivalent alert code") }\n },\n implicated: ImplicatedExistingMedicationResources,\n mitigation: { {\n action: {\n coding: { CCL.FormatCode("Medication review code") }\n }\n } },\n status: 'preliminary'\n }\n else null\n\n// List of references needed for Alert 3 (FlagAntimicrobialMedicationAllergies).\ndefine AntimicrobialAllergyExtensionReferences:\n (AntimicrobialAllergyList) L\n return {\n url: 'http://hl7.org/fhir/StructureDefinition/flag-detail',\n valueReference: {\n reference: CCL.GenerateLocalReference(L.Type, L.Id)\n }\n }\n\n// Strings needed to build message for Alert 3 (FlagAntimicrobialMedicationAllergies).\ndefine CiprofloxacinAllergyText:\n if (exists(CiprofloxacinAllergyIntolerances)) then 'Ciprofloxacin' else null\n\ndefine DoxycyclineAllergyText:\n if (exists(DoxycyclineAllergyIntolerances)) then 'Doxycycline' else null\n\ndefine LevofloxacinAllergyText:\n if (exists(LevofloxacinAllergyIntolerances)) then 'Levofloxacin' else null\n\ndefine MoxifloxacinAllergyText:\n if (exists(MoxifloxacinAllergyIntolerances)) then 'Moxifloxacin' else null\n\ndefine ClindamycinAllergyText:\n if (exists(ClindamycinAllergyIntolerances)) then 'Clindamycin' else null\n\n// Text string to be displayed in Alert 3 (FlagAntimicrobialMedicationAllergies).\ndefine AllergyAlertText:\n Combine({\n '<div xmlns=\\"http://www.w3.org/1999/xhtml\\">Potential patient allergy to [',\n Combine(\n CCL.CullNullStrings({\n CiprofloxacinAllergyText,\n DoxycyclineAllergyText,\n LevofloxacinAllergyText,\n MoxifloxacinAllergyText,\n ClindamycinAllergyText}), ' , '),\n ']. Confirm allergy status.</div>'})\n\n/* Alert 3: Patient potentially has an allergy to one of the antimicrobials. If the\npatient is exposed, asymptomatic, and has an AllergyIntolerance resource for one\nof the recommended antimicrobials, a Flag resource will be generated to alert on\nthis. The list of potential allergies are included in the flag-detail extension\nfield. If the patient has no allergies, then this Flag resource will be empty (null). */\ndefine FlagAntimicrobialMedicationAllergies:\n if (RecentlyExposedToAnthrax and Is18orOlder and Asymptomatic and HasAntimicrobialAllergy) then {\n resourceType: 'Flag',\n id: '4',\n text: {\n status: 'generated',\n "div": AllergyAlertText\n },\n subject: {\n reference: 'Patient/' + Patient.id.value\n },\n author: {\n reference: CCL.GenerateLocalReference('Device', Device.id)\n },\n status: 'active',\n code: {\n coding: { CCL.FormatCode("Verify allergy status code") }\n },\n extension: AntimicrobialAllergyExtensionReferences\n }\n else null\n\n// List of references needed for Alert 4 (FlagBioThraxAllergy).\ndefine VaccineAllergyExtensionReferences:\n (VaccineAllergyList) L\n return {\n url: 'http://hl7.org/fhir/StructureDefinition/flag-detail',\n valueReference: {\n reference: CCL.GenerateLocalReference(L.Type, L.Id)\n }\n }\n\n/* Alert 4: Patient potentially has an allergy to the anthrax vaccine. If the\npatient is exposed, asymptomatic, and has an AllergyIntolerance resource for the\nanthrax vaccine, a Flag resource will be generated to alert on this. The list of\npotential AllergyIntolerance resources are included in the flag-detail extension\nfield of the Flag. If the patient has no allergies to the vaccine, then this Flag\nresource will be empty (null). */\ndefine FlagBioThraxAllergy:\n if (RecentlyExposedToAnthrax and Is18orOlder and Asymptomatic and HasVaccineAllergy) then {\n resourceType: 'Flag',\n id: '5',\n text: {\n status: 'generated',\n "div": '<div xmlns=\\"http://www.w3.org/1999/xhtml\\">Potential patient allergy to BioThrax. Confirm allergy status.</div>'\n },\n subject: {\n reference: 'Patient/' + Patient.id.value\n },\n author: {\n reference: CCL.GenerateLocalReference('Device', Device.id)\n },\n status: 'active',\n code: {\n coding: { CCL.FormatCode("Verify allergy status code") }\n },\n extension: VaccineAllergyExtensionReferences\n }\n else null\n\n// List of references needed for Alert 5 (FlagLatexAllergy).\ndefine LatexAllergyExtensionReferences:\n (LatexAllergyList) L\n return {\n url: 'http://hl7.org/fhir/StructureDefinition/flag-detail',\n valueReference: {\n reference: CCL.GenerateLocalReference(L.Type, L.Id)\n }\n }\n\n/* Alert 5: Patient potentially has an allergy to latex. If the patient is exposed,\nasymptomatic, and has resources indicating an allergy to latex, a Flag resource\nwill be generated to alert on this. The list of potential resources indicating a\nlatex allergy are included in the flag-detail extension field of the Flag. If the\npatient has no allergies to latex, then this Flag resource will be empty (null). */\ndefine FlagLatexAllergy:\n if (RecentlyExposedToAnthrax and Is18orOlder and Asymptomatic and HasLatexAllergy) then {\n resourceType: 'Flag',\n id: '6',\n text: {\n status: 'generated',\n "div": '<div xmlns=\\"http://www.w3.org/1999/xhtml\\">Potential patient allergy to latex. The stopper of BioThrax (anthrax vaccine) vial contains latex. Confirm allergy status.</div>'\n },\n subject: {\n reference: 'Patient/' + Patient.id.value\n },\n author: {\n reference: CCL.GenerateLocalReference('Device', Device.id)\n },\n status: 'active',\n code: {\n coding: { CCL.FormatCode("Verify allergy status code") }\n },\n extension: LatexAllergyExtensionReferences\n }\n else null\n\n// List of references needed for Alert 6 (DetectedIssueBioThraxHistoryInconsistencies).\ndefine ImplicatedVaccineProcedure:\n {\n reference: CCL.GenerateLocalReference('Procedure', MostRecentVaccineProcedure.id.value)\n }\n\n/* Alert 6: Patient BioThrax dosing history has data consistency issues. Either\nthere is an indication that the recommended dosing sequence was not followed (i.e.,\nthere is a missing dose), or the last vaccine Procedure is missing a date. Under\nthese conditions this CDS cannot reliably provide the correct PEP treatment\nrecommendations. If there is a missing dose in the vaccine sequence, or if the\nlast vaccine Procedure is missing a date, then a DetectedIssue resource will be\ngenerated which will reference the most recent vaccine Procedure resource. The\nsuggested mitigation will be to review the patient's medication to ensure it appropriately\nmeets CDC guidelines. If no inconsistencies are found, then this DetectedIssue resource\nwill be empty (null). */\ndefine DetectedIssueBioThraxHistoryInconsistencies:\n if ( RecentlyExposedToAnthrax and Is18orOlder and Asymptomatic and\n (LastVaccineProcedureMissingDate or MissingVaccineDose) ) then {\n resourceType: 'DetectedIssue',\n id: '7',\n detail: 'Potential BioThrax vaccine series problem(s) identified. A vaccine in the recommended series might be missing or a vaccination date might be missing. Review BioThrax vaccine series history.',\n author: {\n reference: CCL.GenerateLocalReference('Device', Device.id)\n },\n code: {\n coding: { CCL.FormatCode("Timing detected issue code") }\n },\n implicated: { ImplicatedVaccineProcedure },\n mitigation: { {\n action: {\n coding: { CCL.FormatCode("Medication review code") }\n }\n } },\n status: 'preliminary'\n }\n else null\n\n// ------------- ORDER SET ----------------------------------------------------\n/* The main output of this CDS is an order set which specifies the recommended\ntreatment for Anthrax PEP. This treatment could include a dose of the Anthrax\nvaccine, a prescription for a recommended antimicrobial, both, or neither.\n*/\n\n/* The appropriate Procedure codes for the next dose of the Anthrax vaccine. If the\npatient is not getting another dose at this time, then this will be empty.\n*/\ndefine VaccineCoding:\n case\n when NextVaccineDoseNumber = 1 then {\n coding: {\n CCL.FormatCode("Anthrax vaccination code"),\n CCL.FormatCode("First anthrax vaccination code")\n }\n }\n when NextVaccineDoseNumber = 2 then {\n coding: {\n CCL.FormatCode("Anthrax vaccination code"),\n CCL.FormatCode("Second anthrax vaccination code")\n }\n }\n when NextVaccineDoseNumber = 3 then {\n coding: {\n CCL.FormatCode("Anthrax vaccination code"),\n CCL.FormatCode("Third anthrax vaccination code")\n }\n }\n else null\n end\n\n// Additional instructions for the VaccineRequest.\ndefine VaccineAdditionalInstructions:\n if (IsPregnant) then {\n {\n text: 'Pregnant women at risk for inhalation anthrax should receive the anthrax vaccine regardless of pregnancy trimester.'\n },\n {\n text: 'Epinephrine solution (1:1000) should be available for immediate use in the event that an anaphylactic reaction occurs.'\n }\n }\n else {\n text: 'Epinephrine solution (1:1000) should be available for immediate use in the event that an anaphylactic reaction occurs.'\n }\n\n// Description to be used in all ActivityDefintion resources generated by this library\ndefine ActivityDefinitionDescription:\n 'In 2009, the US Advisory Committee on Immunization Practices recommended in addition to antimicrobial therapy, a 3-dose series of Anthrax Vaccine Adsorbed (AVA) BioThrax (Emergent BioSolutions Inc., Rockville, MD, USA) for long-term protection after exposure to anthrax in individuals without any previous vaccine. After exposure to aerosolized B. anthracis spores, antimicrobial therapy should be initiated as soon as possible. Ideally, the first dose of vaccine should be administered within 10 days. ACIP recommends a post exposure regimen of 60 days of appropriate antimicrobial prophylaxis (covered previously) combined with 3 subcutaneous doses of AVA (administered at 0, 2, and 4 weeks post exposure) as the most effective protection against inhalation anthrax for previously unvaccinated persons aged ≥18 years who have been exposed to aerosolized B. anthracis spores. In general, the peak serologic response to anthrax vaccine occurs 10–14 days after the third dose. (Wright, J.G et al., Morbidity and Mortality Weekly Report, July 23, 2010 / 59(RR06); 1-30). Additionally, the Advisory Committee on Immunization Practices subsequently reviewed all safety data available as of March 2008, including the final results of a retrospective study, and concluded that AVA is safe to administer to anthrax-exposed women during pregnancy. In the setting of an anthrax event that poses a high risk for exposure to aerosolized B. anthracis spores, pregnancy is neither a precaution nor a contraindication to vaccination. Pregnant women at risk for inhalation anthrax should receive AVA and antimicrobial drug therapy regardless of pregnancy trimester (Meanye-Delman D et al., Emerg Infect Dis, 20(2), 2014).'\n\n// Purpose to be used in all ActivityDefintion resources generated by this library\ndefine ActivityDefinitionPurpose:\n 'Provides clinicians with information for quickly assessing individuals exposed to anthrax unrelated to occupational exposure, for example in bioterrorism events, and provides the recommended post-exposure prophylaxis (PEP) regimen for asymptomatic patients. Includes immediate treatment with antimicrobials and vaccine and follow-up administration of subsequent vaccines to complete the recommended 3-dose vaccination series.'\n\n// Usage to be used in all ActivityDefintion resources generated by this library\ndefine ActivityDefinitionUsage:\n 'Intended for use by clinicians caring for individuals ≥18 years of age in an outpatient setting.'\n\n// UsageContext to be used in all ActivityDefinition and PlanDefinition resources generated by this library\ndefine TreatmentUseContext:\n {\n {\n code: CCL.FormatCode("FHIR age range usage context code"),\n valueRange: {\n low: {\n value: 18\n }\n }\n },\n {\n code: CCL.FormatCode("FHIR clinical venue usage context code"),\n valueCodeableConcept: {\n coding: { CCL.FormatCode("SNOMED outpatient code") }\n }\n },\n {\n code: CCL.FormatCode("FHIR clinical focus usage context code"),\n valueCodeableConcept: {\n coding: { CCL.FormatCode("Exposure to Anthrax code") }\n }\n },\n {\n code: CCL.FormatCode("FHIR clinical focus usage context code"),\n valueCodeableConcept: {\n coding: { CCL.FormatCode("Exposure to Bacillus anthracis (event) code") }\n }\n },\n {\n code: CCL.FormatCode("FHIR clinical focus usage context code"),\n valueCodeableConcept: {\n coding: { CCL.FormatCode("Asymptomatic code") }\n }\n }\n }\n\n// Topics for this library (used in all generated ActivityDefinition and PlanDefinition resources)\ndefine Topics:\n {\n {\n text: 'Anthrax'\n },\n {\n text: 'Emergency Medicine'\n },\n {\n text: 'Post-Exposure Prophylaxis'\n }\n }\n\n// Contributors for this library (used in all generated ActivityDefinition and PlanDefinition resources)\ndefine Author:\n {\n name: 'Alliance to Modernize Healthcare FFRDC'\n }\n\ndefine Endorser:\n {\n name: 'Centers for Disease Control and Prevention'\n }\n// Contact information for this library (used in all generated ActivityDefinition and PlanDefinition resources)\ndefine ContactInfo:\n {\n {\n telecom: {\n {\n system: 'url',\n value: 'https://cds.ahrq.gov/cdsconnect/artifact/anthrax-post-exposure-prophylaxis',\n use: 'work'\n }\n }\n }\n }\n\n// Copyright statement for this library (used in all generated ActivityDefinition and PlanDefinition resources)\ndefine CopyrightStatement:\n '(C) 2018 The MITRE Corporation. All Rights Reserved.'\n\n// An ActivityDefinition resource representing an ImmunizationRecommendation.\ndefine VaccineRequest:\n {\n resourceType: 'ActivityDefinition',\n id: 'VaccineRequest',\n url: 'https://cds.ahrq.gov/cdsconnect/artifact/anthrax-post-exposure-prophylaxis',\n identifier: {\n {\n value: 'Anthrax_Post_Exposure_Prophylaxis_FHIRv400_CQL_v110/VaccineRequest'\n }\n },\n version: CqlVersion,\n name: 'Anthrax_Post_Exposure_Prophylaxis_Adults_Vaccine_Request',\n title: 'Anthrax Post Exposure Prophylaxis (PEP) for Adults: Vaccine Request',\n status: 'draft',\n experimental: true,\n date: '2019-06-07',\n publisher: 'Centers for Disease Control and Prevention',\n description: ActivityDefinitionDescription,\n purpose: ActivityDefinitionPurpose,\n usage: ActivityDefinitionUsage,\n approvalDate: '2019-06-07',\n lastReviewDate: '2019-06-07',\n effectivePeriod: {\n start: '2019-06-07'\n },\n useContext: TreatmentUseContext,\n topic: Topics,\n author: {Author},\n endorser: {Endorser},\n contact: ContactInfo,\n copyright: CopyrightStatement,\n kind: 'ImmunizationRecommendation',\n code: VaccineCoding,\n productCodeableConcept: {\n coding: { CCL.FormatCode("Anthrax vaccine CVX code") }\n },\n dosage: {\n {\n text: '0.5mL',\n additionalInstruction: VaccineAdditionalInstructions,\n doseAndRate: { {\n doseQuantity: {\n value: 0.5,\n unit: 'mL',\n system: 'http://unitsofmeasure.org',\n code: 'mL'\n }\n } },\n route: {\n coding: { CCL.FormatCode("Subcutaneous route code") }\n }\n }\n }\n }\n\n// The title VaccineAction depends on what dose the patient is getting.\ndefine VaccineActionTitle:\n case\n when NextVaccineDoseNumber = 1 then 'Anthrax Vaccination - 1st dose'\n when NextVaccineDoseNumber = 2 then 'Anthrax Vaccination - 2nd dose'\n when NextVaccineDoseNumber = 3 then 'Anthrax Vaccination - 3rd dose'\n else ''\n end\n\n/* The vaccine Action to appear in the order set. References VaccineRequest resource.\nIf the patient doesn't meet the inclusion criteria and isn't ready for the next dose,\nthen this will be empty.\n*/\ndefine VaccineAction:\n if (RecentlyExposedToAnthrax and Is18orOlder and Asymptomatic and ReadyForNextVaccineDose) then {\n title: VaccineActionTitle,\n type: {\n coding: { CCL.FormatCode("FHIR ActionType create code") }\n },\n definitionCanonical: '#' + VaccineRequest.id\n } else null\n\n// If the patient is pregnant, additional text will be added to the CiprofloxacinRequest.\ndefine PregnancyPriorityCiprofloxacin:\n if (IsPregnant) then 'FIRST CHOICE: '\n else ''\n\n/* Additional instructions for the antimicrobials, which is only displayed for patients who\nare pregnant.\n*/\ndefine AntimicrobialPregnancyInstructions:\n if (IsPregnant) then\n {\n text: 'Pregnant women at risk for inhalation anthrax should receive antimicrobial drug therapy regardless of pregnancy trimester.'\n }\n else null\n\n/* Additional instructions for the CiprofloxacinRequest, including a message displayed only\nfor pregnant patients.\n*/\ndefine CiprofloxacinAdditionalInstructions:\n AntimicrobialPregnancyInstructions union\n {\n {\n text: 'CONTRAINDICATIONS: Diagnosis of myasthenia gravis and taking tizanidine.'\n },\n {\n text: 'CAUTIONS: If patient is taking blood thinners, oral antidiabetic drugs, seizure drugs, theophylline, drugs that prolong QT interval, duloxetine (Cymbalta), zolpidem (Ambien), clozapine or any other drug that may interact and cause serious side effects, consider another antibiotic regimen.'\n },\n {\n text: 'Provide patient education on medications.'\n }\n }\n\n// An ActivityDefinition resource representing a MedicationRequest for Ciprofloxacin.\ndefine CiprofloxacinRequest:\n {\n resourceType: 'ActivityDefinition',\n id: 'CiprofloxacinRequest',\n url: 'https://cds.ahrq.gov/cdsconnect/artifact/anthrax-post-exposure-prophylaxis',\n identifier: {\n {\n value: 'Anthrax_Post_Exposure_Prophylaxis_FHIRv400_CQL_v110/CiprofloxacinRequest'\n }\n },\n version: CqlVersion,\n name: 'Anthrax_Post_Exposure_Prophylaxis_Adults_Ciprofloxacin_Request',\n title: 'Anthrax Post Exposure Prophylaxis (PEP) for Adults: Ciprofloxacin Request',\n status: 'draft',\n experimental: true,\n date: '2019-06-07',\n publisher: 'Centers for Disease Control and Prevention',\n description: ActivityDefinitionDescription,\n purpose: ActivityDefinitionPurpose,\n usage: ActivityDefinitionUsage,\n approvalDate: '2019-06-07',\n lastReviewDate: '2019-06-07',\n effectivePeriod: {\n start: '2019-06-07'\n },\n useContext: TreatmentUseContext,\n topic: Topics,\n author: {Author},\n endorser: {Endorser},\n contact: ContactInfo,\n copyright: CopyrightStatement,\n kind: 'MedicationRequest',\n productCodeableConcept: {\n coding: { CCL.FormatCode("Ciprofloxacin Rx code") },\n text: PregnancyPriorityCiprofloxacin + "Ciprofloxacin Rx code".display\n },\n quantity: {\n value: 120,\n system: 'http://hl7.org/fhir/v3/orderableDrugForm',\n code: 'ORTAB'\n },\n dosage: {\n {\n text: 'One every 12 hours for 60 days',\n additionalInstruction: CiprofloxacinAdditionalInstructions,\n patientInstruction: 'Take with full glass of water',\n timing: {\n repeat: {\n frequency: 1,\n period: 12,\n periodUnit: 'h'\n }\n },\n route: {\n coding: { CCL.FormatCode("Oral route code") }\n },\n method: {\n coding: { CCL.FormatCode("Swallow dosing instruction code") }\n }\n }\n }\n }\n\n// If the patient is pregnant, additional text will be added to the DoxycyclineRequest.\ndefine PregnancyPriorityDoxycycline:\n if (IsPregnant) then 'SECOND CHOICE: '\n else ''\n\n/* Additional instructions for the DoxycyclineRequest, including a message displayed only\nfor pregnant patients.\n*/\ndefine DoxycyclineAdditionalInstructions:\n AntimicrobialPregnancyInstructions union\n {\n {\n text: 'CAUTIONS: If patient is taking blood thinners, oral antidiabetic drugs, seizure drugs, or any other drug that may interact and cause serious side effects, consider another antibiotic regimen.'\n },\n {\n text: 'Provide patient education on medications.'\n }\n }\n\n// An ActivityDefinition resource representing a MedicationRequest for Doxycycline.\ndefine DoxycyclineRequest:\n {\n resourceType: 'ActivityDefinition',\n id: 'DoxycyclineRequest',\n url: 'https://cds.ahrq.gov/cdsconnect/artifact/anthrax-post-exposure-prophylaxis',\n identifier: {\n {\n value: 'Anthrax_Post_Exposure_Prophylaxis_FHIRv400_CQL_v110/DoxycyclineRequest'\n }\n },\n version: CqlVersion,\n name: 'Anthrax_Post_Exposure_Prophylaxis_Adults_Doxycycline_Request',\n title: 'Anthrax Post Exposure Prophylaxis (PEP) for Adults: Doxycycline Request',\n status: 'draft',\n experimental: true,\n date: '2019-06-07',\n publisher: 'Centers for Disease Control and Prevention',\n description: ActivityDefinitionDescription,\n purpose: ActivityDefinitionPurpose,\n usage: ActivityDefinitionUsage,\n approvalDate: '2019-06-07',\n lastReviewDate: '2019-06-07',\n effectivePeriod: {\n start: '2019-06-07'\n },\n useContext: TreatmentUseContext,\n topic: Topics,\n author: {Author},\n endorser: {Endorser},\n contact: ContactInfo,\n copyright: CopyrightStatement,\n kind: 'MedicationRequest',\n productCodeableConcept: {\n coding: { CCL.FormatCode("Doxycycline Rx code") },\n text: PregnancyPriorityDoxycycline + "Doxycycline Rx code".display\n },\n quantity: {\n value: 120,\n system: 'http://hl7.org/fhir/v3/orderableDrugForm',\n code: 'ORTAB'\n },\n dosage: {\n {\n text: 'One every 12 hours for 60 days',\n additionalInstruction: DoxycyclineAdditionalInstructions,\n patientInstruction: 'Take with full glass of water',\n timing: {\n repeat: {\n frequency: 1,\n period: 12,\n periodUnit: 'h'\n }\n },\n route: {\n coding: { CCL.FormatCode("Oral route code") }\n },\n method: {\n coding: { CCL.FormatCode("Swallow dosing instruction code") }\n }\n }\n }\n }\n\n/* Additional instructions for the LevofloxacinRequest, including a message displayed only\nfor pregnant patients.\n*/\ndefine LevofloxacinAdditionalInstructions:\n if (IsPregnant) then { AntimicrobialPregnancyInstructions }\n else { { text: 'none'} }\n\n// An ActivityDefinition resource representing a MedicationRequest for Levofloxacin.\ndefine LevofloxacinRequest:\n {\n resourceType: 'ActivityDefinition',\n id: 'LevofloxacinRequest',\n url: 'https://cds.ahrq.gov/cdsconnect/artifact/anthrax-post-exposure-prophylaxis',\n identifier: {\n {\n value: 'Anthrax_Post_Exposure_Prophylaxis_FHIRv400_CQL_v110/LevofloxacinRequest'\n }\n },\n version: CqlVersion,\n name: 'Anthrax_Post_Exposure_Prophylaxis_Adults_Levofloxacin_Request',\n title: 'Anthrax Post Exposure Prophylaxis (PEP) for Adults: Levofloxacin Request',\n status: 'draft',\n experimental: true,\n date: '2019-06-07',\n publisher: 'Centers for Disease Control and Prevention',\n description: ActivityDefinitionDescription,\n purpose: ActivityDefinitionPurpose,\n usage: ActivityDefinitionUsage,\n approvalDate: '2019-06-07',\n lastReviewDate: '2019-06-07',\n effectivePeriod: {\n start: '2019-06-07'\n },\n useContext: TreatmentUseContext,\n topic: Topics,\n author: {Author},\n endorser: {Endorser},\n contact: ContactInfo,\n copyright: CopyrightStatement,\n kind: 'MedicationRequest',\n productCodeableConcept: {\n coding: { CCL.FormatCode("Levofloxacin Rx code") },\n text: "Levofloxacin Rx code".display\n },\n quantity: {\n value: 60,\n system: 'http://hl7.org/fhir/v3/orderableDrugForm',\n code: 'ORTAB'\n },\n dosage: {\n {\n text: 'One every day for 60 days',\n additionalInstruction: LevofloxacinAdditionalInstructions,\n timing: {\n repeat: {\n frequency: 1,\n period: 1,\n periodUnit: 'd'\n }\n },\n route: {\n coding: { CCL.FormatCode("Oral route code") }\n },\n method: {\n coding: { CCL.FormatCode("Swallow dosing instruction code") }\n }\n }\n }\n }\n\n/* Additional instructions for the MoxifloxacinRequest, including a message displayed only\nfor pregnant patients.\n*/\ndefine MoxifloxacinAdditionalInstructions:\n if (IsPregnant) then { AntimicrobialPregnancyInstructions }\n else { { text: 'none'} }\n\n// An ActivityDefinition resource representing a MedicationRequest for Moxifloxacin.\ndefine MoxifloxacinRequest:\n {\n resourceType: 'ActivityDefinition',\n id: 'MoxifloxacinRequest',\n url: 'https://cds.ahrq.gov/cdsconnect/artifact/anthrax-post-exposure-prophylaxis',\n identifier: {\n {\n value: 'Anthrax_Post_Exposure_Prophylaxis_FHIRv400_CQL_v110/MoxifloxacinRequest'\n }\n },\n version: CqlVersion,\n name: 'Anthrax_Post_Exposure_Prophylaxis_Adults_Moxifloxacin_Request',\n title: 'Anthrax Post Exposure Prophylaxis (PEP) for Adults: Moxifloxacin Request',\n status: 'draft',\n experimental: true,\n date: '2019-06-07',\n publisher: 'Centers for Disease Control and Prevention',\n description: ActivityDefinitionDescription,\n purpose: ActivityDefinitionPurpose,\n usage: ActivityDefinitionUsage,\n approvalDate: '2019-06-07',\n lastReviewDate: '2019-06-07',\n effectivePeriod: {\n start: '2019-06-07'\n },\n useContext: TreatmentUseContext,\n topic: Topics,\n author: {Author},\n endorser: {Endorser},\n contact: ContactInfo,\n copyright: CopyrightStatement,\n kind: 'MedicationRequest',\n productCodeableConcept: {\n coding: { CCL.FormatCode("Moxifloxacin Rx code") },\n text: "Moxifloxacin Rx code".display\n },\n quantity: {\n value: 60,\n system: 'http://hl7.org/fhir/v3/orderableDrugForm',\n code: 'ORTAB'\n },\n dosage: {\n {\n text: 'One every day for 60 days',\n additionalInstruction: MoxifloxacinAdditionalInstructions,\n timing: {\n repeat: {\n frequency: 1,\n period: 1,\n periodUnit: 'd'\n }\n },\n route: {\n coding: { CCL.FormatCode("Oral route code") }\n },\n method: {\n coding: { CCL.FormatCode("Swallow dosing instruction code") }\n }\n }\n }\n }\n\n/* Additional instructions for the ClindamycinRequest, including a message displayed only\nfor pregnant patients.\n*/\ndefine ClindamycinAdditionalInstructions:\n if (IsPregnant) then { AntimicrobialPregnancyInstructions }\n else { { text: 'none'} }\n\n// An ActivityDefinition resource representing a MedicationRequest for Clindamycin.\ndefine ClindamycinRequest:\n {\n resourceType: 'ActivityDefinition',\n id: 'ClindamycinRequest',\n url: 'https://cds.ahrq.gov/cdsconnect/artifact/anthrax-post-exposure-prophylaxis',\n identifier: {\n {\n value: 'Anthrax_Post_Exposure_Prophylaxis_FHIRv400_CQL_v110/ClindamycinRequest'\n }\n },\n version: CqlVersion,\n name: 'Anthrax_Post_Exposure_Prophylaxis_Adults_Clindamycin_Request',\n title: 'Anthrax Post Exposure Prophylaxis (PEP) for Adults: Clindamycin Request',\n status: 'draft',\n experimental: true,\n date: '2019-06-07',\n publisher: 'Centers for Disease Control and Prevention',\n description: ActivityDefinitionDescription,\n purpose: ActivityDefinitionPurpose,\n usage: ActivityDefinitionUsage,\n approvalDate: '2019-06-07',\n lastReviewDate: '2019-06-07',\n effectivePeriod: {\n start: '2019-06-07'\n },\n useContext: TreatmentUseContext,\n topic: Topics,\n author: {Author},\n endorser: {Endorser},\n contact: ContactInfo,\n copyright: CopyrightStatement,\n kind: 'MedicationRequest',\n productCodeableConcept: {\n coding: { CCL.FormatCode("Clindamycin Rx code") },\n text: "Clindamycin Rx code".display\n },\n quantity: {\n value: 360,\n system: 'http://hl7.org/fhir/v3/orderableDrugForm',\n code: 'ORTAB'\n },\n dosage: {\n {\n text: 'Two tablets every 8 hours for 60 days',\n additionalInstruction: ClindamycinAdditionalInstructions,\n timing: {\n repeat: {\n frequency: 2,\n period: 8,\n periodUnit: 'h'\n }\n },\n route: {\n coding: { CCL.FormatCode("Oral route code") }\n },\n method: {\n coding: { CCL.FormatCode("Swallow dosing instruction code") }\n }\n }\n }\n }\n\n/* The antimicrobial Action to appear in the order set. References the five preceeding\nantimicrobial MedicationRequest resources. If the patient doesn't meet the inclusion\ncriteria and already has an existing prescription, then this will be empty.\n*/\ndefine AntimicrobialAction:\n if (RecentlyExposedToAnthrax and Is18orOlder and Asymptomatic) then {\n title: 'Antimicrobial medications for anthrax post-exposure prophylaxis',\n groupingBehavior: 'visual-group',\n selectionBehavior: 'at-most-one',\n action: {\n {\n title: 'First line antimicrobial medications for anthrax post-exposure prophylaxis',\n groupingBehavior: 'visual-group',\n selectionBehavior: 'at-most-one',\n action: {\n {\n type: {\n coding: { CCL.FormatCode("FHIR ActionType create code") }\n },\n definitionCanonical: '#' + CiprofloxacinRequest.id\n },\n {\n type: {\n coding: { CCL.FormatCode("FHIR ActionType create code") }\n },\n definitionCanonical: '#' + DoxycyclineRequest.id\n }\n }\n },\n {\n title: 'Second line antimicrobial medications for anthrax post-exposure prophylaxis',\n groupingBehavior: 'visual-group',\n selectionBehavior: 'at-most-one',\n action: {\n {\n type: {\n coding: { CCL.FormatCode("FHIR ActionType create code") }\n },\n definitionCanonical: '#' + LevofloxacinRequest.id\n },\n {\n type: {\n coding: { CCL.FormatCode("FHIR ActionType create code") }\n },\n definitionCanonical: '#' + MoxifloxacinRequest.id\n },\n {\n type: {\n coding: { CCL.FormatCode("FHIR ActionType create code") }\n },\n definitionCanonical: '#' + ClindamycinRequest.id\n }\n }\n }}\n } else null\n\n/* The list of actions for the PlanDefinition order set. It can consist of AntimicrobialAction,\nVaccineAction, both, or neither.\n*/\ndefine ActionList:\n if (VaccineAction is not null) then\n if (AntimicrobialAction is not null) then {\n AntimicrobialAction,\n VaccineAction\n }\n else {\n VaccineAction\n }\n else\n if (AntimicrobialAction is not null) then {\n AntimicrobialAction\n }\n else null\n\n/* To make packaging the order set easier, we embed all the Actions into the order set\nusing FHIR contained resources. This list of contained resources can contain the\nActivityDefinitions for the antimicrobial, the vaccine, both, or neither.\n*/\ndefine ContainedResourcesList:\n if (VaccineAction is not null) then\n if (AntimicrobialAction is not null) then {\n CiprofloxacinRequest,\n DoxycyclineRequest,\n LevofloxacinRequest,\n MoxifloxacinRequest,\n ClindamycinRequest,\n VaccineRequest\n }\n else {\n VaccineRequest\n }\n else\n if (AntimicrobialAction is not null) then {\n CiprofloxacinRequest,\n DoxycyclineRequest,\n LevofloxacinRequest,\n MoxifloxacinRequest,\n ClindamycinRequest\n }\n else null\n\ndefine GenerateOrderSet:\n RecentlyExposedToAnthrax and Is18orOlder and Asymptomatic\n\n/* The order set containing the recommended treatment for Anthrax PEP. It references the\nActionList and the ContainedResourcesList. If treatment is not recommended, then this\nresource will be empty.\n*/\ndefine OrderSet:\n if (GenerateOrderSet) then {\n resourceType: 'PlanDefinition',\n url: 'https://cds.ahrq.gov/cdsconnect/artifact/anthrax-post-exposure-prophylaxis',\n identifier: {\n {\n value: 'Anthrax_Post_Exposure_Prophylaxis_FHIRv400_CQL_v110/OrderSet'\n }\n },\n version: CqlVersion,\n name: 'Anthrax_Post_Exposure_Prophylaxis_Adults',\n title: 'Anthrax Post Exposure Prophylaxis (PEP) for Adults',\n status: 'draft',\n experimental: true,\n type: {\n coding: {\n CCL.FormatCode("FHIR PlanDefinition eca-rule code"),\n CCL.FormatCode("FHIR PlanDefinition order-set code")\n }\n },\n date: '2019-06-07',\n publisher: 'Centers for Disease Control and Prevention',\n description: 'Provides information for treating patients greater than or equal to 18 years old exposed to anthrax within the past 60 days, who do not have anthrax. It is divided into two parts: \\\\n- Part #1: For patients that may be symptomatic to flag the need to conduct a full diagnostic evaluation to rule out anthrax before proceeding with post-exposure prophylaxis (PEP) \\\\n- Part #2: For patients who are asymptomatic (not displaying signs and symptoms of anthrax), it provides recommended PEP regimen',\n purpose: 'Provides clinicians with information for quickly assessing individuals exposed to anthrax unrelated to occupational exposure, for example in bioterrorism events, and provides the recommended post-exposure prophylaxis (PEP) regimen for asymptomatic patients. Includes immediate treatment with antimicrobials and vaccine and follow-up administration of subsequent vaccines to complete the recommended 3-dose vaccination series.',\n usage: 'Intended for use by clinicians caring for individuals ≥18 years of age in an outpatient setting.',\n approvalDate: '2019-06-07',\n lastReviewDate: '2019-06-07',\n effectivePeriod: {\n start: '2019-06-07'\n },\n useContext: TreatmentUseContext,\n jurisdiction: { { "coding": { CCL.FormatCode("United States code") } } },\n topic: Topics,\n author: {Author},\n endorser: {Endorser},\n contact: ContactInfo,\n copyright: CopyrightStatement,\n "library": {\n 'Library/Anthrax_Post_Exposure_Prophylaxis_FHIRv400_Library'\n },\n action: { {\n title: 'Anthrax Post Exposure Prophylaxis',\n groupingBehavior: 'logical-group',\n selectionBehavior: 'any',\n trigger: {\n {\n type: 'data-added',\n data: {\n {\n type: 'Condition',\n codeFilter: {\n {\n path: 'code',\n code: {\n CCL.FormatCode("Exposure to Anthrax code"),\n CCL.FormatCode("Exposure to Bacillus anthracis (event) code")\n }\n }\n }\n }\n }\n },\n {\n type: 'data-added',\n data: {\n {\n type: 'Observation',\n codeFilter: {\n {\n path: 'code',\n code: {\n CCL.FormatCode("Exposure to Anthrax code"),\n CCL.FormatCode("Exposure to Bacillus anthracis (event) code"),\n CCL.FormatCode("Asymptomatic code")\n }\n }\n }\n }\n }\n }\n },\n condition: {\n {\n kind: 'applicability',\n expression: {\n language: 'text/cql',\n expression: 'GenerateOrderSet'\n }\n }\n },\n action: ActionList\n } },\n contained: ContainedResourcesList\n }\n else null\n</code></pre><p><code>No Content</code> (<code>application/elm+xml</code>)</p></div>"
},
"url" : "http://cqframework.org/cpg-example-anthrax/Library/anthrax-post-exposure-prophylaxis-library",
"identifier" : [
{
"use" : "official",
"value" : "Anthrax_Post_Exposure_Prophylaxis_FHIRv400"
}
],
"version" : "1.1.0",
"name" : "Anthrax_Post_Exposure_Prophylaxis_FHIRv400_Library",
"title" : "Anthrax Post Exposure Prophylaxis (PEP) for Adults FHIRv400 Logic",
"status" : "draft",
"experimental" : true,
"type" : {
"coding" : [
{
"system" : "http://terminology.hl7.org/CodeSystem/library-type",
"code" : "logic-library"
}
]
},
"date" : "2024-11-18T16:43:41+00:00",
"publisher" : "HL7 International - Clinical Decision Support WG",
"contact" : [
{
"name" : "HL7 International - Clinical Decision Support WG",
"telecom" : [
{
"system" : "url",
"value" : "http://www.hl7.org/Special/committees/dss/index.cfm"
}
]
}
],
"description" : "Clinical decision support logic for Anthrax Post Exposure Prophylaxis (PEP) for Adults based on the following Centers for Disease Control and Prevention reports: \\n- Hendricks, K.A. et al., Centers for Disease Control and Prevention Expert Panel Meetings on Prevention and Treatment of Anthrax in Adults. Emerg Infect Dis, 20(20), Feb 2014. \\n - Hendricks, K.A. et al., Centers for Disease Control and Prevention Expert Panel Meetings on Prevention and Treatment of Anthrax in Adults: Technical Report. Emerg Infect Dis. 20(20), Feb 2014. \\n- Emergent BioSolutions, BioThrax Anthrax Vaccine Adsorbed (http://www.biothrax.com/whatisbiothrax/). \\n- Centers for Disease Control and Prevention, Ciprofloxacin for Post-Exposure Prophylaxis of Anthrax: Emergency Use Instructions for Healthcare Providers, 2017. \\n- Centers for Disease Control and Prevention. Doxycyxcline for Post-Exposure Prophylaxis of Anthrax: Emergency Use Instructions for Healthcare Providers, 2017. \\n- Public Health Information Network Vocabulary Access and Distribution System (PHIN VADS), PHVS_SignsSymptoms_Anthrax (OID 2.16.840.1.114222.4.11.3212), 2009. \\n- Meanye-Delman D et al., Special Considerations for Prophylaxis for and Treatment of Anthrax in Pregnant and Postpartum Women, Emerg Infect Dis, 20(2), 2014. \\n- Meanye-Delman D et al., Special Considerations for Prophylaxis for and Treatment of Anthrax in Pregnant and Postpartum Women: Technical Report, Emerg Infect Dis, 20(2), 2014. \\n- Wright, J.G et al., Use of Anthrax Vaccine in the United States: Recommendations of the Advisory Committee on Immunization Practices (ACIP), 2009, Morbidity and Mortality Weeklly Report, July 23, 2010 / 59(RR06); 1-30.",
"useContext" : [
{
"code" : {
"system" : "http://terminology.hl7.org/CodeSystem/usage-context-type",
"code" : "age",
"display" : "Age Range"
},
"valueRange" : {
"low" : {
"value" : 18
}
}
},
{
"code" : {
"system" : "http://terminology.hl7.org/CodeSystem/usage-context-type",
"code" : "venue",
"display" : "Clinical Venue"
},
"valueCodeableConcept" : {
"coding" : [
{
"system" : "http://snomed.info/sct",
"code" : "440655000",
"display" : "Outpatient environment"
}
]
}
},
{
"code" : {
"system" : "http://terminology.hl7.org/CodeSystem/usage-context-type",
"code" : "focus",
"display" : "Clinical Focus"
},
"valueCodeableConcept" : {
"coding" : [
{
"system" : "http://hl7.org/fhir/sid/icd-10-cm",
"code" : "Z20.810",
"display" : "Contact with and (suspected) exposure to anthrax"
}
]
}
},
{
"code" : {
"system" : "http://terminology.hl7.org/CodeSystem/usage-context-type",
"code" : "focus",
"display" : "Clinical Focus"
},
"valueCodeableConcept" : {
"coding" : [
{
"system" : "http://snomed.info/sct",
"code" : "170475009",
"display" : "Exposure to Bacillus anthracis (event)"
}
]
}
},
{
"code" : {
"system" : "http://terminology.hl7.org/CodeSystem/usage-context-type",
"code" : "focus",
"display" : "Clinical Focus"
},
"valueCodeableConcept" : {
"coding" : [
{
"system" : "http://snomed.info/sct",
"code" : "84387000",
"display" : "Asymptomatic (finding)"
}
]
}
}
],
"jurisdiction" : [
{
"coding" : [
{
"system" : "http://unstats.un.org/unsd/methods/m49/m49.htm",
"code" : "001",
"display" : "World"
}
]
}
],
"purpose" : "Provides clinicians with information for quickly assessing individuals exposed to anthrax unrelated to occupational exposure, for example in bioterrorism events, and provides the recommended post-exposure prophylaxis (PEP) regimen for asymptomatic patients. Includes immediate treatment with antimicrobials and vaccine and follow-up administration of subsequent vaccines to complete the recommended 3-dose vaccination series.",
"usage" : "Intended for use by clinicians caring for individuals ≥18 years of age in an outpatient setting.",
"topic" : [
{
"text" : "Anthrax"
},
{
"text" : "Emergency Medicine"
},
{
"text" : "Post-Exposure Prophylaxis"
}
],
"author" : [
{
"name" : "Alliance to Modernize Healthcare FFRDC"
}
],
"endorser" : [
{
"name" : "Centers for Disease Control and Prevention"
}
],
"content" : [
{
"contentType" : "text/cql",
"data" : "LyogIExpYnJhcnk6IEFudGhyYXggUG9zdCBFeHBvc3VyZSBQcm9waHlsYXhpcyAoUEVQKSBmb3IgQWR1bHRzLCBGSElSIFI0IGRhdGEgbW9kZWwuCiAgICBBdXRob3I6IENNUyBBbGxpYW5jZSB0byBNb2Rlcm5pemUgSGVhbHRoY2FyZSwgb3BlcmF0ZWQgYnkgVEhFIE1JVFJFIENvcnBvcmF0aW9uLgoKICAgIChDKSAyMDE5IFRoZSBNSVRSRSBDb3Jwb3JhdGlvbi4gQWxsIFJpZ2h0cyBSZXNlcnZlZC4gQXBwcm92ZWQgZm9yIFB1YmxpYyBSZWxlYXNlOiAxOS0yMDQ4LiBEaXN0cmlidXRpb24gVW5saW1pdGVkLgoKICAgIENoYW5nZSBsb2c6CiAgICAtIFZlcnNpb24gMS4xLjA6IFVwZGF0ZWQgb3V0cHV0IHJlc291cmNlcyB0byBhbGlnbiB3aXRoIGRyYWZ0IHByb2ZpbGVzIHBvc3RlZCBhdDoKICAgIGh0dHA6Ly9idWlsZC5maGlyLm9yZy9pZy9ITDcvY3FmLXJlY29tbWVuZGF0aW9ucy9wcm9maWxlcy5odG1sCiAgICBBbHNvIHJlZmFjdG9yZWQgQ1FMIHRv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vcn0sCiAgICBlbmRvcnNlcjoge0VuZG9yc2VyfSwKICAgIGNvbnRhY3Q6IENvbnRhY3RJbmZvLAogICAgY29weXJpZ2h0OiBDb3B5cmlnaHRTdGF0ZW1lbnQsCiAgICBraW5kOiAnTWVkaWNhdGlvblJlcXVlc3QnLAogICAgcHJvZHVjdENvZGVhYmxlQ29uY2VwdDogewogICAgICBjb2Rpbmc6IHsgQ0NMLkZvcm1hdENvZGUoIk1veGlmbG94YWNpbiBSeCBjb2RlIikgfSwKICAgICAgdGV4dDogIk1veGlmbG94YWNpbiBSeCBjb2RlIi5kaXNwbGF5CiAgICB9LAogICAgcXVhbnRpdHk6IHsKICAgICAgdmFsdWU6IDYwLAogICAgICBzeXN0ZW06ICdodHRwOi8vaGw3Lm9yZy9maGlyL3YzL29yZGVyYWJsZURydWdGb3JtJywKICAgICAgY29kZTogJ09SVEFCJwogICAgfSwKICAgIGRvc2FnZTogewogICAgICB7CiAgICAgICAgdGV4dDogJ09uZSBldmVyeSBkYXkgZm9yIDYwIGRheXMnLAogICAgICAgIGFkZGl0aW9uYWxJbnN0cnVjdGlvbjogTW94aWZsb3hhY2luQWRkaXRpb25hbEluc3RydWN0aW9ucywKICAgICAgICB0aW1pbmc6IHsKICAgICAgICAgIHJlcGVhdDogewogICAgICAgICAgICBmcmVxdWVuY3k6IDEsCiAgICAgICAgICAgIHBlcmlvZDogMSwKICAgICAgICAgICAgcGVyaW9kVW5pdDogJ2QnCiAgICAgICAgICB9CiAgICAgICAgfSwKICAgICAgICByb3V0ZTogewogICAgICAgICAgY29kaW5nOiB7IENDTC5Gb3JtYXRDb2RlKCJPcmFsIHJvdXRlIGNvZGUiKSB9CiAgICAgICAgfSwKICAgICAgICBtZXRob2Q6IHsKICAgICAgICAgIGNvZGluZzogeyBDQ0wuRm9ybWF0Q29kZSgiU3dhbGxvdyBkb3NpbmcgaW5zdHJ1Y3Rpb24gY29kZSIpIH0KICAgICAgICB9CiAgICAgIH0KICAgIH0KICB9CgovK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29udGV4dCwKICAgIGp1cmlzZGljdGlvbjogeyB7ICJjb2RpbmciOiB7IENDTC5Gb3JtYXRDb2RlKCJVbml0ZWQgU3RhdGVzIGNvZGUiKSB9IH0gfSwKICAgIHRvcGljOiBUb3BpY3MsCiAgICBhdXRob3I6IHtBdXRob3J9LAogICAgZW5kb3JzZXI6IHtFbmRvcnNlcn0sCiAgICBjb250YWN0OiBDb250YWN0SW5mbywKICAgIGNvcHlyaWdodDogQ29weXJpZ2h0U3RhdGVtZW50LAogICAgImxpYnJhcnkiOiB7CiAgICAgICdMaWJyYXJ5L0FudGhyYXhfUG9zdF9FeHBvc3VyZV9Qcm9waHlsYXhpc19GSElSdjQwMF9MaWJyYXJ5JwogICAgfSwKICAgIGFjdGlvbjogeyB7CiAgICAgIHRpdGxlOiAnQW50aHJheCBQb3N0IEV4cG9zdXJlIFByb3BoeWxheGlzJywKICAgICAgZ3JvdXBpbmdCZWhhdmlvcjogJ2xvZ2ljYWwtZ3JvdXAnLAogICAgICBzZWxlY3Rpb25CZWhhdmlvcjogJ2FueScsCiAgICAgIHRyaWdnZXI6IHsKICAgICAgICB7CiAgICAgICAgICB0eXBlOiAnZGF0YS1hZGRlZCcsCiAgICAgICAgICBkYXRhOiB7CiAgICAgICAgICAgIHsKICAgICAgICAgICAgICB0eXBlOiAnQ29uZGl0aW9uJywKICAgICAgICAgICAgICBjb2RlRmlsdGVyOiB7CiAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgIHBhdGg6ICdjb2RlJywKICAgICAgICAgICAgICAgICAgY29kZTogewogICAgICAgICAgICAgICAgICAgIENDTC5Gb3JtYXRDb2RlKCJFeHBvc3VyZSB0byBBbnRocmF4IGNvZGUiKSwKICAgICAgICAgICAgICAgICAgICBDQ0wuRm9ybWF0Q29kZSgiRXhwb3N1cmUgdG8gQmFjaWxsdXMgYW50aHJhY2lzIChldmVudCkgY29kZSIpCiAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KICAgICAgICAgIH0KICAgICAgICB9LAogICAgICAgIHsKICAgICAgICAgIHR5cGU6ICdkYXRhLWFkZGVkJywKICAgICAgICAgIGRhdGE6IHsKICAgICAgICAgICAgewogICAgICAgICAgICAgIHR5cGU6ICdPYnNlcnZhdGlvbicsCiAgICAgICAgICAgICAgY29kZUZpbHRlcjogewogICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICBwYXRoOiAnY29kZScsCiAgICAgICAgICAgICAgICAgIGNvZGU6IHsKICAgICAgICAgICAgICAgICAgICBDQ0wuRm9ybWF0Q29kZSgiRXhwb3N1cmUgdG8gQW50aHJheCBjb2RlIiksCiAgICAgICAgICAgICAgICAgICAgQ0NMLkZvcm1hdENvZGUoIkV4cG9zdXJlIHRvIEJhY2lsbHVzIGFudGhyYWNpcyAoZXZlbnQpIGNvZGUiKSwKICAgICAgICAgICAgICAgICAgICBDQ0wuRm9ybWF0Q29kZSgiQXN5bXB0b21hdGljIGNvZGUiKQogICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgfQogICAgICAgICAgICB9CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICB9LAogICAgICBjb25kaXRpb246IHsKICAgICAgICB7CiAgICAgICAgICBraW5kOiAnYXBwbGljYWJpbGl0eScsCiAgICAgICAgICBleHByZXNzaW9uOiB7CiAgICAgICAgICAgIGxhbmd1YWdlOiAndGV4dC9jcWwnLAogICAgICAgICAgICBleHByZXNzaW9uOiAnR2VuZXJhdGVPcmRlclNldCcKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgIH0sCiAgICAgIGFjdGlvbjogQWN0aW9uTGlzdAogICAgfSB9LAogICAgY29udGFpbmVkOiBDb250YWluZWRSZXNvdXJjZXNMaXN0CiAgfQogIGVsc2UgbnVsbAo="
},
{
"contentType" : "application/elm+xml"
}
]
}