@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/ExampleScenario/example-laborder> a fhir:ExampleScenario ;
  fhir:nodeRole fhir:treeRoot ;
  fhir:id [ fhir:v "example-laborder"] ; # 
  fhir:text [
     fhir:status [ fhir:v "additional" ] ;
     fhir:div [ fhir:v "<div xmlns=\"http://www.w3.org/1999/xhtml\">\n      <p>\n        <b> ExampleScenario - Lab order tracking with Task</b>\n        <a name=\"example-laborder\"> </a>\n      </p>\n      <div style=\"display: inline-block; background-color: #d9e0e7; padding: 6px; margin: 4px; border: 1px solid #8da1b4; border-radius: 5px; line-height: 60%\">\n        <p style=\"margin-bottom: 0px\">Resource ExampleScenario \"example-laborder\" </p>\n      </div>\n      <p>\n        <b> status</b> : draft\n      </p>\n      <p>\n        <b> purpose</b> : Purpose: this serves to demonstrate a scenario that uses service requests and Task resources to establish a handshake for order tracking.\n      </p>\n\n      <img src=\"./examplescenario-example-laborder.png\" alt=\"ExampleScenario diagram - IHE MMA example\"/>\n    </div>"^^rdf:XMLLiteral ]
  ] ; # 
  fhir:extension ( [
     fhir:url [
       fhir:v "http://hl7.org/fhir/StructureDefinition/structuredefinition-wg"^^xsd:anyURI ;
       fhir:l <http://hl7.org/fhir/StructureDefinition/structuredefinition-wg>
     ] ;
     fhir:value [
       a fhir:Code ;
       fhir:v "fhir"
     ]
  ] ) ; # 
  fhir:name [ fhir:v "LabOrderTrackingWithTask"] ; # 
  fhir:title [ fhir:v "Lab order tracking with Task"] ; # 
  fhir:status [ fhir:v "draft"] ; # 
  fhir:publisher [ fhir:v "HL7 International / FHIR Infrastructure"] ; # 
  fhir:contact ( [
     fhir:telecom ( [
       fhir:system [ fhir:v "url" ] ;
       fhir:value [ fhir:v "http://www.hl7.org/Special/committees/fiwg" ]
     ] )
  ] ) ; # 
  fhir:description [ fhir:v "In this example, the clinician creates an order in the CPOE. Then a Task is created and updated by both the CPOE and the Lab system..."] ; # 
  fhir:purpose [ fhir:v "Purpose: this serves to demonstrate a scenario that uses service requests and Task resources to establish a handshake for order tracking."] ; # 
  fhir:actor ( [
     fhir:key [ fhir:v "Clin" ] ;
     fhir:type [ fhir:v "person" ] ;
     fhir:title [ fhir:v "Clinician" ] ;
     fhir:description [ fhir:v "Clinician" ]
  ] [
     fhir:key [ fhir:v "CPOE" ] ;
     fhir:type [ fhir:v "system" ] ;
     fhir:title [ fhir:v "CPOE" ] ;
     fhir:description [ fhir:v "CPOE" ]
  ] [
     fhir:key [ fhir:v "EMR" ] ;
     fhir:type [ fhir:v "system" ] ;
     fhir:title [ fhir:v "EMR" ] ;
     fhir:description [ fhir:v "EMR" ]
  ] [
     fhir:key [ fhir:v "LabMan" ] ;
     fhir:type [ fhir:v "person" ] ;
     fhir:title [ fhir:v "Lab Man" ] ;
     fhir:description [ fhir:v "Lab Person" ]
  ] [
     fhir:key [ fhir:v "Lab" ] ;
     fhir:type [ fhir:v "other" ] ;
     fhir:title [ fhir:v "Lab" ] ;
     fhir:description [ fhir:v "Lab" ]
  ] ) ; # 
  fhir:instance ( [
     fhir:key [ fhir:v "req1" ] ;
     fhir:structureType [
       fhir:system [
         fhir:v "http://hl7.org/fhir/fhir-types"^^xsd:anyURI ;
         fhir:l <http://hl7.org/fhir/fhir-types>
       ] ;
       fhir:code [ fhir:v "ServiceRequest" ]
     ] ;
     fhir:title [ fhir:v "Request for a lab procedure" ] ;
     fhir:description [ fhir:v "Bla" ] ;
     fhir:version ( [
       fhir:key [ fhir:v "req1-v1" ] ;
       fhir:title [ fhir:v "v1- initial" ] ;
       fhir:description [ fhir:v "Initial order" ]
     ] [
       fhir:key [ fhir:v "req1-v2" ] ;
       fhir:title [ fhir:v "v2 - in progress" ] ;
       fhir:description [ fhir:v "Order in progress" ]
     ] [
       fhir:key [ fhir:v "req1-v3" ] ;
       fhir:title [ fhir:v "v3 - completed" ] ;
       fhir:description [ fhir:v "Order completed" ]
     ] )
  ] [
     fhir:key [ fhir:v "task1" ] ;
     fhir:structureType [
       fhir:system [
         fhir:v "http://hl7.org/fhir/fhir-types"^^xsd:anyURI ;
         fhir:l <http://hl7.org/fhir/fhir-types>
       ] ;
       fhir:code [ fhir:v "Task" ]
     ] ;
     fhir:title [ fhir:v "Task" ] ;
     fhir:description [ fhir:v "The task that handles the status updates..." ] ;
     fhir:version ( [
       fhir:key [ fhir:v "task1-v1" ] ;
       fhir:title [ fhir:v "v1 - created" ] ;
       fhir:description [ fhir:v "Initially created" ]
     ] [
       fhir:key [ fhir:v "task1-v2" ] ;
       fhir:title [ fhir:v "v2 - accepted" ] ;
       fhir:description [ fhir:v "Accepted" ]
     ] [
       fhir:key [ fhir:v "task1-v3" ] ;
       fhir:title [ fhir:v "v3 - in progress" ] ;
       fhir:description [ fhir:v "In progress" ]
     ] [
       fhir:key [ fhir:v "task1-v4" ] ;
       fhir:title [ fhir:v "v4 - completed" ] ;
       fhir:description [ fhir:v "Completed" ]
     ] )
  ] [
     fhir:key [ fhir:v "req.lab1" ] ;
     fhir:structureType [
       fhir:system [
         fhir:v "http://hl7.org/fhir/fhir-types"^^xsd:anyURI ;
         fhir:l <http://hl7.org/fhir/fhir-types>
       ] ;
       fhir:code [ fhir:v "ServiceRequest" ]
     ] ;
     fhir:title [ fhir:v "Internal lab request" ] ;
     fhir:description [ fhir:v "Lab's internal request for the procedure" ] ;
     fhir:version ( [
       fhir:key [ fhir:v "req.lab1-v1" ] ;
       fhir:title [ fhir:v "v1 - created" ] ;
       fhir:description [ fhir:v "Order in progress" ]
     ] [
       fhir:key [ fhir:v "req.lab1-v2" ] ;
       fhir:title [ fhir:v "v2 - in progress" ] ;
       fhir:description [ fhir:v "Order in progress" ]
     ] [
       fhir:key [ fhir:v "req.lab1-v3" ] ;
       fhir:title [ fhir:v "v3 - completed" ] ;
       fhir:description [ fhir:v "Order completed" ]
     ] )
  ] ) ; # 
  fhir:process ( [
     fhir:title [ fhir:v "Lab order tracking with Task" ] ;
     fhir:description [ fhir:v "Lab order, status updates handled with Task between CPOE, EMR and Lab systems" ] ;
     fhir:step ( [
       fhir:number [ fhir:v "1" ] ;
       fhir:process [
         fhir:title [ fhir:v "Create order" ] ;
         fhir:description [ fhir:v "New lab order" ] ;
         fhir:step ( [
           fhir:number [ fhir:v "1.1" ] ;
           fhir:operation [
             fhir:title [ fhir:v "Make a call" ] ;
             fhir:initiator [ fhir:v "Clin" ] ;
             fhir:receiver [ fhir:v "LabMan" ]
           ]
         ] [
           fhir:number [ fhir:v "1.2" ] ;
           fhir:operation [
             fhir:title [ fhir:v "Create new EMR order" ] ;
             fhir:initiator [ fhir:v "Clin" ] ;
             fhir:receiver [ fhir:v "CPOE" ]
           ]
         ] [
           fhir:number [ fhir:v "1.3" ] ;
           fhir:operation [
             fhir:title [ fhir:v "Submit order to EMR" ] ;
             fhir:initiator [ fhir:v "CPOE" ] ;
             fhir:receiver [ fhir:v "EMR" ] ;
             fhir:request [
               fhir:instanceReference [ fhir:v "req1" ] ;
               fhir:versionReference [ fhir:v "req1-v1" ]
             ]
           ]
         ] [
           fhir:number [ fhir:v "1.3" ] ;
           fhir:operation [
             fhir:title [ fhir:v "Create new task " ] ;
             fhir:initiator [ fhir:v "EMR" ] ;
             fhir:receiver [ fhir:v "EMR" ] ;
             fhir:request [
               fhir:instanceReference [ fhir:v "task1" ] ;
               fhir:versionReference [ fhir:v "task1-v1" ]
             ]
           ]
         ] [
           fhir:number [ fhir:v "1.4" ] ;
           fhir:operation [
             fhir:title [ fhir:v "Send task to Lab" ] ;
             fhir:initiator [ fhir:v "EMR" ] ;
             fhir:receiver [ fhir:v "Lab" ] ;
             fhir:request [
               fhir:instanceReference [ fhir:v "task1" ] ;
               fhir:versionReference [ fhir:v "task1-v1" ]
             ]
           ]
         ] )
       ] ;
       fhir:pause [ fhir:v true ]
     ] [
       fhir:number [ fhir:v "2" ] ;
       fhir:process [
         fhir:title [ fhir:v "Accept order" ] ;
         fhir:description [ fhir:v "New task for handling order tracking" ] ;
         fhir:step ( [
           fhir:number [ fhir:v "2.1" ] ;
           fhir:operation [
             fhir:title [ fhir:v "Accept task" ] ;
             fhir:initiator [ fhir:v "LabMan" ] ;
             fhir:receiver [ fhir:v "Lab" ]
           ]
         ] [
           fhir:number [ fhir:v "2.2" ] ;
           fhir:operation [
             fhir:title [ fhir:v "Task status = accepted" ] ;
             fhir:initiator [ fhir:v "Lab" ] ;
             fhir:receiver [ fhir:v "Lab" ] ;
             fhir:request [
               fhir:instanceReference [ fhir:v "task1" ] ;
               fhir:versionReference [ fhir:v "task1-v2" ]
             ]
           ]
         ] [
           fhir:number [ fhir:v "2.3" ] ;
           fhir:operation [
             fhir:title [ fhir:v "Create internal lab request" ] ;
             fhir:initiator [ fhir:v "Lab" ] ;
             fhir:receiver [ fhir:v "Lab" ] ;
             fhir:request [
               fhir:instanceReference [ fhir:v "req.lab1" ] ;
               fhir:versionReference [ fhir:v "req.lab1-v1" ]
             ]
           ]
         ] [
           fhir:number [ fhir:v "2.4" ] ;
           fhir:operation [
             fhir:title [ fhir:v "Send Task to EMR" ] ;
             fhir:initiator [ fhir:v "Lab" ] ;
             fhir:receiver [ fhir:v "EMR" ] ;
             fhir:request [
               fhir:instanceReference [ fhir:v "task1" ] ;
               fhir:versionReference [ fhir:v "task1-v2" ]
             ]
           ]
         ] [
           fhir:number [ fhir:v "2.5" ] ;
           fhir:operation [
             fhir:title [ fhir:v "Inform CPOE of Task status" ] ;
             fhir:initiator [ fhir:v "EMR" ] ;
             fhir:receiver [ fhir:v "CPOE" ] ;
             fhir:request [
               fhir:instanceReference [ fhir:v "task1" ] ;
               fhir:versionReference [ fhir:v "task1-v2" ]
             ]
           ]
         ] )
       ]
     ] [
       fhir:number [ fhir:v "3" ] ;
       fhir:process [
         fhir:title [ fhir:v "Initiate procedure" ] ;
         fhir:description [ fhir:v "Procedure is initiated at the lab" ] ;
         fhir:step ( [
           fhir:number [ fhir:v "3.1" ] ;
           fhir:operation [
             fhir:title [ fhir:v "Begin procedure" ] ;
             fhir:initiator [ fhir:v "LabMan" ] ;
             fhir:receiver [ fhir:v "Lab" ]
           ]
         ] [
           fhir:number [ fhir:v "3.2" ] ;
           fhir:operation [
             fhir:title [ fhir:v "Task status: in-progress" ] ;
             fhir:initiator [ fhir:v "Lab" ] ;
             fhir:receiver [ fhir:v "Lab" ] ;
             fhir:request [
               fhir:instanceReference [ fhir:v "task1" ] ;
               fhir:versionReference [ fhir:v "task1-v3" ]
             ]
           ]
         ] [
           fhir:number [ fhir:v "4.3" ] ;
           fhir:operation [
             fhir:title [ fhir:v "Internal lab request: in-progress" ] ;
             fhir:initiator [ fhir:v "Lab" ] ;
             fhir:receiver [ fhir:v "Lab" ] ;
             fhir:request [
               fhir:instanceReference [ fhir:v "req.lab1" ] ;
               fhir:versionReference [ fhir:v "req.lab1-v2" ]
             ]
           ]
         ] [
           fhir:number [ fhir:v "4.4" ] ;
           fhir:operation [
             fhir:title [ fhir:v "Send updated Task to EMR" ] ;
             fhir:initiator [ fhir:v "Lab" ] ;
             fhir:receiver [ fhir:v "EMR" ] ;
             fhir:request [
               fhir:instanceReference [ fhir:v "task1" ] ;
               fhir:versionReference [ fhir:v "task1-v3" ]
             ]
           ]
         ] [
           fhir:number [ fhir:v "4.5" ] ;
           fhir:operation [
             fhir:title [ fhir:v "Inform CPOE of Task status" ] ;
             fhir:initiator [ fhir:v "EMR" ] ;
             fhir:receiver [ fhir:v "CPOE" ] ;
             fhir:request [
               fhir:instanceReference [ fhir:v "task1" ] ;
               fhir:versionReference [ fhir:v "task1-v4" ]
             ]
           ]
         ] [
           fhir:number [ fhir:v "4.5" ] ;
           fhir:operation [
             fhir:title [ fhir:v "Order status: in-progress" ] ;
             fhir:initiator [ fhir:v "CPOE" ] ;
             fhir:receiver [ fhir:v "CPOE" ] ;
             fhir:request [
               fhir:instanceReference [ fhir:v "req1" ] ;
               fhir:versionReference [ fhir:v "req1-v2" ]
             ]
           ]
         ] )
       ]
     ] [
       fhir:number [ fhir:v "4" ] ;
       fhir:process [
         fhir:title [ fhir:v "Finish procedure" ] ;
         fhir:description [ fhir:v "Procedure is finished" ] ;
         fhir:step ( [
           fhir:number [ fhir:v "4.1" ] ;
           fhir:operation [
             fhir:title [ fhir:v "Finish procedure" ] ;
             fhir:initiator [ fhir:v "LabMan" ] ;
             fhir:receiver [ fhir:v "Lab" ]
           ]
         ] [
           fhir:number [ fhir:v "4.2" ] ;
           fhir:operation [
             fhir:title [ fhir:v "Task status = completed" ] ;
             fhir:initiator [ fhir:v "Lab" ] ;
             fhir:receiver [ fhir:v "Lab" ] ;
             fhir:request [
               fhir:instanceReference [ fhir:v "task1" ] ;
               fhir:versionReference [ fhir:v "task1-v2" ]
             ]
           ]
         ] [
           fhir:number [ fhir:v "4.3" ] ;
           fhir:operation [
             fhir:title [ fhir:v "Internal lab request: complete" ] ;
             fhir:initiator [ fhir:v "Lab" ] ;
             fhir:receiver [ fhir:v "Lab" ] ;
             fhir:request [
               fhir:instanceReference [ fhir:v "req.lab1" ] ;
               fhir:versionReference [ fhir:v "req.lab1-v2" ]
             ]
           ]
         ] [
           fhir:number [ fhir:v "4.4" ] ;
           fhir:operation [
             fhir:title [ fhir:v "Send updated Task to EMR" ] ;
             fhir:initiator [ fhir:v "Lab" ] ;
             fhir:receiver [ fhir:v "EMR" ] ;
             fhir:request [
               fhir:instanceReference [ fhir:v "task1" ] ;
               fhir:versionReference [ fhir:v "task1-v4" ]
             ]
           ]
         ] [
           fhir:number [ fhir:v "4.5" ] ;
           fhir:operation [
             fhir:title [ fhir:v "Inform CPOE of Task status" ] ;
             fhir:initiator [ fhir:v "EMR" ] ;
             fhir:receiver [ fhir:v "CPOE" ] ;
             fhir:request [
               fhir:instanceReference [ fhir:v "task1" ] ;
               fhir:versionReference [ fhir:v "task1-v4" ]
             ]
           ]
         ] [
           fhir:number [ fhir:v "4.5" ] ;
           fhir:operation [
             fhir:title [ fhir:v "Order status = completed" ] ;
             fhir:initiator [ fhir:v "CPOE" ] ;
             fhir:receiver [ fhir:v "CPOE" ] ;
             fhir:request [
               fhir:instanceReference [ fhir:v "req1" ] ;
               fhir:versionReference [ fhir:v "req1-v3" ]
             ]
           ]
         ] )
       ]
     ] )
  ] ) . # 

# -------------------------------------------------------------------------------------

