- claims-page: after auto-submit closes the form, automatically navigate
back to /appointments when an AI claim queue is pending resume, eliminating
the manual navigation delay between appointments
- internal-chat-workflow: warn and block claim when D1120 (child prophy) is
requested for a patient aged 14+ — recommend D1110 (adult prophy) instead,
and advise manual claim if user insists on D1120
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- parseSrpCode: recognize "D4341 UL" / "4341 LR" etc., store quadrant in quad field
- matchOne: auto-prefix D for 4-digit inputs like "0120" → D0120
- LLM prompt: keep SRP code and quadrant together as one procedureName entry
- CdtMatch / CdtResult: add quad field, thread through matchedCodes action data
- claim-form.tsx: include quad in chatbot_claim_prefill type and spread to service line
- selenium_claimSubmitWorker.py: pass quad to fill_service_line, select quadrant
dropdown by index (UR=1, UL=2, LL=3, LR=4) matching MassHealth form structure
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Pass the user's primary NPI provider name through the eligibility and
claim routes so the Selenium workers click the matching option in the
DDMA member-search provider dropdown (data-testid=member-search_provider_select-btn)
rather than always falling back to the first entry.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- AI chat extracts 'with provider <name>' and routes claim to that provider
- Claim form reads provider from sessionStorage before any async effects run,
preventing saved claim/procedure data from overriding the chatbot selection
- NPI provider settings table shows Provider #1 / #2 labels with up/down
reorder buttons; Provider #1 is always the default for claims
- Default provider now uses sortOrder instead of hardcoded 'Mary Scannell'
- Added sortOrder column to NpiProvider schema with migration
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Claim file uploads (chatbot or manual) now save to both the Cloud
Storage patient folder and the Documents page via new
POST /api/claims/upload-to-cloud endpoint
- MH submit flow now calls uploadAttachmentsToLocalFolder (same as
DDMA/United/Tufts) so chatbot-attached X-rays are persisted
- Removed old /upload-attachments disk route and attachmentDiskStorage
multer config; deleted uploads/patients/ folder
- uploadAttachmentsToLocalFolder now points to /upload-to-cloud and
sends patientId so the backend can create the patient folder
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The original migration only created the table with id/userId/apiKey.
All provider keys, models, toggles, and feature flags were in the
schema but never added to the database, causing every AI settings
save to fail with a Prisma column-not-found error.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Add "Eligibility & Appointment" button to chatbot eligibility-id-ready card
- For known patients: creates today's appointment immediately, then opens eligibility page
- For unknown patients: navigates to eligibility page; after Selenium creates the patient,
auto-creates appointment via tryAppointmentFromChatbot on the insurance-status page
- Update MH Eligibility & Appointment button to create a today's schedule slot instead of
navigating to the appointments page; shows PDF preview on completion
- createAppointmentToday falls back from Column A to Column B when Column A is full;
returns column label in response so UI can display it
- Set AI-scheduled appointment duration to 15 minutes
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Daily sync and Sync Now both pull database + uploads in one operation.
PC1 streams uploads/ as a zip via GET /network-backup-files (archiver).
PC2 clears cloud-storage, patients, and patient-documents then extracts
the fresh copy before resolving. Timeout extended to 5 min for large files.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
PC2 can now automatically pull and restore a fresh copy of PC1's database
on a daily schedule. Config and API key are stored in local JSON files so
they survive database restores.
- New networkSyncConfigService: file-based config (network-backup-key.json,
network-sync-config.json) that persists through DB restores
- New networkSyncService: streams live pg_dump from source PC over HTTP and
pipes into psql, then reconnects Prisma and applies missing migrations
- 6 new endpoints: get/regenerate API key, serve backup stream (key-auth
only), get/save sync config, trigger immediate sync
- Hourly cron job that fires only when current hour matches configured syncHour
- NetworkBackupManager component: shows this machine's key (show/copy/regen)
and receiver config (enable toggle, hour picker 0-23, source URL + key,
Save + Sync Now, last sync status)
- README setup guide for both PCs
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
"United Healthcare SCO" does not contain the substring "united sco" so
deriveSiteKey was falling through to the MH default. Add exact and prefix
aliases so any United Healthcare variant maps to UNITED_SCO.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
extractToothSurface now handles A-T primary tooth letters in addition to
numeric #1-32. strippedCleaned strips both formats so "D7111 # H" reduces
to "D7111" for the CDT pass-through. Pass-through no longer returns null
for codes not in the fee schedule JSON.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Chatbot: add paperclip button to attach X-ray/PDF files to claim submissions;
files flow through chatbotFileStore into claim-form uploadedFiles for Selenium
- CDT lookup: auto-select D3310/D3320/D3330 by tooth number for RCT; strip #NN
from procedure names before alias lookup so "1 pa, #3" → D0220 tooth 3;
add "1 pa" alias for D0220; expand multi-PA notation via AI prompt rule
- AI classifier: add navigate_eligibility intent ("check mh" → /insurance-status);
fix duplicate intent entry; add RCT and multi-PA prompt rules
- Check+claim flow: pass serviceDate through check_and_claim_ready actionData;
tryClaimFromChatbot skips PDF preview and navigates straight to claims with
memberId fallback lookup; wired into all provider onPdfReady callbacks
- Claims table: add Service Date column between Patient Name and Submission Date
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
siteKeyToAutoCheck now accepts an optional dob parameter. When siteKey is MH
and the patient is under 21 years old, returns "cmsp" so the AI chat triggers
the CMSP eligibility & history & remaining button instead of the adult MH one.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Added extractToothSurface() helper that parses "#NN [SURFACES]" from any
procedure input (tooth 1-32, surface letters O/M/D/B/L/F/I/V). Applied to
all lookup paths so any procedure with #14 or #29 OB carries toothNumber and
toothSurface through to the DDMA Selenium worker.
Also propagate toothNumber/toothSurface in matchedCodes and chatbot_claim_prefill
so the claim-form prefill sets these fields on the service lines before auto-submit.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Claim flow: show green confirm card (patient, CDT codes, service date) before Selenium starts
- CDT lookup: add DIRECT_CODE_MAP + ALIAS_MAP with 60+ dental abbreviations from office fee schedule
(2BW→D0272, 4BW→D0274, PA→D0220, FL→D1208, RCT codes, composite tooth#/surface parser, etc.)
- Composite filling parser: auto-map "#29 OB" → D2392 based on tooth# (front/back) and surface count
- Ask-and-learn: unknown CDT terms block claim and ask user; answer saved to DB alias map for future use
- Cancel on confirm card returns to chat (not full reset) so user can correct and retry
- Eligibility auto-trigger fix: reset autoTriggeredRef when autoTrigger resets to false so second
chatbot eligibility check on same page visit fires correctly (all 5 provider buttons fixed)
- check_eligibility by name now returns eligibility_id_ready with correct siteKey for non-MH patients
- DDMA/CCA/United/Tufts fee schedules updated with office prices (single Price field, no age split)
- getCodeMap case-insensitive matching fix (ddma/cca/etc. now correctly selected)
- Family plan member disambiguation: insuranceId+DOB composite lookup prevents overwriting siblings
- AI chat date fix: send clientDate from browser to avoid UTC midnight rollover (EST→wrong day)
- AI prompt: appointmentDate extracted for claim_only intent when user says "today" or a date
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Add llm-factory.ts: unified LLM provider abstraction (Google/Claude/OpenAI)
- Install @langchain/anthropic and @langchain/openai packages
- resolveAiProvider picks active provider from DB settings (Claude > OpenAI > Google)
- All AI graphs (reminder, new-patient, reschedule, internal-chat) now accept provider+model params
- Add claudeAiModel, openAiModel, googleAiModel columns to ai_settings table
- New PUT /api/ai/provider-model route to save selected model per provider
- UI model dropdowns for Claude (Haiku/Sonnet/Opus), OpenAI (GPT-5.x series), Google (Gemini 2.5/3.x)
- Google AI section also gets model selector alongside existing API key field
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Documents page shows a "Local Folder" card for each selected patient
with an "Open in Cloud Storage" button that deep-links to their folder
- Cloud Storage page reads ?folderId URL param on mount and auto-opens
the folder panel for seamless navigation from Documents
- Backend: GET /api/cloud-storage/patient-folder/:patientId endpoint
that idempotently gets or creates a top-level CloudFolder per patient
- CloudFolder schema gains optional patientId field linked to Patient
- Disk directories for cloud storage folders now use the folder's name
(e.g. "Xiaohui Wang/") instead of the opaque "folder-{id}/" path
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Add OpenAI, Claude AI, and DentalManagement AI sections to the AI API
Setting page, each with a masked API key input and an on/off toggle
(defaulting to off). Rename sidebar label from "Google AI Settings" to
"AI API Setting". Add provider-key and provider-enabled backend endpoints
and extend the AiSettings schema with 6 new fields.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Internal AI chat: schedule_appointment intent books earliest available
slot in Column A using office hours; claim_only intent looks up latest
past appointment for service date, asks user when two appointments are
within 7 days, auto-triggers correct Selenium worker with mapped prices
- Gemini model updated to gemini-flash-latest; conversation history (15
messages) passed for pronoun/reference resolution; history trimmed to
start with user turn so Gemini doesn't reject the context
- Insurance alias file (insuranceAliases.json) replaces hardcoded siteKey
matching; "tufs" now resolves to TUFTS_SCO
- DOB format normalized (MM/DD/YYYY → YYYY-MM-DD) before parseLocalDate;
autoCheck now fires for all insurance types, not just MH/CMSP
- Claim form auto-submit: all handlers (MH, CCA, DDMA, UnitedDH, Tufts)
accept formToUse and receive fee-schedule-priced form; prefillDone set
after chatbot code prefill so autoSubmit gate opens correctly
- Chatbot: chat history persisted in sessionStorage, cleared on logout
and auto-logout; Clear button writes fresh state synchronously; message
history window increased to 15
- DentaQuest/TuftsSCO Selenium: "Remember me" checkbox clicked before
sign-in to persist OTP trust cookie across sessions
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Add eligibility_by_id and check_and_claim intents to internal chat
- New cdt-lookup.ts: keyword search against fee schedule JSON (no LLM)
- New internal-chat-workflow.ts: deterministic orchestration — patient
resolution, insurance siteKey derivation, CDT code mapping
- Custom CDT aliases stored per-user in DB (TwilioSettings JSON blob)
with GET/PUT /api/ai/cdt-aliases endpoints
- Chatbot UI: new steps for eligibility-id-ready, check-and-claim-ready,
and need-insurance-clarification with insurance picker
- Settings UI: CDT Aliases CRUD table with built-in alias reference
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- New DialPad component on Patient Connection page: clickable keypad,
call/hangup/mute buttons, duration timer, keyboard input support
- Backend: POST /api/twilio/voice-token issues Access Token for browser
Device; POST /api/twilio/webhook/voice-browser is the TwiML webhook
Twilio calls to bridge the browser to the patient's phone
- TwiML App SID field added to Twilio Settings (stored in templates JSON)
- README: one-time Twilio Console setup instructions for the dial pad
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Add Gemini-powered internal staff chatbot (free-text input in the
upper-right bot panel): type "check MARIA GONZALES" to search patient
and pre-fill eligibility, or "open claims" to navigate directly
- Add /api/ai/internal-chat endpoint with LangGraph + Google Gemini
classifier (intent: check_eligibility, find_patient, navigate_*)
- Add Users AI Chat settings section in Settings > Advanced > AI Chat
to configure a custom system prompt for the internal assistant
- Store internal chat system prompt in existing twilioSettings JSON
blob (no DB migration needed)
- Add AI Input Agent sidebar entry and placeholder page describing
planned keyboard-automation typing into Open Dental / Eaglesoft
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Added getPatientByInsuranceIdAndDob to storage
- Processor uses insuranceId + DOB as unique key instead of insuranceId alone
- Dependent with same subscriber ID but different DOB gets a new patient record
(bypasses createOrUpdatePatientByInsuranceId which would overwrite subscriber)
- Name extraction anchored to "Relationship:" to scope Patient Info column only
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Extract patient first/last name from Patient Information DOM section
(scoped to avoid duplicate Subscriber Information column values)
- Switch to latest tab at start of step2 (Eligibility Identifier opens in new tab)
- DOB: double-click + ActionChains.send_keys (no pyperclip, avoids Chrome crash)
- BCBS MA button changed to variant="default" to match nearby buttons
- Backend processor uses extracted names from selenium result
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- New Selenium worker (fresh Chrome per run, no persistent session)
login → OTP modal → eTools → ConnectCenter → Verification →
New Eligibility Request → fill form (NPI, member ID, DOB) →
Expand All → CDP PDF back to app
- Backend route fetches BCBS_MA credentials + provider NPI from settings
- Frontend OTP modal with 6-digit code entry
- BCBS MA added to insurance credentials dropdown in settings
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Add appointment type categories matching insurance claim form (recall, filling, pedo, dentures, implant, endo, crown, perio, extraction, ortho, consultation, emergency, other)
- Auto-infer appointment type from CDT codes with priority rules (endo > implant > crown > ...)
- typeLocked flag prevents auto-overwrite when user manually sets type
- Show appointment type label and procedure codes on schedule cards
- Background sync on /day route retroactively fixes stale appointment types
- Fix PUT /api/claims/:id to save claimFiles (previously silently dropped)
- Auto-link AppointmentFile records to ClaimFile when claim is created or updated
- Fix D5750 (denture reline) CDT range to map correctly to dentures category
- Fix typeLocked Zod rejection in appointment update route
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Fix Express route ordering in appointments-procedures so /prefill-from-appointment
is matched before /:id (D0140 and other codes now always reach the claim)
- claim-form: always fetch AppointmentProcedure records when an existing claim loads
so post-save procedure edits (e.g. adding D0140) are reflected immediately
- appointments-page: replace sessionStorage with React state (newApptPrefill) for
slot-click prefill so columns B-F correctly carry their staffId into the form
- add-appointment-modal / appointment-form: thread prefillData prop; add
NewAppointmentPrefill interface; useEffect applies values via setValue
- appointments upsert: remove per-patient dedup so the same patient can have
multiple appointments on the same day in the same column
- DentaQuest / TuftsSCO: navigate to about:blank and minimize instead of
quit_driver after each run — session cookie stays in memory so OTP is only
required once per app startup, not on every eligibility or claim check
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- claims.ts: batch-column now routes each patient to the correct portal
(MH/CCA/DDMA/TuftsSCO/UnitedSCO) based on patient.insuranceProvider
- appointments-page.tsx: eligibility badge falls back to patientStatus
for all insurance types, not just MassHealth
- unitedDHClaimProcessor/ddmaClaimProcessor/tuftsSCOClaimProcessor:
auto-save claim PDF when no socketId (batch-column path)
- unitedSCOEligibilityProcessor: unknown eligibility no longer stored as INACTIVE
- queues.ts: add tuftssco-claim-submit and uniteddh-claim-submit to SeleniumJobType
- selenium_UnitedSCO_eligibilityCheckWorker.py:
- step1: add Select Insurance OK click with staleness wait; Provider &
Location page just clicks Continue; skip first/last name input
- step2: extract name from eligibility details tab (ALL CAPS → title case);
skip "not available" guard; fix name regex to match only all-caps words
- .gitignore: ignore all chrome_profile_* directories
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Each office sets VITE_CLOUDFLARE_HOST and CLOUDFLARE_HOST in their
local .env files instead of hardcoding the subdomain in source code.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Add full Tufts SCO claim Selenium worker (steps 1-8): login with OTP
support, member search, Create Claim, fill form, attach files, submit,
extract claim number and save confirmation PDF
- Fix DentaQuest browser manager to preserve device trust token on startup
(only clear cookies, not LocalStorage/IndexedDB) so OTP is only needed
once for both eligibility and Tufts claim
- Fix Tufts SCO claim route credential lookup key (TUFTS_SCO not TuftsSCO)
- Add Tufts SCO and United/DentalHub entries to fee schedule update route
- Add "Claim All" button that auto-routes to the correct claim handler
based on the Insurance Type dropdown value
- Add fee schedule JSON files for DDMA, Tufts SCO, and United/DentalHub
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Add full Selenium automation for United/DentalHub claim submission
(steps 1-8: login, OTP, patient search, practitioner page, code entry,
other coverage No, attachments, submit, Status & History PDF)
- Consolidate UnitedDH siteKey to UNITED_SCO throughout app
- Fix procedure date overwrite with Ctrl+A+Delete before typing service date
- Fix OTP popup reliability: emit every poll (no throttle)
- Fix Chrome session persistence: only clear cookies on startup
- Add touchPatient() to storage: claim submission now pushes patient to
top of list across eligibility, claims, and documents pages
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Add full DDMA claim Selenium flow (steps 1-8): search patient, open
member page, create claim, fill form, attach files, next, submit,
extract claim number and save confirmation PDF
- Add fee schedule price-mismatch dialog for all claim buttons (MH,
CCA, DDMA, United, Tufts, Save) with optional price update to JSON
- Add OTP modal for DDMA claim when session expires, mirroring
eligibility OTP flow
- Close Chrome after claim submission via quit_driver() (session
preserved in profile)
- Move Map Price button between Direct Submission and procedure table,
right-aligned above Billed Amount column
- Add fee-schedule update-price backend route
- Add DDMA claim processor with claimNumber/pdf_url result handling
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Selenium: bulletproof Wait→Click→Clear→Type→Verify for tooth, billed amt cells
- Selenium: fix billed amt to click td[23] (correct column) to trigger edit mode
- Selenium: skip tentative date (auto-filled by page after tooth entry)
- Frontend: add Implants category with Implant/Abut/Crown, Fixture, Abutment, Crown buttons (D6010/D6057/D6058)
- Frontend: pdf-preview-modal renders PNG screenshots as <img> instead of PDF iframe
- Backend: CCA preauth route creates claim record if none exists
- Backend: CCA preauth processor saves authNumber into claimNumber column after submission
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Add CCA claim submit Selenium worker (login, fill form, attach docs, submit, capture dashboard PDF)
- Add CCA fee schedule (procedureCodesMH.json renamed, procedureCodesCCA.json added with D6010)
- Add backend route /api/claims/cca-claim, processor, and Selenium client
- Wire CCA claim handler in claims-page with job tracking and PDF preview popup
- Add insurance type dropdown in claim form (same options as eligibility page)
- Auto-populate insurance type from patient.insuranceProvider in claim form and patient edit form
- Map fee schedule by insurance type in Map Price button and combo buttons
- Fix CCA login speed (remove fixed sleeps, use readyState check)
- Fix CCA claim DOB format bug (was sending MM-DD-YYYY, now sends YYYY-MM-DD)
- Fix npiProviderId not saved for CCA claims
- Change Add Service → CCA Claim button (blue), MH → MH Claim
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
External browsers were hitting localhost:5000 instead of going through
nginx. VITE_API_BASE_URL_BACKEND is now empty so all API calls use
relative /api/ paths that nginx proxies to the backend. Also adds
https://communitydentistsoflowell.mydentalofficemanagement.com to
FRONTEND_URLS for CORS. Updated .env.example to match so setup from
template doesn't silently revert this fix.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Deleting users with patients/appointments/claims was blocked by FK
constraints. Now reassigns those records to the requesting admin before
deletion, and cleans up user-specific data (backups, cloud files).
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Removed per-user patient filtering so all staff accounts see the same
patient pool. Previously each user only saw patients they created.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Replace the prisma migrate deploy subprocess with a custom
applyMissingMigrations() that reads each migration SQL file and runs it
via prisma.$executeRawUnsafe. This avoids the Prisma CLI aborting when
the restored _prisma_migrations table contains orphaned entries (migration
names that no longer have a corresponding file in the migrations folder).
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- After importing a backup, run prisma migrate deploy so any schema
migrations the backup is missing are applied automatically. This
prevents pages from failing due to missing tables/columns when the
backup was taken on an older version of the app.
- Force logout and redirect to login after a successful restore so the
JWT is refreshed against the restored database (prevents userId
mismatch causing user-scoped queries to return empty results).
- Fix getTotalPatientCount() in /status route to pass userId so it
counts only the current user's patients instead of all patients.
- Add prisma.$connect() after $disconnect() to ensure a clean reconnect.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Add AI Dental Shopping to sidebar with Search/Tag and Login Info sub-pages
- Build full-stack Login Info CRUD: save vendor name, website, username, password per user
- Add ShoppingVendor Prisma model, run db push, regenerate client and Zod schemas
- Add storage layer, REST API at /api/shopping-vendors/, and frontend table with add/edit/delete modal
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Insurance Forms modal: split into Insurance Claim / PreAuth tabs
- PreAuth tab: same patient info + service lines, no toggle/direct combos
- Excluded Recalls & New Patients, Composite Fillings (Front/Back), Pedo from PreAuth combos
- Extractions: replaced Simple/Surg/Baby Teeth EXT with Full Bony EXT (D7240)
- MH PreAuth button: rewritten selenium worker to use masshealth-dental.org,
selects Dental Prior Authorization (2nd option), skips Date of Service field
- agent.py: convert pdf_path to pdf_url for /claim-pre-auth endpoint
- nginx + Express: raise body size limit to 50mb (fix 413 errors)
- DB schema: appointmentId optional on Claim, add preAuthNumber field, add PREAUTH status
- Backend: create PREAUTH claim record on preauth submit, save preAuthNumber on completion
- Claims table: add PreAuth No column (blue) next to Claim No
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Claims & Payments: save npiProviderId when submitting MH claim; sync between claim and payment on update
- Claims table: add Provider column showing rendering provider name
- Payments table: add Provider column + purple Commissioned badge on status
- Claim edit modal: add Rendering Provider dropdown (defaults to Mary Scannell)
- Payment edit modal: add Rendering Provider dropdown + Commissioned metadata display
- Reports page: add Provider filter dropdown (dynamic from NPI providers settings)
- Reports page: remove Collections by Doctor report type and Select Doctor dropdown
- Commission section: new section in reports page with date range + provider filter, shows eligible paid claims/payments per provider, multi-select checkboxes, Pay Commission modal with print + save, marks payments as commissioned so they are excluded from future cycles
- DB: add CommissionBatch and CommissionBatchItem tables; backfill Payment.npiProviderId from linked claims
- Backend: PATCH /api/payments/:id/provider syncs to linked claim; PUT /api/claims/:id syncs to linked payment; new /api/commissions routes
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Socket.IO reconnects through Cloudflare proxy get a new socket.id, causing
the backend to emit job:update to a stale socket that no longer exists. The
PDF viewer modal never opened even though PDFs were saved successfully.
Adds a GET /api/insurance-status/job-status/:jobId endpoint backed by
InProcessQueue.getJob(), and a waitForSeleniumJob() helper on the frontend
that races socket events against HTTP polling every 3s. Whichever resolves
first wins, so local (socket) and external (Cloudflare) both work reliably.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Add 3-message intro (self-intro → empathetic ack → new/existing question) via single TwiML response to guarantee delivery order
- Detect reschedule intent from first message; look up existing appointment date
- New patient flow: ask insurance type → MassHealth consent → member ID + DOB → Selenium eligibility check
- Post-eligibility: active → ask appointment date/time with office-hours validation; inactive → ask other insurance or collect contact info
- Date/time collection mirrors reschedule flow: check office day open, ask time, validate against office hours
- Auto-create appointment in schedule for known patients on confirmation; use first available staff member
- Add openPhoneReply toggle (Settings → AI Chat) to respond to any number at any time
- Add 5-minute inactivity timeout: reset conversation to initial stage and clear pending state
- Normalize MassHealth DOB to zero-padded MM/DD/YYYY before Selenium submission
- Expand isExistingPatient classifier to recognize "old patient", "old", "previous", "prior"
- Existing patient confirmation message now acknowledges patient type before asking about insurance
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>