Snapshot 3: Connectathon 32 Base

This page is part of the FHIR Specification (v5.0.0-snapshot3: R5 Snapshot #3, to support Connectathon 32). 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

Orders and Observations icon Work GroupMaturity Level: N/AStandards Status: InformativeSecurity Category: Not Classified Compartments: Device, Encounter, Patient, Practitioner, RelatedPerson

R4 : R5 Conversion maps for DocumentReference.

Functional status for this map: 1 test of which 1 fail to execute. (see documentation)

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

uses "http://hl7.org/fhir/3.0/StructureDefinition/DocumentReference" alias DocumentReferenceR3 as source
uses "http://hl7.org/fhir/StructureDefinition/DocumentReference" alias DocumentReference as target

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

group DocumentReference(source src : DocumentReferenceR3, target tgt : DocumentReference) extends DomainResource <<type+>> {
  src.masterIdentifier -> tgt.masterIdentifier;
  src.identifier -> tgt.identifier;
  src.status -> tgt.status;
  src.docStatus -> tgt.docStatus;
  src.type -> tgt.type;
  src.class -> tgt.category;
  src.subject -> tgt.subject;
  src.indexed -> tgt.date;
  src.created as vs ->  tgt.extension as ext,  ext.url = 'http://hl7.org/fhir/3.0/StructureDefinition/extension-DocumentReference.created',  ext.value = vs;
  src.author -> tgt.author;
  src.authenticator -> tgt.authenticator;
  src.custodian -> tgt.custodian;
  src.relatesTo as vs0 -> tgt.relatesTo as vt0 then relatesTo(vs0, vt0);
  src.description -> tgt.description;
  src.securityLabel -> tgt.securityLabel;
  src.content as vs0 -> tgt.content as vt0 then content(vs0, vt0);
  src.context as vs0 -> tgt.context as vt0 then context(vs0, vt0);
}

group relatesTo(source src, target tgt) extends BackboneElement {
  src.code -> tgt.code;
  src.target -> tgt.target;
}

group content(source src, target tgt) extends BackboneElement {
  src.attachment -> tgt.attachment;
  src.format -> tgt.format;
}

group context(source src, target tgt) extends BackboneElement {
  src.encounter -> tgt.encounter;
  src.event -> tgt.event;
  src.period -> tgt.period;
  src.facilityType -> tgt.facilityType;
  src.practiceSetting -> tgt.practiceSetting;
  src.sourcePatientInfo -> tgt.sourcePatientInfo;
  src.related as vs0 -> tgt.related as vt0 then related(vs0, vt0);
}

group related(source src, target tgt) {
  src.identifier as vs0 then Identifier2Reference(vs0, tgt);
  src.ref as vs0 then Reference(vs0, tgt);
}


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

uses "http://hl7.org/fhir/StructureDefinition/DocumentReference" alias DocumentReference as source
uses "http://hl7.org/fhir/3.0/StructureDefinition/DocumentReference" alias DocumentReferenceR3 as target

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

group DocumentReference(source src : DocumentReference, target tgt : DocumentReferenceR3) extends DomainResource <<type+>> {
  src.masterIdentifier -> tgt.masterIdentifier;
  src.identifier -> tgt.identifier;
  src.status -> tgt.status;
  src.docStatus -> tgt.docStatus;
  src.type -> tgt.type;
  src.category -> tgt.class;
  src.subject -> tgt.subject;
  src.date -> tgt.indexed;
  src.extension as ext where url = 'http://hl7.org/fhir/3.0/StructureDefinition/extension-DocumentReference.created' then {
    ext.value as vs0 -> tgt.created = vs0 "created2";
  } "created";
  src.author -> tgt.author;
  src.authenticator -> tgt.authenticator;
  src.custodian -> tgt.custodian;
  src.relatesTo as vs0 -> tgt.relatesTo as vt0 then relatesTo(vs0, vt0);
  src.description -> tgt.description;
  src.securityLabel -> tgt.securityLabel;
  src.content as vs0 -> tgt.content as vt0 then content(vs0, vt0);
  src.context as vs0 -> tgt.context as vt0 then context(vs0, vt0);
}

group relatesTo(source src, target tgt) extends BackboneElement {
  src.code -> tgt.code;
  src.target -> tgt.target;
}

group content(source src, target tgt) extends BackboneElement {
  src.attachment -> tgt.attachment;
  src.format -> tgt.format;
}

group context(source src, target tgt) extends BackboneElement {
  src.encounter -> tgt.encounter;
  src.event -> tgt.event;
  src.period -> tgt.period;
  src.facilityType -> tgt.facilityType;
  src.practiceSetting -> tgt.practiceSetting;
  src.sourcePatientInfo -> tgt.sourcePatientInfo;
  src.related as vs0 -> tgt.related as vt0 then related(vs0, vt0);
}

group related(source src, target tgt) {
  src where reference.exists() -> tgt.ref as vt0 then ReferenceNoIdentifier(src, vt0) "reference";
  src where identifier.exists() -> tgt.identifier as vt0 then Reference2Identifier(src, vt0) "identifier";
}


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