SubjectOfCare-Patient
type: StructureMap
node role: treeRoot
id:
  v: SubjectOfCare-Patient
text:
  status:
    v: generated
  div:
    v: Generated Narrative: StructureMap SubjectOfCare-Patient #xD; map "https://metadata.phase2.scip.synanetics.cloud/fhir/r4/StructureMap/SubjectOfCare-Patient" = "SubjectOfCareToPatient"#xD; #xD; uses "https://metadata.phase2.scip.synanetics.cloud/fhir/r4/StructureDefinition/MODS-SubjectOfCare" alias SubjectOfCare as source#xD; uses "https://metadata.phase2.scip.synanetics.cloud/fhir/r4/StructureDefinition/MODS-Patient" alias Patient as target#xD; #xD; group Patient(source src : SubjectOfCare, target tgt : Patient) {#xD; src -> tgt.id = evaluate(src, id) "setPatientId";#xD; src.demographics as demographics, demographics.sex as sex, sex.code as sexCode then {#xD; src -> src.sex = create('Coding') as sxvt then {#xD; src -> sxvt.code = sexCode "12f54fdb-c9a1-44f2-b149-2851a8498972";#xD; src -> sxvt.system = 'https://data.digitisingsocialcare.co.uk/mods/v1/person-sex' "28b599b2-7388-4c05-9bd3-9e1ac3600d6b";#xD; src -> tgt.extension as birthSexExt then {#xD; src -> birthSexExt.url = 'https://fhir.hl7.org.uk/StructureDefinition/Extension-UKCore-BirthSex' "f45ec68e-5c48-4d02-a472-77f2a8c0353e";#xD; src -> birthSexExt.valueCodeableConcept = translate(sxvt, 'https://metadata.phase2.scip.synanetics.cloud/fhir/r4/ConceptMap/MODS-FHIRBirthSex-1', 'CodeableConcept') "09a0ed80-3a67-45c3-a335-f684139b6f9d";#xD; } "7c94959c-4e8f-4579-85e4-0a9c6969d7eb";#xD; } "0dc8772f-6222-424b-b00a-3b9b70b69144";#xD; } "setPatientBirthSex";#xD; src.demographics as demographics, demographics.ethnicity as ethnicity then {#xD; src -> tgt.extension as ethnicityExt then {#xD; src -> ethnicityExt.url = 'https://fhir.hl7.org.uk/StructureDefinition/Extension-UKCore-EthnicCategory' "773950dd-a9af-4437-81a1-96879fec04f7";#xD; src -> ethnicityExt.valueCodeableConcept as ethnicCategory then {#xD; src -> ethnicCategory.coding as coding then {#xD; src -> coding.system = 'https://fhir.hl7.org.uk/CodeSystem/UKCore-EthnicCategoryEngland' "ee22b11d-c32f-4d03-b720-462434d4c6ef";#xD; src -> coding.code = evaluate(ethnic…
url:
  v: https://metadata.phase2.scip.synanetics.cloud/fhir/r4/StructureMap/SubjectOfCare-Patient
  l: SubjectOfCare-Patient
version:
  v: 0.1.0
name:
  v: SubjectOfCareToPatient
status:
  v: draft
date:
  v: 2026-03-24T16:18:08+00:00
publisher:
  v: Synanetics Ltd on behalf of DHSC/Social Care Interoperability Platform
contact:
  name:
    v: Synanetics Ltd on behalf of DHSC/Social Care Interoperability Platform
  telecom:
    system:
      v: url
    value:
      v: https://synanetics.com
  telecom:
    system:
      v: email
jurisdiction:
  coding:
    system:
      v: urn:iso:std:iso:3166
      l: 3166
    code:
      v: GB
    display:
      v: United Kingdom of Great Britain and Northern Ireland
structure:
  url:
    v: https://metadata.phase2.scip.synanetics.cloud/fhir/r4/StructureDefinition/MODS-SubjectOfCare
    l: MODS-SubjectOfCare
  mode:
    v: source
  alias:
    v: SubjectOfCare
structure:
  url:
    v: https://metadata.phase2.scip.synanetics.cloud/fhir/r4/StructureDefinition/MODS-Patient
    l: MODS-Patient
  mode:
    v: target
  alias:
    v: Patient
group:
  name:
    v: Patient
  type mode:
    v: none
  input:
    name:
      v: src
    type:
      v: SubjectOfCare
    mode:
      v: source
  input:
    name:
      v: tgt
    type:
      v: Patient
    mode:
      v: target
  rule:
    name:
      v: setPatientId
    source:
      context:
        v: src
    target:
      context:
        v: tgt
      context type:
        v: variable
      element:
        v: id
      transform:
        v: evaluate
      parameter:
        value: Id
      parameter:
        value: String
  rule:
    name:
      v: setPatientBirthSex
    source:
      context:
        v: src
      element:
        v: demographics
      variable:
        v: demographics
    source:
      context:
        v: demographics
      element:
        v: sex
      variable:
        v: sex
    source:
      context:
        v: sex
      element:
        v: code
      variable:
        v: sexCode
  rule:
    name:
      v: setPatientEthnicity
    source:
      context:
        v: src
      element:
        v: demographics
      variable:
        v: demographics
    source:
      context:
        v: demographics
      element:
        v: ethnicity
      variable:
        v: ethnicity
  rule:
    name:
      v: setPatientReligion
    source:
      context:
        v: src
      element:
        v: demographics
      variable:
        v: demographics
    source:
      context:
        v: demographics
      element:
        v: religion
      variable:
        v: religion
  rule:
    name:
      v: setPatientSexualOrientation
    source:
      context:
        v: src
      element:
        v: demographics
      variable:
        v: demographics
    source:
      context:
        v: demographics
      element:
        v: sexualOrientation
      variable:
        v: sexualOrientation
  rule:
    name:
      v: setPatientName
    source:
      context:
        v: src
    target:
      context:
        v: tgt
      context type:
        v: variable
      element:
        v: name
      variable:
        v: name
  rule:
    name:
      v: setPatientNHSNumber
    source:
      context:
        v: src
      element:
        v: identification
    target:
      context:
        v: tgt
      context type:
        v: variable
      element:
        v: identifier
      variable:
        v: identifier

Id
v: src

String
v: id

v: src

v: src

v: variable

v: sex

v: sxvt

v: create

value: String
  v: Coding

context:
  v: src

context:
  v: sxvt
context type:
  v: variable
element:
  v: code
transform:
  v: copy
parameter:
  value: Id
    v: sexCode

context:
  v: src

context:
  v: sxvt
context type:
  v: variable
element:
  v: system
transform:
  v: copy
parameter:
  value: String
    v: https://data.digitisingsocialcare.co.uk/mods/v1/person-sex

context:
  v: src

context:
  v: tgt
context type:
  v: variable
element:
  v: extension
variable:
  v: birthSexExt

source:
  context:
    v: src
target:
  context:
    v: birthSexExt
  context type:
    v: variable
  element:
    v: url
  transform:
    v: copy
  parameter:
    value: String
      v: https://fhir.hl7.org.uk/StructureDefinition/Extension-UKCore-BirthSex

source:
  context:
    v: src
target:
  context:
    v: birthSexExt
  context type:
    v: variable
  element:
    v: valueCodeableConcept
  transform:
    v: translate
  parameter:
    value: Id
      v: sxvt
  parameter:
    value: String
      v: https://metadata.phase2.scip.synanetics.cloud/fhir/r4/ConceptMap/MODS-FHIRBirthSex-1
  parameter:
    value: String
      v: CodeableConcept

v: src

v: tgt

v: variable

v: extension

v: ethnicityExt

context:
  v: src

context:
  v: ethnicityExt
context type:
  v: variable
element:
  v: url
transform:
  v: copy
parameter:
  value: String
    v: https://fhir.hl7.org.uk/StructureDefinition/Extension-UKCore-EthnicCategory

context:
  v: src

context:
  v: ethnicityExt
context type:
  v: variable
element:
  v: valueCodeableConcept
variable:
  v: ethnicCategory

source:
  context:
    v: src
target:
  context:
    v: ethnicCategory
  context type:
    v: variable
  element:
    v: coding
  variable:
    v: coding
rule:
  source:
    context:
      v: src
  target:
    context:
      v: coding
    context type:
      v: variable
    element:
      v: system
    transform:
      v: copy
    parameter:
      value: String
        v: https://fhir.hl7.org.uk/CodeSystem/UKCore-EthnicCategoryEngland
rule:
  source:
    context:
      v: src
  target:
    context:
      v: coding
    context type:
      v: variable
    element:
      v: code
    transform:
      v: evaluate
    parameter:
      value: Id
        v: ethnicity
    parameter:
      value: String
        v: code
rule:
  source:
    context:
      v: src
  target:
    context:
      v: coding
    context type:
      v: variable
    element:
      v: display
    transform:
      v: evaluate
    parameter:
      value: Id
        v: ethnicity
    parameter:
      value: String
        v: display

v: src

v: tgt

v: variable

v: extension

v: religionExt

context:
  v: src

context:
  v: religionExt
context type:
  v: variable
element:
  v: url
transform:
  v: copy
parameter:
  value: String
    v: https://metadata.phase2.scip.synanetics.cloud/fhir/r4/StructureDefinition/Extension-MODS-PersonReligiousAffiliation

context:
  v: src

context:
  v: religionExt
context type:
  v: variable
element:
  v: valueCodeableConcept
variable:
  v: ethnicCategory

source:
  context:
    v: src
target:
  context:
    v: ethnicCategory
  context type:
    v: variable
  element:
    v: coding
  variable:
    v: coding
rule:
  source:
    context:
      v: src
  target:
    context:
      v: coding
    context type:
      v: variable
    element:
      v: system
    transform:
      v: copy
    parameter:
      value: String
        v: https://metadata.phase2.scip.synanetics.cloud/fhir/r4/CodeSystem/MODS-PersonReligionCode-1
rule:
  source:
    context:
      v: src
  target:
    context:
      v: coding
    context type:
      v: variable
    element:
      v: code
    transform:
      v: evaluate
    parameter:
      value: Id
        v: religion
    parameter:
      value: String
        v: code
rule:
  source:
    context:
      v: src
  target:
    context:
      v: coding
    context type:
      v: variable
    element:
      v: display
    transform:
      v: evaluate
    parameter:
      value: Id
        v: religion
    parameter:
      value: String
        v: display

v: src

v: tgt

v: variable

v: extension

v: sexualOrientationExt

context:
  v: src

context:
  v: sexualOrientationExt
context type:
  v: variable
element:
  v: url
transform:
  v: copy
parameter:
  value: String
    v: https://metadata.phase2.scip.synanetics.cloud/fhir/r4/StructureDefinition/Extension-MODS-PersonSexualOrientation

context:
  v: src

context:
  v: sexualOrientationExt
context type:
  v: variable
element:
  v: valueCodeableConcept
variable:
  v: sexualOrientationCode

source:
  context:
    v: src
target:
  context:
    v: sexualOrientationCode
  context type:
    v: variable
  element:
    v: coding
  variable:
    v: coding
rule:
  source:
    context:
      v: src
  target:
    context:
      v: coding
    context type:
      v: variable
    element:
      v: system
    transform:
      v: copy
    parameter:
      value: String
        v: http://snomed.info/ct
rule:
  source:
    context:
      v: src
  target:
    context:
      v: coding
    context type:
      v: variable
    element:
      v: code
    transform:
      v: evaluate
    parameter:
      value: Id
        v: sexualOrientation
    parameter:
      value: String
        v: code
rule:
  source:
    context:
      v: src
  target:
    context:
      v: coding
    context type:
      v: variable
    element:
      v: display
    transform:
      v: evaluate
    parameter:
      value: Id
        v: sexualOrientation
    parameter:
      value: String
        v: display

v: src

v: name

v: variable

v: given

v: evaluate

value: Id
  v: src

value: String
  v: name.given

v: src

v: name

v: variable

v: family

v: evaluate

value: Id
  v: src

value: String
  v: name.family

source:
  context:
    v: src
target:
  context:
    v: identifier
  context type:
    v: variable
  element:
    v: use
  transform:
    v: copy
  parameter:
    value: String
      v: official

source:
  context:
    v: src
target:
  context:
    v: identifier
  context type:
    v: variable
  element:
    v: system
  transform:
    v: copy
  parameter:
    value: String
      v: https://fhir.nhs.uk/Id/nhs-number

source:
  context:
    v: src
target:
  context:
    v: identifier
  context type:
    v: variable
  element:
    v: value
  transform:
    v: evaluate
  parameter:
    value: Id
      v: src
  parameter:
    value: String
      v: identification.nhsNumber.value

source:
  context:
    v: src
target:
  context:
    v: identifier
  context type:
    v: variable
  element:
    v: extension
  variable:
    v: extension
rule:
  source:
    context:
      v: src
  target:
    context:
      v: extension
    context type:
      v: variable
    element:
      v: url
    transform:
      v: copy
    parameter:
      value: String
        v: https://fhir.hl7.org.uk/StructureDefinition/Extension-UKCore-NHSNumberVerificationStatus
rule:
  source:
    context:
      v: src
  target:
    context:
      v: extension
    context type:
      v: variable
    element:
      v: valueCodeableConcept
    variable:
      v: cc
  rule:
    source:
      context:
        v: src
    target:
      context:
        v: cc
      context type:
        v: variable
      element:
        v: coding
      variable:
        v: coding

v: src

v: coding

v: variable

v: system

v: copy

v: src

v: coding

v: variable

v: code

v: evaluate

value: Id
  v: src

value: String
  v: identification.nhsNumber.statusIndicator.code

v: src

v: coding

v: variable

v: display

v: evaluate

value: Id
  v: src

value: String
  v: identification.nhsNumber.statusIndicator.display

name:
  v: setOtherPatientIdentifier
source:
  context:
    v: src
  element:
    v: identification
  variable:
    v: identification
source:
  context:
    v: identification
  element:
    v: otherIdentifier
  variable:
    v: otherId
rule:
  source:
    context:
      v: src
  target:
    context:
      v: tgt
    context type:
      v: variable
    element:
      v: identifier
    variable:
      v: id
  rule:
    source:
      context:
        v: src
    target:
      context:
        v: id
      context type:
        v: variable
      element:
        v: system
      transform:
        v: evaluate
      parameter:
        value: Id
      parameter:
        value: String
  rule:
    source:
      context:
        v: src
    target:
      context:
        v: id
      context type:
        v: variable
      element:
        v: value
      transform:
        v: evaluate
      parameter:
        value: Id
      parameter:
        value: String

Id
v: otherId

String
v: system

Id
v: otherId

String
v: value

name:
  v: setPatientBirthDate
source:
  context:
    v: src
  element:
    v: demographics
target:
  context:
    v: tgt
  context type:
    v: variable
  element:
    v: birthDate
  transform:
    v: evaluate
  parameter:
    value: Id
      v: src
  parameter:
    value: String
      v: demographics.dateOfBirth

name:
  v: setPatientGender
source:
  context:
    v: src
  element:
    v: demographics
  variable:
    v: demographics
source:
  context:
    v: demographics
  element:
    v: genderIdentity
  variable:
    v: genderIdentity
source:
  context:
    v: genderIdentity
  element:
    v: code
  variable:
    v: genderIdentityCode
rule:
  source:
    context:
      v: src
  target:
    context:
      v: src
    context type:
      v: variable
    element:
      v: genderIdentity
    variable:
      v: givt
    transform:
      v: create
    parameter:
      value: String
        v: Coding
  rule:
    source:
      context:
        v: src
    target:
      context:
        v: givt
      context type:
        v: variable
      element:
        v: code
      transform:
        v: copy
      parameter:
        value: Id
  rule:
    source:
      context:
        v: src
    target:
      context:
        v: givt
      context type:
        v: variable
      element:
        v: system
      transform:
        v: copy
      parameter:
        value: String
  rule:
    source:
      context:
        v: src
    target:
      context:
        v: tgt
      context type:
        v: variable
      element:
        v: gender
      transform:
        v: translate
      parameter:
        value: Id
      parameter:
        value: String
      parameter:
        value: String

Id
v: genderIdentityCode

Id
v: givt

String
v: code

name:
  v: setExtendedPatientAddress
source:
  context:
    v: src
  element:
    v: address
  variable:
    v: address
  condition:
    v: $this.country.empty().not()
target:
  context:
    v: tgt
  context type:
    v: variable
  element:
    v: address
  variable:
    v: addr
rule:
  source:
    context:
      v: src
  target:
    context:
      v: addr
    context type:
      v: variable
    element:
      v: line
    transform:
      v: evaluate
    parameter:
      value: Id
        v: address
    parameter:
      value: String
        v: addressEntry1
rule:
  source:
    context:
      v: src
  target:
    context:
      v: addr
    context type:
      v: variable
    element:
      v: line
    transform:
      v: evaluate
    parameter:
      value: Id
        v: address
    parameter:
      value: String
        v: addressEntry2
rule:
  source:
    context:
      v: src
  target:
    context:
      v: addr
    context type:
      v: variable
    element:
      v: line
    transform:
      v: evaluate
    parameter:
      value: Id
        v: address
    parameter:
      value: String
        v: addressEntry3
rule:
  source:
    context:
      v: src
  target:
    context:
      v: addr
    context type:
      v: variable
    element:
      v: line
    transform:
      v: evaluate
    parameter:
      value: Id
        v: address
    parameter:
      value: String
        v: addressEntry4
rule:
  source:
    context:
      v: src
  target:
    context:
      v: addr
    context type:
      v: variable
    element:
      v: postalCode
    transform:
      v: evaluate
    parameter:
      value: Id
        v: address
    parameter:
      value: String
        v: postCode
rule:
  source:
    context:
      v: src
  target:
    context:
      v: addr
    context type:
      v: variable
    element:
      v: country
    transform:
      v: evaluate
    parameter:
      value: Id
        v: address
    parameter:
      value: String
        v: country.display
rule:
  source:
    context:
      v: src
  target:
    context:
      v: addr
    context type:
      v: variable
    element:
      v: extension
    variable:
      v: extension
  rule:
    source:
      context:
        v: src
    target:
      context:
        v: extension
      context type:
        v: variable
      element:
        v: url
      transform:
        v: copy
      parameter:
        value: String
  rule:
    source:
      context:
        v: src
    target:
      context:
        v: extension
      context type:
        v: variable
      element:
        v: valueCoding
      variable:
        v: countryCoding

v: src

v: countryCoding

v: variable

v: system

v: copy

v: src

v: countryCoding

v: variable

v: code

v: evaluate

value: Id
  v: address

value: String
  v: country.code

v: src

v: countryCoding

v: variable

v: display

v: evaluate

value: Id
  v: address

value: String
  v: country.display

name:
  v: setPatientAddress
source:
  context:
    v: src
  element:
    v: address
  variable:
    v: address
  condition:
    v: $this.country.empty()
target:
  context:
    v: tgt
  context type:
    v: variable
  element:
    v: address
  variable:
    v: addr
rule:
  source:
    context:
      v: src
  target:
    context:
      v: addr
    context type:
      v: variable
    element:
      v: line
    transform:
      v: evaluate
    parameter:
      value: Id
        v: address
    parameter:
      value: String
        v: addressEntry1
rule:
  source:
    context:
      v: src
  target:
    context:
      v: addr
    context type:
      v: variable
    element:
      v: line
    transform:
      v: evaluate
    parameter:
      value: Id
        v: address
    parameter:
      value: String
        v: addressEntry2
rule:
  source:
    context:
      v: src
  target:
    context:
      v: addr
    context type:
      v: variable
    element:
      v: line
    transform:
      v: evaluate
    parameter:
      value: Id
        v: address
    parameter:
      value: String
        v: addressEntry3
rule:
  source:
    context:
      v: src
  target:
    context:
      v: addr
    context type:
      v: variable
    element:
      v: line
    transform:
      v: evaluate
    parameter:
      value: Id
        v: address
    parameter:
      value: String
        v: addressEntry4
rule:
  source:
    context:
      v: src
  target:
    context:
      v: addr
    context type:
      v: variable
    element:
      v: postalCode
    transform:
      v: evaluate
    parameter:
      value: Id
        v: address
    parameter:
      value: String
        v: postCode

name:
  v: setPatientMaritalStatus
source:
  context:
    v: src
  element:
    v: demographics
  variable:
    v: demographics
source:
  context:
    v: demographics
  element:
    v: maritalStatus
  variable:
    v: maritalStatus
source:
  context:
    v: maritalStatus
  element:
    v: code
  variable:
    v: maritalStatusCode
source:
  context:
    v: maritalStatus
  element:
    v: display
  variable:
    v: maritalStatusDisplay
rule:
  source:
    context:
      v: src
  target:
    context:
      v: tgt
    context type:
      v: variable
    element:
      v: maritalStatus
    variable:
      v: msvt
    transform:
      v: create
    parameter:
      value: String
        v: CodeableConcept
  target:
    context:
      v: msvt
    context type:
      v: variable
    element:
      v: coding
    variable:
      v: maritalStatusCoding
    transform:
      v: create
    parameter:
      value: String
        v: Coding
  rule:
    source:
      context:
        v: src
    target:
      context:
        v: maritalStatusCoding
      context type:
        v: variable
      element:
        v: system
      transform:
        v: copy
      parameter:
        value: String
  rule:
    source:
      context:
        v: src
    target:
      context:
        v: maritalStatusCoding
      context type:
        v: variable
      element:
        v: code
      transform:
        v: copy
      parameter:
        value: Id
  rule:
    source:
      context:
        v: src
    target:
      context:
        v: maritalStatusCoding
      context type:
        v: variable
      element:
        v: display
      transform:
        v: copy
      parameter:
        value: Id

Id
v: maritalStatusCode

Id
v: maritalStatusDisplay

name:
  v: setFirstLanguage
source:
  context:
    v: src
  element:
    v: demographics
  variable:
    v: demographics
source:
  context:
    v: demographics
  element:
    v: firstLanguage
  variable:
    v: firstLanguage
rule:
  source:
    context:
      v: src
  target:
    context:
      v: tgt
    context type:
      v: variable
    element:
      v: communication
    variable:
      v: communication
  target:
    context:
      v: communication
    context type:
      v: variable
    element:
      v: language
    variable:
      v: firstLang
  target:
    context:
      v: firstLang
    context type:
      v: variable
    element:
      v: coding
    variable:
      v: firstLangCoding
  rule:
    source:
      context:
        v: src
    target:
      context:
        v: communication
      context type:
        v: variable
      element:
        v: preferred
      transform:
        v: copy
      parameter:
        value: Boolean
  rule:
    source:
      context:
        v: src
    target:
      context:
        v: firstLangCoding
      context type:
        v: variable
      element:
        v: system
      transform:
        v: copy
      parameter:
        value: String
  rule:
    source:
      context:
        v: src
    target:
      context:
        v: firstLangCoding
      context type:
        v: variable
      element:
        v: code
      transform:
        v: evaluate
      parameter:
        value: Id
      parameter:
        value: String
  rule:
    source:
      context:
        v: src
    target:
      context:
        v: firstLangCoding
      context type:
        v: variable
      element:
        v: display
      transform:
        v: evaluate
      parameter:
        value: Id
      parameter:
        value: String

Boolean
v: true

String
v: urn:ietf:bcp:47

Id
v: firstLanguage

String
v: code

Id
v: firstLanguage

String
v: display

name:
  v: setOtherLanguage
source:
  context:
    v: src
  element:
    v: demographics
  variable:
    v: demographics
source:
  context:
    v: demographics
  element:
    v: otherLanguage
  variable:
    v: otherLanguage
rule:
  source:
    context:
      v: src
  target:
    context:
      v: tgt
    context type:
      v: variable
    element:
      v: communication
    variable:
      v: communication
  target:
    context:
      v: communication
    context type:
      v: variable
    element:
      v: language
    variable:
      v: otherLang
  target:
    context:
      v: otherLang
    context type:
      v: variable
    element:
      v: coding
    variable:
      v: otherLangCoding
  rule:
    source:
      context:
        v: src
    target:
      context:
        v: otherLangCoding
      context type:
        v: variable
      element:
        v: system
      transform:
        v: copy
      parameter:
        value: String
  rule:
    source:
      context:
        v: src
    target:
      context:
        v: otherLangCoding
      context type:
        v: variable
      element:
        v: code
      transform:
        v: evaluate
      parameter:
        value: Id
      parameter:
        value: String
  rule:
    source:
      context:
        v: src
    target:
      context:
        v: otherLangCoding
      context type:
        v: variable
      element:
        v: display
      transform:
        v: evaluate
      parameter:
        value: Id
      parameter:
        value: String

String
v: urn:ietf:bcp:47

Id
v: otherLanguage

String
v: code

Id
v: otherLanguage

String
v: display

name:
  v: setInterpreterRequired
source:
  context:
    v: src
  element:
    v: demographics
  variable:
    v: demographics
source:
  context:
    v: demographics
  element:
    v: interpreterRequired
  variable:
    v: interpreterRequired
  condition:
    v: $this!='Unknown'
rule:
  source:
    context:
      v: src
  target:
    context:
      v: tgt
    context type:
      v: variable
    element:
      v: extension
    variable:
      v: interpreterRequiredExt
  rule:
    source:
      context:
        v: src
    target:
      context:
        v: interpreterRequiredExt
      context type:
        v: variable
      element:
        v: url
      transform:
        v: copy
      parameter:
        value: String
  rule:
    source:
      context:
        v: src
    target:
      context:
        v: interpreterRequiredExt
      context type:
        v: variable
      element:
        v: valueBoolean
      transform:
        v: evaluate
      parameter:
        value: Id
      parameter:
        value: String

Id
v: interpreterRequired

String
v: toBoolean()

name:
  v: contactDetails
source:
  context:
    v: src
  element:
    v: contactDetails
  variable:
    v: emailContactDetails
rule:
  name:
    v: setPatientEmailAddress
  source:
    context:
      v: emailContactDetails
    element:
      v: emailAddressDetails
    variable:
      v: emailAddressDetails
  target:
    context:
      v: tgt
    context type:
      v: variable
    element:
      v: telecom
    variable:
      v: telecom
  rule:
    source:
      context:
        v: src
    target:
      context:
        v: telecom
      context type:
        v: variable
      element:
        v: system
      transform:
        v: copy
      parameter:
        value: String
  rule:
    source:
      context:
        v: src
    target:
      context:
        v: telecom
      context type:
        v: variable
      element:
        v: value
      transform:
        v: evaluate
      parameter:
        value: Id
      parameter:
        value: String
  rule:
    source:
      context:
        v: src
    target:
      context:
        v: telecom
      context type:
        v: variable
      element:
        v: rank
      transform:
        v: evaluate
      parameter:
        value: Id
      parameter:
        value: String
  rule:
    source:
      context:
        v: src
    target:
      context:
        v: src
      context type:
        v: variable
      element:
        v: emailAddressType
      variable:
        v: etvt
      transform:
        v: create
      parameter:
        value: String
rule:
  name:
    v: contactDetails
  source:
    context:
      v: src
    element:
      v: contactDetails
    variable:
      v: telephoneContactDetails
  rule:
    name:
      v: setPatientTelephone
    source:
      context:
        v: telephoneContactDetails
      element:
        v: telephoneDetails
      variable:
        v: telephoneNumberDetails
    target:
      context:
        v: tgt
      context type:
        v: variable
      element:
        v: telecom
      variable:
        v: telecom
  rule:
    name:
      v: setDeathDetails
    source:
      context:
        v: src
      element:
        v: deathDetails
      variable:
        v: deathDetails
  rule:
    name:
      v: setPatientManagingOrganization
    source:
      context:
        v: src
      element:
        v: careProvider
      variable:
        v: careProvider
    target:
      context:
        v: tgt
      context type:
        v: variable
      element:
        v: extension
      variable:
        v: careProviderExt
  rule:
    name:
      v: setPatientGeneralPractitioner
    source:
      context:
        v: src
      element:
        v: generalPractice
      variable:
        v: generalPractice
    target:
      context:
        v: tgt
      context type:
        v: variable
      element:
        v: generalPractitioner
      variable:
        v: generalPractitioner
    rule:
      name:
        v: setPatientGeneralPractitionerIdentifier

String
v: email

Id
v: emailAddressDetails

String
v: emailAddress

Id
v: emailAddressDetails

String
v: preferredOrder

String
v: Coding

v: src

v: etvt

v: variable

v: system

v: copy

v: src

v: etvt

v: variable

v: code

v: evaluate

value: Id
  v: emailAddressDetails

value: String
  v: type.code

v: src

v: telecom

v: variable

v: use

v: translate

value: Id
  v: etvt

value: String
  v: code

v: src

v: telecom

v: variable

v: extension

v: emailTypeExt

context:
  v: src

context:
  v: emailTypeExt
context type:
  v: variable
element:
  v: url
transform:
  v: copy
parameter:
  value: String
    v: https://metadata.phase2.scip.synanetics.cloud/fhir/r4/StructureDefinition/Extension-MODS-PersonEmailAddressType

context:
  v: src

context:
  v: emailTypeExt
context type:
  v: variable
element:
  v: valueCoding
variable:
  v: emailTypeValueCoding

source:
  context:
    v: src
target:
  context:
    v: emailTypeValueCoding
  context type:
    v: variable
  element:
    v: system
  transform:
    v: copy
  parameter:
    value: String
      v: https://metadata.phase2.scip.synanetics.cloud/fhir/r4/CodeSystem/MODS-EmailAddressType-1

source:
  context:
    v: src
target:
  context:
    v: emailTypeValueCoding
  context type:
    v: variable
  element:
    v: code
  transform:
    v: evaluate
  parameter:
    value: Id
      v: emailAddressDetails
  parameter:
    value: String
      v: type.code

source:
  context:
    v: src
target:
  context:
    v: emailTypeValueCoding
  context type:
    v: variable
  element:
    v: display
  transform:
    v: evaluate
  parameter:
    value: Id
      v: emailAddressDetails
  parameter:
    value: String
      v: type.display

v: src

v: telecom

v: variable

v: system

v: copy

value: String
  v: phone

v: src

v: telecom

v: variable

v: value

v: evaluate

value: Id
  v: telephoneNumberDetails

value: String
  v: telephoneNumber

v: src

v: telecom

v: variable

v: rank

v: evaluate

value: Id
  v: telephoneNumberDetails

value: String
  v: preferredOrder

v: src

v: src

v: variable

v: telephoneType

v: ttvt

v: create

value: String
  v: Coding

context:
  v: src

context:
  v: ttvt
context type:
  v: variable
element:
  v: system
transform:
  v: copy
parameter:
  value: String
    v: https://data.digitisingsocialcare.co.uk/mods/v1/person-telephone-type

context:
  v: src

context:
  v: ttvt
context type:
  v: variable
element:
  v: code
transform:
  v: evaluate
parameter:
  value: Id
    v: telephoneNumberDetails
parameter:
  value: String
    v: type.code

context:
  v: src

context:
  v: telecom
context type:
  v: variable
element:
  v: use
transform:
  v: translate
parameter:
  value: Id
    v: ttvt
parameter:
  value: String
    v: https://metadata.phase2.scip.synanetics.cloud/fhir/r4/ConceptMap/MODS-FHIRTelephoneContactPointUse-1
parameter:
  value: String
    v: code

v: src

v: telecom

v: variable

v: extension

v: telephoneTypeExt

context:
  v: src

context:
  v: telephoneTypeExt
context type:
  v: variable
element:
  v: url
transform:
  v: copy
parameter:
  value: String
    v: https://metadata.phase2.scip.synanetics.cloud/fhir/r4/StructureDefinition/Extension-MODS-PersonTelephoneNumberType

context:
  v: src

context:
  v: telephoneTypeExt
context type:
  v: variable
element:
  v: valueCoding
variable:
  v: telephoneNumberTypeCoding

source:
  context:
    v: src
target:
  context:
    v: telephoneNumberTypeCoding
  context type:
    v: variable
  element:
    v: system
  transform:
    v: copy
  parameter:
    value: String
      v: https://metadata.phase2.scip.synanetics.cloud/fhir/r4/CodeSystem/MODS-TelephoneNumberType-1

source:
  context:
    v: src
target:
  context:
    v: telephoneNumberTypeCoding
  context type:
    v: variable
  element:
    v: code
  transform:
    v: evaluate
  parameter:
    value: Id
      v: telephoneNumberDetails
  parameter:
    value: String
      v: type.code

source:
  context:
    v: src
target:
  context:
    v: telephoneNumberTypeCoding
  context type:
    v: variable
  element:
    v: display
  transform:
    v: evaluate
  parameter:
    value: Id
      v: telephoneNumberDetails
  parameter:
    value: String
      v: type.display

v: src

v: tgt

v: variable

v: extension

v: deathDetailsExt

context:
  v: src

context:
  v: deathDetailsExt
context type:
  v: variable
element:
  v: url
transform:
  v: copy
parameter:
  value: String
    v: https://metadata.phase2.scip.synanetics.cloud/fhir/r4/StructureDefinition/Extension-MODS-PersonDeathDetails

v: setDeathCauseIdentificationMethod

context:
  v: src

context:
  v: deathDetailsExt
context type:
  v: variable
element:
  v: extension
variable:
  v: deathCauseIdentificationMethodExt

source:
  context:
    v: src
target:
  context:
    v: deathCauseIdentificationMethodExt
  context type:
    v: variable
  element:
    v: url
  transform:
    v: copy
  parameter:
    value: String
      v: deathCauseIdentificationMethod

source:
  context:
    v: src
target:
  context:
    v: deathCauseIdentificationMethodExt
  context type:
    v: variable
  element:
    v: valueCoding
  variable:
    v: deathCauseIdentificationMethodCoding
rule:
  source:
    context:
      v: src
  target:
    context:
      v: deathCauseIdentificationMethodCoding
    context type:
      v: variable
    element:
      v: system
    transform:
      v: copy
    parameter:
      value: String
        v: https://metadata.phase2.scip.synanetics.cloud/fhir/r4/CodeSystem/MODS-DeathCauseIdentificationMethod-1
rule:
  source:
    context:
      v: src
  target:
    context:
      v: deathCauseIdentificationMethodCoding
    context type:
      v: variable
    element:
      v: code
    transform:
      v: evaluate
    parameter:
      value: Id
        v: deathDetails
    parameter:
      value: String
        v: deathCauseIdentificationMethod.code
rule:
  source:
    context:
      v: src
  target:
    context:
      v: deathCauseIdentificationMethodCoding
    context type:
      v: variable
    element:
      v: display
    transform:
      v: evaluate
    parameter:
      value: Id
        v: deathDetails
    parameter:
      value: String
        v: deathCauseIdentificationMethod.display

v: setDeathLocationType

context:
  v: src

context:
  v: deathDetailsExt
context type:
  v: variable
element:
  v: extension
variable:
  v: deathLocationTypeExt

source:
  context:
    v: src
target:
  context:
    v: deathLocationTypeExt
  context type:
    v: variable
  element:
    v: url
  transform:
    v: copy
  parameter:
    value: String
      v: deathLocationType

source:
  context:
    v: src
target:
  context:
    v: deathLocationTypeExt
  context type:
    v: variable
  element:
    v: valueCoding
  variable:
    v: deathLocationTypeCoding
rule:
  source:
    context:
      v: src
  target:
    context:
      v: deathLocationTypeCoding
    context type:
      v: variable
    element:
      v: system
    transform:
      v: copy
    parameter:
      value: String
        v: https://metadata.phase2.scip.synanetics.cloud/fhir/r4/CodeSystem/MODS-DeathLocationTypeCode-1
rule:
  source:
    context:
      v: src
  target:
    context:
      v: deathLocationTypeCoding
    context type:
      v: variable
    element:
      v: code
    transform:
      v: evaluate
    parameter:
      value: Id
        v: deathDetails
    parameter:
      value: String
        v: deathLocationType.code
rule:
  source:
    context:
      v: src
  target:
    context:
      v: deathLocationTypeCoding
    context type:
      v: variable
    element:
      v: display
    transform:
      v: evaluate
    parameter:
      value: Id
        v: deathDetails
    parameter:
      value: String
        v: deathLocationType.display

v: setPersonDeathLocationDiscussed

context:
  v: src

context:
  v: deathDetailsExt
context type:
  v: variable
element:
  v: extension
variable:
  v: personDeathLocationDiscussedExt

source:
  context:
    v: src
target:
  context:
    v: personDeathLocationDiscussedExt
  context type:
    v: variable
  element:
    v: url
  transform:
    v: copy
  parameter:
    value: String
      v: preferredLocationOfDeathDiscussed

source:
  context:
    v: src
target:
  context:
    v: personDeathLocationDiscussedExt
  context type:
    v: variable
  element:
    v: valueCoding
  variable:
    v: personDeathLocationDiscussedCoding
rule:
  source:
    context:
      v: src
  target:
    context:
      v: personDeathLocationDiscussedCoding
    context type:
      v: variable
    element:
      v: system
    transform:
      v: copy
    parameter:
      value: String
        v: https://metadata.phase2.scip.synanetics.cloud/fhir/r4/CodeSystem/MODS-PersonDeathLocationDiscussedIndicator-1
rule:
  source:
    context:
      v: src
  target:
    context:
      v: personDeathLocationDiscussedCoding
    context type:
      v: variable
    element:
      v: code
    transform:
      v: evaluate
    parameter:
      value: Id
        v: deathDetails
    parameter:
      value: String
        v: preferredDeathLocationDiscussed.code
rule:
  source:
    context:
      v: src
  target:
    context:
      v: personDeathLocationDiscussedCoding
    context type:
      v: variable
    element:
      v: display
    transform:
      v: evaluate
    parameter:
      value: Id
        v: deathDetails
    parameter:
      value: String
        v: preferredDeathLocationDiscussed.display

v: setDeathNotAtPreferredLocationReason

context:
  v: src

context:
  v: deathDetailsExt
context type:
  v: variable
element:
  v: extension
variable:
  v: deathNotAtPreferredLocationReasonExt

source:
  context:
    v: src
target:
  context:
    v: deathNotAtPreferredLocationReasonExt
  context type:
    v: variable
  element:
    v: url
  transform:
    v: copy
  parameter:
    value: String
      v: deathNotAtPreferredLocationReason

source:
  context:
    v: src
target:
  context:
    v: deathNotAtPreferredLocationReasonExt
  context type:
    v: variable
  element:
    v: valueCoding
  variable:
    v: deathNotAtPreferredLocationReasonCoding
rule:
  source:
    context:
      v: src
  target:
    context:
      v: deathNotAtPreferredLocationReasonCoding
    context type:
      v: variable
    element:
      v: system
    transform:
      v: copy
    parameter:
      value: String
        v: https://metadata.phase2.scip.synanetics.cloud/fhir/r4/CodeSystem/MODS-DeathNotAtPreferredLocationReasonCode-1
rule:
  source:
    context:
      v: src
  target:
    context:
      v: deathNotAtPreferredLocationReasonCoding
    context type:
      v: variable
    element:
      v: code
    transform:
      v: evaluate
    parameter:
      value: Id
        v: deathDetails
    parameter:
      value: String
        v: deathNotAtPreferredLocationReason.code
rule:
  source:
    context:
      v: src
  target:
    context:
      v: deathNotAtPreferredLocationReasonCoding
    context type:
      v: variable
    element:
      v: display
    transform:
      v: evaluate
    parameter:
      value: Id
        v: deathDetails
    parameter:
      value: String
        v: deathNotAtPreferredLocationReason.display

v: setPersonAtRiskOfUnexpectedDeath

context:
  v: src

context:
  v: deathDetailsExt
context type:
  v: variable
element:
  v: extension
variable:
  v: personAtRiskOfUnexpectedDeathExt

source:
  context:
    v: src
target:
  context:
    v: personAtRiskOfUnexpectedDeathExt
  context type:
    v: variable
  element:
    v: url
  transform:
    v: copy
  parameter:
    value: String
      v: personAtRiskOfUnexpectedDeath

source:
  context:
    v: src
target:
  context:
    v: personAtRiskOfUnexpectedDeathExt
  context type:
    v: variable
  element:
    v: valueCoding
  variable:
    v: personAtRiskOfUnexpectedDeathCoding
rule:
  source:
    context:
      v: src
  target:
    context:
      v: personAtRiskOfUnexpectedDeathCoding
    context type:
      v: variable
    element:
      v: system
    transform:
      v: copy
    parameter:
      value: String
        v: https://metadata.phase2.scip.synanetics.cloud/fhir/r4/CodeSystem/MODS-PersonAtRiskOfUnexpectedDeathIndicator-1
rule:
  source:
    context:
      v: src
  target:
    context:
      v: personAtRiskOfUnexpectedDeathCoding
    context type:
      v: variable
    element:
      v: code
    transform:
      v: evaluate
    parameter:
      value: Id
        v: deathDetails
    parameter:
      value: String
        v: personAtRiskOfUnexpectedDeath.code
rule:
  source:
    context:
      v: src
  target:
    context:
      v: personAtRiskOfUnexpectedDeathCoding
    context type:
      v: variable
    element:
      v: display
    transform:
      v: evaluate
    parameter:
      value: Id
        v: deathDetails
    parameter:
      value: String
        v: personAtRiskOfUnexpectedDeath.display

v: setPersonDateOfDeath

context:
  v: src

context:
  v: deathDetailsExt
context type:
  v: variable
element:
  v: extension
variable:
  v: personDateOfDeathExt

source:
  context:
    v: src
target:
  context:
    v: personDateOfDeathExt
  context type:
    v: variable
  element:
    v: url
  transform:
    v: copy
  parameter:
    value: String
      v: personDateOfDeath

source:
  context:
    v: src
target:
  context:
    v: personDateOfDeathExt
  context type:
    v: variable
  element:
    v: valueDate
  transform:
    v: evaluate
  parameter:
    value: Id
      v: deathDetails
  parameter:
    value: String
      v: personDeathDate

v: setPersonDateOfTime

context:
  v: src

context:
  v: deathDetailsExt
context type:
  v: variable
element:
  v: extension
variable:
  v: personTimeOfDeathExt

source:
  context:
    v: src
target:
  context:
    v: personTimeOfDeathExt
  context type:
    v: variable
  element:
    v: url
  transform:
    v: copy
  parameter:
    value: String
      v: personTimeOfDeath

source:
  context:
    v: src
target:
  context:
    v: personTimeOfDeathExt
  context type:
    v: variable
  element:
    v: valueTime
  transform:
    v: evaluate
  parameter:
    value: Id
      v: deathDetails
  parameter:
    value: String
      v: personDeathTime

v: src

v: tgt

v: variable

v: deceasedDateTime

v: evaluate

value: Id
  v: deathDetails

value: String
  v: personDateOfDeath

v: src

v: careProviderExt

v: variable

v: url

v: copy

v: src

v: careProviderExt

v: variable

v: valueReference

v: careProviderReference

context:
  v: src

context:
  v: careProviderReference
context type:
  v: variable
element:
  v: reference
transform:
  v: evaluate
parameter:
  value: Id
    v: careProvider
parameter:
  value: String
    v: 'Organization/'+id

context:
  v: src

context:
  v: careProviderReference
context type:
  v: variable
element:
  v: display
transform:
  v: evaluate
parameter:
  value: Id
    v: careProvider
parameter:
  value: String
    v: display

context:
  v: src

context:
  v: careProviderReference
context type:
  v: variable
element:
  v: identifier
variable:
  v: careProviderReferenceIdentifier

source:
  context:
    v: src
target:
  context:
    v: careProviderReferenceIdentifier
  context type:
    v: variable
  element:
    v: value
  transform:
    v: evaluate
  parameter:
    value: Id
      v: careProvider
  parameter:
    value: String
      v: id

v: src

v: generalPractitioner

v: variable

v: identifier

v: gpIdentifier

context:
  v: src

context:
  v: gpIdentifier
context type:
  v: variable
element:
  v: use
transform:
  v: copy
parameter:
  value: String
    v: official

context:
  v: src

context:
  v: gpIdentifier
context type:
  v: variable
element:
  v: system
transform:
  v: copy
parameter:
  value: String
    v: https://fhir.nhs.uk/Id/ods-organization-code

context:
  v: src

context:
  v: gpIdentifier
context type:
  v: variable
element:
  v: value
transform:
  v: evaluate
parameter:
  value: Id
    v: generalPractice
parameter:
  value: String
    v: id

v: src

v: generalPractitioner

v: variable

v: display

v: evaluate

value: Id
  v: generalPractice

value: String
  v: display