Release 4

This page is part of the FHIR Specification (v4.0.1: R4 - Mixed Normative and STU) in it's permanent home (it will always be available at this URL). The current version which supercedes this version is 5.0.0. For a full list of available versions, see the Directory of published versions . Page versions: R5 R4B R4 R3

Patient Administration Work GroupMaturity Level: N/AStandards Status: InformativeSecurity Category: Patient Compartments: Patient, Practitioner, RelatedPerson

R3 : R4 Conversion maps for Patient.

Functional status for this map: 16 tests that all execute ok. All tests pass round-trip testing and all r3 resources are valid. (see documentation)

map "http://hl7.org/fhir/StructureMap/Patient3to4" = "R3 to R4 Conversions for Patient"

uses "http://hl7.org/fhir/3.0/StructureDefinition/Patient" alias PatientR3 as source
uses "http://hl7.org/fhir/StructureDefinition/Patient" alias Patient as target

imports "http://hl7.org/fhir/StructureMap/*3to4"

group Patient(source src : PatientR3, target tgt : Patient) extends DomainResource <<type+>> {
  src.identifier -> tgt.identifier;
  src.active -> tgt.active;
  src.name -> tgt.name;
  src.telecom -> tgt.telecom;
  src.gender -> tgt.gender;
  src.birthDate -> tgt.birthDate;
  src.deceased : boolean as vs -> tgt.deceased = create('boolean') as vt then boolean(vs, vt);
  src.deceased : dateTime as vs -> tgt.deceased = create('dateTime') as vt then dateTime(vs, vt);
  src.address -> tgt.address;
  src.maritalStatus -> tgt.maritalStatus;
  src.multipleBirth : boolean as vs -> tgt.multipleBirth = create('boolean') as vt then boolean(vs, vt);
  src.multipleBirth : integer as vs -> tgt.multipleBirth = create('integer') as vt then integer(vs, vt);
  src.photo -> tgt.photo;
  src.contact as vs0 -> tgt.contact as vt0 then contact(vs0, vt0);
  src.animal as vs0 -> tgt.extension as vt0 then animal(vs0, vt0);
  src.communication as vs0 -> tgt.communication as vt0 then communication(vs0, vt0);
  src.generalPractitioner -> tgt.generalPractitioner;
  src.managingOrganization -> tgt.managingOrganization;
  src.link as vs0 -> tgt.link as vt0 then link(vs0, vt0);
}

group contact(source src, target tgt) extends BackboneElement {
  src.relationship -> tgt.relationship;
  src.name -> tgt.name;
  src.telecom -> tgt.telecom;
  src.address -> tgt.address;
  src.gender -> tgt.gender;
  src.organization -> tgt.organization;
  src.period -> tgt.period;
}

group animal(source src, target tgt) extends Element {
  src -> tgt.url = 'http://hl7.org/fhir/StructureDefinition/patient-animal' "animal";
  src.species as vs ->  tgt.extension as ext,  ext.url = 'species',  ext.value = vs;
  src.breed as vs ->  tgt.extension as ext,  ext.url = 'breed',  ext.value = vs;
  src.genderStatus as vs ->  tgt.extension as ext,  ext.url = 'genderStatus',  ext.value = vs;
}

group communication(source src, target tgt) extends BackboneElement {
  src.language -> tgt.language;
  src.preferred -> tgt.preferred;
}

group link(source src, target tgt) extends BackboneElement {
  src.other -> tgt.other;
  src.type -> tgt.type;
}


map "http://hl7.org/fhir/StructureMap/Patient4to3" = "R4 to R3 Conversion for Patient"

uses "http://hl7.org/fhir/StructureDefinition/Patient" alias Patient as source
uses "http://hl7.org/fhir/3.0/StructureDefinition/Patient" alias PatientR3 as target

imports "http://hl7.org/fhir/StructureMap/*4to3"

group Patient(source src : Patient, target tgt : PatientR3) extends DomainResource <<type+>> {
  src.identifier -> tgt.identifier;
  src.active -> tgt.active;
  src.name -> tgt.name;
  src.telecom -> tgt.telecom;
  src.gender -> tgt.gender;
  src.birthDate -> tgt.birthDate;
  src.deceased : boolean as vs -> tgt.deceased = create('boolean') as vt then boolean(vs, vt);
  src.deceased : dateTime as vs -> tgt.deceased = create('dateTime') as vt then dateTime(vs, vt);
  src.address -> tgt.address;
  src.maritalStatus -> tgt.maritalStatus;
  src.multipleBirth : boolean as vs -> tgt.multipleBirth = create('boolean') as vt then boolean(vs, vt);
  src.multipleBirth : integer as vs -> tgt.multipleBirth = create('integer') as vt then integer(vs, vt);
  src.photo -> tgt.photo;
  src.contact as vs0 -> tgt.contact as vt0 then contact(vs0, vt0);
  src.extension as vs0 where url = 'http://hl7.org/fhir/StructureDefinition/patient-animal' -> tgt.animal as vt0 then animal(vs0, vt0) "animal";
  src.communication as vs0 -> tgt.communication as vt0 then communication(vs0, vt0);
  src.generalPractitioner -> tgt.generalPractitioner;
  src.managingOrganization -> tgt.managingOrganization;
  src.link as vs0 -> tgt.link as vt0 then link(vs0, vt0);
}

group contact(source src, target tgt) extends BackboneElement {
  src.relationship -> tgt.relationship;
  src.name -> tgt.name;
  src.telecom -> tgt.telecom;
  src.address -> tgt.address;
  src.gender -> tgt.gender;
  src.organization -> tgt.organization;
  src.period -> tgt.period;
}

group animal(source src, target tgt) {
  src.extension as ext where url = 'species' then {
    ext.value as vs0 -> tgt.species = vs0 "species2";
  } "species";
  src.extension as ext where url = 'breed' then {
    ext.value as vs0 -> tgt.breed = vs0 "breed";
  } "breed";
  src.extension as ext where url = 'genderStatus' then {
    ext.value as vs0 -> tgt.genderStatus = vs0 "genderStatus";
  } "genderStatus";
}

group communication(source src, target tgt) extends BackboneElement {
  src.language -> tgt.language;
  src.preferred -> tgt.preferred;
}

group link(source src, target tgt) extends BackboneElement {
  src.other -> tgt.other;
  src.type -> tgt.type;
}


<p>No validation errors - all conversions are clean</p>