@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/Provenance/ex-patient-merged> a fhir:Provenance ;
  fhir:nodeRole fhir:treeRoot ;
  fhir:id [ fhir:v "ex-patient-merged"] ; # 
  fhir:target ( [
     fhir:l <http://hl7.org/fhir/Patient/example-merge-survivor> ;
     fhir:reference [ fhir:v "Patient/example-merge-survivor" ]
  ] [
     fhir:l <http://hl7.org/fhir/Patient/example-merge-subsumed> ;
     fhir:reference [ fhir:v "Patient/example-merge-subsumed" ]
  ] [
     fhir:l <http://hl7.org/fhir/Observation/body-height-merged> ;
     fhir:reference [ fhir:v "Observation/body-height-merged" ]
  ] ) ; # 
  fhir:recorded [ fhir:v "2024-06-01T19:00:00Z"^^xsd:dateTime] ; # 
  fhir:authorization ( [] ) ; # 
  fhir:why [ fhir:v "Merge Patient Records that were matched by SSN and confirmed by review, with the data linked to the non-surviving patient is also fixed up to point at the surviving patient."] ; # 
  fhir:activity [
     fhir:coding ( [
       fhir:system [
         fhir:v "http://terminology.hl7.org/CodeSystem/v3-ActReason"^^xsd:anyURI ;
         fhir:l <http://terminology.hl7.org/CodeSystem/v3-ActReason>
       ] ;
       fhir:code [ fhir:v "MDATA" ]
     ] )
  ] ; # 
  fhir:patient [
     fhir:l <http://hl7.org/fhir/Patient/example-merge-survivor> ;
     fhir:reference [ fhir:v "Patient/example-merge-survivor" ]
  ] ; # 
  fhir:agent ( [
     fhir:type [
       fhir:coding ( [
         fhir:system [
           fhir:v "http://terminology.hl7.org/CodeSystem/provenance-participant-type"^^xsd:anyURI ;
           fhir:l <http://terminology.hl7.org/CodeSystem/provenance-participant-type>
         ] ;
         fhir:code [ fhir:v "author" ]
       ] )
     ] ;
     fhir:who [
       fhir:l <http://example.org/Practitioner/ex-practitioner> ;
       fhir:reference [ fhir:v "http://example.org/Practitioner/ex-practitioner" ]
     ]
  ] ) ; # 
  fhir:entity ( [
     fhir:role [ fhir:v "removal" ] ;
     fhir:what [
       fhir:l <http://hl7.org/fhir/Patient/example-merge-subsumed> ;
       fhir:reference [ fhir:v "Patient/example-merge-subsumed" ] ;
       fhir:identifier [
         fhir:system [
           fhir:v "http://example.org/mrn"^^xsd:anyURI ;
           fhir:l <http://example.org/mrn>
         ] ;
         fhir:value [ fhir:v "MRN-002" ]
       ] ;
       fhir:display [ fhir:v "Removed Duplicate Patient Record" ]
     ]
  ] [
     fhir:role [ fhir:v "revision" ] ;
     fhir:what [
       fhir:l <http://hl7.org/fhir/Patient/example-merge-survivor> ;
       fhir:reference [ fhir:v "Patient/example-merge-survivor" ] ;
       fhir:identifier [
         fhir:system [
           fhir:v "http://example.org/mrn"^^xsd:anyURI ;
           fhir:l <http://example.org/mrn>
         ] ;
         fhir:value [ fhir:v "MRN-001" ]
       ] ;
       fhir:display [ fhir:v "Surviving Patient Record after Merge" ]
     ]
  ] [
     fhir:role [ fhir:v "revision" ] ;
     fhir:what [
       fhir:l <http://hl7.org/fhir/Observation/body-height-merged> ;
       fhir:reference [ fhir:v "Observation/body-height-merged" ] ;
       fhir:display [ fhir:v "Body Height Observation from previous Patient is fixed to point at the surviving Patient after Merge" ]
     ]
  ] ) . # 

<http://hl7.org/fhir/Patient/example-merge-survivor> a fhir:Patient .

<http://hl7.org/fhir/Patient/example-merge-subsumed> a fhir:Patient .

<http://hl7.org/fhir/Observation/body-height-merged> a fhir:Observation .

# -------------------------------------------------------------------------------------

