How harshads7/relulu works
Project Type and Purpose
• This is a full-stack forecasting application:
– Frontend: Next.js/React UI for visualizing alerts, backtests, risk metrics, and analyst dashboards.
– Backend: Python service exposing REST endpoints, running the forecast engine, backtesting, alerting, and training GNN models.
Top-Level Components
• Frontend (Next.js)
– Pages: alerts, backtest, analyst, risk
– Shared UI components: charts, timelines, metric cards, ticker bars
– Theme context, global CSS, fonts
• Backend API
– app.py: main web server (e.g., FastAPI/Flask)
– routes.py & schemas.py: HTTP endpoints & data contracts
– ticker.py: real-time data feeder
• Core Services
– forecast_engine.py: runs prediction workflows
– backtest.py / optimize.py / alerts.py: business logic modules
– analyst.py: domain-specific analyses
• Data Layer
– loader.py & constants.py: read raw data from files or external sources
• Machine-Learning Models
– super_node_gnn.py & temporal_gnn.py: GNN architectures
– training scripts: train_temporal.py, train_legacy.py
– artifacts: super_node_v1.pth
• Utility Scripts
– dashboard, netting_report, simulation, stress_test, run_forecast_test
Interactions and Data Flow
1. User → Frontend UI
– Clicks buttons in Next.js pages
2. Frontend → Backend API
– HTTP calls to /alerts, /backtest, /forecast, etc.
3. API → Core Services
– Parses request schemas → invokes forecast_engine, backtest, or alerts
4. Core → Data Layer & Models
– loader.py fetches input data
– forecast_engine loads ML model (.pth) and runs inference
5. Core → Response
– Structures results via schemas → returns JSON to frontend
6. Optional: Scripts & Training
– Offline: training scripts read data, train GNNs, write model files
– Reporting scripts generate CSV/XLS dashboards
Architectural Patterns
• Layered (Controller → Service → Data / Model)
• Separation of concerns:
– Frontend (presentation)
– API (transport)
– Core (business logic)
– Models (ML inference/training)
• Extensibility points:
– Add new routes in backend/api
– Plug in new GNN architectures under backend/models
– Extend UI by adding pages/components in frontend/src/app