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

Add support for fractional doses (beyond half measures) #1

Open
Selbosh opened this issue Apr 16, 2021 · 0 comments
Open

Add support for fractional doses (beyond half measures) #1

Selbosh opened this issue Apr 16, 2021 · 0 comments

Comments

@Selbosh
Copy link
Owner

Selbosh commented Apr 16, 2021

The package currently supports expressions with half measures in them, including mixed fractions:

doseminer::replace_numbers(c('half a spoonful', 'three and a half tablets'))
## [1] "0.5 a spoonful" "3.5 tablets" 

But more unusual fractions like thirds, fifths and quarters don't really work because it just kind of adds the denominator:

doseminer::replace_numbers(c('thirty three and a third', 'four fifths'))
## [1] "37" "9" 

The problem is with fixing this (assuming such cases appear often enough in prescriptions to be worth worrying about) without unintentionally breaking the parsing of ordinal words, which look a lot like fractions:

doseminer::replace_numbers(c('every third day', 'every fifth hour'))
## [1] "every 3 day"  "every 5 hour"

However with enough ambition, 'every 1/3 day' could be interpreted as '(every day) / 3' and end up giving the right result, with an appropriate redesign of how intervals are calculated.

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

1 participant