How It Was Built

A walk through the pipeline behind the attendance dashboard, in the order the data moves. The full source is in the public repository linked from the portfolio home page.

1. Source extract

A student information system typically delivers attendance as flat files: a school roster, a student roster with enrollment and withdrawal dates, the district calendar, and one row per student per school day. For this portfolio the extract is generated by projects/education_attendance/generate.py from a fixed random seed, with realistic seasonality (flu season, end of year), day-of-week effects, Title I differences, mid-year transfers, and a deliberate set of data-quality defects.

2. Raw layer: load everything as text

pipeline/load_raw.py bulk-loads each CSV into a raw_education_attendance schema with every column as text and a load timestamp. The raw layer is a faithful copy of what arrived. If a value can't be typed, that fact is discovered in staging where it is visible and tested, not lost at load time.

No Results

3. Staging: type, standardize, label

dbt staging models cast every column, fix casing and whitespace (elm01 → ELM01), and evaluate the validation rules in a fixed order of precedence so each row gets exactly one dq_status. Student names never leave staging; downstream tables carry only IDs.

4. Marts: one grain per table

No Results

Every mart declares its grain and tests it. The monthly rollup originally included the academic term as a column; the uniqueness test on (school, month) failed immediately because terms straddle month boundaries, which is exactly the kind of double-counting bug a test should catch before a dashboard does.

5. Tests

36 tests run on every build: unique and not_null on every key, relationships between facts and dimensions, accepted_values on every code column, a custom between_0_and_1 check on every rate, a custom unique_combination check on multi-column grains, and a singular test that fails the run if rejected rows exceed 2% of the extract.

6. Reporting

These pages are written in Markdown with embedded SQL and compiled by Evidence into a static site. Page queries run against the marts, so the dashboard cannot drift from the tested model. The site rebuilds automatically whenever the pipeline runs.

7. Orchestration

A GitHub Actions workflow runs the whole chain on a schedule and on every change: generate → load → dbt build (models and tests together, in dependency order) → Evidence build → publish. A failed test stops the run before anything is published.

The full source code, and the commands to run the whole pipeline yourself, are in the public repository on GitHub.