Files
baya-monorepo/client/src/services/patientRecords/constants.ts
T
2026-08-02 23:24:28 +03:30

38 lines
2.1 KiB
TypeScript

/**
* When true, the patient-records domain is served by the in-memory mock (`apis/mockApi.ts`) behind the
* `PatientRecordsApi` seam.
*
* **Mock is primary — the backend is fully built, but the shapes don't match yet.** `PatientCareRecordsController`
* implements every route this seam needs: `care_records` GET/POST (visit-note history/append), `care_record`
* GET/PUT (the family care plan), and `record_access` GET. The blocker is a genuine schema mismatch, not a
* missing endpoint — see `mvp/fix-plan.md`'s "Patient records" follow-up: the client's medication/routine
* shape (structured dose amount/unit, frequency preset codes, a multi-select `timeOfDay`) was built after the
* server shipped a simpler one (one free-text dose, one required frequency string, no `timeOfDay` at all),
* and which side to change is a product decision, not something to guess in code. Flip to `false` once that's
* resolved and `clientApi.ts`'s family-record methods are updated to match.
*/
export const USE_PATIENT_RECORDS_MOCK = true;
/** Page size for the longitudinal visit-note history (api-conventions `pageSize`). */
export const RECORD_HISTORY_PAGE_SIZE = 10;
/**
* The family record + history move slowly (a customer edit / a per-visit note), so a modest `staleTime` means
* tab-switching never refetches; mutations invalidate the affected key. The access check is effectively
* static per session — keep it warm longer.
*/
export const FAMILY_RECORD_STALE_TIME = 60 * 1000;
export const RECORD_HISTORY_STALE_TIME = 60 * 1000;
export const RECORD_ACCESS_STALE_TIME = 5 * 60 * 1000;
export const PATIENT_RECORDS_GC_TIME = 10 * 60 * 1000;
/** Wire cap on a visit-note body (`WriteCareRecordBody.body` ≤ 8000). */
export const VISIT_NOTE_MAX_LENGTH = 8000;
/**
* A sentinel patient id the mock treats as **not owned** by the caller, so the E2 access-denied card is
* demoable by navigating to `/patients/8888/record`. On the real path this state comes from a `403` on the
* clinical read; there is no such thing as a "foreign patient id" on the wire.
*/
export const MOCK_FOREIGN_PATIENT_ID = 8888;