Release 5 Preview #3

This page is part of the FHIR Specification (v4.5.0: R5 Preview #3). 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

Financial Management Work GroupMaturity Level: N/AStandards Status: InformativeSecurity Category: Patient Compartments: Patient, RelatedPerson

R3 : R4 Conversion maps for Coverage.

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

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

uses "http://hl7.org/fhir/3.0/StructureDefinition/Coverage" alias CoverageR3 as source
uses "http://hl7.org/fhir/StructureDefinition/Coverage" alias Coverage as target

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

group Coverage(source src : CoverageR3, target tgt : Coverage) extends DomainResource <<type+>> {
  src.identifier -> tgt.identifier;
  src.status -> tgt.status;
  src.type -> tgt.type;
  src.policyHolder -> tgt.policyHolder;
  src.subscriber -> tgt.subscriber;
  src.subscriberId -> tgt.subscriberId;
  src.beneficiary -> tgt.beneficiary;
  src.dependent -> tgt.dependent;
  src.relationship -> tgt.relationship;
  src.period -> tgt.period;
  src.payor -> tgt.payor;
  src.grouping as g where src.grouping.group.exists() -> tgt.class as t then CoverageGroupingGroup(g, t);
  src.grouping as g where src.grouping.subGroup.exists() -> tgt.class as t then CoverageGroupingSubGroup(g, t);
  src.grouping as g where src.grouping.plan.exists() -> tgt.class as t then CoverageGroupingPlan(g, t);
  src.grouping as g where src.grouping.subPlan.exists() -> tgt.class as t then CoverageGroupingSubPlan(g, t);
  src.grouping as g where src.grouping.class.exists() -> tgt.class as t then CoverageGroupingClass(g, t);
  src.grouping as g where src.grouping.subClass.exists() -> tgt.class as t then CoverageGroupingSubClass(g, t);
  src.order -> tgt.order;
  src.network -> tgt.network;
  src.contract -> tgt.contract;
}

group CoverageGroupingGroup(source src, target tgt) extends BackboneElement {
  src ->  tgt.type as vt,  vt.coding as c,  c.system = 'http://terminology.hl7.org/CodeSystem/coverage-class',  c.code = 'group' "group";
  src.group -> tgt.value;
  src.groupDisplay -> tgt.name;
}

group CoverageGroupingSubGroup(source src, target tgt) extends BackboneElement {
  src ->  tgt.type as vt,  vt.coding as c,  c.system = 'http://terminology.hl7.org/CodeSystem/coverage-class',  c.code = 'subgroup' "subgroup";
  src.subGroup -> tgt.value;
  src.subGroupDisplay -> tgt.name;
}

group CoverageGroupingPlan(source src, target tgt) extends BackboneElement {
  src ->  tgt.type as vt,  vt.coding as c,  c.system = 'http://terminology.hl7.org/CodeSystem/coverage-class',  c.code = 'plan' "plan";
  src.plan -> tgt.value;
  src.planDisplay -> tgt.name;
}

group CoverageGroupingSubPlan(source src, target tgt) extends BackboneElement {
  src ->  tgt.type as vt,  vt.coding as c,  c.system = 'http://terminology.hl7.org/CodeSystem/coverage-class',  c.code = 'subplan' "subplan";
  src.subPlan -> tgt.value;
  src.subPlanDisplay -> tgt.name;
}

group CoverageGroupingClass(source src, target tgt) extends BackboneElement {
  src ->  tgt.type as vt,  vt.coding as c,  c.system = 'http://terminology.hl7.org/CodeSystem/coverage-class',  c.code = 'class' "class";
  src.class -> tgt.value;
  src.classDisplay -> tgt.name;
}

group CoverageGroupingSubClass(source src, target tgt) extends BackboneElement {
  src ->  tgt.type as vt,  vt.coding as c,  c.system = 'http://terminology.hl7.org/CodeSystem/coverage-class',  c.code = 'subclass' "subclass";
  src.subClass -> tgt.value;
  src.subClassDisplay -> tgt.name;
}


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

uses "http://hl7.org/fhir/StructureDefinition/Coverage" alias Coverage as source
uses "http://hl7.org/fhir/3.0/StructureDefinition/Coverage" alias CoverageR3 as target

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

group Coverage(source src : Coverage, target tgt : CoverageR3) extends DomainResource <<type+>> {
  src.identifier -> tgt.identifier;
  src.status -> tgt.status;
  src.type -> tgt.type;
  src.policyHolder -> tgt.policyHolder;
  src.subscriber -> tgt.subscriber;
  src.subscriberId -> tgt.subscriberId;
  src.beneficiary -> tgt.beneficiary;
  src.dependent -> tgt.dependent;
  src.relationship -> tgt.relationship;
  src.period -> tgt.period;
  src.payor -> tgt.payor;
  src.class as class -> tgt.grouping as t then {
    class.type as vs then {
      vs.coding as c where code = 'group' then {
        c then CoverageClassGroup(class, t) "CoverageClassGroup";
      };
    };
  };
  src.class as class -> tgt.grouping as t then {
    class.type as vs then {
      vs.coding as c where code = 'subgroup' then {
        c then CoverageClassSubGroup(class, t) "CoverageClassSubGroup";
      };
    };
  };
  src.class as class -> tgt.grouping as t then {
    class.type as vs then {
      vs.coding as c where code = 'plan' then {
        c then CoverageClassPlanGroup(class, t) "CoverageClassPlanGroup";
      };
    };
  };
  src.class as class -> tgt.grouping as t then {
    class.type as vs then {
      vs.coding as c where code = 'subplan' then {
        c then CoverageClassSubPlanGroup(class, t) "CoverageClassSubPlanGroup";
      };
    };
  };
  src.class as class -> tgt.grouping as t then {
    class.type as vs then {
      vs.coding as c where code = 'class' then {
        c then CoverageClassClassGroup(class, t) "CoverageClassClassGroup";
      };
    };
  };
  src.class as class -> tgt.grouping as t then {
    class.type as vs then {
      vs.coding as c where code = 'subclass' then {
        c then CoverageClassSubClassGroup(class, t) "CoverageClassSubClassGroup";
      };
    };
  };
  src.class as class then {
    class.type as vs then {
      vs.coding as c where code = 'sequence' then {
        c then CoverageClassSequenceGroup(class, tgt) "CoverageClassSequenceGroup";
      };
    };
  };
  src.order -> tgt.order;
  src.network -> tgt.network;
  src.contract -> tgt.contract;
}

group CoverageClassGroup(source src, target tgt) extends BackboneElement {
  src.value -> tgt.group;
  src.name -> tgt.groupDisplay;
}

group CoverageClassSubGroup(source src, target tgt) extends BackboneElement {
  src.value -> tgt.subGroup;
  src.name -> tgt.subGroupDisplay;
}

group CoverageClassPlanGroup(source src, target tgt) extends BackboneElement {
  src.value -> tgt.plan;
  src.name -> tgt.planDisplay;
}

group CoverageClassSubPlanGroup(source src, target tgt) extends BackboneElement {
  src.value -> tgt.subPlan;
  src.name -> tgt.subPlanDisplay;
}

group CoverageClassClassGroup(source src, target tgt) extends BackboneElement {
  src.value -> tgt.class;
  src.name -> tgt.classDisplay;
}

group CoverageClassSubClassGroup(source src, target tgt) extends BackboneElement {
  src.value -> tgt.subClass;
  src.name -> tgt.subClassDisplay;
}

group CoverageClassSequenceGroup(source src, target tgt) extends BackboneElement {
  src.value -> tgt.sequence;
}


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