Data Model: Reporting & Data Quality
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 (six-month report periods) 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. NCANDS ends there; AFCARS goes on to ready_for_transmission (#2179). Neither program can be marked transmitted: both marking-only transmit routes are retired (#2180, #2130), AFCARS transmitted is the delivery program’s (#1967), and NCANDS has no delivery program yet.
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 (#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. For AFCARS, the generate finalizes inside its
one transaction (#2162): validated only when the file has records and no standard is failed, else the terminal
validated_with_errors; until P-D5 evaluates the consistency and recurrence steps, every AFCARS submission is
validated_with_errors.
The fleet-standard platform tables also live in this schema and are documented
centrally: event_outbox / event_inbox / event_inbox_collisions
(ADR-022 and the ADR-062 §A
attempt machine), request_claims
(ADR-062 §B), and
schema_compat_floor (ADR-063).
A claim’s actor is the ADR-085 D3 column pair (#2740): request_claims.created_by_sub holds a worker’s UUID
and created_by_sub_service a service’s service:<name> encoding, with a CHECK that exactly one is set.
Tables
| Table | Purpose |
|---|---|
|
Tracks data quality problems detected across all CRAIG services (missing fields, invalid values, cross-service inconsistencies) |
|
One AFCARS submission per generate ( |
|
One immutable AFCARS oohc record per (submission, child): its (a), (b), (c) and (i) element cells (#2139) |
|
One immutable row per parent of a child’s record, in |
|
One immutable row per removal episode of a child’s record: its (d), (g), (h) and (i) element cells (#2139), then
|
|
One immutable row per living arrangement, tied to its removal row: its (e) and (i) element cells (#2139), then
|
|
One immutable row per plan, periodic review, permanency hearing or caseworker visit: the (f) element cells (#2139) |
|
Per submission, how each oohc element and population situation was sourced (captured / derived / unsourced) (#2139) |
|
Per submission, each blank record cell with the reason it could not be filled (no cell value stored) (#2139) |
|
Per submission, one immutable row per oohc element of its view: the clean class, the applicable records and the records missing, invalid and tardy by worst class, and whether the element meets its standard (#2162) |
|
Per submission, the two immutable A8 step rows (consistency, recurrence): evaluated and met; both unevaluated and failing until P-D5 (#2162) |
|
Per submission, one immutable row per missing, invalid or tardy observation: child, source record, element and class, no cell value (#2162) |
|
Per submission, one immutable review-only finding (a runaway exit against the episode’s latest arrangement, sibling counts out of order, a dated plan outside every episode): child, source record and kind, no cell value; never changes the status (#2163) |
|
The AFCARS dictionary and crosswalk documents a submission used, stored once by canonical content hash (#2139); immutable once written (#2174) |
|
Per submission, the dictionary and crosswalk rule-set id, revision and content hash it was generated under (#2139); immutable once written (#2174) |
|
Per AFCARS submission, one append-only row per winning export flip, written in the flip’s transaction: the export generation, the winning attempt (no foreign key: the prune deletes attempt rows and an id may recur), the stored object’s and the delivered file’s SHA-256 and the retained dictionary and crosswalk identities (rule-set id, revision, content hash) (#2178); the |
|
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
Every index a craig-reporting migration creates on a table in § Tables: each CREATE INDEX and each named UNIQUE
constraint. Primary keys and the platform tables named in § Overview are not listed.
| Table | Index | Columns |
|---|---|---|
|
|
|
|
|
|
|
|
partial |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
partial |
|
|
partial |
|
|
partial |
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 is the afcars_generate background job (#2143; enqueued by POST /v1/reporting/afcars/generate, 202, #2144). Under craig-reporting’s service token it reads craig-placement’s afcars-export, craig-financial’s afcars-facts and craig-cases' persons/afcars-export over the half’s resolved window. It then writes the submission (id = the job id), its records, coverage, gaps, retained policy and the reporting key’s lineage anchor, then validates the rows as inserted, writes the element results, steps and observation errors, finalizes the submission and writes its review-only findings, all in one transaction. An export renders under that retained policy, never the live surface (#2145). The submission-to-producer references (child_id, episode_id, arrangement_id, parent_person_id, source_id) are logical, never foreign keys.