gdpr — events
Per-module slice of docs/events-catalog.md (auto-generated). Update both files when adding or removing events.
Published
| Event | When | Payload keys |
|---|---|---|
gdpr.request.created | a data-subject request is created | clinic_id, request_id, patient_id, request_type |
gdpr.request.status_changed | a DSR status changes (received → in_progress → completed/rejected) | clinic_id, request_id, patient_id, from_status, to_status, changed_by |
gdpr.consent.granted | a consent is recorded | clinic_id, consent_id, patient_id, purpose |
gdpr.consent.withdrawn | a consent is withdrawn (same row, granted=false) | clinic_id, consent_id, patient_id, purpose |
gdpr.erasure.executed | a partial erasure ran | clinic_id, patient_id, request_id, erased_categories, retained_categories |
gdpr.breach.reported | a data-breach report is created | clinic_id, breach_id, affected_people |
All events are published by the gdpr service layer after the DB commit succeeds, so optional subscribers (patient_timeline, notifications, audit exports) react to rights lifecycle without importing gdpr models.
Subscribed
This module does not subscribe to any events.
Adding a new event
- Add the constant to
backend/app/core/events/types.py(EventType). - Publish from a service method, after the DB commit succeeds.
- Add the row to the table(s) above.
- Run
python backend/scripts/generate_catalogs.pyto refresh the global catalog.