LanguageValues and typesStandard typesHealth
Dose
On this page
An amount of a medicine: 500 mg or 5 ml.
Use it for a single dose. For how and how often to take one, use DosageInstruction.
Shape
One of these, each with its own fields:
Example
Dose.mass { amount: 500mg }Good to know
- The other variant is
Dose.volume { amount: ... }. - It must be above zero.
==tells you whether two are the same.<andlist.sort_bydon't take it.
In JSON
An object of its variant's name, as tag, and the variant's fields, in a request, a response or json.write:
{"tag":"mass","amount":{"value":"0.0005","unit":"kg"}}{"tag":"mass","amount":{"value":"0.000000125","unit":"kg"}}{"tag":"mass","amount":{"value":"0.001","unit":"kg"}}
Details
Text form, storage, how it is shown, and operations
Dose is in the group Health, and has been in Jadpo since 0.1.0.
Text form
It has no single text form, so text.from and text.parse don't take it.
How it is stored
It is stored in 2 columns, each named for the field, _ and its suffix. This is {"tag":"mass","amount":{"value":"0.001","unit":"kg"}}:
| Column | Type | Holds |
|---|---|---|
<field>_kind |
text |
'mass' |
<field>_amount |
numeric(38, 9) |
0.001 |
How it is shown to people
text.format(value, locale:) shows it to people in their locale.
With locale: Locale.en_gb:
| Value | Shown |
|---|---|
{"tag":"mass","amount":{"value":"500","unit":"mg"}} |
500 mg |
{"tag":"mass","amount":{"value":"125","unit":"mcg"}} |
0.125 mg |
{"tag":"mass","amount":{"value":"1","unit":"g"}} |
1,000 mg |
{"tag":"volume","amount":{"value":"5","unit":"ml"}} |
5 ml |
Operations
It also takes text.format, json.read, json.write and ==. How every standard type behaves says how they work.
Markdown for agents: /docs/types/type-dose.md.Built from Jadpo main at aee2e8f.