feat(links): close the relation matrix and publish related[] on six details

The link service gains medication and lab result sources and the five new
tables, each readable from both ends. POST/DELETE /api/medications/{id}/links
and /api/labs/{id}/links replace their 501 stubs; the visit links route also
files medications and doses, the dose links route its visit. A scan commit
with a documentId files each written result against its report.

GET on a lab result, visit, document, condition, medication and dose now
carries related[]: stored links, the condition a result shares a visit with,
and the medication whose efficacy target is the result's marker, each with
its web path. A kind is listed only when its module is on and the caller's
grant covers its section. relation-matrix.test.ts holds every one of the
fifteen pairs to a table, a reader or a written exception.
This commit is contained in:
Marc-André Bombeck committed 2026-10-15 23:57:34 +02:00
1 parent ffd46b017b
commit b4bc039d16
25 files changed
+1569 -82

No files matched your search

+115 -8
View File
@@ -15780,7 +15780,8 @@ paths:
- Records
summary: File targets against a visit
description: "Adds links. Idempotent: a pair that already exists succeeds and changes nothing. Session-authenticated
only, matching document link and unlink."
only, matching document link and unlink. Since v1.43 `targetKind` also takes `medication` and `vaccination`;
those links show in the visit's `related` list (`GET /api/encounters/{id}`), not in `links`."
parameters:
- in: path
name: id
@@ -16393,9 +16394,11 @@ paths:
post:
tags:
- Records
summary: File documents against a vaccination
summary: File documents or a visit against a vaccination
description: "Adds links. Idempotent: a pair that already exists succeeds and changes nothing. Session-authenticated
only, matching document and visit link and unlink."
only, matching document and visit link and unlink. Since v1.43 `targetKind` also takes `encounter` (the visit
the dose was given at); that link shows in the dose's `related` list (`GET /api/vaccinations/{id}`), not in
`documents`."
parameters:
- in: path
name: id
@@ -16422,7 +16425,7 @@ paths:
delete:
tags:
- Records
summary: Unfile documents from a vaccination
summary: Unfile documents or a visit from a vaccination
description: Removes links. Idempotent, and it still works for a page the account has since deleted — refusing would
leave a filing nobody can clear.
parameters:
@@ -24506,7 +24509,6 @@ paths:
$ref: "#/components/schemas/ErrorEnvelope"
"422": *a4
"429": *a5
"501": *a44
delete:
tags:
- Links
@@ -24542,7 +24544,6 @@ paths:
$ref: "#/components/schemas/ErrorEnvelope"
"422": *a4
"429": *a5
"501": *a44
/api/labs/{id}/links:
post:
tags:
@@ -24579,7 +24580,6 @@ paths:
$ref: "#/components/schemas/ErrorEnvelope"
"422": *a4
"429": *a5
"501": *a44
delete:
tags:
- Links
@@ -24615,7 +24615,6 @@ paths:
$ref: "#/components/schemas/ErrorEnvelope"
"422": *a4
"429": *a5
"501": *a44
/api/bugreport:
post:
security: []
@@ -31558,6 +31557,8 @@ components:
- document
- labResult
- conditionEpisode
- medication
- vaccination
targetIds:
minItems: 1
maxItems: 100
@@ -31966,6 +31967,7 @@ components:
type: string
enum:
- document
- encounter
targetIds:
minItems: 1
maxItems: 100
@@ -41980,6 +41982,106 @@ components:
- targetId
- createdAt
additionalProperties: {}
labResultDocumentLinks:
default: []
type: array
items:
type: object
properties:
labResultId:
type: string
minLength: 1
documentId:
type: string
minLength: 1
createdAt:
type: string
minLength: 1
required:
- labResultId
- documentId
- createdAt
additionalProperties: {}
encounterMedicationLinks:
default: []
type: array
items:
type: object
properties:
encounterId:
type: string
minLength: 1
medicationId:
type: string
minLength: 1
createdAt:
type: string
minLength: 1
required:
- encounterId
- medicationId
- createdAt
additionalProperties: {}
encounterVaccinationLinks:
default: []
type: array
items:
type: object
properties:
encounterId:
type: string
minLength: 1
vaccinationId:
type: string
minLength: 1
createdAt:
type: string
minLength: 1
required:
- encounterId
- vaccinationId
- createdAt
additionalProperties: {}
medicationDocumentLinks:
default: []
type: array
items:
type: object
properties:
medicationId:
type: string
minLength: 1
documentId:
type: string
minLength: 1
createdAt:
type: string
minLength: 1
required:
- medicationId
- documentId
- createdAt
additionalProperties: {}
medicationConditionLinks:
default: []
type: array
items:
type: object
properties:
medicationId:
type: string
minLength: 1
episodeId:
type: string
minLength: 1
createdAt:
type: string
minLength: 1
required:
- medicationId
- episodeId
- createdAt
additionalProperties: {}
coachConversations:
default: []
type: array
@@ -43204,6 +43306,11 @@ components:
- customVaccines
- vaccinations
- vaccinationDocumentLinks
- labResultDocumentLinks
- encounterMedicationLinks
- encounterVaccinationLinks
- medicationDocumentLinks
- medicationConditionLinks
- coachConversations
- mentalHealthAssessments
- consentReceipts