Open
Conversation
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.
Motivation
Description
src/nlbt/spike_detection.pyintroducingSpikeEventand functionscompute_hour_of_week_baseline,compute_spike_scores,compute_spike_thresholds,compute_term_spike_scores,compute_political_intensity, andpersist_spike_eventswhich creates aspike_eventsSQLite table and writes event rows.max_dayswindow and enforces a minimum day span, with a small fix to thewindow_spancalculation.robust_zandewmamethods, term scoring supportslog_odds(with prior) andratiomodes withmin_support, and political intensity aggregates category/Wikidata/revert/distinct-page signals.tests/test_spike_detection.pywith synthetic tests for baseline medians, robust z spike detection, term scoring support, political-intensity signals, and DB persistence.Testing
pytest -q, but the run was interrupted during collection withModuleNotFoundError: No module named 'nlbt'from legacyscriptstests, causing the suite to fail to complete.tests/test_spike_detection.pywas added and is designed to be run in isolation withpytest tests/test_spike_detection.pyto validate the spike utilities.src/nlbt/spike_detection.pyandtests/test_spike_detection.pyfor follow-up CI runs that isolate the new tests.Codex Task