-
Notifications
You must be signed in to change notification settings - Fork 2
toQuantity() ignores its optional unit parameter #310
Copy link
Copy link
Open
Labels
bugSomething isn't workingSomething isn't workingfhir.pathRelated to the FHIRPath moduleRelated to the FHIRPath module
Description
The FHIRPath spec defines toQuantity() with an optional unit argument:
toQuantity([unit : String]). The parser correctly accepts 0 or 1 arguments, but
ToQuantity.evaluate() never reads or applies the argument — it is silently dropped.
Additionally, the parser does not star-unpack the argument list when constructing the
ToQuantity node, so the argument is lost before it even reaches evaluate().
Expected behaviour
'1.5'.toQuantity('mg') → 1.5 'mg'
'1.5'.toQuantity() → 1.5 '1' (dimensionless)
Actual behaviour
'1.5'.toQuantity('mg') → 1.5 '1' (unit argument ignored)
Suggested fix
- In
parser.py: pass the optional unit string argument when constructingToQuantity. - In
conversion.py: apply the unit argument inevaluate(), overriding the parsed unit
if one is provided.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingfhir.pathRelated to the FHIRPath moduleRelated to the FHIRPath module