# mehadi-trackrep/event-registration architecture

> Architecture diagram of the GitHub repository mehadi-trackrep/event-registration, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-03-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/mehadi-trackrep/event-registration
- Repository: https://github.com/mehadi-trackrep/event-registration

## Overview

##### Main Components
- Tally Form Registration: Representing the user input on the tally form (registration data).
- Google Sheet Database: The central data repository where registration data is stored and updated.
- Google Cloud Service Account: This is set up through the credentials.json file and is used for programmatically accessing the Google Sheets data.
- Google Apps Script Web API: (app_scripts_web_api.js) that provides an interface for retrieving events from the Google Sheet.
- Chart and Analytics Generator: The Python script (generate_charts.py) that fetches data from the Google Sheet and creates visualizations.
- SMS Android Application: Located in the SMS-App directory, developed using MIT App Inventor, which fetches event data via the Apps Script Web API.
- Supporting Documentation/Configuration: Files like sheet_queries.md (for translated/instructional info on querying) and tally-form-images for assets.

##### Relationships and Data Flow
- Registration Process: The tally form collects user registration data and inserts it into the Google Sheet.
- Data Access Layer: The Google Cloud Service Account, via credentials.json, ensures secure access so that both the chart generator and the web API pull data from the Google Sheet.
- API Interaction: The Google Apps Script Web API interfaces directly with the Google Sheet to offer event data needed by the SMS Android application.
- Analytics and Reporting: The Python script (generate_charts.py) periodically queries the Google Sheet (with the help of the service account) to generate analytical charts.
- Mobile Interaction: The SMS Android App communicates with the Web API to fetch the event data, then utilizes this information for messaging or display purposes.
- SMS Sending Caution: Although not shown as a component in the file tree, the README informs you that for sending bulk SMS, a licensed third party service is advised and should be thought of as an external service integration.

##### Architectural Patterns or Design Principles
- Integration-Based Architecture: The system integrates multiple services (Google Sheets, Google Cloud, and an external mobile app) that communicate via APIs.
- Separation of Concerns: There is a clear division between user registration, data storage, analytics processing, and mobile SMS delivery.
- API-Driven Interaction: The use of a dedicated Google Apps Script Web API allows for a decoupled interface between the central data store (Google Sheets) and the SMS application.

- Every component includes a clear label, such as “Tally Form (Registration Interface)”, “Google Sheet (Database)”, “Google Cloud Service Credentials (credentials.json)”, “Google Apps Script Web API (app_scripts_web_api.js)”, “Analytics Generator (generate_charts.py)”, and “SMS App (MIT App Inventor)”.
- Incorporate any supporting elements described in documentation (for example, references to sheet queries from sheet_queries.md or asset directories like tally-form-images if they play a role in UI design or documentation).

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% User Input Layer
    subgraph "User Input"
        A["Tally Form (Registration Interface)"]:::registration
    end

    %% Data Storage Layer
    subgraph "Data Storage"
        B["Google Sheet (Database)"]:::database
    end

    %% Service Layer
    subgraph "Service Layer"
        C["Google Cloud Service Credentials"]:::credentials
        D["Google Apps Script Web API"]:::api
        E["Analytics Generator (Python Script)"]:::analytics
    end

    %% Client Applications Layer
    subgraph "Client Applications"
        F["SMS Android App (MIT App Inventor)"]:::mobile
        G["Licensed Bulk SMS Service"]:::external
    end

    %% Supporting Documentation
    H["Documentation & Config"]:::doc

    %% Connections
    A -->|"registration"| B
    C -->|"authorizes"| D
    C -->|"authorizes"| E
    B -->|"dataFetch"| D
    B -->|"queryData"| E
    D -->|"provideEventData"| F
    F -->|"SMSRequest"| G
    H -->|"supportsQueries"| B

    %% Click Events
    click A "https://github.com/mehadi-trackrep/event-registration/tree/main/tally-form-images"
    click C "https://github.com/mehadi-trackrep/event-registration/blob/main/credentials.json"
    click D "https://github.com/mehadi-trackrep/event-registration/blob/main/app_scripts_web_api.js"
    click E "https://github.com/mehadi-trackrep/event-registration/blob/main/generate_charts.py"
    click F "https://github.com/mehadi-trackrep/event-registration/tree/main/SMS-App"
    click H "https://github.com/mehadi-trackrep/event-registration/blob/main/sheet_queries.md"
    click H "https://github.com/mehadi-trackrep/event-registration/blob/main/readme.md"

    %% Styles
    classDef registration fill:#f3c623,stroke:#333,stroke-width:2px
    classDef database fill:#0099ff,stroke:#333,stroke-width:2px
    classDef credentials fill:#8bc34a,stroke:#333,stroke-width:2px
    classDef api fill:#8bc34a,stroke:#333,stroke-width:2px
    classDef analytics fill:#8bc34a,stroke:#333,stroke-width:2px
    classDef mobile fill:#ff9933,stroke:#333,stroke-width:2px
    classDef external fill:#e91e63,stroke:#333,stroke-width:2px
    classDef doc fill:#9c27b0,stroke:#333,stroke-width:2px
```
