client-py
client-py copied to clipboard
valueDecimal won't accept long values
Questionnaire responses can have an answer of type integer, limited to 32 bits; or they can use valueDecimal for bigger numbers.
However, if the client doesn't put a decimal point, and instead sets valueDecimal to a number that won't fit into an int (e.g. 10000000000000000000), it gets parsed as a long, and the parser gives a validation error:
FHIRValidationError: {root}: group: question: answer: valueDecimal: Wrong type <type 'long'> for property "valueDecimal" on $lt;class 'fhirclient.models.questionnaireresponse.QuestionnaireResponseGroupQuestionAnswer'>, expecting <type 'float'>
Long values without decimal points should be accepted here (even if it means having to convert to a float).
This is a current limitation since we map native Python types to many FHIR primitives, in this case we use float for Decimal.
In an update we want to also use custom classes for FHIR primitives, at which point we can address this issue as well. See #30 .