# carlhenrikalm/calm.weathermonitor architecture

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

- Interactive diagram: https://gitdiagram.com/carlhenrikalm/calm.weathermonitor
- Repository: https://github.com/carlhenrikalm/calm.weathermonitor

## Overview

Calm.WeatherMonitor is an interactive console weather monitor. The user starts at the menu, can import bundled CSV data or fetch current weather from Open-Meteo, and sees import outcomes and status in the dashboard; the menu also offers a Statistics selection, though the supplied source shows selection rather than a statistics computation. Both import paths validate/deduplicate measurements and persist them in SQL Server. The graph reflects the shown wiring and calls; the README gives no additional capability details, and unsampled migration/configuration internals are not expanded.

Main entry points: [`Calm.WeatherMonitor/Services/FileImport/FileImportService.cs`](https://github.com/carlhenrikalm/calm.weathermonitor/blob/master/Calm.WeatherMonitor/Services/FileImport/FileImportService.cs) (CSV import), [`Calm.WeatherMonitor/Classes/Menu/Menu.cs`](https://github.com/carlhenrikalm/calm.weathermonitor/blob/master/Calm.WeatherMonitor/Classes/Menu/Menu.cs) (Interactive menu), [`Calm.WeatherMonitor/Services/Api/WeatherApiService.cs`](https://github.com/carlhenrikalm/calm.weathermonitor/blob/master/Calm.WeatherMonitor/Services/Api/WeatherApiService.cs) (Live weather import), [`Calm.WeatherMonitor/Program.cs`](https://github.com/carlhenrikalm/calm.weathermonitor/blob/master/Calm.WeatherMonitor/Program.cs) (Program startup)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Application"]
  node_program["Program startup<br/>[Program.cs]"]
  node_db_status["Database status check"]
end

subgraph group_imports["Weather imports"]
  node_file_import["CSV import"]
  node_csv_parser["CSV validation"]
  node_bad_logger["Rejected-row logger<br/>[BadDataLogger.cs]"]
  node_csv_file["Weather CSV<br/>[weather_data.csv]"]
  node_api_import["Live weather import"]
  node_api_models["API response models"]
  node_import_results["Import results<br/>[ApiImportResult.cs]"]
  node_file_result["File import result"]
end

subgraph group_storage["Persistence"]
  node_weather_point["Weather measurement"]
  node_db_context["Weather data context"]
end

subgraph group_interface["Console interface"]
  node_menu["Interactive menu<br/>[Menu.cs]"]
  node_state["Menu state<br/>[MenuState.cs]"]
  node_dashboard["Dashboard layout<br/>[DashboardLayout.cs]"]
  node_panels["Dashboard panels<br/>[Panels]"]
  node_panel_factory["Panel factory<br/>[PanelFactory.cs]"]
end

node_user(("Console user"))
node_open_meteo["Open-Meteo"]
node_sql_server[("SQL Server")]

node_user -->|"starts"| node_program
node_program -->|"runs"| node_menu
node_program -->|"configures"| node_db_status
node_program -->|"configures"| node_file_import
node_program -->|"configures"| node_api_import
node_menu -->|"updates"| node_state
node_menu -->|"checks"| node_db_status
node_menu -->|"invokes"| node_file_import
node_menu -->|"invokes"| node_api_import
node_menu -->|"renders"| node_dashboard
node_dashboard -->|"builds"| node_panels
node_panels -->|"uses"| node_panel_factory
node_file_import -->|"reads"| node_csv_file
node_file_import -->|"parses rows"| node_csv_parser
node_file_import -->|"logs rejects"| node_bad_logger
node_file_import -->|"reads and writes"| node_db_context
node_api_import -->|"requests weather"| node_open_meteo
node_api_import -->|"deserializes"| node_api_models
node_api_import -->|"reads and writes"| node_db_context
node_api_import -->|"returns result"| node_import_results
node_file_import -->|"returns result"| node_file_result
node_db_status -->|"checks connection"| node_db_context
node_db_context -->|"maps records"| node_weather_point
node_db_context -.->|"connects"| node_sql_server

click node_program "https://github.com/carlhenrikalm/calm.weathermonitor/blob/master/Calm.WeatherMonitor/Program.cs"
click node_menu "https://github.com/carlhenrikalm/calm.weathermonitor/blob/master/Calm.WeatherMonitor/Classes/Menu/Menu.cs"
click node_state "https://github.com/carlhenrikalm/calm.weathermonitor/blob/master/Calm.WeatherMonitor/Classes/Menu/States/MenuState.cs"
click node_dashboard "https://github.com/carlhenrikalm/calm.weathermonitor/blob/master/Calm.WeatherMonitor/Classes/Menu/Layouts/DashboardLayout.cs"
click node_panels "https://github.com/carlhenrikalm/calm.weathermonitor/tree/master/Calm.WeatherMonitor/Classes/Menu/Panels"
click node_panel_factory "https://github.com/carlhenrikalm/calm.weathermonitor/blob/master/Calm.WeatherMonitor/Classes/Menu/Factory/PanelFactory.cs"
click node_db_status "https://github.com/carlhenrikalm/calm.weathermonitor/blob/master/Calm.WeatherMonitor/Services/DatabaseStatusService.cs"
click node_file_import "https://github.com/carlhenrikalm/calm.weathermonitor/blob/master/Calm.WeatherMonitor/Services/FileImport/FileImportService.cs"
click node_csv_parser "https://github.com/carlhenrikalm/calm.weathermonitor/blob/master/Calm.WeatherMonitor/Services/FileImport/WeatherCsvParser.cs"
click node_bad_logger "https://github.com/carlhenrikalm/calm.weathermonitor/blob/master/Calm.WeatherMonitor/Services/BadDataLogger.cs"
click node_csv_file "https://github.com/carlhenrikalm/calm.weathermonitor/blob/master/Calm.WeatherMonitor/DataFiles/weather_data.csv"
click node_api_import "https://github.com/carlhenrikalm/calm.weathermonitor/blob/master/Calm.WeatherMonitor/Services/Api/WeatherApiService.cs"
click node_api_models "https://github.com/carlhenrikalm/calm.weathermonitor/blob/master/Calm.WeatherMonitor/Models/Api/OpenMeteoResponse.cs"
click node_import_results "https://github.com/carlhenrikalm/calm.weathermonitor/blob/master/Calm.WeatherMonitor/Models/Results/ApiImportResult.cs"
click node_file_result "https://github.com/carlhenrikalm/calm.weathermonitor/blob/master/Calm.WeatherMonitor/Models/Results/FileImportResult.cs"
click node_weather_point "https://github.com/carlhenrikalm/calm.weathermonitor/blob/master/Calm.WeatherMonitor/Models/WeatherDataPoint.cs"
click node_db_context "https://github.com/carlhenrikalm/calm.weathermonitor/blob/master/Calm.WeatherMonitor/Data/WeatherDbContext.cs"

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_program,node_db_status,node_user toneBlue
class node_file_import,node_csv_parser,node_bad_logger,node_csv_file,node_api_import,node_api_models,node_import_results,node_file_result,node_sql_server toneAmber
class node_weather_point,node_db_context toneMint
class node_menu,node_state,node_dashboard,node_panels,node_panel_factory toneRose
class node_open_meteo toneIndigo
```

## Components

### Application

- [Program startup](https://github.com/carlhenrikalm/calm.weathermonitor/blob/master/Calm.WeatherMonitor/Program.cs): `Calm.WeatherMonitor/Program.cs`
- [Database status check](https://github.com/carlhenrikalm/calm.weathermonitor/blob/master/Calm.WeatherMonitor/Services/DatabaseStatusService.cs): `Calm.WeatherMonitor/Services/DatabaseStatusService.cs`

### Weather imports

- [CSV import](https://github.com/carlhenrikalm/calm.weathermonitor/blob/master/Calm.WeatherMonitor/Services/FileImport/FileImportService.cs): `Calm.WeatherMonitor/Services/FileImport/FileImportService.cs`
- [CSV validation](https://github.com/carlhenrikalm/calm.weathermonitor/blob/master/Calm.WeatherMonitor/Services/FileImport/WeatherCsvParser.cs): `Calm.WeatherMonitor/Services/FileImport/WeatherCsvParser.cs`
- [Rejected-row logger](https://github.com/carlhenrikalm/calm.weathermonitor/blob/master/Calm.WeatherMonitor/Services/BadDataLogger.cs): `Calm.WeatherMonitor/Services/BadDataLogger.cs`
- [Weather CSV](https://github.com/carlhenrikalm/calm.weathermonitor/blob/master/Calm.WeatherMonitor/DataFiles/weather_data.csv): `Calm.WeatherMonitor/DataFiles/weather_data.csv`
- [Live weather import](https://github.com/carlhenrikalm/calm.weathermonitor/blob/master/Calm.WeatherMonitor/Services/Api/WeatherApiService.cs): `Calm.WeatherMonitor/Services/Api/WeatherApiService.cs`
- [API response models](https://github.com/carlhenrikalm/calm.weathermonitor/blob/master/Calm.WeatherMonitor/Models/Api/OpenMeteoResponse.cs): `Calm.WeatherMonitor/Models/Api/OpenMeteoResponse.cs`
- [Import results](https://github.com/carlhenrikalm/calm.weathermonitor/blob/master/Calm.WeatherMonitor/Models/Results/ApiImportResult.cs): `Calm.WeatherMonitor/Models/Results/ApiImportResult.cs`
- [File import result](https://github.com/carlhenrikalm/calm.weathermonitor/blob/master/Calm.WeatherMonitor/Models/Results/FileImportResult.cs): `Calm.WeatherMonitor/Models/Results/FileImportResult.cs`

### Persistence

- [Weather measurement](https://github.com/carlhenrikalm/calm.weathermonitor/blob/master/Calm.WeatherMonitor/Models/WeatherDataPoint.cs): `Calm.WeatherMonitor/Models/WeatherDataPoint.cs`
- [Weather data context](https://github.com/carlhenrikalm/calm.weathermonitor/blob/master/Calm.WeatherMonitor/Data/WeatherDbContext.cs): `Calm.WeatherMonitor/Data/WeatherDbContext.cs`

### Console interface

- [Interactive menu](https://github.com/carlhenrikalm/calm.weathermonitor/blob/master/Calm.WeatherMonitor/Classes/Menu/Menu.cs): `Calm.WeatherMonitor/Classes/Menu/Menu.cs`
- [Menu state](https://github.com/carlhenrikalm/calm.weathermonitor/blob/master/Calm.WeatherMonitor/Classes/Menu/States/MenuState.cs): `Calm.WeatherMonitor/Classes/Menu/States/MenuState.cs`
- [Dashboard layout](https://github.com/carlhenrikalm/calm.weathermonitor/blob/master/Calm.WeatherMonitor/Classes/Menu/Layouts/DashboardLayout.cs): `Calm.WeatherMonitor/Classes/Menu/Layouts/DashboardLayout.cs`
- [Dashboard panels](https://github.com/carlhenrikalm/calm.weathermonitor/tree/master/Calm.WeatherMonitor/Classes/Menu/Panels): `Calm.WeatherMonitor/Classes/Menu/Panels`
- [Panel factory](https://github.com/carlhenrikalm/calm.weathermonitor/blob/master/Calm.WeatherMonitor/Classes/Menu/Factory/PanelFactory.cs): `Calm.WeatherMonitor/Classes/Menu/Factory/PanelFactory.cs`

### Other components

- **Console user**
- **Open-Meteo**
- **SQL Server**

## Connections

- Console user → Program startup: starts
- Program startup → Interactive menu: runs (evidence: `Calm.WeatherMonitor/Program.cs`)
- Program startup → Database status check: configures (evidence: `Calm.WeatherMonitor/Program.cs`)
- Program startup → CSV import: configures (evidence: `Calm.WeatherMonitor/Program.cs`)
- Program startup → Live weather import: configures (evidence: `Calm.WeatherMonitor/Program.cs`)
- Interactive menu → Menu state: updates (evidence: `Calm.WeatherMonitor/Classes/Menu/Menu.cs`)
- Interactive menu → Database status check: checks (evidence: `Calm.WeatherMonitor/Classes/Menu/Menu.cs`)
- Interactive menu → CSV import: invokes (evidence: `Calm.WeatherMonitor/Classes/Menu/Menu.cs`)
- Interactive menu → Live weather import: invokes (evidence: `Calm.WeatherMonitor/Classes/Menu/Menu.cs`)
- Interactive menu → Dashboard layout: renders (evidence: `Calm.WeatherMonitor/Classes/Menu/Menu.cs`)
- Dashboard layout → Dashboard panels: builds (evidence: `Calm.WeatherMonitor/Classes/Menu/Layouts/DashboardLayout.cs`)
- Dashboard panels → Panel factory: uses (evidence: `Calm.WeatherMonitor/Classes/Menu/Panels/InformationPanelBuilder.cs`)
- CSV import → Weather CSV: reads (evidence: `Calm.WeatherMonitor/Services/FileImport/FileImportService.cs`)
- CSV import → CSV validation: parses rows (evidence: `Calm.WeatherMonitor/Services/FileImport/FileImportService.cs`)
- CSV import → Rejected-row logger: logs rejects (evidence: `Calm.WeatherMonitor/Services/FileImport/FileImportService.cs`)
- CSV import → Weather data context: reads and writes (evidence: `Calm.WeatherMonitor/Services/FileImport/FileImportService.cs`)
- Live weather import → Open-Meteo: requests weather (evidence: `Calm.WeatherMonitor/Services/Api/WeatherApiService.cs`)
- Live weather import → API response models: deserializes (evidence: `Calm.WeatherMonitor/Services/Api/WeatherApiService.cs`)
- Live weather import → Weather data context: reads and writes (evidence: `Calm.WeatherMonitor/Services/Api/WeatherApiService.cs`)
- Live weather import → Import results: returns result (evidence: `Calm.WeatherMonitor/Services/Api/WeatherApiService.cs`)
- CSV import → File import result: returns result (evidence: `Calm.WeatherMonitor/Services/FileImport/FileImportService.cs`)
- Database status check → Weather data context: checks connection (evidence: `Calm.WeatherMonitor/Services/DatabaseStatusService.cs`)
- Weather data context → Weather measurement: maps records (evidence: `Calm.WeatherMonitor/Data/WeatherDbContext.cs`)
- Weather data context → SQL Server: connects
