# gladw-in/movie-ticket-booking architecture

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

- Interactive diagram: https://gitdiagram.com/gladw-in/movie-ticket-booking
- Repository: https://github.com/gladw-in/movie-ticket-booking

## Overview

##### Project’s Main Components
- Command/Scripts Layer: There are three key CMD files – bank.cmd, db.cmd, and login.cmd. These scripts trigger different operational phases: setting up a bank account (depositing money), ensuring the proper configuration/creation of the database, and starting the administrator login process.
- Application Logic Modules: Inside the “files” directory, there are multiple Python scripts acting as the application’s core. For example:
- DB_config.py: Manages database connectivity and configurations.
- main.py: Likely serves as the main entry point for administrative operations.
- admin.py and admin_movie.csv: Likely handle administrative functionalities and might include movie-specific administrative tasks.
- login.py and users.py: Coordinate user authentication and management.
- banking.py: Contains logic for handling banking transactions.
- Data/Persistence Layer: The project uses both a MySQL database (as indicated by the SQL script in files/sql/movie_ticketbooking.sql) and CSV files (like acc.csv and admin_movie.csv) for storing account and possibly other transactional data.
- Assets: The “img” and “movie images” directories store visual assets used in the application, possibly for the UI or promotional materials.

##### Relationships and Interactions
- The CMD scripts serve as entry points that sequentially set up banking details, configure or verify the database, and finally enable the administrator to log in.
- Once logged in, the application logic (running primarily from main.py and coordinated with other modules like admin.py, login.py, and users.py) communicates with the MySQL database through the DB_config.py module.
- Banking transactions initiated via bank.cmd and handled in banking.py interact with CSV data (acc.csv) and possibly with the database to update account and payment details.
- Integration of graphical assets (using Pillow as indicated by the dependency) is likely used to render images in the UI or reports.

##### Architectural Patterns and Design Principles
- Presentation (CMD scripts triggering actions)
- Business Logic (Python modules handling core functions)
- Data Persistence (MySQL for structured data and CSV files for additional records)
- The design reflects modular programming where each script is responsible for a specific functionality, making the overall system easier to maintain and extend.

##### Technologies and Frameworks
- MySQL is used (with mysql.connector) for database operations.
- Pandas is likely leveraged for data manipulation of CSV files.
- Pillow is included for image processing.
- The project targets Python 3.11, ensuring modern language capabilities.

- Separate nodes for:
- Bank Operations (bank.cmd → banking.py → acc.csv)
- Database Setup/Verification (db.cmd → DB_config.py → MySQL database)
- Authentication & Ticket Booking (login.cmd → login.py/users.py → main.py → admin.py)
- Annotations for modular responsibilities and any conditional flows or error handling logic (for instance, what happens if the database isn’t set up properly).

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Global Entity
    Admin["Administrator/User"]:::external

    %% CMD/Trigger Layer
    subgraph "CMD/Trigger Layer"
        CMD1["bank.cmd"]:::cmd
        CMD2["db.cmd"]:::cmd
        CMD3["login.cmd"]:::cmd
    end

    %% Application Logic Modules
    subgraph "Application Logic Modules"
        DBConfig["DB_config.py"]:::module
        Main["main.py"]:::module
        AdminModule["admin.py"]:::module
        LoginModule["login.py"]:::module
        Users["users.py"]:::module
        Banking["banking.py"]:::module
        AdminCSV["admin_movie.csv"]:::file
    end

    %% Data/Persistence Layer
    subgraph "Data/Persistence Layer"
        MySQL["MySQL Database (movie_ticketbooking.sql)"]:::database
        AccCSV["CSV Data (acc.csv)"]:::csv
    end

    %% Asset Layer
    subgraph "Asset Layer"
        Img["Image Assets"]:::asset
        MovieImg["Movie Images"]:::asset
    end

    %% Connections from Administrator to CMD scripts
    Admin -->|"triggers"| CMD1
    Admin -->|"triggers"| CMD2
    Admin -->|"triggers"| CMD3

    %% CMD scripts trigger application modules
    CMD1 -->|"initiates"| Banking
    CMD2 -->|"initiates"| DBConfig
    CMD3 -->|"initiates"| LoginModule

    %% Application interconnections
    DBConfig -->|"connects"| MySQL
    Banking -->|"updates"| AccCSV
    LoginModule -->|"authenticates"| Users
    LoginModule -->|"calls"| Main
    Main -->|"manages"| AdminModule
    AdminModule -->|"handles"| AdminCSV

    %% Asset usage by application layer
    Main ---|"renders"| Img
    Main ---|"renders"| MovieImg

    %% Click Events for CMD/Trigger Layer
    click CMD1 "https://github.com/gladw-in/movie-ticket-booking/blob/main/bank.cmd"
    click CMD2 "https://github.com/gladw-in/movie-ticket-booking/blob/main/db.cmd"
    click CMD3 "https://github.com/gladw-in/movie-ticket-booking/blob/main/login.cmd"

    %% Click Events for Application Logic Modules
    click DBConfig "https://github.com/gladw-in/movie-ticket-booking/blob/main/files/DB_config.py"
    click Main "https://github.com/gladw-in/movie-ticket-booking/blob/main/files/main.py"
    click AdminModule "https://github.com/gladw-in/movie-ticket-booking/blob/main/files/admin.py"
    click LoginModule "https://github.com/gladw-in/movie-ticket-booking/blob/main/files/login.py"
    click Users "https://github.com/gladw-in/movie-ticket-booking/blob/main/files/users.py"
    click Banking "https://github.com/gladw-in/movie-ticket-booking/blob/main/files/banking.py"
    click AdminCSV "https://github.com/gladw-in/movie-ticket-booking/blob/main/files/admin_movie.csv"

    %% Click Events for Data/Persistence Layer
    click MySQL "https://github.com/gladw-in/movie-ticket-booking/blob/main/files/sql/movie_ticketbooking.sql"
    click AccCSV "https://github.com/gladw-in/movie-ticket-booking/blob/main/files/acc.csv"

    %% Click Events for Asset Layer
    click Img "https://github.com/gladw-in/movie-ticket-booking/tree/main/files/img"
    click MovieImg "https://github.com/gladw-in/movie-ticket-booking/tree/main/files/movie images"

    %% Styles
    classDef external fill:#FFD700,stroke:#DAA520,stroke-width:2px;
    classDef cmd fill:#ADD8E6,stroke:#000,stroke-width:1px;
    classDef module fill:#90EE90,stroke:#000,stroke-width:1px;
    classDef file fill:#FFC0CB,stroke:#000,stroke-width:1px;
    classDef database fill:#FFA500,stroke:#000,stroke-width:1px;
    classDef csv fill:#FFB6C1,stroke:#000,stroke-width:1px;
    classDef asset fill:#D3D3D3,stroke:#000,stroke-width:1px;
```
