Tenelix
Documentation

Audit & PHI logging

How Tenelix structures clinical, billing, and admin audit — and how to query it.

Tenelix emits structured events for every clinical, billing, and admin action. Events flow into dedicated, append-only log channels and are tenant-aware.

Channels

ChannelPurpose
phi_accessPHI access — every read of a patient record
rbac_auditRole, permission, and user-role changes
billing_auditInvoice, payment, and adjustment lifecycle
account_securityPhone-verify, trusted-device, and account-security events
defaultApplication logs

Per-module audit channels (inventory, donor program, gamete bank, migration, referrers) record lifecycle events for their own domains.

Event shape

All audit events share a base shape:

{
  "tenant_id": "uuid",
  "user_id": "uuid",
  "request_id": "uuid",
  "action": "patient.read",
  "resource_type": "Patient",
  "resource_id": "uuid",
  "metadata": { ... },
  "timestamp": "ISO-8601"
}

Every event carries tenant_id and request_id, so nothing slips through unattributed.

Override audit

Some actions support an admin override path — for example, clearing a patient through Awaiting Payment without taking payment. Overrides leave typed columns (override_by_user_id, override_reason, override_marker = "[CLEARED WITHOUT PAYMENT]") on the affected record. The override log is immutable.