FHIR Release 3 (STU) Current Build
This page is part of FHIR STU 3 (v3.0.1) in it's permanent home (it will always be available at this URL). It has been superceded by R4 . For a full list of available versions, see the Directory of published versions .
FHIR Infrastructure Orders and Observations Work Group Maturity Level : N/A Ballot Standards Status : Informative Security Category : Patient Compartments : Device , Encounter , Patient , Practitioner

R2 : R3 Converson : R4 Conversion maps for Media.

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

map "http://hl7.org/fhir/StructureMap/Media2to3" = "R2 to R3 Conversions for Media"
map "http://hl7.org/fhir/StructureMap/Media3to4" = "R3 to R4 Conversions for Media"
uses "http://hl7.org/fhir/DSTU2/StructureDefinition/Media" alias MediaR2 as source

uses "http://hl7.org/fhir/3.0/StructureDefinition/Media" alias MediaR3 as source

uses "http://hl7.org/fhir/StructureDefinition/Media" alias Media as target
imports "http://hl7.org/fhir/StructureMap/primitives2to3"
imports "http://hl7.org/fhir/StructureMap/DomainResource2to3"
imports "http://hl7.org/fhir/StructureMap/Attachment2to3"
imports "http://hl7.org/fhir/StructureMap/Identifier2to3"
imports "http://hl7.org/fhir/StructureMap/Reference2to3"
imports "http://hl7.org/fhir/StructureMap/CodeableConcept2to3"
group for type+types  Media extends DomainResource
  input src : MediaR2 as source
  input tgt : Media as target

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

  "Media-identifier" : for src.identifier make tgt.identifier
  "Media-type" : for src.type make tgt.type
  "Media-subtype" : for src.subtype make tgt.subtype
  "Media-view" : for src.view make tgt.view
  "Media-subject" : for src.subject make tgt.subject
  "Media-operator" : for src.operator make tgt.operator
  "Media-deviceName" : for src.deviceName as v make tgt.device as d, d.display = v
  "Media-height" : for src.height make tgt.height
  "Media-width" : for src.width make tgt.width
  "Media-frames" : for src.frames make tgt.frames
  "Media-duration" : for src.duration make tgt.duration
  "Media-content" : for src.content make tgt.content

group Media(source src : MediaR3, target tgt : Media) extends DomainResource <<type+>> {
  src.identifier -> tgt.identifier;
  src.basedOn -> tgt.basedOn;
  src.type as vs0 ->  tgt.type as vt0,  vt0.coding as c,  c.system = 'http://terminology.hl7.org/CodeSystem/media-type',  c.code = vs0;
  src.subtype -> tgt.modality;
  src.view -> tgt.view;
  src.subject -> tgt.subject;
  src.context -> tgt.encounter;
  src.occurrence : dateTime as vs -> tgt.created = create('dateTime') as vt then dateTime(vs, vt);
  src.occurrence : Period as vs -> tgt.created = create('Period') as vt then Period(vs, vt);
  src.operator -> tgt.operator;
  src.reasonCode -> tgt.reasonCode;
  src.bodySite -> tgt.bodySite;
  src.device -> tgt.device;
  src.height -> tgt.height;
  src.width -> tgt.width;
  src.frames -> tgt.frames;
  src.duration -> tgt.duration;
  src.content -> tgt.content;
  src.note -> tgt.note;
}

endgroup

map "http://hl7.org/fhir/StructureMap/Media3to2" = "R3 to R2 Conversion for Media"
map "http://hl7.org/fhir/StructureMap/Media4to3" = "R4 to R3 Conversion for Media"
uses "http://hl7.org/fhir/StructureDefinition/Media" alias Media as source
uses "http://hl7.org/fhir/DSTU2/StructureDefinition/Media" alias MediaR2 as target
imports "http://hl7.org/fhir/StructureMap/primitives3to2"
imports "http://hl7.org/fhir/StructureMap/DomainResource3to2"
imports "http://hl7.org/fhir/StructureMap/Attachment3to2"
imports "http://hl7.org/fhir/StructureMap/Identifier3to2"
imports "http://hl7.org/fhir/StructureMap/Reference3to2"
imports "http://hl7.org/fhir/StructureMap/CodeableConcept3to2"

uses "http://hl7.org/fhir/3.0/StructureDefinition/Media" alias MediaR3 as target

group for type+types  Media extends DomainResource
  input src : Media as source
  input tgt : MediaR2 as target

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

  "Media-identifier" : for src.identifier make tgt.identifier
  "Media-type" : for src.type make tgt.type
  "Media-subtype" : for src.subtype make tgt.subtype
  "Media-view" : for src.view make tgt.view
  "Media-subject" : for src.subject make tgt.subject
  "Media-operator" : for src.operator make tgt.operator
  "Media-deviceName" : for src.device as v then {
    "Media-deviceName-inner" : for v.display make tgt.deviceName
  }
  "Media-height" : for src.height make tgt.height
  "Media-width" : for src.width make tgt.width
  "Media-frames" : for src.frames make tgt.frames
  "Media-duration" : for src.duration make tgt.duration
  "Media-content" : for src.content make tgt.content

group Media(source src : MediaR3, target tgt : Media) extends DomainResource <<type+>> {
  src.identifier -> tgt.identifier;
  src.basedOn -> tgt.basedOn;
  src.type as vs0 then {
    vs0.coding as c where system = 'http://terminology.hl7.org/CodeSystem/media-type' then {
      c.code -> tgt.type;
    };
  };
  src.modality -> tgt.subtype;
  src.view -> tgt.view;
  src.subject -> tgt.subject;
  src.encounter -> tgt.context;
  src.created : dateTime as vs -> tgt.occurrence = create('dateTime') as vt then dateTime(vs, vt);
  src.created : Period as vs -> tgt.occurrence = create('Period') as vt then Period(vs, vt);
  src.operator -> tgt.operator;
  src.reasonCode -> tgt.reasonCode;
  src.bodySite -> tgt.bodySite;
  src.device -> tgt.device;
  src.height -> tgt.height;
  src.width -> tgt.width;
  src.frames -> tgt.frames;
  src.duration -> tgt.duration;
  src.content -> tgt.content;
  src.note -> tgt.note;
}

endgroup

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