Dose as SimpleQuantity

71 views
Skip to first unread message

rdbo...@gmail.com

unread,
Apr 22, 2021, 3:20:33 PM4/22/21
to FHIR DOTNET
Hello, We are upgrading from a 1.* version of Hl7.Fhir.STU3. We are getting compile error when trying to convert a MedicationRequest dose to a SimpleQuantity. It does not seem like SimpleQuantity exists and the Type of Dose is now DataType. Here is the code before:

Snippetif (!(dosageInstruction.Dose is Quantity quantity)) {     quantity = dosageInstruction.Dose as SimpleQuantity; }

Ewout Kramer

unread,
Apr 23, 2021, 3:02:27 AM4/23/21
to FHIR DOTNET
That is right - SimpleQuantity has been removed.  It was just a direct subclass of Quantity with no additional members or functionality, so you can just use Quantity instead.

There were good reasons to (finally!) clean this up: this change reflects that SimpleQuantity is not really a datatype in FHIR but a profile on a datatype (that's why it is printed in pink for example here:  http://www.hl7.org/fhir/stu3/datatypes.html#2.26.0).  You can also spot the fact that it did not really exist as a distinct type by the fact that, when using a SimpleQuantity in, say, Observation.value[x], you will see "Observation.valueQuantity" in the json/xml. When you would parse it again, the API will have no other clue than to parse this as a Quantity. In other words, the type did not even roundtrip if you tried.   All in all, a constant source of confusion with no added value, so we removed it.

As for Dose and DataType - this is a slight restructuring (we added some interim abstract classes between Element and the datatypes) to align with the very sensible introduction of these abstract types in R5. We have also introduced these abstract classes to R4, so that for people working with R3/R4/R5 the datatype hierarchy is now consistent across versions.


Op donderdag 22 april 2021 om 21:20:33 UTC+2 schreef rdbo...@gmail.com:
Reply all
Reply to author
Forward
0 new messages