# shdyt13/optimizing-bbri-stock-forecasts architecture

> Architecture diagram of the GitHub repository shdyt13/optimizing-bbri-stock-forecasts, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/shdyt13/optimizing-bbri-stock-forecasts
- Repository: https://github.com/shdyt13/optimizing-bbri-stock-forecasts

## Overview

BBRI Stock Forecast is a research decision-support application for comparing SVR and Random Forest stock-price forecasts. The main workflow is CSV upload, preprocessing and feature ranking, six feature-subset experiments with model tuning, prediction and evaluation, then dashboard review or Excel export. The repository also documents a separate offline analysis/reporting mode and step-by-step tuning views. Relationships reflect the sampled calls, imports, and README workflow; unsampled endpoint and offline internals are not expanded.

Main entry points: [`frontend/src/context/DataContext.jsx`](https://github.com/shdyt13/optimizing-bbri-stock-forecasts/blob/main/frontend/src/context/DataContext.jsx) (Data and API Client), [`backend/main.py`](https://github.com/shdyt13/optimizing-bbri-stock-forecasts/blob/main/backend/main.py) (Forecast API), [`frontend/src/pages/Dashboard.jsx`](https://github.com/shdyt13/optimizing-bbri-stock-forecasts/blob/main/frontend/src/pages/Dashboard.jsx) (Dataset Dashboard), [`backend/trainoff.py`](https://github.com/shdyt13/optimizing-bbri-stock-forecasts/blob/main/backend/trainoff.py) (Offline Analysis Runner)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["Web Interface"]
  node_app["Application Shell<br/>[App.jsx]"]
  node_dashboard["Dataset Dashboard<br/>[Dashboard.jsx]"]
  node_state["Data and API Client<br/>[DataContext.jsx]"]
  node_feature_page["Feature Selection View"]
  node_evaluation_page["Model Evaluation View"]
  node_tuning_view["Tuning Step View"]
  node_experiments_view["Feature Experiments View"]
end

subgraph group_api["API and Orchestration"]
  node_api["Forecast API<br/>[main.py]"]
end

subgraph group_ml["Forecast Experiments"]
  node_preprocess["Data Preprocessing<br/>[ml_pipeline.py]"]
  node_selection["Feature Ranking and Subsets<br/>[ml_pipeline.py]"]
  node_tuning["SVR and RF Grid Search<br/>[ml_pipeline.py]"]
  node_prediction["Scenario Predictions<br/>[ml_pipeline.py]"]
  node_offline["Offline Analysis Runner<br/>[trainoff.py]"]
end

subgraph group_reporting["Results and Reporting"]
  node_cache["Latest Prediction Cache<br/>[main.py]"]
  node_excel["Excel Export<br/>[main.py]"]
  node_offline_report["Offline Report"]
  node_artifacts["Trained Model Artifacts"]
end

node_researcher(("Researcher"))

node_researcher -->|"uploads CSVs"| node_dashboard
node_researcher -->|"starts prediction"| node_dashboard
node_app -.->|"shows workflow"| node_dashboard
node_dashboard -->|"uses data"| node_state
node_state -->|"sends CSV and requests"| node_api
node_api -->|"runs pipeline"| node_preprocess
node_preprocess -.->|"prepares features"| node_selection
node_selection -->|"evaluates subsets"| node_tuning
node_tuning -->|"predicts scenarios"| node_prediction
node_api -->|"stores results"| node_cache
node_api -->|"exports results"| node_excel
node_cache -->|"supplies cached data"| node_excel
node_state -->|"provides results"| node_feature_page
node_state -->|"provides metrics"| node_evaluation_page
node_researcher -->|"reviews tuning"| node_tuning_view
node_researcher -->|"compares subsets"| node_experiments_view
node_offline -.->|"writes models"| node_artifacts
node_offline -.->|"supports reporting"| node_offline_report

click node_app "https://github.com/shdyt13/optimizing-bbri-stock-forecasts/blob/main/frontend/src/App.jsx"
click node_dashboard "https://github.com/shdyt13/optimizing-bbri-stock-forecasts/blob/main/frontend/src/pages/Dashboard.jsx"
click node_state "https://github.com/shdyt13/optimizing-bbri-stock-forecasts/blob/main/frontend/src/context/DataContext.jsx"
click node_feature_page "https://github.com/shdyt13/optimizing-bbri-stock-forecasts/blob/main/frontend/src/pages/FeatureSelection.jsx"
click node_evaluation_page "https://github.com/shdyt13/optimizing-bbri-stock-forecasts/blob/main/frontend/src/pages/ModelEvaluation.jsx"
click node_tuning_view "https://github.com/shdyt13/optimizing-bbri-stock-forecasts/blob/main/frontend/src/components/HyperparameterTuningTab.jsx"
click node_experiments_view "https://github.com/shdyt13/optimizing-bbri-stock-forecasts/blob/main/frontend/src/components/FeatureExperimentsTab.jsx"
click node_api "https://github.com/shdyt13/optimizing-bbri-stock-forecasts/blob/main/backend/main.py"
click node_preprocess "https://github.com/shdyt13/optimizing-bbri-stock-forecasts/blob/main/backend/ml_pipeline.py"
click node_selection "https://github.com/shdyt13/optimizing-bbri-stock-forecasts/blob/main/backend/ml_pipeline.py"
click node_tuning "https://github.com/shdyt13/optimizing-bbri-stock-forecasts/blob/main/backend/ml_pipeline.py"
click node_prediction "https://github.com/shdyt13/optimizing-bbri-stock-forecasts/blob/main/backend/ml_pipeline.py"
click node_offline "https://github.com/shdyt13/optimizing-bbri-stock-forecasts/blob/main/backend/trainoff.py"
click node_cache "https://github.com/shdyt13/optimizing-bbri-stock-forecasts/blob/main/backend/main.py"
click node_excel "https://github.com/shdyt13/optimizing-bbri-stock-forecasts/blob/main/backend/main.py"
click node_offline_report "https://github.com/shdyt13/optimizing-bbri-stock-forecasts/blob/main/backend/report_offline.html"
click node_artifacts "https://github.com/shdyt13/optimizing-bbri-stock-forecasts/tree/main/backend/models"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_app,node_dashboard,node_state,node_feature_page,node_evaluation_page,node_tuning_view,node_experiments_view toneBlue
class node_api toneAmber
class node_preprocess,node_selection,node_tuning,node_prediction,node_offline toneMint
class node_cache,node_excel,node_offline_report,node_artifacts toneRose
class node_researcher toneIndigo
```

## Components

### Web Interface

- [Application Shell](https://github.com/shdyt13/optimizing-bbri-stock-forecasts/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Dataset Dashboard](https://github.com/shdyt13/optimizing-bbri-stock-forecasts/blob/main/frontend/src/pages/Dashboard.jsx): `frontend/src/pages/Dashboard.jsx`
- [Data and API Client](https://github.com/shdyt13/optimizing-bbri-stock-forecasts/blob/main/frontend/src/context/DataContext.jsx): `frontend/src/context/DataContext.jsx`
- [Feature Selection View](https://github.com/shdyt13/optimizing-bbri-stock-forecasts/blob/main/frontend/src/pages/FeatureSelection.jsx): `frontend/src/pages/FeatureSelection.jsx`
- [Model Evaluation View](https://github.com/shdyt13/optimizing-bbri-stock-forecasts/blob/main/frontend/src/pages/ModelEvaluation.jsx): `frontend/src/pages/ModelEvaluation.jsx`
- [Tuning Step View](https://github.com/shdyt13/optimizing-bbri-stock-forecasts/blob/main/frontend/src/components/HyperparameterTuningTab.jsx): `frontend/src/components/HyperparameterTuningTab.jsx`
- [Feature Experiments View](https://github.com/shdyt13/optimizing-bbri-stock-forecasts/blob/main/frontend/src/components/FeatureExperimentsTab.jsx): `frontend/src/components/FeatureExperimentsTab.jsx`

### API and Orchestration

- [Forecast API](https://github.com/shdyt13/optimizing-bbri-stock-forecasts/blob/main/backend/main.py): `backend/main.py`

### Forecast Experiments

- [Data Preprocessing](https://github.com/shdyt13/optimizing-bbri-stock-forecasts/blob/main/backend/ml_pipeline.py): `backend/ml_pipeline.py`
- [Feature Ranking and Subsets](https://github.com/shdyt13/optimizing-bbri-stock-forecasts/blob/main/backend/ml_pipeline.py): `backend/ml_pipeline.py`
- [SVR and RF Grid Search](https://github.com/shdyt13/optimizing-bbri-stock-forecasts/blob/main/backend/ml_pipeline.py): `backend/ml_pipeline.py`
- [Scenario Predictions](https://github.com/shdyt13/optimizing-bbri-stock-forecasts/blob/main/backend/ml_pipeline.py): `backend/ml_pipeline.py`
- [Offline Analysis Runner](https://github.com/shdyt13/optimizing-bbri-stock-forecasts/blob/main/backend/trainoff.py): `backend/trainoff.py`

### Results and Reporting

- [Latest Prediction Cache](https://github.com/shdyt13/optimizing-bbri-stock-forecasts/blob/main/backend/main.py): `backend/main.py`
- [Excel Export](https://github.com/shdyt13/optimizing-bbri-stock-forecasts/blob/main/backend/main.py): `backend/main.py`
- [Offline Report](https://github.com/shdyt13/optimizing-bbri-stock-forecasts/blob/main/backend/report_offline.html): `backend/report_offline.html`
- [Trained Model Artifacts](https://github.com/shdyt13/optimizing-bbri-stock-forecasts/tree/main/backend/models): `backend/models`

### Other components

- **Researcher**

## Connections

- Researcher → Dataset Dashboard: uploads CSVs (evidence: `README.md`)
- Researcher → Dataset Dashboard: starts prediction (evidence: `README.md`)
- Application Shell → Dataset Dashboard: shows workflow
- Dataset Dashboard → Data and API Client: uses data (evidence: `frontend/src/pages/Dashboard.jsx`)
- Data and API Client → Forecast API: sends CSV and requests (evidence: `frontend/src/context/DataContext.jsx`)
- Forecast API → Data Preprocessing: runs pipeline (evidence: `backend/main.py`)
- Data Preprocessing → Feature Ranking and Subsets: prepares features (evidence: `backend/ml_pipeline.py`)
- Feature Ranking and Subsets → SVR and RF Grid Search: evaluates subsets (evidence: `backend/ml_pipeline.py`)
- SVR and RF Grid Search → Scenario Predictions: predicts scenarios (evidence: `backend/ml_pipeline.py`)
- Forecast API → Latest Prediction Cache: stores results (evidence: `backend/main.py`)
- Forecast API → Excel Export: exports results (evidence: `backend/main.py`)
- Latest Prediction Cache → Excel Export: supplies cached data (evidence: `backend/main.py`)
- Data and API Client → Feature Selection View: provides results (evidence: `frontend/src/pages/FeatureSelection.jsx`)
- Data and API Client → Model Evaluation View: provides metrics (evidence: `frontend/src/pages/ModelEvaluation.jsx`)
- Researcher → Tuning Step View: reviews tuning (evidence: `README.md`)
- Researcher → Feature Experiments View: compares subsets (evidence: `README.md`)
- Offline Analysis Runner → Trained Model Artifacts: writes models
- Offline Analysis Runner → Offline Report: supports reporting
