Weight
identity.person.weightPerson weight in kg, lbs, or other units (e.g., 75kg, 165lbs). Transforms to DOUBLE (kilograms). Decompose extracts value and unit.
Worked samples
DuckDB 1.5.5 · finetype 0.6.64
| Value | As DOUBLE | unit | value |
|---|---|---|---|
| 75 kg | 75.0 | KG | 75.0 |
| 165 lbs | 74.84283005688056 | LBS | 165.0 |
| 68.5 kg | 68.5 | KG | 68.5 |
| 170 pounds | 77.11079460405875 | POUNDS | 170.0 |
Shape
^[0-9]+(\.[0-9]+)?\s*(kg|lbs|lb|g|oz|stones)?$| Value | Length | Shape |
|---|---|---|
| 75 kg | 5 | matches |
| 165 lbs | 7 | matches |
| 68.5 kg | 7 | matches |
| 170 pounds | 10 | rejected |
| 75 k | 4 | rejected: one character short |
Told apart
Going the other way, this type's own rule accepts 1 of 4 samples of Gender Code.
Background
Origin
Before 2019 the kilogram was tied to a physical object, the International Prototype Kilogram.[1]
The international yard and pound were agreed by representatives of six nations on 1 July 1959.[2] The signatories were Australia, Canada, New Zealand, South Africa, the United Kingdom and the United States.[2] The agreement defined the international pound as 0.45359237 kilograms.[2] The United States National Bureau of Standards adopted the metric-based units effective 1 July 1959.[2]
The stone is equal to 14 avoirdupois pounds.[3] The stone continues in customary use in the United Kingdom and Ireland for body weight.[3]
Use
NIST's Guide to the SI gives lb as the symbol for the avoirdupois pound and oz for the avoirdupois ounce.[4] A number with no unit is the hardest case: decide the unit from the source system's documentation, not from the size of the value, because a heavy adult in kilograms and a light adult in pounds overlap. (Meridian's view)
In the UK and Ireland a body weight may be given in stones and pounds, as in 11 stone 4, meaning 11 stones and 4 pounds.[3] A value like 11 stone 4 is two numbers in one field, so split it and convert both parts rather than reading only the leading number. (Meridian's view)
The NHANES 2017-2018 body measures file sets weight to missing for participants with limb amputations.[5] The same file carries a comment code for weights taken while the participant kept their own clothing on.[5] Look for companion flags like these before you analyse weights, because a measured weight and a usable weight are not always the same thing. (Meridian's view) Convert everything to kilograms once, keep the original text alongside it, and range-check the result so a mislabelled unit shows up as an outlier. (Meridian's view)
Where you'll meet it
The CDC's NHANES 2017-2018 body measures file records weight in the variable BMXWT, labelled Weight (kg).[5] In that file the observed weights run from 3.2 to 242.6 kg.[5]
Sources
- [1]SI Units - Massdocumentation
- [2]International yard and poundsecondary source
- [3]Stone (unit) - Wikipediasecondary source
- [4]NIST Guide to the SI, Appendix B.9: Factors for units listed by kind of quantity or field of sciencedocumentation
- [5]Body Measures (BMX_J)dataset
Detection notes
v1 migration: Was person.weight. Transform converts to kilograms. Handles kg, lbs, pounds, stones. Decompose extracts value and unit.
Use it
$ finetype infer -i "75 kg" --mode column
→ identity.person.weight
SELECT ft_infer('75 kg');
-- → 'identity.person.weight'CASE
WHEN UPPER({col}) LIKE '%LB%' OR UPPER({col}) LIKE '%POUND%' THEN CAST(REGEXP_EXTRACT({col}, '^([0-9.]+)', 1) AS DOUBLE) / 2.20462
ELSE CAST(REGEXP_EXTRACT({col}, '^([0-9.]+)', 1) AS DOUBLE)
END
Schema
https://meridian.online/schemas/identity.person.weight · Frictionless type number
finetype taxonomy identity.person.weight -o json-schema