{
 "seed": 20261121,
 "headers": [
  "Record ID#",
  "Participant ID",
  "Program",
  "Service Category",
  "Service Date",
  "Hours",
  "Amount",
  "Site",
  "Case Notes",
  "Date Created",
  "Date Modified",
  "Record Owner",
  "Last Modified By"
 ],
 "counts": [
  {
   "stage": "Export file: data lines",
   "rows": 1202,
   "note": "lines after the header row"
  },
  {
   "stage": "Export file: records (CSV parser)",
   "rows": 1201,
   "distinct_ids": 1200,
   "note": "a quoted line break makes 2 lines but 1 record"
  },
  {
   "stage": "Varchar staging",
   "rows": 1199,
   "distinct_ids": 1198,
   "note": "all columns TEXT"
  },
  {
   "stage": "Typed",
   "rows": 1199,
   "distinct_ids": 1198,
   "nulls_from_cast": 4,
   "note": "dates and numbers cast"
  },
  {
   "stage": "Enterprise model (fact table)",
   "rows": 1198,
   "distinct_ids": 1197,
   "note": "joined to dimensions"
  }
 ],
 "findings": [
  {
   "stage": "Export file",
   "record_id": "1187",
   "check": "malformed_row",
   "observed": "14 fields where the header has 13",
   "evidence": {
    "extra_fields": 1
   }
  },
  {
   "stage": "Export file",
   "record_id": "1105",
   "check": "duplicate_key",
   "observed": "Record ID# appears 2 times in one file",
   "evidence": {
    "copies": 2,
    "fields_differ": [
     "Hours",
     "Date Modified"
    ]
   }
  },
  {
   "stage": "Export file",
   "record_id": "1550",
   "check": "blank_key",
   "observed": "Participant ID is blank",
   "evidence": {}
  },
  {
   "stage": "Staging",
   "record_id": "1043",
   "check": "missing_in_staging",
   "observed": "valid record in the file, no row in staging",
   "evidence": {
    "line_break_in": [
     "Case Notes"
    ]
   }
  },
  {
   "stage": "Typed",
   "record_id": "1211",
   "check": "cast_failure",
   "observed": "Service Date \"13/02/2026\" became NULL",
   "evidence": {
    "field": "Service Date",
    "value": "13/02/2026",
    "kind": "date",
    "numeric_after_cleanup": false
   }
  },
  {
   "stage": "Typed",
   "record_id": "1260",
   "check": "cast_failure",
   "observed": "Service Date \"02-30-2026\" became NULL",
   "evidence": {
    "field": "Service Date",
    "value": "02-30-2026",
    "kind": "date",
    "numeric_after_cleanup": false
   }
  },
  {
   "stage": "Typed",
   "record_id": "1333",
   "check": "cast_failure",
   "observed": "Hours \"N/A\" became NULL",
   "evidence": {
    "field": "Hours",
    "value": "N/A",
    "kind": "number",
    "numeric_after_cleanup": false
   }
  },
  {
   "stage": "Typed",
   "record_id": "1302",
   "check": "cast_failure",
   "observed": "Amount \"1,250.00\" became NULL",
   "evidence": {
    "field": "Amount",
    "value": "1,250.00",
    "kind": "number",
    "numeric_after_cleanup": true
   }
  },
  {
   "stage": "Typed",
   "record_id": "1401",
   "check": "unmapped_category",
   "observed": "label \"Youth Mentoring - Pilot\" has no enterprise code",
   "evidence": {
    "label": "Youth Mentoring - Pilot"
   }
  },
  {
   "stage": "Typed",
   "record_id": "1402",
   "check": "unmapped_category",
   "observed": "label \"Youth Mentoring - Pilot\" has no enterprise code",
   "evidence": {
    "label": "Youth Mentoring - Pilot"
   }
  },
  {
   "stage": "Typed",
   "record_id": "1403",
   "check": "unmapped_category",
   "observed": "label \"Youth Mentoring - Pilot\" has no enterprise code",
   "evidence": {
    "label": "Youth Mentoring - Pilot"
   }
  },
  {
   "stage": "Target",
   "record_id": "1450",
   "check": "missing_in_target",
   "observed": "in typed data, not in the target (site \"Eastgate Annex\")",
   "evidence": {
    "site": "Eastgate Annex",
    "site_in_site_table": false
   }
  },
  {
   "stage": "Target",
   "record_id": "1451",
   "check": "missing_in_target",
   "observed": "in typed data, not in the target (site \"Eastgate Annex\")",
   "evidence": {
    "site": "Eastgate Annex",
    "site_in_site_table": false
   }
  },
  {
   "stage": "Target",
   "record_id": "0987",
   "check": "extra_in_target",
   "observed": "in the target, not in this export",
   "evidence": {}
  },
  {
   "stage": "Target",
   "record_id": "1500",
   "check": "orphan_key",
   "observed": "participant \"P-0917\" not in the participant dimension",
   "evidence": {
    "participant": "P-0917"
   }
  }
 ],
 "log": [
  {
   "id": "D-01",
   "stage": "Export file",
   "record_id": "1187",
   "check": "malformed_row",
   "observed": "14 fields where the header has 13",
   "cause": "Export file (likely edited after export)",
   "decision": "Re-export from Quickbase; do not edit the CSV by hand.",
   "owner": "Data engineer",
   "status": "Open",
   "plain_note": "This record has 1 more column than the header, most likely because the file was edited after export and a comma split a note."
  },
  {
   "id": "D-02",
   "stage": "Export file",
   "record_id": "1105",
   "check": "duplicate_key",
   "observed": "Record ID# appears 2 times in one file",
   "cause": "Extract (two versions in one file)",
   "decision": "Keep the copy with the latest Date Modified; export once per run.",
   "owner": "Data engineer",
   "status": "Open",
   "plain_note": "The same record is in the file 2 times and the copies differ in Hours and Date Modified, so totals would count it twice."
  },
  {
   "id": "D-03",
   "stage": "Export file",
   "record_id": "1550",
   "check": "blank_key",
   "observed": "Participant ID is blank",
   "cause": "Data entry",
   "decision": "Program team fills Participant ID; make the field required.",
   "owner": "Program data lead",
   "status": "Open",
   "plain_note": "This record has no Participant ID, so it cannot be linked to a person."
  },
  {
   "id": "D-04",
   "stage": "Staging",
   "record_id": "1043",
   "check": "missing_in_staging",
   "observed": "valid record in the file, no row in staging",
   "cause": "ETL (loader splits lines)",
   "decision": "Load with a CSV parser that honors quoted line breaks.",
   "owner": "Data engineer",
   "status": "Open",
   "plain_note": "The record is fine in the file, but the loader lost it because its Case Notes has a line break."
  },
  {
   "id": "D-05",
   "stage": "Typed",
   "record_id": "1211",
   "check": "cast_failure",
   "observed": "Service Date \"13/02/2026\" became NULL",
   "cause": "Data entry",
   "decision": "Program team corrects the date in Quickbase; consider a Date field type.",
   "owner": "Program data lead",
   "status": "Open",
   "plain_note": "Service Date \"13/02/2026\" is not a real MM-DD-YYYY date, so it would have been lost as a blank."
  },
  {
   "id": "D-06",
   "stage": "Typed",
   "record_id": "1260",
   "check": "cast_failure",
   "observed": "Service Date \"02-30-2026\" became NULL",
   "cause": "Data entry",
   "decision": "Program team corrects the date in Quickbase; consider a Date field type.",
   "owner": "Program data lead",
   "status": "Open",
   "plain_note": "Service Date \"02-30-2026\" is not a real MM-DD-YYYY date, so it would have been lost as a blank."
  },
  {
   "id": "D-07",
   "stage": "Typed",
   "record_id": "1333",
   "check": "cast_failure",
   "observed": "Hours \"N/A\" became NULL",
   "cause": "Data entry",
   "decision": "Program team enters a real Hours value or leaves it blank on purpose.",
   "owner": "Program data lead",
   "status": "Open",
   "plain_note": "Hours says \"N/A\", which is not a number, so it would have been lost as a blank."
  },
  {
   "id": "D-08",
   "stage": "Typed",
   "record_id": "1302",
   "check": "cast_failure",
   "observed": "Amount \"1,250.00\" became NULL",
   "cause": "ETL (cast rule)",
   "decision": "Accept separators in the Amount cast, then re-run.",
   "owner": "Data engineer",
   "status": "Open",
   "plain_note": "Amount holds a real number written with a separator; the pipeline rule needs the fix, not the entry."
  },
  {
   "id": "D-09",
   "stage": "Typed",
   "record_id": "1401",
   "check": "unmapped_category",
   "observed": "label \"Youth Mentoring - Pilot\" has no enterprise code",
   "cause": "Mapping decision",
   "decision": "Decide the enterprise code for the new label, then add it to the map.",
   "owner": "Program data lead",
   "status": "Open",
   "plain_note": "The category \"Youth Mentoring - Pilot\" has no reporting category yet, so somebody must decide where it belongs."
  },
  {
   "id": "D-10",
   "stage": "Typed",
   "record_id": "1402",
   "check": "unmapped_category",
   "observed": "label \"Youth Mentoring - Pilot\" has no enterprise code",
   "cause": "Mapping decision",
   "decision": "Decide the enterprise code for the new label, then add it to the map.",
   "owner": "Program data lead",
   "status": "Open",
   "plain_note": "The category \"Youth Mentoring - Pilot\" has no reporting category yet, so somebody must decide where it belongs."
  },
  {
   "id": "D-11",
   "stage": "Typed",
   "record_id": "1403",
   "check": "unmapped_category",
   "observed": "label \"Youth Mentoring - Pilot\" has no enterprise code",
   "cause": "Mapping decision",
   "decision": "Decide the enterprise code for the new label, then add it to the map.",
   "owner": "Program data lead",
   "status": "Open",
   "plain_note": "The category \"Youth Mentoring - Pilot\" has no reporting category yet, so somebody must decide where it belongs."
  },
  {
   "id": "D-12",
   "stage": "Target",
   "record_id": "1450",
   "check": "missing_in_target",
   "observed": "in typed data, not in the target (site \"Eastgate Annex\")",
   "cause": "ETL (reference data)",
   "decision": "Add the site to the site table before the load; use a left join plus a check.",
   "owner": "Data engineer",
   "status": "Open",
   "plain_note": "The record never reached the reporting system because its site \"Eastgate Annex\" is not in the site table there."
  },
  {
   "id": "D-13",
   "stage": "Target",
   "record_id": "1451",
   "check": "missing_in_target",
   "observed": "in typed data, not in the target (site \"Eastgate Annex\")",
   "cause": "ETL (reference data)",
   "decision": "Add the site to the site table before the load; use a left join plus a check.",
   "owner": "Data engineer",
   "status": "Open",
   "plain_note": "The record never reached the reporting system because its site \"Eastgate Annex\" is not in the site table there."
  },
  {
   "id": "D-14",
   "stage": "Target",
   "record_id": "0987",
   "check": "extra_in_target",
   "observed": "in the target, not in this export",
   "cause": "ETL (likely no delete handling)",
   "decision": "Confirm the record is deleted at the source, then remove it downstream.",
   "owner": "Data engineer",
   "status": "Open",
   "plain_note": "The reporting system holds a record that is not in this export, most likely deleted in Quickbase after an earlier load."
  },
  {
   "id": "D-15",
   "stage": "Target",
   "record_id": "1500",
   "check": "orphan_key",
   "observed": "participant \"P-0917\" not in the participant dimension",
   "cause": "ETL (load order)",
   "decision": "Load the participant table before the fact table.",
   "owner": "Data engineer",
   "status": "Open",
   "plain_note": "The record reached the reporting system, but participant P-0917 is missing from its participant table."
  }
 ],
 "scorecard": [
  {
   "record_id": "1043",
   "check": "missing_in_staging",
   "stage": "Staging",
   "planted": "line break inside Case Notes",
   "caught": true
  },
  {
   "record_id": "1187",
   "check": "malformed_row",
   "stage": "Export file",
   "planted": "unquoted comma after a hand edit",
   "caught": true
  },
  {
   "record_id": "1105",
   "check": "duplicate_key",
   "stage": "Export file",
   "planted": "two exports appended; record appears twice",
   "caught": true
  },
  {
   "record_id": "1211",
   "check": "cast_failure",
   "stage": "Typed",
   "planted": "day and month swapped",
   "caught": true
  },
  {
   "record_id": "1260",
   "check": "cast_failure",
   "stage": "Typed",
   "planted": "date that does not exist",
   "caught": true
  },
  {
   "record_id": "1302",
   "check": "cast_failure",
   "stage": "Typed",
   "planted": "thousands separator",
   "caught": true
  },
  {
   "record_id": "1333",
   "check": "cast_failure",
   "stage": "Typed",
   "planted": "text in a number field",
   "caught": true
  },
  {
   "record_id": "1401",
   "check": "unmapped_category",
   "stage": "Typed",
   "planted": "new category label",
   "caught": true
  },
  {
   "record_id": "1402",
   "check": "unmapped_category",
   "stage": "Typed",
   "planted": "new category label",
   "caught": true
  },
  {
   "record_id": "1403",
   "check": "unmapped_category",
   "stage": "Typed",
   "planted": "new category label",
   "caught": true
  },
  {
   "record_id": "1450",
   "check": "missing_in_target",
   "stage": "Target",
   "planted": "site not in site dimension",
   "caught": true
  },
  {
   "record_id": "1451",
   "check": "missing_in_target",
   "stage": "Target",
   "planted": "site not in site dimension",
   "caught": true
  },
  {
   "record_id": "1500",
   "check": "orphan_key",
   "stage": "Target",
   "planted": "participant not in participant dimension",
   "caught": true
  },
  {
   "record_id": "1550",
   "check": "blank_key",
   "stage": "Export file",
   "planted": "Participant ID left blank",
   "caught": true
  },
  {
   "record_id": "0987",
   "check": "extra_in_target",
   "stage": "Target",
   "planted": "deleted at source, still in target",
   "caught": true
  }
 ],
 "planted": 15,
 "caught": 15,
 "unplanned_findings": [],
 "control": {
  "records": 1200,
  "findings": 0,
  "fact_rows": 1200
 },
 "flagged_records": 15,
 "summary": [
  "1,200 records left the program database, and the reporting system now holds 1,197. 15 records need attention before the numbers can be trusted.",
  "4 need a correction by the program team in the source database: 1550, 1211, 1260, 1333.",
  "3 need a decision on which reporting category a new label belongs to: 1401, 1402, 1403.",
  "8 need a fix in the pipeline, not in the data: 1187, 1105, 1043, 1302, 1450, 1451, 0987, 1500. None of these need program staff to change anything."
 ],
 "sql": {
  "staging_vs_file": "-- records the file holds (parsed with a real CSV reader) vs rows in staging\nSELECT f.record_id FROM file_records f\nLEFT JOIN stg_service s ON s.\"Record ID#\" = f.record_id\nWHERE s.\"Record ID#\" IS NULL AND f.field_count = 13;",
  "duplicate_key": "SELECT \"Record ID#\", COUNT(*) FROM file_records_dup GROUP BY 1 HAVING COUNT(*) > 1;",
  "cast_failure": "-- a value was present in staging but the typed column is NULL: a silent null\nSELECT t.record_id, 'Service Date' AS field, s.\"Service Date\" AS staged_value\nFROM typed_service t JOIN stg_service s ON CAST(s.\"Record ID#\" AS INTEGER) = t.record_id\nWHERE t.service_date IS NULL AND TRIM(s.\"Service Date\") <> ''\n-- (same pattern for Hours and Amount)",
  "unmapped_category": "SELECT t.record_id, t.category_label FROM typed_service t\nLEFT JOIN map_category m ON m.category_label = t.category_label\nWHERE m.category_label IS NULL;",
  "missing_in_target": "SELECT t.record_id, t.site FROM typed_service t\nLEFT JOIN fact_service f ON f.record_id = t.record_id\nWHERE f.record_id IS NULL;",
  "extra_in_target": "SELECT f.record_id FROM fact_service f\nLEFT JOIN typed_service t ON t.record_id = f.record_id\nWHERE t.record_id IS NULL;",
  "orphan_key": "SELECT f.record_id, f.participant_id FROM fact_service f\nLEFT JOIN dim_participant p ON p.participant_id = f.participant_id\nWHERE f.participant_id IS NOT NULL AND p.participant_id IS NULL;"
 },
 "category_map": {
  "Case Management": "SVC-CM",
  "Housing Navigation": "SVC-HN",
  "Job Readiness": "SVC-JR",
  "Food Assistance": "SVC-FA",
  "Youth Mentoring": "SVC-YM",
  "Benefits Enrollment": "SVC-BE"
 }
}