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

Fix mme calc dose range #196

Merged
merged 5 commits into from
Aug 11, 2022
Merged

Fix mme calc dose range #196

merged 5 commits into from
Aug 11, 2022

Conversation

bryantaustin13
Copy link
Contributor

@bryantaustin13 bryantaustin13 commented Aug 3, 2022

A medication using doseRange was erroring on ToQuantity:
org.opencds.cqf.cql.engine.exception.CqlException: Could not resolve call to operator 'ToQuantity(org.hl7.fhir.r4.model.Quantity)' in library 'MMECalculator'.
Adjusted MMECalculator.ToQuantity to handle this using quantity.system.value = 'http://terminology.hl7.org/CodeSystem/v3-orderableDrugForm'. This might be too specific and need adjustment. To test do
POST http://localhost:8080/cds-services/opioidcds-08-order-sign
and use the requests
https://github.com/cqframework/opioid-cds-r4/blob/Fix_MMECalc_doseRange/input/pagecontent/requests/OpioidCDSREC08OrderSign/request-example-rec-08-order-sign-mme-doseRange.json
AND
https://github.com/cqframework/opioid-cds-r4/blob/Fix_MMECalc_doseRange/input/pagecontent/requests/OpioidCDSREC08OrderSign/request-example-rec-08-order-sign-mme-greater-than-fifty.json
plus whatever other testing is needed. Both these should return cards.

@brynrhodes
Copy link
Member

So this logic seems to be trying to account for the case when the FHIR.Quantity provided has a system of "orderable drug form", and appears to be collapsing the "unit" and "code" elements in that case. So a couple points:

  1. It's never safe to use the "unit" element formally, that's not constrained to be a code of the given system. If a system is specified, the Quantity should have a code value from that system. If it doesn't that's invalid FHIR data and we should not be calculating with it
  2. We can't just use the code from a system of "orderable-drug-form" as a UCUM quantity, we would need to convert from the orderable-drug-form code to a corresponding UCUM unit. Looking at the orderable-drug-form code system though, that doesn't seem computable: https://terminology.hl7.org/3.1.0/CodeSystem-v3-orderableDrugForm.html

So, where are we getting a quantity that has that system?

@Capt-Mac Capt-Mac self-requested a review August 11, 2022 20:53
@Capt-Mac Capt-Mac merged commit f9ca0f0 into master Aug 11, 2022
@Capt-Mac Capt-Mac deleted the Fix_MMECalc_doseRange branch August 11, 2022 20:54
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

Successfully merging this pull request may close these issues.

3 participants