Api reference
components.compliance.public.commands ¶
alert_unreviewed_gdpr_deletion_batches ¶
alert_unreviewed_gdpr_deletion_batches ¶
Send Slack alerts for unreviewed GDPR deletion batches per bucket type.
Source code in components/compliance/public/commands/alert_unreviewed_gdpr_deletion_batches.py
create_gdpr_deletion_batch_for_data_bucket ¶
create_gdpr_deletion_batch_for_data_bucket ¶
Create GDPR deletion batches for a given data bucket, chunked by max-batch-size.
Source code in components/compliance/public/commands/create_gdpr_deletion_batch_for_data_bucket.py
create_gdpr_deletion_records_for_data_bucket ¶
create_gdpr_deletion_records_for_data_bucket ¶
Create GDPR deletion records for a given bucket type using bulk operations.
Source code in components/compliance/public/commands/create_gdpr_deletion_records_for_data_bucket.py
purge_gdpr_compliance_data ¶
purge_gdpr_compliance_data_command ¶
Purge all GDPR deletion records, batches, and orphan profiles for a bucket type.
Source code in components/compliance/public/commands/purge_gdpr_compliance_data.py
components.compliance.public.entities ¶
BucketEligibilityResult
dataclass
¶
Per-bucket eligibility report from a single GDPR producer.
Profiles in ready_for_deletion ∪ not_ready_yet are the producer's
"opinionated" set. Any profile outside both lists is implicitly
OUT_OF_SCOPE for this producer — the orchestrator uses that distinction
so silent omissions can no longer block deletion across multiple producers.
ComplianceProfile
dataclass
¶
Bases: DataClassJsonMixin
Entity representing a compliance profile model
DeletionContract
dataclass
¶
What a producer owns and reads, for GDPR deletion ordering.
owns: anchors this producer deletes.reads_as_discriminator: anchors this producer inspects to decide deletability. The orchestrator must not delete such an anchor until this producer has run, so a producer reading anchor X must run before the producer that owns X deletes it.reads_as_reference: anchors this producer reads only for display/enrichment. Deleting one blanks a field the producer renders but never changes deletability, so references warn, they never block and impose no ordering (the runtime "data lost elsewhere" warning is a later increment). Surfaced byget_reference_reads.
A producer that both owns and reads an anchor (self-read) imposes no cross-producer ordering: it orders its own reads-before-deletes internally.
GdprDeletionBatch
dataclass
¶
GdprDeletionBatch(
id,
bucket_type,
deletion_records,
reviewed_status,
reviewed_at,
reviewed_by,
reviewed_reason,
created_at,
updated_at,
records_count_for_list=0,
failed_records_count=0,
manually_reviewed_count=0,
rejected_records_count=0,
total_records_count=0,
)
Bases: DataClassJsonMixin
Entity representing a GDPR deletion batch model
GdprDeletionBatchProgress
dataclass
¶
GdprDeletionRecord
dataclass
¶
GdprDeletionRecord(
id,
compliance_profile_id,
compliance_profile,
bucket_type,
deletion_batch_id,
deletion_scheduled_at,
deletion_applied_at,
created_at,
updated_at,
accepted_for_deletion=None,
is_manually_reviewed=None,
deletion_error=None,
)
Bases: DataClassJsonMixin
Entity representing a GDPR deletion record model
components.compliance.public.enums ¶
ComplianceDataBucketType ¶
Bases: AlanBaseEnum
Type of data bucket to be considered for GDPR compliance deletion process
DELETION_ANCHOR_TABLES
module-attribute
¶
DELETION_ANCHOR_TABLES = {
enrollment: ("enrollment",),
employment: ("employment",),
exemption: (
"exemption",
"exemption_signed_document",
"exemption_justification",
),
insurance_profile: ("insurance_profile",),
medical_conversation_part: (
"medical_data.medical_conversation_part",
),
therapist_booking_session: (
"therapist_booking.therapist_booking_session",
),
}
DeletionAnchor ¶
Bases: AlanBaseEnum
A model (or logical group of tables) that participates in GDPR deletion ordering.
A producer declares which anchors it owns (deletes) and which it reads as a
discriminator (a model it inspects to decide whether a profile is deletable). An
anchor is a logical concept, not a single table: exemption spans several physical
tables. DELETION_ANCHOR_TABLES maps each anchor to its real __tablename__s,
kept honest by test_every_deletion_anchor_maps_to_real_tables.
Seeded only with the anchors the onboarded producers reference. Add one when a producer needs it.
components.compliance.public.gdpr_access ¶
Helpers for running Metabase saved questions and uploading files for GDPR access requests.
run_metabase_questions_for_user ¶
Run a sequence of Metabase questions parameterized with user_id, saving each as CSV.
Output filenames follow the pattern
{file_prefix}{short_name}.csv}_{iso8601_timestamp
Pass an explicit timestamp to share it across multiple export functions in one batch. If omitted, a timestamp is generated at call time.
Returns:
| Type | Description |
|---|---|
list[str]
|
List of written file paths. |
Source code in components/compliance/public/gdpr_access.py
upload_files_to_gdpr_folder ¶
Upload GDPR access files to a new Dataroom folder.
Creates folder 'GDPR access - {app_name} - {user_id}' inside the GDPR root folder (ID 2041) and uploads all files to it.
Returns:
| Type | Description |
|---|---|
DataroomFileData
|
DataroomFileData for the created folder. |