# harshithak6/earlyalert. architecture

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

- Interactive diagram: https://gitdiagram.com/harshithak6/earlyalert.
- Repository: https://github.com/harshithak6/earlyalert.

## Overview

EarlyAlert is a Streamlit academic-risk dashboard. It loads student academic records, calculates risk and contributing factors, then presents student and subject details alongside historical trends. Mentors can request a Groq-generated explanation, explore a projected recovery scenario, and prepare and approve a message draft; the draft is saved, not sent. SQLite stores risk, explanation, and mentor records. The excerpts confirm the risk-analysis call and database setup and mentor-save calls; links to other dashboard actions are shown as unverified where the relevant app code was omitted.

Main entry points: [`app.py`](https://github.com/harshithak6/earlyalert./blob/main/app.py) (Streamlit dashboard), [`utils/database.py`](https://github.com/harshithak6/earlyalert./blob/main/utils/database.py) (Database access), [`agents/history_agent.py`](https://github.com/harshithak6/earlyalert./blob/main/agents/history_agent.py) (Historical reports), [`data/student_academic_data.csv`](https://github.com/harshithak6/earlyalert./blob/main/data/student_academic_data.csv) (Academic records)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_dashboard["Dashboard"]
  node_dashboard_app["Streamlit dashboard<br/>[app.py]"]
end

subgraph group_analysis["Academic analysis"]
  node_academic_csv["Academic records"]
  node_risk_analysis["Risk analysis<br/>[risk_agent.py]"]
  node_history_reports["Historical reports<br/>[history_agent.py]"]
  node_progress_summary["Progress summary<br/>[history_agent.py]"]
end

subgraph group_support["Support planning"]
  node_recovery_simulator["Recovery simulator<br/>[recovery_agent.py]"]
  node_ai_explanation["AI explanation"]
  node_mentor_draft["Mentor message draft<br/>[mentor_agent.py]"]
end

subgraph group_persistence["Persistence"]
  node_database_access["Database access<br/>[database.py]"]
  node_sqlite_store[("SQLite records")]
end

node_mentor_user(("Mentor"))
node_groq_service{{"Groq API"}}

node_mentor_user -->|"uses"| node_dashboard_app
node_academic_csv -->|"reads records"| node_risk_analysis
node_dashboard_app -->|"loads analysis"| node_risk_analysis
node_academic_csv -->|"reads records"| node_history_reports
node_history_reports -->|"summarizes report"| node_progress_summary
node_dashboard_app -.->|"requests report"| node_history_reports
node_dashboard_app -.->|"requests summary"| node_progress_summary
node_dashboard_app -.->|"simulates risk"| node_recovery_simulator
node_dashboard_app -.->|"requests explanation"| node_ai_explanation
node_ai_explanation -->|"requests completion"| node_groq_service
node_dashboard_app -.->|"creates draft"| node_mentor_draft
node_dashboard_app -->|"creates tables"| node_database_access
node_dashboard_app -->|"saves mentor record"| node_database_access
node_dashboard_app -.->|"saves risk and explanation"| node_database_access
node_database_access -->|"reads and writes"| node_sqlite_store

click node_dashboard_app "https://github.com/harshithak6/earlyalert./blob/main/app.py"
click node_academic_csv "https://github.com/harshithak6/earlyalert./blob/main/data/student_academic_data.csv"
click node_risk_analysis "https://github.com/harshithak6/earlyalert./blob/main/agents/risk_agent.py"
click node_history_reports "https://github.com/harshithak6/earlyalert./blob/main/agents/history_agent.py"
click node_progress_summary "https://github.com/harshithak6/earlyalert./blob/main/agents/history_agent.py"
click node_recovery_simulator "https://github.com/harshithak6/earlyalert./blob/main/agents/recovery_agent.py"
click node_ai_explanation "https://github.com/harshithak6/earlyalert./blob/main/agents/explanation_agent.py"
click node_mentor_draft "https://github.com/harshithak6/earlyalert./blob/main/agents/mentor_agent.py"
click node_database_access "https://github.com/harshithak6/earlyalert./blob/main/utils/database.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_dashboard_app toneBlue
class node_academic_csv,node_risk_analysis,node_history_reports,node_progress_summary toneAmber
class node_recovery_simulator,node_ai_explanation,node_mentor_draft,node_groq_service toneMint
class node_database_access,node_sqlite_store toneRose
class node_mentor_user toneIndigo
```

## Components

### Dashboard

- [Streamlit dashboard](https://github.com/harshithak6/earlyalert./blob/main/app.py): `app.py`

### Academic analysis

- [Academic records](https://github.com/harshithak6/earlyalert./blob/main/data/student_academic_data.csv): `data/student_academic_data.csv`
- [Risk analysis](https://github.com/harshithak6/earlyalert./blob/main/agents/risk_agent.py): `agents/risk_agent.py`
- [Historical reports](https://github.com/harshithak6/earlyalert./blob/main/agents/history_agent.py): `agents/history_agent.py`
- [Progress summary](https://github.com/harshithak6/earlyalert./blob/main/agents/history_agent.py): `agents/history_agent.py`

### Support planning

- [Recovery simulator](https://github.com/harshithak6/earlyalert./blob/main/agents/recovery_agent.py): `agents/recovery_agent.py`
- [AI explanation](https://github.com/harshithak6/earlyalert./blob/main/agents/explanation_agent.py): `agents/explanation_agent.py`
- [Mentor message draft](https://github.com/harshithak6/earlyalert./blob/main/agents/mentor_agent.py): `agents/mentor_agent.py`

### Persistence

- [Database access](https://github.com/harshithak6/earlyalert./blob/main/utils/database.py): `utils/database.py`
- **SQLite records**

### Other components

- **Mentor**
- **Groq API**

## Connections

- Mentor → Streamlit dashboard: uses (evidence: `app.py`)
- Academic records → Risk analysis: reads records (evidence: `agents/risk_agent.py`)
- Streamlit dashboard → Risk analysis: loads analysis (evidence: `app.py`)
- Academic records → Historical reports: reads records (evidence: `agents/history_agent.py`)
- Historical reports → Progress summary: summarizes report (evidence: `agents/history_agent.py`)
- Streamlit dashboard → Historical reports: requests report (evidence: `app.py`)
- Streamlit dashboard → Progress summary: requests summary (evidence: `app.py`)
- Streamlit dashboard → Recovery simulator: simulates risk (evidence: `app.py`)
- Streamlit dashboard → AI explanation: requests explanation (evidence: `app.py`)
- AI explanation → Groq API: requests completion (evidence: `agents/explanation_agent.py`)
- Streamlit dashboard → Mentor message draft: creates draft (evidence: `app.py`)
- Streamlit dashboard → Database access: creates tables (evidence: `app.py`)
- Streamlit dashboard → Database access: saves mentor record (evidence: `app.py`)
- Streamlit dashboard → Database access: saves risk and explanation (evidence: `app.py`)
- Database access → SQLite records: reads and writes (evidence: `utils/database.py`)
