LanguageValues and typesStandard typesHealth
BloodGlucose
On this page
A blood sugar level, shown 5.5 mmol/L.
Use it for a person's reading. For any other concentration, use Concentration.
Shape
One Concentration, with limits of its own.
Example
BloodGlucose(0.99gL)A value outside its limits breaks min or max.
text.parse(raw, as: BloodGlucose) reads one from text that comes from outside. Text that isn't one at all fails malformed, such as 5.5, mmol/L or high.
These operations give one: units.of and units.sum.
Good to know
- It is shown in millimoles per litre, so
0.99gLshows as5.5 mmol/L. To start from that figure, useunits.of(5.5, ConcentrationUnit.millimole_of_glucose_per_litre). - It can't be below zero.
==tells you whether two are the same, and<andlist.sort_bycompare and sort them.- A field that holds one counts as personal data (
health), so you don't mark it yourself.
In JSON
An object of its parts, in a request, a response or json.write:
{"value":"0.7206228","unit":"gL"}{"value":"0.99","unit":"gL"}{"value":"0.99085635","unit":"gL"}
Details
Text form, storage, how it is shown, and operations
BloodGlucose is in the group Health, and has been in Jadpo since 0.1.0.
Text form
text.from writes one standard text form, the same form text.parse reads back: 0.7206228 gL, 0.99 gL and 0.99085635 gL.
How it is stored
It is stored in one column named for the field, of type numeric(38, 9), holding the concentration in grams per litre (g/L). 0.99085635 gL is stored as 0.99085635.
How it is shown to people
text.format(value, locale:) shows it to people in their locale. A call may also give unit:.
With locale: Locale.en_gb:
| Value | Shown |
|---|---|
0.7206228 gL |
4 mmol/L |
0.99 gL |
5.5 mmol/L |
0.99085635 gL |
5.5 mmol/L |
2.01774384 gL |
11.2 mmol/L |
Operations
units.in(value: Quantity, unit: QuantityUnit, scale: Int, rounding: Rounding) -> Decimal:valueinunit, a unit of its kind, as aDecimalofscaleplaces rounded byrounding:units.in(5km, LengthUnit.mile, scale: 2, rounding: Rounding.half_even)is3.11.units.of(value: Number, unit: QuantityUnit) -> Quantity:valueofunit, anIntor aDecimal, as the quantity ofunit's kind, converted exactly to the base unit and rounded half to even to the kind's scale:units.of(5, LengthUnit.mile).units.sum(items: List<Quantity>) -> Quantity: The items added up, all of one kind; nothing for no items. ATemperatureor aSoundLeveldoesn't add to itself, so neither is summed.
It also takes text.parse, text.from, text.format, json.read, json.write and ==. How every standard type behaves says how they work.
Markdown for agents: /docs/types/type-blood-glucose.md.Built from Jadpo main at aee2e8f.