@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 -------------------------------------------------------------------

# The expected output of this task is a DiagnosticRequest and will generated once the task is near completion

<http://hl7.org/fhir/Task/example1> a fhir:Task ;
  fhir:nodeRole fhir:treeRoot ;
  fhir:id [ fhir:v "example1"] ; # This is an example to demonstrate using task for actioning a servicerequest and to illustrate how to populate many of the task elements - this is the parent task that will be broken into subtask to grab the specimen
#example1 action lipid panel -in progress =>. example2 specimen collection subtask -accepted => example4  specimen collection subtask - completed  with output Specimen=>example 5 action lipid panel -in progress specimen collected => example 6 action lipid panel - completed with output DiagnosticReport
  fhir:contained ( [
     a fhir:Provenance ;
     fhir:id [ fhir:v "signature" ] ;
     fhir:target ( [
       fhir:l <http://hl7.org/fhir/ServiceRequest/physiotherapy/_history/1> ;
       fhir:reference [ fhir:v "ServiceRequest/physiotherapy/_history/1" ]
     ] ) ;
     fhir:recorded [ fhir:v "2016-10-31T08:25:05+10:00"^^xsd:dateTime ] ;
     fhir:agent ( [
       fhir:role ( [
         fhir:coding ( [
           fhir:system [
             fhir:v "http://terminology.hl7.org/CodeSystem/v3-ParticipationType"^^xsd:anyURI ;
             fhir:l <http://terminology.hl7.org/CodeSystem/v3-ParticipationType>
           ] ;
           fhir:code [ fhir:v "AUT" ]
         ] )
       ] ) ;
       fhir:who [
         fhir:l <http://hl7.org/fhir/Practitioner/f202> ;
         fhir:reference [ fhir:v "Practitioner/f202" ] ;
         fhir:display [ fhir:v "Luigi Maas" ]
       ]
     ] ) ;
     fhir:signature ( [
       fhir:type ( [
         fhir:system [
           fhir:v "urn:iso-astm:E1762-95:2013"^^xsd:anyURI ;
           fhir:l <urn:iso-astm:E1762-95:2013>
         ] ;
         fhir:code [ fhir:v "1.2.840.10065.1.12.1.1" ] ;
         fhir:display [ fhir:v "Author's Signature" ]
       ] ) ;
       fhir:when [ fhir:v "2016-10-31T08:25:05+10:00"^^xsd:dateTime ] ;
       fhir:who [
         fhir:l <http://hl7.org/fhir/Practitioner/example> ;
         fhir:reference [ fhir:v "Practitioner/example" ] ;
         fhir:display [ fhir:v "Dr Adam Careful" ]
       ] ;
       fhir:targetFormat [ fhir:v "application/fhir+xml" ] ;
       fhir:sigFormat [ fhir:v "application/signature+xml" ] ;
       fhir:data [ fhir:v "dGhpcyBibG9iIGlzIHNuaXBwZWQ="^^xsd:base64Binary ]
     ] )
  ] ) ; # 
  fhir:identifier ( [
     fhir:use [ fhir:v "official" ] ;
     fhir:system [
       fhir:v "http:/goodhealth.org/identifiers"^^xsd:anyURI ;
       fhir:l <http://hl7.org/fhir/http:/goodhealth.org/identifiers>
     ] ;
     fhir:value [ fhir:v "20170201-001" ]
  ] ) ; # 
  fhir:basedOn ( [
     fhir:display [ fhir:v "General Wellness Careplan" ]
  ] ) ; # 
  fhir:groupIdentifier [
     fhir:use [ fhir:v "official" ] ;
     fhir:system [
       fhir:v "http:/goodhealth.org/accession/identifiers"^^xsd:anyURI ;
       fhir:l <http://hl7.org/fhir/http:/goodhealth.org/accession/identifiers>
     ] ;
     fhir:value [ fhir:v "G20170201-001" ]
  ] ; # 
  fhir:status [ fhir:v "in-progress"] ; # 
  fhir:businessStatus [
     fhir:text [ fhir:v "waiting for specimen" ]
  ] ; # fictive business status populated for this example
  fhir:intent [ fhir:v "order"] ; # 
  fhir:priority [ fhir:v "routine"] ; # 
  fhir:code [
     fhir:coding ( [
       fhir:system [
         fhir:v "http://hl7.org/fhir/CodeSystem/task-code"^^xsd:anyURI ;
         fhir:l <http://hl7.org/fhir/CodeSystem/task-code>
       ] ;
       fhir:code [ fhir:v "fulfill" ]
     ] )
  ] ; # fictive code and description elements populated for this example
  fhir:description [ fhir:v "Create order for getting specimen, Set up inhouse testing,  generate order for any sendouts and submit with specimen"] ; # 
  fhir:focus ( [
     fhir:value [
       a fhir:Reference ;
       fhir:l <http://hl7.org/fhir/ServiceRequest/lipid> ;
       fhir:reference [ fhir:v "ServiceRequest/lipid" ] ;
       fhir:display [ fhir:v "Lipid Panel Request" ]
     ]
  ] ) ; # Use the lipid servicerequest example
  fhir:for [
     fhir:l <http://hl7.org/fhir/Patient/example> ;
     fhir:reference [ fhir:v "Patient/example" ] ;
     fhir:display [ fhir:v "Peter James Chalmers" ]
  ] ; # who the task is for
  fhir:encounter [
     fhir:l <http://hl7.org/fhir/Encounter/example> ;
     fhir:reference [ fhir:v "Encounter/example" ] ;
     fhir:display [ fhir:v "Example In-Patient Encounter" ]
  ] ; # 
  fhir:executionPeriod [
     fhir:start [ fhir:v "2016-10-31T08:25:05+10:00"^^xsd:dateTime ]
  ] ; # Lots of dates
  fhir:authoredOn [ fhir:v "2016-10-31T08:25:05+10:00"^^xsd:dateTime] ; # 
  fhir:lastModified [ fhir:v "2016-10-31T09:45:05+10:00"^^xsd:dateTime] ; # 
  fhir:requester [
     fhir:l <http://hl7.org/fhir/Practitioner/example> ;
     fhir:reference [ fhir:v "Practitioner/example" ] ;
     fhir:display [ fhir:v "Dr Adam Careful" ]
  ] ; # 
  fhir:requestedPerformer ( [
     fhir:concept [
       fhir:coding ( [
         a sct:18850004 ;
         fhir:system [
           fhir:v "http://snomed.info/sct"^^xsd:anyURI ;
           fhir:l <http://snomed.info/sct>
         ] ;
         fhir:code [ fhir:v "18850004" ] ;
         fhir:display [ fhir:v "Laboratory hematologist" ]
       ] ) ;
       fhir:text [ fhir:v "Performer" ]
     ]
  ] ) ; # 
  fhir:owner [
     fhir:l <http://hl7.org/fhir/Organization/1832473e-2fe0-452d-abe9-3cdb9879522f> ;
     fhir:reference [ fhir:v "Organization/1832473e-2fe0-452d-abe9-3cdb9879522f" ] ;
     fhir:display [ fhir:v "Clinical Laboratory @ Acme Hospital" ]
  ] ; # 
  fhir:reason ( [
     fhir:concept [
       fhir:text [ fhir:v "The Task.reason should only be included if there is no Task.focus or if it differs from the reason indicated on the focus" ]
     ]
  ] ) ; # populate the reason just to demonstrate it use in this example
  fhir:note ( [
     fhir:text [ fhir:v "This is an example to demonstrate using task for actioning a servicerequest and to illustrate how to populate many of the task elements - this is the parent task that will be broken into subtask to grab the specimen and a sendout lab test" ]
  ] ) ; # 
  fhir:relevantHistory ( [
     fhir:l <#signature> ;
     fhir:reference [ fhir:v "#signature" ] ;
     fhir:display [ fhir:v "Author's Signature" ]
  ] ) ; # add the link to the signature on the task to show how this element is usedemonstrating in this example the relevant history element using a contained resource for the purpose of this example only typically would reference an external resource
  fhir:restriction [
     fhir:repetitions [ fhir:v "1"^^xsd:positiveInteger ] ;
     fhir:period [
       fhir:end [ fhir:v "2016-11-02T09:45:05+10:00"^^xsd:dateTime ]
     ]
  ] . # complete the request within 48 hrs

<http://hl7.org/fhir/ServiceRequest/physiotherapy/_history/1> a fhir:ServiceRequest .

<http://hl7.org/fhir/Practitioner/f202> a fhir:Practitioner .

<http://hl7.org/fhir/Practitioner/example> a fhir:Practitioner .

<http://hl7.org/fhir/ServiceRequest/lipid> a fhir:ServiceRequest .

<http://hl7.org/fhir/Patient/example> a fhir:Patient .

<http://hl7.org/fhir/Encounter/example> a fhir:Encounter .

<http://hl7.org/fhir/Organization/1832473e-2fe0-452d-abe9-3cdb9879522f> a fhir:Organization .

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

