Reports - All Locations (API)

Follow Up Report

Path/follow-up-report
Statuslive
Drill-down pages—
Pop-ups—
Tabs—
API routes/api/data/offices
/api/follow-up-report
PUT /api/follow-up-report/:procedureId
/api/follow-up-report/:procedureId

What's on the page

  • Filters (kept in the page link): Office Location; Date Range (same choices as Treatment Tracking, default Last 7 Days); Patient (name or id); Treatment; Final Status (Pending, Booked, Declined, No Response); Clear.
  • Cards: Total Records, Pending, Booked, Declined, No Response.
  • Table columns: Patient Name (stays in view), Patient ID, Treatment Type, Date Presented, 24hr Follow-Up (Date — date picker), 24hr Follow-Up (Outcome — click to type), 3 Day Email Sent (Date — date picker), 7 Day Call (Outcome), Monthly Follow-Up (Outcome), Final Status (drop-down), Patient Record (View link).
  • Editing: a note saves when you press Enter or leave the box (Escape cancels); dates save when picked; "Saving..." shows while it saves, and an error puts the old value back.
  • Links:
    • Patient Record → View opens the patient's chart in Dentrix Ascend (new tab).
  • Sort: every column except Patient Record. Default: newest Date Presented first.
  • Paging: 25 / 50 (default) / 100 / 250 / 1000 rows per page.
  • Export CSV: every matching row (up to 25,000) with all the notes.

Business rules

Data comes from: the same rows as Treatment Tracking (Dentrix API, read from our copy: one row per procedure) plus the notes staff type on this page, saved in treatment_follow_ups (one row per procedure). No Dentrix calls when the page opens or saves.

How the numbers are worked out:

  • Final status: what staff picked; if nobody has, worked out from Dentrix (shown in italics):
    • declined → Declined;
    • started, or status Complete / In Progress → Booked;
    • otherwise → Pending (a treatment plan, shown as Scheduled on Treatment Tracking, stays Pending until it is started).
  • Cards: count of rows per final status for everything the filters match.
  • 24hr follow-up date / 3 day email date: dates picked by staff.
  • 24hr / 7 day / monthly outcomes: free text (up to 500 characters), stored encrypted because it is about a patient. Sorting by them works on the decrypted text.
  • Empty a cell to clear it. Every save is in the audit log (which field, not the text).

Database tables & columns

TableColumns used
treatment_rows viewdate_presented, declined_yn, diagnosed, follow_up_status, location_id, patient_id, procedure_id, started_yn, treatment_type
dentrix_offices(columns not named in the SQL)
dh_claim_proceduresread through the view treatment_rows
dh_patient_proceduresid
dh_patientsdentrix_id, first_name, first_name_encrypted, last_name, last_name_encrypted
dh_sync_stateid, last_synced_at
treatment_follow_upscall_7day_outcome_encrypted, email_3day_on, final_status, followup_24hr_on, followup_24hr_outcome_encrypted, monthly_followup_outcome_encrypted, procedure_id, updated_by

File structure

Its own files

  • apps/
    • web/
      • src/
        • features/
          • follow-up-report/
            • components/
              • Cells.tsx
            • pages/
              • FollowUpReportPage.tsx
            • api.ts
            • index.ts
    • worker/
      • src/
        • features/
          • follow-up-report/
            • __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
          • forms/
            • DatePicker.tsx
          • reports/
            • DataAsOf.tsx
            • DentrixSourceNote.tsx
            • FilterSelect.tsx
            • HowItWorksNote.tsx
            • ReportDateRange.tsx
            • ReportHeader.tsx
            • sortable-grid.tsx
          • TablePagination.tsx
        • hooks/
          • useApi.ts
          • usePagedList.ts
        • lib/
          • csv.ts
          • date-presets.ts
          • dentrix.ts
        • services/
          • api.ts
    • worker/
      • src/
        • db/
          • index.ts
        • lib/
          • dates.ts
          • list-query.ts
          • text-sort.ts
        • routes/
          • data.ts
        • services/
          • phi-read-dh.ts
          • phi-read.ts
          • treatment-rows.ts
        • utils/
          • crypto.ts
          • office.ts
          • phi-access.ts
          • phi-crypto.ts
          • timestamps.ts