# eaglepython/policy-analysis-dashboard architecture

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

- Interactive diagram: https://gitdiagram.com/eaglepython/policy-analysis-dashboard
- Repository: https://github.com/eaglepython/policy-analysis-dashboard

## Overview

##### Project Type and Purpose
- From the file tree and README, this is a front-end–focused “Policy Analysis Dashboard” built with React (src/App.js, src/components/…), styled with Tailwind/CSS, and delivered as a static web app (public/index.html).
- Its purpose is to let users explore AI governance metrics (HHI antitrust alerts), healthcare cost savings, and policy-trade-off modeling via interactive charts. It also supports CSV upload and offers downloadable Python analysis scripts.

##### File Structure
- Top level: package.json (dependencies), postcss.config.js, tailwind.config.js → front-end build config.
- public/ → static HTML and assets.
- src/ → React source code:
- App.js & index.js → application entrypoint and router/render logic.
- src/components/… → three dashboard views (AIVendorMarketShare, HealthcareCostAnalysis, PolicyImpactModeling) + About.
- No backend folder—data processing is client-side, with optional CSV upload.

##### README for Additional Insights
- Features summary confirms three main analysis modules + CSV upload + Python script downloads.
- No mention of a hosted API or database—computation and data storage are in the client’s browser.

##### Main Components
a. Browser/Client (React App)
b. Presentation Layer (UI Components & Chart Library)
c. Data Ingestion (CSV Upload Handler)
d. Analytics Engine (JS functions for HHI, time-series savings, trade-off calculations)
e. Static Asset Hosting/CDN (e.g., Netlify, GitHub Pages)
f. Optional Python Scripts (download endpoint—static file server)
g. External Services (if any: analytics APIs or CDN endpoints)

##### Relationships and Data Flow
- User → Browser → React App
- React App loads static assets from CDN/Hosting
- User uploads CSV → CSV Handler → Analytics Engine → Component UI updates
- React App fetches Python script files from the same static host for download
- All data processing happens client-side, no persistent database or server-side API

##### Architectural Patterns and Principles
- Single-Page Application (SPA)
- Component-based UI (React)
- Separation of concerns:
- Components for each analysis module
- Utility functions for data processing
- Static asset pipeline (PostCSS/Tailwind)
- Client-centric processing to avoid backend complexity

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% User Interaction
    User["User"]:::external
    User -->|"Interacts with"| Browser

    %% React SPA Subgraph
    subgraph "React SPA (Browser/Client)" 
        direction TB
        entryIndex["src/index.js"]:::frontend
        appJS["src/App.js"]:::frontend
        pubIndex["public/index.html"]:::frontend
    end

    Browser["Browser"]:::external
    Browser -->|"Loads SPA via HTTP GET"| pubIndex
    pubIndex -->|"Initializes React App"| entryIndex
    entryIndex -->|"Renders App Component"| appJS

    %% Presentation Layer
    subgraph "Presentation Layer (UI Components & Charts)"
        direction TB
        aiVendor["AIVendorMarketShare.jsx"]:::frontend
        healthcare["HealthcareCostAnalysis.jsx"]:::frontend
        policyModel["PolicyImpactModeling.jsx"]:::frontend
        aboutComp["About.jsx"]:::frontend
    end

    appJS -->|"Routes to Views"| aiVendor
    appJS -->|"Routes to Views"| healthcare
    appJS -->|"Routes to Views"| policyModel
    appJS -->|"Routes to About"| aboutComp

    %% Data Ingestion and Analytics
    subgraph "Data & Analytics"
        direction TB
        csvHandler["CSV Upload Handler"]:::data
        analysisUtils["Analysis Utilities"]:::data
    end

    aiVendor -->|"Needs Data"| csvHandler
    healthcare -->|"Needs Data"| csvHandler
    policyModel -->|"Needs Data"| csvHandler
    csvHandler -->|"Parses CSV → JSON"| analysisUtils
    analysisUtils -->|"Returns Metrics"| aiVendor
    analysisUtils -->|"Returns Metrics"| healthcare
    analysisUtils -->|"Returns Metrics"| policyModel

    %% Styling & Build Configuration
    subgraph "Styling & Build Configuration"
        direction TB
        tailwind["tailwind.config.js"]:::infra
        postcss["postcss.config.js"]:::infra
        cssIndex["src/index.css"]:::infra
    end

    entryIndex -->|"Imports Styles"| cssIndex
    cssIndex -->|"Build Pipeline uses"| postcss
    postcss -->|"Processes with"| tailwind

    %% Static Asset Hosting
    subgraph "Static Hosting/CDN"
        direction TB
        publicDir["public/"]:::infra
        pythonScripts["Python Scripts (static files)"]:::infra
    end

    pubIndex -->|"Served from"| publicDir
    publicDir -->|"Hosts SPA & assets"| Browser
    publicDir -->|"Hosts scripts"| pythonScripts
    policyModel -->|"Download Link"| pythonScripts

    %% Package Management
    subgraph "Package & Dependency Management"
        direction TB
        pkgJson["package.json"]:::infra
        pkgLock["package-lock.json"]:::infra
    end

    entryIndex -->|"Requires Dependencies from"| pkgJson
    pkgJson -->|"Lockfile"| pkgLock

    %% Click Events
    click entryIndex "https://github.com/eaglepython/policy-analysis-dashboard/blob/main/src/index.js"
    click appJS "https://github.com/eaglepython/policy-analysis-dashboard/blob/main/src/App.js"
    click pubIndex "https://github.com/eaglepython/policy-analysis-dashboard/blob/main/public/index.html"
    click aiVendor "https://github.com/eaglepython/policy-analysis-dashboard/blob/main/src/components/AIVendorMarketShare.jsx"
    click healthcare "https://github.com/eaglepython/policy-analysis-dashboard/blob/main/src/components/HealthcareCostAnalysis.jsx"
    click policyModel "https://github.com/eaglepython/policy-analysis-dashboard/blob/main/src/components/PolicyImpactModeling.jsx"
    click aboutComp "https://github.com/eaglepython/policy-analysis-dashboard/blob/main/src/components/About.jsx"
    click tailwind "https://github.com/eaglepython/policy-analysis-dashboard/blob/main/tailwind.config.js"
    click postcss "https://github.com/eaglepython/policy-analysis-dashboard/blob/main/postcss.config.js"
    click cssIndex "https://github.com/eaglepython/policy-analysis-dashboard/blob/main/src/index.css"
    click publicDir "https://github.com/eaglepython/policy-analysis-dashboard/tree/main/public/"
    click pkgJson "https://github.com/eaglepython/policy-analysis-dashboard/blob/main/package.json"
    click pkgLock "https://github.com/eaglepython/policy-analysis-dashboard/blob/main/package-lock.json"

    %% Styles
    classDef frontend fill:#D0E8FF,stroke:#0284C7,stroke-width:1px
    classDef data fill:#D1FAE5,stroke:#047857,stroke-width:1px
    classDef infra fill:#E5E7EB,stroke:#6B7280,stroke-width:1px
    classDef external fill:#F3F4F6,stroke:#374151,stroke-width:1px,stroke-dasharray: 5 5
```
