Skip to content

Odontogram — events

Per-module slice of docs/events-catalog.md (auto-generated). Update both files when adding or removing events.

Published

Two groups. The odontogram.treatment.* events are published via EventType; the tooth-state events (surface/tooth/condition) use the module-local OdontogramEventType class in service.py (kept for the legacy surface/tooth update path).

EventWhenConsumers
odontogram.treatment.performedA planned/charted treatment is marked performedbudget, patient_timeline, payments, periodontogram, treatment_plan
odontogram.treatment.addedTreatment added to a tooth
odontogram.treatment.status_changedTreatment status transition
odontogram.treatment.deletedTreatment removed
odontogram.surface.updatedA tooth surface condition changes
odontogram.tooth.updatedA whole-tooth condition changes
odontogram.condition.changedA tooth condition is (re)assigned

odontogram.treatment.performed feeds the payments earned ledger — its payload carries the unit_price/price_snapshot the payments handler needs. unit_price: null means "revenue already attributed elsewhere": TreatmentService.perform(publish_price=False) is how treatment_plan finalizes a sessioned item whose amounts were already booked per-session (treatment_plan.item_session_completed); subscribers must not book revenue for a null price. See the module CLAUDE.md for the full payload contract.

Subscribed

This module does not subscribe to any events (get_event_handlers returns {}; plan→treatment propagation lives in TreatmentPlanService.complete_item).

Adding a new event

  1. Add the constant to backend/app/core/events/types.py (EventType).
  2. Publish from a service method, after the DB commit succeeds.
  3. Add the row to the table above.
  4. Run python backend/scripts/generate_catalogs.py to refresh the global catalog.