How mukta01/evnet_sentinel works
Purpose and Entry Points
EVNet Sentinel is an EV charging-network intrusion-detection research and serving system. It reproduces CICEVSE2024-based static classifiers and adaptive online detection, then exposes results to a Next.js dashboard. Main service entry points are src/api/main.py and backend/app/main.py; the browser application begins at frontend/app/page.tsx and includes frontend/app/dashboard/page.tsx.
Data Acquisition and Preparation
The restricted CICEVSE2024 dataset is retrieved locally through environment-provided access, kept out of version control, and split between raw and processed stores. Central preparation logic loads and transforms source traffic into model-ready features, providing a leakage-control boundary before training or inference.
• data/raw/
• data/processed/
• src/data_prep/load_data.py
• src/data_prep/preprocess.py
Offline Model Training
Model implementations are separated by algorithm but share the processed-data contract and serialized-artifact destination. Static multiclass detection includes SVM, random forest, logistic regression, and decision-tree paths; their training products are intended for later API/model-registry consumption.
• src/models/svm/train_svm.py
• src/models/random_forest/train_rf.py
• src/models/log_reg/train_logreg.py
• saved_models/
Adaptive Streaming Detection
The ARF + ADWIN subsystem is the online-learning branch, designed to process simulated traffic streams and detect concept drift rather than only score a fixed test set. Drift-related output is persisted separately, establishing a boundary between adaptive-state events and standard model predictions.
• src/models/arfadwin/train_arfadwin.py
• src/models/arfadwin/evaluate_arfadwin.py
• predictions/arf_adwin_drift_events.json
• saved_models/arf_adwin.pkl
Evaluation and Output Contracts
A unified evaluation layer produces comparable metrics for models, while prediction files and serialized models are shared integration artifacts. Existing reports and plots are offline evidence, not runtime dependencies. The system’s central exchange contract is: processed feature data → trained model → prediction/drift output → API/dashboard.
• src/evaluation/evaluate_model.py
• predictions/
• evaluation_results/
• saved_models/rf_model_multiclass.pkl
Backend Serving Boundary
FastAPI provides the service boundary between Python ML artifacts and clients. The repository contains both a project-level API implementation and a backend/app service package with configuration, implying deployment should select and consolidate the authoritative entry point rather than treat both as independent ML pipelines. Docker is the declared deployment runtime; environment files hold deployment and dataset secrets.
• src/api/main.py
• backend/app/main.py
• backend/app/config.py
• Dockerfile
Dashboard and Client Integration
The frontend is a Next.js/React application with landing, documentation, and dashboard routes. It is the consumer of REST/WebSocket detection results and renders cybersecurity-focused visualizations; it does not own model execution. Dashboard-specific UX is isolated from reusable presentation components.
• frontend/app/dashboard/page.tsx
• frontend/app/page.tsx
• frontend/app/layout.tsx
• frontend/components/ThreatAccordion.tsx
Infrastructure and External Dependencies
Material runtimes are Python/FastAPI for ML serving and TypeScript/Next.js for the client, containerized via Docker. External dependencies include the access-restricted CICEVSE2024 dataset hosted through a team-provided Google Drive URL, and the browser-to-backend REST/WebSocket channel. Project documentation defines the intended architecture and setup boundary.
• Dockerfile
• requirements.txt
• frontend/package.json
• docs/ARCHITECTURE.md
Main entry points: main.py Project API · train_arfadwin.py ARF + ADWIN training · page.tsx Detection dashboard · load_data.py Data loader
Components 20
Data Pipeline
- Restricted raw traffic · Locally retrieved CICEVSE2024 source data.
- Processed features · Leakage-controlled model input contract.
- Data loader
src/data_prep/load_data.py - Preprocessing
src/data_prep/preprocess.py
ML Training & Evaluation
- Static classifiers · SVM, random forest, and logistic-regression training paths.
src/models/svm/train_svm.py - Random forest trainer
src/models/random_forest/train_rf.py - Logistic regression trainer
src/models/log_reg/train_logreg.py - ARF + ADWIN training · Processes simulated streams with adaptive state.
src/models/arfadwin/train_arfadwin.py - ARF + ADWIN evaluation
src/models/arfadwin/evaluate_arfadwin.py - Model registry artifacts · Shared destination for static and adaptive models.
- ARF + ADWIN model
saved_models/arf_adwin.pkl - Unified evaluation · Produces comparable model metrics.
src/evaluation/evaluate_model.py - Prediction outputs · Shared prediction and drift-result contract.
- Drift events
predictions/arf_adwin_drift_events.json
Serving
- Project API · Candidate authoritative Python ML service.
src/api/main.py - Backend service package · Alternative deployment entry point requiring consolidation.
backend/app/main.py - Docker runtime · Declared container deployment boundary.
Dockerfile
Dashboard
- Detection dashboard · Consumes REST/WebSocket detection results.
frontend/app/dashboard/page.tsx - Landing route
frontend/app/page.tsx - Threat UI component
frontend/components/ThreatAccordion.tsx
Connections 23
- Restricted raw traffic → Data loader: loads
- Data loader → Preprocessing: source traffic
- Preprocessing → Processed features: writes features
- Processed features → Static classifiers: training features
- Processed features → Random forest trainer: training features
- Processed features → Logistic regression trainer: training features
- Processed features → ARF + ADWIN training: simulated stream
- Static classifiers → Model registry artifacts: serializes models
- Random forest trainer → Model registry artifacts: serializes model
- Logistic regression trainer → Model registry artifacts: serializes model
- ARF + ADWIN training → ARF + ADWIN model: serializes adaptive state
- ARF + ADWIN training → ARF + ADWIN evaluation: stream results
- ARF + ADWIN evaluation → Drift events: writes drift events
- Drift events → Prediction outputs: stored in
- Model registry artifacts → Unified evaluation: evaluates
- Unified evaluation → Prediction outputs: writes predictions
- Model registry artifacts → Project API: loads models
- Processed features → Project API: inference features
- Project API → Detection dashboard: REST/WebSocket results
- Backend service package → Project API: alternative service entry point
- Landing route → Detection dashboard: navigates to
- Threat UI component → Detection dashboard: renders within
- Docker runtime → Project API: deploys