# gkrishna4346/battery-clinic-ai architecture

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

- Interactive diagram: https://gitdiagram.com/gkrishna4346/battery-clinic-ai
- Repository: https://github.com/gkrishna4346/battery-clinic-ai

## Overview

Battery Clinic AI is a Streamlit app for predicting laptop battery health, managing training data, exploring model behavior, and explaining results. The main workflow is user input or uploaded CSV → app orchestration → model prediction and interpretation → displayed or downloadable result. Separate branches support data replacement and restore, model comparison and analysis, and the Mr. GK assistant. Edges reflect the excerpts and README; unsampled app sections limit detail about some page-to-engine calls.

Main entry points: [`app.py`](https://github.com/gkrishna4346/battery-clinic-ai/blob/main/app.py) (Streamlit app), [`versions.py`](https://github.com/gkrishna4346/battery-clinic-ai/blob/main/versions.py) (Version management), [`mrgk.py`](https://github.com/gkrishna4346/battery-clinic-ai/blob/main/mrgk.py) (Mr. GK assistant), [`engine.py`](https://github.com/gkrishna4346/battery-clinic-ai/blob/main/engine.py) (Modeling engine)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["Application"]
  node_app["Streamlit app<br/>[app.py]"]
  node_config["Domain settings<br/>[config.py]"]
end

subgraph group_ml["Prediction and analysis"]
  node_engine["Modeling engine<br/>[engine.py]"]
  node_reports["Prediction reports<br/>[report.py]"]
end

subgraph group_data["Data management"]
  node_datafile[("Active dataset<br/>[battery_health.csv]")]
  node_versioning["Version management<br/>[versions.py]"]
  node_versionstore[("Version archive")]
end

subgraph group_assistant["Assistant"]
  node_assistant_logic["Mr. GK assistant<br/>[mrgk.py]"]
  node_knowledge["Assistant knowledge<br/>[mrgk_kb.py]"]
  node_guide["User guide<br/>[user_guide.html]"]
end

node_user(("Laptop user"))
node_github["GitHub repository"]
node_anthropic["Anthropic API"]

node_user -->|"uses"| node_app
node_app -->|"requests predictions"| node_engine
node_engine -->|"reads domain rules"| node_config
node_app -->|"uses settings"| node_config
node_app -->|"initializes versions"| node_versioning
node_versioning -->|"activates dataset"| node_datafile
node_versioning -->|"stores versions"| node_versionstore
node_app -->|"offers report downloads"| node_reports
node_app -->|"opens assistant"| node_assistant_logic
node_assistant_logic -->|"selects answers"| node_knowledge
node_assistant_logic -->|"searches guide"| node_guide
node_assistant_logic -.->|"requests AI answers"| node_anthropic
node_versioning -.->|"syncs optionally"| node_github

click node_app "https://github.com/gkrishna4346/battery-clinic-ai/blob/main/app.py"
click node_config "https://github.com/gkrishna4346/battery-clinic-ai/blob/main/config.py"
click node_engine "https://github.com/gkrishna4346/battery-clinic-ai/blob/main/engine.py"
click node_datafile "https://github.com/gkrishna4346/battery-clinic-ai/blob/main/data/battery_health.csv"
click node_versioning "https://github.com/gkrishna4346/battery-clinic-ai/blob/main/versions.py"
click node_versionstore "https://github.com/gkrishna4346/battery-clinic-ai/tree/main/data/versions"
click node_reports "https://github.com/gkrishna4346/battery-clinic-ai/blob/main/report.py"
click node_assistant_logic "https://github.com/gkrishna4346/battery-clinic-ai/blob/main/mrgk.py"
click node_knowledge "https://github.com/gkrishna4346/battery-clinic-ai/blob/main/mrgk_kb.py"
click node_guide "https://github.com/gkrishna4346/battery-clinic-ai/blob/main/docs/user_guide.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_app,node_config,node_user toneBlue
class node_engine,node_reports toneAmber
class node_datafile,node_versioning,node_versionstore,node_anthropic toneMint
class node_assistant_logic,node_knowledge,node_guide toneRose
class node_github toneIndigo
```

## Components

### Application

- [Streamlit app](https://github.com/gkrishna4346/battery-clinic-ai/blob/main/app.py): `app.py`
- [Domain settings](https://github.com/gkrishna4346/battery-clinic-ai/blob/main/config.py): `config.py`

### Prediction and analysis

- [Modeling engine](https://github.com/gkrishna4346/battery-clinic-ai/blob/main/engine.py): `engine.py`
- [Prediction reports](https://github.com/gkrishna4346/battery-clinic-ai/blob/main/report.py): `report.py`

### Data management

- [Active dataset](https://github.com/gkrishna4346/battery-clinic-ai/blob/main/data/battery_health.csv): `data/battery_health.csv`
- [Version management](https://github.com/gkrishna4346/battery-clinic-ai/blob/main/versions.py): `versions.py`
- [Version archive](https://github.com/gkrishna4346/battery-clinic-ai/tree/main/data/versions): `data/versions`

### Assistant

- [Mr. GK assistant](https://github.com/gkrishna4346/battery-clinic-ai/blob/main/mrgk.py): `mrgk.py`
- [Assistant knowledge](https://github.com/gkrishna4346/battery-clinic-ai/blob/main/mrgk_kb.py): `mrgk_kb.py`
- [User guide](https://github.com/gkrishna4346/battery-clinic-ai/blob/main/docs/user_guide.html): `docs/user_guide.html`

### Other components

- **Laptop user**
- **GitHub repository**
- **Anthropic API**

## Connections

- Laptop user → Streamlit app: uses (evidence: `README.md`)
- Streamlit app → Modeling engine: requests predictions (evidence: `app.py`)
- Modeling engine → Domain settings: reads domain rules (evidence: `engine.py`)
- Streamlit app → Domain settings: uses settings (evidence: `app.py`)
- Streamlit app → Version management: initializes versions (evidence: `app.py`)
- Version management → Active dataset: activates dataset (evidence: `versions.py`)
- Version management → Version archive: stores versions (evidence: `versions.py`)
- Streamlit app → Prediction reports: offers report downloads (evidence: `README.md`)
- Streamlit app → Mr. GK assistant: opens assistant (evidence: `app.py`)
- Mr. GK assistant → Assistant knowledge: selects answers (evidence: `mrgk.py`)
- Mr. GK assistant → User guide: searches guide (evidence: `README.md`)
- Mr. GK assistant → Anthropic API: requests AI answers (evidence: `mrgk.py`)
- Version management → GitHub repository: syncs optionally (evidence: `versions.py`)
