# chinmaye5/m4c_assignment architecture

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

- Interactive diagram: https://gitdiagram.com/chinmaye5/m4c_assignment
- Repository: https://github.com/chinmaye5/m4c_assignment

## Overview

This Next.js app turns monthly school-response and grant CSV data into two user-facing results: a filterable PBL program review and a traceable grant-report preview. The workflow loads normalized data, computes metrics and risk explanations, then renders summaries or grant facts, finance, milestones, media, and tagged report sentences. CSV normalization is documented, but its seed script is excluded as setup machinery. Edges are limited to relationships visible in excerpts or stated in the README; unsampled capabilities use supported directory paths.

Main entry points: [`app/grants/page.tsx`](https://github.com/chinmaye5/m4c_assignment/blob/main/app/grants/page.tsx) (Grant report view), [`lib/grants.ts`](https://github.com/chinmaye5/m4c_assignment/blob/main/lib/grants.ts) (Grant facts and writer), [`app/page.tsx`](https://github.com/chinmaye5/m4c_assignment/blob/main/app/page.tsx) (Review dashboard), [`lib/data.ts`](https://github.com/chinmaye5/m4c_assignment/blob/main/lib/data.ts) (Data loader)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_review["Program Review"]
  node_review_page["Review dashboard<br/>[page.tsx]"]
  node_meeting["Meeting summary<br/>[metrics.ts]"]
end

subgraph group_grant["Grant Reporting"]
  node_grant_page["Grant report view<br/>[page.tsx]"]
  node_report_copy["Copy and print<br/>[CopyButton.tsx]"]
  node_grant_engine["Grant facts and writer<br/>[grants.ts]"]
  node_grant_finance["Finance and milestones<br/>[grants.ts]"]
  node_grant_media["Evidence and media<br/>[grants.ts]"]
end

subgraph group_core["Data and Analysis"]
  node_metrics["Metrics and rankings<br/>[metrics.ts]"]
  node_risk["Risk classification<br/>[risk.ts]"]
  node_data_loader["Data loader<br/>[data.ts]"]
end

subgraph group_inputs["Source Data"]
  node_school_csv["Monthly PBL responses"]
  node_grant_csv["Grant finance and profile"]
  node_performance_csv["Grant performance"]
  node_media_csv["Evidence index"]
  node_generated_data[("Normalized data file")]
  node_evidence_assets["Evidence images"]
end

node_reviewer(("Program reviewer"))
node_reporter(("Grant reporter"))

node_reviewer -->|"filters review"| node_review_page
node_review_page -->|"reads schools"| node_data_loader
node_review_page -->|"computes dashboard"| node_metrics
node_review_page -->|"uses thresholds"| node_risk
node_metrics -->|"selects rows"| node_data_loader
node_metrics -->|"classifies scores"| node_risk
node_review_page -->|"renders summary"| node_meeting
node_reporter -->|"chooses report"| node_grant_page
node_grant_page -->|"reads months"| node_data_loader
node_grant_page -->|"requests facts"| node_grant_engine
node_grant_page -->|"labels statuses"| node_risk
node_grant_engine -->|"reads grant data"| node_data_loader
node_grant_engine -->|"summarizes schools"| node_metrics
node_grant_engine -->|"classifies facts"| node_risk
node_grant_page -->|"provides report text"| node_report_copy
node_grant_page -->|"renders images"| node_evidence_assets
node_school_csv -.->|"normalized into"| node_generated_data
node_grant_csv -.->|"normalized into"| node_generated_data
node_performance_csv -.->|"normalized into"| node_generated_data
node_media_csv -.->|"normalized into"| node_generated_data
node_data_loader -->|"loads JSON"| node_generated_data
node_grant_engine -->|"computes finance"| node_grant_finance
node_grant_engine -->|"selects linked media"| node_grant_media

click node_review_page "https://github.com/chinmaye5/m4c_assignment/blob/main/app/page.tsx"
click node_meeting "https://github.com/chinmaye5/m4c_assignment/blob/main/lib/metrics.ts"
click node_grant_page "https://github.com/chinmaye5/m4c_assignment/blob/main/app/grants/page.tsx"
click node_report_copy "https://github.com/chinmaye5/m4c_assignment/blob/main/app/CopyButton.tsx"
click node_grant_engine "https://github.com/chinmaye5/m4c_assignment/blob/main/lib/grants.ts"
click node_grant_finance "https://github.com/chinmaye5/m4c_assignment/blob/main/lib/grants.ts"
click node_grant_media "https://github.com/chinmaye5/m4c_assignment/blob/main/lib/grants.ts"
click node_metrics "https://github.com/chinmaye5/m4c_assignment/blob/main/lib/metrics.ts"
click node_risk "https://github.com/chinmaye5/m4c_assignment/blob/main/lib/risk.ts"
click node_data_loader "https://github.com/chinmaye5/m4c_assignment/blob/main/lib/data.ts"
click node_school_csv "https://github.com/chinmaye5/m4c_assignment/tree/main/data/pbl"
click node_grant_csv "https://github.com/chinmaye5/m4c_assignment/blob/main/data/grant/01_Grant_Profile_and_Finance.csv"
click node_performance_csv "https://github.com/chinmaye5/m4c_assignment/blob/main/data/grant/02_Grant_Performance_and_Report_Material.csv"
click node_media_csv "https://github.com/chinmaye5/m4c_assignment/blob/main/data/grant/03_Evidence_and_Media_Index.csv"
click node_evidence_assets "https://github.com/chinmaye5/m4c_assignment/tree/main/public/evidence"

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_review_page,node_meeting,node_reviewer toneBlue
class node_grant_page,node_report_copy,node_grant_engine,node_grant_finance,node_grant_media toneAmber
class node_metrics,node_risk,node_data_loader toneMint
class node_school_csv,node_grant_csv,node_performance_csv,node_media_csv,node_generated_data,node_evidence_assets toneRose
class node_reporter toneIndigo
```

## Components

### Program Review

- [Review dashboard](https://github.com/chinmaye5/m4c_assignment/blob/main/app/page.tsx): `app/page.tsx`
- [Meeting summary](https://github.com/chinmaye5/m4c_assignment/blob/main/lib/metrics.ts): `lib/metrics.ts`

### Grant Reporting

- [Grant report view](https://github.com/chinmaye5/m4c_assignment/blob/main/app/grants/page.tsx): `app/grants/page.tsx`
- [Copy and print](https://github.com/chinmaye5/m4c_assignment/blob/main/app/CopyButton.tsx): `app/CopyButton.tsx`
- [Grant facts and writer](https://github.com/chinmaye5/m4c_assignment/blob/main/lib/grants.ts): `lib/grants.ts`
- [Finance and milestones](https://github.com/chinmaye5/m4c_assignment/blob/main/lib/grants.ts): `lib/grants.ts`
- [Evidence and media](https://github.com/chinmaye5/m4c_assignment/blob/main/lib/grants.ts): `lib/grants.ts`

### Data and Analysis

- [Metrics and rankings](https://github.com/chinmaye5/m4c_assignment/blob/main/lib/metrics.ts): `lib/metrics.ts`
- [Risk classification](https://github.com/chinmaye5/m4c_assignment/blob/main/lib/risk.ts): `lib/risk.ts`
- [Data loader](https://github.com/chinmaye5/m4c_assignment/blob/main/lib/data.ts): `lib/data.ts`

### Source Data

- [Monthly PBL responses](https://github.com/chinmaye5/m4c_assignment/tree/main/data/pbl): `data/pbl`
- [Grant finance and profile](https://github.com/chinmaye5/m4c_assignment/blob/main/data/grant/01_Grant_Profile_and_Finance.csv): `data/grant/01_Grant_Profile_and_Finance.csv`
- [Grant performance](https://github.com/chinmaye5/m4c_assignment/blob/main/data/grant/02_Grant_Performance_and_Report_Material.csv): `data/grant/02_Grant_Performance_and_Report_Material.csv`
- [Evidence index](https://github.com/chinmaye5/m4c_assignment/blob/main/data/grant/03_Evidence_and_Media_Index.csv): `data/grant/03_Evidence_and_Media_Index.csv`
- **Normalized data file**
- [Evidence images](https://github.com/chinmaye5/m4c_assignment/tree/main/public/evidence): `public/evidence`

### Other components

- **Program reviewer**
- **Grant reporter**

## Connections

- Program reviewer → Review dashboard: filters review (evidence: `app/page.tsx`)
- Review dashboard → Data loader: reads schools (evidence: `app/page.tsx`)
- Review dashboard → Metrics and rankings: computes dashboard (evidence: `app/page.tsx`)
- Review dashboard → Risk classification: uses thresholds (evidence: `app/page.tsx`)
- Metrics and rankings → Data loader: selects rows (evidence: `lib/metrics.ts`)
- Metrics and rankings → Risk classification: classifies scores (evidence: `lib/metrics.ts`)
- Review dashboard → Meeting summary: renders summary (evidence: `app/page.tsx`)
- Grant reporter → Grant report view: chooses report (evidence: `app/grants/page.tsx`)
- Grant report view → Data loader: reads months (evidence: `app/grants/page.tsx`)
- Grant report view → Grant facts and writer: requests facts (evidence: `app/grants/page.tsx`)
- Grant report view → Risk classification: labels statuses (evidence: `app/grants/page.tsx`)
- Grant facts and writer → Data loader: reads grant data (evidence: `lib/grants.ts`)
- Grant facts and writer → Metrics and rankings: summarizes schools (evidence: `lib/grants.ts`)
- Grant facts and writer → Risk classification: classifies facts (evidence: `lib/grants.ts`)
- Grant report view → Copy and print: provides report text (evidence: `app/grants/page.tsx`)
- Grant report view → Evidence images: renders images (evidence: `app/grants/page.tsx`)
- Monthly PBL responses → Normalized data file: normalized into (evidence: `README.md`)
- Grant finance and profile → Normalized data file: normalized into (evidence: `README.md`)
- Grant performance → Normalized data file: normalized into (evidence: `README.md`)
- Evidence index → Normalized data file: normalized into (evidence: `README.md`)
- Data loader → Normalized data file: loads JSON (evidence: `lib/data.ts`)
- Grant facts and writer → Finance and milestones: computes finance (evidence: `lib/grants.ts`)
- Grant facts and writer → Evidence and media: selects linked media (evidence: `lib/grants.ts`)
