# sreeshnave7-ship-it/attendance-calculator architecture

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

- Interactive diagram: https://gitdiagram.com/sreeshnave7-ship-it/attendance-calculator
- Repository: https://github.com/sreeshnave7-ship-it/attendance-calculator

## Overview

AttendanceIQ is a browser-based attendance tracker. Users manage subjects, record class outcomes, and review live percentages, skip/recovery estimates, risk alerts, and historical trends; subject records persist in localStorage. Optional AI workflows parse natural-language logs, answer attendance questions, predict risk, and extract subjects from timetable images. The dashboard and feature pages present these workflows, while storage, attendance calculations, and server-side AI routes provide the main internal services. Some feature-page and API wiring is documented but not shown in the excerpts, so those links are marked unverified.

Main entry points: [`app/page.tsx`](https://github.com/sreeshnave7-ship-it/attendance-calculator/blob/main/app/page.tsx) (Dashboard), [`app/trends/page.tsx`](https://github.com/sreeshnave7-ship-it/attendance-calculator/blob/main/app/trends/page.tsx) (Trends page), [`lib/storage.ts`](https://github.com/sreeshnave7-ship-it/attendance-calculator/blob/main/lib/storage.ts) (Browser storage), [`lib/claudeClient.ts`](https://github.com/sreeshnave7-ship-it/attendance-calculator/blob/main/lib/claudeClient.ts) (Claude client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["App experience"]
  node_dashboard["Dashboard<br/>[page.tsx]"]
  node_subjectspage["Subjects page<br/>[page.tsx]"]
  node_trendspage["Trends page<br/>[page.tsx]"]
  node_assistantpage["Assistant page<br/>[page.tsx]"]
  node_navbar["Navigation<br/>[Navbar.tsx]"]
  node_theme["Theme provider<br/>[ThemeProvider.tsx]"]
end

subgraph group_tracking["Attendance tracking"]
  node_subjectform["Subject form<br/>[SubjectForm.tsx]"]
  node_subjectcards["Subject cards<br/>[SubjectCard.tsx]"]
  node_overallcalc["Attendance simulator"]
  node_riskbanner["Risk alerts"]
  node_trendchart["Trend chart<br/>[TrendChart.tsx]"]
end

subgraph group_ai["AI features"]
  node_nlpinput["Natural-language logger"]
  node_chatwindow["Chat window<br/>[ChatWindow.tsx]"]
  node_timetableupload["Timetable upload"]
  node_chatapi["Chat endpoint<br/>[route.ts]"]
  node_parseapi["Attendance parser<br/>[route.ts]"]
  node_riskapi["Risk prediction<br/>[route.ts]"]
  node_ocrapi["Timetable OCR<br/>[route.ts]"]
end

subgraph group_services["Core services"]
  node_claude["Claude client<br/>[claudeClient.ts]"]
  node_storage[("Browser storage<br/>[storage.ts]")]
  node_hooks["Attendance data hook<br/>[hooks.ts]"]
  node_math["Attendance calculations<br/>[attendanceMath.ts]"]
end

node_user(("Student"))

node_user -->|"uses"| node_dashboard
node_user -->|"manages subjects"| node_subjectspage
node_user -->|"reviews trends"| node_trendspage
node_user -->|"asks questions"| node_assistantpage
node_dashboard -->|"renders"| node_subjectcards
node_dashboard -->|"renders"| node_overallcalc
node_dashboard -->|"renders"| node_riskbanner
node_dashboard -->|"renders"| node_nlpinput
node_dashboard -->|"records attendance"| node_storage
node_subjectspage -.->|"manages subjects"| node_subjectform
node_dashboard -.->|"edits subjects"| node_subjectform
node_trendspage -->|"renders"| node_trendchart
node_trendspage -->|"loads data"| node_hooks
node_trendspage -->|"logs attendance"| node_storage
node_trendspage -->|"calculates trends"| node_math
node_assistantpage -->|"renders"| node_chatwindow
node_assistantpage -->|"loads data"| node_hooks
node_nlpinput -->|"reads and updates"| node_storage
node_chatwindow -->|"reads history"| node_storage
node_overallcalc -->|"calculates estimates"| node_math
node_hooks -->|"subscribes and reads"| node_storage
node_dashboard -.->|"includes navigation"| node_navbar
node_navbar -->|"opens form"| node_subjectform
node_navbar -->|"opens import"| node_timetableupload
node_timetableupload -->|"imports subjects"| node_storage
node_nlpinput -.->|"submits text"| node_parseapi
node_chatwindow -.->|"sends messages"| node_chatapi
node_chatapi -->|"requests response"| node_claude
node_chatapi -->|"computes attendance"| node_math
node_parseapi -->|"requests extraction"| node_claude
node_timetableupload -.->|"uploads image"| node_ocrapi
node_ocrapi -->|"requests extraction"| node_claude
node_dashboard -.->|"requests risk analysis"| node_riskapi
node_riskapi -->|"requests prediction"| node_claude
node_trendspage -->|"calculates attendance"| node_math

click node_dashboard "https://github.com/sreeshnave7-ship-it/attendance-calculator/blob/main/app/page.tsx"
click node_subjectspage "https://github.com/sreeshnave7-ship-it/attendance-calculator/blob/main/app/subjects/page.tsx"
click node_trendspage "https://github.com/sreeshnave7-ship-it/attendance-calculator/blob/main/app/trends/page.tsx"
click node_assistantpage "https://github.com/sreeshnave7-ship-it/attendance-calculator/blob/main/app/assistant/page.tsx"
click node_navbar "https://github.com/sreeshnave7-ship-it/attendance-calculator/blob/main/components/Navbar.tsx"
click node_subjectform "https://github.com/sreeshnave7-ship-it/attendance-calculator/blob/main/components/SubjectForm.tsx"
click node_subjectcards "https://github.com/sreeshnave7-ship-it/attendance-calculator/blob/main/components/SubjectCard.tsx"
click node_overallcalc "https://github.com/sreeshnave7-ship-it/attendance-calculator/blob/main/components/OverallAttendanceCalculator.tsx"
click node_riskbanner "https://github.com/sreeshnave7-ship-it/attendance-calculator/blob/main/components/RiskAlertBanner.tsx"
click node_trendchart "https://github.com/sreeshnave7-ship-it/attendance-calculator/blob/main/components/TrendChart.tsx"
click node_nlpinput "https://github.com/sreeshnave7-ship-it/attendance-calculator/blob/main/components/NaturalLanguageInput.tsx"
click node_chatwindow "https://github.com/sreeshnave7-ship-it/attendance-calculator/blob/main/components/ChatWindow.tsx"
click node_timetableupload "https://github.com/sreeshnave7-ship-it/attendance-calculator/blob/main/components/TimetableUpload.tsx"
click node_chatapi "https://github.com/sreeshnave7-ship-it/attendance-calculator/blob/main/app/api/chat/route.ts"
click node_parseapi "https://github.com/sreeshnave7-ship-it/attendance-calculator/blob/main/app/api/parse-attendance/route.ts"
click node_riskapi "https://github.com/sreeshnave7-ship-it/attendance-calculator/blob/main/app/api/predict-risk/route.ts"
click node_ocrapi "https://github.com/sreeshnave7-ship-it/attendance-calculator/blob/main/app/api/ocr-timetable/route.ts"
click node_claude "https://github.com/sreeshnave7-ship-it/attendance-calculator/blob/main/lib/claudeClient.ts"
click node_storage "https://github.com/sreeshnave7-ship-it/attendance-calculator/blob/main/lib/storage.ts"
click node_hooks "https://github.com/sreeshnave7-ship-it/attendance-calculator/blob/main/lib/hooks.ts"
click node_math "https://github.com/sreeshnave7-ship-it/attendance-calculator/blob/main/lib/attendanceMath.ts"
click node_theme "https://github.com/sreeshnave7-ship-it/attendance-calculator/blob/main/components/ThemeProvider.tsx"

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,node_subjectspage,node_trendspage,node_assistantpage,node_navbar,node_theme toneBlue
class node_subjectform,node_subjectcards,node_overallcalc,node_riskbanner,node_trendchart toneAmber
class node_nlpinput,node_chatwindow,node_timetableupload,node_chatapi,node_parseapi,node_riskapi,node_ocrapi toneMint
class node_claude,node_storage,node_hooks,node_math toneRose
class node_user toneIndigo
```

## Components

### App experience

- [Dashboard](https://github.com/sreeshnave7-ship-it/attendance-calculator/blob/main/app/page.tsx): `app/page.tsx`
- [Subjects page](https://github.com/sreeshnave7-ship-it/attendance-calculator/blob/main/app/subjects/page.tsx): `app/subjects/page.tsx`
- [Trends page](https://github.com/sreeshnave7-ship-it/attendance-calculator/blob/main/app/trends/page.tsx): `app/trends/page.tsx`
- [Assistant page](https://github.com/sreeshnave7-ship-it/attendance-calculator/blob/main/app/assistant/page.tsx): `app/assistant/page.tsx`
- [Navigation](https://github.com/sreeshnave7-ship-it/attendance-calculator/blob/main/components/Navbar.tsx): `components/Navbar.tsx`
- [Theme provider](https://github.com/sreeshnave7-ship-it/attendance-calculator/blob/main/components/ThemeProvider.tsx): `components/ThemeProvider.tsx`

### Attendance tracking

- [Subject form](https://github.com/sreeshnave7-ship-it/attendance-calculator/blob/main/components/SubjectForm.tsx): `components/SubjectForm.tsx`
- [Subject cards](https://github.com/sreeshnave7-ship-it/attendance-calculator/blob/main/components/SubjectCard.tsx): `components/SubjectCard.tsx`
- [Attendance simulator](https://github.com/sreeshnave7-ship-it/attendance-calculator/blob/main/components/OverallAttendanceCalculator.tsx): `components/OverallAttendanceCalculator.tsx`
- [Risk alerts](https://github.com/sreeshnave7-ship-it/attendance-calculator/blob/main/components/RiskAlertBanner.tsx): `components/RiskAlertBanner.tsx`
- [Trend chart](https://github.com/sreeshnave7-ship-it/attendance-calculator/blob/main/components/TrendChart.tsx): `components/TrendChart.tsx`

### AI features

- [Natural-language logger](https://github.com/sreeshnave7-ship-it/attendance-calculator/blob/main/components/NaturalLanguageInput.tsx): `components/NaturalLanguageInput.tsx`
- [Chat window](https://github.com/sreeshnave7-ship-it/attendance-calculator/blob/main/components/ChatWindow.tsx): `components/ChatWindow.tsx`
- [Timetable upload](https://github.com/sreeshnave7-ship-it/attendance-calculator/blob/main/components/TimetableUpload.tsx): `components/TimetableUpload.tsx`
- [Chat endpoint](https://github.com/sreeshnave7-ship-it/attendance-calculator/blob/main/app/api/chat/route.ts): `app/api/chat/route.ts`
- [Attendance parser](https://github.com/sreeshnave7-ship-it/attendance-calculator/blob/main/app/api/parse-attendance/route.ts): `app/api/parse-attendance/route.ts`
- [Risk prediction](https://github.com/sreeshnave7-ship-it/attendance-calculator/blob/main/app/api/predict-risk/route.ts): `app/api/predict-risk/route.ts`
- [Timetable OCR](https://github.com/sreeshnave7-ship-it/attendance-calculator/blob/main/app/api/ocr-timetable/route.ts): `app/api/ocr-timetable/route.ts`

### Core services

- [Claude client](https://github.com/sreeshnave7-ship-it/attendance-calculator/blob/main/lib/claudeClient.ts): `lib/claudeClient.ts`
- [Browser storage](https://github.com/sreeshnave7-ship-it/attendance-calculator/blob/main/lib/storage.ts): `lib/storage.ts`
- [Attendance data hook](https://github.com/sreeshnave7-ship-it/attendance-calculator/blob/main/lib/hooks.ts): `lib/hooks.ts`
- [Attendance calculations](https://github.com/sreeshnave7-ship-it/attendance-calculator/blob/main/lib/attendanceMath.ts): `lib/attendanceMath.ts`

### Other components

- **Student**

## Connections

- Student → Dashboard: uses (evidence: `README.md`)
- Student → Subjects page: manages subjects (evidence: `README.md`)
- Student → Trends page: reviews trends (evidence: `README.md`)
- Student → Assistant page: asks questions (evidence: `README.md`)
- Dashboard → Subject cards: renders (evidence: `app/page.tsx`)
- Dashboard → Attendance simulator: renders (evidence: `app/page.tsx`)
- Dashboard → Risk alerts: renders (evidence: `app/page.tsx`)
- Dashboard → Natural-language logger: renders (evidence: `app/page.tsx`)
- Dashboard → Browser storage: records attendance (evidence: `app/page.tsx`)
- Subjects page → Subject form: manages subjects
- Dashboard → Subject form: edits subjects (evidence: `app/page.tsx`)
- Trends page → Trend chart: renders (evidence: `app/trends/page.tsx`)
- Trends page → Attendance data hook: loads data (evidence: `app/trends/page.tsx`)
- Trends page → Browser storage: logs attendance (evidence: `app/trends/page.tsx`)
- Trends page → Attendance calculations: calculates trends (evidence: `app/trends/page.tsx`)
- Assistant page → Chat window: renders (evidence: `app/assistant/page.tsx`)
- Assistant page → Attendance data hook: loads data (evidence: `app/assistant/page.tsx`)
- Natural-language logger → Browser storage: reads and updates (evidence: `components/NaturalLanguageInput.tsx`)
- Chat window → Browser storage: reads history (evidence: `components/ChatWindow.tsx`)
- Attendance simulator → Attendance calculations: calculates estimates (evidence: `components/OverallAttendanceCalculator.tsx`)
- Attendance data hook → Browser storage: subscribes and reads (evidence: `lib/hooks.ts`)
- Dashboard → Navigation: includes navigation
- Navigation → Subject form: opens form (evidence: `app/client-layout.tsx`)
- Navigation → Timetable upload: opens import (evidence: `app/client-layout.tsx`)
- Timetable upload → Browser storage: imports subjects (evidence: `app/client-layout.tsx`)
- Natural-language logger → Attendance parser: submits text
- Chat window → Chat endpoint: sends messages
- Chat endpoint → Claude client: requests response (evidence: `app/api/chat/route.ts`)
- Chat endpoint → Attendance calculations: computes attendance (evidence: `app/api/chat/route.ts`)
- Attendance parser → Claude client: requests extraction (evidence: `app/api/parse-attendance/route.ts`)
- Timetable upload → Timetable OCR: uploads image
- Timetable OCR → Claude client: requests extraction (evidence: `app/api/ocr-timetable/route.ts`)
- Dashboard → Risk prediction: requests risk analysis
- Risk prediction → Claude client: requests prediction (evidence: `app/api/predict-risk/route.ts`)
- Trends page → Attendance calculations: calculates attendance (evidence: `app/trends/page.tsx`)
