FirelyTeam / firely-net-sdk

The official Firely .NET SDK for HL7 FHIR
Other
816 stars 340 forks source link

Investigate the type of ElementModel.Quantity.Value #2791

Open Kasdejong opened 1 month ago

Kasdejong commented 1 month ago

Describe the bug Our ElementModel.Quantity datatype has a value field of type System.Decimal. There are two issues with this:

Now that our metric service interface works with strings instead of decimals, we could either:

ewoutkramer commented 1 month ago

We use decimal in more places:

So, the potential "problem" is bigger (and I knew it was not 100% to the FHIR spec), but anyone working with decimals in .NET will be using, well, decimal. So, that's why I chose to use the normal type. How big is this problem? Is this relevant for, say, lab values? I really don't know.

In any case, I don't mind making FHIR.Decimal use string as a backing value (it aligns well with #2781 that I already proposed for 6.0 I think). I don't know that we can do the same for Element.Quantity (although it also has a concept of raw text).

In any case, the logic in our SDK working with these types are using decimal internally, so the problem remains (if it is there).