How ovladisluvv/gradetrack works
Purpose and entry points
GradeTrack is a Python 3.12 desktop application for MSU students. It authenticates against lk.msu.ru, retrieves grade HTML, calculates averages, and evaluates whether an honors diploma is reachable. GUI startup is src/gui/app.py (python -m gui.app from src); packaged startup is defined by GradeTrack.spec.
Layered application boundary
The repository uses a deliberate downward dependency structure: GUI orchestrates services; services combine web I/O with pure core logic; core does not perform network I/O. Package boundaries are represented by:
• src/gui/__init__.py
• src/services/__init__.py
• src/core/__init__.py
This separation permits analysis of saved HTML without network access and keeps portal-specific behavior out of grading rules.
Portal access and scraping
src/web owns the authenticated HTTP session with the external MSU personal-account service. Authentication obtains CSRF state and submits credentials; failures become typed domain exceptions. Scraping returns raw grades-page HTML only, leaving its interpretation to core.
• src/web/auth.py
• src/web/scraper.py
• src/web/exceptions.py
The material external dependency is lk.msu.ru; its authentication flow and page markup are integration boundaries prone to upstream change.
Grade ingestion and normalization
Core converts fetched or saved HTML into structured grade records, then filters unusable/unpassed entries and maps textual grades to numeric values. During preprocessing, each record is also classified as diploma-relevant.
• src/core/parser.py
• src/core/preprocessor.py
• src/core/grade_models.py
Flow: HTML → GradeInfo-style models → normalized numeric grades plus in_diploma classification. This is the principal boundary between unstable portal markup and stable analytical inputs.
Diploma curriculum data
Diploma inclusion is data-driven rather than hard-coded. The selector resolves subject lists by faculty, program, department, and semester; early semesters use program-level files, while later semesters can use department-specific lists.
• src/core/diploma_subjects.py
• data/in_diploma/vmk/fiit/sem1.txt
• data/in_diploma/vmk/pmi/ani/sem5.txt
The provided curriculum coverage makes honors-diploma analysis materially targeted at VMK bachelor programs. University-selection structure is supplied separately through data/university_structure.yaml.
Analysis and service orchestration
The analyzer calculates averages with and without retake penalties, optional semester ranges, diploma-grade distribution, and honors-diploma reachability. grades_service is the application-facing facade: one path runs scrape-to-analysis, another accepts preexisting HTML.
• src/core/analyzer.py
• src/services/grades_service.py
• data/test_grades.html
Control flow is GUI/user choices → service → authenticated scrape (or saved HTML) → parse/preprocess/curriculum tagging → analysis result → GUI rendering.
Desktop runtime, state, and delivery
PyQt6 provides the only user interface: a terminal-styled wizard collects credentials and academic selections, maintains navigation/session state, and moves blocking portal work to a background thread. Configuration and data paths support both source and PyInstaller execution.
• src/gui/state_manager.py
• src/gui/wizard_view.py
• src/gui/terminal_view.py
Deployment supports native PyInstaller binaries and Dockerized GUI execution with X11/OpenGL. Docker mounts config and data, so those are runtime-editable inputs; image publishing and releases are automated via .github/workflows/docker-publish.yml and .github/workflows/release.yml.
Main entry points: grades_service.py Grades facade · wizard_view.py Wizard views · preprocessor.py Grade normalizer · GradeTrack.spec PyInstaller build
Components 18
Desktop UI
PyQt6 wizard runtime.
- GUI startup
src/gui/app.py - Wizard views · Collects credentials and academic selections.
src/gui/wizard_view.py - Terminal view · Renders analysis output.
src/gui/terminal_view.py - Navigation state · Maintains wizard and session state.
src/gui/state_manager.py
Application Service
- Grades facade · Supports portal scraping and saved-HTML analysis.
src/services/grades_service.py - Saved grade HTML · Allows analysis without portal access.
data/test_grades.html
Core Analysis
Pure parsing, normalization, and diploma rules.
- HTML parser · Converts portal or saved HTML into grade records.
src/core/parser.py - Grade normalizer · Filters records, maps grades, and tags diploma relevance.
src/core/preprocessor.py - Grade records · Structured GradeInfo-style analytical inputs.
src/core/grade_models.py - Diploma selector · Resolves subject lists by program, department, and semester.
src/core/diploma_subjects.py - VMK curriculum lists · Program and department-specific diploma subjects.
data/in_diploma/vmk/fiit/sem1.txt - Honors analyzer · Calculates averages, distributions, and diploma reachability.
src/core/analyzer.py
Portal & Delivery
- Portal authentication · Obtains CSRF state and maps failures to typed exceptions.
src/web/auth.py - Grade HTML scraper · Returns raw grades-page HTML.
src/web/scraper.py - lk.msu.ru · Upstream authentication and markup boundary.
- PyInstaller build · Defines packaged application startup.
GradeTrack.spec - Docker publishing · Builds and publishes the GUI image.
.github/workflows/docker-publish.yml - Release automation · Publishes native releases.
.github/workflows/release.yml
Connections 19
- GUI startup → Wizard views: starts
- Wizard views → Navigation state: updates
- Wizard views → Grades facade: submits choices
- Grades facade → Portal authentication: authenticates
- Portal authentication → lk.msu.ru: CSRF and credentials
- Grades facade → Grade HTML scraper: fetches grades
- Grade HTML scraper → lk.msu.ru: requests grades page
- Grades facade → Saved grade HTML: accepts offline input
- Grades facade → HTML parser: passes HTML
- HTML parser → Grade records: creates
- Grade records → Grade normalizer: normalizes
- Grade normalizer → Diploma selector: checks inclusion
- Diploma selector → VMK curriculum lists: loads subject lists
- Grade normalizer → Honors analyzer: provides tagged grades
- Honors analyzer → Grades facade: returns result
- Grades facade → Terminal view: renders result
- PyInstaller build → GUI startup: packages entry point
- Docker publishing → PyInstaller build: delivers image build
- Release automation → PyInstaller build: publishes binaries