# vova-snapcik/template-assignment-1 architecture

> Architecture diagram of the GitHub repository vova-snapcik/template-assignment-1, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-14). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/vova-snapcik/template-assignment-1
- Repository: https://github.com/vova-snapcik/template-assignment-1

## Overview

This is a Python starter application for analyzing demand-side flexibility in active distribution grids. The principal workflow is: a user selects a case, the loader turns shared appliance and grid data plus case parameters into input data, the model builds and solves an optimization problem, and the entry point saves results and figures. Optional sensitivity runs derive modified inputs, solve each case, and compare results. The model formulation is explicitly unfinished; documented extensions for assignment questions are not separate implemented pipelines. The graph reflects shown calls and README workflow; unsampled data files are grouped by their documented roles.

Main entry points: [`main.py`](https://github.com/vova-snapcik/template-assignment-1/blob/main/main.py) (Command entry), [`src/plotting.py`](https://github.com/vova-snapcik/template-assignment-1/blob/main/src/plotting.py) (Figure generation), [`src/model.py`](https://github.com/vova-snapcik/template-assignment-1/blob/main/src/model.py) (Consumer model), [`src/data_loader.py`](https://github.com/vova-snapcik/template-assignment-1/blob/main/src/data_loader.py) (Input loader)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_workflow["Run workflow"]
  node_entry["Command entry<br/>[main.py]"]
end

subgraph group_domain["Case and optimization"]
  node_case_data["Case data"]
  node_loader["Input loader<br/>[data_loader.py]"]
  node_model["Consumer model<br/>[model.py]"]
  node_solver["Gurobi solver"]
end

subgraph group_analysis["Analysis outputs"]
  node_scenarios["Scenario transforms<br/>[scenarios.py]"]
  node_plotting["Figure generation<br/>[plotting.py]"]
  node_results["Saved results"]
end

node_user(("Analyst"))

node_user -->|"runs case"| node_entry
node_loader -->|"reads JSON"| node_case_data
node_entry -->|"loads case"| node_loader
node_entry -->|"plots inputs"| node_plotting
node_entry -->|"builds and solves"| node_model
node_model -->|"optimizes"| node_solver
node_model -->|"uses input data"| node_loader
node_entry -->|"derives scenarios"| node_scenarios
node_entry -->|"compares scenarios"| node_plotting
node_plotting -->|"reads results"| node_model
node_plotting -->|"reads inputs"| node_loader
node_entry -->|"saves outputs"| node_results
node_entry -->|"saves figures"| node_plotting
node_entry -->|"saves scenario runs"| node_results

click node_entry "https://github.com/vova-snapcik/template-assignment-1/blob/main/main.py"
click node_case_data "https://github.com/vova-snapcik/template-assignment-1/tree/main/data"
click node_loader "https://github.com/vova-snapcik/template-assignment-1/blob/main/src/data_loader.py"
click node_model "https://github.com/vova-snapcik/template-assignment-1/blob/main/src/model.py"
click node_scenarios "https://github.com/vova-snapcik/template-assignment-1/blob/main/src/scenarios.py"
click node_plotting "https://github.com/vova-snapcik/template-assignment-1/blob/main/src/plotting.py"
click node_results "https://github.com/vova-snapcik/template-assignment-1/tree/main/results"

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_entry toneBlue
class node_case_data,node_loader,node_model,node_solver toneAmber
class node_scenarios,node_plotting,node_results toneMint
class node_user toneIndigo
```

## Components

### Run workflow

- [Command entry](https://github.com/vova-snapcik/template-assignment-1/blob/main/main.py): `main.py`

### Case and optimization

- [Case data](https://github.com/vova-snapcik/template-assignment-1/tree/main/data): `data`
- [Input loader](https://github.com/vova-snapcik/template-assignment-1/blob/main/src/data_loader.py): `src/data_loader.py`
- [Consumer model](https://github.com/vova-snapcik/template-assignment-1/blob/main/src/model.py): `src/model.py`
- **Gurobi solver**

### Analysis outputs

- [Scenario transforms](https://github.com/vova-snapcik/template-assignment-1/blob/main/src/scenarios.py): `src/scenarios.py`
- [Figure generation](https://github.com/vova-snapcik/template-assignment-1/blob/main/src/plotting.py): `src/plotting.py`
- [Saved results](https://github.com/vova-snapcik/template-assignment-1/tree/main/results): `results`

### Other components

- **Analyst**

## Connections

- Analyst → Command entry: runs case (evidence: `README.md`)
- Input loader → Case data: reads JSON (evidence: `src/data_loader.py`)
- Command entry → Input loader: loads case (evidence: `main.py`)
- Command entry → Figure generation: plots inputs (evidence: `main.py`)
- Command entry → Consumer model: builds and solves (evidence: `main.py`)
- Consumer model → Gurobi solver: optimizes (evidence: `src/model.py`)
- Consumer model → Input loader: uses input data (evidence: `src/model.py`)
- Command entry → Scenario transforms: derives scenarios (evidence: `main.py`)
- Command entry → Figure generation: compares scenarios (evidence: `main.py`)
- Figure generation → Consumer model: reads results (evidence: `src/plotting.py`)
- Figure generation → Input loader: reads inputs (evidence: `src/plotting.py`)
- Command entry → Saved results: saves outputs (evidence: `main.py`)
- Command entry → Figure generation: saves figures (evidence: `main.py`)
- Command entry → Saved results: saves scenario runs (evidence: `main.py`)
