@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://haau3.com/fhir/OperationDefinition/reconcile-medications> a fhir:OperationDefinition ;
  fhir:nodeRole fhir:treeRoot ;
  fhir:Resource.id [ fhir:value "reconcile-medications"] ;
  fhir:DomainResource.text [
     fhir:Narrative.status [ fhir:value "generated" ] ;
     fhir:Narrative.div "<div xmlns=\"http://www.w3.org/1999/xhtml\"><p class=\"res-header-id\"><b>Generated Narrative: OperationDefinition reconcile-medications</b></p><a name=\"reconcile-medications\"> </a><a name=\"hcreconcile-medications\"> </a><p>URL: [base]/$reconcile-medications</p><h3>Parameters</h3><table class=\"grid\"><tr><td><b>Use</b></td><td><b>Name</b></td><td><b>Scope</b></td><td><b>Cardinality</b></td><td><b>Type</b></td><td><b>Binding</b></td><td><b>Documentation</b></td></tr><tr><td>IN</td><td>bundle</td><td/><td>0..1</td><td><a href=\"http://hl7.org/fhir/R4/bundle.html\">Bundle</a></td><td/><td><div><p>The patient's medication records, as a Bundle of type collection or searchset. This is also the bare-body form: POST the Bundle itself as the request body, with nothing on the URL, and the list is evaluated as of the time of the request.</p>\n</div></td></tr><tr><td>IN</td><td>resource</td><td/><td>0..*</td><td><a href=\"http://hl7.org/fhir/R4/resource.html\">Resource</a></td><td/><td><div><p>One resource per repetition, for the Parameters form: a MedicationRequest, MedicationStatement, MedicationDispense or MedicationAdministration, or a Medication that one of those records references. Every part carries an id. A record's Medication/{id} reference resolves to the Medication part with that id, or to a Medication contained in the record, and the response names each source record as {resourceType}/{id}.</p>\n</div></td></tr><tr><td>IN</td><td>asOf</td><td/><td>0..1</td><td><a href=\"http://hl7.org/fhir/R4/datatypes.html#dateTime\">dateTime</a></td><td/><td><div><p>The date and time to evaluate the list as of. Parameters form only: the bare-body form evaluates the list as of the time of the request.</p>\n</div></td></tr><tr><td>OUT</td><td>return</td><td/><td>1..1</td><td><a href=\"http://hl7.org/fhir/R4/bundle.html\">Bundle</a></td><td/><td><div><p>The reconciled list: a Bundle conforming to haau3 Reconciled Medication Bundle, returned as the response body itself.</p>\n</div></td></tr></table><div><p>Send <code>bundle</code>, or one or more <code>resource</code> parts, but not both. Every record must name the same patient in <code>subject</code>. A request is refused, with an OperationOutcome that names the reason, for a resource of any other type, records that name two patients or none, a Bundle that is not a <code>collection</code> or <code>searchset</code>, a body over 16 MiB, a resource part with no id, or malformed content. A record that names no medication, or whose <code>medicationReference</code> cannot be resolved, is skipped with a warning that names only its <code>fullUrl</code>. The response is the Bundle itself, conforming to <a href=\"StructureDefinition-haau3-reconciled-medication-bundle.html\">haau3 Reconciled Medication Bundle</a>, not a Parameters resource.</p>\n</div></div>"
  ] ;
  fhir:OperationDefinition.url [ fhir:value "https://haau3.com/fhir/OperationDefinition/reconcile-medications"] ;
  fhir:OperationDefinition.version [ fhir:value "1.0.0"] ;
  fhir:OperationDefinition.name [ fhir:value "ReconcileMedications"] ;
  fhir:OperationDefinition.title [ fhir:value "Reconcile medications"] ;
  fhir:OperationDefinition.status [ fhir:value "active"] ;
  fhir:OperationDefinition.kind [ fhir:value "operation"] ;
  fhir:OperationDefinition.date [ fhir:value "2026-09-25"^^xsd:date] ;
  fhir:OperationDefinition.publisher [ fhir:value "haau3"] ;
  fhir:OperationDefinition.contact [
     fhir:index 0 ;
     fhir:ContactDetail.name [ fhir:value "haau3" ] ;
     fhir:ContactDetail.telecom [
       fhir:index 0 ;
       fhir:ContactPoint.system [ fhir:value "url" ] ;
       fhir:ContactPoint.value [ fhir:value "https://haau3.com" ]
     ], [
       fhir:index 1 ;
       fhir:ContactPoint.system [ fhir:value "email" ] ;
       fhir:ContactPoint.value [ fhir:value "hello@haau3.com" ]
     ]
  ] ;
  fhir:OperationDefinition.description [ fhir:value "Reconciles one patient's medication records, which may come from many sources and overlap, into one clean medication list. The list holds one entry per clinical drug, each a [haau3 Reconciled MedicationRequest](StructureDefinition-haau3-reconciled-medication-request.html) with a [haau3 Reconciled Medication Provenance](StructureDefinition-haau3-reconciled-medication-provenance.html) naming the records it came from. Software computes the list; no person curates it."] ;
  fhir:OperationDefinition.jurisdiction [
     fhir:index 0 ;
     fhir:CodeableConcept.coding [
       fhir:index 0 ;
       fhir:Coding.system [ fhir:value "urn:iso:std:iso:3166" ] ;
       fhir:Coding.code [ fhir:value "US" ] ;
       fhir:Coding.display [ fhir:value "United States of America" ]
     ]
  ] ;
  fhir:OperationDefinition.affectsState [ fhir:value "false"^^xsd:boolean] ;
  fhir:OperationDefinition.code [ fhir:value "reconcile-medications"] ;
  fhir:OperationDefinition.comment [ fhir:value "Send `bundle`, or one or more `resource` parts, but not both. Every record must name the same patient in `subject`. A request is refused, with an OperationOutcome that names the reason, for a resource of any other type, records that name two patients or none, a Bundle that is not a `collection` or `searchset`, a body over 16 MiB, a resource part with no id, or malformed content. A record that names no medication, or whose `medicationReference` cannot be resolved, is skipped with a warning that names only its `fullUrl`. The response is the Bundle itself, conforming to [haau3 Reconciled Medication Bundle](StructureDefinition-haau3-reconciled-medication-bundle.html), not a Parameters resource."] ;
  fhir:OperationDefinition.system [ fhir:value "true"^^xsd:boolean] ;
  fhir:OperationDefinition.type [ fhir:value "false"^^xsd:boolean] ;
  fhir:OperationDefinition.instance [ fhir:value "false"^^xsd:boolean] ;
  fhir:OperationDefinition.parameter [
     fhir:index 0 ;
     fhir:OperationDefinition.parameter.name [ fhir:value "bundle" ] ;
     fhir:OperationDefinition.parameter.use [ fhir:value "in" ] ;
     fhir:OperationDefinition.parameter.min [ fhir:value "0"^^xsd:integer ] ;
     fhir:OperationDefinition.parameter.max [ fhir:value "1" ] ;
     fhir:OperationDefinition.parameter.documentation [ fhir:value "The patient's medication records, as a Bundle of type collection or searchset. This is also the bare-body form: POST the Bundle itself as the request body, with nothing on the URL, and the list is evaluated as of the time of the request." ] ;
     fhir:OperationDefinition.parameter.type [ fhir:value "Bundle" ]
  ], [
     fhir:index 1 ;
     fhir:OperationDefinition.parameter.name [ fhir:value "resource" ] ;
     fhir:OperationDefinition.parameter.use [ fhir:value "in" ] ;
     fhir:OperationDefinition.parameter.min [ fhir:value "0"^^xsd:integer ] ;
     fhir:OperationDefinition.parameter.max [ fhir:value "*" ] ;
     fhir:OperationDefinition.parameter.documentation [ fhir:value "One resource per repetition, for the Parameters form: a MedicationRequest, MedicationStatement, MedicationDispense or MedicationAdministration, or a Medication that one of those records references. Every part carries an id. A record's Medication/{id} reference resolves to the Medication part with that id, or to a Medication contained in the record, and the response names each source record as {resourceType}/{id}." ] ;
     fhir:OperationDefinition.parameter.type [ fhir:value "Resource" ]
  ], [
     fhir:index 2 ;
     fhir:OperationDefinition.parameter.name [ fhir:value "asOf" ] ;
     fhir:OperationDefinition.parameter.use [ fhir:value "in" ] ;
     fhir:OperationDefinition.parameter.min [ fhir:value "0"^^xsd:integer ] ;
     fhir:OperationDefinition.parameter.max [ fhir:value "1" ] ;
     fhir:OperationDefinition.parameter.documentation [ fhir:value "The date and time to evaluate the list as of. Parameters form only: the bare-body form evaluates the list as of the time of the request." ] ;
     fhir:OperationDefinition.parameter.type [ fhir:value "dateTime" ]
  ], [
     fhir:index 3 ;
     fhir:Element.extension [
       fhir:index 0 ;
       fhir:Extension.url [ fhir:value "http://hl7.org/fhir/StructureDefinition/operationdefinition-profile" ] ;
       fhir:Extension.valueUri [ fhir:value "https://haau3.com/fhir/StructureDefinition/haau3-reconciled-medication-bundle" ]
     ] ;
     fhir:OperationDefinition.parameter.name [ fhir:value "return" ] ;
     fhir:OperationDefinition.parameter.use [ fhir:value "out" ] ;
     fhir:OperationDefinition.parameter.min [ fhir:value "1"^^xsd:integer ] ;
     fhir:OperationDefinition.parameter.max [ fhir:value "1" ] ;
     fhir:OperationDefinition.parameter.documentation [ fhir:value "The reconciled list: a Bundle conforming to haau3 Reconciled Medication Bundle, returned as the response body itself." ] ;
     fhir:OperationDefinition.parameter.type [ fhir:value "Bundle" ]
  ] .

# - ontology header ------------------------------------------------------------

<https://haau3.com/fhir/OperationDefinition/reconcile-medications.ttl> a owl:Ontology ;
  owl:imports fhir:fhir.ttl .

# -------------------------------------------------------------------------------------

