Data Subject Rights (DSR)
Description
Data Subject Requests (DSRs) are formal requests from individuals exercising their rights under data protection laws. The Compliance module provides a complete, structured DSR workflow: submission, assignment, review, processing, and closure — with a full append-only audit trail and SLA tracking.
Request Types
The system supports five DSR types as defined by GDPR and CCPA regulations:
| Request Type | Description | GDPR Reference |
|---|---|---|
| Access | Right of Access (Article 15). Subject requests a list of processing purposes, categories of personal data, and recipients. | Article 15 |
| Export | Right to Data Portability (Article 20). Subject requests a machine-readable copy of their personal data. | Article 20 |
| Erasure | Right to Erasure / Right to be Forgotten (Article 17). Subject requests permanent deletion or anonymization of their PII. | Article 17 |
| Rectification | Right to Rectification (Article 16). Subject requests correction of inaccurate or incomplete personal data. | Article 16 |
| Restriction | Right to Restriction of Processing (Article 18). Subject requests suspension of data processing while maintaining data storage. | Article 18 |
Request Lifecycle
DSR tickets are modeled as state transitions with a review cycle and safety confirmation gates to prevent accidental and irreversible deletions:
DSR Anonymization Execution Flow
Erasure request execution anonymizes personal data asynchronously across modules via fanned-out provider implementations:
SLA Tracking & Deadline Calculations
Compliance regulations dictate strict response timelines. SCRIPE automatically calculates and tracks SLA metrics on the admin dashboard:
Escalation Engine & Alerts
The DsrEscalationJob runs daily at 08:00 UTC to evaluate SLA consumption and escalate overdue tickets:
Extensible Provider Architecture
To maintain loose coupling, the Compliance module communicates with other modules using the IUserDataProvider and IUserDataAnonymizer abstractions:
Entity Reference
The core DSR domain aggregate stores request metadata, current status, verified subject identifiers, and execution timestamps.
| Field | Type | Description |
|---|---|---|
| Id | Guid | Unique identifier for the DSR request. |
| TenantId | Guid | Foreign key referencing the tenant context. |
| SubjectEmail | String | Data subject email address (anonymized upon erasure). |
| RequestType | Enum | Type of DSR (Access, Export, Erasure, Rectification, Restriction). |
| Status | Enum | Current lifecycle status of the request. |
| Deadline | DateTime | Calculated SLA response deadline. |
| ErasureConfirmed | Boolean | Boolean flag unlocking Erasure requests for background jobs. |
| ErasureExecuteAfter | DateTime? | Execution threshold enforcing the adaptive grace period. |
| ExportFileUrl | String | URL to download fanned-out exported data zip. |
| AssignedTo | Guid? | Foreign key referencing the assigned admin user. |
| RetryCount | Integer | Current retry attempt count for failed module executions. |
| CompletedAt | DateTime? | Timestamp indicating when the DSR was completed. |
CQRS Handlers & Domain Events
DSR processing leverages CQRS commands and queries, emitting domain events across module boundaries to invoke registered data anonymizers.
public class SubmitDsrCommandHandler : ICommandHandler<SubmitDsrCommand, Guid>
{
public async Task<Result<Guid>> Handle(SubmitDsrCommand request, CancellationToken ct)
{
// 1. Calculate SLA deadline based on regulation profile
var regulation = await _regulationRepo.GetByCodeAsync(request.RegulationCode, ct);
var deadline = DateTime.UtcNow.AddDays(regulation.ResponseSlaDays);
// 2. Create the entity
var dsr = new DataSubjectRequest
{
TenantId = _tenantContext.TenantId,
SubjectEmail = request.SubjectEmail,
RequestType = request.RequestType,
RegulationCode = request.RegulationCode,
Status = DsrStatus.Pending,
Deadline = deadline
};
await _repository.AddAsync(dsr, ct);
await _unitOfWork.SaveChangesAsync(ct);
// 3. Domain event triggers webhook
dsr.AddDomainEvent(new DsrSubmittedEvent(dsr.Id));
return Result<Guid>.Success(dsr.Id);
}
}API Endpoints
| Method | Endpoint | Description | Auth |
|---|---|---|---|
| POST | /api/v1/compliance/dsr | Submit a new Data Subject Request ticket (Access, Rectification, Erasure). | 🔒 Required |
| GET | /api/v1/compliance/dsr | List submitted Data Subject Requests with status and SLA indicators. | 🔒 Required |
| GET | /api/v1/compliance/dsr/{id} | Retrieve complete lifecycle status, discovery logs, and artifacts for a DSR ticket. | 🔒 Required |
| POST | /api/v1/compliance/dsr/{id}/review | Transition a DSR ticket to in-review and record compliance officer notes. | 🔒 Required |
| POST | /api/v1/compliance/dsr/{id}/confirm | Execute automated fulfillment actions and confirm DSR ticket completion. | 🔒 Required |
| POST | /api/v1/compliance/dsr/{id}/assign | Assign a DSR ticket to a designated compliance handler or DPO. | 🔒 Required |
Quick Start Guide
Seed Compliance Profiles
Run the development seeder to populate GDPR and CCPA regulation profiles with SLA days.Submit a Data Subject Request
Use the POST endpoint to log a new request. The system validates input constraints and calculates the response deadline.JSONPOST /api/v1/compliance/dsr { "requestType": "Export", "regulationCode": "GDPR", "subjectEmail": "user@example.com" }Review and Approve
The assigned compliance officer reviews the ticket. Approving an Erasure DSR sets the grace period and awaits final nuclear confirmation.