@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 sct: <http://snomed.info/id/> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .

# - resource -------------------------------------------------------------------

<http://hl7.org/fhir/uv/deqm/Measure/FHIRPath-example> a fhir:Measure ;
  fhir:nodeRole fhir:treeRoot ;
  fhir:id [ fhir:v "FHIRPath-example"] ; # 
  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  <table class=\"narrative-table\">\n    <tbody>\n<tr>\n\n\n<th colspan=\"2\" scope=\"row\" class=\"row-header\">Metadata</th>\n\n\n</tr>\n\n<tr>\n\n\n<th scope=\"row\" class=\"row-header\">Title</th>\n\n\n\n<td class=\"content-container\">Example of a Measure using FHIRPath</td>\n\n\n</tr>\n\n\n\n<tr>\n\n\n<th scope=\"row\" class=\"row-header\">Version</th>\n\n\n\n<td class=\"content-container\">1.0.0-ballot</td>\n\n\n</tr>\n\n\n\n\n\n\n\n  \n<tr>\n\n\n<th scope=\"row\" class=\"row-header\">Identifier</th>\n\n\n\n<td class=\"content-container\">urn:oid:2.16.840.1.113883.4.642.40.42.29.4</td>\n\n\n</tr>\n\n\n\n\n\n\n\n<tr>\n\n\n<th scope=\"row\" class=\"row-header\">Status</th>\n\n\n\n<td class=\"content-container\">Draft</td>\n\n\n</tr>\n\n\n\n\n<tr>\n\n\n<th scope=\"row\" class=\"row-header\">Experimental</th>\n\n\n\n<td class=\"content-container\">true</td>\n\n\n</tr>\n\n\n\n\n<tr>\n\n\n<th scope=\"row\" class=\"row-header\">Use Context</th>\n\n\n\n<td class=\"content-container\">\n    focus from <a href=\"http://terminology.hl7.org/7.1.0/CodeSystem-usage-context-type.html\">http://terminology.hl7.org/CodeSystem/usage-context-type</a> \n\n = \n    COVID-19\n\n\n</td>\n\n\n</tr>\n\n\n<tr>\n\n\n<th scope=\"row\" class=\"row-header\">Jurisdiction</th>\n\n\n\n<td class=\"content-container\">\n    World\n\n\n</td>\n\n\n</tr>\n\n\n\n\n\n\n\n\n<tr>\n\n\n<th scope=\"row\" class=\"row-header\">Steward (Publisher)</th>\n\n\n\n<td class=\"content-container\">HL7 International / Clinical Quality Information</td>\n\n\n</tr>\n\n\n\n\n\n\n\n\n\n<tr>\n\n\n<th scope=\"row\" class=\"row-header\">Description</th>\n\n\n\n<td class=\"content-container\"><div><p>This measure exemplifies use of FHIRPath expressions in a FHIR Measure</p>\n</div></td>\n\n\n</tr>\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n<tr>\n  \n  \n\n<th scope=\"row\" class=\"row-header\">Documentation</th>\n\n\n  \n  \n  \n  \n  \n  <td class=\"content-container\">\n    \n    <em>Description</em>: CDC/NHSN COVID-19 Patient Impact &amp; Hospital Capacity Module Home Page\n    \n    <br/>\n    \n    \n    \n    \n    <em>Content URL</em>: <a href=\"https://web.archive.org/web/20200501215043/https://www.cdc.gov/nhsn/acute-care-hospital/covid19/\">https://web.archive.org/web/20200501215043/https://www.cdc.gov/nhsn/acute-care-hospital/covid19/</a>\n    \n    <br/>\n    \n    \n    \n    <em>Document</em>: null @ https://web.archive.org/web/20200501215043/https://www.cdc.gov/nhsn/acute-care-hospital/covid19/\n    \n    \n    \n    \n    \n  </td>\n</tr>\n\n<tr>\n  \n  \n\n<th scope=\"row\" class=\"row-header\">Documentation</th>\n\n\n  \n  \n  \n  \n  \n  <td class=\"content-container\">\n    \n    <em>Description</em>: Importing COVID-19 Patient Module Denominator data for Patient Safety Component\n    \n    <br/>\n    \n    \n    \n    \n    <em>Content URL</em>: <a href=\"https://web.archive.org/web/20200501215043/https://www.cdc.gov/nhsn/pdfs/covid19/import-covid19-data-508.pdf\">https://web.archive.org/web/20200501215043/https://www.cdc.gov/nhsn/pdfs/covid19/import-covid19-data-508.pdf</a>\n    \n    <br/>\n    \n    \n    \n    <em>Document</em>: null @ https://web.archive.org/web/20200501215043/https://www.cdc.gov/nhsn/pdfs/covid19/import-covid19-data-508.pdf\n    \n    \n    \n    \n    \n  </td>\n</tr>\n\n<tr>\n  \n  \n\n<th scope=\"row\" class=\"row-header\">Documentation</th>\n\n\n  \n  \n  \n  \n  \n  <td class=\"content-container\">\n    \n    <em>Description</em>: Instructions for Completion of the COVID-19 Patient Impact and Hospital Capacity Module Form (CDC 57.130)\n    \n    <br/>\n    \n    \n    \n    \n    <em>Content URL</em>: <a href=\"https://web.archive.org/web/20200501215043/https://www.cdc.gov/nhsn/pdfs/covid19/57.130-toi-508.pdf\">https://web.archive.org/web/20200501215043/https://www.cdc.gov/nhsn/pdfs/covid19/57.130-toi-508.pdf</a>\n    \n    <br/>\n    \n    \n    \n    <em>Document</em>: null @ https://web.archive.org/web/20200501215043/https://www.cdc.gov/nhsn/pdfs/covid19/57.130-toi-508.pdf\n    \n    \n    \n    \n    \n  </td>\n</tr>\n\n<tr>\n  \n  \n\n<th scope=\"row\" class=\"row-header\">Documentation</th>\n\n\n  \n  \n  \n  \n  \n  <td class=\"content-container\">\n    \n    <em>Description</em>: CDC/NHSN COVID-19 Reporting CSV File Template\n    \n    <br/>\n    \n    \n    \n    \n    <em>Content URL</em>: <a href=\"https://web.archive.org/web/20200501215043/https://www.cdc.gov/nhsn/pdfs/covid19/covid19-test-csv-import.csv\">https://web.archive.org/web/20200501215043/https://www.cdc.gov/nhsn/pdfs/covid19/covid19-test-csv-import.csv</a>\n    \n    <br/>\n    \n    \n    \n    <em>Document</em>: null @ https://web.archive.org/web/20200501215043/https://www.cdc.gov/nhsn/pdfs/covid19/covid19-test-csv-import.csv\n    \n    \n    \n    \n    \n  </td>\n</tr>\n\n\n\n\n\n\n\n\n\n  \n  \n  \n    <tr>\n\n\n<th colspan=\"2\" scope=\"row\" class=\"row-header\">Measure Group (Rate)</th>\n\n\n</tr>\n  \n  \n  \n\n\n\n\n\n\n\n\n\n\n\n  \n\n  \n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n<tr>\n  <th colspan=\"2\" scope=\"row\" class=\"row-header\">Generated using version 0.5.4-cibuild of the sample-content-ig Liquid templates</th>\n</tr>\n\n    </tbody>\n  </table>\n</div>"^^rdf:XMLLiteral ]
  ] ; # 
  fhir:url [
     fhir:v "http://hl7.org/fhir/uv/deqm/Measure/FHIRPath-example"^^xsd:anyURI ;
     fhir:l <http://hl7.org/fhir/uv/deqm/Measure/FHIRPath-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.42.29.4" ]
  ] ) ; # 
  fhir:version [ fhir:v "1.0.0-ballot"] ; # 
  fhir:name [ fhir:v "FHIRPathExample"] ; # 
  fhir:title [ fhir:v "Example of a Measure using FHIRPath"] ; # 
  fhir:status [ fhir:v "draft"] ; # 
  fhir:experimental [ fhir:v true] ; # 
  fhir:date [ fhir:v "2024-05-18T21:25:01+00:00"^^xsd:dateTime] ; # 
  fhir:publisher [ fhir:v "HL7 International / Clinical Quality Information"] ; # 
  fhir:contact ( [
     fhir:telecom ( [
       fhir:system [ fhir:v "url" ] ;
       fhir:value [ fhir:v "http://www.hl7.org/Special/committees/cqi" ]
     ] )
  ] ) ; # 
  fhir:description [ fhir:v "This measure exemplifies use of FHIRPath expressions in a FHIR Measure"] ; # 
  fhir:useContext ( [
     fhir:code [
       fhir:system [
         fhir:v "http://terminology.hl7.org/CodeSystem/usage-context-type"^^xsd:anyURI ;
         fhir:l <http://terminology.hl7.org/CodeSystem/usage-context-type>
       ] ;
       fhir:code [ fhir:v "focus" ]
     ] ;
     fhir:value [
       a fhir:CodeableConcept ;
       fhir:coding ( [
         a sct:840539006 ;
         fhir:system [
           fhir:v "http://snomed.info/sct"^^xsd:anyURI ;
           fhir:l <http://snomed.info/sct>
         ] ;
         fhir:code [ fhir:v "840539006" ] ;
         fhir:display [ fhir:v "COVID-19" ]
       ] )
     ]
  ] ) ; # 
  fhir:jurisdiction ( [
     fhir:coding ( [
       fhir:system [
         fhir:v "http://unstats.un.org/unsd/methods/m49/m49.htm"^^xsd:anyURI ;
         fhir:l <http://unstats.un.org/unsd/methods/m49/m49.htm>
       ] ;
       fhir:code [ fhir:v "001" ] ;
       fhir:display [ fhir:v "World" ]
     ] )
  ] ) ; # 
  fhir:relatedArtifact ( [
     fhir:type [ fhir:v "documentation" ] ;
     fhir:label [ fhir:v "NHSN COVID-19 Reporting" ] ;
     fhir:display [ fhir:v "CDC/NHSN COVID-19 Patient Impact & Hospital Capacity Module Home Page" ] ;
     fhir:url [
       fhir:v "https://web.archive.org/web/20200501215043/https://www.cdc.gov/nhsn/acute-care-hospital/covid19/"^^xsd:anyURI ;
       fhir:l <https://web.archive.org/web/20200501215043/https://www.cdc.gov/nhsn/acute-care-hospital/covid19/>
     ] ;
     fhir:document [
       fhir:url [
         fhir:v "https://web.archive.org/web/20200501215043/https://www.cdc.gov/nhsn/acute-care-hospital/covid19/"^^xsd:anyURI ;
         fhir:l <https://web.archive.org/web/20200501215043/https://www.cdc.gov/nhsn/acute-care-hospital/covid19/>
       ]
     ]
  ] [
     fhir:type [ fhir:v "documentation" ] ;
     fhir:label [ fhir:v "How to import COVID-19 Summary Data" ] ;
     fhir:display [ fhir:v "Importing COVID-19 Patient Module Denominator data for Patient Safety Component" ] ;
     fhir:url [
       fhir:v "https://web.archive.org/web/20200501215043/https://www.cdc.gov/nhsn/pdfs/covid19/import-covid19-data-508.pdf"^^xsd:anyURI ;
       fhir:l <https://web.archive.org/web/20200501215043/https://www.cdc.gov/nhsn/pdfs/covid19/import-covid19-data-508.pdf>
     ] ;
     fhir:document [
       fhir:url [
         fhir:v "https://web.archive.org/web/20200501215043/https://www.cdc.gov/nhsn/pdfs/covid19/import-covid19-data-508.pdf"^^xsd:anyURI ;
         fhir:l <https://web.archive.org/web/20200501215043/https://www.cdc.gov/nhsn/pdfs/covid19/import-covid19-data-508.pdf>
       ]
     ]
  ] [
     fhir:type [ fhir:v "documentation" ] ;
     fhir:label [ fhir:v "Table of Instructions" ] ;
     fhir:display [ fhir:v "Instructions for Completion of the COVID-19 Patient Impact and Hospital Capacity Module Form (CDC 57.130)" ] ;
     fhir:url [
       fhir:v "https://web.archive.org/web/20200501215043/https://www.cdc.gov/nhsn/pdfs/covid19/57.130-toi-508.pdf"^^xsd:anyURI ;
       fhir:l <https://web.archive.org/web/20200501215043/https://www.cdc.gov/nhsn/pdfs/covid19/57.130-toi-508.pdf>
     ] ;
     fhir:document [
       fhir:url [
         fhir:v "https://web.archive.org/web/20200501215043/https://www.cdc.gov/nhsn/pdfs/covid19/57.130-toi-508.pdf"^^xsd:anyURI ;
         fhir:l <https://web.archive.org/web/20200501215043/https://www.cdc.gov/nhsn/pdfs/covid19/57.130-toi-508.pdf>
       ]
     ]
  ] [
     fhir:type [ fhir:v "documentation" ] ;
     fhir:label [ fhir:v "CSV File Template" ] ;
     fhir:display [ fhir:v "CDC/NHSN COVID-19 Reporting CSV File Template" ] ;
     fhir:url [
       fhir:v "https://web.archive.org/web/20200501215043/https://www.cdc.gov/nhsn/pdfs/covid19/covid19-test-csv-import.csv"^^xsd:anyURI ;
       fhir:l <https://web.archive.org/web/20200501215043/https://www.cdc.gov/nhsn/pdfs/covid19/covid19-test-csv-import.csv>
     ] ;
     fhir:document [
       fhir:url [
         fhir:v "https://web.archive.org/web/20200501215043/https://www.cdc.gov/nhsn/pdfs/covid19/covid19-test-csv-import.csv"^^xsd:anyURI ;
         fhir:l <https://web.archive.org/web/20200501215043/https://www.cdc.gov/nhsn/pdfs/covid19/covid19-test-csv-import.csv>
       ]
     ]
  ] ) ; # 
  fhir:group ( [
     fhir:extension ( [
       fhir:extension ( [
         fhir:url [
           fhir:v "subject"^^xsd:anyURI ;
           fhir:l fhir:subject
         ] ;
         fhir:value [
           a fhir:CodeableConcept ;
           fhir:coding ( [
             fhir:system [
               fhir:v "http://hl7.org/fhir/resource-types"^^xsd:anyURI ;
               fhir:l <http://hl7.org/fhir/resource-types>
             ] ;
             fhir:code [ fhir:v "Device" ]
           ] [
             a sct:257463002 ;
             fhir:system [
               fhir:v "http://snomed.info/sct"^^xsd:anyURI ;
               fhir:l <http://snomed.info/sct>
             ] ;
             fhir:code [ fhir:v "257463002" ] ;
             fhir:display [ fhir:v "Ventilator Outlet" ]
           ] ) ;
           fhir:text [ fhir:v "Ventilator capacity" ]
         ]
       ] [
         fhir:url [
           fhir:v "scoring"^^xsd:anyURI ;
           fhir:l fhir:scoring
         ] ;
         fhir:value [
           a fhir:CodeableConcept ;
           fhir:coding ( [
             fhir:system [
               fhir:v "http://example.org/fhir/"^^xsd:anyURI ;
               fhir:l <http://example.org/fhir/>
             ] ;
             fhir:code [ fhir:v "capacity" ]
           ] )
         ]
       ] [
         fhir:url [
           fhir:v "type"^^xsd:anyURI ;
           fhir:l fhir:type
         ] ;
         fhir:value [
           a fhir:CodeableConcept ;
           fhir:coding ( [
             fhir:system [
               fhir:v "http://terminology.hl7.org/CodeSystem/measure-type"^^xsd:anyURI ;
               fhir:l <http://terminology.hl7.org/CodeSystem/measure-type>
             ] ;
             fhir:code [ fhir:v "structure" ]
           ] )
         ]
       ] [
         fhir:url [
           fhir:v "improvementNotation"^^xsd:anyURI ;
           fhir:l fhir:improvementNotation
         ] ;
         fhir:value [
           a fhir:CodeableConcept ;
           fhir:coding ( [
             fhir:system [
               fhir:v "http://terminology.hl7.org/CodeSystem/measure-improvement-notation"^^xsd:anyURI ;
               fhir:l <http://terminology.hl7.org/CodeSystem/measure-improvement-notation>
             ] ;
             fhir:code [ fhir:v "decrease" ]
           ] )
         ]
       ] [
         fhir:url [
           fhir:v "rateAggregation"^^xsd:anyURI ;
           fhir:l fhir:rateAggregation
         ] ;
         fhir:value [
           a fhir:String ;
           fhir:v "point-in-time"
         ]
       ] ) ;
       fhir:url [
         fhir:v "http://example.org/fhir/MeasureGroupAttributes"^^xsd:anyURI ;
         fhir:l <http://example.org/fhir/MeasureGroupAttributes>
       ]
     ] ) ;
     fhir:code [
       fhir:coding ( [
         fhir:system [
           fhir:v "http://example.org/fhir/"^^xsd:anyURI ;
           fhir:l <http://example.org/fhir/>
         ] ;
         fhir:code [ fhir:v "Ventilators" ] ;
         fhir:display [ fhir:v "Ventilators" ]
       ] ) ;
       fhir:text [ fhir:v "Ventilator Reporting" ]
     ] ;
     fhir:population ( [
       fhir:code [
         fhir:coding ( [
           fhir:system [
             fhir:v "http://example.org/fhir/"^^xsd:anyURI ;
             fhir:l <http://example.org/fhir/>
           ] ;
           fhir:code [ fhir:v "numVent" ] ;
           fhir:display [ fhir:v "Mechanical Ventilators" ]
         ] [
           fhir:system [
             fhir:v "http://terminology.hl7.org/CodeSystem/measure-population"^^xsd:anyURI ;
             fhir:l <http://terminology.hl7.org/CodeSystem/measure-population>
           ] ;
           fhir:code [ fhir:v "denominator" ]
         ] ) ;
         fhir:text [ fhir:v "Total number of ventilators" ]
       ] ;
       fhir:description [ fhir:v "Count of all ventilators that can support patient care, whether or not they are presently in use." ] ;
       fhir:criteria [
         fhir:description [ fhir:v "Computes the total number of ventilators from the previously reported MeasureReport" ] ;
         fhir:name [ fhir:v "NumVent" ] ;
         fhir:language [ fhir:v "text/fhirpath" ] ;
         fhir:expression [ fhir:v "iif(trace('PriorReport exists:', %PriorReport.exists()), %PriorReport.group[3].population[0].count, 0)" ]
       ]
     ] [
       fhir:code [
         fhir:coding ( [
           fhir:system [
             fhir:v "http://example.org/fhir/"^^xsd:anyURI ;
             fhir:l <http://example.org/fhir/>
           ] ;
           fhir:code [ fhir:v "numVentUse" ] ;
           fhir:display [ fhir:v "Mechanical Ventilators in Use" ]
         ] [
           fhir:system [
             fhir:v "http://terminology.hl7.org/CodeSystem/measure-population"^^xsd:anyURI ;
             fhir:l <http://terminology.hl7.org/CodeSystem/measure-population>
           ] ;
           fhir:code [ fhir:v "numerator" ]
         ] ) ;
         fhir:text [ fhir:v "Total number of ventilators in use" ]
       ] ;
       fhir:description [ fhir:v "Count of all ventilators in use." ] ;
       fhir:criteria [
         fhir:description [ fhir:v "Identifies the number of ventilators in use by counting Patient with an Observation\n or Procedure resource from an appropriate value set indicating ventilator use." ] ;
         fhir:name [ fhir:v "NumVentUse" ] ;
         fhir:language [ fhir:v "text/fhirpath" ] ;
         fhir:expression [ fhir:v "findAll('Encounter',\n including('subject'),\n with('status').equalTo('in-progress'|'finished'),\n with('date').within(%ReportingPeriod)\n).onServers(%Base)\n.select(entry.resource as Patient)\n.where(\n  iif(\n    whereExists('Observation',\n      with('status').equalTo('registered'|'preliminary'|'final'|'amended'|'corrected'),\n      with('patient').equalTo($this.id),\n      with('verificationStatus').notEqualTo('refuted'|'entered-in-error'),\n      with('date').within(%ReportingPeriod),\n      with('code').in(%VentilatorObservations.url)\n    ).onServers(%Base)\n    true,\n    whereExists('Procedure',\n      with('status').equalTo('in-progress'|'completed'),\n      with('patient').equalTo($this.id),\n      with('date').within(%ReportingPeriod),\n      with('code').in(%VentilatorProcedures.url)\n    ).onServers(%Base)\n  )\n)" ]
       ]
     ] [
       fhir:code [
         fhir:coding ( [
           fhir:system [
             fhir:v "http://example.org/fhir/"^^xsd:anyURI ;
             fhir:l <http://example.org/fhir/>
           ] ;
           fhir:code [ fhir:v "numVentAvail" ] ;
           fhir:display [ fhir:v "Mechanical Ventilators Available" ]
         ] [
           fhir:system [
             fhir:v "http://example.org/fhir/"^^xsd:anyURI ;
             fhir:l <http://example.org/fhir/>
           ] ;
           fhir:code [ fhir:v "numerator-complement" ]
         ] ) ;
         fhir:text [ fhir:v "Total number of ventilators not presently in use." ]
       ] ;
       fhir:description [ fhir:v "Count of all ventilators not presently in use." ] ;
       fhir:criteria [
         fhir:description [ fhir:v "Computes the number of ventilators available by substracting the number of ventilators in use\n determined by population 1 from thee total number of ventilators given in population 0" ] ;
         fhir:name [ fhir:v "NumVentAvail" ] ;
         fhir:language [ fhir:v "text/fhirpath" ] ;
         fhir:expression [ fhir:v "%NumVent - %NumVentUse.total.toInteger()" ]
       ]
     ] )
  ] ) . # 

# -------------------------------------------------------------------------------------

