Data Model: Reporting & Data Quality
On this page
Overview
The reporting service provides automated data quality monitoring and federal report generation. It consumes events from other CRAIG services (cases, placement, financial) to detect data quality issues, and generates AFCARS (quarterly) and NCANDS (annual) submissions for federal reporting to the Administration for Children and Families (ACF).
Data quality issues are created automatically when inbound events fail validation checks (missing required fields, invalid values).
AFCARS and NCANDS submissions follow an approval workflow: draft → validated → reviewed → approved → transmitted.
For NCANDS, generate finalizes to validated only when the file has reportable records and zero validation
errors; a file with genuine defects (e.g. >4 maltreatment types) or no reportable records finalizes to
validated_with_errors, a terminal state the workflow cannot advance and transmit refuses (#782). The Child File carries only children whose report
received a disposition in the FFY — still-pending reports are excluded as not-yet-reportable (ADR-040
capture-complete amendment), reported in the year they are disposed.
Tables
| Table | Purpose |
|---|---|
|
Tracks data quality problems detected across all CRAIG services (missing fields, invalid values, cross-service inconsistencies) |
|
AFCARS quarterly submission records with review/approval audit trail |
|
NCANDS annual submission records with review/approval audit trail |
|
Per-(report, child) materialized NCANDS Child File rows for a submission (the federal #1–34 codes); written when a submission is generated, read by the export emitter ( |
|
Point-in-time metrics for dashboards (field completeness, AFCARS/NCANDS readiness scores) |
|
ADR-062 §U upload-attempt tombstones (SU2 #1248): one immutable row per client
upload/export operation, id = the client-held request id; generation-fenced CAS
state machine + replay decision table live in |
Indexes
| Table | Index | Columns |
|---|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Cross-Service References
The reporting service does not have direct foreign keys to other databases.
Instead, it stores source_record_id (UUID) references that correspond to records in other services:
-
source_service = "craig-cases"→cases.idincraig_casesdatabase -
source_service = "craig-placement"→placements.idincraig_placementdatabase -
source_service = "craig-financial"→payments.idincraig_financialdatabase
For NCANDS generation, the service makes HTTP calls to collect data from upstream services using the caller’s JWT token. AFCARS generation does not yet collect upstream data: generate_afcars creates an honest zero-record draft stub that cannot advance the federal workflow or be transmitted, pending the real extraction tracked in #949 (#762).