r-quantities / substances

Substance-aware unit conversions
MIT License
0 stars 2 forks source link

Initial clinical laboratory unit commit #4

Open DBartlettHP opened 4 months ago

DBartlettHP commented 4 months ago

Related to #2

@billdenney

Here is a data set of clinical units for testing.

billdenney commented 4 months ago

@Enchufa2, Here is the initial concept of how we are tracking clinical laboratory units. There are several notable features of the dataset that will be worth discussion:

  1. It is possible to convert some units from conventional to SI automatically. I assume that those should be filtered out of this package.
  2. Many units are not valid as SI units on their own. As an example, the acid phosphatase conventional units are nkat/L and are converted to "U/L" (where "U" stands for "international units").

I think that the goal here would be to do a few things:

  1. Detect when the units are currently-valid units by themselves (e.g. "mg/dL" gets converted to "mmol/L" for glucose), but they need a substance-specific conversion factor to convert from "mg" to "mmol".
  2. Detect when the units are not currently-valid (e.g. "nkat/L" above) which may happen for both the conventional and SI units, add the missing units as a new base unit, then add a substance-specific conversion factor.
    1. Within this, we would also need to detect which parts are not valid units in the current units library, the numerator, the denominator, or both. Based on prior discussion, I don't think that this is currently possible, so it may need to be a custom table stored within the substances package that is dynamically generated.

Does that sound right to you?

billdenney commented 2 months ago

@Enchufa2, ping on this PR/issue discussion.

Enchufa2 commented 2 months ago

Thanks for the reminder, I'll try to find time for this, but I'm in "best effort" mode this time of year.