Reports - All Locations (API)

Waitlist

Path/waitlist
Statuslive
Drill-down pages—
Pop-ups—
TabsTabs: All Patients · Waitlist 6+ Months · Future D Codes (`?tab=`)
API routes/api/data/offices
/api/waitlist
POST /api/waitlist/sync
/api/waitlist/sync

What's on the page

  • Tabs: All Patients (default), Waitlist 6+ Months, Future D Codes (kept in the page link).
  • Filters (kept in the page link): Search by name, email or phone (a full email is found exactly; anything else matches part of a name, email or phone); Office.
  • Count: "N patients" for everything the tab and filters match.
  • Table columns: Name ("Last, First"; stays in view when scrolling sideways), Email, Phone, Office, Last Appt, Next Appt, Insurance (Yes / No), D Codes (Waitlist and D Codes tabs), Days Since (Waitlist tab).
  • Sort: Name (default, A–Z), Office, Last Appt, Next Appt.
  • Paging: 25 / 50 (default) / 100 / 250 rows per page; "Showing x–y of total".
  • Export CSV: every patient the tab and filters match (up to 25,000), with D Codes on the D Codes tab.
  • Links: none.
  • Dentrix data as of: when the procedures sync last ran.

Business rules

Data comes from: Dentrix API, read from our copy: patients (dh_patients), appointments (dh_appointments) and procedures (dh_procedures_current), all filled by the Dentrix syncs. Visit dates come from the dh_patient_visits view. Opening the page makes no Dentrix calls; the Sync from Dentrix button runs the procedures sync now (about 20 Dentrix calls, the same job as the nightly run).

How the numbers are worked out:

  • Patients: active patients that have a Dentrix id.
  • A visit: any Dentrix appointment that was not cancelled — by the patient or by the office (broken and no-show still count).
  • Last Appt: the latest visit at or before now. Next Appt: the earliest visit after now.
  • Waitlist 6+ Months tab: no visit from 6 months ago onward (a booked future visit also takes a patient off the list).
  • Future D Codes tab: patients with any diagnostic (D-code) procedure in Dentrix.
  • D Codes column: the patient's diagnostic procedures, newest first (hover for the description).
  • Days Since: days since Last Appt, shown as months + days; red after a year; "Never" when there is no visit.
  • Office: the patient's preferred office in Dentrix.

Open questions (need your answer)

Open questions:

  • "Future D Codes" lists every patient with any diagnostic procedure, past ones included (10,322 on staging). Should it be only patients whose diagnostic procedure is planned or on a future appointment?
  • Broken and no-show appointments count as visits for Last Appt and the 6-month rule. Should they?

Database tables & columns

TableColumns used
dh_patient_visits viewlast_visit_at, latest_visit_at, next_visit_at, patient_id
dh_procedures_current viewada_code, category, description, id, patient_id, service_date, status
dentrix_officesapp, dentrix_id, name
dh_appointmentsread through the view dh_patient_visits
dh_patient_proceduresada_code, amount, bill_to_insurance, category, description, entry_date, id, location_id, patient_id, practice_procedure_id, provider_id, referred_out, service_date, status, synced_at, teeth
dh_patientsdentrix_id, email, email_hash, first_name, id, insurance_eligible, is_active, last_name, phone, preferred_location_id
dh_practice_proceduresabbreviated_description, active, ada_code, category, description, favorite, fee, id, synced_at, treatment_area
dh_sync_stateid, last_id, last_synced_at

File structure

Its own files

  • apps/
    • web/
      • src/
        • features/
          • waitlist/
            • pages/
              • WaitlistPage.tsx
            • api.ts
            • index.ts
    • worker/
      • src/
        • features/
          • waitlist/
            • __tests__/
              • service.test.ts
            • index.ts
            • queries.ts
            • routes.ts
            • service.ts

Shared code it uses (followed through its imports and the helpers its API calls; sign-in/access plumbing and UI primitives left out)

  • apps/
    • web/
      • src/
        • components/
          • data/
            • DataTable.tsx
          • reports/
            • DataAsOf.tsx
            • DentrixSourceNote.tsx
            • FilterSelect.tsx
            • HowItWorksNote.tsx
            • ReportHeader.tsx
            • sortable-grid.tsx
          • TablePagination.tsx
        • hooks/
          • useApi.ts
          • usePagedList.ts
        • lib/
          • csv.ts
        • services/
          • api.ts
    • worker/
      • src/
        • db/
          • index.ts
        • lib/
          • list-query.ts
        • routes/
          • data.ts
          • reports.ts
        • services/
          • phi-read-dh.ts
          • phi-read.ts
        • utils/
          • crypto.ts
          • office.ts
          • phi-access.ts
          • phi-crypto.ts
          • timestamps.ts