@prefix fhir: <http://hl7.org/fhir/> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .

# - resource -------------------------------------------------------------------

<https://fhir.dha.go.ke/erx/MedicationDispense/example-medicationdispense-with-notification> a fhir:MedicationDispense ;
  fhir:nodeRole fhir:treeRoot ;
  fhir:Resource.id [ fhir:value "example-medicationdispense-with-notification"] ;
  fhir:Resource.meta [
     fhir:Meta.profile [
       fhir:value "https://fhir.dha.go.ke/erx/StructureDefinition/ke-medication-dispense" ;
       fhir:index 0 ;
       fhir:link <https://fhir.dha.go.ke/erx/StructureDefinition/ke-medication-dispense>
     ], [
       fhir:value "https://fhir.dha.go.ke/fhir/StructureDefinition/ke-medication-dispense" ;
       fhir:index 1 ;
       fhir:link <https://fhir.dha.go.ke/fhir/StructureDefinition/ke-medication-dispense>
     ]
  ] ;
  fhir:DomainResource.text [
     fhir:Narrative.status [ fhir:value "generated" ] ;
     fhir:Narrative.div "<div xmlns=\"http://www.w3.org/1999/xhtml\"><p><b>Dispense DISP-2025-EXT-00001 – Notification Extension</b></p><p>60 tablets of Metformin 500 mg dispensed at KNH Pharmacy on 15 June 2025 (30-day supply). SMS notification sent to patient at 10:35 EAT. Authorized by prescription RX-2025-EXT-00001.</p></div>"
  ] ;
  fhir:DomainResource.extension [
     fhir:index 0 ;
     fhir:Element.extension [
       fhir:index 0 ;
       fhir:Extension.url [ fhir:value "notificationSent" ] ;
       fhir:Extension.valueBoolean [ fhir:value "true"^^xsd:boolean ]
     ], [
       fhir:index 1 ;
       fhir:Extension.url [ fhir:value "notificationChannel" ] ;
       fhir:Extension.valueCodeableConcept [
         fhir:CodeableConcept.text [ fhir:value "SMS" ]
       ]
     ], [
       fhir:index 2 ;
       fhir:Extension.url [ fhir:value "notifiedOn" ] ;
       fhir:Extension.valueDateTime [ fhir:value "2025-06-15T10:35:00+03:00"^^xsd:dateTime ]
     ] ;
     fhir:Extension.url [ fhir:value "https://fhir.dha.go.ke/fhir/StructureDefinition/dispense-notification" ]
  ] ;
  fhir:MedicationDispense.identifier [
     fhir:index 0 ;
     fhir:Identifier.system [ fhir:value "https://ilm-hie.dha.go.ke/fhir/NamingSystem/dispense-identifier" ] ;
     fhir:Identifier.value [ fhir:value "DISP-2025-EXT-00001" ]
  ] ;
  fhir:MedicationDispense.status [ fhir:value "completed"] ;
  fhir:MedicationDispense.medicationCodeableConcept [
     fhir:CodeableConcept.coding [
       fhir:index 0 ;
       fhir:Coding.system [ fhir:value "https://fhir.dha.go.ke/fhir/CodeSystem/generic-products-cs" ] ;
       fhir:Coding.code [ fhir:value "GE10002" ] ;
       fhir:Coding.display [ fhir:value "Metformin 500 mg Oral Tablet" ]
     ] ;
     fhir:CodeableConcept.text [ fhir:value "Metformin 500 mg Oral Tablet" ]
  ] ;
  fhir:MedicationDispense.subject [
     fhir:link <https://fhir.dha.go.ke/erx/Patient/example-patient-otieno> ;
     fhir:Reference.reference [ fhir:value "Patient/example-patient-otieno" ]
  ] ;
  fhir:MedicationDispense.context [
     fhir:link <https://fhir.dha.go.ke/erx/Encounter/example-encounter-otieno-inpatient> ;
     fhir:Reference.reference [ fhir:value "Encounter/example-encounter-otieno-inpatient" ]
  ] ;
  fhir:MedicationDispense.performer [
     fhir:index 0 ;
     fhir:MedicationDispense.performer.actor [
       fhir:link <https://fhir.dha.go.ke/erx/Organization/example-organization-knh> ;
       fhir:Reference.reference [ fhir:value "Organization/example-organization-knh" ]
     ]
  ] ;
  fhir:MedicationDispense.location [
     fhir:link <https://fhir.dha.go.ke/erx/Location/example-location-knh-pharmacy> ;
     fhir:Reference.reference [ fhir:value "Location/example-location-knh-pharmacy" ]
  ] ;
  fhir:MedicationDispense.authorizingPrescription [
     fhir:index 0 ;
     fhir:link <https://fhir.dha.go.ke/erx/MedicationRequest/example-medicationrequest-with-extensions> ;
     fhir:Reference.reference [ fhir:value "MedicationRequest/example-medicationrequest-with-extensions" ]
  ] ;
  fhir:MedicationDispense.type [
     fhir:CodeableConcept.coding [
       fhir:index 0 ;
       fhir:Coding.system [ fhir:value "http://terminology.hl7.org/CodeSystem/v3-ActCode" ] ;
       fhir:Coding.code [ fhir:value "FF" ] ;
       fhir:Coding.display [ fhir:value "First Fill" ]
     ]
  ] ;
  fhir:MedicationDispense.quantity [
     fhir:Quantity.value [ fhir:value "60"^^xsd:decimal ] ;
     fhir:Quantity.unit [ fhir:value "tablet" ] ;
     fhir:Quantity.system [ fhir:value "http://unitsofmeasure.org" ] ;
     fhir:Quantity.code [ fhir:value "1" ]
  ] ;
  fhir:MedicationDispense.daysSupply [
     fhir:Quantity.value [ fhir:value "30"^^xsd:decimal ] ;
     fhir:Quantity.unit [ fhir:value "day" ] ;
     fhir:Quantity.system [ fhir:value "http://unitsofmeasure.org" ] ;
     fhir:Quantity.code [ fhir:value "d" ]
  ] ;
  fhir:MedicationDispense.whenHandedOver [ fhir:value "2025-06-15T10:35:00+03:00"^^xsd:dateTime] ;
  fhir:MedicationDispense.substitution [
     fhir:MedicationDispense.substitution.wasSubstituted [ fhir:value "false"^^xsd:boolean ]
  ] .

# - ontology header ------------------------------------------------------------

<https://fhir.dha.go.ke/erx/MedicationDispense/example-medicationdispense-with-notification.ttl> a owl:Ontology ;
  owl:imports fhir:fhir.ttl .

# -------------------------------------------------------------------------------------

