# sebastianmunozcodes/smart-utilities-analytics architecture

> Architecture diagram of the GitHub repository sebastianmunozcodes/smart-utilities-analytics, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-05). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/sebastianmunozcodes/smart-utilities-analytics
- Repository: https://github.com/sebastianmunozcodes/smart-utilities-analytics

## Overview

Smart Utilities Analytics turns monthly EIA electricity data into a cleaned dataset, statistical summaries, charts, SQLite-backed SQL analysis, and a Markdown report. The graph preserves the documented workflow and major analysis capabilities. Source excerpts show the cleaning, Pandas, database, and report behaviors; workflow ordering and SQL validation are also documented in the README, but no runtime orchestrator is shown.

Main entry points: [`data/cleaned/eia_sales_revenue_monthly_states_cleaned.csv`](https://github.com/sebastianmunozcodes/smart-utilities-analytics/blob/main/data/cleaned/eia_sales_revenue_monthly_states_cleaned.csv) (Cleaned CSV), [`charts`](https://github.com/sebastianmunozcodes/smart-utilities-analytics/tree/main/charts) (Analysis charts), [`src/clean_data.py`](https://github.com/sebastianmunozcodes/smart-utilities-analytics/blob/main/src/clean_data.py) (Data cleaning), [`src/analyze_pandas.py`](https://github.com/sebastianmunozcodes/smart-utilities-analytics/blob/main/src/analyze_pandas.py) (State sales)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_data["Data preparation"]
  node_raw["Raw EIA CSV"]
  node_cleaner["Data cleaning<br/>[clean_data.py]"]
  node_cleaned["Cleaned CSV"]
end

subgraph group_pandas["Pandas analytics"]
  node_state_sales["State sales<br/>[analyze_pandas.py]"]
  node_state_price["State prices<br/>[analyze_pandas.py]"]
  node_state_revenue["State revenue<br/>[analyze_pandas.py]"]
  node_monthly_trend["Monthly trends<br/>[analyze_pandas.py]"]
  node_record_ranking["Record rankings<br/>[analyze_pandas.py]"]
  node_charts["Analysis charts"]
end

subgraph group_database["Database analytics"]
  node_schema["Table setup<br/>[setup_database.py]"]
  node_loader["CSV loader<br/>[load_data.py]"]
  node_store[("SQLite table")]
  node_sql_analysis["SQL summaries<br/>[analyze_sql.py]"]
  node_validation["SQL validation<br/>[analyze_sql.py]"]
end

subgraph group_reporting["Reporting"]
  node_report["Markdown report<br/>[generate_report.py]"]
end

node_analyst(("Analyst"))

node_analyst -.->|"runs workflow"| node_cleaner
node_raw -->|"reads"| node_cleaner
node_cleaner -->|"writes"| node_cleaned
node_cleaned -->|"reads"| node_state_sales
node_cleaned -->|"reads"| node_state_price
node_cleaned -->|"reads"| node_state_revenue
node_cleaned -->|"reads"| node_monthly_trend
node_cleaned -->|"reads"| node_record_ranking
node_state_sales -->|"generates"| node_charts
node_state_price -->|"generates"| node_charts
node_state_revenue -->|"generates"| node_charts
node_monthly_trend -->|"generates"| node_charts
node_record_ranking -->|"generates"| node_charts
node_schema -->|"creates table"| node_store
node_cleaned -->|"reads"| node_loader
node_loader -->|"inserts rows"| node_store
node_store -->|"queried by"| node_sql_analysis
node_sql_analysis -.->|"reproduces summaries"| node_validation
node_cleaned -->|"reads"| node_report
node_validation -.->|"summarized in"| node_report

click node_raw "https://github.com/sebastianmunozcodes/smart-utilities-analytics/blob/main/data/raw/eia_sales_revenue_monthly_states.csv"
click node_cleaner "https://github.com/sebastianmunozcodes/smart-utilities-analytics/blob/main/src/clean_data.py"
click node_cleaned "https://github.com/sebastianmunozcodes/smart-utilities-analytics/blob/main/data/cleaned/eia_sales_revenue_monthly_states_cleaned.csv"
click node_state_sales "https://github.com/sebastianmunozcodes/smart-utilities-analytics/blob/main/src/analyze_pandas.py"
click node_state_price "https://github.com/sebastianmunozcodes/smart-utilities-analytics/blob/main/src/analyze_pandas.py"
click node_state_revenue "https://github.com/sebastianmunozcodes/smart-utilities-analytics/blob/main/src/analyze_pandas.py"
click node_monthly_trend "https://github.com/sebastianmunozcodes/smart-utilities-analytics/blob/main/src/analyze_pandas.py"
click node_record_ranking "https://github.com/sebastianmunozcodes/smart-utilities-analytics/blob/main/src/analyze_pandas.py"
click node_charts "https://github.com/sebastianmunozcodes/smart-utilities-analytics/tree/main/charts"
click node_schema "https://github.com/sebastianmunozcodes/smart-utilities-analytics/blob/main/src/setup_database.py"
click node_loader "https://github.com/sebastianmunozcodes/smart-utilities-analytics/blob/main/src/load_data.py"
click node_sql_analysis "https://github.com/sebastianmunozcodes/smart-utilities-analytics/blob/main/src/analyze_sql.py"
click node_validation "https://github.com/sebastianmunozcodes/smart-utilities-analytics/blob/main/src/analyze_sql.py"
click node_report "https://github.com/sebastianmunozcodes/smart-utilities-analytics/blob/main/src/generate_report.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_raw,node_cleaner,node_cleaned toneBlue
class node_state_sales,node_state_price,node_state_revenue,node_monthly_trend,node_record_ranking,node_charts toneAmber
class node_schema,node_loader,node_store,node_sql_analysis,node_validation toneMint
class node_report toneRose
class node_analyst toneIndigo
```

## Components

### Data preparation

- [Raw EIA CSV](https://github.com/sebastianmunozcodes/smart-utilities-analytics/blob/main/data/raw/eia_sales_revenue_monthly_states.csv): `data/raw/eia_sales_revenue_monthly_states.csv`
- [Data cleaning](https://github.com/sebastianmunozcodes/smart-utilities-analytics/blob/main/src/clean_data.py): `src/clean_data.py`
- [Cleaned CSV](https://github.com/sebastianmunozcodes/smart-utilities-analytics/blob/main/data/cleaned/eia_sales_revenue_monthly_states_cleaned.csv): `data/cleaned/eia_sales_revenue_monthly_states_cleaned.csv`

### Pandas analytics

- [State sales](https://github.com/sebastianmunozcodes/smart-utilities-analytics/blob/main/src/analyze_pandas.py): `src/analyze_pandas.py`
- [State prices](https://github.com/sebastianmunozcodes/smart-utilities-analytics/blob/main/src/analyze_pandas.py): `src/analyze_pandas.py`
- [State revenue](https://github.com/sebastianmunozcodes/smart-utilities-analytics/blob/main/src/analyze_pandas.py): `src/analyze_pandas.py`
- [Monthly trends](https://github.com/sebastianmunozcodes/smart-utilities-analytics/blob/main/src/analyze_pandas.py): `src/analyze_pandas.py`
- [Record rankings](https://github.com/sebastianmunozcodes/smart-utilities-analytics/blob/main/src/analyze_pandas.py): `src/analyze_pandas.py`
- [Analysis charts](https://github.com/sebastianmunozcodes/smart-utilities-analytics/tree/main/charts): `charts`

### Database analytics

- [Table setup](https://github.com/sebastianmunozcodes/smart-utilities-analytics/blob/main/src/setup_database.py): `src/setup_database.py`
- [CSV loader](https://github.com/sebastianmunozcodes/smart-utilities-analytics/blob/main/src/load_data.py): `src/load_data.py`
- **SQLite table**
- [SQL summaries](https://github.com/sebastianmunozcodes/smart-utilities-analytics/blob/main/src/analyze_sql.py): `src/analyze_sql.py`
- [SQL validation](https://github.com/sebastianmunozcodes/smart-utilities-analytics/blob/main/src/analyze_sql.py): `src/analyze_sql.py`

### Reporting

- [Markdown report](https://github.com/sebastianmunozcodes/smart-utilities-analytics/blob/main/src/generate_report.py): `src/generate_report.py`

### Other components

- **Analyst**

## Connections

- Analyst → Data cleaning: runs workflow (evidence: `README.md`)
- Raw EIA CSV → Data cleaning: reads (evidence: `src/clean_data.py`)
- Data cleaning → Cleaned CSV: writes (evidence: `src/clean_data.py`)
- Cleaned CSV → State sales: reads (evidence: `src/analyze_pandas.py`)
- Cleaned CSV → State prices: reads (evidence: `src/analyze_pandas.py`)
- Cleaned CSV → State revenue: reads (evidence: `src/analyze_pandas.py`)
- Cleaned CSV → Monthly trends: reads (evidence: `src/analyze_pandas.py`)
- Cleaned CSV → Record rankings: reads (evidence: `src/analyze_pandas.py`)
- State sales → Analysis charts: generates (evidence: `src/analyze_pandas.py`)
- State prices → Analysis charts: generates (evidence: `src/analyze_pandas.py`)
- State revenue → Analysis charts: generates (evidence: `src/analyze_pandas.py`)
- Monthly trends → Analysis charts: generates (evidence: `src/analyze_pandas.py`)
- Record rankings → Analysis charts: generates (evidence: `src/analyze_pandas.py`)
- Table setup → SQLite table: creates table (evidence: `src/setup_database.py`)
- Cleaned CSV → CSV loader: reads (evidence: `src/load_data.py`)
- CSV loader → SQLite table: inserts rows (evidence: `src/load_data.py`)
- SQLite table → SQL summaries: queried by (evidence: `src/analyze_sql.py`)
- SQL summaries → SQL validation: reproduces summaries (evidence: `README.md`)
- Cleaned CSV → Markdown report: reads (evidence: `src/generate_report.py`)
- SQL validation → Markdown report: summarized in (evidence: `README.md`)
