feat: AI-powered eligibility detection from Copy Agent screenshots
Adds an "AI Detect & Check Eligibility" action to the Copy Agent page that sends captured screenshots to Claude to extract Member ID/DOB, then opens the chatbot's eligibility confirm step pre-filled with the result. - POST /api/ai/detect-eligibility-info: Claude vision extraction of Member ID/DOB from uploaded screenshots. - POST /api/patients/create-temp: auto-creates a placeholder "PID-<id>" patient (matched by insuranceId+dob) when no patient is selected, so screenshots can be saved immediately; the real eligibility check later rewrites the patient's name and Cloud Storage folder automatically via the existing createOrUpdatePatientByInsuranceId matching logic. - Chatbot: Member ID/DOB on the confirm card are now editable (MM/DD/YYYY), with edits synced back to the patient record before the check runs. - Fixed a useEffect ordering bug on the insurance-status page that could silently clear a chatbot-prefilled Member ID/DOB before the auto-trigger effect ran, preventing the eligibility check from ever starting. - Added a local-disk-only screenshot backup (apps/Backend/uploads/ screenshot-backups/) for debugging, not exposed anywhere in the UI. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -138,6 +138,7 @@ export interface IStorage {
|
||||
streamFileTo(resStream: NodeJS.WritableStream, fileId: number): Promise<void>;
|
||||
|
||||
// Patient folder
|
||||
getPatientFolder(patientId: number): Promise<CloudFolder | null>;
|
||||
getOrCreatePatientFolder(
|
||||
userId: number,
|
||||
patientId: number,
|
||||
@@ -549,6 +550,13 @@ export const cloudStorageStorage: IStorage = {
|
||||
},
|
||||
|
||||
// --- PATIENT FOLDER ---
|
||||
async getPatientFolder(patientId: number) {
|
||||
const existing = await db.cloudFolder.findFirst({
|
||||
where: { patientId },
|
||||
});
|
||||
return (existing as unknown as CloudFolder) ?? null;
|
||||
},
|
||||
|
||||
async getOrCreatePatientFolder(
|
||||
userId: number,
|
||||
patientId: number,
|
||||
|
||||
Reference in New Issue
Block a user