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

Insulin concentration #1344

Open
adamradocz opened this issue Dec 25, 2023 · 1 comment
Open

Insulin concentration #1344

adamradocz opened this issue Dec 25, 2023 · 1 comment

Comments

@adamradocz
Copy link

adamradocz commented Dec 25, 2023

Is your feature request related to a problem? Please describe.
Insulin concentration feature would be nice, but I'm not sure whether does it suit to this library or not.
There are two units to measure insulin concentration.

  • IU/mL
  • pmol/L (this is already covered by the library)

Unfortunately, the correct value converting between these two different approaches is not the most-used, and I'd like to mitigate this.

IU stands for international unit and that should be implemented first.
The #127 adds VitaminA as a unit, which uses the International Unit as a base, but I think that's not the right approach. I can see the benefits of types like vitamin, but IU is the unit and not the Vitamin.

Describe the solution you'd like
Units.Net should contain only the core units and a separate extension library should be created. This way the this library can be stay lean, but the useful features still can be used as need. Like the vitamins, useful constants (eg Glucose Molecular Weight for Mass and Molarity conversion what was reqested in #690), etc.

@angularsen
Copy link
Owner

angularsen commented Dec 28, 2023

I'm not familiar with this domain, so please help me understand better how you would change this.

From https://en.wikipedia.org/wiki/International_unit:

In pharmacology, the international unit (IU) is a unit of measurement for the effect or biological activity of a substance, for the purpose of easier comparison across similar forms of substances. International units are used to quantify vitamins, hormones, some medications, vaccines, blood products, and similar biologically active substances.

  • UnitsNet is structured around quantities (Length, Mass) with associated units (centimeter, kilogram)
  • InternationalUnit seems to me a unit in this structure
  • According to wiki, we can't compare 1 IU of VitaminA to Insulin or any other substance.
  • Their IU units are effectively different units, so it does make sense to treat VitaminA and Insulin as different quantities with different IU units, instead of trying to "share" an IU unit if that is what you proposed.

However, I realize that adding VitaminA, Insulin, and a bunch of other vitamins, hormones, medications, vaccines etc as separate quantities may not be a good fit for UnitsNet structure:

  • It does not scale very well to have a quantity type for every substance, with a bunch of generated code for each. There are many substances.
  • UnitsNet adds the most value when having multiple units to convert between, VitaminA only has a single unit InternationalUnit and I imagine this would be similar for Insulin and other substances?

Maybe these substances are better represented in a different way? Something that creates a useful abstraction when working with different kinds of substances and converting to other quantities? And maybe outside UnitsNet main library?

For example, it seems useful to be able to convert from IU units to mass equivalent units as per wiki:

image

If you could give a bullet list of what changes you would make and why, that would be helpful for me to help move this forward. Someone with domain knowledge can best make decisions here, I can help make it fit into UnitsNet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants