FHIR Extensions Pack v5.1.0-cibuild (2024-04-21)

FHIR Extensions Pack, published by HL7 International / FHIR Infrastructure. This guide is not an authorized publication; it is the continuous build for version 5.1.0-cibuild built by the FHIR (HL7® FHIR® Standard) CI Build. This version is based on the current content of https://github.com/HL7/fhir-extensions/ and changes regularly. See the Directory of published versions

Financial Management Work GroupMaturity Level: N/AStandards Status: InformativeSecurity Category: N/A Compartments: N/A

Following are maps for converting between the equivalent R4B resource and this R5 resource.

Maps to Claim

FML Conversion for Claim: R5 to R4 (Ready for Use/Trial Use)

/// url = 'http://hl7.org/fhir/StructureMap/Claim5to4'
/// name = 'Claim5to4'
/// title = 'FML Conversion for Claim: R5 to R4'
/// status = 'active'

conceptmap "ClaimStatus" {
  prefix s = "http://hl7.org/fhir/fm-status"
  prefix t = "http://hl7.org/fhir/4.0/fm-status"

  s:active - t:active
  s:cancelled - t:cancelled
  s:draft - t:draft
  s:"entered-in-error" - t:"entered-in-error"
}

conceptmap "Use" {
  prefix s = "http://hl7.org/fhir/claim-use"
  prefix t = "http://hl7.org/fhir/4.0/claim-use"

  s:claim - t:claim
  s:preauthorization - t:preauthorization
  s:predetermination - t:predetermination
}

uses "http://hl7.org/fhir/StructureDefinition/Claim" alias ClaimR5 as source
uses "http://hl7.org/fhir/4.0/StructureDefinition/Claim" alias ClaimR4 as target

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

group Claim(source src : ClaimR5, target tgt : ClaimR4) extends DomainResource <<type+>> {
  src.identifier -> tgt.identifier;
  src.status as v -> tgt.status = translate(v, '#ClaimStatus', 'code'); // src.traceNumber -> tgt.traceNumber;
  src.type -> tgt.type;
  src.subType -> tgt.subType;
  src.use as v -> tgt.use = translate(v, '#Use', 'code');
  src.patient -> tgt.patient;
  src.billablePeriod -> tgt.billablePeriod;
  src.created -> tgt.created;
  src.enterer -> tgt.enterer;
  src.insurer -> tgt.insurer;
  src.provider -> tgt.provider;
  src.priority -> tgt.priority;
  src.fundsReserve -> tgt.fundsReserve;
  src.related as s -> tgt.related as t then ClaimRelated(s, t);
  src.prescription -> tgt.prescription;
  src.originalPrescription -> tgt.originalPrescription;
  src.payee as s -> tgt.payee as t then ClaimPayee(s, t);
  src.referral -> tgt.referral;
  src.facility -> tgt.facility; // src.encounter -> tgt.encounter;
  src.careTeam as s -> tgt.careTeam as t then ClaimCareTeam(s, t); // src.diagnosisRelatedGroup -> tgt.diagnosisRelatedGroup;
  src.supportingInfo as s -> tgt.supportingInfo as t then ClaimSupportingInfo(s, t);
  src.diagnosis as s -> tgt.diagnosis as t then ClaimDiagnosis(s, t);
  src.procedure as s -> tgt.procedure as t then ClaimProcedure(s, t);
  src.insurance as s -> tgt.insurance as t then ClaimInsurance(s, t);
  src.accident as s -> tgt.accident as t then ClaimAccident(s, t);
  src.item as s -> tgt.item as t then ClaimItem(s, t); // src.patientPaid -> tgt.patientPaid;
  src.total -> tgt.total;
}

group ClaimRelated(source src, target tgt) extends BackboneElement {
  src.claim -> tgt.claim;
  src.relationship -> tgt.relationship;
  src.reference -> tgt.reference;
}

group ClaimPayee(source src, target tgt) extends BackboneElement {
  src.type -> tgt.type;
  src.party -> tgt.party;
}

// group ClaimEvent(source src, target tgt) extends BackboneElement {
// src.type -> tgt.type;
// src.when : dateTime -> tgt.when;
// src.when : Period -> tgt.when;
// }
group ClaimCareTeam(source src, target tgt) extends BackboneElement {
  src.sequence -> tgt.sequence;
  src.provider -> tgt.provider;
  src.responsible -> tgt.responsible;
  src.role -> tgt.role;
  src.specialty -> tgt.qualification;
}

group ClaimSupportingInfo(source src, target tgt) extends BackboneElement {
  src.sequence -> tgt.sequence;
  src.category -> tgt.category;
  src.code -> tgt.code;
  src.timing : date -> tgt.timing;
  src.timing : Period -> tgt.timing;
  src.value : boolean -> tgt.value;
  src.value : string -> tgt.value;
  src.value : Quantity -> tgt.value;
  src.value : Attachment -> tgt.value;
  src.value : Reference -> tgt.value;
  src.reason -> tgt.reason; // src.value : Identifier -> tgt.value;
}

group ClaimDiagnosis(source src, target tgt) extends BackboneElement {
  src.sequence -> tgt.sequence;
  src.diagnosis : CodeableConcept -> tgt.diagnosis;
  src.diagnosis : Reference -> tgt.diagnosis;
  src.type -> tgt.type;
  src.onAdmission -> tgt.onAdmission;
}

group ClaimProcedure(source src, target tgt) extends BackboneElement {
  src.sequence -> tgt.sequence;
  src.type -> tgt.type;
  src.date -> tgt.date;
  src.procedure : CodeableConcept -> tgt.procedure;
  src.procedure : Reference -> tgt.procedure;
  src.udi -> tgt.udi;
}

group ClaimInsurance(source src, target tgt) extends BackboneElement {
  src.sequence -> tgt.sequence;
  src.focal -> tgt.focal;
  src.identifier -> tgt.identifier;
  src.coverage -> tgt.coverage;
  src.businessArrangement -> tgt.businessArrangement;
  src.preAuthRef -> tgt.preAuthRef;
  src.claimResponse -> tgt.claimResponse;
}

group ClaimAccident(source src, target tgt) extends BackboneElement {
  src.date -> tgt.date;
  src.type -> tgt.type;
  src.location : Address -> tgt.location;
  src.location : Reference -> tgt.location;
}

group ClaimItem(source src, target tgt) extends BackboneElement {
  src.sequence -> tgt.sequence;
  src.careTeamSequence -> tgt.careTeamSequence; // src.traceNumber -> tgt.traceNumber;
  src.diagnosisSequence -> tgt.diagnosisSequence;
  src.procedureSequence -> tgt.procedureSequence;
  src.informationSequence -> tgt.informationSequence;
  src.revenue -> tgt.revenue;
  src.category -> tgt.category;
  src.productOrService -> tgt.productOrService;
  src.modifier -> tgt.modifier; // src.productOrServiceEnd -> tgt.productOrServiceEnd;
  src.programCode -> tgt.programCode;
  src.serviced : date -> tgt.serviced;
  src.serviced : Period -> tgt.serviced;
  src.location : CodeableConcept -> tgt.location;
  src.location : Address -> tgt.location;
  src.location : Reference -> tgt.location;
  src.quantity -> tgt.quantity; // src.patientPaid -> tgt.patientPaid;
  src.unitPrice -> tgt.unitPrice;
  src.factor -> tgt.factor;
  src.net -> tgt.net; // src.tax -> tgt.tax;
  src.udi -> tgt.udi;
  src.bodySite as s -> tgt.bodySite = s.site;
  src.encounter -> tgt.encounter;
  src.detail as s -> tgt.detail as t then ClaimItemDetail(s, t);
}

// group ClaimItemBodySite(source src, target tgt) extends BackboneElement {
// src.site -> tgt.site;
// src.subSite -> tgt.subSite;
// }
group ClaimItemDetail(source src, target tgt) extends BackboneElement {
  src.sequence -> tgt.sequence;
  src.revenue -> tgt.revenue; // src.traceNumber -> tgt.traceNumber;
  src.category -> tgt.category;
  src.productOrService -> tgt.productOrService;
  src.modifier -> tgt.modifier; // src.productOrServiceEnd -> tgt.productOrServiceEnd;
  src.programCode -> tgt.programCode;
  src.quantity -> tgt.quantity; // src.patientPaid -> tgt.patientPaid;
  src.unitPrice -> tgt.unitPrice;
  src.factor -> tgt.factor;
  src.net -> tgt.net; // src.tax -> tgt.tax;
  src.udi -> tgt.udi;
  src.subDetail as s -> tgt.subDetail as t then ClaimItemDetailSubDetail(s, t);
}

group ClaimItemDetailSubDetail(source src, target tgt) extends BackboneElement {
  src.sequence -> tgt.sequence;
  src.revenue -> tgt.revenue; // src.traceNumber -> tgt.traceNumber;
  src.category -> tgt.category;
  src.productOrService -> tgt.productOrService;
  src.modifier -> tgt.modifier; // src.productOrServiceEnd -> tgt.productOrServiceEnd;
  src.programCode -> tgt.programCode;
  src.quantity -> tgt.quantity; // src.patientPaid -> tgt.patientPaid;
  src.unitPrice -> tgt.unitPrice;
  src.factor -> tgt.factor;
  src.net -> tgt.net; // src.tax -> tgt.tax;
  src.udi -> tgt.udi;
}

FML Conversion for Claim: R5 to R4B (Ready for Use/Trial Use)

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

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

  s:active - t:active
  s:cancelled - t:cancelled
  s:draft - t:draft
  s:"entered-in-error" - t:"entered-in-error"
}

conceptmap "Use" {
  prefix s = "http://hl7.org/fhir/claim-use"
  prefix t = "http://hl7.org/fhir/4.3/claim-use"

  s:claim - t:claim
  s:preauthorization - t:preauthorization
  s:predetermination - t:predetermination
}

uses "http://hl7.org/fhir/StructureDefinition/Claim" alias ClaimR5 as source
uses "http://hl7.org/fhir/4.3/StructureDefinition/Claim" alias ClaimR4B as target

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

group Claim(source src : ClaimR5, target tgt : ClaimR4B) extends DomainResource <<type+>> {
  src.identifier -> tgt.identifier;
  src.status as v -> tgt.status = translate(v, '#ClaimStatus', 'code'); // src.traceNumber -> tgt.traceNumber;
  src.type -> tgt.type;
  src.subType -> tgt.subType;
  src.use as v -> tgt.use = translate(v, '#Use', 'code');
  src.patient -> tgt.patient;
  src.billablePeriod -> tgt.billablePeriod;
  src.created -> tgt.created;
  src.enterer -> tgt.enterer;
  src.insurer -> tgt.insurer;
  src.provider -> tgt.provider;
  src.priority -> tgt.priority;
  src.fundsReserve -> tgt.fundsReserve;
  src.related as s -> tgt.related as t then ClaimRelated(s, t);
  src.prescription -> tgt.prescription;
  src.originalPrescription -> tgt.originalPrescription;
  src.payee as s -> tgt.payee as t then ClaimPayee(s, t);
  src.referral -> tgt.referral;
  src.facility -> tgt.facility; // src.encounter -> tgt.encounter;
  src.careTeam as s -> tgt.careTeam as t then ClaimCareTeam(s, t); // src.diagnosisRelatedGroup -> tgt.diagnosisRelatedGroup;
  src.supportingInfo as s -> tgt.supportingInfo as t then ClaimSupportingInfo(s, t);
  src.diagnosis as s -> tgt.diagnosis as t then ClaimDiagnosis(s, t);
  src.procedure as s -> tgt.procedure as t then ClaimProcedure(s, t);
  src.insurance as s -> tgt.insurance as t then ClaimInsurance(s, t);
  src.accident as s -> tgt.accident as t then ClaimAccident(s, t);
  src.item as s -> tgt.item as t then ClaimItem(s, t); // src.patientPaid -> tgt.patientPaid;
  src.total -> tgt.total;
}

group ClaimRelated(source src, target tgt) extends BackboneElement {
  src.claim -> tgt.claim;
  src.relationship -> tgt.relationship;
  src.reference -> tgt.reference;
}

group ClaimPayee(source src, target tgt) extends BackboneElement {
  src.type -> tgt.type;
  src.party -> tgt.party;
}

// group ClaimEvent(source src, target tgt) extends BackboneElement {
// src.type -> tgt.type;
// src.when : dateTime -> tgt.when;
// src.when : Period -> tgt.when;
// }
group ClaimCareTeam(source src, target tgt) extends BackboneElement {
  src.sequence -> tgt.sequence;
  src.provider -> tgt.provider;
  src.responsible -> tgt.responsible;
  src.role -> tgt.role;
  src.specialty -> tgt.qualification;
}

group ClaimSupportingInfo(source src, target tgt) extends BackboneElement {
  src.sequence -> tgt.sequence;
  src.category -> tgt.category;
  src.code -> tgt.code;
  src.timing : date -> tgt.timing;
  src.timing : Period -> tgt.timing;
  src.value : boolean -> tgt.value;
  src.value : string -> tgt.value;
  src.value : Quantity -> tgt.value;
  src.value : Attachment -> tgt.value;
  src.value : Reference -> tgt.value;
  src.reason -> tgt.reason; // src.value : Identifier -> tgt.value;
}

group ClaimDiagnosis(source src, target tgt) extends BackboneElement {
  src.sequence -> tgt.sequence;
  src.diagnosis : CodeableConcept -> tgt.diagnosis;
  src.diagnosis : Reference -> tgt.diagnosis;
  src.type -> tgt.type;
  src.onAdmission -> tgt.onAdmission;
}

group ClaimProcedure(source src, target tgt) extends BackboneElement {
  src.sequence -> tgt.sequence;
  src.type -> tgt.type;
  src.date -> tgt.date;
  src.procedure : CodeableConcept -> tgt.procedure;
  src.procedure : Reference -> tgt.procedure;
  src.udi -> tgt.udi;
}

group ClaimInsurance(source src, target tgt) extends BackboneElement {
  src.sequence -> tgt.sequence;
  src.focal -> tgt.focal;
  src.identifier -> tgt.identifier;
  src.coverage -> tgt.coverage;
  src.businessArrangement -> tgt.businessArrangement;
  src.preAuthRef -> tgt.preAuthRef;
  src.claimResponse -> tgt.claimResponse;
}

group ClaimAccident(source src, target tgt) extends BackboneElement {
  src.date -> tgt.date;
  src.type -> tgt.type;
  src.location : Address -> tgt.location;
  src.location : Reference -> tgt.location;
}

group ClaimItem(source src, target tgt) extends BackboneElement {
  src.sequence -> tgt.sequence;
  src.careTeamSequence -> tgt.careTeamSequence; // src.traceNumber -> tgt.traceNumber;
  src.diagnosisSequence -> tgt.diagnosisSequence;
  src.procedureSequence -> tgt.procedureSequence;
  src.informationSequence -> tgt.informationSequence;
  src.revenue -> tgt.revenue;
  src.category -> tgt.category;
  src.productOrService -> tgt.productOrService;
  src.modifier -> tgt.modifier; // src.productOrServiceEnd -> tgt.productOrServiceEnd;
  src.programCode -> tgt.programCode;
  src.serviced : date -> tgt.serviced;
  src.serviced : Period -> tgt.serviced;
  src.location : CodeableConcept -> tgt.location;
  src.location : Address -> tgt.location;
  src.location : Reference -> tgt.location;
  src.quantity -> tgt.quantity; // src.patientPaid -> tgt.patientPaid;
  src.unitPrice -> tgt.unitPrice;
  src.factor -> tgt.factor;
  src.net -> tgt.net; // src.tax -> tgt.tax;
  src.udi -> tgt.udi;
  src.bodySite as s -> tgt.bodySite = s.site;
  src.encounter -> tgt.encounter;
  src.detail as s -> tgt.detail as t then ClaimItemDetail(s, t);
}

// group ClaimItemBodySite(source src, target tgt) extends BackboneElement {
// src.site -> tgt.site;
// src.subSite -> tgt.subSite;
// }
group ClaimItemDetail(source src, target tgt) extends BackboneElement {
  src.sequence -> tgt.sequence;
  src.revenue -> tgt.revenue; // src.traceNumber -> tgt.traceNumber;
  src.category -> tgt.category;
  src.productOrService -> tgt.productOrService;
  src.modifier -> tgt.modifier; // src.productOrServiceEnd -> tgt.productOrServiceEnd;
  src.programCode -> tgt.programCode;
  src.quantity -> tgt.quantity; // src.patientPaid -> tgt.patientPaid;
  src.unitPrice -> tgt.unitPrice;
  src.factor -> tgt.factor;
  src.net -> tgt.net; // src.tax -> tgt.tax;
  src.udi -> tgt.udi;
  src.subDetail as s -> tgt.subDetail as t then ClaimItemDetailSubDetail(s, t);
}

group ClaimItemDetailSubDetail(source src, target tgt) extends BackboneElement {
  src.sequence -> tgt.sequence;
  src.revenue -> tgt.revenue; // src.traceNumber -> tgt.traceNumber;
  src.category -> tgt.category;
  src.productOrService -> tgt.productOrService;
  src.modifier -> tgt.modifier; // src.productOrServiceEnd -> tgt.productOrServiceEnd;
  src.programCode -> tgt.programCode;
  src.quantity -> tgt.quantity; // src.patientPaid -> tgt.patientPaid;
  src.unitPrice -> tgt.unitPrice;
  src.factor -> tgt.factor;
  src.net -> tgt.net; // src.tax -> tgt.tax;
  src.udi -> tgt.udi;
}

Maps from Claim

FML Conversion for Claim: R4B to R5 (Ready for Use/Trial Use)

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

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

  s:active - t:active
  s:cancelled - t:cancelled
  s:draft - t:draft
  s:"entered-in-error" - t:"entered-in-error"
}

conceptmap "Use" {
  prefix s = "http://hl7.org/fhir/4.3/claim-use"
  prefix t = "http://hl7.org/fhir/claim-use"

  s:claim - t:claim
  s:preauthorization - t:preauthorization
  s:predetermination - t:predetermination
}

uses "http://hl7.org/fhir/4.3/StructureDefinition/Claim" alias ClaimR4B as source
uses "http://hl7.org/fhir/StructureDefinition/Claim" alias ClaimR5 as target

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

group Claim(source src : ClaimR4B, target tgt : ClaimR5) extends DomainResource <<type+>> {
  src.identifier -> tgt.identifier;
  src.status as v -> tgt.status = translate(v, '#ClaimStatus', 'code'); // src.traceNumber -> tgt.traceNumber;
  src.type -> tgt.type;
  src.subType -> tgt.subType;
  src.use as v -> tgt.use = translate(v, '#Use', 'code');
  src.patient -> tgt.patient;
  src.billablePeriod -> tgt.billablePeriod;
  src.created -> tgt.created;
  src.enterer -> tgt.enterer;
  src.insurer -> tgt.insurer;
  src.provider -> tgt.provider;
  src.priority -> tgt.priority;
  src.fundsReserve -> tgt.fundsReserve;
  src.related as s -> tgt.related as t then ClaimRelated(s, t);
  src.prescription -> tgt.prescription;
  src.originalPrescription -> tgt.originalPrescription;
  src.payee as s -> tgt.payee as t then ClaimPayee(s, t);
  src.referral -> tgt.referral;
  src.facility -> tgt.facility; // src.encounter -> tgt.encounter;
  src.careTeam as s -> tgt.careTeam as t then ClaimCareTeam(s, t); // src.diagnosisRelatedGroup -> tgt.diagnosisRelatedGroup;
  src.supportingInfo as s -> tgt.supportingInfo as t then ClaimSupportingInfo(s, t);
  src.diagnosis as s -> tgt.diagnosis as t then ClaimDiagnosis(s, t);
  src.procedure as s -> tgt.procedure as t then ClaimProcedure(s, t);
  src.insurance as s -> tgt.insurance as t then ClaimInsurance(s, t);
  src.accident as s -> tgt.accident as t then ClaimAccident(s, t);
  src.item as s -> tgt.item as t then ClaimItem(s, t); // src.patientPaid -> tgt.patientPaid;
  src.total -> tgt.total;
}

group ClaimRelated(source src, target tgt) extends BackboneElement {
  src.claim -> tgt.claim;
  src.relationship -> tgt.relationship;
  src.reference -> tgt.reference;
}

group ClaimPayee(source src, target tgt) extends BackboneElement {
  src.type -> tgt.type;
  src.party -> tgt.party;
}

// group ClaimEvent(source src, target tgt) extends BackboneElement {
// src.type -> tgt.type;
// src.when : dateTime -> tgt.when;
// src.when : Period -> tgt.when;
// }
group ClaimCareTeam(source src, target tgt) extends BackboneElement {
  src.sequence -> tgt.sequence;
  src.provider -> tgt.provider;
  src.responsible -> tgt.responsible;
  src.role -> tgt.role;
  src.qualification -> tgt.specialty;
}

group ClaimSupportingInfo(source src, target tgt) extends BackboneElement {
  src.sequence -> tgt.sequence;
  src.category -> tgt.category;
  src.code -> tgt.code;
  src.timing : date -> tgt.timing;
  src.timing : Period -> tgt.timing;
  src.value : boolean -> tgt.value;
  src.value : string -> tgt.value;
  src.value : Quantity -> tgt.value;
  src.value : Attachment -> tgt.value;
  src.value : Reference -> tgt.value;
  src.reason -> tgt.reason; // src.value : Identifier -> tgt.value;
}

group ClaimDiagnosis(source src, target tgt) extends BackboneElement {
  src.sequence -> tgt.sequence;
  src.diagnosis : CodeableConcept -> tgt.diagnosis;
  src.diagnosis : Reference -> tgt.diagnosis;
  src.type -> tgt.type;
  src.onAdmission -> tgt.onAdmission;
}

group ClaimProcedure(source src, target tgt) extends BackboneElement {
  src.sequence -> tgt.sequence;
  src.type -> tgt.type;
  src.date -> tgt.date;
  src.procedure : CodeableConcept -> tgt.procedure;
  src.procedure : Reference -> tgt.procedure;
  src.udi -> tgt.udi;
}

group ClaimInsurance(source src, target tgt) extends BackboneElement {
  src.sequence -> tgt.sequence;
  src.focal -> tgt.focal;
  src.identifier -> tgt.identifier;
  src.coverage -> tgt.coverage;
  src.businessArrangement -> tgt.businessArrangement;
  src.preAuthRef -> tgt.preAuthRef;
  src.claimResponse -> tgt.claimResponse;
}

group ClaimAccident(source src, target tgt) extends BackboneElement {
  src.date -> tgt.date;
  src.type -> tgt.type;
  src.location : Address -> tgt.location;
  src.location : Reference -> tgt.location;
}

group ClaimItem(source src, target tgt) extends BackboneElement {
  src.sequence -> tgt.sequence;
  src.careTeamSequence -> tgt.careTeamSequence; // src.traceNumber -> tgt.traceNumber;
  src.diagnosisSequence -> tgt.diagnosisSequence;
  src.procedureSequence -> tgt.procedureSequence;
  src.informationSequence -> tgt.informationSequence;
  src.revenue -> tgt.revenue;
  src.category -> tgt.category;
  src.productOrService -> tgt.productOrService;
  src.modifier -> tgt.modifier; // src.productOrServiceEnd -> tgt.productOrServiceEnd;
  src.programCode -> tgt.programCode;
  src.serviced : date -> tgt.serviced;
  src.serviced : Period -> tgt.serviced;
  src.location : CodeableConcept -> tgt.location;
  src.location : Address -> tgt.location;
  src.location : Reference -> tgt.location;
  src.quantity -> tgt.quantity; // src.patientPaid -> tgt.patientPaid;
  src.unitPrice -> tgt.unitPrice;
  src.factor -> tgt.factor;
  src.net -> tgt.net; // src.tax -> tgt.tax;
  src.udi -> tgt.udi;
  src.bodySite : CodeableConcept as s ->  tgt.bodySite as t,  t.site = s;
  src.encounter -> tgt.encounter;
  src.detail as s -> tgt.detail as t then ClaimItemDetail(s, t);
}

// group ClaimItemBodySite(source src, target tgt) extends BackboneElement {
// src.site -> tgt.site;
// src.subSite -> tgt.subSite;
// }
group ClaimItemDetail(source src, target tgt) extends BackboneElement {
  src.sequence -> tgt.sequence;
  src.revenue -> tgt.revenue; // src.traceNumber -> tgt.traceNumber;
  src.category -> tgt.category;
  src.productOrService -> tgt.productOrService;
  src.modifier -> tgt.modifier; // src.productOrServiceEnd -> tgt.productOrServiceEnd;
  src.programCode -> tgt.programCode;
  src.quantity -> tgt.quantity; // src.patientPaid -> tgt.patientPaid;
  src.unitPrice -> tgt.unitPrice;
  src.factor -> tgt.factor;
  src.net -> tgt.net; // src.tax -> tgt.tax;
  src.udi -> tgt.udi;
  src.subDetail as s -> tgt.subDetail as t then ClaimItemDetailSubDetail(s, t);
}

group ClaimItemDetailSubDetail(source src, target tgt) extends BackboneElement {
  src.sequence -> tgt.sequence;
  src.revenue -> tgt.revenue; // src.traceNumber -> tgt.traceNumber;
  src.category -> tgt.category;
  src.productOrService -> tgt.productOrService;
  src.modifier -> tgt.modifier; // src.productOrServiceEnd -> tgt.productOrServiceEnd;
  src.programCode -> tgt.programCode;
  src.quantity -> tgt.quantity; // src.patientPaid -> tgt.patientPaid;
  src.unitPrice -> tgt.unitPrice;
  src.factor -> tgt.factor;
  src.net -> tgt.net; // src.tax -> tgt.tax;
  src.udi -> tgt.udi;
}

FML Conversion for Claim: R4 to R5 (Ready for Use/Trial Use)

/// url = 'http://hl7.org/fhir/StructureMap/Claim4to5'
/// name = 'Claim4to5'
/// title = 'FML Conversion for Claim: R4 to R5'
/// status = 'active'

conceptmap "ClaimStatus" {
  prefix s = "http://hl7.org/fhir/4.0/fm-status"
  prefix t = "http://hl7.org/fhir/fm-status"

  s:active - t:active
  s:cancelled - t:cancelled
  s:draft - t:draft
  s:"entered-in-error" - t:"entered-in-error"
}

conceptmap "Use" {
  prefix s = "http://hl7.org/fhir/4.0/claim-use"
  prefix t = "http://hl7.org/fhir/claim-use"

  s:claim - t:claim
  s:preauthorization - t:preauthorization
  s:predetermination - t:predetermination
}

uses "http://hl7.org/fhir/4.0/StructureDefinition/Claim" alias ClaimR4 as source
uses "http://hl7.org/fhir/StructureDefinition/Claim" alias ClaimR5 as target

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

group Claim(source src : ClaimR4, target tgt : ClaimR5) extends DomainResource <<type+>> {
  src.identifier -> tgt.identifier;
  src.status as v -> tgt.status = translate(v, '#ClaimStatus', 'code'); // src.traceNumber -> tgt.traceNumber;
  src.type -> tgt.type;
  src.subType -> tgt.subType;
  src.use as v -> tgt.use = translate(v, '#Use', 'code');
  src.patient -> tgt.patient;
  src.billablePeriod -> tgt.billablePeriod;
  src.created -> tgt.created;
  src.enterer -> tgt.enterer;
  src.insurer -> tgt.insurer;
  src.provider -> tgt.provider;
  src.priority -> tgt.priority;
  src.fundsReserve -> tgt.fundsReserve;
  src.related as s -> tgt.related as t then ClaimRelated(s, t);
  src.prescription -> tgt.prescription;
  src.originalPrescription -> tgt.originalPrescription;
  src.payee as s -> tgt.payee as t then ClaimPayee(s, t);
  src.referral -> tgt.referral;
  src.facility -> tgt.facility; // src.encounter -> tgt.encounter;
  src.careTeam as s -> tgt.careTeam as t then ClaimCareTeam(s, t); // src.diagnosisRelatedGroup -> tgt.diagnosisRelatedGroup;
  src.supportingInfo as s -> tgt.supportingInfo as t then ClaimSupportingInfo(s, t);
  src.diagnosis as s -> tgt.diagnosis as t then ClaimDiagnosis(s, t);
  src.procedure as s -> tgt.procedure as t then ClaimProcedure(s, t);
  src.insurance as s -> tgt.insurance as t then ClaimInsurance(s, t);
  src.accident as s -> tgt.accident as t then ClaimAccident(s, t);
  src.item as s -> tgt.item as t then ClaimItem(s, t); // src.patientPaid -> tgt.patientPaid;
  src.total -> tgt.total;
}

group ClaimRelated(source src, target tgt) extends BackboneElement {
  src.claim -> tgt.claim;
  src.relationship -> tgt.relationship;
  src.reference -> tgt.reference;
}

group ClaimPayee(source src, target tgt) extends BackboneElement {
  src.type -> tgt.type;
  src.party -> tgt.party;
}

// group ClaimEvent(source src, target tgt) extends BackboneElement {
// src.type -> tgt.type;
// src.when : dateTime -> tgt.when;
// src.when : Period -> tgt.when;
// }
group ClaimCareTeam(source src, target tgt) extends BackboneElement {
  src.sequence -> tgt.sequence;
  src.provider -> tgt.provider;
  src.responsible -> tgt.responsible;
  src.role -> tgt.role;
  src.qualification -> tgt.specialty;
}

group ClaimSupportingInfo(source src, target tgt) extends BackboneElement {
  src.sequence -> tgt.sequence;
  src.category -> tgt.category;
  src.code -> tgt.code;
  src.timing : date -> tgt.timing;
  src.timing : Period -> tgt.timing;
  src.value : boolean -> tgt.value;
  src.value : string -> tgt.value;
  src.value : Quantity -> tgt.value;
  src.value : Attachment -> tgt.value;
  src.value : Reference -> tgt.value;
  src.reason -> tgt.reason; // src.value : Identifier -> tgt.value;
}

group ClaimDiagnosis(source src, target tgt) extends BackboneElement {
  src.sequence -> tgt.sequence;
  src.diagnosis : CodeableConcept -> tgt.diagnosis;
  src.diagnosis : Reference -> tgt.diagnosis;
  src.type -> tgt.type;
  src.onAdmission -> tgt.onAdmission;
}

group ClaimProcedure(source src, target tgt) extends BackboneElement {
  src.sequence -> tgt.sequence;
  src.type -> tgt.type;
  src.date -> tgt.date;
  src.procedure : CodeableConcept -> tgt.procedure;
  src.procedure : Reference -> tgt.procedure;
  src.udi -> tgt.udi;
}

group ClaimInsurance(source src, target tgt) extends BackboneElement {
  src.sequence -> tgt.sequence;
  src.focal -> tgt.focal;
  src.identifier -> tgt.identifier;
  src.coverage -> tgt.coverage;
  src.businessArrangement -> tgt.businessArrangement;
  src.preAuthRef -> tgt.preAuthRef;
  src.claimResponse -> tgt.claimResponse;
}

group ClaimAccident(source src, target tgt) extends BackboneElement {
  src.date -> tgt.date;
  src.type -> tgt.type;
  src.location : Address -> tgt.location;
  src.location : Reference -> tgt.location;
}

group ClaimItem(source src, target tgt) extends BackboneElement {
  src.sequence -> tgt.sequence;
  src.careTeamSequence -> tgt.careTeamSequence; // src.traceNumber -> tgt.traceNumber;
  src.diagnosisSequence -> tgt.diagnosisSequence;
  src.procedureSequence -> tgt.procedureSequence;
  src.informationSequence -> tgt.informationSequence;
  src.revenue -> tgt.revenue;
  src.category -> tgt.category;
  src.productOrService -> tgt.productOrService;
  src.modifier -> tgt.modifier; // src.productOrServiceEnd -> tgt.productOrServiceEnd;
  src.programCode -> tgt.programCode;
  src.serviced : date -> tgt.serviced;
  src.serviced : Period -> tgt.serviced;
  src.location : CodeableConcept -> tgt.location;
  src.location : Address -> tgt.location;
  src.location : Reference -> tgt.location;
  src.quantity -> tgt.quantity; // src.patientPaid -> tgt.patientPaid;
  src.unitPrice -> tgt.unitPrice;
  src.factor -> tgt.factor;
  src.net -> tgt.net; // src.tax -> tgt.tax;
  src.udi -> tgt.udi;
  src.bodySite : CodeableConcept as s ->  tgt.bodySite as t,  t.site = s;
  src.encounter -> tgt.encounter;
  src.detail as s -> tgt.detail as t then ClaimItemDetail(s, t);
}

// group ClaimItemBodySite(source src, target tgt) extends BackboneElement {
// src.site -> tgt.site;
// src.subSite -> tgt.subSite;
// }
group ClaimItemDetail(source src, target tgt) extends BackboneElement {
  src.sequence -> tgt.sequence;
  src.revenue -> tgt.revenue; // src.traceNumber -> tgt.traceNumber;
  src.category -> tgt.category;
  src.productOrService -> tgt.productOrService;
  src.modifier -> tgt.modifier; // src.productOrServiceEnd -> tgt.productOrServiceEnd;
  src.programCode -> tgt.programCode;
  src.quantity -> tgt.quantity; // src.patientPaid -> tgt.patientPaid;
  src.unitPrice -> tgt.unitPrice;
  src.factor -> tgt.factor;
  src.net -> tgt.net; // src.tax -> tgt.tax;
  src.udi -> tgt.udi;
  src.subDetail as s -> tgt.subDetail as t then ClaimItemDetailSubDetail(s, t);
}

group ClaimItemDetailSubDetail(source src, target tgt) extends BackboneElement {
  src.sequence -> tgt.sequence;
  src.revenue -> tgt.revenue; // src.traceNumber -> tgt.traceNumber;
  src.category -> tgt.category;
  src.productOrService -> tgt.productOrService;
  src.modifier -> tgt.modifier; // src.productOrServiceEnd -> tgt.productOrServiceEnd;
  src.programCode -> tgt.programCode;
  src.quantity -> tgt.quantity; // src.patientPaid -> tgt.patientPaid;
  src.unitPrice -> tgt.unitPrice;
  src.factor -> tgt.factor;
  src.net -> tgt.net; // src.tax -> tgt.tax;
  src.udi -> tgt.udi;
}