fix(labs): read unitless specific gravity, pH and INR, and any lab category spelling

A urinalysis sent its specific gravity and pH as bare numbers, which
failed as missing_unit and made a normal report a partial success. A
number without a unit is now the unity "1" when its LOINC code names a
specific gravity, a pH or an INR; any other analyte keeps the refusal.

The category check took only FHIR's own "laboratory" and skipped
records a system filed as "LAB" or "Lab Results", although Apple
Health had already classified them as lab results. A code, display or
text containing "lab" now counts; other categories are still skipped.
This commit is contained in:
Marc-André Bombeck committed 2026-11-17 21:28:03 +01:00
1 parent d1db4e59cb
commit 6aad42a384
6 files changed
+124 -19

No files matched your search

+9 -7
View File
@@ -78305,13 +78305,15 @@ components:
- status
additionalProperties: false
description: "One record's outcome, by its position in the request. `inserted`: written. `duplicate`: the record already
holds it, under the same identity (deleted readings included, so a deleted result stays deleted) or as the same
reading on the same day from another source. `skipped`: not a reading HealthLog keeps, with `reason`
`not_observation` | `not_lab` | `not_final` (preliminary; it is taken once final) | `withdrawn` | `panel_header`
| `no_value` | `unsupported_value` | `no_date` | `future_date` | `invalid_date` | `too_large` (a resource over
256 KiB). `failed`: a reading that could not be stored, with `reason` `missing_unit` | `unit_mismatch` (the
account's marker is in a unit this one does not convert into) | `text_too_long` | `write_failed` (transient:
send it again)."
holds it, under the same identity (deleted readings included, also once the reading or its whole marker is gone,
so a deleted result stays deleted) or as the same reading on the same day from another source. `skipped`: not a
reading HealthLog keeps, with `reason` `not_observation` | `not_lab` (no category names a lab; a code, display
or text containing `lab` in any case counts) | `not_final` (preliminary; it is taken once final) | `withdrawn` |
`panel_header` | `no_value` | `unsupported_value` | `no_date` | `future_date` | `invalid_date` | `too_large` (a
resource over 256 KiB). `failed`: a reading that could not be stored, with `reason` `missing_unit` (a number
without a unit; a specific gravity, a pH or an INR, known by its LOINC code, is read as the unity `1` instead) |
`unit_mismatch` (the account's marker is in a unit this one does not convert into) | `text_too_long` |
`write_failed` (transient: send it again)."
LabOverviewEnvelope:
type: object
properties: