From 1968e3bfccd96f4631ac7c8bd77f6ec3be455b29 Mon Sep 17 00:00:00 2001 From: Gitead Date: Sat, 7 Nov 2026 17:38:12 -0500 Subject: [PATCH] feat: MH claim 15-digit claim number check, procedure code retry, copy/paste appointment - MassHealth claim: pick the visible typeahead option for procedure codes, verify the code stuck (retry), re-check all lines before submit - MassHealth claim: only an exact 15-digit claim number counts as submitted; otherwise fail with ERROR:CLAIM_NOT_SUBMITTED - Appointments: right-click "Copy the appointment" and "Paste the appointment" on an empty slot Co-Authored-By: Claude Opus 5.5 --- apps/Frontend/src/pages/appointments-page.tsx | 72 +++++++++++ .../selenium_claimSubmitWorker.py | 118 +++++++++++++----- 2 files changed, 159 insertions(+), 31 deletions(-) diff --git a/apps/Frontend/src/pages/appointments-page.tsx b/apps/Frontend/src/pages/appointments-page.tsx index a5aa0fbf..0a32dd4d 100755 --- a/apps/Frontend/src/pages/appointments-page.tsx +++ b/apps/Frontend/src/pages/appointments-page.tsx @@ -21,6 +21,8 @@ import { Trash2, CreditCard, ClipboardList, + ClipboardPaste, + Copy, StickyNote, Shield, FileCheck, @@ -168,6 +170,7 @@ function resolveAppointmentBadgeStatus(apt: ScheduledAppointment): PatientStatus // Define a unique ID for the appointment context menu const APPOINTMENT_CONTEXT_MENU_ID = "appointment-context-menu"; +const SLOT_CONTEXT_MENU_ID = "slot-context-menu"; // 🔑 exported base key const SCHEDULE_DATE_KEY = "schedule_selected_date"; @@ -277,6 +280,14 @@ export default function AppointmentsPage() { staffId: number; } | null>(null); const [newApptPrefill, setNewApptPrefill] = useState(null); + // Appointment copied via right-click "Copy the appointment", pasted onto an empty slot + const [copiedAppointment, setCopiedAppointment] = useState<{ + patientId: number; + patientName: string; + title: string; + type: string; + notes?: string; + } | null>(null); const toggleReminderColumn = (staffId: number) => { setSelectedReminderColumns((prev) => { @@ -329,6 +340,9 @@ export default function AppointmentsPage() { const { show } = useContextMenu({ id: APPOINTMENT_CONTEXT_MENU_ID, }); + const { show: showSlotMenu } = useContextMenu({ + id: SLOT_CONTEXT_MENU_ID, + }); // ---------------------- // Day-level fetch: appointments + patients for selectedDate (lightweight) @@ -922,6 +936,39 @@ export default function AppointmentsPage() { } }; + const handleCopyAppointment = (appointmentId: number) => { + const apt = appointments.find((a) => a.id === appointmentId) as any; + if (!apt) return; + const patientName = + processedAppointments.find((a) => a.id === appointmentId)?.patientName ?? ""; + setCopiedAppointment({ + patientId: apt.patientId, + patientName, + title: apt.title, + type: apt.type, + notes: apt.notes ?? undefined, + }); + toast({ + title: "Appointment Copied", + description: `${patientName} — right-click an empty slot to paste.`, + }); + }; + + const handlePasteAppointment = (timeSlot: TimeSlot, staffId: number) => { + if (!copiedAppointment || !user) return; + createAppointmentMutation.mutate({ + patientId: copiedAppointment.patientId, + userId: user.id, + staffId, + title: copiedAppointment.title, + date: formatLocalDate(selectedDate), + type: copiedAppointment.type, + startTime: timeSlot.time, + endTime: timeSlot.time, // backend sets the real end time + notes: copiedAppointment.notes, + } as unknown as InsertAppointment); + }; + // Function to display context menu const handleContextMenu = (e: React.MouseEvent, appointmentId: number) => { // Prevent the default browser context menu @@ -1160,6 +1207,10 @@ export default function AppointmentsPage() { : "text-gray-400 hover:bg-gray-100" }`} onClick={handleClickEmpty} + onContextMenu={(e) => { + e.preventDefault(); + showSlotMenu({ event: e, props: { timeSlot, staffId } }); + }} > @@ -2245,6 +2296,12 @@ export default function AppointmentsPage() { Edit Appointment + handleCopyAppointment(props.appointmentId)}> + + + Copy the appointment + + handleDeleteAppointment(props.appointmentId) @@ -2327,6 +2384,21 @@ export default function AppointmentsPage() { + {/* Empty-slot Context Menu */} + + handlePasteAppointment(props.timeSlot, props.staffId)} + > + + + {copiedAppointment + ? `Paste the appointment (${copiedAppointment.patientName})` + : "Paste the appointment"} + + + + {/* Main Content */}
{/* Schedule Grid */} diff --git a/apps/SeleniumService/selenium_claimSubmitWorker.py b/apps/SeleniumService/selenium_claimSubmitWorker.py index 8ad3550e..a0382039 100755 --- a/apps/SeleniumService/selenium_claimSubmitWorker.py +++ b/apps/SeleniumService/selenium_claimSubmitWorker.py @@ -1059,17 +1059,13 @@ class AutomationMassHealthClaimsLogin: text = element.text.strip() print(f"DEBUG: Checking element with selector {selector}: {text[:100]}") # Look for 15-digit claim number pattern (MassHealth format: YYYYMMDD + 7 digits) - match = re.search(r'(\d{15})', text) + # Only an exact 15-digit number counts - shorter numbers on the page + # (e.g. timestamps on the unsubmitted form) are not claim numbers + match = re.search(r'(?