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