import { useFhirAdverseEventBroadcast, useFhirAllergyIntoleranceBroadcast, useFhirCarePlanBroadcast, useFhirCareTeamBroadcast, useFhirClinicalImpressionBroadcast, useFhirConditionBroadcast, useFhirCoverageBroadcast, useFhirDetectedIssueBroadcast, useFhirDiagnosticReportBroadcast, useFhirDeviceRequestBroadcast, useFhirDeviceUseStatementBroadcast, useFhirDeviceBroadcast, useFhirEncounterBroadcast, useFhirEpisodeOfCareBroadcast, useFhirFamilyMemberHistoryBroadcast, useFhirGoalBroadcast, useFhirImmunizationEvaluationBroadcast, useFhirImmunizationRecommendationBroadcast, useFhirImmunizationBroadcast, useFhirMedicationAdministrationBroadcast, useFhirMedicationDispenseBroadcast, useFhirMedicationRequestBroadcast, useFhirMedicationStatementBroadcast, useFhirNutritionOrderBroadcast, useFhirObservationBroadcast, useFhirProcedureBroadcast, useFhirQuestionnaireResponseBroadcast, useFhirRelatedPersonBroadcast, useFhirRiskAssessmentBroadcast, useFhirTaskBroadcast, useFhirVisionPrescriptionBroadcast, } from './index'; /** * EVERY LIVE UPDATE THE PATIENT'S RECORD CAN RECEIVE, SUBSCRIBED WHERE IT SURVIVES NAVIGATION. * * The server already pushes each clinical write to the patient - `Condition/post.ts` and its siblings * call `broadcastToRecipients` with the subject - and every facet already had a hook to consume it. The * hooks were mounted on the facet PAGES, so an event landed only if the patient happened to be looking * at that exact screen at that exact moment. Anywhere else in the portal it was dropped, and nothing * asked again: a record list is fetched once per document and the auto-load will not re-ask while a * bundle for the same patient is in the context. * * MEASURED 2026-09-06: a clinician saved a coded diagnosis; the patient navigated away from * Conditions and back and NO second request went out - one `GET /R4/Condition` for the whole session. * The diagnosis was invisible to them until a full page reload. The record is the patient's to read * without delay, so a reload is not an answer. * * Spencer ruled 2026-09-06: mount them at the app shell for ALL the record facets, not for one. * `DashboardPage` is where `useFhirCommunicationBroadcast` and `useFhirFormSubmissionBroadcast` already * live for exactly this reason, and this sits beside them. * * DELIBERATELY NOT A REFETCH. A prior card ruled that a list already correct for this patient is not * re-fetched on navigation, and its control still stands in * `aProblemListBelongsToThePatientOnScreen.test.tsx`. A subscription needs no such trade: it costs one * WebSocket registration and delivers the write itself rather than a reason to ask again. * * THE TARGETED VARIANTS ARE NOT HERE ON PURPOSE. `useFhirTargetedBroadcast` takes an open resource * and its dialog callbacks; it belongs to whatever has that resource open, never to the shell. * * APPOINTMENTS ARE ABSENT FOR A DIFFERENT REASON, and it is a shape rather than an omission. * `useFhirAppointmentBroadcast` takes required `onCreate`/`onUpdate`/`onDelete` handlers: it does not * update a shared list itself, it hands the event to whoever mounted it. There is nothing for the shell * to pass, and mounting it with empty handlers would subscribe and then throw every event away, which * reads in review exactly like working coverage. Its consumers keep mounting it themselves. * * THREE FACETS HAVE NO BROADCAST HOOK TO MOUNT and are therefore absent: `BodyStructure`, * `DiagnosticReport` and the composite `ClinicalLists`. `DiagnosticReport` is the one that matters - * the server DOES push it (`DiagnosticReport/post.ts` calls `broadcastToRecipients`), nothing on the * client listens, and a result reaching the patient without delay is a ruling of 2026-09-06. Carded * rather than written here, because a new hook is a different change from mounting the ones that exist. */ export const useFhirRecordBroadcasts = (): void => { useFhirAdverseEventBroadcast(); useFhirAllergyIntoleranceBroadcast(); useFhirCarePlanBroadcast(); useFhirCareTeamBroadcast(); useFhirClinicalImpressionBroadcast(); useFhirConditionBroadcast(); useFhirCoverageBroadcast(); useFhirDetectedIssueBroadcast(); useFhirDiagnosticReportBroadcast(); useFhirDeviceRequestBroadcast(); useFhirDeviceUseStatementBroadcast(); useFhirDeviceBroadcast(); useFhirEncounterBroadcast(); useFhirEpisodeOfCareBroadcast(); useFhirFamilyMemberHistoryBroadcast(); useFhirGoalBroadcast(); useFhirImmunizationEvaluationBroadcast(); useFhirImmunizationRecommendationBroadcast(); useFhirImmunizationBroadcast(); useFhirMedicationAdministrationBroadcast(); useFhirMedicationDispenseBroadcast(); useFhirMedicationRequestBroadcast(); useFhirMedicationStatementBroadcast(); useFhirNutritionOrderBroadcast(); useFhirObservationBroadcast(); useFhirProcedureBroadcast(); useFhirQuestionnaireResponseBroadcast(); useFhirRelatedPersonBroadcast(); useFhirRiskAssessmentBroadcast(); useFhirTaskBroadcast(); useFhirVisionPrescriptionBroadcast(); };