feat(documents): filter the archive by procedure or surgery

The vault's filter row gains a procedure facet beside the condition
facet. It lists the record's procedures and surgeries that hold at least
one live document, headed the way the visits page heads them (the
reason, else the practice, else the kind) with the body site and date
beneath, and narrows the list through the existing `encounterId` filter.
Same control, placement and clear behaviour as the condition facet; the
choice rides the URL as `?encounter=`, and an upload dropped into the
filtered view is filed against the procedure.

The usage read publishes the choices as `linkedProcedures` (additive),
decrypting only the label columns, and returns none when a sharing
grant does not cover the visits section.

On a phone an active facet now gives up label width before the search
field does, and the search keeps room for its icon and padding.
This commit is contained in:
Marc-André Bombeck committed 2026-10-04 21:59:22 +02:00
1 parent dc7061634e
commit 0219a85e92
24 files changed
+1308 -54

No files matched your search

+23
View File
@@ -349,6 +349,21 @@ export interface DocumentConditionLinkDto {
name: string;
}
/**
* One procedure the vault can be filtered by. The visit's own words, decrypted
* server-side; the client composes the label the visits page shows (the
* reason, else the practice, else the kind) in the reader's locale.
*/
export interface DocumentLinkedProcedureDto {
encounterId: string;
/** ISO-8601 instant of the procedure. */
occurredAt: string;
reason: string | null;
bodySite: string | null;
laterality: "LEFT" | "RIGHT" | "BOTH" | null;
practitionerName: string | null;
}
/**
* One visit link on a document DTO — "this letter belongs to that appointment".
*
@@ -958,6 +973,14 @@ export interface DocumentUsageDto {
* every linked document sits pages deep in the timeline.
*/
linkedEpisodes: DocumentConditionLinkDto[];
/**
* Procedures and surgeries (visits of kind PROCEDURE) carrying at least one
* LIVE document link — the filter bar's procedure choices, sourced
* server-side for the same reason as `linkedEpisodes`. Empty when the
* caller's grant does not cover the visits section, because the label is
* the visit's own text.
*/
linkedProcedures: DocumentLinkedProcedureDto[];
/**
* Whether the AI "Suggest details" action can run for this caller — true when
* a provider (vision, or text + local OCR) is configured. The UI hides the