Stream: implementers
Topic: UCUM- New units(s) for "log of count"
Colin E. (Sep 16 2021 at 19:14):
Note: This question is quite UCUM-specific, but also could have "what do we want?" implications for implementers, so I hope it's considered on-topic. If not let me know.
I have been looking into UCUM Gaps- where units are in use in UK Pathology practice that don't appear to be expressible in UCUM. There is one type that raises some interesting questions.
We have labs reporting results in units of log(copies) / L This particular unit is used in situations like reporting viral load in infectious diseases. There are other situations where the log of a measured value is used, drug overdose tests being one I believe.
A user/implementer can't create a logarithmic unit in a UCUM expression. UCUM can handle logarithmic units (e.g. Bel, dBel) but they have to be defined as "special" unit atoms in the core UCUM data file (ucum essence.xml), by the Regenstrief / UCUM team.
copy or copies is one of the infinite set of countable items whose unit/dimension is "1", so if we were to ask Regenstrief for a [log_copies] unit atom, we would also potentially and up asking for [log_redbloodcells], [log_whitebloodcells], [log_basepairs] etc. ad infinitum.
It seems to me the better option would be to see if either one or two general-purpose logarithmic unit atoms could be defined in UCUM.
I believe a unit of the form [log_number] (where "number" implies an integer (countable) value was fed to the log(10) calculation)
and potentially-
[log_amount] where "amount" allows for any (positive) real number (a double in reality?) as the value
Would allow any dimensionless quantity (where the dimension of the starting value is 1) to be expressed.
I must admit i'm not sure if this approach can be extended to values of non-Unity dimension (e.g. "moles per litre"), my maths rather runs out of puff at that point.
I'd be interested in views/comments. Are other countries / disciplines using logarithmic results, and if so how are you implementing them?
Grahame Grieve (Sep 16 2021 at 19:21):
I'm not familiar with units like this. But I can see the underlying rationale. On the other hand, the conversion maths sounds a bit scary once it mixes in with other units (btw @Swapna Abhyankar )
Colin E. (Sep 19 2021 at 16:40):
I'm no great shakes as a software developer myself, so i'm cautious about making claims about what would be easy vs. hard to implement, but the logic seems straightforward.
in UCUM non- ratio scale units are implemented by having a pair of mapping functions defined, so the user-side unit (U) is transformed into a ratio scale equivalent (U'), the required conversions and calculations are done in "ratio space" using U', and then the result is converted back to the original non-ratio scale U using the inverse mapping function. In this case the mapping functions would be 10^x and log10(x)
That all sounds reasonable. What I don't know is, from an implementation perspective, whether keeping track of an incoming value that came in as the log of a value (which is itself just a number) and was then mapped to a different number (=10^value) for internal calculation purposes would make it hard to keep track of the "logginess" of the value for re-conversion of the return value. That would need someone with knowledge of the internal workings of one or more of the s/w implementations to comment I think.
Colin E. (Sep 19 2021 at 18:56):
As an extension to this idea, if Regenstrief were prepared to countenance the creation of {log_number] and [log_amount] type units (denoting integer and real dimensionless values respectively) then it would seem resonable to propose creating units of [number] and [amount] as well.
I'm thinking these might satisfy the desire to put SOMETHING in the units field, as people seem to shy away from the unit "1" which is formally the proper unit for dimensionless values. Meanwhile we could get off the slippery slope implied by the units already in UCUM of [CFU] and [PFU], which are themselves just alternate names for "1", but seem to imply to possibility for naming every possible countable value with its own unit.
Grahame Grieve (Sep 19 2021 at 22:33):
I maintain the formal test cases and the java reference implementation so I'm kind of interested in the implementation question.
Last updated: Apr 12 2022 at 19:14 UTC