US Public Health Profiles Library
2.0.0-ballot - STU 2 - Ballot United States of America flag

US Public Health Profiles Library, published by HL7 International / Public Health. This guide is not an authorized publication; it is the continuous build for version 2.0.0-ballot built by the FHIR (HL7® FHIR® Standard) CI Build. This version is based on the current content of https://github.com/HL7/fhir-us-ph-library/ and changes regularly. See the Directory of published versions

: US Public Health PlanDefinition - Alternative Expression - XML Representation

Page standards status: Informative

Raw xml | Download


<PlanDefinition xmlns="http://hl7.org/fhir">
  <id value="us-ph-plandefinition-alt-expression-example"/>
  <meta>
    <profile
             value="http://hl7.org/fhir/us/ph-library/StructureDefinition/us-ph-plandefinition"/>
  </meta>
  <text>
    <status value="extensions"/>
    <div xmlns="http://www.w3.org/1999/xhtml">
<div>
    <table class="grid dict">
        
        <tr>
            <th scope="row"><b>Id: </b></th>
            <td style="padding-left: 4px;">us-ph-plandefinition-alt-expression-example</td>
        </tr>
        

        
        <tr>
            <th scope="row"><b>Url: </b></th>
            <td style="padding-left: 4px;"><a href="PlanDefinition-us-ph-plandefinition-alt-expression-example.html">US Public Health PlanDefinition Alternative Expression Example</a></td>
        </tr>
        

        
        <tr>
            <th scope="row"><b>Version: </b></th>
            <td style="padding-left: 4px;">2.0.0-ballot</td>
        </tr>
        

        
        <tr>
            <th scope="row">
                <b>
                    
                        
                    
                </b>
            </th>
            <td style="padding-left: 4px;">
                
                <p style="margin-bottom: 5px;">
                    <span>urn:oid:2.16.840.1.113883.4.642.40.58.34.1</span>
                </p>
                
            </td>
        </tr>
        

        
        <tr>
            <th scope="row"><b>Title: </b></th>
            <td style="padding-left: 4px;">US Public Health PlanDefinition Alternative Expression Example</td>
        </tr>
        

        

        

        
        <tr>
            <th scope="row"><b>Experimental: </b></th>
            <td style="padding-left: 4px;">true</td>
        </tr>
        

        
        <tr>
            <th scope="row"><b>Type: </b></th>
            <td style="padding-left: 4px;">
                
                    
                        
                        <p style="margin-bottom: 5px;">
                            <b>system: </b> <span><a href="http://terminology.hl7.org/6.5.0/CodeSystem-plan-definition-type.html">http://terminology.hl7.org/CodeSystem/plan-definition-type</a></span>
                        </p>
                        
                        
                        <p style="margin-bottom: 5px;">
                            <b>code: </b> <span>workflow-definition</span>
                        </p>
                        
                        
                        <p style="margin-bottom: 5px;">
                            <b>display: </b> <span>Workflow Definition</span>
                        </p>
                        
                    
                
                
            </td>
        </tr>
        

        

        
        <tr>
            <th scope="row"><b>Date: </b></th>
            <td style="padding-left: 4px;">2022-07-31 12:32:29-0500</td>
        </tr>
        

        
        <tr>
            <th scope="row"><b>Publisher: </b></th>
            <td style="padding-left: 4px;">HL7 International / Public Health</td>
        </tr>
        

        
        <tr>
            <th scope="row"><b>Description: </b></th>
            <td style="padding-left: 4px;"><div><p>An example PlanDefinition</p>
</div></td>
        </tr>
        

        

        

        

        
        <tr>
            <th scope="row"><b>Jurisdiction: </b></th>
            <td style="padding-left: 4px;">US</td>
        </tr>
        

        

        

        

        

        

        
        <tr>
            <th scope="row"><b>Effective Period: </b></th>
            <td style="padding-left: 4px;">2020-12-01..</td>
        </tr>
        

        
        <tr>
            <th scope="row"><b>Related Artifacts: </b></th>
            <td style="padding-left: 4px;">
                
                
                
                <p><b>Dependencies</b></p>
                <ul>
                    
                    <li><code>http://example.org/fhir/Library/library-rctc-example</code></li>
                    
                </ul>
                
                
                
                
                
            </td>
        </tr>
        

        

        
        <tr>
            <th scope="row"><b>Actions: </b></th>
            <td style="padding-left: 4px;">
                <table class="grid-dict">
                    
                    <tr>
                        <td>
                            
                            Start the reporting workflow in response to an encounter-start event
                            
                            <br/>
                            
                            <b>When:</b>
                            
                            <i>Named Event:</i> encounter-start
                            <br/>
                            
                            
                            
                            
                            
                            
                        </td>
                    </tr>
                    
                    <tr>
                        <td>
                            
                            Check suspected disorders for immediate reportability and setup jobs for future reportability checks.
                            
                            <br/>
                            
                            
                            
                            <b>Then:</b>
                            <table class="grid-dict">
                                
                                <tr>
                                    <td>
                                        
                                        Check Trigger Codes based on Suspected Reportable Value set.
                                        
                                        <br/>
                                        
                                        
                                        <b>If:</b>
                                        
                                        <i>Applicability:</i>
                                        
                                        <i>(%modifiedConditions.exists() or %modifiedLabResults.exists() or %modifiedMedicationOrders.exists())</i>
                                        <br/>
                                        
                                        
                                        
                                        
                                        
                                    </td>
                                </tr>
                                
                                <tr>
                                    <td>
                                        
                                        <b> :</b>
                                        
                                        
                                        <br/>
                                        
                                        
                                        <b>If:</b>
                                        
                                        <i>Applicability:</i>
                                        
                                        <i>(%encounter.where((status = 'in-progress' and period.start + 1 day * %normalReportingDuration &gt;= now()) or (status = 'finished' and period.end + 72 hours &gt;= now())).select(true))</i>
                                        <br/>
                                        
                                        
                                        
                                        
                                        
                                    </td>
                                </tr>
                                
                            </table>
                            
                        </td>
                    </tr>
                    
                    <tr>
                        <td>
                            
                            Check Reportability and setup jobs for future reportability checks.
                            
                            <br/>
                            
                            
                            
                            <b>Then:</b>
                            <table class="grid-dict">
                                
                                <tr>
                                    <td>
                                        
                                        Check Trigger Codes based on RCTC Value sets.
                                        
                                        <br/>
                                        
                                        
                                        <b>If:</b>
                                        
                                        <i>Applicability:</i>
                                        
                                        <i>(%encounter.where(period.start + 1 day * %normalReportingDuration &gt;= now()).select(true) and (%conditions.exists() or %encounters.exists() or %immunizations.exists() or %procedures.exists() or %procedureOrders.exists() or %labOrders.exists() or %labTests.exists() or %labResults.exists() or %medicationAdministrations.exists() or %medicationOrders.exists() or %medicationDispenses.exists()))</i>
                                        <br/>
                                        
                                        
                                        
                                        
                                        
                                    </td>
                                </tr>
                                
                                <tr>
                                    <td>
                                        
                                        <b> :</b>
                                        
                                        
                                        <br/>
                                        
                                        
                                        <b>If:</b>
                                        
                                        <i>Applicability:</i>
                                        
                                        <i>(((%lasteicr.last().entry[2].resource as Bundle).entry.first().resource as Composition).date &lt; now() - 72 hours)</i>
                                        <br/>
                                        
                                        
                                        
                                        
                                        
                                    </td>
                                </tr>
                                
                                <tr>
                                    <td>
                                        
                                        <b> :</b>
                                        
                                        
                                        <br/>
                                        
                                        
                                        <b>If:</b>
                                        
                                        <i>Applicability:</i>
                                        
                                        <i>(%inprogressencounter.where(status = 'in-progress' and period.start + 1 day * %normalReportingDuration &gt;= now() or (status = 'finished' and period.end + 72 hours &gt;= now())).exists())</i>
                                        <br/>
                                        
                                        
                                        
                                        
                                        
                                    </td>
                                </tr>
                                
                            </table>
                            
                        </td>
                    </tr>
                    
                    <tr>
                        <td>
                            
                            Create eICR
                            
                            <br/>
                            
                            
                            
                            <b>Then:</b>
                            <table class="grid-dict">
                                
                                <tr>
                                    <td>
                                        
                                        Anonymize the report.
                                        
                                        <br/>
                                        
                                        
                                        
                                        
                                        
                                    </td>
                                </tr>
                                
                            </table>
                            
                        </td>
                    </tr>
                    
                    <tr>
                        <td>
                            
                            Validate eICR
                            
                            <br/>
                            
                            
                            
                            
                            
                        </td>
                    </tr>
                    
                    <tr>
                        <td>
                            
                            Route and send eICR
                            
                            <br/>
                            
                            
                            
                            
                            
                        </td>
                    </tr>
                    
                    <tr>
                        <td>
                            
                            Start the reporting workflow in response to an encounter-modified event
                            
                            <br/>
                            
                            <b>When:</b>
                            
                            <i>Named Event:</i> encounter-modified
                            <br/>
                            
                            
                            
                            <b>If:</b>
                            
                            <i>Applicability:</i>
                            
                            <i>(%encounter.where(period.start + 1 day * %normalReportingDuration &lt; now()).select(true))</i>
                            <br/>
                            
                            
                            
                            
                            
                        </td>
                    </tr>
                    
                </table>
            </td>
        </tr>
        
    </table>
</div>
</div>
  </text>
  <url
       value="http://example.org/fhir/PlanDefinition/us-ph-plandefinition-alt-expression-example"/>
  <identifier>
    <system value="urn:ietf:rfc:3986"/>
    <value value="urn:oid:2.16.840.1.113883.4.642.40.58.34.1"/>
  </identifier>
  <version value="2.0.0-ballot"/>
  <name value="USPublicHealthPlanDefinitionAlternativeExpressionExample"/>
  <title
         value="US Public Health PlanDefinition Alternative Expression Example"/>
  <type>
    <coding>
      <system
              value="http://terminology.hl7.org/CodeSystem/plan-definition-type"/>
      <code value="workflow-definition"/>
      <display value="Workflow Definition"/>
    </coding>
  </type>
  <status value="active"/>
  <experimental value="true"/>
  <date value="2022-07-31T12:32:29.858-05:00"/>
  <publisher value="HL7 International / Public Health"/>
  <contact>
    <name value="HL7 International / Public Health"/>
    <telecom>
      <system value="url"/>
      <value value="http://www.hl7.org/Special/committees/pher"/>
    </telecom>
    <telecom>
      <system value="email"/>
      <value value="pher@lists.HL7.org"/>
    </telecom>
  </contact>
  <description value="An example PlanDefinition"/>
  <jurisdiction>
    <coding>
      <system value="urn:iso:std:iso:3166"/>
      <code value="US"/>
    </coding>
  </jurisdiction>
  <effectivePeriod>
    <start value="2020-12-01"/>
  </effectivePeriod>
  <relatedArtifact>
    <type value="depends-on"/>
    <label value="RCTC Value Set Library of Trigger Codes"/>
    <resource value="http://example.org/fhir/Library/library-rctc-example"/>
  </relatedArtifact>
  <action id="start-workflow">
    <description
                 value="This action represents the start of the reporting workflow in response to the encounter-start event."/>
    <textEquivalent
                    value="Start the reporting workflow in response to an encounter-start event"/>
    <code>
      <coding>
        <system
                value="http://hl7.org/fhir/us/ph-library/CodeSystem/us-ph-codesystem-plandefinition-actions"/>
        <code value="initiate-reporting-workflow"/>
        <display value="Initiate a reporting workflow"/>
      </coding>
    </code>
    <trigger id="encounter-start">
      <extension
                 url="http://hl7.org/fhir/us/ph-library/StructureDefinition/us-ph-named-eventtype-extension">
        <valueCodeableConcept>
          <coding>
            <system
                    value="http://hl7.org/fhir/us/ph-library/CodeSystem/us-ph-codesystem-triggerdefinition-namedevents"/>
            <code value="encounter-start"/>
            <display value="Indicates the start of an encounter"/>
          </coding>
        </valueCodeableConcept>
      </extension>
      <type value="named-event"/>
      <name value="encounter-start"/>
    </trigger>
    <input id="patient">
      <extension
                 url="http://hl7.org/fhir/us/ph-library/StructureDefinition/us-ph-fhirquerypattern-extension">
        <valueString value="Patient/{{context.patientId}}"/>
      </extension>
      <type value="Patient"/>
    </input>
    <input id="encounter">
      <extension
                 url="http://hl7.org/fhir/us/ph-library/StructureDefinition/us-ph-fhirquerypattern-extension">
        <valueString value="Encounter/{{context.encounterId}}"/>
      </extension>
      <type value="Encounter"/>
    </input>
    <relatedAction>
      <actionId value="check-suspected-disorder"/>
      <relationship value="before-start"/>
      <offsetDuration>
        <value value="1"/>
        <system value="http://unitsofmeasure.org"/>
        <code value="h"/>
      </offsetDuration>
    </relatedAction>
  </action>
  <action id="check-suspected-disorder">
    <description
                 value="This action represents the start of the check suspected disorder reporting workflow in response to the encounter-start event."/>
    <textEquivalent
                    value="Check suspected disorders for immediate reportability and setup jobs for future reportability checks."/>
    <code>
      <coding>
        <system
                value="http://hl7.org/fhir/us/ph-library/CodeSystem/us-ph-codesystem-plandefinition-actions"/>
        <code value="execute-reporting-workflow"/>
      </coding>
    </code>
    <action id="is-encounter-suspected-disorder">
      <description
                   value="This action represents the check for suspected disorder reportability to create the patients eICR."/>
      <textEquivalent
                      value="Check Trigger Codes based on Suspected Reportable Value set."/>
      <code>
        <coding>
          <system
                  value="http://hl7.org/fhir/us/ph-library/CodeSystem/us-ph-codesystem-plandefinition-actions"/>
          <code value="check-trigger-codes"/>
        </coding>
      </code>
      <condition>
        <kind value="applicability"/>
        <expression>
          <extension
                     url="http://hl7.org/fhir/us/ph-library/StructureDefinition/us-ph-alternative-expression-extension">
            <valueExpression>
              <language value="text/cql-identifier"/>
              <expression value="Is Suspected Disorder?"/>
              <reference
                         value="http://example.org/fhir/Library/RuleFilters|1.0.0"/>
            </valueExpression>
          </extension>
          <language value="text/fhirpath"/>
          <expression
                      value="%modifiedConditions.exists() or %modifiedLabResults.exists() or %modifiedMedicationOrders.exists()"/>
        </expression>
      </condition>
      <input id="modifiedConditions">
        <extension
                   url="http://hl7.org/fhir/us/ph-library/StructureDefinition/us-ph-fhirquerypattern-extension">
          <valueString
                       value="Condition?patient=Patient/{{context.patientId}}"/>
        </extension>
        <type value="Condition"/>
        <codeFilter>
          <path value="code"/>
          <valueSet
                    value="http://example.org/fhir/ValueSet/valueset-sdtc-example"/>
        </codeFilter>
      </input>
      <input id="modifiedLabResults">
        <extension
                   url="http://hl7.org/fhir/us/ph-library/StructureDefinition/us-ph-fhirquerypattern-extension">
          <valueString
                       value="Observation?patient=Patient/{{context.patientId}}"/>
        </extension>
        <type value="Observation"/>
        <codeFilter>
          <path value="value"/>
          <valueSet
                    value="http://example.org/fhir/ValueSet/valueset-sdtc-example"/>
        </codeFilter>
      </input>
      <input id="modifiedMedicationOrders">
        <extension
                   url="http://hl7.org/fhir/us/ph-library/StructureDefinition/us-ph-fhirquerypattern-extension">
          <valueString
                       value="MedicationRequest?patient=Patient/{{context.patientId}}"/>
        </extension>
        <type value="MedicationRequest"/>
        <codeFilter>
          <path value="medication"/>
          <valueSet
                    value="http://example.org/fhir/ValueSet/valueset-sdtc-example"/>
        </codeFilter>
      </input>
      <relatedAction>
        <actionId value="create-eicr"/>
        <relationship value="before-start"/>
      </relatedAction>
    </action>
    <action id="continue-check-reportable">
      <code>
        <coding>
          <system
                  value="http://hl7.org/fhir/us/ph-library/CodeSystem/us-ph-codesystem-plandefinition-actions"/>
          <code value="evaluate-condition"/>
        </coding>
      </code>
      <condition>
        <kind value="applicability"/>
        <expression>
          <extension
                     url="http://hl7.org/fhir/us/ph-library/StructureDefinition/us-ph-alternative-expression-extension">
            <valueExpression>
              <language value="text/cql-identifier"/>
              <expression
                          value="Is Encounter In Progress and Within Normal Reporting Duration or 72h or less after end of encounter?"/>
              <reference
                         value="http://example.org/fhir/Library/RuleFilters|1.0.0"/>
            </valueExpression>
          </extension>
          <language value="text/fhirpath"/>
          <expression
                      value="%encounter.where((status = 'in-progress' and period.start + 1 day * %normalReportingDuration &gt;= now()) or (status = 'finished' and period.end + 72 hours &gt;= now())).select(true)"/>
        </expression>
      </condition>
      <relatedAction>
        <actionId value="check-reportable"/>
        <relationship value="before-start"/>
        <offsetDuration>
          <value value="6"/>
          <system value="http://unitsofmeasure.org"/>
          <code value="h"/>
        </offsetDuration>
      </relatedAction>
    </action>
  </action>
  <action id="check-reportable">
    <description
                 value="This action represents the check for suspected reportability of the eICR."/>
    <textEquivalent
                    value="Check Reportability and setup jobs for future reportability checks."/>
    <code>
      <coding>
        <system
                value="http://hl7.org/fhir/us/ph-library/CodeSystem/us-ph-codesystem-plandefinition-actions"/>
        <code value="execute-reporting-workflow"/>
      </coding>
    </code>
    <action id="is-encounter-reportable">
      <description
                   value="This action represents the check for reportability to create the patients eICR."/>
      <textEquivalent value="Check Trigger Codes based on RCTC Value sets."/>
      <code>
        <coding>
          <system
                  value="http://hl7.org/fhir/us/ph-library/CodeSystem/us-ph-codesystem-plandefinition-actions"/>
          <code value="check-trigger-codes"/>
        </coding>
      </code>
      <condition>
        <kind value="applicability"/>
        <expression>
          <extension
                     url="http://hl7.org/fhir/us/ph-library/StructureDefinition/us-ph-alternative-expression-extension">
            <valueExpression>
              <language value="text/cql-identifier"/>
              <expression
                          value="Is Encounter Reportable and Within Normal Reporting Duration?"/>
              <reference
                         value="http://example.org/fhir/Library/RuleFilters|1.0.0"/>
            </valueExpression>
          </extension>
          <language value="text/fhirpath"/>
          <expression
                      value="%encounter.where(period.start + 1 day * %normalReportingDuration &gt;= now()).select(true) and (%conditions.exists() or %encounters.exists() or %immunizations.exists() or %procedures.exists() or %procedureOrders.exists() or %labOrders.exists() or %labTests.exists() or %labResults.exists() or %medicationAdministrations.exists() or %medicationOrders.exists() or %medicationDispenses.exists())"/>
        </expression>
      </condition>
      <input id="conditions">
        <extension
                   url="http://hl7.org/fhir/us/ph-library/StructureDefinition/us-ph-fhirquerypattern-extension">
          <valueString
                       value="Condition?patient=Patient/{{context.patientId}}"/>
        </extension>
        <type value="Condition"/>
        <codeFilter>
          <path value="code"/>
          <valueSet
                    value="http://example.org/fhir/ValueSet/valueset-dxtc-example"/>
        </codeFilter>
      </input>
      <input id="encounters">
        <extension
                   url="http://hl7.org/fhir/us/ph-library/StructureDefinition/us-ph-relateddata-extension">
          <valueString value="encounter"/>
        </extension>
        <type value="Encounter"/>
        <codeFilter>
          <path value="reasonCode"/>
          <valueSet
                    value="http://example.org/fhir/ValueSet/valueset-dxtc-example"/>
        </codeFilter>
      </input>
      <input id="immunizations">
        <extension
                   url="http://hl7.org/fhir/us/ph-library/StructureDefinition/us-ph-fhirquerypattern-extension">
          <valueString
                       value="Immunization?patient=Patient/{{context.patientId}}"/>
        </extension>
        <type value="Immunization"/>
        <codeFilter>
          <path value="vaccineCode"/>
          <valueSet
                    value="http://example.org/fhir/ValueSet/valueset-mrtc-example"/>
        </codeFilter>
      </input>
      <input id="labOrders">
        <extension
                   url="http://hl7.org/fhir/us/ph-library/StructureDefinition/us-ph-fhirquerypattern-extension">
          <valueString
                       value="ServiceRequest?patient=Patient/{{context.patientId}}"/>
        </extension>
        <type value="ServiceRequest"/>
        <codeFilter>
          <path value="code"/>
          <valueSet
                    value="http://example.org/fhir/ValueSet/valueset-lotc-example"/>
        </codeFilter>
      </input>
      <input id="labTests">
        <extension
                   url="http://hl7.org/fhir/us/ph-library/StructureDefinition/us-ph-fhirquerypattern-extension">
          <valueString
                       value="Observation?patient=Patient/{{context.patientId}}"/>
        </extension>
        <type value="Observation"/>
        <codeFilter>
          <path value="code"/>
          <valueSet
                    value="http://example.org/fhir/ValueSet/valueset-lotc-example"/>
        </codeFilter>
      </input>
      <input id="diagnosticOrders">
        <extension
                   url="http://hl7.org/fhir/us/ph-library/StructureDefinition/us-ph-fhirquerypattern-extension">
          <valueString
                       value="DiagnosticReport?patient=Patient/{{context.patientId}}"/>
        </extension>
        <type value="DiagnosticReport"/>
        <codeFilter>
          <path value="code"/>
          <valueSet
                    value="http://example.org/fhir/ValueSet/valueset-lotc-example"/>
        </codeFilter>
      </input>
      <input id="procedureOrders">
        <extension
                   url="http://hl7.org/fhir/us/ph-library/StructureDefinition/us-ph-fhirquerypattern-extension">
          <valueString
                       value="ServiceRequest?patient=Patient/{{context.patientId}}"/>
        </extension>
        <type value="ServiceRequest"/>
        <codeFilter>
          <path value="code"/>
          <valueSet
                    value="http://example.org/fhir/ValueSet/valueset-pctc-example"/>
        </codeFilter>
      </input>
      <input id="procedures">
        <extension
                   url="http://hl7.org/fhir/us/ph-library/StructureDefinition/us-ph-fhirquerypattern-extension">
          <valueString
                       value="Procedure?patient=Patient/{{context.patientId}}"/>
        </extension>
        <type value="Procedure"/>
        <codeFilter>
          <path value="code"/>
          <valueSet
                    value="http://example.org/fhir/ValueSet/valueset-pctc-example"/>
        </codeFilter>
      </input>
      <input id="medicationOrders">
        <extension
                   url="http://hl7.org/fhir/us/ph-library/StructureDefinition/us-ph-fhirquerypattern-extension">
          <valueString
                       value="MedicationRequest?patient=Patient/{{context.patientId}}"/>
        </extension>
        <type value="MedicationRequest"/>
        <codeFilter>
          <path value="medication"/>
          <valueSet
                    value="http://example.org/fhir/ValueSet/valueset-mrtc-example"/>
        </codeFilter>
      </input>
      <input id="medicationDispenses">
        <extension
                   url="http://hl7.org/fhir/us/ph-library/StructureDefinition/us-ph-fhirquerypattern-extension">
          <valueString
                       value="MedicationDispense?patient=Patient/{{context.patientId}}"/>
        </extension>
        <type value="MedicationDispense"/>
        <codeFilter>
          <path value="medication"/>
          <valueSet
                    value="http://example.org/fhir/ValueSet/valueset-mrtc-example"/>
        </codeFilter>
      </input>
      <input id="medicationAdministrations">
        <extension
                   url="http://hl7.org/fhir/us/ph-library/StructureDefinition/us-ph-fhirquerypattern-extension">
          <valueString
                       value="MedicationAdministration?patient=Patient/{{context.patientId}}"/>
        </extension>
        <type value="MedicationAdministration"/>
        <codeFilter>
          <path value="medication"/>
          <valueSet
                    value="http://example.org/fhir/ValueSet/valueset-mrtc-example"/>
        </codeFilter>
      </input>
      <input id="labResults">
        <extension
                   url="http://hl7.org/fhir/us/ph-library/StructureDefinition/us-ph-relateddata-extension">
          <valueString value="labTests"/>
        </extension>
        <type value="Observation"/>
        <codeFilter>
          <path value="value"/>
          <valueSet
                    value="http://example.org/fhir/ValueSet/valueset-ostc-example"/>
        </codeFilter>
      </input>
      <input id="diagnosticResults">
        <extension
                   url="http://hl7.org/fhir/us/ph-library/StructureDefinition/us-ph-relateddata-extension">
          <valueString value="diagnosticOrders"/>
        </extension>
        <type value="DiagnosticReport"/>
        <codeFilter>
          <path value="code"/>
          <valueSet
                    value="http://example.org/fhir/ValueSet/valueset-ostc-example"/>
        </codeFilter>
      </input>
      <relatedAction>
        <actionId value="create-eicr"/>
        <relationship value="before-start"/>
      </relatedAction>
    </action>
    <action id="check-update-eicr">
      <code>
        <coding>
          <system
                  value="http://hl7.org/fhir/us/ph-library/CodeSystem/us-ph-codesystem-plandefinition-actions"/>
          <code value="evaluate-condition"/>
        </coding>
      </code>
      <condition>
        <kind value="applicability"/>
        <expression>
          <extension
                     url="http://hl7.org/fhir/us/ph-library/StructureDefinition/us-ph-alternative-expression-extension">
            <valueExpression>
              <language value="text/cql-identifier"/>
              <expression value="Most recent eICR sent over 72 hours ago?"/>
              <reference
                         value="http://example.org/fhir/Library/RuleFilters|1.0.0"/>
            </valueExpression>
          </extension>
          <language value="text/fhirpath"/>
          <expression
                      value="((%lasteicr.last().entry[2].resource as Bundle).entry.first().resource as Composition).date &lt; now() - 72 hours"/>
        </expression>
      </condition>
      <input id="lasteicr">
        <extension
                   url="http://hl7.org/fhir/us/ph-library/StructureDefinition/us-ph-relateddata-extension">
          <valueString value="eicrreport"/>
        </extension>
        <type value="Bundle"/>
        <profile
                 value="http://hl7.org/fhir/us/ph-library/StructureDefinition/us-ph-document-bundle"/>
      </input>
      <relatedAction>
        <actionId value="create-eicr"/>
        <relationship value="before-start"/>
      </relatedAction>
    </action>
    <action id="is-encounter-in-progress">
      <code>
        <coding>
          <system
                  value="http://hl7.org/fhir/us/ph-library/CodeSystem/us-ph-codesystem-plandefinition-actions"/>
          <code value="evaluate-condition"/>
        </coding>
      </code>
      <condition>
        <kind value="applicability"/>
        <expression>
          <extension
                     url="http://hl7.org/fhir/us/ph-library/StructureDefinition/us-ph-alternative-expression-extension">
            <valueExpression>
              <language value="text/cql-identifier"/>
              <expression
                          value="Is Encounter In Progress and Within Normal Reporting Duration or 72h or less after end of encounter?"/>
              <reference
                         value="http://example.org/fhir/Library/RuleFilters|1.0.0"/>
            </valueExpression>
          </extension>
          <language value="text/fhirpath"/>
          <expression
                      value="%inprogressencounter.where(status = 'in-progress' and period.start + 1 day * %normalReportingDuration &gt;= now() or (status = 'finished' and period.end + 72 hours &gt;= now())).exists()"/>
        </expression>
      </condition>
      <input id="inprogressencounter">
        <extension
                   url="http://hl7.org/fhir/us/ph-library/StructureDefinition/us-ph-relateddata-extension">
          <valueString value="encounter"/>
        </extension>
        <type value="Encounter"/>
      </input>
      <relatedAction>
        <actionId value="check-reportable"/>
        <relationship value="before-start"/>
        <offsetDuration>
          <value value="6"/>
          <system value="http://unitsofmeasure.org"/>
          <code value="h"/>
        </offsetDuration>
      </relatedAction>
    </action>
  </action>
  <action id="create-eicr">
    <description
                 value="This action represents the creation of the eICR. It subsequently calls validate."/>
    <textEquivalent value="Create eICR"/>
    <code>
      <coding>
        <system
                value="http://hl7.org/fhir/us/ph-library/CodeSystem/us-ph-codesystem-plandefinition-actions"/>
        <code value="create-report"/>
      </coding>
    </code>
    <input id="patientdata">
      <extension
                 url="http://hl7.org/fhir/us/ph-library/StructureDefinition/us-ph-relateddata-extension">
        <valueString value="patient"/>
      </extension>
      <type value="Patient"/>
      <profile
               value="http://hl7.org/fhir/us/core/StructureDefinition/us-core-patient"/>
    </input>
    <input id="conditiondata">
      <extension
                 url="http://hl7.org/fhir/us/ph-library/StructureDefinition/us-ph-relateddata-extension">
        <valueString value="conditions"/>
      </extension>
      <type value="Condition"/>
      <profile
               value="http://hl7.org/fhir/us/core/StructureDefinition/us-core-condition-encounter-diagnosis"/>
    </input>
    <input id="encounterdata">
      <extension
                 url="http://hl7.org/fhir/us/ph-library/StructureDefinition/us-ph-relateddata-extension">
        <valueString value="encounter"/>
      </extension>
      <type value="Encounter"/>
      <profile
               value="http://hl7.org/fhir/us/core/StructureDefinition/us-core-encounter"/>
    </input>
    <input id="mrdata">
      <extension
                 url="http://hl7.org/fhir/us/ph-library/StructureDefinition/us-ph-relateddata-extension">
        <valueString value="medicationOrders"/>
      </extension>
      <type value="MedicationRequest"/>
      <profile
               value="http://hl7.org/fhir/us/core/StructureDefinition/us-core-medicationrequest"/>
    </input>
    <input id="immzdata">
      <extension
                 url="http://hl7.org/fhir/us/ph-library/StructureDefinition/us-ph-relateddata-extension">
        <valueString value="immunizations"/>
      </extension>
      <type value="Immunization"/>
      <profile
               value="http://hl7.org/fhir/us/core/StructureDefinition/us-core-immunization"/>
    </input>
    <input id="procdata">
      <extension
                 url="http://hl7.org/fhir/us/ph-library/StructureDefinition/us-ph-relateddata-extension">
        <valueString value="procedures"/>
      </extension>
      <type value="Procedure"/>
      <profile
               value="http://hl7.org/fhir/us/core/StructureDefinition/us-core-procedure"/>
    </input>
    <input id="labResultdata">
      <extension
                 url="http://hl7.org/fhir/us/ph-library/StructureDefinition/us-ph-relateddata-extension">
        <valueString value="labResults"/>
      </extension>
      <type value="Observation"/>
      <profile
               value="http://hl7.org/fhir/us/core/StructureDefinition/us-core-observation-lab"/>
    </input>
    <input id="labOrderdata">
      <extension
                 url="http://hl7.org/fhir/us/ph-library/StructureDefinition/us-ph-relateddata-extension">
        <valueString value="labOrders"/>
      </extension>
      <type value="ServiceRequest"/>
      <profile
               value="http://hl7.org/fhir/StructureDefinition/ServiceRequest"/>
    </input>
    <input id="diagnosticResultdata">
      <extension
                 url="http://hl7.org/fhir/us/ph-library/StructureDefinition/us-ph-relateddata-extension">
        <valueString value="diagnosticResults"/>
      </extension>
      <type value="DiagnosticReport"/>
      <profile
               value="http://hl7.org/fhir/us/core/StructureDefinition/us-core-diagnosticreport-lab"/>
    </input>
    <input id="diagnosticOrderdata">
      <extension
                 url="http://hl7.org/fhir/us/ph-library/StructureDefinition/us-ph-relateddata-extension">
        <valueString value="diagnosticOrders"/>
      </extension>
      <type value="DiagnosticReport"/>
      <profile
               value="http://hl7.org/fhir/us/core/StructureDefinition/us-core-diagnosticreport-lab"/>
    </input>
    <output id="eicrreport">
      <type value="Bundle"/>
      <profile
               value="http://hl7.org/fhir/us/ph-library/StructureDefinition/us-ph-document-bundle"/>
    </output>
    <relatedAction>
      <actionId value="validate-eicr"/>
      <relationship value="before-start"/>
    </relatedAction>
    <action id="anonymize-report">
      <extension
                 url="http://hl7.org/fhir/us/ph-library/StructureDefinition/us-ph-trust-service-endpoint-extension">
        <valueReference>🔗 
          <reference value="Endpoint/us-ph-endpoint-pha"/>
        </valueReference>
      </extension>
      <description
                   value="This action is used to anonymize a identifiable report"/>
      <textEquivalent value="Anonymize the report."/>
      <code>
        <coding>
          <system
                  value="http://hl7.org/fhir/us/ph-library/CodeSystem/us-ph-codesystem-plandefinition-actions"/>
          <code value="anonymize-report"/>
        </coding>
      </code>
      <input id="report-to-be-anonymized">
        <extension
                   url="http://hl7.org/fhir/us/ph-library/StructureDefinition/us-ph-relateddata-extension">
          <valueString value="output-report"/>
        </extension>
        <type value="Bundle"/>
      </input>
      <output id="anonymized-report">
        <type value="Bundle"/>
        <profile
                 value="http://hl7.org/fhir/us/ph-library/StructureDefinition/us-ph-reporting-bundle"/>
      </output>
    </action>
  </action>
  <action id="validate-eicr">
    <description
                 value="This action represents the validation of the eICR. It subsequently calls route-and-send."/>
    <textEquivalent value="Validate eICR"/>
    <code>
      <coding>
        <system
                value="http://hl7.org/fhir/us/ph-library/CodeSystem/us-ph-codesystem-plandefinition-actions"/>
        <code value="validate-report"/>
      </coding>
    </code>
    <input id="generatedeicrreport">
      <extension
                 url="http://hl7.org/fhir/us/ph-library/StructureDefinition/us-ph-relateddata-extension">
        <valueString value="eicrreport"/>
      </extension>
      <type value="Bundle"/>
      <profile
               value="http://hl7.org/fhir/us/ph-library/StructureDefinition/us-ph-document-bundle"/>
    </input>
    <output id="valideicrreport">
      <type value="Bundle"/>
      <profile
               value="http://hl7.org/fhir/us/ph-library/StructureDefinition/us-ph-document-bundle"/>
    </output>
    <relatedAction>
      <actionId value="route-and-send-eicr"/>
      <relationship value="before-start"/>
    </relatedAction>
  </action>
  <action id="route-and-send-eicr">
    <description
                 value="This action represents the routing and sending of the eICR."/>
    <textEquivalent value="Route and send eICR"/>
    <code>
      <coding>
        <system
                value="http://hl7.org/fhir/us/ph-library/CodeSystem/us-ph-codesystem-plandefinition-actions"/>
        <code value="submit-report"/>
      </coding>
    </code>
    <input id="validatedeicrreport">
      <extension
                 url="http://hl7.org/fhir/us/ph-library/StructureDefinition/us-ph-relateddata-extension">
        <valueString value="valideicrreport"/>
      </extension>
      <type value="Bundle"/>
      <profile
               value="http://hl7.org/fhir/us/ph-library/StructureDefinition/us-ph-document-bundle"/>
    </input>
    <output id="submittedeicrreport">
      <type value="Bundle"/>
      <profile
               value="http://hl7.org/fhir/us/ph-library/StructureDefinition/us-ph-document-bundle"/>
    </output>
  </action>
  <action id="encounter-modified">
    <description
                 value="This action represents the start of the reporting workflow in response to the encounter-modified event"/>
    <textEquivalent
                    value="Start the reporting workflow in response to an encounter-modified event"/>
    <code>
      <coding>
        <system
                value="http://hl7.org/fhir/us/ph-library/CodeSystem/us-ph-codesystem-plandefinition-actions"/>
        <code value="initiate-reporting-workflow"/>
        <display value="Initiate a reporting workflow"/>
      </coding>
    </code>
    <trigger id="encounter-modified-trigger">
      <extension
                 url="http://hl7.org/fhir/us/ph-library/StructureDefinition/us-ph-named-eventtype-extension">
        <valueCodeableConcept>
          <coding>
            <system
                    value="http://hl7.org/fhir/us/ph-library/CodeSystem/us-ph-codesystem-triggerdefinition-namedevents"/>
            <code value="encounter-modified"/>
            <display
                     value="Indicates modifications to data elements of an encounter"/>
          </coding>
        </valueCodeableConcept>
      </extension>
      <type value="named-event"/>
      <name value="encounter-modified"/>
    </trigger>
    <condition>
      <kind value="applicability"/>
      <expression>
        <extension
                   url="http://hl7.org/fhir/us/ph-library/StructureDefinition/us-ph-alternative-expression-extension">
          <valueExpression>
            <language value="text/cql-identifier"/>
            <expression
                        value="Is Encounter Longer Than Normal Reporting Duration?"/>
            <reference
                       value="http://example.org/fhir/Library/RuleFilters|1.0.0"/>
          </valueExpression>
        </extension>
        <language value="text/fhirpath"/>
        <expression
                    value="%encounter.where(period.start + 1 day * %normalReportingDuration &lt; now()).select(true)"/>
      </expression>
    </condition>
    <relatedAction>
      <actionId value="create-eicr"/>
      <relationship value="before-start"/>
    </relatedAction>
  </action>
</PlanDefinition>