FHIR Extensions Pack
5.1.0 - 5.1.0 (April 2024) International flag

This page is part of the FHIR Core Extensions Registry (v5.1.0: Release 5.1) based on FHIR (HL7® FHIR® Standard) v5.0.0. This is the current published version in its permanent home (it will always be available at this URL). For a full list of available versions, see the Directory of published versions

StructureMap: FML Conversion for MedicationRequest: R4B to R5

Official URL: http://hl7.org/fhir/StructureMap/MedicationRequest4Bto5 Version: 5.1.0
Standards status: Trial-use Maturity Level: 1 Computable Name: MedicationRequest4Bto5

FMLConversionforMedicationRequestR4BtoR5

/// url = 'http://hl7.org/fhir/StructureMap/MedicationRequest4Bto5'
/// name = 'MedicationRequest4Bto5'
/// title = 'FML Conversion for MedicationRequest: R4B to R5'
/// status = 'active'

conceptmap "MedicationRequestIntent" {
  prefix s = "http://hl7.org/fhir/4.3/CodeSystem/medicationrequest-intent"
  prefix t = "http://hl7.org/fhir/CodeSystem/medicationrequest-intent"

  s:proposal - t:proposal
  s:plan - t:plan
  s:order - t:order
  s:"original-order" - t:"original-order"
  s:"reflex-order" - t:"reflex-order"
  s:"filler-order" - t:"filler-order"
  s:"instance-order" - t:"instance-order"
  s:option - t:option
}

conceptmap "MedicationRequestPriority" {
  prefix s = "http://hl7.org/fhir/4.3/request-priority"
  prefix t = "http://hl7.org/fhir/request-priority"

  s:routine - t:routine
  s:urgent - t:urgent
  s:asap - t:asap
  s:stat - t:stat
}

conceptmap "MedicationRequestStatus" {
  prefix s = "http://hl7.org/fhir/4.3/CodeSystem/medicationrequest-status"
  prefix t = "http://hl7.org/fhir/CodeSystem/medicationrequest-status"

  s:active - t:active
  s:"on-hold" - t:"on-hold"
  s:stopped - t:stopped
  s:completed - t:completed
  s:cancelled - t:cancelled
  s:"entered-in-error" - t:"entered-in-error"
  s:draft - t:draft
  s:unknown - t:unknown
}

uses "http://hl7.org/fhir/4.3/StructureDefinition/MedicationRequest" alias MedicationRequestR4B as source
uses "http://hl7.org/fhir/StructureDefinition/MedicationRequest" alias MedicationRequestR5 as target

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

group MedicationRequest(source src : MedicationRequestR4B, target tgt : MedicationRequestR5) extends DomainResource <<type+>> {
  src.identifier -> tgt.identifier;
  src.basedOn -> tgt.basedOn;
  src.priorPrescription -> tgt.priorPrescription;
  src.groupIdentifier -> tgt.groupIdentifier;
  src.status as v -> tgt.status = translate(v, '#MedicationRequestStatus', 'code');
  src.statusReason -> tgt.statusReason;
  src.intent as v -> tgt.intent = translate(v, '#MedicationRequestIntent', 'code'); // src.statusChanged -> tgt.statusChanged;
  src.category -> tgt.category;
  src.priority as v -> tgt.priority = translate(v, '#MedicationRequestPriority', 'code');
  src.doNotPerform -> tgt.doNotPerform;
  src.medication : CodeableConcept -> tgt.medication;
  src.medication : Reference -> tgt.medication;
  src.subject -> tgt.subject;
  src.encounter -> tgt.encounter; // src.informationSource -> tgt.informationSource;
  src.supportingInformation -> tgt.supportingInformation;
  src.authoredOn -> tgt.authoredOn;
  src.requester -> tgt.requester;
  src.performerType -> tgt.performerType; // src.reported -> tgt.reported;
  src.performer -> tgt.performer;
  src.recorder -> tgt.recorder; // src.device -> tgt.device;
  src.reasonCode -> tgt.reason;
  src.reasonReference -> tgt.reason;
  src.courseOfTherapyType -> tgt.courseOfTherapyType;
  src.insurance -> tgt.insurance;
  src.note -> tgt.note;
  src.dispenseRequest as s -> tgt.dispenseRequest as t then MedicationRequestDispenseRequest(s, t); // src.renderedDosageInstruction -> tgt.renderedDosageInstruction;
  src.substitution as s -> tgt.substitution as t then MedicationRequestSubstitution(s, t);
  src.eventHistory -> tgt.eventHistory;
}

group MedicationRequestDispenseRequest(source src, target tgt) extends BackboneElement {
  src.initialFill as s -> tgt.initialFill as t then MedicationRequestDispenseRequestInitialFill(s, t);
  src.dispenseInterval -> tgt.dispenseInterval;
  src.validityPeriod -> tgt.validityPeriod;
  src.numberOfRepeatsAllowed -> tgt.numberOfRepeatsAllowed;
  src.quantity -> tgt.quantity;
  src.expectedSupplyDuration -> tgt.expectedSupplyDuration;
  src.performer -> tgt.dispenser;
}

group MedicationRequestDispenseRequestInitialFill(source src, target tgt) extends BackboneElement {
  src.quantity -> tgt.quantity;
  src.duration -> tgt.duration;
}

group MedicationRequestSubstitution(source src, target tgt) extends BackboneElement {
  src.allowed : boolean -> tgt.allowed;
  src.allowed : CodeableConcept -> tgt.allowed;
  src.reason -> tgt.reason;
}