FHIR Extensions Pack
5.1.0-ballot1 - Ballot for Release 5.1.0 International flag

This page is part of the FHIR Core Extensions Registry (v5.1.0-ballot: Releases Ballot 4) based on FHIR (HL7® FHIR® Standard) v5.0.0. The current version which supersedes this version is 1.0.0. For a full list of available versions, see the Directory of published versions

StructureMap: FML Conversion for PlanDefinition: R5 to R4B

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

FMLConversionforPlanDefinitionR5toR4B

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

conceptmap "ActionCardinalityBehavior" {
  prefix s = "http://hl7.org/fhir/action-cardinality-behavior"
  prefix t = "http://hl7.org/fhir/4.3/action-cardinality-behavior"

  s:single - t:single
  s:multiple - t:multiple
}

conceptmap "ActionConditionKind" {
  prefix s = "http://hl7.org/fhir/action-condition-kind"
  prefix t = "http://hl7.org/fhir/4.3/action-condition-kind"

  s:applicability - t:applicability
  s:start - t:start
  s:stop - t:stop
}

conceptmap "ActionGroupingBehavior" {
  prefix s = "http://hl7.org/fhir/action-grouping-behavior"
  prefix t = "http://hl7.org/fhir/4.3/action-grouping-behavior"

  s:"visual-group" - t:"visual-group"
  s:"logical-group" - t:"logical-group"
  s:"sentence-group" - t:"sentence-group"
}

conceptmap "ActionPrecheckBehavior" {
  prefix s = "http://hl7.org/fhir/action-precheck-behavior"
  prefix t = "http://hl7.org/fhir/4.3/action-precheck-behavior"

  s:yes - t:yes
  s:no - t:no
}

conceptmap "ActionRelationshipType" {
  prefix s = "http://hl7.org/fhir/action-relationship-type"
  prefix t = "http://hl7.org/fhir/4.3/action-relationship-type"

  s:before - t:before
  s:"before-start" - t:"before-start"
  s:"before-end" - t:"before-end"
  s:concurrent - t:concurrent
  s:"concurrent-with-start" - t:"concurrent-with-start"
  s:"concurrent-with-end" - t:"concurrent-with-end"
  s:after - t:after
  s:"after-start" - t:"after-start"
  s:"after-end" - t:"after-end"
}

conceptmap "ActionRequiredBehavior" {
  prefix s = "http://hl7.org/fhir/action-required-behavior"
  prefix t = "http://hl7.org/fhir/4.3/action-required-behavior"

  s:must - t:must
  s:could - t:could
  s:"must-unless-documented" - t:"must-unless-documented"
}

conceptmap "ActionSelectionBehavior" {
  prefix s = "http://hl7.org/fhir/action-selection-behavior"
  prefix t = "http://hl7.org/fhir/4.3/action-selection-behavior"

  s:any - t:any
  s:all - t:all
  s:"all-or-none" - t:"all-or-none"
  s:"exactly-one" - t:"exactly-one"
  s:"at-most-one" - t:"at-most-one"
  s:"one-or-more" - t:"one-or-more"
}

conceptmap "ActivityParticipantType" {
  prefix s = "http://hl7.org/fhir/action-participant-type"
  prefix t = "http://hl7.org/fhir/4.3/action-participant-type"

  s:device - t:device
  s:patient - t:patient
  s:practitioner - t:practitioner
  s:relatedperson - t:"related-person"
}

conceptmap "PublicationStatus" {
  prefix s = "http://hl7.org/fhir/publication-status"
  prefix t = "http://hl7.org/fhir/4.3/publication-status"

  s:draft - t:draft
  s:active - t:active
  s:retired - t:retired
  s:unknown - t:unknown
}

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

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

uses "http://hl7.org/fhir/StructureDefinition/PlanDefinition" alias PlanDefinitionR5 as source
uses "http://hl7.org/fhir/4.3/StructureDefinition/PlanDefinition" alias PlanDefinitionR4B as target

imports "http://hl7.org/fhir/StructureMap/*5to4B"

group PlanDefinition(source src : PlanDefinitionR5, target tgt : PlanDefinitionR4B) extends DomainResource <<type+>> {
  src.url -> tgt.url;
  src.identifier -> tgt.identifier;
  src.version -> tgt.version;
  src.name -> tgt.name; // src.versionAlgorithm : string -> tgt.versionAlgorithm;
  src.title -> tgt.title;
  src.subtitle -> tgt.subtitle;
  src.type -> tgt.type;
  src.status as v -> tgt.status = translate(v, '#PublicationStatus', 'code');
  src.experimental -> tgt.experimental;
  src.subject as s where code = 'Patient' ->  tgt.subject = create('CodeableConcept') as tc,  tc.coding = create('Coding') as tcc,  tcc.system = 'http://hl7.org/fhir/resource-types',  tcc.code = 'Patient',  tcc.display = 'Patient';
  src.subject as s where code = 'Practitioner' ->  tgt.subject = create('CodeableConcept') as tc,  tc.coding = create('Coding') as tcc,  tcc.system = 'http://hl7.org/fhir/resource-types',  tcc.code = 'Patient',  tcc.display = 'Practitioner';
  src.subject as s where code = 'Organization' ->  tgt.subject = create('CodeableConcept') as tc,  tc.coding = create('Coding') as tcc,  tcc.system = 'http://hl7.org/fhir/resource-types',  tcc.code = 'Patient',  tcc.display = 'Organization';
  src.subject as s where code = 'Location' ->  tgt.subject = create('CodeableConcept') as tc,  tc.coding = create('Coding') as tcc,  tcc.system = 'http://hl7.org/fhir/resource-types',  tcc.code = 'Patient',  tcc.display = 'Location';
  src.subject as s where code = 'Device' ->  tgt.subject = create('CodeableConcept') as tc,  tc.coding = create('Coding') as tcc,  tcc.system = 'http://hl7.org/fhir/resource-types',  tcc.code = 'Patient',  tcc.display = 'Device';
  src.subject : Reference -> tgt.subject;
  src.subject : canonical -> tgt.subject;
  src.date -> tgt.date;
  src.publisher -> tgt.publisher;
  src.contact -> tgt.contact;
  src.description -> tgt.description;
  src.useContext -> tgt.useContext;
  src.jurisdiction -> tgt.jurisdiction;
  src.purpose -> tgt.purpose;
  src.usage -> tgt.usage;
  src.copyright -> tgt.copyright;
  src.approvalDate -> tgt.approvalDate; // src.copyrightLabel -> tgt.copyrightLabel;
  src.lastReviewDate -> tgt.lastReviewDate;
  src.effectivePeriod -> tgt.effectivePeriod;
  src.topic -> tgt.topic;
  src.author -> tgt.author;
  src.editor -> tgt.editor;
  src.reviewer -> tgt.reviewer;
  src.endorser -> tgt.endorser;
  src.relatedArtifact -> tgt.relatedArtifact;
  src.library -> tgt.library;
  src.goal as s -> tgt.goal as t then PlanDefinitionGoal(s, t);
  src.action as s -> tgt.action as t then PlanDefinitionAction(s, t); // src.actor as s -> tgt.actor as t then PlanDefinitionActor(s,t);
}

group PlanDefinitionGoal(source src, target tgt) extends BackboneElement {
  src.category -> tgt.category;
  src.description -> tgt.description;
  src.priority -> tgt.priority;
  src.start -> tgt.start;
  src.addresses -> tgt.addresses;
  src.documentation -> tgt.documentation;
  src.target as s -> tgt.target as t then PlanDefinitionGoalTarget(s, t);
}

group PlanDefinitionGoalTarget(source src, target tgt) extends BackboneElement {
  src.measure -> tgt.measure;
  src.detail : Quantity -> tgt.detail;
  src.detail : Range -> tgt.detail;
  src.detail : CodeableConcept -> tgt.detail;
  src.due -> tgt.due; // src.detail : string -> tgt.detail;
}

// group PlanDefinitionActor(source src, target tgt) extends BackboneElement {
// src.title -> tgt.title;
// src.description -> tgt.description;
// src.option as s -> tgt.option as t then PlanDefinitionActorOption(s,t);
// }
// group PlanDefinitionActorOption(source src, target tgt) extends BackboneElement {
// src.type as v -> tgt.type = translate(v, '#ActivityParticipantType', 'code');
// src.typeCanonical -> tgt.typeCanonical;
// src.typeReference -> tgt.typeReference;
// src.role -> tgt.role;
// }
group PlanDefinitionAction(source src, target tgt) extends BackboneElement {
  src.linkId -> tgt.id;
  src.prefix -> tgt.prefix;
  src.title -> tgt.title;
  src.description -> tgt.description;
  src.textEquivalent -> tgt.textEquivalent;
  src.priority as v -> tgt.priority = translate(v, '#RequestPriority', 'code');
  src.code -> tgt.code;
  src.reason -> tgt.reason;
  src.documentation -> tgt.documentation;
  src.goalId -> tgt.goalId;
  src.subject as s where code = 'Patient' ->  tgt.subject = create('CodeableConcept') as tc,  tc.coding = create('Coding') as tcc,  tcc.system = 'http://hl7.org/fhir/resource-types',  tcc.code = 'Patient',  tcc.display = 'Patient';
  src.subject as s where code = 'Practitioner' ->  tgt.subject = create('CodeableConcept') as tc,  tc.coding = create('Coding') as tcc,  tcc.system = 'http://hl7.org/fhir/resource-types',  tcc.code = 'Patient',  tcc.display = 'Practitioner';
  src.subject as s where code = 'Organization' ->  tgt.subject = create('CodeableConcept') as tc,  tc.coding = create('Coding') as tcc,  tcc.system = 'http://hl7.org/fhir/resource-types',  tcc.code = 'Patient',  tcc.display = 'Organization';
  src.subject as s where code = 'Location' ->  tgt.subject = create('CodeableConcept') as tc,  tc.coding = create('Coding') as tcc,  tcc.system = 'http://hl7.org/fhir/resource-types',  tcc.code = 'Patient',  tcc.display = 'Location';
  src.subject as s where code = 'Device' ->  tgt.subject = create('CodeableConcept') as tc,  tc.coding = create('Coding') as tcc,  tcc.system = 'http://hl7.org/fhir/resource-types',  tcc.code = 'Patient',  tcc.display = 'Device';
  src.subject : Reference -> tgt.subject;
  src.subject : canonical -> tgt.subject;
  src.trigger -> tgt.trigger;
  src.condition as s -> tgt.condition as t then PlanDefinitionActionCondition(s, t);
  src.input as s -> tgt.input = r.requirement;
  src.output as s -> tgt.output = r.requirement;
  src.relatedAction as s -> tgt.relatedAction as t then PlanDefinitionActionRelatedAction(s, t);
  src.timing : Age -> tgt.timing;
  src.timing : Duration -> tgt.timing;
  src.timing : Range -> tgt.timing;
  src.timing : Timing -> tgt.timing;
  src.participant as s -> tgt.participant as t then PlanDefinitionActionParticipant(s, t); // src.location -> tgt.location;
  src.type -> tgt.type;
  src.groupingBehavior as v -> tgt.groupingBehavior = translate(v, '#ActionGroupingBehavior', 'code');
  src.selectionBehavior as v -> tgt.selectionBehavior = translate(v, '#ActionSelectionBehavior', 'code');
  src.requiredBehavior as v -> tgt.requiredBehavior = translate(v, '#ActionRequiredBehavior', 'code');
  src.precheckBehavior as v -> tgt.precheckBehavior = translate(v, '#ActionPrecheckBehavior', 'code');
  src.cardinalityBehavior as v -> tgt.cardinalityBehavior = translate(v, '#ActionCardinalityBehavior', 'code');
  src.definition : canonical -> tgt.definition;
  src.definition : uri -> tgt.definition;
  src.transform -> tgt.transform;
  src.dynamicValue as s -> tgt.dynamicValue as t then PlanDefinitionActionDynamicValue(s, t);
}

group PlanDefinitionActionCondition(source src, target tgt) extends BackboneElement {
  src.kind as v -> tgt.kind = translate(v, '#ActionConditionKind', 'code');
  src.expression -> tgt.expression;
}

group PlanDefinitionActionRelatedAction(source src, target tgt) extends BackboneElement {
  src.targetId -> tgt.actionId;
  src.relationship as v -> tgt.relationship = translate(v, '#ActionRelationshipType', 'code');
  src.endRelationship as v -> tgt.relationship = translate(v, '#ActionRelationshipType', 'code');
  src.offset : Duration -> tgt.offset;
  src.offset : Range -> tgt.offset;
}

group PlanDefinitionActionParticipant(source src, target tgt) extends BackboneElement {
  src.type as v -> tgt.type = translate(v, '#ActivityParticipantType', 'code'); // src.actorId -> tgt.actorId;
  src.role -> tgt.role; // src.typeCanonical -> tgt.typeCanonical;
}

group PlanDefinitionActionDynamicValue(source src, target tgt) extends BackboneElement {
  src.path -> tgt.path;
  src.expression -> tgt.expression;
}