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

Quantity does not accept integers #51

Closed
hheldenbrand opened this issue May 16, 2018 · 2 comments
Closed

Quantity does not accept integers #51

hheldenbrand opened this issue May 16, 2018 · 2 comments

Comments

@hheldenbrand
Copy link

I know similar issues have already been raised (e.g. #33) but wanted to add that the mapping of the python type 'float' to quantity.value causes valid integer values to be rejected.

In this example: http://hl7.org/fhir/medicationdispense0303.json.html the values in daysSupply and quantity would incorrectly raise FHIRValidationErrors as type str when float is expected.

@p2
Copy link
Member

p2 commented May 16, 2018

This seems to work for me with version 3.0.0?

$ python
Python 3.6.1 (default, Apr  4 2017, 09:40:21) 
>>> import json
>>> with open('medicationdispense0303.json', 'r') as h:
...     js = json.load(h)
>>> from fhirclient.models import medicationdispense as _MD
>>> md = _MD.MedicationDispense(js)
>>> md.daysSupply
<fhirclient.models.quantity.Quantity object at 0x10a8cd358>
>>> md.daysSupply.value
10

@hheldenbrand
Copy link
Author

Thanks for the response and clear example code. You are correct and your example helped me find the issue further upstream in my own code.

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