Skip to content

Refactor and clean up codebase: remove unused scripts, enhance behavi… - #2

Merged
Samarthuday merged 2 commits into
mainfrom
refactor/quantitative-risk-modeling-v2
Aug 28, 2026
Merged

Refactor and clean up codebase: remove unused scripts, enhance behavi…#2
Samarthuday merged 2 commits into
mainfrom
refactor/quantitative-risk-modeling-v2

Conversation

@Samarthuday

Copy link
Copy Markdown
Owner

…oral features, and update model training pipeline

  • Deleted serve_dashboard.py, check_status.py, simple_ingestion.py, start_system.py, and test_ingestion.py as they are no longer needed.
  • Updated behavioral_features.py to include Payment_currency and Received_currency in partitioning for more accurate feature calculations.
  • Modified baseline.py to include StandardScaler in the logistic regression pipeline for better model performance.
  • Adjusted train.py to reflect changes in feature names and removed deprecated features.
  • Added tests in test_leakage.py to ensure no leakage occurs and that behavioral features are correctly calculated based on currency.

…oral features, and update model training pipeline

- Deleted `serve_dashboard.py`, `check_status.py`, `simple_ingestion.py`, `start_system.py`, and `test_ingestion.py` as they are no longer needed.
- Updated `behavioral_features.py` to include `Payment_currency` and `Received_currency` in partitioning for more accurate feature calculations.
- Modified `baseline.py` to include `StandardScaler` in the logistic regression pipeline for better model performance.
- Adjusted `train.py` to reflect changes in feature names and removed deprecated features.
- Added tests in `test_leakage.py` to ensure no leakage occurs and that behavioral features are correctly calculated based on currency.
Copilot AI lite review requested due to automatic review settings August 28, 2026 18:22

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

There are confirmed inconsistencies/bugs (currency-aware refactor is incomplete for pair_transaction_count, and README Python version conflicts with pyproject.toml/CI) that should be resolved before approval.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

This PR refactors the repository from a legacy “real-time monitoring demo” into a research-oriented modeling pipeline, focusing on leakage-safe feature engineering, improved baseline modeling, and reproducibility/CI hygiene.

Changes:

  • Removed legacy dashboard/API/ingestion launcher scripts and old notebooks; updated README to the new research/pipeline framing.
  • Updated behavioral feature generation to be more currency-aware and adjusted model feature contracts accordingly.
  • Improved the logistic baseline (scaling) and strengthened metadata/reproducibility (package versions, training windows, probability quantiles), plus added CI and leakage-related tests.
File summaries
File Description
tests/test_leakage.py Adds tests for leakage-free behavioral features, currency awareness, and chronological split boundaries.
start_system.py Deletes top-level legacy launcher script.
src/utils/test_ingestion.py Deletes legacy ingestion test utility.
src/utils/start_system.py Deletes legacy “start API + dashboard” orchestration script.
src/utils/simple_ingestion.py Deletes demo transaction stream simulator.
src/utils/check_status.py Deletes legacy status checker.
src/models/train.py Updates model feature lists and retains chronological split helper.
src/models/baseline.py Wraps SGD logistic baseline in a pipeline with StandardScaler.
src/features/behavioral_features.py Updates rolling windows to partition by currency and refactors lifetime/network-related features + HHI logic.
src/dashboard/serve_dashboard.py Deletes dashboard HTTP server.
src/dashboard/real_time_dashboard.html Deletes legacy dashboard UI.
src/api/simple_api_server.py Deletes legacy simple API server.
scripts/train_model.py Improves artifact metadata (quantiles, time windows, prevalence, params, package versions).
README.md Rewrites documentation for the research/pipeline focus and new API entrypoints.
pyproject.toml Adds packaging/test/lint configuration and declares Python version requirement.
notebooks/03_backtesting.ipynb Deletes legacy notebook.
notebooks/02_model_research.ipynb Deletes legacy notebook.
notebooks/01_eda.ipynb Deletes legacy notebook.
docs/assets/.gitkeep Adds placeholder for documentation assets directory.
.github/workflows/ci.yml Adds CI workflow to run tests on Python 3.11/3.12.
Review details

Suppressed comments (1)

src/features/behavioral_features.py:109

  • pair_transaction_count is still partitioned only by (Sender_account, Receiver_account) while other rolling behavioral windows were updated to be currency-aware. This can mix interactions across currencies (e.g., USD and EUR transfers between the same pair) and makes the feature contract inconsistent with the currency-aware intent of this refactor.
            COUNT(*) OVER (
                PARTITION BY Sender_account, Receiver_account
                ORDER BY timestamp
                RANGE BETWEEN UNBOUNDED PRECEDING
                AND INTERVAL '1 microsecond' PRECEDING
            ) AS pair_transaction_count
  • Files reviewed: 19/20 changed files
  • Comments generated: 1
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread README.md Outdated
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@Samarthuday
Samarthuday merged commit fb19d5d into main Aug 28, 2026
2 checks passed
Copilot stopped work on behalf of Samarthuday due to an error August 28, 2026 18:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants