Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Present decimal values as integer for Json output #563

Closed
LeoWirz opened this issue May 30, 2023 · 2 comments
Closed

Present decimal values as integer for Json output #563

LeoWirz opened this issue May 30, 2023 · 2 comments

Comments

@LeoWirz
Copy link

LeoWirz commented May 30, 2023

Is your feature request related to a problem? Please describe.
It is related to this issue. The goal was to be able to output round decimal value as integer for "Quantity" (ie. "400.0" should be presented as "400").

The solution of implementing a custom "BsonDecimalSerializer " works to format the decimal value as an integer when we get it from the Mongo DB.

While it works as intended when we get the final output as an XML, we still have an issue when we want to get the result as a JSON because the "FhirJsonSerializer" that is used to produce it adds the ".0" again.

XML output
image
JSON output
image

Describe the solution you'd like
A solution would be to add a custom JSON converter for decimal values (like this), but I couldn't find a way of adding a custom converter to the FhirJsonSerializer.

Is there a solution to adapt the FhirJsonSerializer to handle this scenario ?

Describe alternatives you've considered

  1. Storing integer values as "Integer" instead of "Quantity" but the issue is that the fhir Integer resource does not have some fields such as a "unit".
  2. Creating a custom JsonFhirFormatter that doesn't rely on the FhirJsonSerializer
@kennethmyhra
Copy link
Collaborator

I think this is a question that should be asked in https://github.com/FirelyTeam/firely-net-sdk. FhirJsonSerializer is a component that is part of that library.

@kennethmyhra
Copy link
Collaborator

Closing this. Let me know or re-open if you still think it is relevant.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants