# e-allora/patchowner architecture

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

- Interactive diagram: https://gitdiagram.com/e-allora/patchowner
- Repository: https://github.com/e-allora/patchowner

## Overview

PatchOwner replays recent CISA KEV advisories against an uploaded or local asset inventory, decides which notices warrant action and who should receive them, then produces an HTML report. The CLI and web upload flow share the replay engine. The report surfaces notices, policy reasoning, health checks, follow-through, and sharing controls. Source excerpts establish the central calls; unsampled report and web details are represented only where documented by the README or visible template lookup.

Main entry points: [`patchowner/engine.py`](https://github.com/e-allora/patchowner/blob/main/patchowner/engine.py) (Replay engine), [`patchowner/web.py`](https://github.com/e-allora/patchowner/blob/main/patchowner/web.py) (Upload web app), [`patchowner/cli.py`](https://github.com/e-allora/patchowner/blob/main/patchowner/cli.py) (CLI commands), [`patchowner/decide.py`](https://github.com/e-allora/patchowner/blob/main/patchowner/decide.py) (Decision and routing)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Entry points"]
  node_cli["CLI commands<br/>[cli.py]"]
  node_web["Upload web app<br/>[web.py]"]
end

subgraph group_replay["Replay pipeline"]
  node_engine["Replay engine<br/>[engine.py]"]
  node_inventory["Inventory parser<br/>[inventory.py]"]
  node_kev["KEV feed and window<br/>[kev.py]"]
  node_matching["Advisory matching<br/>[matching.py]"]
end

subgraph group_decisions["Policy and routing"]
  node_decide["Decision and routing<br/>[decide.py]"]
  node_ssvc["SSVC assessment<br/>[ssvc.py]"]
  node_policy["Default policy"]
  node_health["Inventory health<br/>[health.py]"]
end

subgraph group_reporting["Report and follow-through"]
  node_state[("Notice state<br/>[state.py]")]
  node_report["Report renderer<br/>[report.py]"]
  node_template["HTML report view<br/>[report.html]"]
end

node_user(("Operator"))
node_cisa["CISA KEV catalog"]
node_browser(("Report reader"))

node_user -->|"runs command"| node_cli
node_user -->|"uploads inventory"| node_web
node_cli -->|"runs replay"| node_engine
node_web -->|"runs replay"| node_engine
node_web -->|"checks CSV fields"| node_inventory
node_web -->|"records actions"| node_state
node_engine -->|"parses CSV"| node_inventory
node_engine -->|"loads and filters"| node_kev
node_kev -->|"downloads feed"| node_cisa
node_engine -->|"matches advisories"| node_matching
node_engine -->|"decides matches"| node_decide
node_decide -->|"assesses policy"| node_ssvc
node_ssvc -->|"loads default"| node_policy
node_decide -->|"reads notice history"| node_state
node_engine -->|"assesses health"| node_health
node_engine -->|"renders replay"| node_report
node_report -->|"renders template"| node_template
node_cli -->|"writes HTML"| node_report
node_browser -->|"submits actions"| node_web
node_browser -->|"views report"| node_template

click node_cli "https://github.com/e-allora/patchowner/blob/main/patchowner/cli.py"
click node_web "https://github.com/e-allora/patchowner/blob/main/patchowner/web.py"
click node_engine "https://github.com/e-allora/patchowner/blob/main/patchowner/engine.py"
click node_inventory "https://github.com/e-allora/patchowner/blob/main/patchowner/inventory.py"
click node_kev "https://github.com/e-allora/patchowner/blob/main/patchowner/kev.py"
click node_matching "https://github.com/e-allora/patchowner/blob/main/patchowner/matching.py"
click node_decide "https://github.com/e-allora/patchowner/blob/main/patchowner/decide.py"
click node_ssvc "https://github.com/e-allora/patchowner/blob/main/patchowner/ssvc.py"
click node_policy "https://github.com/e-allora/patchowner/blob/main/patchowner/policies/deployer_default.csv"
click node_health "https://github.com/e-allora/patchowner/blob/main/patchowner/health.py"
click node_state "https://github.com/e-allora/patchowner/blob/main/patchowner/state.py"
click node_report "https://github.com/e-allora/patchowner/blob/main/patchowner/report.py"
click node_template "https://github.com/e-allora/patchowner/blob/main/patchowner/templates/report.html"

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_web toneBlue
class node_engine,node_inventory,node_kev,node_matching toneAmber
class node_decide,node_ssvc,node_policy,node_health toneMint
class node_state,node_report,node_template toneRose
class node_user,node_cisa,node_browser toneIndigo
```

## Components

### Entry points

- [CLI commands](https://github.com/e-allora/patchowner/blob/main/patchowner/cli.py): `patchowner/cli.py`
- [Upload web app](https://github.com/e-allora/patchowner/blob/main/patchowner/web.py): `patchowner/web.py`

### Replay pipeline

- [Replay engine](https://github.com/e-allora/patchowner/blob/main/patchowner/engine.py): `patchowner/engine.py`
- [Inventory parser](https://github.com/e-allora/patchowner/blob/main/patchowner/inventory.py): `patchowner/inventory.py`
- [KEV feed and window](https://github.com/e-allora/patchowner/blob/main/patchowner/kev.py): `patchowner/kev.py`
- [Advisory matching](https://github.com/e-allora/patchowner/blob/main/patchowner/matching.py): `patchowner/matching.py`

### Policy and routing

- [Decision and routing](https://github.com/e-allora/patchowner/blob/main/patchowner/decide.py): `patchowner/decide.py`
- [SSVC assessment](https://github.com/e-allora/patchowner/blob/main/patchowner/ssvc.py): `patchowner/ssvc.py`
- [Default policy](https://github.com/e-allora/patchowner/blob/main/patchowner/policies/deployer_default.csv): `patchowner/policies/deployer_default.csv`
- [Inventory health](https://github.com/e-allora/patchowner/blob/main/patchowner/health.py): `patchowner/health.py`

### Report and follow-through

- [Notice state](https://github.com/e-allora/patchowner/blob/main/patchowner/state.py): `patchowner/state.py`
- [Report renderer](https://github.com/e-allora/patchowner/blob/main/patchowner/report.py): `patchowner/report.py`
- [HTML report view](https://github.com/e-allora/patchowner/blob/main/patchowner/templates/report.html): `patchowner/templates/report.html`

### Other components

- **Operator**
- **CISA KEV catalog**
- **Report reader**

## Connections

- Operator → CLI commands: runs command (evidence: `README.md`)
- Operator → Upload web app: uploads inventory (evidence: `README.md`)
- CLI commands → Replay engine: runs replay (evidence: `patchowner/cli.py`)
- Upload web app → Replay engine: runs replay (evidence: `patchowner/web.py`)
- Upload web app → Inventory parser: checks CSV fields (evidence: `patchowner/web.py`)
- Upload web app → Notice state: records actions (evidence: `patchowner/web.py`)
- Replay engine → Inventory parser: parses CSV (evidence: `patchowner/engine.py`)
- Replay engine → KEV feed and window: loads and filters (evidence: `patchowner/engine.py`)
- KEV feed and window → CISA KEV catalog: downloads feed (evidence: `patchowner/kev.py`)
- Replay engine → Advisory matching: matches advisories (evidence: `patchowner/engine.py`)
- Replay engine → Decision and routing: decides matches (evidence: `patchowner/engine.py`)
- Decision and routing → SSVC assessment: assesses policy (evidence: `patchowner/decide.py`)
- SSVC assessment → Default policy: loads default (evidence: `patchowner/ssvc.py`)
- Decision and routing → Notice state: reads notice history (evidence: `patchowner/decide.py`)
- Replay engine → Inventory health: assesses health (evidence: `patchowner/engine.py`)
- Replay engine → Report renderer: renders replay (evidence: `patchowner/engine.py`)
- Report renderer → HTML report view: renders template (evidence: `patchowner/report.py`)
- CLI commands → Report renderer: writes HTML (evidence: `patchowner/cli.py`)
- Report reader → Upload web app: submits actions (evidence: `patchowner/web.py`)
- Report reader → HTML report view: views report (evidence: `README.md`)
