Social Care Interoperability Platform FHIR Implementation Guide
Version: 0.1.0, Status: draft

Social Care Interoperability Platform FHIR Implementation Guide - Local Development build (v0.1.0) built by the FHIR (HL7® FHIR® Standard) Build Tools. See the Directory of published versions

StructureMap: RegistrationToPatient

Official URL: https://metadata.phase2.scip.synanetics.cloud/fhir/r4/StructureMap/Registration-Patient Version: 0.1.0
Draft as of 2026-06-10 Computable Name: RegistrationToPatient

map "https://metadata.phase2.scip.synanetics.cloud/fhir/r4/StructureMap/Registration-Patient" = "RegistrationToPatient"

uses "https://metadata.phase2.scip.synanetics.cloud/fhir/r4/StructureDefinition/MODS-SubjectOfCareRegistration" alias Registration as source
uses "https://metadata.phase2.scip.synanetics.cloud/fhir/r4/StructureDefinition/MODS-Patient" alias Patient as target

group RegistrationPatient(source src : Registration, target tgt : Patient) {
  src -> tgt.id = evaluate(src, subjectOfCareId) "00e9f63a-468b-4175-abc3-425edb549da1";
  src.sex as sex, sex.code as sexCode then {
    src -> src.sex = create('Coding') as sxvt then {
      src -> sxvt.code = sexCode "c52db195-f186-48a1-933f-6a375e486853";
      src -> sxvt.system = 'https://data.digitisingsocialcare.co.uk/mods/v1/person-sex' "128d701d-9bb2-4aa9-a6dc-1ce75928002c";
      src -> tgt.extension as birthSexExt then {
        src -> birthSexExt.url = 'https://fhir.hl7.org.uk/StructureDefinition/Extension-UKCore-BirthSex' "8a0d3b39-8704-4f01-b2e6-62eb860f2548";
        src -> birthSexExt.valueCodeableConcept = translate(sxvt, 'https://metadata.phase2.scip.synanetics.cloud/fhir/r4/ConceptMap/MODS-FHIRBirthSex-1', 'CodeableConcept') "76144650-bd83-480b-ba62-8f1a27bc3d64";
      } "9f7da33c-8344-4704-91c2-0b57ef007b68";
    } "7d587212-b486-4a2c-b645-57388f72da76";
  } "setPatientBirthSex";
  src.genderIdentity as genderIdentity then {
    src -> tgt.extension as genderIdentityExt then {
      src -> genderIdentityExt.url = 'https://metadata.phase2.scip.synanetics.cloud/fhir/r4/StructureDefinition/Extension-MODS-PersonGenderIdentity' "b86ee800-a7b3-4b6c-8b0a-e4b74a8da793";
      src -> genderIdentityExt.valueCodeableConcept as genderIdentityCode then {
        src -> genderIdentityCode.coding as coding then {
          src -> coding.system = 'https://metadata.phase2.scip.synanetics.cloud/fhir/r4/CodeSystem/MODS-PersonGenderIdentityCode-1' "471a74e1-4d16-48c3-adb5-6dd9403cdf03";
          src -> coding.code = evaluate(genderIdentity, code) "d5ef49e5-6c57-447f-9de2-e055041d7881";
          src -> coding.display = evaluate(genderIdentity, display) "e5a014da-130e-4496-a9bd-276391634ab7";
        } "9317e171-7bb6-4a17-b555-85e8ae068abe";
      } "70d24b7d-08a0-47f8-b0c6-8cd12bc5db69";
    } "7cabef6e-d447-4163-a30e-fcaa8d609684";
  } "setGenderIdentity";
  src.ethnicity as ethnicity then {
    src -> tgt.extension as ethnicityExt then {
      src -> ethnicityExt.url = 'https://fhir.hl7.org.uk/StructureDefinition/Extension-UKCore-EthnicCategory' "e0d8ae9b-6278-4eec-9c10-98b3dd3a1817";
      src -> ethnicityExt.valueCodeableConcept as ethnicCategory then {
        src -> ethnicCategory.coding as coding then {
          src -> coding.system = 'https://fhir.hl7.org.uk/CodeSystem/UKCore-EthnicCategoryEngland' "1474ddfc-6586-45cc-b540-9c68116b8314";
          src -> coding.code = evaluate(ethnicity, code) "b2331ab1-2f78-435a-9edc-f56e4cbbd91e";
          src -> coding.display = evaluate(ethnicity, display) "84e9148b-6a7a-4893-a095-4dbf191acd5f";
        } "42214afe-5a03-49f4-890b-8ee3b98db43d";
      } "0e9fe38e-4162-4245-9c27-403b9c496b7b";
    } "ef28cd78-9d21-4ae1-833f-706c456229e9";
  } "setPatientEthnicity";
  src.religion as religion then {
    src -> tgt.extension as religionExt then {
      src -> religionExt.url = 'https://metadata.phase2.scip.synanetics.cloud/fhir/r4/StructureDefinition/Extension-MODS-PersonReligiousAffiliation' "17ec9060-a1d9-48bf-b366-727208c2868a";
      src -> religionExt.valueCodeableConcept as ethnicCategory then {
        src -> ethnicCategory.coding as coding then {
          src -> coding.system = 'https://metadata.phase2.scip.synanetics.cloud/fhir/r4/CodeSystem/MODS-PersonReligionCode-1' "1d8f0381-738b-4b3f-9a34-ad5092bfa80a";
          src -> coding.code = evaluate(religion, code) "7dfb7972-d926-4152-ac31-72600f055196";
          src -> coding.display = evaluate(religion, display) "a70f09c6-7e3d-4c16-801f-92643f80701d";
        } "f68dbcd8-6074-47e1-860b-e8ee5a635e82";
      } "fc88e5fc-2c0f-4bd5-9ac0-834ff55662f0";
    } "68091bd6-0439-4363-b00d-22fd5e412d36";
  } "setPatientReligion";
  src.sexualOrientation as sexualOrientation then {
    src -> tgt.extension as sexualOrientationExt then {
      src -> sexualOrientationExt.url = 'https://metadata.phase2.scip.synanetics.cloud/fhir/r4/StructureDefinition/Extension-MODS-PersonSexualOrientation' "7c361efe-dab9-400b-b8c0-7156638e315f";
      src -> sexualOrientationExt.valueCodeableConcept as sexualOrientationCode then {
        src -> sexualOrientationCode.coding as coding then {
          src -> coding.system = 'http://snomed.info/ct' "b1e7d3a7-c725-43fd-b1c8-4605003c63dc";
          src -> coding.code = evaluate(sexualOrientation, code) "43f81d80-fbea-4d34-9dbc-be6769829e79";
          src -> coding.display = evaluate(sexualOrientation, display) "01541caa-5251-4da2-a1bc-b4fec6ca6042";
        } "2843a89d-3428-4b03-b6e9-4ef3f5252d4c";
      } "5cf21372-9aaf-48c6-a31c-9901eb4c9b7a";
    } "f3827207-622c-4204-90fa-7c4932b33a90";
  } "setPatientSexualOrientation";
  src -> tgt.name as name then {
    src -> name.given = evaluate(src, name.given) "33148443-014d-4b2e-9664-91371189e7e8";
    src -> name.family = evaluate(src, name.family) "4b733097-8d89-4f65-9f53-2cae271dc983";
  } "setPatientName";
  src.nhsNumber -> tgt.identifier as identifier then {
    src -> identifier.use = 'official' "573aa6d2-e287-4c7f-9384-6ed32cec632b";
    src -> identifier.system = 'https://fhir.nhs.uk/Id/nhs-number' "9cd57652-c970-49db-b18f-47fa45fb0a4c";
    src -> identifier.value = evaluate(src, nhsNumber.value) "fe123ed3-ce6e-4002-ac19-559779b0a7b3";
    src -> identifier.extension as extension then {
      src -> extension.url = 'https://fhir.hl7.org.uk/StructureDefinition/Extension-UKCore-NHSNumberVerificationStatus' "9987c016-c7e0-4ba5-b06d-c85de0e59322";
      src -> extension.valueCodeableConcept as cc then {
        src -> cc.coding as coding then {
          src -> coding.system = 'https://fhir.hl7.org.uk/CodeSystem/UKCore-NHSNumberVerificationStatusEngland' "d893cec9-c410-4293-a466-b169183536ec";
          src -> coding.code = evaluate(src, nhsNumber.statusIndicator.code) "dd735001-5d09-4a94-8cb1-449e1605b376";
          src -> coding.display = evaluate(src, nhsNumber.statusIndicator.display) "d553d674-ecc8-4db5-93aa-e6d02d52e5a8";
        } "fad70144-5c22-47f1-b8d9-772bb8d9c10b";
      } "2cc64160-b0e1-42b0-bc94-d7205fb7fbf8";
    } "fd0f942f-748d-4eba-b3be-2698c0c536c8";
  } "setPatientNHSNumber";
  src.nationalInsuranceNumber then {
    src -> tgt.identifier as id then {
      src -> id.system = 'https://fhir.hl7.org.uk/Id/nino' "af99e76d-a473-45df-9554-fab9b6e2db70";
      src -> id.value = evaluate(src, nationalInsuranceNumber) "8bb8bee1-c411-4737-a6c4-206df83420bd";
    } "d98a25d4-6e0a-436c-88d5-c2aed2a5f808";
  } "setNationalInsuranceNumber";
  src.otherIdentifier as otherIdentifier then {
    src -> tgt.identifier as id then {
      src -> id.system = evaluate(otherIdentifier, system) "d347873f-b4bf-4e69-809f-5c2c7ba24d4b";
      src -> id.value = evaluate(otherIdentifier, value) "b0d25559-a31f-41d7-9ea9-bcfece6b05a3";
    } "f9550172-88f7-406a-bc70-3e9c2a8e1366";
  } "setOtherPatientIdentifier";
  src.dateOfBirth -> tgt.birthDate "setPatientBirthDate";
  src.genderIdentity as genderIdentity, genderIdentity.code as genderIdentityCode then {
    src -> src.genderIdentity = create('Coding') as givt then {
      src -> givt.code = genderIdentityCode "2c2eb2c2-e116-4813-854b-c0303a8ed669";
      src -> givt.system = 'https://data.digitisingsocialcare.co.uk/mods/v1/person-gender-identity' "37db9c93-e35e-41c3-bd16-71f7db7076b6";
      src -> tgt.gender = translate(givt, 'https://metadata.phase2.scip.synanetics.cloud/fhir/r4/ConceptMap/MODS-FHIRGenderIdentity-1', 'code') "c73e52e2-26db-452e-b753-8dec5de29f62";
    } "f52f22ab-1fdc-49cc-80b6-89df56379917";
  } "setPatientGender";
  src.maritalStatus as maritalStatus, maritalStatus.code as maritalStatusCode, maritalStatus.display as maritalStatusDisplay then {
    src ->  tgt.maritalStatus = create('CodeableConcept') as msvt,  msvt.coding = create('Coding') as maritalStatusCoding then {
      src -> maritalStatusCoding.system = 'https://fhir.hl7.org.uk/CodeSystem/UKCore-PersonMaritalStatusEngland' "ab18a1f6-745b-42c4-b400-38e6d05c56d0";
      src -> maritalStatusCoding.code = maritalStatusCode "72816b02-924e-4d89-98c7-785d2441d31b";
      src -> maritalStatusCoding.display = maritalStatusDisplay "484279ce-793c-4f99-87b6-bf2ff3d8146e";
    } "189232f8-2b7d-4a39-9cc6-84adb84f99cc";
  } "setPatientMaritalStatus";
  src.homeAddress as address where $this.country.empty().not() -> tgt.address as addr then {
    src -> addr.line = evaluate(address, addressEntry1) "4fba9702-9a20-4c00-b648-92280ab14dc7";
    src -> addr.line = evaluate(address, addressEntry2) "06f68e76-bfd1-45c3-9755-98cf21ec13d6";
    src -> addr.line = evaluate(address, addressEntry3) "b92088b6-c7f1-49e4-9844-1dd096e9adb1";
    src -> addr.line = evaluate(address, addressEntry4) "cf465f0f-f5ac-40a1-8d2b-76d6e7f60e55";
    src -> addr.postalCode = evaluate(address, postCode) "b9fde70f-e324-41b1-b4b8-d52da30aef6f";
    src -> addr.country = evaluate(address, country.display) "d28de831-c35b-471b-8840-8ed66ff15072";
    src -> addr.extension as extension then {
      src -> extension.url = 'https://metadata.phase2.scip.synanetics.cloud/fhir/r4/StructureDefinition/Extension-MODS-AddressCountry' "c1d8a98c-fb31-46f1-b788-92d6ea7a28e5";
      src -> extension.valueCoding as countryCoding then {
        src -> countryCoding.system = 'https://metadata.phase2.scip.synanetics.cloud/fhir/r4/CodeSystem/MODS-Country-1' "fec84c6b-7457-49db-9220-c2d159ec1f4c";
        src -> countryCoding.code = evaluate(address, country.code) "e9b214b1-21a7-448a-b4f2-b3ac053025f0";
        src -> countryCoding.display = evaluate(address, country.display) "38236b3c-20a0-4bd6-bd71-ceeec9892684";
      } "c9d395c8-d66e-43ea-978f-2845ad8ec6cb";
    } "35cd9065-54d7-41ce-88d2-1219c4140f80";
  } "setExtendedPatientAddress";
  src.homeAddress as address where $this.country.empty() -> tgt.address as addr then {
    src -> addr.line = evaluate(address, addressEntry1) "c98b2bba-177b-4fe2-bc52-4f44dbc3c9f4";
    src -> addr.line = evaluate(address, addressEntry2) "4fff75a4-23c2-4c35-9f77-8589de7f71d8";
    src -> addr.line = evaluate(address, addressEntry3) "43620999-78ac-449f-b3d7-5bbad9e8cb26";
    src -> addr.line = evaluate(address, addressEntry4) "00caee37-21ea-4bde-92e5-08a685c280c4";
    src -> addr.postalCode = evaluate(address, postCode) "38fe9452-ee4b-4cbf-b645-460a714c7d53";
  } "setPatientAddress";
}