WHO Immunization Implementation Guide
0.2.0 - ci-build

WHO Immunization Implementation Guide, published by WHO. This guide is not an authorized publication; it is the continuous build for version 0.2.0 built by the FHIR (HL7® FHIR® Standard) CI Build. This version is based on the current content of https://github.com/WorldHealthOrganization/smart-immunizations/ and changes regularly. See the Directory of published versions

StructureMap:

Official URL: http://smart.who.int/immunizations/StructureMap/IMMZCLMToPatient Version: 0.2.0
Draft as of 2024-12-18 Computable Name: IMMZCLMToPatient

Immunization Client Registry - Transform Logical Model to Patient resources

Generated Narrative: StructureMap IMMZCLMToPatient

map "http://smart.who.int/immunizations/StructureMap/IMMZCLMToPatient" = "IMMZCLMToPatient"

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

uses "http://smart.who.int/immunizations/StructureDefinition/IMMZCClientregistration" 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";
}