Files
onboard/docs/adr/0001-report-domain-strangler.md

1.2 KiB

ADR 0001: Report Domain Strangler

Status

Accepted

Context

The first report flow in the medical reporting system has grown into a large Laravel service that mixes orchestration, replica reads, calculations, persistence, snapshots, and post-processing.

Decision

We introduce Domain/Reports, Application/Reports, and Infrastructure/Reports alongside the legacy implementation. The first migration slice covers only the save path and auto-fill path. Read-side statistics remain on the legacy path.

The new save flow is orchestrated by GenerateReportUseCase and persists through EloquentReportRepository. Transitional adapters to ReportService and SnapshotService are allowed until formulas and data sources are moved into Domain-native calculators and sources.

Feature rollout is controlled by config('reports.use_new_arch.report_types'). Each new-path execution writes an audit record to reports_audit with comparison status and diff payload.

Consequences

  • Legacy behavior remains available as a fallback.
  • New code can be unit-tested without framework imports in Domain/Application DTOs.
  • Future reports can reuse the same orchestration, repository contract, and audit pipeline.