# anton325/carpool architecture

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

- Interactive diagram: https://gitdiagram.com/anton325/carpool
- Repository: https://github.com/anton325/carpool

## Overview

##### Project Type and Purpose
- This is a standalone Python desktop application with a GUI front end.
- Purpose: load rider sign-up data from a Google-Form–exported Excel file, automatically assign riders to drivers by location, allow manual overrides, and prepare per-car group messages for iMessage.

##### File Structure
- Top-level scripts:
- gui.py – constructs and drives the user interface
- main.py – application entry point (invokes GUI)
- importTable.py – loads and parses the Excel sign-up sheet
- algorithm.py – assignment logic (location clustering and matching)
- person.py – data model representing riders and drivers
- textmessage.txt – template for generating group messages
- assets/ – UI mockups/screenshots used by gui.py
- responses.xlsx – sample payload from Google Forms
- requirements.txt – Python dependencies

##### Extract Insights from the README
- UI flow is three phases:
a. Start Screen: load Excel, customize outgoing message
b. Assignment Screen: run automatic matching, allow add/remove/reassign
c. Final Screen: display per-car phone lists for message copying
- No external services called at runtime other than file I/O; final message step is manual (iMessage).

##### Main Components and Their Interactions
a. Components
- User / GUI Layer (gui.py)
- Data Import Module (importTable.py)
- Domain Model (person.py)
- Assignment Engine (algorithm.py)
- Message Generator (textmessage.txt parser)
- File System (Excel in/out, templates)
- External Systems: Google Forms (pre-runtime), iMessage (post-runtime manual)
b. Relationships / Data Flows
1. User launches main.py → initializes GUI.
2. GUI “Load” action → Import Module reads responses.xlsx → Domain Model objects.
3. GUI passes model list to Assignment Engine → returns groupings.
4. GUI displays auto-assigned groups → user may invoke GUI methods to adjust (add/remove/reassign), updating the Domain Model.
5. GUI invokes Message Generator → reads textmessage.txt, merges with group data → renders phone-number lists.
6. User copies lists and pastes into iMessage.
c. Architectural Patterns
- MVC-like separation: gui.py (View+Controller), person.py (Model)
- Pipeline pattern: Import → Transform (Model) → Process (Algorithm) → Export (Message)
d. Key Technologies
- Python 3.x
- GUI library (e.g., Tkinter or PySimpleGUI – as imported in gui.py)
- openpyxl or pandas (for Excel parsing in importTable.py)

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% External Systems
    subgraph "External Systems"
        GF["Google Forms"]:::external
        IM["iMessage (manual paste)"]:::external
    end

    %% Persistence Layer
    subgraph "Persistence / Files"
        EXCEL["responses.xlsx"]:::persistence
        TXT["textmessage.txt"]:::persistence
        REQ["requirements.txt"]:::persistence
        MD["README.md"]:::persistence
        LIC["LICENSE.txt"]:::persistence
    end

    %% Data Import and Domain Model
    subgraph "Data & Domain"
        IT["importTable.py"]:::logic
        PM["person.py"]:::model
    end

    %% Logic Layer
    subgraph "Assignment & Generation Logic"
        ALGO["algorithm.py"]:::logic
        MSG["Message Generator"]:::logic
    end

    %% UI Layer
    subgraph "User & GUI Layer"
        MAIN["main.py"]:::ui
        GUI["gui.py"]:::ui
        ASSETS["assets/"]:::ui
    end

    %% Flow
    GF -->|"export Excel file"| EXCEL
    EXCEL -->|"read Excel"| IT
    IT -->|"create Person objects"| PM
    MAIN -->|"start application"| GUI
    GUI -->|"invoke import"| IT
    PM -->|"provide data list"| ALGO
    GUI -->|"run auto-assignment"| ALGO
    ALGO -->|"return groups"| GUI
    GUI -->|"manual override (add/remove/reassign)"| PM
    GUI -->|"invoke message gen"| MSG
    TXT -->|"read template"| MSG
    PM -->|"group data"| MSG
    MSG -->|"render phone lists"| GUI
    GUI -->|"display lists for copy"| IM

    %% Click Events
    click MAIN "https://github.com/anton325/carpool/blob/main/main.py"
    click GUI "https://github.com/anton325/carpool/blob/main/gui.py"
    click ASSETS "https://github.com/anton325/carpool/tree/main/assets/"
    click IT "https://github.com/anton325/carpool/blob/main/importTable.py"
    click EXCEL "https://github.com/anton325/carpool/blob/main/responses.xlsx"
    click PM "https://github.com/anton325/carpool/blob/main/person.py"
    click ALGO "https://github.com/anton325/carpool/blob/main/algorithm.py"
    click TXT "https://github.com/anton325/carpool/blob/main/textmessage.txt"
    click REQ "https://github.com/anton325/carpool/blob/main/requirements.txt"
    click MD "https://github.com/anton325/carpool/blob/main/README.md"
    click LIC "https://github.com/anton325/carpool/blob/main/LICENSE.txt"

    %% Styles
    classDef ui fill:#AED6F1,stroke:#1F618D,color:#1F618D
    classDef model fill:#A9DFBF,stroke:#27AE60,color:#145A32
    classDef logic fill:#F5CBA7,stroke:#D35400,color:#943126
    classDef persistence fill:#D5D8DC,stroke:#566573,color:#1B2631
    classDef external fill:#E8DAEF,stroke:#884EA0,color:#4A235A
```
