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 .
Financial Management Work Group Maturity Level : N/A Ballot Standards Status : Informative Security Category : Patient Compartments : Encounter , Patient , Practitioner

R2 : R3 Converson : R4 Conversion maps for VisionPrescription.

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

map "http://hl7.org/fhir/StructureMap/VisionPrescription2to3" = "R2 to R3 Conversions for VisionPrescription"
map "http://hl7.org/fhir/StructureMap/VisionPrescription3to4" = "R3 to R4 Conversions for VisionPrescription"
uses "http://hl7.org/fhir/DSTU2/StructureDefinition/VisionPrescription" alias VisionPrescriptionR2 as source

uses "http://hl7.org/fhir/3.0/StructureDefinition/VisionPrescription" alias VisionPrescriptionR3 as source

uses "http://hl7.org/fhir/StructureDefinition/VisionPrescription" alias VisionPrescription as target
imports "http://hl7.org/fhir/StructureMap/*2to3"

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

group for type+types  VisionPrescription extends DomainResource
  input src : VisionPrescriptionR2 as source
  input tgt : VisionPrescription as target

group VisionPrescription(source src : VisionPrescriptionR3, target tgt : VisionPrescription) extends DomainResource <<type+>> {
  src.identifier -> tgt.identifier;
  src.status -> tgt.status;
  src.patient -> tgt.patient;
  src.encounter -> tgt.encounter;
  src.dateWritten -> tgt.dateWritten;
  src.prescriber -> tgt.prescriber;
  src.reason as v ->  tgt.extension as vt,  vt.url = 'http://hl7.org/fhir/3.0/StructureDefinition/extension-VisionPrescription.Reason',  vt.value = v;
  src.dispense as s -> tgt.lensSpecification as t then dispense(s, t);
}
group dispense(source src, target tgt) extends BackboneElement {
  src.product -> tgt.product;
  src.eye -> tgt.eye;
  src.sphere -> tgt.sphere;
  src.cylinder -> tgt.cylinder;
  src.axis -> tgt.axis;
  src where src.prism.exists() or src.base.exists() -> tgt.prism as t then {
    src.prism -> t.amount;
    src.base -> t.base;
  } "prism";
  src.add -> tgt.add;
  src.power -> tgt.power;
  src.backCurve -> tgt.backCurve;
  src.diameter -> tgt.diameter;
  src.duration -> tgt.duration;
  src.color -> tgt.color;
  src.brand -> tgt.brand;
  src.note -> tgt.note;
}

  "VisionPrescription-identifier" : for src.identifier make tgt.identifier
  "VisionPrescription-dateWritten" : for src.dateWritten make tgt.dateWritten
  "VisionPrescription-patient" : for src.patient make tgt.patient
  "VisionPrescription-prescriber" : for src.prescriber make tgt.prescriber
  "VisionPrescription-encounter" : for src.encounter make tgt.encounter
  "VisionPrescription-reason" : for src.reason make tgt.reason
  "VisionPrescription-dispense" : for src.dispense as vs0 make tgt.dispense as vt0 then vspDispense(vs0, vt0)
endgroup

group vspDispense extends BackboneElement
  input src as source
  input tgt as target
  
  "VisionPrescription.dispense-product" : for src.product as v make tgt.product as d, d.coding as v
  "VisionPrescription.dispense-eye" : for src.eye make tgt.eye
  "VisionPrescription.dispense-sphere" : for src.sphere make tgt.sphere
  "VisionPrescription.dispense-cylinder" : for src.cylinder make tgt.cylinder
  "VisionPrescription.dispense-axis" : for src.axis make tgt.axis
  "VisionPrescription.dispense-prism" : for src.prism make tgt.prism
  "VisionPrescription.dispense-base" : for src.base make tgt.base
  "VisionPrescription.dispense-add" : for src.add make tgt.add
  "VisionPrescription.dispense-power" : for src.power make tgt.power
  "VisionPrescription.dispense-backCurve" : for src.backCurve make tgt.backCurve
  "VisionPrescription.dispense-diameter" : for src.diameter make tgt.diameter
  "VisionPrescription.dispense-duration" : for src.duration make tgt.duration
  "VisionPrescription.dispense-color" : for src.color make tgt.color
  "VisionPrescription.dispense-brand" : for src.brand make tgt.brand
  "VisionPrescription.dispense-note" : for src.notes as v make tgt.note as n, n.text = v
endgroup

map "http://hl7.org/fhir/StructureMap/VisionPrescription3to2" = "R3 to R2 Conversion for VisionPrescription"
map "http://hl7.org/fhir/StructureMap/VisionPrescription4to3" = "R4 to R3 Conversion for VisionPrescription"
uses "http://hl7.org/fhir/StructureDefinition/VisionPrescription" alias VisionPrescription as source
uses "http://hl7.org/fhir/DSTU2/StructureDefinition/VisionPrescription" alias VisionPrescriptionR2 as target
imports "http://hl7.org/fhir/StructureMap/*3to2"
group for type+types  VisionPrescription extends DomainResource
  input src : VisionPrescription as source
  input tgt : VisionPrescriptionR2 as target
  "VisionPrescription-identifier" : for src.identifier make tgt.identifier
  "VisionPrescription-dateWritten" : for src.dateWritten make tgt.dateWritten
  "VisionPrescription-patient" : for src.patient make tgt.patient
  "VisionPrescription-prescriber" : for src.prescriber make tgt.prescriber
  "VisionPrescription-encounter" : for src.encounter make tgt.encounter
  "VisionPrescription-reason" : for src.reason make tgt.reason
  "VisionPrescription-dispense" : for src.dispense as vs0 make tgt.dispense as vt0 then vspDispense(vs0, vt0)
endgroup

uses "http://hl7.org/fhir/3.0/StructureDefinition/VisionPrescription" alias VisionPrescriptionR3 as target

group vspDispense extends BackboneElement
  input src as source
  input tgt as target
  
  "VisionPrescription.dispense-product" : for src.product as v then vpsProduct(v, tgt)
  "VisionPrescription.dispense-eye1" : for src.eye as v where coding.code = 'left' make tgt.eye = "left"
  "VisionPrescription.dispense-eye2" : for src.eye as v where coding.code = 'right' make tgt.eye = "right"
  "VisionPrescription.dispense-sphere" : for src.sphere make tgt.sphere
  "VisionPrescription.dispense-cylinder" : for src.cylinder make tgt.cylinder
  "VisionPrescription.dispense-axis" : for src.axis make tgt.axis
  "VisionPrescription.dispense-prism" : for src.prism make tgt.prism
  "VisionPrescription.dispense-base1" : for src.base make tgt.base
  "VisionPrescription.dispense-add" : for src.add make tgt.add
  "VisionPrescription.dispense-power" : for src.power make tgt.power
  "VisionPrescription.dispense-backCurve" : for src.backCurve make tgt.backCurve
  "VisionPrescription.dispense-diameter" : for src.diameter make tgt.diameter
  "VisionPrescription.dispense-duration" : for src.duration make tgt.duration
  "VisionPrescription.dispense-color" : for src.color make tgt.color
  "VisionPrescription.dispense-brand" : for src.brand make tgt.brand
  "VisionPrescription.dispense-note" : for src.note as n then vspNote(n, tgt)
endgroup

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

group VisionPrescription(source src : VisionPrescription, target tgt : VisionPrescriptionR3) extends DomainResource <<type+>> {
  src.identifier -> tgt.identifier;
  src.status -> tgt.status;
  src.patient -> tgt.patient;
  src.encounter -> tgt.encounter;
  src.dateWritten -> tgt.dateWritten;
  src.prescriber -> tgt.prescriber;
  src.extension as e where url = 'http://hl7.org/fhir/3.0/StructureDefinition/extension-VisionPrescription.reason' then {
    e.value -> tgt.reason;
  };
  src.lensSpecification as s -> tgt.dispense as t then dispense(s, t);
}

group vpsProduct extends Element
  input src as source
  input tgt as target

group dispense(source src, target tgt) extends BackboneElement {
  src.product -> tgt.product;
  src.eye -> tgt.eye;
  src.sphere -> tgt.sphere;
  src.cylinder -> tgt.cylinder;
  src.axis -> tgt.axis;
  src.prism as s then {
    s.amount -> tgt.prism;
    s.base -> tgt.base;
  };
  src.add -> tgt.add;
  src.power -> tgt.power;
  src.backCurve -> tgt.backCurve;
  src.diameter -> tgt.diameter;
  src.duration -> tgt.duration;
  src.color -> tgt.color;
  src.brand -> tgt.brand;
  src.note -> tgt.note;
}

  "VisionPrescription.dispense.product-coding" : for src.coding make tgt.product
endgroup

group vspNote extends Element
  input src as source
  input tgt as target
  
  "VisionPrescription.dispense.note-text" : for src.text make tgt.notes
endgroup

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