EHR2FSL
type: StructureMap
node role: treeRoot
id:
  v: EHR2FSL
text:
  status:
    v: generated
  div:
    v: Narratif généré : StructureMap EHR2FSL #xD; map "https://interop.aphp.fr/ig/fhir/dm/StructureMap/EHR2FSL" = "EHR2FSL"#xD; #xD; // Transforms EHR logical model data to FHIR Semantic Layer resources using Bundle as container#xD; #xD; uses "https://interop.aphp.fr/ig/fhir/dm/StructureDefinition/ehr" alias EHR as source#xD; uses "http://hl7.org/fhir/StructureDefinition/Bundle" alias Bundle as target#xD; #xD; group EHR2FSL(source src : EHR, target bundle : Bundle) {#xD; // Initialize Bundle#xD; src -> bundle.id = uuid() "bundleid";#xD; src -> bundle.type = 'collection' "bundletype";#xD; src -> (now()) as timestamp then {#xD; src -> bundle.timestamp = timestamp "affectTimestamp";#xD; } "setTimestamp";#xD; // Transform Patient#xD; src.patient as patient -> bundle.entry as patientEntry then {#xD; patient -> patientEntry.resource = create('Patient') as dmPatient then {#xD; patient then TransformPatient(patient, dmPatient) "transformpatient";#xD; patient then setEntryRequestAndFullUrl(dmPatient, patientEntry) "setRequestAndFullUrl";#xD; src.patientAdresse as patientAdresse where patientAdresse.patientId = %patient.patientId then setAddress(patientAdresse, dmPatient) "transformpatientAdresse";#xD; // Transform PMSI Encounters#xD; src.donneesPmsi as pmsi where pmsi.patientId = %patient.patientId -> bundle.entry as encounterEntry then {#xD; pmsi -> encounterEntry.resource = create('Encounter') as dmEncounter then {#xD; pmsi then TransformEncounter(pmsi, dmEncounter, dmPatient) "transformencounter";#xD; pmsi then setEntryRequestAndFullUrl(dmEncounter, encounterEntry) "setRequestAndFullUrl";#xD; // Transform Conditions (Diagnostics)#xD; src.diagnostics as diag where (diag.patientId = %patient.patientId) and (diag.pmsiId = %pmsi.pmsiId) -> bundle.entry as conditionEntry then {#xD; diag -> conditionEntry.resource = create('Condition') as dmCondition then {#xD; diag then TransformCondition(diag, dmCondition, dmPatient, dmEncounter) "transformcondition";#xD; diag then setEntryRequestA…
url:
  v: https://interop.aphp.fr/ig/fhir/dm/StructureMap/EHR2FSL
  l: EHR2FSL
version:
  v: 0.1.0
name:
  v: EHR2FSL
title:
  v: Transforms EHR logical model data to FHIR Semantic Layer resources using Bundle as container
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: Transforms EHR logical model data to FHIR Semantic Layer resources using Bundle as container
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/ehr
    l: ehr
  mode:
    v: source
  alias:
    v: EHR
structure:
  url:
    v: http://hl7.org/fhir/StructureDefinition/Bundle
    l: Bundle
  mode:
    v: target
  alias:
    v: Bundle
group:
  name:
    v: EHR2FSL
  type mode:
    v: none
  input:
    name:
      v: src
    type:
      v: EHR
    mode:
      v: source
  input:
    name:
      v: bundle
    type:
      v: Bundle
    mode:
      v: target
  rule:
    name:
      v: bundleid
    source:
      context:
        v: src
    target:
      context:
        v: bundle
      context type:
        v: variable
      element:
        v: id
      transform:
        v: uuid
  rule:
    name:
      v: bundletype
    source:
      context:
        v: src
    target:
      context:
        v: bundle
      context type:
        v: variable
      element:
        v: type
      transform:
        v: copy
      parameter:
        value: String
  rule:
    name:
      v: setTimestamp
    source:
      context:
        v: src
    target:
      context type:
        v: variable
      variable:
        v: timestamp
      transform:
        v: evaluate
      parameter:
        value: String
    rule:
      name:
        v: affectTimestamp
  rule:
    name:
      v: patiententry
    source:
      context:
        v: src
      element:
        v: patient
      variable:
        v: patient
    target:
      context:
        v: bundle
      context type:
        v: variable
      element:
        v: entry
      variable:
        v: patientEntry
    rule:
      name:
        v: createpatient
group:
  name:
    v: TransformPatient
  type mode:
    v: none
  documentation:
    v: --------------------------------------------------------- PATIENT TRANSFORMATION ---------------------------------------------------------
  input:
    name:
      v: src
    mode:
      v: source
  input:
    name:
      v: tgt
    type:
      v: Patient
    mode:
      v: target
  rule:
    name:
      v: setId
    source:
      context:
        v: src
    target:
      context:
        v: tgt
      context type:
        v: variable
      element:
        v: id
      transform:
        v: uuid
  rule:
    name:
      v: patientidentifier
    source:
      context:
        v: src
      element:
        v: patientId
      variable:
        v: pid
    target:
      context:
        v: tgt
      context type:
        v: variable
      element:
        v: identifier
      variable:
        v: identifier
    rule:
      name:
        v: iduse

String
v: collection

String
v: now()

v: src

v: bundle

v: variable

v: timestamp

v: copy

value: Id
  v: timestamp

v: patient

v: patientEntry

v: variable

v: resource

v: dmPatient

v: create

value: String
  v: Patient

v: transformpatient

context:
  v: patient

name:
  v: TransformPatient
variable:
  v: patient
variable:
  v: dmPatient

v: setRequestAndFullUrl

context:
  v: patient

name:
  v: setEntryRequestAndFullUrl
variable:
  v: dmPatient
variable:
  v: patientEntry

v: transformpatientAdresse

context:
  v: src
element:
  v: patientAdresse
variable:
  v: patientAdresse
condition:
  v: patientAdresse.patientId = %patient.patientId

name:
  v: setAddress
variable:
  v: patientAdresse
variable:
  v: dmPatient

v: encounterentries

context:
  v: src
element:
  v: donneesPmsi
variable:
  v: pmsi
condition:
  v: pmsi.patientId = %patient.patientId

context:
  v: bundle
context type:
  v: variable
element:
  v: entry
variable:
  v: encounterEntry

name:
  v: createencounter
source:
  context:
    v: pmsi
target:
  context:
    v: encounterEntry
  context type:
    v: variable
  element:
    v: resource
  variable:
    v: dmEncounter
  transform:
    v: create
  parameter:
    value: String
      v: Encounter
rule:
  name:
    v: transformencounter
  source:
    context:
      v: pmsi
  dependent:
    name:
      v: TransformEncounter
    variable:
      v: pmsi
    variable:
      v: dmEncounter
    variable:
      v: dmPatient
rule:
  name:
    v: setRequestAndFullUrl
  source:
    context:
      v: pmsi
  dependent:
    name:
      v: setEntryRequestAndFullUrl
    variable:
      v: dmEncounter
    variable:
      v: encounterEntry
rule:
  name:
    v: conditionentries
  source:
    context:
      v: src
    element:
      v: diagnostics
    variable:
      v: diag
    condition:
      v: (diag.patientId = %patient.patientId) and (diag.pmsiId = %pmsi.pmsiId)
  target:
    context:
      v: bundle
    context type:
      v: variable
    element:
      v: entry
    variable:
      v: conditionEntry
  rule:
    name:
      v: createcondition
    source:
      context:
        v: diag
    target:
      context:
        v: conditionEntry
      context type:
        v: variable
      element:
        v: resource
      variable:
        v: dmCondition
      transform:
        v: create
      parameter:
        value: String
    rule:
      name:
        v: transformcondition
    rule:
      name:
        v: setRequestAndFullUrl
rule:
  name:
    v: procedureentries
  source:
    context:
      v: src
    element:
      v: actes
    variable:
      v: acte
    condition:
      v: (acte.patientId = %patient.patientId) and (acte.pmsiId = %pmsi.pmsiId)
  target:
    context:
      v: bundle
    context type:
      v: variable
    element:
      v: entry
    variable:
      v: procedureEntry
  rule:
    name:
      v: createprocedure
    source:
      context:
        v: acte
    target:
      context:
        v: procedureEntry
      context type:
        v: variable
      element:
        v: resource
      variable:
        v: dmProcedure
      transform:
        v: create
      parameter:
        value: String
    rule:
      name:
        v: transformprocedure
    rule:
      name:
        v: setRequestAndFullUrl

String
v: Condition

v: diag

v: TransformCondition

v: diag

v: dmCondition

v: dmPatient

v: dmEncounter

v: diag

v: setEntryRequestAndFullUrl

v: dmCondition

v: conditionEntry

String
v: Procedure

v: acte

v: TransformProcedure

v: acte

v: dmProcedure

v: dmPatient

v: dmEncounter

v: acte

v: setEntryRequestAndFullUrl

v: dmProcedure

v: procedureEntry

v: labentries

context:
  v: src
element:
  v: biologie
variable:
  v: lab
condition:
  v: lab.patientId = %patient.patientId

context:
  v: bundle
context type:
  v: variable
element:
  v: entry
variable:
  v: labEntry

name:
  v: createlabobs
source:
  context:
    v: lab
target:
  context:
    v: labEntry
  context type:
    v: variable
  element:
    v: resource
  variable:
    v: dmLab
  transform:
    v: create
  parameter:
    value: String
      v: Observation
rule:
  name:
    v: transformLabObs
  source:
    context:
      v: lab
  dependent:
    name:
      v: TransformLabObservation
    variable:
      v: lab
    variable:
      v: dmLab
    variable:
      v: dmPatient
rule:
  name:
    v: setRequestAndFullUrl
  source:
    context:
      v: lab
  dependent:
    name:
      v: setEntryRequestAndFullUrl
    variable:
      v: dmLab
    variable:
      v: labEntry

v: medicationentries

context:
  v: src
element:
  v: prescription
variable:
  v: pres
condition:
  v: pres.patientId = %patient.patientId

context:
  v: bundle
context type:
  v: variable
element:
  v: entry
variable:
  v: medReqEntry

name:
  v: createmedreq
source:
  context:
    v: pres
target:
  context:
    v: medReqEntry
  context type:
    v: variable
  element:
    v: resource
  variable:
    v: dmMedReq
  transform:
    v: create
  parameter:
    value: String
      v: MedicationRequest
rule:
  name:
    v: createmedrequest
  source:
    context:
      v: src
  dependent:
    name:
      v: TransformMedicationRequest
    variable:
      v: pres
    variable:
      v: dmMedReq
    variable:
      v: dmPatient
rule:
  name:
    v: setRequestAndFullUrl
  source:
    context:
      v: pres
  dependent:
    name:
      v: setEntryRequestAndFullUrl
    variable:
      v: dmMedReq
    variable:
      v: medReqEntry
rule:
  name:
    v: transformPoso
  source:
    context:
      v: src
    element:
      v: posologie
    variable:
      v: poso
    condition:
      v: %poso.prescriptionId = %pres.prescriptionId
  dependent:
    name:
      v: setPoso
    variable:
      v: poso
    variable:
      v: pres
    variable:
      v: dmMedReq
rule:
  name:
    v: administrationentries
  source:
    context:
      v: src
    element:
      v: administration
    variable:
      v: admin
    condition:
      v: (admin.patientId = %patient.patientId) and (admin.prescriptionId = pres.prescriptionId)
  target:
    context:
      v: bundle
    context type:
      v: variable
    element:
      v: entry
    variable:
      v: adminEntry
  rule:
    name:
      v: createmedadmin
    source:
      context:
        v: admin
    target:
      context:
        v: adminEntry
      context type:
        v: variable
      element:
        v: resource
      variable:
        v: dmAdmin
      transform:
        v: create
      parameter:
        value: String
    rule:
      name:
        v: createmedadmin
    rule:
      name:
        v: setRequestAndFullUrl

String
v: MedicationAdministration

v: admin

v: TransformMedicationAdministrationWOrder

v: admin

v: dmAdmin

v: dmPatient

v: dmMedReq

v: admin

v: setEntryRequestAndFullUrl

v: dmAdmin

v: adminEntry

v: lifestyleentries

context:
  v: src
element:
  v: styleVie
variable:
  v: lifestyle
condition:
  v: lifestyle.patientId = %patient.patientId

name:
  v: tobaccoentries
source:
  context:
    v: lifestyle
  element:
    v: consommationTabac
  variable:
    v: tobacco
  condition:
    v: tobacco.exists()
target:
  context:
    v: bundle
  context type:
    v: variable
  element:
    v: entry
  variable:
    v: tobaccoEntry
rule:
  name:
    v: createtobaccoobs
  source:
    context:
      v: tobacco
  target:
    context:
      v: tobaccoEntry
    context type:
      v: variable
    element:
      v: resource
    variable:
      v: tobaccoObs
    transform:
      v: create
    parameter:
      value: String
        v: Observation
  rule:
    name:
      v: createtobaccoobs
    source:
      context:
        v: lifestyle
    dependent:
      name:
        v: TransformTobaccoObservation
      variable:
        v: lifestyle
      variable:
        v: tobaccoObs
      variable:
        v: dmPatient
  rule:
    name:
      v: setRequestAndFullUrl
    source:
      context:
        v: lifestyle
    dependent:
      name:
        v: setEntryRequestAndFullUrl
      variable:
        v: tobaccoObs
      variable:
        v: tobaccoEntry

name:
  v: alcoholentries
source:
  context:
    v: lifestyle
  element:
    v: consommationAlcool
  variable:
    v: alcohol
  condition:
    v: alcohol.exists()
target:
  context:
    v: bundle
  context type:
    v: variable
  element:
    v: entry
  variable:
    v: alcoholEntry
rule:
  name:
    v: createalcoholobs
  source:
    context:
      v: alcohol
  target:
    context:
      v: alcoholEntry
    context type:
      v: variable
    element:
      v: resource
    variable:
      v: alcoholObs
    transform:
      v: create
    parameter:
      value: String
        v: Observation
  rule:
    name:
      v: createalcoholobs
    source:
      context:
        v: lifestyle
    dependent:
      name:
        v: TransformAlcoholObservation
      variable:
        v: lifestyle
      variable:
        v: alcoholObs
      variable:
        v: dmPatient
  rule:
    name:
      v: setRequestAndFullUrl
    source:
      context:
        v: lifestyle
    dependent:
      name:
        v: setEntryRequestAndFullUrl
      variable:
        v: alcoholObs
      variable:
        v: alcoholEntry

name:
  v: drugentries
source:
  context:
    v: lifestyle
  element:
    v: consommationAutresDrogues
  variable:
    v: drugs
  condition:
    v: drugs.exists()
target:
  context:
    v: bundle
  context type:
    v: variable
  element:
    v: entry
  variable:
    v: drugEntry
rule:
  name:
    v: createdrugobs
  source:
    context:
      v: drugs
  target:
    context:
      v: drugEntry
    context type:
      v: variable
    element:
      v: resource
    variable:
      v: drugObs
    transform:
      v: create
    parameter:
      value: String
        v: Observation
  rule:
    name:
      v: createdrugobs
    source:
      context:
        v: lifestyle
    dependent:
      name:
        v: TransformDrugObservation
      variable:
        v: lifestyle
      variable:
        v: drugObs
      variable:
        v: dmPatient
  rule:
    name:
      v: setRequestAndFullUrl
    source:
      context:
        v: lifestyle
    dependent:
      name:
        v: setEntryRequestAndFullUrl
      variable:
        v: drugObs
      variable:
        v: drugEntry

name:
  v: physicalentries
source:
  context:
    v: lifestyle
  element:
    v: activitePhysique
  variable:
    v: physical
  condition:
    v: physical.exists()
target:
  context:
    v: bundle
  context type:
    v: variable
  element:
    v: entry
  variable:
    v: physicalEntry
rule:
  name:
    v: createphysicalobs
  source:
    context:
      v: physical
  target:
    context:
      v: physicalEntry
    context type:
      v: variable
    element:
      v: resource
    variable:
      v: physicalObs
    transform:
      v: create
    parameter:
      value: String
        v: Observation
  rule:
    name:
      v: createphysicalobs
    source:
      context:
        v: lifestyle
    dependent:
      name:
        v: TransformPhysicalActivityObservation
      variable:
        v: lifestyle
      variable:
        v: physicalObs
      variable:
        v: dmPatient
  rule:
    name:
      v: setRequestAndFullUrl
    source:
      context:
        v: lifestyle
    dependent:
      name:
        v: setEntryRequestAndFullUrl
      variable:
        v: physicalObs
      variable:
        v: physicalEntry

v: vitalentries

context:
  v: src
element:
  v: dossierSoins
variable:
  v: soin
condition:
  v: soin.patientId = %patient.patientId

context:
  v: bundle
context type:
  v: variable
element:
  v: entry
variable:
  v: vitalEntry

name:
  v: createmesureobs
source:
  context:
    v: soin
target:
  context:
    v: vitalEntry
  context type:
    v: variable
  element:
    v: resource
  variable:
    v: dmObs
  transform:
    v: create
  parameter:
    value: String
      v: Observation
rule:
  name:
    v: createmesureobs
  source:
    context:
      v: soin
  dependent:
    name:
      v: TransformVitalSigns
    variable:
      v: soin
    variable:
      v: dmObs
    variable:
      v: dmPatient
rule:
  name:
    v: setRequestAndFullUrl
  source:
    context:
      v: soin
  dependent:
    name:
      v: setEntryRequestAndFullUrl
    variable:
      v: dmObs
    variable:
      v: vitalEntry

v: administrationentries

context:
  v: src
element:
  v: administration
variable:
  v: admin
condition:
  v: (admin.patientId = %patient.patientId) and admin.prescriptionId.empty()

context:
  v: bundle
context type:
  v: variable
element:
  v: entry
variable:
  v: adminEntry

name:
  v: createmedadmin
source:
  context:
    v: admin
target:
  context:
    v: adminEntry
  context type:
    v: variable
  element:
    v: resource
  variable:
    v: dmAdmin
  transform:
    v: create
  parameter:
    value: String
      v: MedicationAdministration
rule:
  name:
    v: createmedadmin
  source:
    context:
      v: admin
  dependent:
    name:
      v: TransformMedicationAdministrationWOOrder
    variable:
      v: admin
    variable:
      v: dmAdmin
    variable:
      v: dmPatient
rule:
  name:
    v: setRequestAndFullUrl
  source:
    context:
      v: admin
  dependent:
    name:
      v: setEntryRequestAndFullUrl
    variable:
      v: dmAdmin
    variable:
      v: adminEntry

context:
  v: pid

context:
  v: identifier
context type:
  v: variable
element:
  v: use
transform:
  v: copy
parameter:
  value: String
    v: usual

name:
  v: idtype
source:
  context:
    v: pid
target:
  context:
    v: identifier
  context type:
    v: variable
  element:
    v: type
  transform:
    v: cc
  parameter:
    value: String
      v: http://terminology.hl7.org/CodeSystem/v2-0203
  parameter:
    value: String
      v: PI
  parameter:
    value: String
      v: Patient Identifier

name:
  v: idsystem
source:
  context:
    v: pid
target:
  context:
    v: identifier
  context type:
    v: variable
  element:
    v: system
  transform:
    v: copy
  parameter:
    value: String
      v: https://hospital.eu/ehr/patient-id

name:
  v: idvalue
source:
  context:
    v: pid
target:
  context:
    v: identifier
  context type:
    v: variable
  element:
    v: value
  transform:
    v: copy
  parameter:
    value: Id
      v: pid

name:
  v: insidentifier
source:
  context:
    v: src
  element:
    v: ins
  variable:
    v: ins
  condition:
    v: ins.exists()
target:
  context:
    v: tgt
  context type:
    v: variable
  element:
    v: identifier
  variable:
    v: insIdentifier
rule:
  name:
    v: insuse
  source:
    context:
      v: ins
  target:
    context:
      v: insIdentifier
    context type:
      v: variable
    element:
      v: use
    transform:
      v: copy
    parameter:
      value: String
        v: official
  documentation:
    v: On part du principe qu'on n'est pas sur un old.
rule:
  name:
    v: instype
  source:
    context:
      v: ins
  target:
    context:
      v: insIdentifier
    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
    parameter:
      value: String
        v: NIR définitif
rule:
  name:
    v: inssystem
  source:
    context:
      v: ins
  target:
    context:
      v: insIdentifier
    context type:
      v: variable
    element:
      v: system
    transform:
      v: copy
    parameter:
      value: String
        v: urn:oid:1.2.250.1.213.1.4.8
rule:
  name:
    v: insvalue
  source:
    context:
      v: ins
  target:
    context:
      v: insIdentifier
    context type:
      v: variable
    element:
      v: value
    transform:
      v: copy
    parameter:
      value: Id
        v: ins

name:
  v: patientname
source:
  context:
    v: src
  condition:
    v: src.nom.exists() or src.prenom.exists()
target:
  context:
    v: tgt
  context type:
    v: variable
  element:
    v: name
  variable:
    v: name
rule:
  name:
    v: familyname
  source:
    context:
      v: src
    element:
      v: nom
    variable:
      v: lastName
  target:
    context:
      v: name
    context type:
      v: variable
    element:
      v: family
    transform:
      v: copy
    parameter:
      value: Id
        v: lastName
rule:
  name:
    v: givenname
  source:
    context:
      v: src
    element:
      v: prenom
    variable:
      v: firstName
  target:
    context:
      v: name
    context type:
      v: variable
    element:
      v: given
    transform:
      v: copy
    parameter:
      value: Id
        v: firstName
rule:
  name:
    v: nameuse
  source:
    context:
      v: src
  target:
    context:
      v: name
    context type:
      v: variable
    element:
      v: use
    transform:
      v: copy
    parameter:
      value: String
        v: official
  documentation:
    v: hypothèse un peu forte.

name:
  v: birthdate
source:
  context:
    v: src
  element:
    v: dateNaissance
  variable:
    v: birthDate
target:
  context:
    v: tgt
  context type:
    v: variable
  element:
    v: birthDate
  transform:
    v: copy
  parameter:
    value: Id
      v: birthDate

name:
  v: gendermale
source:
  context:
    v: src
  element:
    v: sexe
  variable:
    v: gender
  condition:
    v: gender = 'h'
target:
  context:
    v: tgt
  context type:
    v: variable
  element:
    v: gender
  transform:
    v: copy
  parameter:
    value: String
      v: male

name:
  v: genderfemale
source:
  context:
    v: src
  element:
    v: sexe
  variable:
    v: gender
  condition:
    v: gender = 'f'
target:
  context:
    v: tgt
  context type:
    v: variable
  element:
    v: gender
  transform:
    v: copy
  parameter:
    value: String
      v: female

name:
  v: genderunknown
source:
  context:
    v: src
  element:
    v: sexe
  variable:
    v: gender
  condition:
    v: gender.exists() and (gender != 'h') and (gender != 'f')
target:
  context:
    v: tgt
  context type:
    v: variable
  element:
    v: gender
  transform:
    v: copy
  parameter:
    value: String
      v: unknown
documentation:
  v: n'a pas grand sens en l'état des contraintes SQL

name:
  v: deathDate
source:
  context:
    v: src
  element:
    v: dateDeces
  variable:
    v: deathDate
  condition:
    v: deathDate.exists()
target:
  context:
    v: tgt
  context type:
    v: variable
  element:
    v: deceased
  variable:
    v: deceasedDate
  transform:
    v: cast
  parameter:
    value: Id
      v: deathDate
  parameter:
    value: String
      v: dateTime
rule:
  name:
    v: deathSource
  source:
    context:
      v: src
    element:
      v: sourceDeces
    variable:
      v: deathSource
    condition:
      v: deathSource.exists()
  target:
    context:
      v: deceasedDate
    context type:
      v: variable
    element:
      v: extension
    variable:
      v: DeathSourceExtension
  rule:
    name:
      v: deathSourceUrl
    source:
      context:
        v: deathSource
    target:
      context:
        v: DeathSourceExtension
      context type:
        v: variable
      element:
        v: url
      transform:
        v: copy
      parameter:
        value: String
  rule:
    name:
      v: deathSourceValue
    source:
      context:
        v: deathSource
    target:
      context:
        v: DeathSourceExtension
      context type:
        v: variable
      element:
        v: value
      transform:
        v: cast
      parameter:
        value: Id
      parameter:
        value: String

Id
v: deathSource

String
v: code

name:
  v: multiplebirth
source:
  context:
    v: src
  element:
    v: rangGemellaire
  variable:
    v: twin
  condition:
    v: twin.exists()
target:
  context:
    v: tgt
  context type:
    v: variable
  element:
    v: multipleBirth
  transform:
    v: copy
  parameter:
    value: Id
      v: twin

name:
  v: setAddress
type mode:
  v: none
documentation:
  v: ======================================================================== PATIENT_LOCATION TRANSFORMATION ========================================================================
input:
  name:
    v: src
  mode:
    v: source
input:
  name:
    v: tgtPat
  type:
    v: Patient
  mode:
    v: target
rule:
  name:
    v: checkSource
  source:
    context:
      v: src
    condition:
      v: src.latitude.exists() or src.longitude.exists() or src.codeIris.exists() or src.libelleIris.exists() or src.codeGeographiqueResidence.exists()
  rule:
    name:
      v: createAddress
    source:
      context:
        v: src
    target:
      context:
        v: tgtPat
      context type:
        v: variable
      element:
        v: address
      variable:
        v: newAddress
    rule:
      name:
        v: setCoordinates
    rule:
      name:
        v: setIris
    rule:
      name:
        v: SetResidencePmsi
    rule:
      name:
        v: setDateRecueil

v: src

v: src.latitude.exists() or src.longitude.exists()

v: newAddress

v: variable

v: extension

v: geolocationExtension

v: geolocationExtension

v: variable

v: url

v: copy

v: setLat

context:
  v: src
element:
  v: latitude
variable:
  v: srcLat

context:
  v: geolocationExtension
context type:
  v: variable
element:
  v: extension
variable:
  v: tgtLat

context:
  v: tgtLat
context type:
  v: variable
element:
  v: url
transform:
  v: copy
parameter:
  value: String
    v: latitude

context:
  v: tgtLat
context type:
  v: variable
element:
  v: value
transform:
  v: copy
parameter:
  value: Id
    v: srcLat

v: setLong

context:
  v: src
element:
  v: longitude
variable:
  v: srcLong

context:
  v: geolocationExtension
context type:
  v: variable
element:
  v: extension
variable:
  v: tgtLong

context:
  v: tgtLong
context type:
  v: variable
element:
  v: url
transform:
  v: copy
parameter:
  value: String
    v: longitude

context:
  v: tgtLong
context type:
  v: variable
element:
  v: value
transform:
  v: copy
parameter:
  value: Id
    v: srcLong

v: src

v: src.codeIris.exists() or src.libelleIris.exists()

v: newAddress

v: variable

v: line

v: irisLine

v: evaluate

value: String
  v: %src.libelleIris

v: irisLine

v: variable

v: extension

v: irisExtension

v: create

value: String
  v: Extension

v: irisExtension

v: variable

v: url

v: copy

v: irisExtension

v: variable

v: value

v: evaluate

value: String
  v: %src.codeIris

v: src

v: codeGeographiqueResidence

v: srcCodeGeographiqueResidence

v: src.codeGeographiqueResidence.exists()

v: newAddress

v: variable

v: extension

v: residencePmsiExtension

v: residencePmsiExtension

v: variable

v: url

v: copy

v: residencePmsiExtension

v: variable

v: value

v: cast

value: Id
  v: srcCodeGeographiqueResidence

value: String
  v: code

v: src

v: dateRecueil

v: dateRecueil

v: newAddress

v: variable

v: period

v: newAddressPeriod

v: newAddressPeriod

v: variable

v: start

v: copy

value: Id
  v: dateRecueil

name:
  v: TransformEncounter
type mode:
  v: none
documentation:
  v: ======================================================================== ENCOUNTER TRANSFORMATION ========================================================================
input:
  name:
    v: src
  mode:
    v: source
input:
  name:
    v: tgtEnc
  type:
    v: Encounter
  mode:
    v: target
input:
  name:
    v: patient
  mode:
    v: source
rule:
  name:
    v: setId
  source:
    context:
      v: src
  target:
    context:
      v: tgtEnc
    context type:
      v: variable
    element:
      v: id
    transform:
      v: uuid
rule:
  name:
    v: encounteridentifier
  source:
    context:
      v: src
  target:
    context:
      v: tgtEnc
    context type:
      v: variable
    element:
      v: identifier
    variable:
      v: identifier
  rule:
    name:
      v: idtype
    source:
      context:
        v: src
    target:
      context:
        v: identifier
      context type:
        v: variable
      element:
        v: type
      transform:
        v: cc
      parameter:
        value: String
      parameter:
        value: String
      parameter:
        value: String
  rule:
    name:
      v: encounteridsystem
    source:
      context:
        v: src
    target:
      context:
        v: identifier
      context type:
        v: variable
      element:
        v: system
      transform:
        v: copy
      parameter:
        value: String
  rule:
    name:
      v: encounteridvalue
    source:
      context:
        v: src
      element:
        v: pmsiId
      variable:
        v: srcEncoutnerId
    target:
      context:
        v: identifier
      context type:
        v: variable
      element:
        v: value
      transform:
        v: copy
      parameter:
        value: Id
rule:
  name:
    v: encounterstatus
  source:
    context:
      v: src
  target:
    context:
      v: tgtEnc
    context type:
      v: variable
    element:
      v: status
    transform:
      v: copy
    parameter:
      value: String
        v: finished
rule:
  name:
    v: encounterclass
  source:
    context:
      v: src
  target:
    context:
      v: tgtEnc
    context type:
      v: variable
    element:
      v: class
    transform:
      v: c
    parameter:
      value: String
        v: http://terminology.hl7.org/CodeSystem/v3-ActCode
    parameter:
      value: String
        v: IMP
    parameter:
      value: String
        v: inpatient encounter
rule:
  name:
    v: encountersubject
  source:
    context:
      v: src
  target:
    context:
      v: tgtEnc
    context type:
      v: variable
    element:
      v: subject
    variable:
      v: ref
    transform:
      v: create
    parameter:
      value: String
        v: Reference
  rule:
    name:
      v: subjectreference
    source:
      context:
        v: patient
      element:
        v: id
      variable:
        v: patientId
    target:
      context:
        v: ref
      context type:
        v: variable
      element:
        v: reference
      transform:
        v: evaluate
      parameter:
        value: String
    target:
      context:
        v: ref
      context type:
        v: variable
      element:
        v: type
      transform:
        v: copy

String
v: VN

String
v: Visit Number

Id
v: srcEncoutnerId

String
v: 'Patient/' + %patientId

value: String
  v: Patient

name:
  v: encounterperiod
source:
  context:
    v: src
  condition:
    v: src.dateDebutSejour.exists() or src.dateFinSejour.exists()
target:
  context:
    v: tgtEnc
  context type:
    v: variable
  element:
    v: period
  variable:
    v: period
rule:
  name:
    v: periodstart
  source:
    context:
      v: src
    element:
      v: dateDebutSejour
    variable:
      v: startDate
  target:
    context:
      v: period
    context type:
      v: variable
    element:
      v: start
    transform:
      v: copy
    parameter:
      value: Id
        v: startDate
rule:
  name:
    v: periodend
  source:
    context:
      v: src
    element:
      v: dateFinSejour
    variable:
      v: endDate
  target:
    context:
      v: period
    context type:
      v: variable
    element:
      v: end
    transform:
      v: copy
    parameter:
      value: Id
        v: endDate

name:
  v: encounterhospitalization
source:
  context:
    v: src
  condition:
    v: src.modeEntree.exists() or src.modeSortie.exists()
target:
  context:
    v: tgtEnc
  context type:
    v: variable
  element:
    v: hospitalization
  variable:
    v: hosp
rule:
  name:
    v: admitsource
  source:
    context:
      v: src
    element:
      v: modeEntree
    variable:
      v: admitSource
  target:
    context:
      v: hosp
    context type:
      v: variable
    element:
      v: admitSource
    variable:
      v: admitSrc
  rule:
    name:
      v: admitsourcetext
    source:
      context:
        v: admitSource
    target:
      context:
        v: admitSrc
      context type:
        v: variable
      element:
        v: text
      transform:
        v: copy
      parameter:
        value: Id
rule:
  name:
    v: dischargedisposition
  source:
    context:
      v: src
    element:
      v: modeSortie
    variable:
      v: dischargeDisp
  target:
    context:
      v: hosp
    context type:
      v: variable
    element:
      v: dischargeDisposition
    variable:
      v: dischargeDsp
  rule:
    name:
      v: dischargedisptext
    source:
      context:
        v: dischargeDisp
    target:
      context:
        v: dischargeDsp
      context type:
        v: variable
      element:
        v: text
      transform:
        v: copy
      parameter:
        value: Id

Id
v: admitSource

Id
v: dischargeDisp

name:
  v: provider
source:
  context:
    v: src
  condition:
    v: src.uniteFonctionnelle.exists() or src.service.exists() or src.etablissement.exists()
target:
  context:
    v: tgtEnc
  context type:
    v: variable
  element:
    v: serviceProvider
  variable:
    v: provider
rule:
  name:
    v: providerdisplay
  source:
    context:
      v: src
  target:
    context:
      v: provider
    context type:
      v: variable
    element:
      v: display
    transform:
      v: evaluate
    parameter:
      value: String
        v: iif(%src.uniteFonctionnelle.exists(), %src.uniteFonctionnelle, iif(%src.service.exists(), %src.service, %src.etablissement))

name:
  v: TransformCondition
type mode:
  v: none
documentation:
  v: ======================================================================== CONDITION TRANSFORMATION ========================================================================
input:
  name:
    v: src
  mode:
    v: source
input:
  name:
    v: tgtCond
  type:
    v: Condition
  mode:
    v: target
input:
  name:
    v: patient
  mode:
    v: source
input:
  name:
    v: encounter
  mode:
    v: source
rule:
  name:
    v: setId
  source:
    context:
      v: src
  target:
    context:
      v: tgtCond
    context type:
      v: variable
    element:
      v: id
    transform:
      v: uuid
rule:
  name:
    v: conditionidentifier
  source:
    context:
      v: src
    element:
      v: diagnosticId
    variable:
      v: diagId
  target:
    context:
      v: tgtCond
    context type:
      v: variable
    element:
      v: identifier
    variable:
      v: identifier
  rule:
    name:
      v: conditionidsystem
    source:
      context:
        v: diagId
    target:
      context:
        v: identifier
      context type:
        v: variable
      element:
        v: system
      transform:
        v: copy
      parameter:
        value: String
  rule:
    name:
      v: conditionidvalue
    source:
      context:
        v: diagId
    target:
      context:
        v: identifier
      context type:
        v: variable
      element:
        v: value
      transform:
        v: copy
      parameter:
        value: Id
rule:
  name:
    v: categoryencounterDiag
  source:
    context:
      v: src
  target:
    context:
      v: tgtCond
    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
    parameter:
      value: String
        v: Encounter Diagnosis
rule:
  name:
    v: conditioncategory
  source:
    context:
      v: src
    element:
      v: typeDiagnostic
    variable:
      v: diagType
  target:
    context:
      v: tgtCond
    context type:
      v: variable
    element:
      v: category
    variable:
      v: category
  rule:
    name:
      v: categorytext
    source:
      context:
        v: diagType
    target:
      context:
        v: category
      context type:
        v: variable
      element:
        v: text
      transform:
        v: copy
      parameter:
        value: Id
rule:
  name:
    v: varcode
  source:
    context:
      v: src
    element:
      v: codeDiagnostic
    variable:
      v: srcCode
  target:
    context:
      v: tgtCond
    context type:
      v: variable
    element:
      v: code
    variable:
      v: conditionCode
  rule:
    name:
      v: conditioncode
    source:
      context:
        v: src
      element:
        v: libelleDiagnostic
      variable:
        v: label
    target:
      context:
        v: conditionCode
      context type:
        v: variable
      element:
        v: coding
      variable:
        v: tgtCoding
    target:
      context:
        v: tgtCoding
      context type:
        v: variable
      element:
        v: system
      transform:
        v: copy

Id
v: diagId

Id
v: diagType

context:
  v: tgtCoding
context type:
  v: variable
element:
  v: code
transform:
  v: copy
parameter:
  value: Id
    v: srcCode

name:
  v: codetext
source:
  context:
    v: src
  element:
    v: libelleDiagnostic
  variable:
    v: text
target:
  context:
    v: conditionCode
  context type:
    v: variable
  element:
    v: text
  transform:
    v: copy
  parameter:
    value: Id
      v: text

name:
  v: conditionsubject
source:
  context:
    v: src
target:
  context:
    v: tgtCond
  context type:
    v: variable
  element:
    v: subject
  variable:
    v: ref
  transform:
    v: create
  parameter:
    value: String
      v: Reference
rule:
  name:
    v: subjectref
  source:
    context:
      v: patient
    element:
      v: id
    variable:
      v: patientId
  target:
    context:
      v: ref
    context type:
      v: variable
    element:
      v: reference
    transform:
      v: evaluate
    parameter:
      value: String
        v: 'Patient/' + %patientId
  target:
    context:
      v: ref
    context type:
      v: variable
    element:
      v: type
    transform:
      v: copy
    parameter:
      value: String
        v: Patient

name:
  v: conditionencounter
source:
  context:
    v: src
target:
  context:
    v: tgtCond
  context type:
    v: variable
  element:
    v: encounter
  variable:
    v: ref
  transform:
    v: create
  parameter:
    value: String
      v: Reference
rule:
  name:
    v: encounterref
  source:
    context:
      v: encounter
    element:
      v: id
    variable:
      v: encounterId
  target:
    context:
      v: ref
    context type:
      v: variable
    element:
      v: reference
    transform:
      v: evaluate
    parameter:
      value: String
        v: 'Encounter/' + %encounterId
  target:
    context:
      v: ref
    context type:
      v: variable
    element:
      v: type
    transform:
      v: copy
    parameter:
      value: String
        v: Encounter

name:
  v: conditionrecordeddate
source:
  context:
    v: src
  element:
    v: dateRecueil
  variable:
    v: entryDate
target:
  context:
    v: tgtCond
  context type:
    v: variable
  element:
    v: recordedDate
  transform:
    v: copy
  parameter:
    value: Id
      v: entryDate

name:
  v: conditionclinicalstatus
source:
  context:
    v: src
target:
  context:
    v: tgtCond
  context type:
    v: variable
  element:
    v: clinicalStatus
  transform:
    v: cc
  parameter:
    value: String
      v: http://terminology.hl7.org/CodeSystem/condition-clinical
  parameter:
    value: String
      v: active

name:
  v: conditionverificationstatus
source:
  context:
    v: src
target:
  context:
    v: tgtCond
  context type:
    v: variable
  element:
    v: verificationStatus
  transform:
    v: cc
  parameter:
    value: String
      v: http://terminology.hl7.org/CodeSystem/condition-ver-status
  parameter:
    value: String
      v: confirmed

name:
  v: TransformProcedure
type mode:
  v: none
documentation:
  v: ======================================================================== PROCEDURE TRANSFORMATION ========================================================================
input:
  name:
    v: src
  mode:
    v: source
input:
  name:
    v: tgtProc
  type:
    v: Procedure
  mode:
    v: target
input:
  name:
    v: patient
  mode:
    v: source
input:
  name:
    v: encounter
  mode:
    v: source
rule:
  name:
    v: setId
  source:
    context:
      v: src
  target:
    context:
      v: tgtProc
    context type:
      v: variable
    element:
      v: id
    transform:
      v: uuid
rule:
  name:
    v: procedureidentifier
  source:
    context:
      v: src
    element:
      v: acteId
    variable:
      v: acteId
  target:
    context:
      v: tgtProc
    context type:
      v: variable
    element:
      v: identifier
    variable:
      v: identifier
  rule:
    name:
      v: procedureidsystem
    source:
      context:
        v: acteId
    target:
      context:
        v: identifier
      context type:
        v: variable
      element:
        v: system
      transform:
        v: copy
      parameter:
        value: String
  rule:
    name:
      v: procedureidvalue
    source:
      context:
        v: acteId
    target:
      context:
        v: identifier
      context type:
        v: variable
      element:
        v: value
      transform:
        v: copy
      parameter:
        value: Id
rule:
  name:
    v: procedurestatus
  source:
    context:
      v: src
  target:
    context:
      v: tgtProc
    context type:
      v: variable
    element:
      v: status
    transform:
      v: copy
    parameter:
      value: String
        v: completed
rule:
  name:
    v: procedurecode
  source:
    context:
      v: src
    element:
      v: codeActe
    variable:
      v: code
  target:
    context:
      v: tgtProc
    context type:
      v: variable
    element:
      v: code
    variable:
      v: procedureCode
  rule:
    name:
      v: procedurecoding
    source:
      context:
        v: code
    target:
      context:
        v: procedureCode
      context type:
        v: variable
      element:
        v: coding
      variable:
        v: coding
    target:
      context:
        v: coding
      context type:
        v: variable
      element:
        v: system
      transform:
        v: copy
      parameter:
        value: String
    target:
      context:
        v: coding
      context type:
        v: variable
      element:
        v: code
      transform:
        v: copy
      parameter:
        value: Id
  rule:
    name:
      v: codetext
    source:
      context:
        v: src
      element:
        v: libelleActe
      variable:
        v: text
    target:
      context:
        v: procedureCode
      context type:
        v: variable
      element:
        v: text
      transform:
        v: copy
      parameter:
        value: Id
rule:
  name:
    v: proceduresubject
  source:
    context:
      v: src
  target:
    context:
      v: tgtProc
    context type:
      v: variable

Id
v: acteId

Id
v: code

Id
v: text

v: subject

v: ref

v: create

value: String
  v: Reference

name:
  v: subjectref
source:
  context:
    v: patient
  element:
    v: id
  variable:
    v: patientId
target:
  context:
    v: ref
  context type:
    v: variable
  element:
    v: reference
  transform:
    v: evaluate
  parameter:
    value: String
      v: 'Patient/' + %patientId
target:
  context:
    v: ref
  context type:
    v: variable
  element:
    v: type
  transform:
    v: copy
  parameter:
    value: String
      v: Patient

name:
  v: procedureencounter
source:
  context:
    v: src
target:
  context:
    v: tgtProc
  context type:
    v: variable
  element:
    v: encounter
  variable:
    v: ref
  transform:
    v: create
  parameter:
    value: String
      v: Reference
rule:
  name:
    v: encounterref
  source:
    context:
      v: encounter
    element:
      v: id
    variable:
      v: encounterId
  target:
    context:
      v: ref
    context type:
      v: variable
    element:
      v: reference
    transform:
      v: evaluate
    parameter:
      value: String
        v: 'Encounter/' + %encounterId
  target:
    context:
      v: ref
    context type:
      v: variable
    element:
      v: type
    transform:
      v: copy
    parameter:
      value: String
        v: Encounter

name:
  v: procedureperformed
source:
  context:
    v: src
  element:
    v: dateActe
  variable:
    v: performedDate
  condition:
    v: %performedDate.exists()
target:
  context:
    v: tgtProc
  context type:
    v: variable
  element:
    v: performed
  transform:
    v: copy
  parameter:
    value: Id
      v: performedDate

name:
  v: procedureperformer
source:
  context:
    v: src
  element:
    v: executant
  variable:
    v: performer
target:
  context:
    v: tgtProc
  context type:
    v: variable
  element:
    v: performer
  variable:
    v: perf
rule:
  name:
    v: performeractor
  source:
    context:
      v: performer
  target:
    context:
      v: perf
    context type:
      v: variable
    element:
      v: actor
    variable:
      v: actor
  rule:
    name:
      v: performerdisplay
    source:
      context:
        v: performer
    target:
      context:
        v: actor
      context type:
        v: variable
      element:
        v: display
      transform:
        v: copy
      parameter:
        value: Id
  rule:
    name:
      v: performerType
    source:
      context:
        v: performer
    target:
      context:
        v: actor
      context type:
        v: variable
      element:
        v: type
      transform:
        v: copy
      parameter:
        value: String
rule:
  name:
    v: performerFunction
  source:
    context:
      v: performer
  target:
    context:
      v: perf
    context type:
      v: variable
    element:
      v: function
    variable:
      v: function
  target:
    context:
      v: function
    context type:
      v: variable
    element:
      v: text
    transform:
      v: copy
    parameter:
      value: String
        v: Exécutant

Id
v: performer

String
v: Practitioner

name:
  v: TransformLabObservation
type mode:
  v: none
documentation:
  v: ======================================================================== LABORATORY OBSERVATION TRANSFORMATION ========================================================================
input:
  name:
    v: src
  mode:
    v: source
input:
  name:
    v: tgtObs
  type:
    v: Observation
  mode:
    v: target
input:
  name:
    v: patient
  mode:
    v: source
rule:
  name:
    v: setId
  source:
    context:
      v: src
  target:
    context:
      v: tgtObs
    context type:
      v: variable
    element:
      v: id
    transform:
      v: uuid
rule:
  name:
    v: labidentifier
  source:
    context:
      v: src
    element:
      v: biologieId
    variable:
      v: bioId
  target:
    context:
      v: tgtObs
    context type:
      v: variable
    element:
      v: identifier
    variable:
      v: identifier
  rule:
    name:
      v: labidsystem
    source:
      context:
        v: bioId
    target:
      context:
        v: identifier
      context type:
        v: variable
      element:
        v: system
      transform:
        v: copy
      parameter:
        value: String
  rule:
    name:
      v: labidvalue
    source:
      context:
        v: bioId
    target:
      context:
        v: identifier
      context type:
        v: variable
      element:
        v: value
      transform:
        v: copy
      parameter:
        value: Id
rule:
  name:
    v: statusvalidated
  source:
    context:
      v: src
    element:
      v: statutValidation
    variable:
      v: validation
    condition:
      v: validation = 'VALIDE'
  target:
    context:
      v: tgtObs
    context type:
      v: variable
    element:
      v: status
    transform:
      v: copy
    parameter:
      value: String
        v: final
rule:
  name:
    v: statusdefault
  source:
    context:
      v: src
    condition:
      v: src.statutValidation.exists().not()
  target:
    context:
      v: tgtObs
    context type:
      v: variable
    element:
      v: status
    transform:
      v: copy
    parameter:
      value: String
        v: final
rule:
  name:
    v: labcategory
  source:
    context:
      v: src
  target:
    context:
      v: tgtObs
    context type:
      v: variable
    element:
      v: category
    variable:
      v: category
  rule:
    name:
      v: categorycoding
    source:
      context:
        v: src
    target:
      context:
        v: category
      context type:
        v: variable
      element:
        v: coding
      variable:
        v: coding
    rule:
      name:
        v: categorysystem
    rule:
      name:
        v: categorycode
    rule:
      name:
        v: categorydisplay
rule:
  name:
    v: labcode
  source:
    context:
      v: src
    element:
      v: codeLoinc
    variable:
      v: loinc
  target:
    context:
      v: tgtObs
    context type:
      v: variable
    element:
      v: code
    variable:
      v: code
  rule:
    name:
      v: labcoding
    source:
      context:
        v: loinc
    target:
      context:
        v: code
      context type:
        v: variable

Id
v: bioId

v: src

v: coding

v: variable

v: system

v: copy

v: src

v: coding

v: variable

v: code

v: copy

value: String
  v: laboratory

v: src

v: coding

v: variable

v: display

v: copy

value: String
  v: Laboratory

v: coding

v: coding

name:
  v: codesystem
source:
  context:
    v: loinc
target:
  context:
    v: coding
  context type:
    v: variable
  element:
    v: system
  transform:
    v: copy
  parameter:
    value: String
      v: http://loinc.org

name:
  v: codevalue
source:
  context:
    v: loinc
target:
  context:
    v: coding
  context type:
    v: variable
  element:
    v: code
  transform:
    v: copy
  parameter:
    value: Id
      v: loinc

name:
  v: codetext
source:
  context:
    v: src
  element:
    v: libelleTest
  variable:
    v: text
target:
  context:
    v: code
  context type:
    v: variable
  element:
    v: text
  transform:
    v: copy
  parameter:
    value: Id
      v: text

name:
  v: labsubject
source:
  context:
    v: src
target:
  context:
    v: tgtObs
  context type:
    v: variable
  element:
    v: subject
  variable:
    v: ref
  transform:
    v: create
  parameter:
    value: String
      v: Reference
rule:
  name:
    v: subjectref
  source:
    context:
      v: patient
    element:
      v: id
    variable:
      v: patientId
  target:
    context:
      v: ref
    context type:
      v: variable
    element:
      v: reference
    transform:
      v: evaluate
    parameter:
      value: String
        v: 'Patient/' + %patientId
  target:
    context:
      v: ref
    context type:
      v: variable
    element:
      v: type
    transform:
      v: copy
    parameter:
      value: String
        v: Patient

name:
  v: labeffective
source:
  context:
    v: src
  element:
    v: datePrelevement
  variable:
    v: collectionDate
  condition:
    v: %collectionDate.exists()
target:
  context:
    v: tgtObs
  context type:
    v: variable
  element:
    v: effective
  transform:
    v: cast
  parameter:
    value: Id
      v: collectionDate
  parameter:
    value: String
      v: dateTime

name:
  v: labvaluequantity
source:
  context:
    v: src
  element:
    v: valeur
  variable:
    v: numValue
  condition:
    v: numValue.exists()
target:
  context:
    v: tgtObs
  context type:
    v: variable
  element:
    v: value
  variable:
    v: qty
  transform:
    v: create
  parameter:
    value: String
      v: Quantity
rule:
  name:
    v: quantityvalue
  source:
    context:
      v: numValue
  target:
    context:
      v: qty
    context type:
      v: variable
    element:
      v: value
    transform:
      v: copy
    parameter:
      value: Id
        v: numValue
rule:
  name:
    v: quantityunit
  source:
    context:
      v: src
    element:
      v: unite
    variable:
      v: unit
  target:
    context:
      v: qty
    context type:
      v: variable
    element:
      v: unit
    transform:
      v: copy
    parameter:
      value: Id
        v: unit
rule:
  name:
    v: quantitycode
  source:
    context:
      v: src
    element:
      v: unite
    variable:
      v: unit
  target:
    context:
      v: qty
    context type:
      v: variable
    element:
      v: code
    transform:
      v: copy
    parameter:
      value: Id
        v: unit
rule:
  name:
    v: quantitysystem
  source:
    context:
      v: src
  target:
    context:
      v: qty
    context type:
      v: variable
    element:
      v: system
    transform:
      v: copy
    parameter:
      value: String
        v: http://unitsofmeasure.org

name:
  v: labreferencerange
source:
  context:
    v: src
  condition:
    v: src.borneInfNormale.exists() or src.borneSupNormale.exists()
target:
  context:
    v: tgtObs
  context type:
    v: variable
  element:
    v: referenceRange
  variable:
    v: range
rule:
  name:
    v: referencelow
  source:
    context:
      v: src
    element:
      v: borneInfNormale
    variable:
      v: low
  target:
    context:
      v: range
    context type:
      v: variable
    element:
      v: low
    variable:
      v: lowQty
  rule:
    name:
      v: reflowvalue
    source:
      context:
        v: low
    target:
      context:
        v: lowQty
      context type:
        v: variable
      element:
        v: value
      transform:
        v: copy
      parameter:
        value: Id
  rule:
    name:
      v: reflowunit
    source:
      context:
        v: src
      element:
        v: unite
      variable:
        v: unit
    target:
      context:
        v: lowQty
      context type:
        v: variable
      element:
        v: unit
      transform:
        v: copy
      parameter:
        value: Id
  rule:
    name:
      v: reflowcode
    source:
      context:
        v: src
      element:
        v: unite
      variable:
        v: unit
    target:
      context:
        v: lowQty
      context type:
        v: variable
      element:
        v: code
      transform:
        v: copy
      parameter:
        value: Id
  rule:
    name:
      v: reflowsystem
    source:
      context:
        v: src
    target:
      context:
        v: lowQty
      context type:
        v: variable
      element:
        v: system
      transform:
        v: copy
      parameter:
        value: String
rule:
  name:
    v: referencehigh
  source:
    context:
      v: src
    element:
      v: borneSupNormale
    variable:
      v: high
  target:
    context:
      v: range
    context type:
      v: variable
    element:
      v: high
    variable:
      v: highQty
  rule:
    name:
      v: refhighvalue
    source:
      context:
        v: high
    target:
      context:
        v: highQty
      context type:
        v: variable
      element:
        v: value
      transform:
        v: copy
      parameter:
        value: Id
  rule:
    name:
      v: refhighunit
    source:
      context:
        v: src
      element:
        v: unite
      variable:
        v: unit
    target:
      context:
        v: highQty
      context type:
        v: variable
      element:
        v: unit
      transform:
        v: copy
      parameter:
        value: Id
  rule:
    name:
      v: refhighcode
    source:
      context:
        v: src
      element:
        v: unite
      variable:
        v: unit
    target:
      context:
        v: highQty
      context type:
        v: variable
      element:
        v: code
      transform:
        v: copy
      parameter:
        value: Id
  rule:
    name:
      v: refhighsystem
    source:
      context:
        v: src
    target:
      context:
        v: highQty
      context type:
        v: variable
      element:
        v: system
      transform:
        v: copy

Id
v: low

Id
v: unit

Id
v: unit

Id
v: high

Id
v: unit

Id
v: unit

name:
  v: labperformer
source:
  context:
    v: src
  element:
    v: laboratoire
  variable:
    v: lab
target:
  context:
    v: tgtObs
  context type:
    v: variable
  element:
    v: performer
  variable:
    v: performer
rule:
  name:
    v: performerdisplay
  source:
    context:
      v: lab
  target:
    context:
      v: performer
    context type:
      v: variable
    element:
      v: display
    transform:
      v: copy
    parameter:
      value: Id
        v: lab
rule:
  name:
    v: performerType
  source:
    context:
      v: lab
  target:
    context:
      v: performer
    context type:
      v: variable
    element:
      v: type
    transform:
      v: copy
    parameter:
      value: String
        v: Organization

name:
  v: TransformMedicationRequest
type mode:
  v: none
documentation:
  v: ======================================================================== MEDICATION REQUEST TRANSFORMATION ========================================================================
input:
  name:
    v: src
  mode:
    v: source
input:
  name:
    v: tgtMedReq
  type:
    v: MedicationRequest
  mode:
    v: target
input:
  name:
    v: patient
  mode:
    v: source
rule:
  name:
    v: setId
  source:
    context:
      v: src
  target:
    context:
      v: tgtMedReq
    context type:
      v: variable
    element:
      v: id
    transform:
      v: uuid
rule:
  name:
    v: medrequestidentifier
  source:
    context:
      v: src
    element:
      v: prescriptionId
    variable:
      v: presId
  target:
    context:
      v: tgtMedReq
    context type:
      v: variable
    element:
      v: identifier
    variable:
      v: identifier
  rule:
    name:
      v: medrequestidsystem
    source:
      context:
        v: presId
    target:
      context:
        v: identifier
      context type:
        v: variable
      element:
        v: system
      transform:
        v: copy
      parameter:
        value: String
  rule:
    name:
      v: medrequestidvalue
    source:
      context:
        v: presId
    target:
      context:
        v: identifier
      context type:
        v: variable
      element:
        v: value
      transform:
        v: copy
      parameter:
        value: Id
rule:
  name:
    v: medrequeststatus
  source:
    context:
      v: src
  target:
    context:
      v: tgtMedReq
    context type:
      v: variable
    element:
      v: status
    transform:
      v: copy
    parameter:
      value: String
        v: unknown
rule:
  name:
    v: medrequestintent
  source:
    context:
      v: src
  target:
    context:
      v: tgtMedReq
    context type:
      v: variable
    element:
      v: intent
    transform:
      v: copy
    parameter:
      value: String
        v: order
rule:
  name:
    v: medrequestsubject
  source:
    context:
      v: src
  target:
    context:
      v: tgtMedReq
    context type:
      v: variable
    element:
      v: subject
    variable:
      v: ref
    transform:
      v: create
    parameter:
      value: String
        v: Reference
  rule:
    name:
      v: subjectref
    source:
      context:
        v: patient
      element:
        v: id
      variable:
        v: patientId
    target:
      context:
        v: ref
      context type:
        v: variable
      element:
        v: reference
      transform:
        v: evaluate
      parameter:
        value: String
    target:
      context:
        v: ref
      context type:
        v: variable
      element:
        v: type
      transform:
        v: copy
      parameter:
        value: String
rule:
  name:
    v: medicationdenomination
  source:
    context:
      v: src
    element:
      v: denomination
    variable:
      v: denomination
  target:
    context:
      v: tgtMedReq
    context type:
      v: variable
    element:
      v: medication
    variable:
      v: medication
    transform:
      v: create
    parameter:
      value: String
        v: CodeableConcept

Id
v: presId

String
v: 'Patient/' + %patientId

String
v: Patient

name:
  v: medicationtext
source:
  context:
    v: denomination
  variable:
    v: text
target:
  context:
    v: medication
  context type:
    v: variable
  element:
    v: text
  transform:
    v: copy
  parameter:
    value: Id
      v: text

name:
  v: atccoding
source:
  context:
    v: src
  element:
    v: codeAtc
  variable:
    v: atc
target:
  context:
    v: medication
  context type:
    v: variable
  element:
    v: coding
  variable:
    v: coding
rule:
  name:
    v: atcsystem
  source:
    context:
      v: atc
  target:
    context:
      v: coding
    context type:
      v: variable
    element:
      v: system
    transform:
      v: copy
    parameter:
      value: String
        v: http://www.whocc.no/atc
rule:
  name:
    v: atccode
  source:
    context:
      v: atc
  target:
    context:
      v: coding
    context type:
      v: variable
    element:
      v: code
    transform:
      v: copy
    parameter:
      value: Id
        v: atc

name:
  v: medauthored
source:
  context:
    v: src
  element:
    v: datePrescription
  variable:
    v: prescDate
target:
  context:
    v: tgtMedReq
  context type:
    v: variable
  element:
    v: authoredOn
  transform:
    v: copy
  parameter:
    value: Id
      v: prescDate

name:
  v: medrequester
source:
  context:
    v: src
  element:
    v: prescripteur
  variable:
    v: prescriber
target:
  context:
    v: tgtMedReq
  context type:
    v: variable
  element:
    v: requester
  variable:
    v: requesterRef
rule:
  name:
    v: requesterdisplay
  source:
    context:
      v: prescriber
  target:
    context:
      v: requesterRef
    context type:
      v: variable
    element:
      v: display
    transform:
      v: copy
    parameter:
      value: Id
        v: prescriber
rule:
  name:
    v: requesterType
  source:
    context:
      v: prescriber
  target:
    context:
      v: requesterRef
    context type:
      v: variable
    element:
      v: type
    transform:
      v: copy
    parameter:
      value: String
        v: Practitioner

name:
  v: setPoso
type mode:
  v: none
documentation:
  v: ======================================================================== POSOLOGIE TRANSFORMATION ========================================================================
input:
  name:
    v: srcPoso
  mode:
    v: source
input:
  name:
    v: srcPres
  mode:
    v: source
input:
  name:
    v: tgtMedReq
  mode:
    v: target
rule:
  name:
    v: dosageinstruction
  source:
    context:
      v: srcPres
  target:
    context:
      v: tgtMedReq
    context type:
      v: variable
    element:
      v: dosageInstruction
    variable:
      v: dosageInstruction
  rule:
    name:
      v: dosagetext
    source:
      context:
        v: srcPoso
    target:
      context:
        v: dosageInstruction
      context type:
        v: variable
      element:
        v: text
      transform:
        v: evaluate
      parameter:
        value: String
  rule:
    name:
      v: dosageroute
    source:
      context:
        v: srcPres
      element:
        v: voieAdministration
      variable:
        v: route
    target:
      context:
        v: dosageInstruction
      context type:
        v: variable
      element:
        v: route
      variable:
        v: routeCC
    rule:
      name:
        v: routecoding
  rule:
    name:
      v: dosagetiming
    source:
      context:
        v: srcPoso
    target:
      context:
        v: dosageInstruction
      context type:
        v: variable
      element:
        v: timing
      variable:
        v: timing
    rule:
      name:
        v: timingrepeat
  rule:
    name:
      v: doseandrate
    source:
      context:
        v: srcPoso
      element:
        v: quantite
      variable:
        v: quantity
    target:
      context:
        v: dosageInstruction
      context type:
        v: variable
      element:
        v: doseAndRate
      variable:
        v: doseRate
    rule:
      name:
        v: dosequantity

String
v: 'Prendre' + iif(%srcPoso.quantite.exists(), ' ' + %srcPoso.quantite.toString(), '1') + iif(%srcPoso.uniteQuantite.exists(), ' ' + %srcPoso.uniteQuantite, ' comprimé') + iif(%srcPoso.nombrePrisesParJour.exists(), ' ' + %srcPoso.nombrePrisesParJour.toString() + ' fois par jour', ' selon prescription')

v: route

v: routeCC

v: variable

v: coding

v: routeCoding

v: routecode

context:
  v: route

context:
  v: routeCoding
context type:
  v: variable
element:
  v: code
transform:
  v: copy
parameter:
  value: Id
    v: route

v: routesystem

context:
  v: route

context:
  v: routeCoding
context type:
  v: variable
element:
  v: system
transform:
  v: copy
parameter:
  value: String
    v: https://smt.esante.gouv.fr/terminologie-standardterms

v: srcPoso

v: timing

v: variable

v: repeat

v: timingRepeat

v: prescriptionperiod

context:
  v: srcPres
condition:
  v: srcPres.dateDebutPrescription.exists() or srcPres.dateFinPrescription.exists()

context:
  v: timingRepeat
context type:
  v: variable
element:
  v: bounds
variable:
  v: medReqPeriod
transform:
  v: create
parameter:
  value: String
    v: Period

name:
  v: periodstart
source:
  context:
    v: srcPres
  element:
    v: dateDebutPrescription
  variable:
    v: startDate
target:
  context:
    v: medReqPeriod
  context type:
    v: variable
  element:
    v: start
  transform:
    v: copy
  parameter:
    value: Id
      v: startDate

name:
  v: periodend
source:
  context:
    v: srcPres
  element:
    v: dateFinPrescription
  variable:
    v: endDate
target:
  context:
    v: medReqPeriod
  context type:
    v: variable
  element:
    v: end
  transform:
    v: copy
  parameter:
    value: Id
      v: endDate

v: timingfrequency

context:
  v: srcPoso
element:
  v: nombrePrisesParJour
variable:
  v: frequency

context:
  v: timingRepeat
context type:
  v: variable
element:
  v: frequency
transform:
  v: copy
parameter:
  value: Id
    v: frequency

v: timingperiod

context:
  v: srcPoso
element:
  v: nombrePrisesParJour
variable:
  v: frequency

context:
  v: timingRepeat
context type:
  v: variable
element:
  v: period
transform:
  v: copy
parameter:
  value: String
    v: 1

v: timingperiodunit

context:
  v: srcPoso
element:
  v: nombrePrisesParJour
variable:
  v: frequency

context:
  v: timingRepeat
context type:
  v: variable
element:
  v: periodUnit
transform:
  v: copy
parameter:
  value: String
    v: d

v: quantity

v: doseRate

v: variable

v: dose

v: doseQuantity

v: create

value: String
  v: Quantity

v: dosevalue

context:
  v: quantity

context:
  v: doseQuantity
context type:
  v: variable
element:
  v: value
transform:
  v: copy
parameter:
  value: Id
    v: quantity

v: doseunit

context:
  v: srcPoso
element:
  v: uniteQuantite
variable:
  v: unit

context:
  v: doseQuantity
context type:
  v: variable
element:
  v: unit
transform:
  v: copy
parameter:
  value: Id
    v: unit

v: dosecode

context:
  v: srcPoso
element:
  v: uniteQuantite
variable:
  v: unit

context:
  v: doseQuantity
context type:
  v: variable
element:
  v: code
transform:
  v: copy
parameter:
  value: Id
    v: unit

v: dosesystem

context:
  v: srcPoso

context:
  v: doseQuantity
context type:
  v: variable
element:
  v: system
transform:
  v: copy
parameter:
  value: String
    v: http://unitsofmeasure.org

name:
  v: TransformVitalSigns
type mode:
  v: none
documentation:
  v: ======================================================================== VITAL SIGNS TRANSFORMATION ========================================================================
input:
  name:
    v: src
  mode:
    v: source
input:
  name:
    v: tgtObs
  type:
    v: Observation
  mode:
    v: target
input:
  name:
    v: patient
  mode:
    v: source
rule:
  name:
    v: setId
  source:
    context:
      v: src
  target:
    context:
      v: tgtObs
    context type:
      v: variable
    element:
      v: id
    transform:
      v: uuid
rule:
  name:
    v: medrequestidentifier
  source:
    context:
      v: src
    element:
      v: soinId
    variable:
      v: soinId
  target:
    context:
      v: tgtObs
    context type:
      v: variable
    element:
      v: identifier
    variable:
      v: identifier
  rule:
    name:
      v: soinidsystem
    source:
      context:
        v: soinId
    target:
      context:
        v: identifier
      context type:
        v: variable
      element:
        v: system
      transform:
        v: copy
      parameter:
        value: String
  rule:
    name:
      v: soinidvalue
    source:
      context:
        v: soinId
    target:
      context:
        v: identifier
      context type:
        v: variable
      element:
        v: value
      transform:
        v: copy
      parameter:
        value: Id
rule:
  name:
    v: status
  source:
    context:
      v: src
  target:
    context:
      v: tgtObs
    context type:
      v: variable
    element:
      v: status
    transform:
      v: copy
    parameter:
      value: String
        v: final
rule:
  name:
    v: category
  source:
    context:
      v: src
  target:
    context:
      v: tgtObs
    context type:
      v: variable
    element:
      v: category
    variable:
      v: category
  rule:
    name:
      v: categorycoding
    source:
      context:
        v: src
    target:
      context:
        v: category
      context type:
        v: variable
      element:
        v: coding
      variable:
        v: coding
    rule:
      name:
        v: categorysystem
    rule:
      name:
        v: categorycode
rule:
  name:
    v: code
  source:
    context:
      v: src
  target:
    context:
      v: tgtObs
    context type:
      v: variable
    element:
      v: code
    variable:
      v: code
  rule:
    name:
      v: coding
    source:
      context:
        v: src
    target:
      context:
        v: code
      context type:
        v: variable
      element:
        v: coding
      variable:
        v: coding
    rule:
      name:
        v: codesystem
    rule:
      name:
        v: codevalue
  rule:
    name:
      v: codetext
    source:
      context:
        v: src
      element:
        v: libelleTest
      variable:
        v: label
    target:
      context:
        v: code
      context type:
        v: variable
      element:
        v: text
      transform:
        v: copy
      parameter:
        value: Id

Id
v: soinId

v: src

v: coding

v: variable

v: system

v: copy

v: src

v: coding

v: variable

v: code

v: copy

value: String
  v: vital-signs

v: src

v: coding

v: variable

v: system

v: copy

v: src

v: codeLoinc

v: codeLoinc

v: coding

v: variable

v: code

v: copy

value: Id
  v: codeLoinc

Id
v: label

name:
  v: obssubject
source:
  context:
    v: src
target:
  context:
    v: tgtObs
  context type:
    v: variable
  element:
    v: subject
  variable:
    v: ref
  transform:
    v: create
  parameter:
    value: String
      v: Reference
rule:
  name:
    v: subjectref
  source:
    context:
      v: patient
    element:
      v: id
    variable:
      v: patientId
  target:
    context:
      v: ref
    context type:
      v: variable
    element:
      v: reference
    transform:
      v: evaluate
    parameter:
      value: String
        v: 'Patient/' + %patientId
  target:
    context:
      v: ref
    context type:
      v: variable
    element:
      v: type
    transform:
      v: copy
    parameter:
      value: String
        v: Patient

name:
  v: effective
source:
  context:
    v: src
  element:
    v: dateMesure
  variable:
    v: date
  condition:
    v: %date.exists()
target:
  context:
    v: tgtObs
  context type:
    v: variable
  element:
    v: effective
  transform:
    v: cast
  parameter:
    value: Id
      v: date
  parameter:
    value: String
      v: dateTime

name:
  v: quantity
source:
  context:
    v: src
target:
  context:
    v: tgtObs
  context type:
    v: variable
  element:
    v: value
  variable:
    v: qty
  transform:
    v: create
  parameter:
    value: String
      v: Quantity
rule:
  name:
    v: value
  source:
    context:
      v: src
    element:
      v: valeur
    variable:
      v: mesure
  target:
    context:
      v: qty
    context type:
      v: variable
    element:
      v: value
    transform:
      v: copy
    parameter:
      value: Id
        v: mesure
rule:
  name:
    v: unit
  source:
    context:
      v: src
    element:
      v: unite
    variable:
      v: unit
  target:
    context:
      v: qty
    context type:
      v: variable
    element:
      v: unit
    transform:
      v: copy
    parameter:
      value: Id
        v: unit
rule:
  name:
    v: code
  source:
    context:
      v: src
    element:
      v: unite
    variable:
      v: unit
  target:
    context:
      v: qty
    context type:
      v: variable
    element:
      v: code
    transform:
      v: copy
    parameter:
      value: Id
        v: unit
rule:
  name:
    v: system
  source:
    context:
      v: src
  target:
    context:
      v: qty
    context type:
      v: variable
    element:
      v: system
    transform:
      v: copy
    parameter:
      value: String
        v: http://unitsofmeasure.org

name:
  v: TransformTobaccoObservation
type mode:
  v: none
documentation:
  v: ======================================================================== LIFESTYLE TRANSFORMATION - SEPARATE OBSERVATIONS ========================================================================
input:
  name:
    v: src
  mode:
    v: source
input:
  name:
    v: tgtObs
  type:
    v: Observation
  mode:
    v: target
input:
  name:
    v: patient
  mode:
    v: source
rule:
  name:
    v: setId
  source:
    context:
      v: src
  target:
    context:
      v: tgtObs
    context type:
      v: variable
    element:
      v: id
    transform:
      v: uuid
rule:
  name:
    v: lifestyleidentifier
  source:
    context:
      v: src
    element:
      v: styleVieId
    variable:
      v: lsId
  target:
    context:
      v: tgtObs
    context type:
      v: variable
    element:
      v: identifier
    variable:
      v: identifier
  rule:
    name:
      v: lifestyleidsystem
    source:
      context:
        v: lsId
    target:
      context:
        v: identifier
      context type:
        v: variable
      element:
        v: system
      transform:
        v: copy
      parameter:
        value: String
  rule:
    name:
      v: lifestyleidvalue
    source:
      context:
        v: lsId
    target:
      context:
        v: identifier
      context type:
        v: variable
      element:
        v: value
      transform:
        v: evaluate
      parameter:
        value: String
rule:
  name:
    v: lifestylestatus
  source:
    context:
      v: src
  target:
    context:
      v: tgtObs
    context type:
      v: variable
    element:
      v: status
    transform:
      v: copy
    parameter:
      value: String
        v: final
rule:
  name:
    v: lifestylecategory
  source:
    context:
      v: src
  target:
    context:
      v: tgtObs
    context type:
      v: variable
    element:
      v: category
    variable:
      v: category
  rule:
    name:
      v: categorycoding
    source:
      context:
        v: src
    target:
      context:
        v: category
      context type:
        v: variable
      element:
        v: coding
      variable:
        v: coding
    rule:
      name:
        v: categorysystem
    rule:
      name:
        v: categorycode
    rule:
      name:
        v: categorydisplay
rule:
  name:
    v: tobaccocode
  source:
    context:
      v: src
  target:
    context:
      v: tgtObs
    context type:
      v: variable
    element:
      v: code
    variable:
      v: code
  rule:
    name:
      v: tobaccocoding
    source:
      context:
        v: src
    target:
      context:
        v: code
      context type:
        v: variable
      element:
        v: coding
      variable:
        v: coding
    rule:
      name:
        v: codesystem
    rule:
      name:
        v: codevalue
    rule:
      name:
        v: codedisplay
rule:
  name:
    v: lifestylesubject
  source:
    context:
      v: src
  target:
    context:
      v: tgtObs
    context type:
      v: variable
    element:
      v: subject
    variable:
      v: ref

String
v: %lsId & '-tobacco'

v: src

v: coding

v: variable

v: system

v: copy

v: src

v: coding

v: variable

v: code

v: copy

value: String
  v: social-history

v: src

v: coding

v: variable

v: display

v: copy

value: String
  v: Social History

v: src

v: coding

v: variable

v: system

v: copy

v: src

v: coding

v: variable

v: code

v: copy

value: String
  v: 72166-2

v: src

v: coding

v: variable

v: display

v: copy

value: String
  v: Tobacco smoking status

v: create

value: String
  v: Reference

name:
  v: subjectref
source:
  context:
    v: patient
  element:
    v: id
  variable:
    v: patientId
target:
  context:
    v: ref
  context type:
    v: variable
  element:
    v: reference
  transform:
    v: evaluate
  parameter:
    value: String
      v: 'Patient/' + %patientId
target:
  context:
    v: ref
  context type:
    v: variable
  element:
    v: type
  transform:
    v: copy
  parameter:
    value: String
      v: Patient

name:
  v: lifestyleeffective
source:
  context:
    v: src
  element:
    v: dateRecueil
  variable:
    v: collectDate
  condition:
    v: %collectDate.exists()
target:
  context:
    v: tgtObs
  context type:
    v: variable
  element:
    v: effective
  transform:
    v: cast
  parameter:
    value: Id
      v: collectDate
  parameter:
    value: String
      v: dateTime

name:
  v: tobaccovalue
source:
  context:
    v: src
  element:
    v: consommationTabac
  variable:
    v: tobacco
target:
  context:
    v: tgtObs
  context type:
    v: variable
  element:
    v: value
  variable:
    v: valueCC
  transform:
    v: create
  parameter:
    value: String
      v: CodeableConcept
rule:
  name:
    v: tobaccovaluetext
  source:
    context:
      v: tobacco
  target:
    context:
      v: valueCC
    context type:
      v: variable
    element:
      v: text
    transform:
      v: copy
    parameter:
      value: Id
        v: tobacco

name:
  v: TransformAlcoholObservation
type mode:
  v: none
input:
  name:
    v: src
  mode:
    v: source
input:
  name:
    v: tgtObs
  type:
    v: Observation
  mode:
    v: target
input:
  name:
    v: patient
  mode:
    v: source
rule:
  name:
    v: setId
  source:
    context:
      v: src
  target:
    context:
      v: tgtObs
    context type:
      v: variable
    element:
      v: id
    transform:
      v: uuid
rule:
  name:
    v: lifestyleidentifier
  source:
    context:
      v: src
    element:
      v: styleVieId
    variable:
      v: lsId
  target:
    context:
      v: tgtObs
    context type:
      v: variable
    element:
      v: identifier
    variable:
      v: identifier
  rule:
    name:
      v: lifestyleidsystem
    source:
      context:
        v: lsId
    target:
      context:
        v: identifier
      context type:
        v: variable
      element:
        v: system
      transform:
        v: copy
      parameter:
        value: String
  rule:
    name:
      v: lifestyleidvalue
    source:
      context:
        v: lsId
    target:
      context:
        v: identifier
      context type:
        v: variable
      element:
        v: value
      transform:
        v: evaluate
      parameter:
        value: String
rule:
  name:
    v: lifestylestatus
  source:
    context:
      v: src
  target:
    context:
      v: tgtObs
    context type:
      v: variable
    element:
      v: status
    transform:
      v: copy
    parameter:
      value: String
        v: final
rule:
  name:
    v: lifestylecategory
  source:
    context:
      v: src
  target:
    context:
      v: tgtObs
    context type:
      v: variable
    element:
      v: category
    variable:
      v: category
  rule:
    name:
      v: categorycoding
    source:
      context:
        v: src
    target:
      context:
        v: category
      context type:
        v: variable
      element:
        v: coding
      variable:
        v: coding
    rule:
      name:
        v: categorysystem
    rule:
      name:
        v: categorycode
    rule:
      name:
        v: categorydisplay
rule:
  name:
    v: alcoholcode
  source:
    context:
      v: src
  target:
    context:
      v: tgtObs
    context type:
      v: variable
    element:
      v: code
    variable:
      v: code
  rule:
    name:
      v: alcoholcoding
    source:
      context:
        v: src
    target:
      context:
        v: code
      context type:
        v: variable
      element:
        v: coding
      variable:
        v: coding
    rule:
      name:
        v: codesystem
    rule:
      name:
        v: codevalue
    rule:
      name:
        v: codedisplay
rule:
  name:
    v: lifestylesubject
  source:
    context:
      v: src
  target:
    context:
      v: tgtObs
    context type:
      v: variable
    element:
      v: subject
    variable:
      v: ref
    transform:
      v: create

String
v: %lsId & '-alcohol'

v: src

v: coding

v: variable

v: system

v: copy

v: src

v: coding

v: variable

v: code

v: copy

value: String
  v: social-history

v: src

v: coding

v: variable

v: display

v: copy

value: String
  v: Social History

v: src

v: coding

v: variable

v: system

v: copy

v: src

v: coding

v: variable

v: code

v: copy

value: String
  v: 11331-6

v: src

v: coding

v: variable

v: display

v: copy

value: String
  v: History of alcohol use

value: String
  v: Reference

name:
  v: subjectref
source:
  context:
    v: patient
  element:
    v: id
  variable:
    v: patientId
target:
  context:
    v: ref
  context type:
    v: variable
  element:
    v: reference
  transform:
    v: evaluate
  parameter:
    value: String
      v: 'Patient/' + %patientId
target:
  context:
    v: ref
  context type:
    v: variable
  element:
    v: type
  transform:
    v: copy
  parameter:
    value: String
      v: Patient

name:
  v: lifestyleeffective
source:
  context:
    v: src
  element:
    v: dateRecueil
  variable:
    v: collectDate
  condition:
    v: %collectDate.exists()
target:
  context:
    v: tgtObs
  context type:
    v: variable
  element:
    v: effective
  transform:
    v: cast
  parameter:
    value: Id
      v: collectDate
  parameter:
    value: String
      v: dateTime

name:
  v: alcoholvalue
source:
  context:
    v: src
  element:
    v: consommationAlcool
  variable:
    v: alcohol
target:
  context:
    v: tgtObs
  context type:
    v: variable
  element:
    v: value
  variable:
    v: valueCC
  transform:
    v: create
  parameter:
    value: String
      v: CodeableConcept
rule:
  name:
    v: alcoholvaluetext
  source:
    context:
      v: alcohol
  target:
    context:
      v: valueCC
    context type:
      v: variable
    element:
      v: text
    transform:
      v: copy
    parameter:
      value: Id
        v: alcohol

name:
  v: TransformDrugObservation
type mode:
  v: none
input:
  name:
    v: src
  mode:
    v: source
input:
  name:
    v: tgtObs
  type:
    v: Observation
  mode:
    v: target
input:
  name:
    v: patient
  mode:
    v: source
rule:
  name:
    v: setId
  source:
    context:
      v: src
  target:
    context:
      v: tgtObs
    context type:
      v: variable
    element:
      v: id
    transform:
      v: uuid
rule:
  name:
    v: lifestyleidentifier
  source:
    context:
      v: src
    element:
      v: styleVieId
    variable:
      v: lsId
  target:
    context:
      v: tgtObs
    context type:
      v: variable
    element:
      v: identifier
    variable:
      v: identifier
  rule:
    name:
      v: lifestyleidsystem
    source:
      context:
        v: lsId
    target:
      context:
        v: identifier
      context type:
        v: variable
      element:
        v: system
      transform:
        v: copy
      parameter:
        value: String
  rule:
    name:
      v: lifestyleidvalue
    source:
      context:
        v: lsId
    target:
      context:
        v: identifier
      context type:
        v: variable
      element:
        v: value
      transform:
        v: evaluate
      parameter:
        value: String
rule:
  name:
    v: lifestylestatus
  source:
    context:
      v: src
  target:
    context:
      v: tgtObs
    context type:
      v: variable
    element:
      v: status
    transform:
      v: copy
    parameter:
      value: String
        v: final
rule:
  name:
    v: lifestylecategory
  source:
    context:
      v: src
  target:
    context:
      v: tgtObs
    context type:
      v: variable
    element:
      v: category
    variable:
      v: category
  rule:
    name:
      v: categorycoding
    source:
      context:
        v: src
    target:
      context:
        v: category
      context type:
        v: variable
      element:
        v: coding
      variable:
        v: coding
    rule:
      name:
        v: categorysystem
    rule:
      name:
        v: categorycode
    rule:
      name:
        v: categorydisplay
rule:
  name:
    v: drugcode
  source:
    context:
      v: src
  target:
    context:
      v: tgtObs
    context type:
      v: variable
    element:
      v: code
    variable:
      v: code
  rule:
    name:
      v: drugcoding
    source:
      context:
        v: src
    target:
      context:
        v: code
      context type:
        v: variable
      element:
        v: coding
      variable:
        v: coding
    rule:
      name:
        v: codesystem
    rule:
      name:
        v: codevalue
    rule:
      name:
        v: codedisplay
rule:
  name:
    v: lifestylesubject
  source:
    context:
      v: src
  target:
    context:
      v: tgtObs
    context type:
      v: variable
    element:
      v: subject
    variable:
      v: ref
    transform:
      v: create

String
v: %lsId & '-drugs'

v: src

v: coding

v: variable

v: system

v: copy

v: src

v: coding

v: variable

v: code

v: copy

value: String
  v: social-history

v: src

v: coding

v: variable

v: display

v: copy

value: String
  v: Social History

v: src

v: coding

v: variable

v: system

v: copy

v: src

v: coding

v: variable

v: code

v: copy

value: String
  v: 11342-3

v: src

v: coding

v: variable

v: display

v: copy

value: String
  v: History of drug use

value: String
  v: Reference

name:
  v: subjectref
source:
  context:
    v: patient
  element:
    v: id
  variable:
    v: patientId
target:
  context:
    v: ref
  context type:
    v: variable
  element:
    v: reference
  transform:
    v: evaluate
  parameter:
    value: String
      v: 'Patient/' + %patientId
target:
  context:
    v: ref
  context type:
    v: variable
  element:
    v: type
  transform:
    v: copy
  parameter:
    value: String
      v: Patient

name:
  v: lifestyleeffective
source:
  context:
    v: src
  element:
    v: dateRecueil
  variable:
    v: collectDate
  condition:
    v: %collectDate.exists()
target:
  context:
    v: tgtObs
  context type:
    v: variable
  element:
    v: effective
  transform:
    v: cast
  parameter:
    value: Id
      v: collectDate
  parameter:
    value: String
      v: dateTime

name:
  v: drugvalue
source:
  context:
    v: src
  element:
    v: consommationAutresDrogues
  variable:
    v: drugs
target:
  context:
    v: tgtObs
  context type:
    v: variable
  element:
    v: value
  variable:
    v: valueCC
  transform:
    v: create
  parameter:
    value: String
      v: CodeableConcept
rule:
  name:
    v: drugvaluetext
  source:
    context:
      v: drugs
  target:
    context:
      v: valueCC
    context type:
      v: variable
    element:
      v: text
    transform:
      v: copy
    parameter:
      value: Id
        v: drugs

name:
  v: TransformPhysicalActivityObservation
type mode:
  v: none
input:
  name:
    v: src
  mode:
    v: source
input:
  name:
    v: tgtObs
  type:
    v: Observation
  mode:
    v: target
input:
  name:
    v: patient
  mode:
    v: source
rule:
  name:
    v: setId
  source:
    context:
      v: src
  target:
    context:
      v: tgtObs
    context type:
      v: variable
    element:
      v: id
    transform:
      v: uuid
rule:
  name:
    v: lifestyleidentifier
  source:
    context:
      v: src
    element:
      v: styleVieId
    variable:
      v: lsId
  target:
    context:
      v: tgtObs
    context type:
      v: variable
    element:
      v: identifier
    variable:
      v: identifier
  rule:
    name:
      v: lifestyleidsystem
    source:
      context:
        v: lsId
    target:
      context:
        v: identifier
      context type:
        v: variable
      element:
        v: system
      transform:
        v: copy
      parameter:
        value: String
  rule:
    name:
      v: lifestyleidvalue
    source:
      context:
        v: lsId
    target:
      context:
        v: identifier
      context type:
        v: variable
      element:
        v: value
      transform:
        v: evaluate
      parameter:
        value: String
rule:
  name:
    v: lifestylestatus
  source:
    context:
      v: src
  target:
    context:
      v: tgtObs
    context type:
      v: variable
    element:
      v: status
    transform:
      v: copy
    parameter:
      value: String
        v: final
rule:
  name:
    v: lifestylecategory
  source:
    context:
      v: src
  target:
    context:
      v: tgtObs
    context type:
      v: variable
    element:
      v: category
    variable:
      v: category
  rule:
    name:
      v: categorycoding
    source:
      context:
        v: src
    target:
      context:
        v: category
      context type:
        v: variable
      element:
        v: coding
      variable:
        v: coding
    rule:
      name:
        v: categorysystem
    rule:
      name:
        v: categorycode
    rule:
      name:
        v: categorydisplay
rule:
  name:
    v: physicalcode
  source:
    context:
      v: src
  target:
    context:
      v: tgtObs
    context type:
      v: variable
    element:
      v: code
    variable:
      v: code
  rule:
    name:
      v: physicalcoding
    source:
      context:
        v: src
    target:
      context:
        v: code
      context type:
        v: variable
      element:
        v: coding
      variable:
        v: coding
    rule:
      name:
        v: codesystem
    rule:
      name:
        v: codevalue
    rule:
      name:
        v: codedisplay
rule:
  name:
    v: lifestylesubject
  source:
    context:
      v: src
  target:
    context:
      v: tgtObs
    context type:
      v: variable
    element:
      v: subject
    variable:
      v: ref
    transform:
      v: create

String
v: %lsId & '-physical'

v: src

v: coding

v: variable

v: system

v: copy

v: src

v: coding

v: variable

v: code

v: copy

value: String
  v: social-history

v: src

v: coding

v: variable

v: display

v: copy

value: String
  v: Social History

v: src

v: coding

v: variable

v: system

v: copy

v: src

v: coding

v: variable

v: code

v: copy

value: String
  v: 67504-6

v: src

v: coding

v: variable

v: display

v: copy

value: String
  v: Exercise activity

value: String
  v: Reference

name:
  v: subjectref
source:
  context:
    v: patient
  element:
    v: id
  variable:
    v: patientId
target:
  context:
    v: ref
  context type:
    v: variable
  element:
    v: reference
  transform:
    v: evaluate
  parameter:
    value: String
      v: 'Patient/' + %patientId
target:
  context:
    v: ref
  context type:
    v: variable
  element:
    v: type
  transform:
    v: copy
  parameter:
    value: String
      v: Patient

name:
  v: lifestyleeffective
source:
  context:
    v: src
  element:
    v: dateRecueil
  variable:
    v: collectDate
  condition:
    v: %collectDate.exists()
target:
  context:
    v: tgtObs
  context type:
    v: variable
  element:
    v: effective
  transform:
    v: cast
  parameter:
    value: Id
      v: collectDate
  parameter:
    value: String
      v: dateTime

name:
  v: physicalvalue
source:
  context:
    v: src
  element:
    v: activitePhysique
  variable:
    v: physical
target:
  context:
    v: tgtObs
  context type:
    v: variable
  element:
    v: value
  variable:
    v: valueCC
  transform:
    v: create
  parameter:
    value: String
      v: CodeableConcept
rule:
  name:
    v: physicalvaluetext
  source:
    context:
      v: physical
  target:
    context:
      v: valueCC
    context type:
      v: variable
    element:
      v: text
    transform:
      v: copy
    parameter:
      value: Id
        v: physical

name:
  v: TransformMedicationAdministrationWOOrder
type mode:
  v: none
documentation:
  v: ======================================================================== MEDICATION ADMINISTRATION TRANSFORMATION ========================================================================
input:
  name:
    v: src
  mode:
    v: source
input:
  name:
    v: tgtMedAdmin
  type:
    v: MedicationAdministration
  mode:
    v: target
input:
  name:
    v: patient
  mode:
    v: source
rule:
  name:
    v: setId
  source:
    context:
      v: src
  target:
    context:
      v: tgtMedAdmin
    context type:
      v: variable
    element:
      v: id
    transform:
      v: uuid
rule:
  name:
    v: adminidentifier
  source:
    context:
      v: src
    element:
      v: administrationId
    variable:
      v: adminId
  target:
    context:
      v: tgtMedAdmin
    context type:
      v: variable
    element:
      v: identifier
    variable:
      v: identifier
  rule:
    name:
      v: adminidsystem
    source:
      context:
        v: adminId
    target:
      context:
        v: identifier
      context type:
        v: variable
      element:
        v: system
      transform:
        v: copy
      parameter:
        value: String
  rule:
    name:
      v: adminidvalue
    source:
      context:
        v: adminId
    target:
      context:
        v: identifier
      context type:
        v: variable
      element:
        v: value
      transform:
        v: copy
      parameter:
        value: Id
rule:
  name:
    v: adminstatus
  source:
    context:
      v: src
  target:
    context:
      v: tgtMedAdmin
    context type:
      v: variable
    element:
      v: status
    transform:
      v: copy
    parameter:
      value: String
        v: completed
rule:
  name:
    v: adminsubject
  source:
    context:
      v: src
  target:
    context:
      v: tgtMedAdmin
    context type:
      v: variable
    element:
      v: subject
    variable:
      v: ref
    transform:
      v: create
    parameter:
      value: String
        v: Reference
  rule:
    name:
      v: subjectref
    source:
      context:
        v: patient
      element:
        v: id
      variable:
        v: patientId
    target:
      context:
        v: ref
      context type:
        v: variable
      element:
        v: reference
      transform:
        v: evaluate
      parameter:
        value: String
    target:
      context:
        v: ref
      context type:
        v: variable
      element:
        v: type
      transform:
        v: copy
      parameter:
        value: String
rule:
  name:
    v: adminmedication
  source:
    context:
      v: src
    element:
      v: denomination
    variable:
      v: denomination
  target:
    context:
      v: tgtMedAdmin
    context type:
      v: variable
    element:
      v: medication
    variable:
      v: medication
    transform:
      v: create
    parameter:
      value: String
        v: CodeableConcept
  rule:
    name:
      v: medicationtext
    source:
      context:
        v: denomination
    target:
      context:
        v: medication
      context type:
        v: variable
      element:
        v: text
      transform:
        v: copy
      parameter:
        value: Id

Id
v: adminId

String
v: 'Patient/' + %patientId

String
v: Patient

Id
v: denomination

name:
  v: atccoding
source:
  context:
    v: src
  element:
    v: codeAtc
  variable:
    v: atc
target:
  context:
    v: medication
  context type:
    v: variable
  element:
    v: coding
  variable:
    v: coding
rule:
  name:
    v: atcsystem
  source:
    context:
      v: atc
  target:
    context:
      v: coding
    context type:
      v: variable
    element:
      v: system
    transform:
      v: copy
    parameter:
      value: String
        v: http://www.whocc.no/atc
rule:
  name:
    v: atccode
  source:
    context:
      v: atc
  target:
    context:
      v: coding
    context type:
      v: variable
    element:
      v: code
    transform:
      v: copy
    parameter:
      value: Id
        v: atc

name:
  v: admineffective
source:
  context:
    v: src
  condition:
    v: src.dateHeureDebut.exists() or src.dateHeureFin.exists()
target:
  context:
    v: tgtMedAdmin
  context type:
    v: variable
  element:
    v: effective
  variable:
    v: period
  transform:
    v: create
  parameter:
    value: String
      v: Period
rule:
  name:
    v: periodstart
  source:
    context:
      v: src
    element:
      v: dateHeureDebut
    variable:
      v: startDate
  target:
    context:
      v: period
    context type:
      v: variable
    element:
      v: start
    transform:
      v: copy
    parameter:
      value: Id
        v: startDate
rule:
  name:
    v: periodend
  source:
    context:
      v: src
    element:
      v: dateHeureFin
    variable:
      v: endDate
  target:
    context:
      v: period
    context type:
      v: variable
    element:
      v: end
    transform:
      v: copy
    parameter:
      value: Id
        v: endDate

name:
  v: admindosage
source:
  context:
    v: src
  condition:
    v: src.quantite.exists() or src.voieAdministration.exists()
target:
  context:
    v: tgtMedAdmin
  context type:
    v: variable
  element:
    v: dosage
  variable:
    v: dosage
rule:
  name:
    v: admindose
  source:
    context:
      v: src
    element:
      v: quantite
    variable:
      v: quantity
  target:
    context:
      v: dosage
    context type:
      v: variable
    element:
      v: dose
    variable:
      v: dose
    transform:
      v: create
    parameter:
      value: String
        v: Quantity
  rule:
    name:
      v: dosevalue
    source:
      context:
        v: quantity
    target:
      context:
        v: dose
      context type:
        v: variable
      element:
        v: value
      transform:
        v: copy
      parameter:
        value: Id
  rule:
    name:
      v: doseunit
    source:
      context:
        v: src
      element:
        v: uniteQuantite
      variable:
        v: unit
    target:
      context:
        v: dose
      context type:
        v: variable
      element:
        v: unit
      transform:
        v: copy
      parameter:
        value: Id
rule:
  name:
    v: dosageroute
  source:
    context:
      v: src
    element:
      v: voieAdministration
    variable:
      v: route
  target:
    context:
      v: dosage
    context type:
      v: variable
    element:
      v: route
    variable:
      v: routeCC
  rule:
    name:
      v: routecoding
    source:
      context:
        v: route
    target:
      context:
        v: routeCC
      context type:
        v: variable
      element:
        v: coding
      variable:
        v: routeCoding
    rule:
      name:
        v: routecode
    rule:
      name:
        v: routesystem

Id
v: quantity

Id
v: unit

v: route

v: routeCoding

v: variable

v: code

v: copy

value: Id
  v: route

v: route

v: routeCoding

v: variable

v: system

v: copy

name:
  v: TransformMedicationAdministrationWOrder
extends:
  v: TransformMedicationAdministrationWOOrder
type mode:
  v: none
input:
  name:
    v: src
  mode:
    v: source
input:
  name:
    v: tgtMedAdmin
  type:
    v: MedicationAdministration
  mode:
    v: target
input:
  name:
    v: patient
  mode:
    v: source
input:
  name:
    v: order
  mode:
    v: source
rule:
  name:
    v: admincontext
  source:
    context:
      v: src
  target:
    context:
      v: tgtMedAdmin
    context type:
      v: variable
    element:
      v: request
    variable:
      v: ref
    transform:
      v: create
    parameter:
      value: String
        v: Reference
  rule:
    name:
      v: encounterref
    source:
      context:
        v: order
      element:
        v: id
      variable:
        v: orderId
    target:
      context:
        v: ref
      context type:
        v: variable
      element:
        v: reference
      transform:
        v: evaluate
      parameter:
        value: String
    target:
      context:
        v: ref
      context type:
        v: variable
      element:
        v: type
      transform:
        v: copy
      parameter:
        value: String

String
v: 'MedicationRequest/' + %orderId

String
v: MedicationRequest

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

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