# bhupesh-debug/ml-project-portfoliofuture-substai architecture

> Architecture diagram of the GitHub repository bhupesh-debug/ml-project-portfoliofuture-substai, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-15). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/bhupesh-debug/ml-project-portfoliofuture-substai
- Repository: https://github.com/bhupesh-debug/ml-project-portfoliofuture-substai
- Video tour (about a minute): https://gitdiagram.com/bhupesh-debug/ml-project-portfoliofuture-substai/video

## Overview

PortfolioFuture-SubstAI combines an interactive fund and market intelligence product with market-data services and a fund-substitution analytics framework. The main market workflow is user-initiated quote or history requests, validated and served through the API and market-data service, then cached or delegated to a provider; indicator requests calculate analytics from retrieved history. The dashboard, allocation calculator, and institutional distribution views are documented capabilities. Source evidence is sampled for the API and market-data modules; dashboard and several analytics links rely on README documentation or are omitted where implementation wiring is not shown.

Main entry points: [`src/market_data/service.py`](https://github.com/bhupesh-debug/ml-project-portfoliofuture-substai/blob/main/src/market_data/service.py) (Market data service), [`src/data_pipeline.py`](https://github.com/bhupesh-debug/ml-project-portfoliofuture-substai/blob/main/src/data_pipeline.py) (Fund and holdings loaders), [`src/api.py`](https://github.com/bhupesh-debug/ml-project-portfoliofuture-substai/blob/main/src/api.py) (REST API), [`src/feature_engineering.py`](https://github.com/bhupesh-debug/ml-project-portfoliofuture-substai/blob/main/src/feature_engineering.py) (Substitution features)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_presentation["User Applications"]
  node_dashboard["Dashboard and quant hub<br/>[app.py]"]
  node_webhub["Standalone web hub<br/>[index.html]"]
  node_api["REST API<br/>[api.py]"]
end

subgraph group_market["Market Data Services"]
  node_market_service["Market data service<br/>[service.py]"]
  node_schemas["Request and response schemas<br/>[schemas.py]"]
  node_cache[("SQLite market cache<br/>[cache.py]")]
  node_provider_interface["Provider interface<br/>[provider_base.py]"]
  node_yfinance["Yahoo Finance adapter"]
  node_mock_provider["Mock market provider<br/>[mock_provider.py]"]
  node_analytics["Technical indicators"]
end

subgraph group_funds["Fund Intelligence"]
  node_pipeline["Fund and holdings loaders<br/>[data_pipeline.py]"]
  node_features["Substitution features"]
  node_model["Substitution classifier<br/>[model.py]"]
  node_evaluation["Model and fee evaluation<br/>[evaluate.py]"]
  node_dataset_builder["Real dataset builder"]
end

subgraph group_datasets["Data Assets"]
  node_fund_profiles["Fund profiles"]
  node_ownership_data["13F and RIA holdings"]
end

node_user(("Investor or analyst"))

node_user -->|"uses"| node_dashboard
node_user -->|"uses"| node_webhub
node_user -->|"requests data"| node_api
node_api -->|"fetches quotes or history"| node_market_service
node_api -->|"validates and returns"| node_schemas
node_api -->|"calculates indicators"| node_analytics
node_api -->|"loads symbol universe"| node_pipeline
node_market_service -->|"validates symbols"| node_schemas
node_market_service -->|"reads and writes"| node_cache
node_market_service -->|"delegates fetches"| node_provider_interface
node_market_service -->|"selects provider"| node_yfinance
node_market_service -->|"selects provider"| node_mock_provider
node_yfinance -->|"implements"| node_provider_interface
node_mock_provider -->|"implements"| node_provider_interface
node_pipeline -->|"loads profiles"| node_fund_profiles
node_pipeline -->|"loads holdings"| node_ownership_data
node_features -->|"loads profiles"| node_pipeline
node_model -->|"uses fund data"| node_pipeline
node_model -->|"uses features"| node_features
node_evaluation -->|"loads funds and holdings"| node_pipeline
node_evaluation -->|"extracts test features"| node_features
node_dataset_builder -.->|"builds profiles"| node_fund_profiles
node_dataset_builder -.->|"builds holdings"| node_ownership_data

click node_dashboard "https://github.com/bhupesh-debug/ml-project-portfoliofuture-substai/blob/main/app.py"
click node_webhub "https://github.com/bhupesh-debug/ml-project-portfoliofuture-substai/blob/main/index.html"
click node_api "https://github.com/bhupesh-debug/ml-project-portfoliofuture-substai/blob/main/src/api.py"
click node_market_service "https://github.com/bhupesh-debug/ml-project-portfoliofuture-substai/blob/main/src/market_data/service.py"
click node_schemas "https://github.com/bhupesh-debug/ml-project-portfoliofuture-substai/blob/main/src/market_data/schemas.py"
click node_cache "https://github.com/bhupesh-debug/ml-project-portfoliofuture-substai/blob/main/src/market_data/cache.py"
click node_provider_interface "https://github.com/bhupesh-debug/ml-project-portfoliofuture-substai/blob/main/src/market_data/provider_base.py"
click node_yfinance "https://github.com/bhupesh-debug/ml-project-portfoliofuture-substai/blob/main/src/market_data/yfinance_provider.py"
click node_mock_provider "https://github.com/bhupesh-debug/ml-project-portfoliofuture-substai/blob/main/src/market_data/mock_provider.py"
click node_analytics "https://github.com/bhupesh-debug/ml-project-portfoliofuture-substai/blob/main/src/market_analytics.py"
click node_fund_profiles "https://github.com/bhupesh-debug/ml-project-portfoliofuture-substai/blob/main/data/processed/fund_universe_profiles_real.csv"
click node_ownership_data "https://github.com/bhupesh-debug/ml-project-portfoliofuture-substai/blob/main/data/processed/sec_13f_ria_ownership_real.csv"
click node_pipeline "https://github.com/bhupesh-debug/ml-project-portfoliofuture-substai/blob/main/src/data_pipeline.py"
click node_features "https://github.com/bhupesh-debug/ml-project-portfoliofuture-substai/blob/main/src/feature_engineering.py"
click node_model "https://github.com/bhupesh-debug/ml-project-portfoliofuture-substai/blob/main/src/model.py"
click node_evaluation "https://github.com/bhupesh-debug/ml-project-portfoliofuture-substai/blob/main/src/evaluate.py"
click node_dataset_builder "https://github.com/bhupesh-debug/ml-project-portfoliofuture-substai/blob/main/src/build_real_datasets.py"

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_dashboard,node_webhub,node_api toneBlue
class node_market_service,node_schemas,node_cache,node_provider_interface,node_yfinance,node_mock_provider,node_analytics toneAmber
class node_pipeline,node_features,node_model,node_evaluation,node_dataset_builder toneMint
class node_fund_profiles,node_ownership_data toneRose
class node_user toneIndigo
```

## Components

### User Applications

- [Dashboard and quant hub](https://github.com/bhupesh-debug/ml-project-portfoliofuture-substai/blob/main/app.py): `app.py`
- [Standalone web hub](https://github.com/bhupesh-debug/ml-project-portfoliofuture-substai/blob/main/index.html): `index.html`
- [REST API](https://github.com/bhupesh-debug/ml-project-portfoliofuture-substai/blob/main/src/api.py): `src/api.py`

### Market Data Services

- [Market data service](https://github.com/bhupesh-debug/ml-project-portfoliofuture-substai/blob/main/src/market_data/service.py): `src/market_data/service.py`
- [Request and response schemas](https://github.com/bhupesh-debug/ml-project-portfoliofuture-substai/blob/main/src/market_data/schemas.py): `src/market_data/schemas.py`
- [SQLite market cache](https://github.com/bhupesh-debug/ml-project-portfoliofuture-substai/blob/main/src/market_data/cache.py): `src/market_data/cache.py`
- [Provider interface](https://github.com/bhupesh-debug/ml-project-portfoliofuture-substai/blob/main/src/market_data/provider_base.py): `src/market_data/provider_base.py`
- [Yahoo Finance adapter](https://github.com/bhupesh-debug/ml-project-portfoliofuture-substai/blob/main/src/market_data/yfinance_provider.py): `src/market_data/yfinance_provider.py`
- [Mock market provider](https://github.com/bhupesh-debug/ml-project-portfoliofuture-substai/blob/main/src/market_data/mock_provider.py): `src/market_data/mock_provider.py`
- [Technical indicators](https://github.com/bhupesh-debug/ml-project-portfoliofuture-substai/blob/main/src/market_analytics.py): `src/market_analytics.py`

### Fund Intelligence

- [Fund and holdings loaders](https://github.com/bhupesh-debug/ml-project-portfoliofuture-substai/blob/main/src/data_pipeline.py): `src/data_pipeline.py`
- [Substitution features](https://github.com/bhupesh-debug/ml-project-portfoliofuture-substai/blob/main/src/feature_engineering.py): `src/feature_engineering.py`
- [Substitution classifier](https://github.com/bhupesh-debug/ml-project-portfoliofuture-substai/blob/main/src/model.py): `src/model.py`
- [Model and fee evaluation](https://github.com/bhupesh-debug/ml-project-portfoliofuture-substai/blob/main/src/evaluate.py): `src/evaluate.py`
- [Real dataset builder](https://github.com/bhupesh-debug/ml-project-portfoliofuture-substai/blob/main/src/build_real_datasets.py): `src/build_real_datasets.py`

### Data Assets

- [Fund profiles](https://github.com/bhupesh-debug/ml-project-portfoliofuture-substai/blob/main/data/processed/fund_universe_profiles_real.csv): `data/processed/fund_universe_profiles_real.csv`
- [13F and RIA holdings](https://github.com/bhupesh-debug/ml-project-portfoliofuture-substai/blob/main/data/processed/sec_13f_ria_ownership_real.csv): `data/processed/sec_13f_ria_ownership_real.csv`

### Other components

- **Investor or analyst**

## Connections

- Investor or analyst → Dashboard and quant hub: uses (evidence: `README.md`)
- Investor or analyst → Standalone web hub: uses (evidence: `README.md`)
- Investor or analyst → REST API: requests data (evidence: `README.md`)
- REST API → Market data service: fetches quotes or history (evidence: `src/api.py`)
- REST API → Request and response schemas: validates and returns (evidence: `src/api.py`)
- REST API → Technical indicators: calculates indicators (evidence: `src/api.py`)
- REST API → Fund and holdings loaders: loads symbol universe (evidence: `src/api.py`)
- Market data service → Request and response schemas: validates symbols (evidence: `src/market_data/service.py`)
- Market data service → SQLite market cache: reads and writes (evidence: `src/market_data/service.py`)
- Market data service → Provider interface: delegates fetches (evidence: `src/market_data/service.py`)
- Market data service → Yahoo Finance adapter: selects provider (evidence: `src/market_data/service.py`)
- Market data service → Mock market provider: selects provider (evidence: `src/market_data/service.py`)
- Yahoo Finance adapter → Provider interface: implements (evidence: `src/market_data/yfinance_provider.py`)
- Mock market provider → Provider interface: implements (evidence: `src/market_data/mock_provider.py`)
- Fund and holdings loaders → Fund profiles: loads profiles (evidence: `src/data_pipeline.py`)
- Fund and holdings loaders → 13F and RIA holdings: loads holdings (evidence: `src/data_pipeline.py`)
- Substitution features → Fund and holdings loaders: loads profiles (evidence: `src/feature_engineering.py`)
- Substitution classifier → Fund and holdings loaders: uses fund data (evidence: `src/model.py`)
- Substitution classifier → Substitution features: uses features (evidence: `src/model.py`)
- Model and fee evaluation → Fund and holdings loaders: loads funds and holdings (evidence: `src/evaluate.py`)
- Model and fee evaluation → Substitution features: extracts test features (evidence: `src/evaluate.py`)
- Real dataset builder → Fund profiles: builds profiles
- Real dataset builder → 13F and RIA holdings: builds holdings
