Sign-in & shared code
Audit log & patient-data log
| Path | shared/audit-log |
|---|---|
| Status | staging |
| Drill-down pages | — |
| Pop-ups | — |
| Tabs | — |
| API routes | — |
Business rules
Data comes from: audit_logs (one row per change or per patient-data view). Shown on Admin → Audit Logs.
How it works:
- Changes: writes to 23 tracked tables (calendars, schedules, bookings, companies, users, offices, patients, appointments, providers, API keys, app settings and others; list in
db/audit.tsAUDIT_TABLES) are logged automatically with who, when, and old and new values (db/audit.ts). - Passwords, tokens and encrypted patient fields are never written to the log.
- Staging only (waits for the HIPAA cutover, migrations 099–108): old/new values and metadata are stored encrypted (
*_encryptedcolumns). Live stores them as plain JSON. - Dentrix sync jobs don't log their re-copies of patients and providers (about 2 million rows in 3 months that nobody changed).
- Patient-data views (HIPAA, staging only until the cutover): when a signed-in request decrypts patient data, one row is written with entity type
phi_access, the user, the route (ids only) and how many values or files were decrypted. Search text is never logged (utils/phi-access.ts). - Logging runs after the answer is sent and never blocks the request.
- Kept for at least six years (HIPAA), so rows are never cleaned up. Live: about 17 million rows (5.5 GB) since May; most are Dentrix sync copies written before syncs stopped being logged. Indexes: time, user, (record type, record id), (record id, time) and (action, time) (migration 177).
Database tables & columns
| Table | Columns used |
|---|---|
audit_logs | action, entity_id, entity_type, ip_address, metadata, metadata_encrypted, new_data, new_data_encrypted, old_data, old_data_encrypted, user_agent, user_name |
File structure
Its own files
- apps/
- worker/
- src/
- db/
- audit.ts
- utils/
- phi-access.ts
- db/
- src/
- worker/
Shared code it uses (followed through its imports and the helpers its API calls; sign-in/access plumbing and UI primitives left out)
- apps/
- worker/
- src/
- utils/
- crypto.ts
- phi-crypto.ts
- utils/
- src/
- worker/