# shashankvemuri/economic-dashboard architecture

> Architecture diagram of the GitHub repository shashankvemuri/economic-dashboard, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-22). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/shashankvemuri/economic-dashboard
- Repository: https://github.com/shashankvemuri/economic-dashboard

## Overview

##### Project type and purpose
- This is a monolithic full-stack single-page dashboard application built with Python and Plotly Dash.
- Purpose: display macroeconomic and stock market data (sentiment indicators, unemployment, inflation, treasury rates) via interactive graphs and tables.

##### File structure
- app.py: main Dash server script that initializes the app, sets up layout, and registers page callbacks.
- pages/: modular sub-pages (economy.py, indices.py, sentiment.py) each define a section’s layout and callbacks.
- assets/: CSS/SCSS styling (boot-swatch theme, custom variables). Dash will auto-serve these under /assets.
- data_functions.py: business-logic layer for data retrieval, processing, and transformation.
- render.yaml: deployment configuration for Render.com (defines service type, build/runtime commands, environment).
- requirements.txt: Python dependencies.
- README.md: project overview, install/run instructions, deployment URL.

##### README for additional insights
- Confirms purely Python/Dash stack with no external database—data likely fetched on demand via APIs or CSVs inside data_functions.py.
- Deployment on Render.com, serving at port 8050 by default.

##### Main components and interactions
a. Components
- User’s web browser (front end)
- Dash server (app.py entry point)
- Page modules (economy.py, indices.py, sentiment.py)
- Business logic module (data_functions.py)
- Assets server (CSS/SCSS files under assets/)
- External data sources (e.g., FRED API, Yahoo Finance, local CSVs)
- Deployment environment (Render.com container)
b. Relationships & data flow
1. User interacts with browser UI → sends HTTP requests over WebSocket/REST to Dash server.
2. Dash server routes requests to appropriate page module callback.
3. Page callback invokes data_functions to fetch/process data.
4. data_functions retrieves raw data from external APIs or local files.
5. Processed data returned to callback → rendered as graphs/tables in browser.
6. Browser downloads CSS/JS from assets folder served by the Dash server.
7. Deployment layer (Render.com) wraps entire Dash server in a container, exposing port 8050 behind a load balancer/HTTPS.

##### Architectural patterns & design principles
- Modular page-based routing (Dash multipage architecture).
- Separation of concerns: UI layout and callbacks in pages/, data access in data_functions.py, styling in assets/.
- Single-process monolith; no microservices.
- Stateless server: each request invokes fresh data fetch; no persistent session state.

##### Relevant technologies, frameworks, libraries
- Python 3.x, Plotly Dash, pandas (probable), requests (for API calls), SCSS bootstrap theme.
- Render.com for PaaS deployment (render.yaml).
- Git for version control.

## Diagram (Mermaid)

```mermaid
flowchart TB
    Browser["User Web Browser"]:::frontend
    subgraph "Deployment Environment"
        Render["Render.com Container\n(economic-dashboard.onrender.com:8050)"]:::deployment
    end
    Render -->|hosts| DashServer
    DashServer["app.py\n(Dash Server)"]:::backend
    subgraph "UI Modules (pages/)"
        Econ["economy.py"]:::backend
        Ind["indices.py"]:::backend
        Sent["sentiment.py"]:::backend
    end
    DataLogic["data_functions.py"]:::backend
    subgraph "Static Assets (/assets)"
        BS["_bootswatch.scss"]:::assets
        VAR["_variables.scss"]:::assets
        CSS["bootstrap.css"]:::assets
    end
    subgraph "Configurations"
        ENV["render.yaml"]:::deployment
        REQ["requirements.txt"]:::deployment
        MD["README.md"]:::deployment
    end
    ExternalAPIs["External Data Sources\n(FRED API, Yahoo Finance, CSV)"]:::external

    Browser -->|"HTTP/WebSocket"| DashServer
    Browser -->|"fetch CSS/JS"| BS
    Browser -->|"fetch CSS/JS"| VAR
    Browser -->|"fetch CSS/JS"| CSS

    DashServer -->|"routes requests to"| Econ
    DashServer -->|"routes requests to"| Ind
    DashServer -->|"routes requests to"| Sent

    Econ -->|"invoke callbacks"| DataLogic
    Ind -->|"invoke callbacks"| DataLogic
    Sent -->|"invoke callbacks"| DataLogic

    DataLogic -->|"fetch/process data"| ExternalAPIs
    ExternalAPIs -->|"return raw data"| DataLogic

    DataLogic -->|"processed data"| Econ
    DataLogic -->|"processed data"| Ind
    DataLogic -->|"processed data"| Sent

    Econ -->|"render graphs/tables"| Browser
    Ind -->|"render graphs/tables"| Browser
    Sent -->|"render graphs/tables"| Browser

    classDef frontend fill:#add8e6,stroke:#000,stroke-width:1px
    classDef backend fill:#98fb98,stroke:#000,stroke-width:1px
    classDef external fill:#ffa500,stroke:#000,stroke-width:1px
    classDef assets fill:#dda0dd,stroke:#000,stroke-width:1px
    classDef deployment fill:#ffdead,stroke:#000,stroke-width:1px

    click DashServer "https://github.com/shashankvemuri/economic-dashboard/blob/main/app.py"
    click Econ "https://github.com/shashankvemuri/economic-dashboard/blob/main/pages/economy.py"
    click Ind "https://github.com/shashankvemuri/economic-dashboard/blob/main/pages/indices.py"
    click Sent "https://github.com/shashankvemuri/economic-dashboard/blob/main/pages/sentiment.py"
    click DataLogic "https://github.com/shashankvemuri/economic-dashboard/blob/main/data_functions.py"
    click BS "https://github.com/shashankvemuri/economic-dashboard/blob/main/assets/_bootswatch.scss"
    click VAR "https://github.com/shashankvemuri/economic-dashboard/blob/main/assets/_variables.scss"
    click CSS "https://github.com/shashankvemuri/economic-dashboard/blob/main/assets/bootstrap.css"
    click ENV "https://github.com/shashankvemuri/economic-dashboard/blob/main/render.yaml"
    click REQ "https://github.com/shashankvemuri/economic-dashboard/blob/main/requirements.txt"
    click MD "https://github.com/shashankvemuri/economic-dashboard/blob/main/README.md"
```
