Level 7 / Project 07 - Stale Data Detector¶
Home: README
Learn Your Way¶
| Read | Build | Watch | Test | Review | Visualize | Try |
|---|---|---|---|---|---|---|
| — | This project | — | — | Flashcards | — | — |
Focus¶
- freshness checks and stale alerts
Why this project exists¶
This project gives you level-appropriate practice in a realistic operations context. Goal: run the baseline, alter behavior, break one assumption, recover safely, and explain the fix.
Run (copy/paste)¶
Use <repo-root> as the folder containing this repository's README.md.
cd <repo-root>/projects/level-7/07-stale-data-detector
python project.py --input data/sample_input.txt --output data/output_summary.json
pytest -q
Expected terminal output¶
Expected artifacts¶
data/output_summary.json- Passing tests
- Updated
notes.md
Alter it (required)¶
- Add a
"degraded"severity level between warning and stale (e.g. at 75% of stale threshold). - Add a
most_stale()method that returns the single stalest source. - Re-run script and tests — verify the new severity and method appear in output.
Break it (required)¶
- Provide a
last_updatedtimestamp in the future (ahead ofnow) and observe negative age. - Remove the
sourcekey from one of the source records. - Capture the KeyError or nonsensical "fresh" classification for future timestamps.
Fix it (required)¶
- Clamp negative ages to zero (a future timestamp means "just refreshed").
- Validate that each source record has the required
sourceandlast_updatedkeys. - Add tests for future timestamps and missing required keys.
Explain it (teach-back)¶
- Why do different data sources need different freshness thresholds?
- What happened when a timestamp was in the future?
- How did clamping to zero prevent misleading results?
- Where would stale-data detection be used in a real data platform?
Mastery check¶
You can move on when you can: - run baseline without docs, - explain one core function line-by-line, - break and recover in one session, - keep tests passing after your change.
Related Concepts¶
| ← Prev | Home | Next → |
|---|---|---|