CorePhysical2FHIR
type: StructureMap
node role: treeRoot
id:
  v: CorePhysical2FHIR
text:
  status:
    v: generated
  div:
    v: Narratif généré : StructureMap CorePhysical2FHIR #xD; map "https://interop.aphp.fr/ig/fhir/dm/StructureMap/CorePhysical2FHIR" = "CorePhysical2FHIR"#xD; #xD; // Alignement de l''usage Core du modèle physique du DPI vers les ressources FHIR#xD; #xD; uses "https://interop.aphp.fr/ig/fhir/dm/StructureDefinition/CoreDataSet" alias DataSet as source#xD; uses "https://interop.aphp.fr/ig/fhir/dm/StructureDefinition/CorePatient" alias PatientTable as source#xD; uses "https://interop.aphp.fr/ig/fhir/dm/StructureDefinition/CoreSejour" alias SejourTable as source#xD; uses "https://interop.aphp.fr/ig/fhir/dm/StructureDefinition/CoreBiology" alias BiologyTable as source#xD; uses "https://interop.aphp.fr/ig/fhir/dm/StructureDefinition/CoreClinical" alias ClinicalTable as source#xD; uses "https://interop.aphp.fr/ig/fhir/dm/StructureDefinition/CoreDiag" alias DiagTable as source#xD; uses "https://interop.aphp.fr/ig/fhir/dm/StructureDefinition/CoreActe" alias ActeTable as source#xD; uses "https://interop.aphp.fr/ig/fhir/dm/StructureDefinition/CoreAddress" alias AddressTable as source#xD; uses "https://interop.aphp.fr/ig/fhir/dm/StructureDefinition/CoreMedicationAdm" alias MedicationAdmTable as source#xD; uses "https://interop.aphp.fr/ig/fhir/dm/StructureDefinition/CoreMedicationPre" alias MedicationPreTable as source#xD; uses "http://hl7.org/fhir/StructureDefinition/Bundle" alias FHIRBundle as target#xD; uses "http://hl7.org/fhir/StructureDefinition/Patient" alias FHIRPatient as target#xD; uses "http://hl7.org/fhir/StructureDefinition/Encounter" alias FHIREncounter as target#xD; uses "http://hl7.org/fhir/StructureDefinition/Observation" alias FHIRObservation as target#xD; uses "http://hl7.org/fhir/StructureDefinition/Meta" alias FHIRMeta as target#xD; uses "http://hl7.org/fhir/StructureDefinition/Procedure" alias FHIRProcedure as target#xD; uses "http://hl7.org/fhir/StructureDefinition/Condition" alias FHIRCondition as target#xD; #xD; group dataSet(source srcDataSet : DataSet, target…
url:
  v: https://interop.aphp.fr/ig/fhir/dm/StructureMap/CorePhysical2FHIR
  l: CorePhysical2FHIR
version:
  v: 0.1.0
name:
  v: CorePhysical2FHIR
title:
  v: Alignement de l''usage Core du modèle physique du DPI vers les ressources FHIR
status:
  v: draft
date:
  v: 2026-04-16T14:35:38+00:00
publisher:
  v: AP-HP
contact:
  name:
    v: AP-HP
  telecom:
    system:
      v: url
    value:
      v: https://aphp.fr
description:
  v: Alignement de l''usage Core du modèle physique du DPI vers les ressources FHIR
jurisdiction:
  coding:
    system:
      v: urn:iso:std:iso:3166
      l: 3166
    code:
      v: FR
structure:
  url:
    v: https://interop.aphp.fr/ig/fhir/dm/StructureDefinition/CoreDataSet
    l: CoreDataSet
  mode:
    v: source
  alias:
    v: DataSet
structure:
  url:
    v: https://interop.aphp.fr/ig/fhir/dm/StructureDefinition/CorePatient
    l: CorePatient
  mode:
    v: source
  alias:
    v: PatientTable
structure:
  url:
    v: https://interop.aphp.fr/ig/fhir/dm/StructureDefinition/CoreSejour
    l: CoreSejour
  mode:
    v: source
  alias:
    v: SejourTable
structure:
  url:
    v: https://interop.aphp.fr/ig/fhir/dm/StructureDefinition/CoreBiology
    l: CoreBiology
  mode:
    v: source
  alias:
    v: BiologyTable
structure:
  url:
    v: https://interop.aphp.fr/ig/fhir/dm/StructureDefinition/CoreClinical
    l: CoreClinical
  mode:
    v: source
  alias:
    v: ClinicalTable
structure:
  url:
    v: https://interop.aphp.fr/ig/fhir/dm/StructureDefinition/CoreDiag
    l: CoreDiag
  mode:
    v: source
  alias:
    v: DiagTable
structure:
  url:
    v: https://interop.aphp.fr/ig/fhir/dm/StructureDefinition/CoreActe
    l: CoreActe
  mode:
    v: source
  alias:
    v: ActeTable
structure:
  url:
    v: https://interop.aphp.fr/ig/fhir/dm/StructureDefinition/CoreAddress
    l: CoreAddress
  mode:
    v: source
  alias:
    v: AddressTable
structure:
  url:
    v: https://interop.aphp.fr/ig/fhir/dm/StructureDefinition/CoreMedicationAdm
    l: CoreMedicationAdm
  mode:
    v: source
  alias:
    v: MedicationAdmTable
structure:
  url:
    v: https://interop.aphp.fr/ig/fhir/dm/StructureDefinition/CoreMedicationPre
    l: CoreMedicationPre
  mode:
    v: source
  alias:
    v: MedicationPreTable
structure:
  url:
    v: http://hl7.org/fhir/StructureDefinition/Bundle
    l: Bundle
  mode:
    v: target
  alias:
    v: FHIRBundle
structure:
  url:
    v: http://hl7.org/fhir/StructureDefinition/Patient
    l: Patient
  mode:
    v: target
  alias:
    v: FHIRPatient
structure:
  url:
    v: http://hl7.org/fhir/StructureDefinition/Encounter
    l: Encounter
  mode:
    v: target
  alias:
    v: FHIREncounter
structure:
  url:
    v: http://hl7.org/fhir/StructureDefinition/Observation
    l: Observation
  mode:
    v: target
  alias:
    v: FHIRObservation
structure:
  url:
    v: http://hl7.org/fhir/StructureDefinition/Meta
    l: Meta
  mode:
    v: target
  alias:
    v: FHIRMeta
structure:
  url:
    v: http://hl7.org/fhir/StructureDefinition/Procedure
    l: Procedure
  mode:
    v: target
  alias:
    v: FHIRProcedure
structure:
  url:
    v: http://hl7.org/fhir/StructureDefinition/Condition
    l: Condition
  mode:
    v: target
  alias:
    v: FHIRCondition
group:
  name:
    v: dataSet
  type mode:
    v: types
  input:
    name:
      v: srcDataSet
    type:
      v: DataSet
    mode:
      v: source
  input:
    name:
      v: tgtBundle
    type:
      v: FHIRBundle
    mode:
      v: target
  rule:
    name:
      v: setId
    source:
      context:
        v: srcDataSet

context:
  v: tgtBundle
context type:
  v: variable
element:
  v: id
transform:
  v: uuid

name:
  v: setType
source:
  context:
    v: srcDataSet
target:
  context:
    v: tgtBundle
  context type:
    v: variable
  element:
    v: type
  transform:
    v: copy
  parameter:
    value: String
      v: transaction

name:
  v: createPatient
source:
  context:
    v: srcDataSet
  element:
    v: patient
  variable:
    v: srcPatient
target:
  context:
    v: tgtBundle
  context type:
    v: variable
  element:
    v: entry
  variable:
    v: tgtPatientEntry
target:
  context:
    v: tgtPatientEntry
  context type:
    v: variable
  element:
    v: resource
  variable:
    v: newPatient
  transform:
    v: create
  parameter:
    value: String
      v: Patient
rule:
  name:
    v: setPatient
  source:
    context:
      v: srcPatient
  dependent:
    name:
      v: patient
    variable:
      v: srcPatient
    variable:
      v: newPatient
rule:
  name:
    v: setRequestAndFullUrl
  source:
    context:
      v: srcPatient
  dependent:
    name:
      v: setEntryRequestAndFullUrl
    variable:
      v: newPatient
    variable:
      v: tgtPatientEntry
rule:
  name:
    v: addPatientAddress
  source:
    context:
      v: srcDataSet
    element:
      v: address
    variable:
      v: srcAddress
    condition:
      v: patientNi.reference = ('PatientCore/' + %srcPatient.patientNi.toString())
  dependent:
    name:
      v: patientAddress
    variable:
      v: srcAddress
    variable:
      v: newPatient
rule:
  name:
    v: createEncounter
  source:
    context:
      v: srcDataSet
    element:
      v: sejour
    variable:
      v: srcSejour
    condition:
      v: patientNi.reference = ('PatientCore/' + %srcPatient.patientNi.toString())
  target:
    context:
      v: tgtBundle
    context type:
      v: variable
    element:
      v: entry
    variable:
      v: tgtEncounterEntry
  target:
    context:
      v: tgtEncounterEntry
    context type:
      v: variable
    element:
      v: resource
    variable:
      v: newEncounter
    transform:
      v: create
    parameter:
      value: String
        v: Encounter
  rule:
    name:
      v: setEncounter
    source:
      context:
        v: srcSejour
    dependent:
      name:
        v: encounter
      variable:
        v: srcSejour
      variable:
        v: newPatient
      variable:
        v: newEncounter
  rule:
    name:
      v: setRequestAndFullUrl
    source:
      context:
        v: srcSejour
    dependent:
      name:
        v: setEntryRequestAndFullUrl
      variable:
        v: newEncounter
      variable:
        v: tgtEncounterEntry
  rule:
    name:
      v: createProcedure
    source:
      context:
        v: srcDataSet
      element:
        v: acte
      variable:
        v: srcActe
      condition:
        v: sejourNi.reference = ('SejourCore/' + %srcSejour.sejourNi.toString())
    target:
      context:
        v: tgtBundle
      context type:
        v: variable
      element:
        v: entry
      variable:
        v: tgtProcedureEntry
    target:
      context:
        v: tgtProcedureEntry
      context type:
        v: variable
      element:
        v: resource
      variable:
        v: newProcedure
      transform:
        v: create
      parameter:
        value: String
    rule:
      name:
        v: setProcedure
    rule:
      name:
        v: setRequestAndFullUrl
  rule:
    name:
      v: createProcedure
    source:
      context:
        v: srcDataSet
      element:
        v: diag
      variable:
        v: srcDiag
      condition:
        v: sejourNi.reference = ('SejourCore/' + %srcSejour.sejourNi.toString())
    target:
      context:
        v: tgtBundle
      context type:
        v: variable
      element:
        v: entry
      variable:
        v: tgtConditionEntry
    target:
      context:
        v: tgtConditionEntry

String
v: Procedure

v: srcActe

v: procedure

v: srcActe

v: newPatient

v: newEncounter

v: newProcedure

v: srcActe

v: setEntryRequestAndFullUrl

v: newProcedure

v: tgtProcedureEntry

v: variable

v: resource

v: newCondition

v: create

value: String
  v: Condition

name:
  v: setCondition
source:
  context:
    v: srcDiag
dependent:
  name:
    v: condition
  variable:
    v: srcDiag
  variable:
    v: newPatient
  variable:
    v: newEncounter
  variable:
    v: newCondition

name:
  v: setRequestAndFullUrl
source:
  context:
    v: srcDiag
dependent:
  name:
    v: setEntryRequestAndFullUrl
  variable:
    v: newCondition
  variable:
    v: tgtConditionEntry

name:
  v: createObservation
source:
  context:
    v: srcDataSet
  element:
    v: biology
  variable:
    v: srcBiology
  condition:
    v: sejourNi.reference = ('SejourCore/' + %srcSejour.sejourNi.toString())
target:
  context:
    v: tgtBundle
  context type:
    v: variable
  element:
    v: entry
  variable:
    v: tgtBiologyEntry
target:
  context:
    v: tgtBiologyEntry
  context type:
    v: variable
  element:
    v: resource
  variable:
    v: newObservation
  transform:
    v: create
  parameter:
    value: String
      v: Observation
rule:
  name:
    v: setBiology
  source:
    context:
      v: srcBiology
  dependent:
    name:
      v: observationBiol
    variable:
      v: srcBiology
    variable:
      v: newPatient
    variable:
      v: newEncounter
    variable:
      v: newObservation
rule:
  name:
    v: setRequestAndFullUrl
  source:
    context:
      v: srcBiology
  dependent:
    name:
      v: setEntryRequestAndFullUrl
    variable:
      v: newObservation
    variable:
      v: tgtBiologyEntry

name:
  v: patient
type mode:
  v: none
input:
  name:
    v: srcPatient
  type:
    v: PatientTable
  mode:
    v: source
input:
  name:
    v: tgtPatient
  type:
    v: FHIRPatient
  mode:
    v: target
rule:
  name:
    v: setId
  source:
    context:
      v: srcPatient
  target:
    context:
      v: tgtPatient
    context type:
      v: variable
    element:
      v: id
    transform:
      v: uuid
rule:
  name:
    v: setMeta
  source:
    context:
      v: srcPatient
    element:
      v: patientNi
    variable:
      v: srcNi
  target:
    context:
      v: tgtPatient
    context type:
      v: variable
    element:
      v: meta
    variable:
      v: tgtMeta
  dependent:
    name:
      v: setPatientMeta
    variable:
      v: srcNi
    variable:
      v: tgtMeta
  documentation:
    v: copie la valeur du champ patientNi de la table Patient dans l'élément id de la ressource FHIR Patient
rule:
  name:
    v: setHumainName
  source:
    context:
      v: srcPatient
  target:
    context:
      v: tgtPatient
    context type:
      v: variable
    element:
      v: name
    variable:
      v: tgtPatientName
  dependent:
    name:
      v: setHumainName
    variable:
      v: srcPatient
    variable:
      v: tgtPatientName
rule:
  name:
    v: setHumainNir
  source:
    context:
      v: srcPatient
  target:
    context:
      v: tgtPatient
    context type:
      v: variable
    element:
      v: identifier
    variable:
      v: tgtPatientIdentifier
  dependent:
    name:
      v: setHumainNir
    variable:
      v: srcPatient
    variable:
      v: tgtPatientIdentifier
rule:
  name:
    v: setGender
  source:
    context:
      v: srcPatient
    element:
      v: gender
    variable:
      v: srcPatientGender
  target:
    context:
      v: tgtPatient
    context type:
      v: variable
    element:
      v: gender
    transform:
      v: translate
    parameter:
      value: Id
        v: srcPatientGender
    parameter:
      value: String
        v: https://interop.aphp.fr/ig/fhir/dm/ConceptMap/DpiGender2Hl7Gender
    parameter:
      value: String
        v: code
  documentation:
    v: traduit la valeur du champ gender de la table Patient dans l'élément gender de la ressource FHIR Patient
rule:
  name:
    v: setBirthDate
  source:
    context:
      v: srcPatient
    element:
      v: birthDate
    variable:
      v: srcPatientBirthDate
  target:
    context:
      v: tgtPatient
    context type:
      v: variable
    element:
      v: birthDate
    transform:
      v: copy
    parameter:
      value: Id
        v: srcPatientBirthDate
  documentation:
    v: copie la valeur du champ birthDate de la table Patient dans l'élément birthDate de la ressource FHIR Patient

name:
  v: setPatientMeta
type mode:
  v: none
input:
  name:
    v: srcNi
  mode:
    v: source
input:
  name:
    v: tgtMeta
  type:
    v: FHIRMeta
  mode:
    v: target
rule:
  name:
    v: setSource
  source:
    context:
      v: srcNi
  target:
    context:
      v: tgtMeta
    context type:
      v: variable
    element:
      v: source
    transform:
      v: evaluate
    parameter:
      value: String
        v: 'https://aphp.fr/fhir/Endpoint/dpi/PatientTable' + '/' + %srcNi.toString()

name:
  v: setHumainName
type mode:
  v: none
input:
  name:
    v: srcPatient
  type:
    v: PatientTable
  mode:
    v: source
input:
  name:
    v: tgtPatientName
  mode:
    v: target
rule:
  name:
    v: setUse
  source:
    context:
      v: srcPatient
  target:
    context:
      v: tgtPatientName
    context type:
      v: variable
    element:
      v: use
    transform:
      v: copy
    parameter:
      value: String
        v: usual
rule:
  name:
    v: setName
  source:
    context:
      v: srcPatient
    element:
      v: name
    variable:
      v: srcPatientName
  target:
    context:
      v: tgtPatientName
    context type:
      v: variable
    element:
      v: family
    transform:
      v: copy
    parameter:
      value: Id
        v: srcPatientName
  rule:
    name:
      v: setFirstNameAndText
    source:
      context:
        v: srcPatient
      element:
        v: firstName
      variable:
        v: srcPatientFirstName
    target:
      context:
        v: tgtPatientName
      context type:
        v: variable
      element:
        v: given
      transform:
        v: copy
      parameter:
        value: Id
    target:
      context:
        v: tgtPatientName
      context type:
        v: variable
      element:
        v: text
      transform:
        v: evaluate
      parameter:
        value: String

Id
v: srcPatientFirstName

String
v: %srcPatientFirstName + ' ' + %srcPatientName

name:
  v: setHumainNir
type mode:
  v: none
input:
  name:
    v: srcPatient
  type:
    v: PatientTable
  mode:
    v: source
input:
  name:
    v: tgtPatientIdentifier
  mode:
    v: target
rule:
  name:
    v: setNir
  source:
    context:
      v: srcPatient
    element:
      v: nir
    variable:
      v: srcPatientNir
  target:
    context:
      v: tgtPatientIdentifier
    context type:
      v: variable
    element:
      v: use
    transform:
      v: copy
    parameter:
      value: String
        v: official
  target:
    context:
      v: tgtPatientIdentifier
    context type:
      v: variable
    element:
      v: type
    transform:
      v: cc
    parameter:
      value: String
        v: https://hl7.fr/ig/fhir/core/CodeSystem/fr-core-cs-v2-0203
    parameter:
      value: String
        v: INS-NIR
  target:
    context:
      v: tgtPatientIdentifier
    context type:
      v: variable
    element:
      v: system
    transform:
      v: copy
    parameter:
      value: String
        v: urn:oid:1.2.250.1.213.1.4.8
  target:
    context:
      v: tgtPatientIdentifier
    context type:
      v: variable
    element:
      v: value
    transform:
      v: copy
    parameter:
      value: Id
        v: srcPatientNir

name:
  v: patientAddress
type mode:
  v: none
input:
  name:
    v: srcAddress
  type:
    v: AddressTable
  mode:
    v: source
input:
  name:
    v: tgtPatient
  type:
    v: FHIRPatient
  mode:
    v: target
rule:
  name:
    v: setAddress
  source:
    context:
      v: srcAddress
  target:
    context:
      v: tgtPatient
    context type:
      v: variable
    element:
      v: address
    variable:
      v: newAddress
    transform:
      v: create
    parameter:
      value: String
        v: Address
  rule:
    name:
      v: setZip
    source:
      context:
        v: srcAddress
      element:
        v: zipCode
      variable:
        v: srczip
    target:
      context:
        v: newAddress
      context type:
        v: variable
      element:
        v: postalCode
      transform:
        v: copy
      parameter:
        value: Id
  rule:
    name:
      v: setCity
    source:
      context:
        v: srcAddress
      element:
        v: city
      variable:
        v: srcCity
    target:
      context:
        v: newAddress
      context type:
        v: variable
      element:
        v: city
      transform:
        v: copy
      parameter:
        value: Id
  rule:
    name:
      v: setCountry
    source:
      context:
        v: srcAddress
      element:
        v: country
      variable:
        v: srcCountry
    target:
      context:
        v: newAddress
      context type:
        v: variable
      element:
        v: country
      transform:
        v: copy
      parameter:
        value: Id
  rule:
    name:
      v: setText
    source:
      context:
        v: srcAddress
      element:
        v: address
      variable:
        v: srcAddressText
    target:
      context:
        v: newAddress
      context type:
        v: variable
      element:
        v: text
      transform:
        v: copy
      parameter:
        value: Id
  rule:
    name:
      v: setUseHome
    source:
      context:
        v: srcAddress
      condition:
        v: current = true
    target:
      context:
        v: newAddress
      context type:
        v: variable
      element:
        v: use
      transform:
        v: copy
      parameter:
        value: String
  rule:
    name:
      v: setUseOld
    source:
      context:
        v: srcAddress
      condition:
        v: current = false
    target:
      context:
        v: newAddress
      context type:
        v: variable
      element:
        v: use
      transform:
        v: copy
      parameter:
        value: String
  rule:
    name:
      v: setCoordinatesExtension
    source:
      context:
        v: srcAddress
      condition:
        v: latitude.exists() or longitude.exists()
    target:
      context:
        v: newAddress
      context type:
        v: variable
      element:
        v: extension
      variable:
        v: firstLevelExtension
      transform:
        v: create
      parameter:
        value: String
    rule:
      name:
        v: setflext

Id
v: srczip

Id
v: srcCity

Id
v: srcCountry

Id
v: srcAddressText

String
v: home

String
v: old

String
v: Extension

v: srcAddress

v: firstLevelExtension

v: variable

v: url

v: evaluate

value: String
  v: 'http://hl7.org/fhir/StructureDefinition/geolocation'

v: setLatExt

context:
  v: srcAddress
element:
  v: latitude
variable:
  v: srcLat

context:
  v: firstLevelExtension
context type:
  v: variable
element:
  v: extension
variable:
  v: latExtension
transform:
  v: create
parameter:
  value: String
    v: Extension

name:
  v: setLat
source:
  context:
    v: srcLat
target:
  context:
    v: latExtension
  context type:
    v: variable
  element:
    v: url
  transform:
    v: evaluate
  parameter:
    value: String
      v: 'latitude'
target:
  context:
    v: latExtension
  context type:
    v: variable
  element:
    v: value
  transform:
    v: copy
  parameter:
    value: Id
      v: srcLat

v: setLongExt

context:
  v: srcAddress
element:
  v: longitude
variable:
  v: srcLong

context:
  v: firstLevelExtension
context type:
  v: variable
element:
  v: extension
variable:
  v: longExtension
transform:
  v: create
parameter:
  value: String
    v: Extension

name:
  v: setLong
source:
  context:
    v: srcLong
target:
  context:
    v: longExtension
  context type:
    v: variable
  element:
    v: url
  transform:
    v: evaluate
  parameter:
    value: String
      v: 'longitude'
target:
  context:
    v: longExtension
  context type:
    v: variable
  element:
    v: value
  transform:
    v: copy
  parameter:
    value: Id
      v: srcLong

name:
  v: encounter
type mode:
  v: none
input:
  name:
    v: srcSejour
  type:
    v: SejourTable
  mode:
    v: source
input:
  name:
    v: srcPatient
  type:
    v: FHIRPatient
  mode:
    v: source
input:
  name:
    v: tgtEncounter
  type:
    v: FHIREncounter
  mode:
    v: target
rule:
  name:
    v: setId
  source:
    context:
      v: srcSejour
  target:
    context:
      v: tgtEncounter
    context type:
      v: variable
    element:
      v: id
    transform:
      v: uuid
rule:
  name:
    v: setMeta
  source:
    context:
      v: srcSejour
    element:
      v: sejourNi
    variable:
      v: srcNi
  target:
    context:
      v: tgtEncounter
    context type:
      v: variable
    element:
      v: meta
    variable:
      v: tgtMeta
  dependent:
    name:
      v: setEncounterMeta
    variable:
      v: srcNi
    variable:
      v: tgtMeta
  documentation:
    v: copie la valeur du champ patientNi de la table Patient dans l'élément id de la ressource FHIR Patient
rule:
  name:
    v: setStatus
  source:
    context:
      v: srcSejour
  target:
    context:
      v: tgtEncounter
    context type:
      v: variable
    element:
      v: status
    transform:
      v: copy
    parameter:
      value: String
        v: finished
rule:
  name:
    v: setEncounterClass
  source:
    context:
      v: srcSejour
    element:
      v: sejourType
    variable:
      v: srcSejourType
  target:
    context:
      v: tgtEncounter
    context type:
      v: variable
    element:
      v: class
    transform:
      v: translate
    parameter:
      value: Id
        v: srcSejourType
    parameter:
      value: String
        v: https://interop.aphp.fr/ig/fhir/dm/ConceptMap/DpiEncounterType2SemanticLayerEncounterClass
    parameter:
      value: String
        v: Coding
rule:
  name:
    v: setSubjectReference
  source:
    context:
      v: srcPatient
    element:
      v: id
    variable:
      v: patientId
  target:
    context:
      v: tgtEncounter
    context type:
      v: variable
    element:
      v: subject
    variable:
      v: newSubject
    transform:
      v: create
    parameter:
      value: String
        v: Reference
  dependent:
    name:
      v: setSubjectReference
    variable:
      v: patientId
    variable:
      v: newSubject
rule:
  name:
    v: patientNi
  source:
    context:
      v: srcSejour
    element:
      v: patientNi
  documentation:
    v: fk vers le patient à conserver pour la construction auto du périmètre final
rule:
  name:
    v: setPeriod
  source:
    context:
      v: srcSejour
  target:
    context:
      v: tgtEncounter
    context type:
      v: variable
    element:
      v: period
    variable:
      v: newActualPeriod
    transform:
      v: create
    parameter:
      value: String
        v: Period
  rule:
    name:
      v: setStart
    source:
      context:
        v: srcSejour
      element:
        v: sejourStart
      variable:
        v: srcPeriodStart
    target:
      context:
        v: newActualPeriod
      context type:
        v: variable
      element:
        v: start
      transform:
        v: copy
      parameter:
        value: Id
  rule:
    name:
      v: setEnd
    source:
      context:
        v: srcSejour
      element:
        v: sejourEnd

Id
v: srcPeriodStart

v: srcPeriodEnd

context:
  v: newActualPeriod
context type:
  v: variable
element:
  v: end
transform:
  v: copy
parameter:
  value: Id
    v: srcPeriodEnd

name:
  v: setEncounterMeta
type mode:
  v: none
input:
  name:
    v: srcNi
  mode:
    v: source
input:
  name:
    v: tgtMeta
  type:
    v: FHIRMeta
  mode:
    v: target
rule:
  name:
    v: setSource
  source:
    context:
      v: srcNi
  target:
    context:
      v: tgtMeta
    context type:
      v: variable
    element:
      v: source
    transform:
      v: evaluate
    parameter:
      value: String
        v: 'https://aphp.fr/fhir/Endpoint/dpi/SejourTable' + '/' + %srcNi.toString()

name:
  v: setSubjectReference
type mode:
  v: none
input:
  name:
    v: srcPatientId
  mode:
    v: source
input:
  name:
    v: newSubject
  mode:
    v: target
rule:
  name:
    v: setReference
  source:
    context:
      v: srcPatientId
  target:
    context:
      v: newSubject
    context type:
      v: variable
    element:
      v: reference
    transform:
      v: evaluate
    parameter:
      value: String
        v: 'Patient/' + %srcPatientId.toString()

name:
  v: procedure
type mode:
  v: none
input:
  name:
    v: srcActe
  type:
    v: ActeTable
  mode:
    v: source
input:
  name:
    v: srcPatient
  type:
    v: FHIRPatient
  mode:
    v: source
input:
  name:
    v: srcEncounter
  type:
    v: FHIREncounter
  mode:
    v: source
input:
  name:
    v: tgtProcedure
  type:
    v: FHIRProcedure
  mode:
    v: target
rule:
  name:
    v: setId
  source:
    context:
      v: srcActe
  target:
    context:
      v: tgtProcedure
    context type:
      v: variable
    element:
      v: id
    transform:
      v: uuid
rule:
  name:
    v: setMeta
  source:
    context:
      v: srcActe
    element:
      v: acteNi
    variable:
      v: srcNi
  target:
    context:
      v: tgtProcedure
    context type:
      v: variable
    element:
      v: meta
    variable:
      v: tgtMeta
  dependent:
    name:
      v: setProcedureMeta
    variable:
      v: srcNi
    variable:
      v: tgtMeta
rule:
  name:
    v: setSubjectReference
  source:
    context:
      v: srcPatient
    element:
      v: id
    variable:
      v: patientId
  target:
    context:
      v: tgtProcedure
    context type:
      v: variable
    element:
      v: subject
    variable:
      v: newSubject
    transform:
      v: create
    parameter:
      value: String
        v: Reference
  dependent:
    name:
      v: setSubjectReference
    variable:
      v: patientId
    variable:
      v: newSubject
rule:
  name:
    v: setEncounterReference
  source:
    context:
      v: srcEncounter
    element:
      v: id
    variable:
      v: encounterId
  target:
    context:
      v: tgtProcedure
    context type:
      v: variable
    element:
      v: encounter
    variable:
      v: newEncounter
    transform:
      v: create
    parameter:
      value: String
        v: Reference
  dependent:
    name:
      v: setEncounterReference
    variable:
      v: encounterId
    variable:
      v: newEncounter
rule:
  name:
    v: setStatus
  source:
    context:
      v: srcActe
  target:
    context:
      v: tgtProcedure
    context type:
      v: variable
    element:
      v: status
    transform:
      v: copy
    parameter:
      value: String
        v: completed
rule:
  name:
    v: setDate
  source:
    context:
      v: srcActe
    condition:
      v: dateStart.exists() or dateEnd.exists
  target:
    context:
      v: tgtProcedure
    context type:
      v: variable
    element:
      v: performed
    variable:
      v: tgtProcedurePeriod
    transform:
      v: create
    parameter:
      value: String
        v: Period
  rule:
    name:
      v: setActeStart
    source:
      context:
        v: srcActe
      element:
        v: dateStart
      variable:
        v: srcActeStart
    target:
      context:
        v: tgtProcedurePeriod
      context type:
        v: variable
      element:
        v: start
      transform:
        v: copy
      parameter:
        value: Id
  rule:
    name:
      v: setActeEnd
    source:
      context:
        v: srcActe
      element:
        v: dateEnd

Id
v: srcActeStart

v: srcActeEnd

context:
  v: tgtProcedurePeriod
context type:
  v: variable
element:
  v: end
transform:
  v: copy
parameter:
  value: Id
    v: srcActeEnd

name:
  v: setCode
source:
  context:
    v: srcActe
  element:
    v: code
  variable:
    v: acteCode
target:
  context:
    v: tgtProcedure
  context type:
    v: variable
  element:
    v: code
  transform:
    v: cc
  parameter:
    value: String
      v: https://smt.esante.gouv.fr/terminologie-ccam
  parameter:
    value: Id
      v: acteCode
documentation:
  v: C'est le code de la CCAM facturante

name:
  v: setProcedureMeta
type mode:
  v: none
input:
  name:
    v: srcNi
  mode:
    v: source
input:
  name:
    v: tgtMeta
  type:
    v: FHIRMeta
  mode:
    v: target
rule:
  name:
    v: setSource
  source:
    context:
      v: srcNi
  target:
    context:
      v: tgtMeta
    context type:
      v: variable
    element:
      v: source
    transform:
      v: evaluate
    parameter:
      value: String
        v: 'https://aphp.fr/fhir/Endpoint/dpi/ActeTable' + '/' + %srcNi.toString()

name:
  v: setEncounterReference
type mode:
  v: none
input:
  name:
    v: srcEncounterId
  mode:
    v: source
input:
  name:
    v: newEncounter
  mode:
    v: target
rule:
  name:
    v: setReference
  source:
    context:
      v: srcEncounterId
  target:
    context:
      v: newEncounter
    context type:
      v: variable
    element:
      v: reference
    transform:
      v: evaluate
    parameter:
      value: String
        v: 'Encounter/' + %srcEncounterId.toString()

name:
  v: condition
type mode:
  v: none
input:
  name:
    v: srcDiag
  type:
    v: DiagTable
  mode:
    v: source
input:
  name:
    v: srcPatient
  type:
    v: FHIRPatient
  mode:
    v: source
input:
  name:
    v: srcEncounter
  type:
    v: FHIREncounter
  mode:
    v: source
input:
  name:
    v: tgtCondition
  type:
    v: FHIRCondition
  mode:
    v: target
rule:
  name:
    v: setId
  source:
    context:
      v: srcDiag
  target:
    context:
      v: tgtCondition
    context type:
      v: variable
    element:
      v: id
    transform:
      v: uuid
rule:
  name:
    v: setMeta
  source:
    context:
      v: srcDiag
    element:
      v: diagNi
    variable:
      v: srcNi
  target:
    context:
      v: tgtCondition
    context type:
      v: variable
    element:
      v: meta
    variable:
      v: tgtMeta
  dependent:
    name:
      v: setConditionMeta
    variable:
      v: srcNi
    variable:
      v: tgtMeta
rule:
  name:
    v: setSubjectReference
  source:
    context:
      v: srcPatient
    element:
      v: id
    variable:
      v: patientId
  target:
    context:
      v: tgtCondition
    context type:
      v: variable
    element:
      v: subject
    variable:
      v: newSubject
    transform:
      v: create
    parameter:
      value: String
        v: Reference
  dependent:
    name:
      v: setSubjectReference
    variable:
      v: patientId
    variable:
      v: newSubject
rule:
  name:
    v: setEncounterReference
  source:
    context:
      v: srcEncounter
    element:
      v: id
    variable:
      v: encounterId
  target:
    context:
      v: tgtCondition
    context type:
      v: variable
    element:
      v: encounter
    variable:
      v: newEncounter
    transform:
      v: create
    parameter:
      value: String
        v: Reference
  dependent:
    name:
      v: setEncounterReference
    variable:
      v: encounterId
    variable:
      v: newEncounter
rule:
  name:
    v: setVerificationStatus
  source:
    context:
      v: srcDiag
  target:
    context:
      v: tgtCondition
    context type:
      v: variable
    element:
      v: verificationStatus
    transform:
      v: copy
    parameter:
      value: String
        v: confirmed
rule:
  name:
    v: setCategory
  source:
    context:
      v: srcDiag
  target:
    context:
      v: tgtCondition
    context type:
      v: variable
    element:
      v: category
    transform:
      v: cc
    parameter:
      value: String
        v: http://terminology.hl7.org/CodeSystem/condition-category
    parameter:
      value: String
        v: encounter-diagnosis
rule:
  name:
    v: setCode
  source:
    context:
      v: srcDiag
    element:
      v: code
    variable:
      v: diagCode
  target:
    context:
      v: tgtCondition
    context type:
      v: variable
    element:
      v: code
    transform:
      v: cc
    parameter:
      value: String
        v: http://hl7.org/fhir/sid/icd-10
    parameter:
      value: Id
        v: diagCode

name:
  v: setConditionMeta
type mode:
  v: none
input:
  name:
    v: srcNi
  mode:
    v: source
input:
  name:
    v: tgtMeta
  type:
    v: FHIRMeta
  mode:
    v: target
rule:
  name:
    v: setSource
  source:
    context:
      v: srcNi
  target:
    context:
      v: tgtMeta
    context type:
      v: variable
    element:
      v: source
    transform:
      v: evaluate
    parameter:
      value: String
        v: 'https://aphp.fr/fhir/Endpoint/dpi/DiagTable' + '/' + %srcNi.toString()

name:
  v: observationBiol
type mode:
  v: none
input:
  name:
    v: srcBiology
  type:
    v: BiologyTable
  mode:
    v: source
input:
  name:
    v: srcPatient
  type:
    v: FHIRPatient
  mode:
    v: source
input:
  name:
    v: srcEncounter
  type:
    v: FHIREncounter
  mode:
    v: source
input:
  name:
    v: tgtObservation
  type:
    v: FHIRObservation
  mode:
    v: target
rule:
  name:
    v: setId
  source:
    context:
      v: srcBiology
  target:
    context:
      v: tgtObservation
    context type:
      v: variable
    element:
      v: id
    transform:
      v: uuid
rule:
  name:
    v: setMeta
  source:
    context:
      v: srcBiology
    element:
      v: biologyNi
    variable:
      v: srcNi
  target:
    context:
      v: tgtObservation
    context type:
      v: variable
    element:
      v: meta
    variable:
      v: tgtMeta
  dependent:
    name:
      v: setBiologyMeta
    variable:
      v: srcNi
    variable:
      v: tgtMeta
rule:
  name:
    v: setSubjectReference
  source:
    context:
      v: srcPatient
    element:
      v: id
    variable:
      v: patientId
  target:
    context:
      v: tgtObservation
    context type:
      v: variable
    element:
      v: subject
    variable:
      v: newSubject
    transform:
      v: create
    parameter:
      value: String
        v: Reference
  dependent:
    name:
      v: setSubjectReference
    variable:
      v: patientId
    variable:
      v: newSubject
rule:
  name:
    v: setEncounterReference
  source:
    context:
      v: srcEncounter
    element:
      v: id
    variable:
      v: encounterId
  target:
    context:
      v: tgtObservation
    context type:
      v: variable
    element:
      v: encounter
    variable:
      v: newEncounter
    transform:
      v: create
    parameter:
      value: String
        v: Reference
  dependent:
    name:
      v: setEncounterReference
    variable:
      v: encounterId
    variable:
      v: newEncounter
rule:
  name:
    v: setStatus
  source:
    context:
      v: srcBiology
  target:
    context:
      v: tgtObservation
    context type:
      v: variable
    element:
      v: status
    transform:
      v: copy
    parameter:
      value: String
        v: final
rule:
  name:
    v: setCategory
  source:
    context:
      v: srcBiology
  target:
    context:
      v: tgtObservation
    context type:
      v: variable
    element:
      v: category
    transform:
      v: cc
    parameter:
      value: String
        v: http://terminology.hl7.org/CodeSystem/observation-category
    parameter:
      value: String
        v: vital-signs
rule:
  name:
    v: setDate
  source:
    context:
      v: srcBiology
    element:
      v: biologyDatePrel
    variable:
      v: biologyDatePrel
  target:
    context:
      v: tgtObservation
    context type:
      v: variable
    element:
      v: effective
    transform:
      v: copy
    parameter:
      value: Id
        v: biologyDatePrel
rule:
  name:
    v: setCode
  source:
    context:
      v: srcBiology

v: biologyCode

v: biologyCode

context:
  v: tgtObservation
context type:
  v: variable
element:
  v: code
transform:
  v: cc
parameter:
  value: String
    v: http://loinc.org
parameter:
  value: Id
    v: biologyCode

name:
  v: setQuantity
source:
  context:
    v: srcBiology
  element:
    v: biologyValue
target:
  context:
    v: tgtObservation
  context type:
    v: variable
  element:
    v: value
  variable:
    v: tgtObsQuantity
  transform:
    v: create
  parameter:
    value: String
      v: Quantity
rule:
  name:
    v: setValue
  source:
    context:
      v: srcBiology
    element:
      v: biologyValue
    variable:
      v: biologyValue
  target:
    context:
      v: tgtObsQuantity
    context type:
      v: variable
    element:
      v: value
    transform:
      v: copy
    parameter:
      value: Id
        v: biologyValue
rule:
  name:
    v: setUnit
  source:
    context:
      v: srcBiology
    element:
      v: biologyUnit
    variable:
      v: biologyUnit
  target:
    context:
      v: tgtObsQuantity
    context type:
      v: variable
    element:
      v: code
    transform:
      v: copy
    parameter:
      value: Id
        v: biologyUnit
  target:
    context:
      v: tgtObsQuantity
    context type:
      v: variable
    element:
      v: unit
    transform:
      v: copy
    parameter:
      value: Id
        v: biologyUnit
  target:
    context:
      v: tgtObsQuantity
    context type:
      v: variable
    element:
      v: system
    transform:
      v: copy
    parameter:
      value: String
        v: http://unitsofmeasure.org

name:
  v: setBiologyMeta
type mode:
  v: none
input:
  name:
    v: srcNi
  mode:
    v: source
input:
  name:
    v: tgtMeta
  type:
    v: FHIRMeta
  mode:
    v: target
rule:
  name:
    v: setSource
  source:
    context:
      v: srcNi
  target:
    context:
      v: tgtMeta
    context type:
      v: variable
    element:
      v: source
    transform:
      v: evaluate
    parameter:
      value: String
        v: 'https://aphp.fr/fhir/Endpoint/dpi/BiologyTable' + '/' + %srcNi.toString()

name:
  v: setEntryRequestAndFullUrl
type mode:
  v: none
input:
  name:
    v: newRes
  mode:
    v: source
input:
  name:
    v: tgtEntry
  mode:
    v: target
rule:
  name:
    v: setResourceType
  source:
    context:
      v: newRes
    element:
      v: id
    variable:
      v: newResId
  rule:
    name:
      v: setFullUrl
    source:
      context:
        v: newResId
    target:
      context:
        v: tgtEntry
      context type:
        v: variable
      element:
        v: fullUrl
      transform:
        v: evaluate
      parameter:
        value: String
  rule:
    name:
      v: setRequest
    source:
      context:
        v: newResId
    target:
      context:
        v: tgtEntry
      context type:
        v: variable
      element:
        v: request
      variable:
        v: tgtEntryRequest
    target:
      context:
        v: tgtEntryRequest
      context type:
        v: variable
      element:
        v: method
      transform:
        v: copy
      parameter:
        value: String
    target:
      context:
        v: tgtEntryRequest
      context type:
        v: variable
      element:
        v: url
      transform:
        v: evaluate
      parameter:
        value: String

String
v: 'https://aphp.fr/' + %newRes.type().name + '/' + %newResId

String
v: POST

String
v: %newRes.type().name + '/' + %newResId