FHIR Chat · Can't cast to Money · R3/R4 Conversion work

Stream: R3/R4 Conversion work

Topic: Can't cast to Money


view this post on Zulip Vadim Peretokin (Dec 02 2018 at 06:39):

I'm having the same issue in https://github.com/HL7/fhir/pull/335 and https://github.com/HL7/fhir/pull/334 - I can't move a money element around, it fails on casting:

org.hl7.fhir.exceptions.FHIRException: Unable to convert a org.hl7.fhir.r4.elementmodel.Element to an Money
    at org.hl7.fhir.r4.model.Base.castToMoney(Base.java:508)
    at org.hl7.fhir.r4.model.ExplanationOfBenefit$TotalComponent.setProperty(ExplanationOfBenefit.java:10501)
    at org.hl7.fhir.r4.utils.StructureMapUtilities.processTarget(StructureMapUtilities.java:1809)

I've looked into it, Base.java public Money castToMoney(Base b) is failing and doesn't think b is an instanceOf Money even though b.toString() says totalCost=Money[3 children]

view this post on Zulip Vadim Peretokin (Dec 02 2018 at 06:39):

Given that Money was reworked I'm guessing this is the sideeffect

view this post on Zulip Grahame Grieve (Dec 03 2018 at 18:52):

hmm. I'll have a look at it

view this post on Zulip Vadim Peretokin (Dec 04 2018 at 07:35):

OK let me know. I have a couple of maps that are stuck on this

view this post on Zulip Grahame Grieve (Dec 04 2018 at 18:41):

ok:

group ExplanationOfBenefitTotalCost(source src, target tgt) extends BackboneElement {
  // src.category -> tgt.category;
  src as vs -> tgt.amount as vt then Money(vs, vt);
}

view this post on Zulip Grahame Grieve (Dec 04 2018 at 18:42):

why is category commented out?

view this post on Zulip Grahame Grieve (Dec 04 2018 at 18:42):

I fixed the mapping. well, I changed it to what works. In general, I would not expect what you currently have to work except for primitives

view this post on Zulip Vadim Peretokin (Dec 04 2018 at 18:43):

Like the PR said with the [WIP], it was still a work in progress :wink:

view this post on Zulip Grahame Grieve (Dec 04 2018 at 18:43):

ok

view this post on Zulip Vadim Peretokin (Dec 04 2018 at 18:43):

thanks, I'll finish it up and the other one as well

view this post on Zulip Vadim Peretokin (Dec 04 2018 at 18:44):

I forgot about the simple/vs complex, now it makes sense


Last updated: Apr 12 2022 at 19:14 UTC