# banamex43/resource-watcher architecture

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

- Interactive diagram: https://gitdiagram.com/banamex43/resource-watcher
- Repository: https://github.com/banamex43/resource-watcher

## Overview

PC Resource Watcher collects CPU, memory, and disk readings in a CLI loop, evaluates thresholds, persists readings, and presents a local HTML report. A separate Flask dashboard reads the CSV history, validates rows, computes historical and sustained-pressure summaries, and renders a health view. Configuration and logging support both entry points. The shared CSV connection is inferred from matching filenames, so that edge is marked unverified; the README is empty.

Main entry points: [`main.py`](https://github.com/banamex43/resource-watcher/blob/main/main.py) (Monitor loop), [`app.py`](https://github.com/banamex43/resource-watcher/blob/main/app.py) (Dashboard route), [`config.py`](https://github.com/banamex43/resource-watcher/blob/main/config.py) (Config validation), [`resource_analysis.py`](https://github.com/banamex43/resource-watcher/blob/main/resource_analysis.py) (Sustained pressure)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_monitor["Monitoring"]
  node_cli["Monitor loop<br/>[main.py]"]
  node_capture["Resource capture<br/>[main.py]"]
  node_csvlog[("Reading history")]
  node_console["Console output<br/>[main.py]"]
  node_report["Health report<br/>[health_report.html]"]
end

subgraph group_analysis["Analysis"]
  node_thresholds["Live findings<br/>[main.py]"]
  node_history["History summary"]
  node_pressure["Sustained pressure"]
  node_health["Health evaluation"]
end

subgraph group_dashboard["Dashboard"]
  node_dashboard_app["Dashboard route<br/>[app.py]"]
  node_csvload["CSV validation<br/>[app.py]"]
  node_template["Dashboard view<br/>[dashboard.html]"]
end

subgraph group_support["Configuration"]
  node_config_loader["Config validation<br/>[config.py]"]
  node_config_data["Watcher settings<br/>[config.json]"]
  node_logging["Logging setup<br/>[logger_config.py]"]
end

node_user(("Operator"))

node_user -->|"starts monitoring"| node_cli
node_cli -->|"collects readings"| node_capture
node_cli -->|"evaluates thresholds"| node_thresholds
node_cli -->|"appends readings"| node_csvlog
node_cli -->|"displays findings"| node_console
node_cli -->|"generates report"| node_report
node_user -->|"opens dashboard"| node_dashboard_app
node_dashboard_app -->|"loads history"| node_csvload
node_csvload -.->|"reads history"| node_csvlog
node_dashboard_app -->|"analyzes history"| node_history
node_dashboard_app -->|"detects pressure"| node_pressure
node_dashboard_app -->|"evaluates health"| node_health
node_dashboard_app -->|"renders view"| node_template
node_cli -->|"loads settings"| node_config_loader
node_config_loader -->|"reads settings"| node_config_data
node_pressure -->|"loads thresholds"| node_config_loader
node_health -->|"loads thresholds"| node_config_loader
node_cli -->|"gets logger"| node_logging
node_dashboard_app -->|"gets logger"| node_logging

click node_cli "https://github.com/banamex43/resource-watcher/blob/main/main.py"
click node_capture "https://github.com/banamex43/resource-watcher/blob/main/main.py"
click node_thresholds "https://github.com/banamex43/resource-watcher/blob/main/main.py"
click node_console "https://github.com/banamex43/resource-watcher/blob/main/main.py"
click node_report "https://github.com/banamex43/resource-watcher/blob/main/health_report.html"
click node_dashboard_app "https://github.com/banamex43/resource-watcher/blob/main/app.py"
click node_csvload "https://github.com/banamex43/resource-watcher/blob/main/app.py"
click node_history "https://github.com/banamex43/resource-watcher/blob/main/resource_analysis.py"
click node_pressure "https://github.com/banamex43/resource-watcher/blob/main/resource_analysis.py"
click node_health "https://github.com/banamex43/resource-watcher/blob/main/resource_analysis.py"
click node_template "https://github.com/banamex43/resource-watcher/blob/main/templates/dashboard.html"
click node_config_loader "https://github.com/banamex43/resource-watcher/blob/main/config.py"
click node_config_data "https://github.com/banamex43/resource-watcher/blob/main/config.json"
click node_logging "https://github.com/banamex43/resource-watcher/blob/main/logger_config.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_cli,node_capture,node_csvlog,node_console,node_report toneBlue
class node_thresholds,node_history,node_pressure,node_health toneAmber
class node_dashboard_app,node_csvload,node_template toneMint
class node_config_loader,node_config_data,node_logging toneRose
class node_user toneIndigo
```

## Components

### Monitoring

- [Monitor loop](https://github.com/banamex43/resource-watcher/blob/main/main.py): `main.py`
- [Resource capture](https://github.com/banamex43/resource-watcher/blob/main/main.py): `main.py`
- **Reading history**
- [Console output](https://github.com/banamex43/resource-watcher/blob/main/main.py): `main.py`
- [Health report](https://github.com/banamex43/resource-watcher/blob/main/health_report.html): `health_report.html`

### Analysis

- [Live findings](https://github.com/banamex43/resource-watcher/blob/main/main.py): `main.py`
- [History summary](https://github.com/banamex43/resource-watcher/blob/main/resource_analysis.py): `resource_analysis.py`
- [Sustained pressure](https://github.com/banamex43/resource-watcher/blob/main/resource_analysis.py): `resource_analysis.py`
- [Health evaluation](https://github.com/banamex43/resource-watcher/blob/main/resource_analysis.py): `resource_analysis.py`

### Dashboard

- [Dashboard route](https://github.com/banamex43/resource-watcher/blob/main/app.py): `app.py`
- [CSV validation](https://github.com/banamex43/resource-watcher/blob/main/app.py): `app.py`
- [Dashboard view](https://github.com/banamex43/resource-watcher/blob/main/templates/dashboard.html): `templates/dashboard.html`

### Configuration

- [Config validation](https://github.com/banamex43/resource-watcher/blob/main/config.py): `config.py`
- [Watcher settings](https://github.com/banamex43/resource-watcher/blob/main/config.json): `config.json`
- [Logging setup](https://github.com/banamex43/resource-watcher/blob/main/logger_config.py): `logger_config.py`

### Other components

- **Operator**

## Connections

- Operator → Monitor loop: starts monitoring (evidence: `main.py`)
- Monitor loop → Resource capture: collects readings (evidence: `main.py`)
- Monitor loop → Live findings: evaluates thresholds (evidence: `main.py`)
- Monitor loop → Reading history: appends readings (evidence: `main.py`)
- Monitor loop → Console output: displays findings (evidence: `main.py`)
- Monitor loop → Health report: generates report (evidence: `main.py`)
- Operator → Dashboard route: opens dashboard (evidence: `app.py`)
- Dashboard route → CSV validation: loads history (evidence: `app.py`)
- CSV validation → Reading history: reads history
- Dashboard route → History summary: analyzes history (evidence: `app.py`)
- Dashboard route → Sustained pressure: detects pressure (evidence: `app.py`)
- Dashboard route → Health evaluation: evaluates health (evidence: `app.py`)
- Dashboard route → Dashboard view: renders view (evidence: `app.py`)
- Monitor loop → Config validation: loads settings (evidence: `main.py`)
- Config validation → Watcher settings: reads settings (evidence: `config.py`)
- Sustained pressure → Config validation: loads thresholds (evidence: `resource_analysis.py`)
- Health evaluation → Config validation: loads thresholds (evidence: `resource_analysis.py`)
- Monitor loop → Logging setup: gets logger (evidence: `main.py`)
- Dashboard route → Logging setup: gets logger (evidence: `app.py`)
