mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-16 23:33:29 +00:00
feat(encounters): the lab moment, the condition side, and closing a checkup
A lab panel files itself against the visit it came from, and never has to. The OCR review and the manual form both offer the suggestion through the one shared field, anchored on the draw date rather than on now, so backdating a reading moves the offer with it. The commit writes one link PER RESULT ROW, which is why the join is m:n: a marker re-run on a different day belongs to its own visit. Best-effort by design — the readings are the write that matters and must not be lost to a link that could not be made. The condition side gets a Visits about this card with an action that pre-links the episode. From the episode side only, and that is a decision: an episode spans weeks and a visit is a point, so matching the other way would be wrong often enough to teach a person to ignore every suggestion in the product. A due checkup gains a second action beside erledigt. Filing the visit as done satisfies the checkup through the same forward-only, idempotent primitive the checkbox uses, so doing both is one satisfaction and no error. The two actions answer different questions — one says it happened, the other says where. An appointment now appears where a person looks, and NEITHER surface relaxes the reminder-table exclusion that keeps it out of the preventive-care lists. Both read the visit table: a quiet line under the dashboard checkup block for anything inside two weeks, and one rail item for today or tomorrow. A diff in either that touches origin is the wrong fix. A visit write now also refreshes the reminder reads. Closing a checkup moves its next-due date on three surfaces that would otherwise keep showing it due until their own poll. OpenAPI regenerated in the same commit.
This commit is contained in:
1 parent
be9c79974f
commit
c47122ccfe
36 files changed
+924
-192
No files matched your search
@@ -138,6 +138,15 @@ export const encounterListQuerySchema = z
|
||||
to: z.iso.datetime({ offset: true }).optional(),
|
||||
status: encounterStatusEnum.optional(),
|
||||
practitionerId: id.optional(),
|
||||
/**
|
||||
* Only visits filed against this condition episode.
|
||||
*
|
||||
* The condition side of the link, and the only direction it is offered in:
|
||||
* an episode spans weeks and a visit is a point, so matching from the visit
|
||||
* side would produce false positives at a rate that trains a person to
|
||||
* ignore every suggestion in the product.
|
||||
*/
|
||||
episodeId: id.optional(),
|
||||
limit: z.coerce.number().int().min(1).max(200).optional(),
|
||||
})
|
||||
.strict()
|
||||
|
||||
@@ -209,6 +209,17 @@ export const ocrCommitSchema = z.object({
|
||||
* is verified server-side before any link is written.
|
||||
*/
|
||||
documentId: z.string().trim().min(1).max(64).optional(),
|
||||
/**
|
||||
* The visit this panel came out of, when the review step offered one.
|
||||
*
|
||||
* Optional, always. A panel commits with no visit named and the commit
|
||||
* succeeds unchanged — the link is the by-the-way half of the flow, never
|
||||
* a condition of the write. Ownership is verified server-side, and one link
|
||||
* is written PER RESULT ROW rather than one for the panel: a re-run panel on
|
||||
* a different day links to its own visit, which is why the join is m:n and
|
||||
* not a scalar column on the result.
|
||||
*/
|
||||
encounterId: z.string().trim().min(1).max(40).optional(),
|
||||
});
|
||||
|
||||
export type OcrCommitInput = z.infer<typeof ocrCommitSchema>;
|
||||
|
||||
@@ -131,6 +131,12 @@ export const createLabResultSchema = z
|
||||
takenAt: takenAtField,
|
||||
note: optionalNote,
|
||||
source,
|
||||
/**
|
||||
* The visit this reading came out of, when the form offered one. Optional
|
||||
* always: a reading saves with no visit named, and the link never gates
|
||||
* the write.
|
||||
*/
|
||||
encounterId: z.string().trim().min(1).max(40).optional(),
|
||||
})
|
||||
// Either a catalog link OR a free-text analyte must be present.
|
||||
.refine((d) => d.biomarkerId !== undefined || d.analyte !== undefined, {
|
||||
|
||||
Reference in new issue
Block a user