Jadpo is experimental and not ready for production. These docs follow the compiler's main branch as of 1 Nov 2026. What's built · Install 0.2.0
jadpo
Reference: Standard library

Standard types

BloodGlucose

On this page

A blood glucose level, a Concentration never below 0: units.of(5.5, ConcentrationUnit.millimole_of_glucose_per_litre), shown 5.5 mmol/L. Health data.

Health; ordered; since Jadpo 0.1.0.

Make one

It is a Concentration with bounds of its own: build one as you build a Concentration, and a value outside its bounds breaks min or max.

text.parse(raw, as: BloodGlucose) reads one from its text; text that isn't one at all fails malformed, such as 5.5, mmol/L or "".

These operations give one: units.of and units.sum.

Text, JSON and storage

text.from writes its canonical text, the one form text.parse reads back. JSON sends an object of its parts.

Text JSON
0.7206228 gL {"value":"0.7206228","unit":"gL"}
0.99 gL {"value":"0.99","unit":"gL"}
0.99085635 gL {"value":"0.99085635","unit":"gL"}
2.01774384 gL {"value":"2.01774384","unit":"gL"}

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.

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: value in unit, a unit of its kind, as a Decimal of scale places rounded by rounding: units.in(5km, LengthUnit.mile, scale: 2, rounding: Rounding.half_even) is 3.11.
  • units.of(value: Number, unit: QuantityUnit) -> Quantity: value of unit, an Int or a Decimal, as the quantity of unit'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. A Temperature or a SoundLevel doesn't add to itself, so neither is summed.

Like every standard type, it also has the contract's own operations: text.parse, text.from, text.format, json.read, json.write and ==. It is ordered, so < and sorting take it. Every standard type meets one contract says how they work.

Markdown for agents: /docs/types/type-blood-glucose.md.Built from Jadpo main at e00e61f.