# ghostfrankwu/sustech_tools architecture

> Architecture diagram of the GitHub repository ghostfrankwu/sustech_tools, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-02-17). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ghostfrankwu/sustech_tools
- Repository: https://github.com/ghostfrankwu/sustech_tools

## Overview

##### Main components
- Main Program (main.py): This is the central controller that orchestrates the course selection process.
- Configuration/Input File (class.txt): Contains the list of courses (ordered by priority) that the script should attempt to register for.
- External Systems:
- TIS Server: The course registration system which the script communicates with.
- CAS (Central Authentication Service): Used for login/authentication where applicable.
- Visual Components (screenShots folder): Contains images for help and UI feedback, which, while not functional components of the code, give context about the user interface.

##### Relationships and interactions
- The script (main.py) reads the course configuration from class.txt on startup.
- It then enters a loop (triggered when the user presses return) that, every 3 seconds, attempts to register the highest-priority course. This involves:
- Constructing and sending network requests to the TIS system.
- Dealing with authentication through CAS where necessary.
- The documentation (README) describes how the request scheduling works (priority order, manual intervention to skip courses), so include a component for flow management/control logic.

##### Architectural patterns or design principles
- Separation of Concerns: Even though it’s a single Python file, there is a clear distinction between:
- Data Input (course list from class.txt)
- Processing Logic (course selection loop and request dispatch)
- Network Communication (interaction with TIS and CAS endpoints)
- Dependency on external systems is critical (TIS, CAS), so ensure these are clearly depicted.
- Timing and concurrency (multiple cycles if the enter key is pressed) are also factors – indicate that the script might run concurrent time-cycles.

##### Relevant technologies and frameworks
- Python 3 (with a minimal version requirement of 3.6+)
- Standard libraries for network operations (likely requests or similar, though not explicitly shown in the file tree)
- Any additional libraries if imported in main.py (though not exposited in the tree, it may be inferred from the operational context).

- Data flow within a single executable script:
- Input (class.txt) → Core Logic (main.py: reading, decision making, timing loop) → Network Communication (interacting with TIS and CAS).
- Although not a full-stack application with distinct frontend and backend layers, mark the boundaries between local processing (the script’s logic) and external service interactions.
- For completeness, designate external dependencies and note any user-triggered events (the manual skip via enter key).

- “Configuration Input (class.txt)”
- “Main Control Loop (main.py)” with a note on “3-second cycle, priority-based selection”
- “TIS Backend Service” and “CAS Authentication Service”
- “User Interface / Visual Feedback” indicating where screenshots are used for help and interface display.
- Another for processing logic (main.py),
- And a third for external services (TIS, CAS).

## Diagram (Mermaid)

```mermaid
flowchart TD
    A["Configuration Input (class.txt)"]:::input
    B["Main Control Loop (main.py)\n(3-second cycle, priority-based selection)"]:::logic
    C["TIS Backend Service"]:::external
    D["CAS Authentication Service"]:::external
    E["User Interface / Visual Feedback"]:::input

    A -->|"reads"| B
    B -->|"register_request(流量限制)"| C
    B -->|"auth_request(流量限制)"| D
    C -->|"response"| B
    D -->|"response"| B
    B -->|"UI_update"| E

    click A "https://github.com/ghostfrankwu/sustech_tools/blob/master/class.txt"
    click B "https://github.com/ghostfrankwu/sustech_tools/blob/master/main.py"
    click E "https://github.com/ghostfrankwu/sustech_tools/tree/master/screenShots"

    classDef input fill:#FFE0B2,stroke:#E65100,stroke-width:2px;
    classDef logic fill:#B3E5FC,stroke:#01579B,stroke-width:2px;
    classDef external fill:#C8E6C9,stroke:#2E7D32,stroke-width:2px;
```
