WHO Immunization Implementation Guide
1.0.0 - release

This page is part of the Immunizations (v1.0.0: Release) based on FHIR (HL7® FHIR® Standard) R4. This is the current published version in its permanent home (it will always be available at this URL). For a full list of available versions, see the Directory of published versions

StructureMap: IMMZ.C4.LMToPatient

Official URL: http://smart.who.int/immunizations/StructureMap/IMMZ.C4.LMToPatient Version: 1.0.0
Draft as of 2026-10-02 Computable Name: IMMZ.C4.LMToPatient

Immunization Client Registry - Transform Logical Model to Patient resources

map "http://smart.who.int/immunizations/StructureMap/IMMZ.C4.LMToPatient" = "IMMZ.C4.LMToPatient"

// Immunization Client Registry - Transform Logical Model to Patient resources

uses "http://smart.who.int/immunizations/StructureDefinition/IMMZC4" alias IMMZC as source
uses "http://hl7.org/fhir/StructureDefinition/Bundle" alias Bundle as target

// uses "http://hl7.org/fhir/StructureDefinition/Patient" alias Patient as produced
// uses "http://hl7.org/fhir/StructureDefinition/RelatedPerson" alias RelatedPerson as produced
group IMMZCToPatient(source immzc : IMMZC, target bundle : Bundle) {
  immzc -> bundle.type = 'transaction' "SetBundleType";
  immzc ->  uuid() as pid,  bundle.entry as entry,  entry.fullUrl = append('urn:uuid:', pid),  entry.request as request,  request.method = 'PUT',  request.url = append('Patient/', pid),  entry.resource = create('Patient') as patient then {
    immzc -> patient.id = pid "SetId";
    immzc.uniqueId as id -> patient.identifier as identifier then {
      id -> identifier.value = id "SetIdentifierValue";
    } "SetIdentifier";
    immzc -> patient.name as pname then {
      immzc.name as fullName -> pname.text = fullName "SetFullName";
      immzc.firstName as firstName -> pname.given = firstName "SetFirstName";
      immzc.familyName as familyName -> pname.family = familyName "SetFamilyName";
    } "SetName";
    immzc.sex as sex -> patient.gender = translate(sex, 'http://smart.who.int/immunizations/ConceptMap/IMMZ.C.ConceptMap', 'code') "SetGender";
    immzc.dateOfBirth as birthDate -> patient.birthDate = birthDate "SetBirthDate";
    immzc.contactPhoneNumber as phone -> patient.telecom as telecom then {
      phone as content ->  telecom.value = content,  telecom.system = 'phone' "SetPhoneValue";
    } "SetPhone";
    immzc.address as address -> patient.address as taddress then {
      address as content -> taddress.text = content "SetAddressText";
    } "SetAddress";
    immzc.caregiversMultiple as caregiver ->  uuid() as rpid,  bundle.entry as entry,  entry.fullUrl = append('urn:uuid:', rpid),  entry.request as request,  request.method = 'PUT',  request.url = append('RelatedPerson/', rpid),  entry.resource = create('RelatedPerson') as person then {
      caregiver -> person.id = rpid "SetId";
      caregiver ->  person.patient as patient,  patient.reference = append('Patient/', pid) "setPatient";
      caregiver -> person.name as pname then {
        caregiver.caregiversFullName as fullName -> pname.text = fullName "SetFullName";
        caregiver.caregiversFirstName as firstName -> pname.given = firstName "SetFirstName";
        caregiver.caregiversFamilyName as familyName -> pname.family = familyName "SetFamilyName";
      } "SetCaregiverName";
    } "CreateRelatedPerson";
  } "CreatePatient";
}