chore: add data-ingestion freshness checker - #522
Open
essentialbit wants to merge 9 commits into
Open
Conversation
signals/news_items/signal_outcomes are all 5-8 days stale on the live DB while trends/rag_chunks are current -- confirms main.py's own APScheduler process isn't currently running (scheduled jobs never fire from one-off script invocations, which is how the sensor/interactive sessions actually touch this DB). scripts/check_data_freshness.py gives future cycles a one-shot read of which ingestion tables are stale vs their real job cadence, instead of re-deriving this by hand via ad hoc SQL each time.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
scripts/check_data_freshness.py: read-only diagnostic reporting staleness ofsignals/news_items/signal_outcomes/trends/rag_chunksagainst the actual APScheduler job cadences defined inmain.py, plus an informational-only section for legitimately-sparse tables (filings/divergence_events/counterfactual_runs/calibration_scores).signals(199h stale),news_items(116h), andsignal_outcomes(118h) all far past their scheduled cadence, whiletrends/rag_chunksare current — consistent withmain.py's own Flask/APScheduler process not currently running continuously on this Mac (only touched via one-off script invocations from the sensor/interactive sessions). The script documents this diagnosis so future cycles don't have to re-derive it via ad hoc SQL.feature_backlogitem this cycle scored ≥0.55) — same class ascheck_sensor_health.py/feat: scripts/check_sensor_health.py -- detect silent hourly-sensor outages #496,eligible_backlog.py/feat: eligible-backlog cross-reference script (closes #271) #272, etc. Does not attempt to startmain.pyitself; that's a systemic operational decision flagged for the user, not sensor-actionable.Test plan
python3 -c "import ast; ast.parse(...)"on the new scriptPYTHONPATH=. venv/bin/python3 scripts/check_data_freshness.pyrun against the live DB, output verified correct (3 stale, 2 ok, 4 informational)PYTHONPATH=. venv/bin/python3 -c "from main import app"still imports cleanly (225 routes, no collision)🤖 Generated with Claude Code