# isaknyberg/kth-gpa-calculator architecture

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

- Interactive diagram: https://gitdiagram.com/isaknyberg/kth-gpa-calculator
- Repository: https://github.com/isaknyberg/kth-gpa-calculator

## Overview

KTH GPA Calculator is a browser-based tool for parsing a Ladok transcript PDF, calculating KTH GPA, and letting users adjust courses and export results. Its main workflow is upload or drop PDF → extract course rows → manage and grade courses → display GPA and credits. The README also promises local-only processing and simulation by adding or editing courses. The sampled sources show these core interactions; the separate Swedish and English pages are not mapped because their runtime wiring was not shown.

Main entry points: [`script.js`](https://github.com/isaknyberg/kth-gpa-calculator/blob/main/script.js) (Upload and parsing), [`CourseList.js`](https://github.com/isaknyberg/kth-gpa-calculator/blob/main/CourseList.js) (Course collection), [`Course.js`](https://github.com/isaknyberg/kth-gpa-calculator/blob/main/Course.js) (Course model)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_workflow["Transcript workflow"]
  node_upload["Upload and parsing<br/>[script.js]"]
end

subgraph group_domain["Course and GPA"]
  node_course["Course model<br/>[Course.js]"]
  node_course_list["Course collection<br/>[CourseList.js]"]
  node_grade_tables["Grade tables<br/>[script.js]"]
  node_gpa["GPA and credits<br/>[CourseList.js]"]
end

subgraph group_interface["Results interface"]
  node_course_table["Editable course table<br/>[script.js]"]
  node_summary["GPA summary<br/>[script.js]"]
  node_csv["CSV download<br/>[script.js]"]
end

node_user(("User"))
node_transcript["Ladok PDF"]
node_pdfjs["PDF.js"]

node_user -->|"selects file"| node_upload
node_transcript -->|"provides PDF"| node_upload
node_upload -->|"loads document"| node_pdfjs
node_upload -->|"creates parsed courses"| node_course
node_upload -->|"builds collection"| node_course_list
node_course_list -->|"adds and grades"| node_course
node_course_list -->|"applies grading"| node_grade_tables
node_course_list -->|"calculates"| node_gpa
node_upload -->|"renders courses"| node_course_table
node_course_table -->|"updates course inclusion"| node_gpa
node_gpa -->|"supplies totals"| node_summary
node_user -->|"edits courses"| node_course_table
node_user -->|"requests export"| node_csv
node_csv -->|"serializes courses"| node_course_list

click node_upload "https://github.com/isaknyberg/kth-gpa-calculator/blob/main/script.js"
click node_course "https://github.com/isaknyberg/kth-gpa-calculator/blob/main/Course.js"
click node_course_list "https://github.com/isaknyberg/kth-gpa-calculator/blob/main/CourseList.js"
click node_grade_tables "https://github.com/isaknyberg/kth-gpa-calculator/blob/main/script.js"
click node_gpa "https://github.com/isaknyberg/kth-gpa-calculator/blob/main/CourseList.js"
click node_course_table "https://github.com/isaknyberg/kth-gpa-calculator/blob/main/script.js"
click node_summary "https://github.com/isaknyberg/kth-gpa-calculator/blob/main/script.js"
click node_csv "https://github.com/isaknyberg/kth-gpa-calculator/blob/main/script.js"

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_upload,node_user toneBlue
class node_course,node_course_list,node_grade_tables,node_gpa toneAmber
class node_course_table,node_summary,node_csv toneMint
class node_transcript,node_pdfjs toneIndigo
```

## Components

### Transcript workflow

- [Upload and parsing](https://github.com/isaknyberg/kth-gpa-calculator/blob/main/script.js): `script.js`

### Course and GPA

- [Course model](https://github.com/isaknyberg/kth-gpa-calculator/blob/main/Course.js): `Course.js`
- [Course collection](https://github.com/isaknyberg/kth-gpa-calculator/blob/main/CourseList.js): `CourseList.js`
- [Grade tables](https://github.com/isaknyberg/kth-gpa-calculator/blob/main/script.js): `script.js`
- [GPA and credits](https://github.com/isaknyberg/kth-gpa-calculator/blob/main/CourseList.js): `CourseList.js`

### Results interface

- [Editable course table](https://github.com/isaknyberg/kth-gpa-calculator/blob/main/script.js): `script.js`
- [GPA summary](https://github.com/isaknyberg/kth-gpa-calculator/blob/main/script.js): `script.js`
- [CSV download](https://github.com/isaknyberg/kth-gpa-calculator/blob/main/script.js): `script.js`

### Other components

- **User**
- **Ladok PDF**
- **PDF.js**

## Connections

- User → Upload and parsing: selects file (evidence: `script.js`)
- Ladok PDF → Upload and parsing: provides PDF (evidence: `script.js`)
- Upload and parsing → PDF.js: loads document (evidence: `script.js`)
- Upload and parsing → Course model: creates parsed courses (evidence: `script.js`)
- Upload and parsing → Course collection: builds collection (evidence: `script.js`)
- Course collection → Course model: adds and grades (evidence: `CourseList.js`)
- Course collection → Grade tables: applies grading (evidence: `script.js`)
- Course collection → GPA and credits: calculates (evidence: `CourseList.js`)
- Upload and parsing → Editable course table: renders courses (evidence: `script.js`)
- Editable course table → GPA and credits: updates course inclusion (evidence: `script.js`)
- GPA and credits → GPA summary: supplies totals (evidence: `script.js`)
- User → Editable course table: edits courses (evidence: `script.js`)
- User → CSV download: requests export (evidence: `script.js`)
- CSV download → Course collection: serializes courses (evidence: `script.js`)
