import { cache } from 'react'; import { getAnalysisResultsForDoctor } from '@kit/doctor/services/doctor-analysis.service'; import { PageBody, PageHeader } from '@kit/ui/page'; import { DoctorPageViewAction, createDoctorPageViewLog, } from '~/lib/services/audit/doctorPageView.service'; import AnalysisView from '../../_components/analysis-view'; import { DoctorGuard } from '../../_components/doctor-guard'; async function AnalysisPage({ params, }: { params: Promise<{ id: string; }>; }) { const { id: analysisResponseId } = await params; const analysisResultDetails = await loadResult(Number(analysisResponseId)); if (!analysisResultDetails) { return null; } if (analysisResultDetails) { await createDoctorPageViewLog({ action: DoctorPageViewAction.VIEW_ANALYSIS_RESULTS, recordKey: id, dataOwnerUserId: analysisResultDetails.patient.userId, }); } return ( <> ); } export default DoctorGuard(AnalysisPage); const loadResult = cache(getAnalysisResultsForDoctor);