Admin

Dentrix API Status

Path/dentrix-api-status
Statuslive
Drill-down pages/email-management
Pop-ups—
Tabs—
API routes/api/dentrix-api-status/summary
/api/dentrix-api-status/checks
/api/dentrix-api-status/check

What's on the page

  • Header: last checked time and Check now.
  • Headline: "All endpoints responding" (green), "N of M endpoints failing" (red), or "Over the Dentrix quota: not a Dentrix outage" (amber), with OK count, when, how long ago, "authentication failed" and "alert emailed" when they apply. When something fails: syncs using it are stalled, and nothing is skipped (cursors don't move on failure, so the gap replays on recovery).
  • One line per endpoint: Endpoint, Used by, Called by (coloured by system), Run times per caller, Status (green, red, amber "over quota", or grey "not checked" when the run stopped before it), error text, Response time (amber over 5 s), Last failed (or "not in 30 days").
  • Recent checks: Checked, Result (N/M OK, N down, or "over quota"), Failing endpoints, Email (alert sent / recovery sent). Result filter (something down, all OK, over quota, email sent), Date Range (default All Time), 24 per page, newest first. Filters, sort and page are kept in the link.

Business rules

Data comes from: dentrix_health_checks (one row per run: when, sign-in OK, counts, whether an email went) and dentrix_health_results (one row per endpoint per run: status, response time, error, over quota). What each endpoint is for and who calls it is in code (services/dentrix-health.ts, PROBES). API: GET /api/dentrix-api-status/summary, GET /checks, POST /check.

How it works:

  • Live checks every endpoint once an hour on the hour (about 20 Dentrix calls, ~480 a day). Staging does not run the hourly check: it reads the same Dentrix account as live, so it would only spend live quota.
  • One run per 5 minutes, whoever starts it. The hourly job and Check now both take the same claim first (one atomic database statement), so a repeated cron delivery, two people pressing at once, or a press just before the hour can't run it twice. A press inside the 5 minutes shows the latest run and the time it can run again; the button stays disabled until then. It doesn't run while Pulse is pausing Dentrix calls after a rate limit.
  • A 429 stops the run at once (the rest share the same quota). Endpoints it didn't reach show "not checked". Over quota is never counted as a failure: not in "Last failed", the Failing column, or the alert email.
  • A 4xx from Dentrix (except 401/403) means it is up and objecting to our request, so it is not counted as down. A 429 is shown as over quota (our problem), not an outage.
  • The first time an endpoint fails, one email goes to the people on "Dentrix API Up/Down Alerts" in Email Management, and one more when it recovers.
  • Runs are kept 30 days.
  • Needs the Dentrix API Status access key (or admin), checked on the server.

Database tables & columns

TableColumns used
dentrix_health_checksauth_ok, checked_at, down_count, emailed, id, ok_count, recovered, total_count
dentrix_health_resultscheck_id, error, ms, ok, path, rate_limited, status
dentrix_officesapp, dentrix_id
dh_patientsdentrix_id
dh_sync_stateextra, id, last_synced_at
email_recipientsemail, email_type
email_sendsapp, error, lang, provider, recipients, ref, sent_by, status, subject, subject_encrypted, template_key, to_email, to_email_encrypted, to_email_hash
email_templatesactive, bcc_emails, body_en, body_es, from_email, key, reply_to, subject_en, subject_es, to_emails

File structure

Its own files

  • apps/
    • web/
      • src/
        • features/
          • dentrix-api-status/
            • pages/
              • DentrixApiStatusPage.tsx
            • api.ts
            • index.ts
    • worker/
      • src/
        • features/
          • dentrix-api-status/
            • __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/
            • DentrixSourceNote.tsx
            • FilterSelect.tsx
            • HowItWorksNote.tsx
            • ReportDateRange.tsx
            • ReportHeader.tsx
            • sortable-grid.tsx
          • TablePagination.tsx
        • hooks/
          • usePagedList.ts
        • lib/
          • date-presets.ts
          • office.ts
          • time.ts
        • services/
          • api.ts
    • worker/
      • src/
        • adapters/
          • dentrix.ts
        • db/
          • index.ts
        • lib/
          • dates.ts
          • list-query.ts
        • services/
          • dentrix-health.ts
          • email-templates.ts
        • utils/
          • email.ts