feat(apple-health): import lab results from Health Records in the export

The export parser counted every <ClinicalRecord> as skipped. Lab-result
records are now handed to a pass after the export.xml rows are written:
each referenced clinical-records/ JSON file is read from the archive
one at a time, mapped with the shared FHIR mapper, given its panel's
name and written through the shared writer. Other clinical types stay
skipped. The pass is fail-soft like the ECG and route passes, and the
job result carries bounded lab counts only.

The ECG pass moves out of the worker into ecg-import.ts, and the parser
revision goes to 4 so an archive imported before can be uploaded again
to pick up its lab results.
This commit is contained in:
Marc-André Bombeck committed 2026-11-17 18:42:21 +01:00
1 parent e40de2a654
commit 736e6e9c86
16 files changed
+922 -212

No files matched your search

@@ -1,7 +1,7 @@
{
"$comment": "Production functions over 200 lines, keyed \"file :: name\", and their length. Maintained by src/__tests__/source-size-ratchet.test.ts.",
"count": 335,
"total": 109025,
"total": 109021,
"entries": {
"app/achievements/page.tsx :: AchievementsPage": 206,
"app/api/admin/backups/upload/route.ts :: apiHandler(arg)": 275,
@@ -285,7 +285,7 @@
"lib/insights/status-provider.ts :: runStatusCompletion": 215,
"lib/integrations/connection-health-load.ts :: loadConnectionFacts": 229,
"lib/integrations/status.ts :: recordSyncFailure": 292,
"lib/jobs/apple-health-import-worker.ts :: handleAppleHealthImport": 300,
"lib/jobs/apple-health-import-worker.ts :: handleAppleHealthImport": 292,
"lib/jobs/coach-nudge.ts :: findTriggerForUser": 279,
"lib/jobs/coach-nudge.ts :: runCoachNudgeTick": 292,
"lib/jobs/coach-reminder-sweep.ts :: runCoachReminderSweep": 222,
@@ -314,8 +314,8 @@
"lib/measurements/dense-intraday-retention.ts :: runDenseIntradayRetention > walkSource > writeDay > foldOnce": 212,
"lib/measurements/drain-per-sample-cumulative.ts :: drainPerSampleCumulative": 344,
"lib/measurements/drain-per-sample-cumulative.ts :: drainPerSampleCumulative > writeDay": 205,
"lib/measurements/import-apple-health-export.ts :: streamParseExportXml": 1245,
"lib/measurements/import-apple-health-export.ts :: streamParseExportXml > (anonymous) #2": 323,
"lib/measurements/import-apple-health-export.ts :: streamParseExportXml": 1247,
"lib/measurements/import-apple-health-export.ts :: streamParseExportXml > (anonymous) #2": 325,
"lib/medications/efficacy/build-efficacy.ts :: buildMedicationEfficacy": 268,
"lib/medications/intake-slot-dedup.ts :: dedupeUserIntakeSlots": 319,
"lib/medications/list-read.ts :: buildMedicationsList": 310,