# pcarballo07/clim_app architecture

> Architecture diagram of the GitHub repository pcarballo07/clim_app, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/pcarballo07/clim_app
- Repository: https://github.com/pcarballo07/clim_app

## Overview

clim_app is a console application for recording and consulting weather observations in Madrid, backed by JSON history. Its main workflow starts at the menu, then registers a dated station measurement (validating inputs and handling duplicates) or searches history by zone. The README also documents historical data prepared from AEMET; the repository has an AEMET fetch-and-transform script and a separate alert evaluator, but the sampled application entry point does not connect either to the menu workflow. The data-file relationship is explicit in the source; other unsampled data contents are not inferred.

Main entry points: [`main.py`](https://github.com/pcarballo07/clim_app/blob/main/main.py) (App menu), [`store.py`](https://github.com/pcarballo07/clim_app/blob/main/store.py) (JSON persistence), [`utils/descargar_aemet.py`](https://github.com/pcarballo07/clim_app/blob/main/utils/descargar_aemet.py) (AEMET extraction and normalization), [`validations.py`](https://github.com/pcarballo07/clim_app/blob/main/validations.py) (Input validation)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Console app"]
  node_menu["App menu<br/>[main.py]"]
  node_registration["Measurement registration<br/>[main.py]"]
  node_zone_search["Zone history search<br/>[main.py]"]
end

subgraph group_domain["Weather domain"]
  node_validation["Input validation<br/>[validations.py]"]
  node_alert_rules["Alert evaluation<br/>[alerts.py]"]
end

subgraph group_data["JSON data"]
  node_json_store["JSON persistence<br/>[store.py]"]
  node_history_file["Observation history<br/>[mock_real.json]"]
end

subgraph group_ingestion["Historical ingestion"]
  node_aemet_import["AEMET extraction and normalization<br/>[descargar_aemet.py]"]
  node_historical_file["Historical climate dataset<br/>[clima_mock.json]"]
end

node_operator(("Operator"))
node_aemet{{"AEMET OpenData"}}

node_operator -->|"selects action"| node_menu
node_menu -->|"routes to"| node_registration
node_menu -->|"routes to"| node_zone_search
node_registration -->|"loads and saves"| node_json_store
node_registration -->|"validates with"| node_validation
node_zone_search -->|"selects zone with"| node_validation
node_zone_search -->|"loads history"| node_json_store
node_json_store -->|"reads and writes"| node_history_file
node_aemet_import -->|"requests observations"| node_aemet
node_aemet_import -->|"writes dataset"| node_historical_file

click node_menu "https://github.com/pcarballo07/clim_app/blob/main/main.py"
click node_registration "https://github.com/pcarballo07/clim_app/blob/main/main.py"
click node_zone_search "https://github.com/pcarballo07/clim_app/blob/main/main.py"
click node_validation "https://github.com/pcarballo07/clim_app/blob/main/validations.py"
click node_alert_rules "https://github.com/pcarballo07/clim_app/blob/main/alerts.py"
click node_json_store "https://github.com/pcarballo07/clim_app/blob/main/store.py"
click node_history_file "https://github.com/pcarballo07/clim_app/blob/main/data/mock_real.json"
click node_aemet_import "https://github.com/pcarballo07/clim_app/blob/main/utils/descargar_aemet.py"
click node_historical_file "https://github.com/pcarballo07/clim_app/blob/main/data/clima_mock.json"

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_menu,node_registration,node_zone_search toneBlue
class node_validation,node_alert_rules toneAmber
class node_json_store,node_history_file toneMint
class node_aemet_import,node_historical_file toneRose
class node_operator,node_aemet toneIndigo
```

## Components

### Console app

- [App menu](https://github.com/pcarballo07/clim_app/blob/main/main.py): `main.py`
- [Measurement registration](https://github.com/pcarballo07/clim_app/blob/main/main.py): `main.py`
- [Zone history search](https://github.com/pcarballo07/clim_app/blob/main/main.py): `main.py`

### Weather domain

- [Input validation](https://github.com/pcarballo07/clim_app/blob/main/validations.py): `validations.py`
- [Alert evaluation](https://github.com/pcarballo07/clim_app/blob/main/alerts.py): `alerts.py`

### JSON data

- [JSON persistence](https://github.com/pcarballo07/clim_app/blob/main/store.py): `store.py`
- [Observation history](https://github.com/pcarballo07/clim_app/blob/main/data/mock_real.json): `data/mock_real.json`

### Historical ingestion

- [AEMET extraction and normalization](https://github.com/pcarballo07/clim_app/blob/main/utils/descargar_aemet.py): `utils/descargar_aemet.py`
- [Historical climate dataset](https://github.com/pcarballo07/clim_app/blob/main/data/clima_mock.json): `data/clima_mock.json`

### Other components

- **Operator**
- **AEMET OpenData**

## Connections

- Operator → App menu: selects action (evidence: `main.py`)
- App menu → Measurement registration: routes to (evidence: `main.py`)
- App menu → Zone history search: routes to (evidence: `main.py`)
- Measurement registration → JSON persistence: loads and saves (evidence: `main.py`)
- Measurement registration → Input validation: validates with (evidence: `main.py`)
- Zone history search → Input validation: selects zone with (evidence: `main.py`)
- Zone history search → JSON persistence: loads history (evidence: `main.py`)
- JSON persistence → Observation history: reads and writes (evidence: `store.py`)
- AEMET extraction and normalization → AEMET OpenData: requests observations (evidence: `utils/descargar_aemet.py`)
- AEMET extraction and normalization → Historical climate dataset: writes dataset (evidence: `utils/descargar_aemet.py`)
