Quantity comparisons for "unconvertible" units when they are the same

Open
#350 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
38/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
javascript
Domain
backend

Research direction

Start by reproducing the GreaterOrEqual example with Quantity values using the exact same unit [IU]/mL, then trace the engine's Quantity comparison and UCUM conversion behavior. Done means the expected behavior for identical arbitrary units is decided and covered by a regression test, including whether the comparison returns true rather than null.

Written by the indexing model from the issue text.

Description

A recent fqm-execution issue (#352)[https://github.com/projecttacoma/fqm-execution/issues/352]. Uncovered an issue with comparison of unconvertible units in a GreaterOrEqual comparison of Quantity for [IU]/mL. ex logic:

Dalteparin.dosage ( ) >= 10000 '[IU]/mL'

The result of Datleparin.dosage ( ) is a Quantity 10000 '[IU]/mL'. It seems like this logic should result in true for the comparison, but it results in null. On deeper inspection this is occurring because the comparison logic for Quantity in the engine is converting the units even though they are the "same". The UCUM library we use refuses to convert [IU]/mL to [IU]/mL with the response "Attempt to convert arbitrary unit international unit per milliliter". This appears to be considered arbitrary because [IU] is different depending on the chemical.

This raises two questions?

  • Is this actually correct that it should throw a fit here and return null for this Quantity comparison of [IU]/mL to [IU]/mL?
  • Should Quantity comparisons of the same exact unit actually skip past the conversion stop?
Dominant language
JavaScript
Stars
86
Forks
40
PR merge metrics
No merged PRs in 30d

Getting set up

  • No Dockerfile or Docker Compose file
  • Has a pull request template
  • No contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from cqframework/cql-execution

All issues in cqframework/cql-execution

Similar issues

More JavaScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.