# tom1030507/ncu_course_selection_helper architecture

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

- Interactive diagram: https://gitdiagram.com/tom1030507/ncu_course_selection_helper
- Repository: https://github.com/tom1030507/ncu_course_selection_helper

## Overview

##### Project type and purpose
- This is a lightweight Python-based course‐selection helper (open-source CLI/notebook tool) that pulls enrollment data from NCU’s course system, computes per-wish cumulative counts and allocation probabilities, and presents the results in the console or Jupyter notebook.

##### Main components
a. User layer
- Student / end-user interacting via terminal or Colab notebook
b. Application layer
- `NCU_Course_Selection_Helper.py` – core Python script implementing data retrieval, parsing, calculation, and output
- `ncu_course_selection_helper.ipynb` – Jupyter front end in Colab for interactive runs
c. External system
- NCU Course Selection Web System (HTTP API/HTML pages)
d. Libraries/Dependencies
- HTTP client (e.g., requests)
- HTML parser (e.g., BeautifulSoup)
- Data processing (e.g., pandas or built-ins)
e. Data flow / persistence
- Input: user-supplied course IDs (`course_numbers`)
- Output: console or notebook tables, probability reports
- Optional local storage (e.g., saving snapshots on disk or cloud)

##### Relationships and interactions
- The user invokes the script or notebook → The tool issues HTTP GET requests to NCU’s selection pages → Receives HTML → Parser extracts “cumulative students” and “seat limits” → Probability calculator computes allocation odds per wish position → Results are returned to the user interface (terminal or notebook) → Optionally write results to local file (e.g., JSON/CSV)

##### Architectural patterns and design principles
- Simple linear pipeline: Input → Fetch → Parse → Compute → Output
- Separation of concerns:
- Networking module (HTTP + retry logic)
- Parsing module (HTML→structured data)
- Calculation module (probability formulas)
- Presentation module (CLI print or Jupyter display)
- Extensibility point: Add new data sources or custom output formats by plugging into the pipeline

- Clear component labels (e.g., “HTTP Client”, “HTML Parser”)
- Optional inset showing Colab badge → Notebook environment

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% User Layer
    subgraph "User Layer"
        Terminal["Terminal CLI"]:::ui
        Notebook["ncu_course_selection_helper.ipynb"]:::ui
    end

    %% Application Layer
    subgraph "Application Layer"
        AppScript["NCU_Course_Selection_Helper.py"]:::module
        Net["HTTP Client\n(requests)"]:::module
        Parser["HTML Parser\n(BeautifulSoup)"]:::module
        Calc["Calculation Module"]:::module
        Pres["Presentation Module"]:::module
    end

    %% External System
    Cloud["NCU Course Selection Web System"]:::external

    %% Data Store
    Storage["Local Storage\n(JSON/CSV)"]:::storage

    %% Dependencies
    subgraph "Libraries/Dependencies"
        Req["requests"]:::dep
        BS["BeautifulSoup"]:::dep
        PD["pandas"]:::dep
    end

    %% Documentation
    README["README.md"]:::doc

    %% Data Flow
    Terminal -->|"Input: course_numbers"| AppScript
    Notebook -->|"Interactive Run"| AppScript
    AppScript -->|"HTTP GET"| Cloud
    Cloud -->|"HTML"| Net
    Net -->|"Response HTML"| Parser
    Parser -->|"Parsed Data (JSON)"| Calc
    Calc -->|"Computed Probabilities"| Pres
    Pres -->|"Console Output"| Terminal
    Pres -->|"Notebook Output"| Notebook
    Pres -->|"Optional Save"| Storage

    %% Dependency Links
    Req --> Net
    BS --> Parser
    PD --> Calc
    PD --> Pres

    %% Documentation Link
    README

    %% Click Events
    click AppScript "https://github.com/tom1030507/ncu_course_selection_helper/blob/main/NCU_Course_Selection_Helper.py"
    click Notebook "https://github.com/tom1030507/ncu_course_selection_helper/blob/main/ncu_course_selection_helper.ipynb"
    click README "https://github.com/tom1030507/ncu_course_selection_helper/blob/main/README.md"

    %% Styles
    classDef ui fill:#b0f2b6,stroke:#333,stroke-width:1px
    classDef module fill:#b3d1f2,stroke:#333,stroke-width:1px
    classDef external fill:#f2c08d,stroke:#333,stroke-width:1px
    classDef dep fill:#d3d3d3,stroke:#333,stroke-width:1px
    classDef storage fill:#cccccc,stroke:#333,stroke-width:1px
    classDef doc fill:#e3b2f2,stroke:#333,stroke-width:1px
```
