# vimukthi101/scat architecture

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

- Interactive diagram: https://gitdiagram.com/vimukthi101/scat
- Repository: https://github.com/vimukthi101/scat

## Overview

##### Project type and purpose
- This is a multi-platform system that integrates several components: Android mobile applications (one focused on smart card transactions and another dedicated to GPS tracking), a series of PHP-based web applications and APIs (in the public, webApp, and mobile folders), and smart card firmware (using Arduino INO files for reading and writing smart cards).
- The system is designed to handle operations such as commuter login, balance and transfer management, travel transactions, reporting (via FusionCharts and Highcharts), SMS notifications, and location tracking of trains or commuters.

##### File structure
- Android Applications:
– There are two main Android projects:
- "SCAT" – which includes functionalities like Login, Account, Balance, Transfer, Travel, and Map activities, using getResponse() methods.
- "GPS" – which includes a Map and Settings to send location data (sendLocation()).
- Smart Card Device:
– The “SmartCard” directory contains Arduino sketches (Read.ino, Write.ino, etc.) which suggest the system has an embedded component for managing physical smart card operations.
- PHP-based Backends:
– The “mobile” folder features PHP APIs (e.g., disable.php, getTrainList.php, login.php, transfer.php, etc.).
– The “public” and “webApp” directories include a large number of PHP scripts (with controller sub-folders) which serve various user roles (commuter, station master, registrar, manager, etc.), handling user registration, reports, and other backend operations.
- Database:
– A “db” folder includes an SQL file (scat.sql) that likely defines the schema for the entire system.
- Supporting Services:
– The presence of SMS settings and SMTP settings (in ssi directories across multiple parts) indicates integration with external SMS gateways and email services.

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Mobile Applications"
        A["Android SCAT App<br/>(Handles commuter transactions, login, transfer, travel)"]:::mobile
        B["Android GPS App<br/>(Tracks location, sendLocation())"]:::mobile
    end

    subgraph "Embedded Device"
        C["Smart Card Module<br/>(Arduino Firmware)"]:::embedded
        C1["Read Firmware"]:::embedded
        C2["Write Firmware"]:::embedded
    end

    subgraph "Backend Servers"
        D["Mobile PHP API Backend<br/>(PHP APIs: disable, login, transfer, etc.)"]:::backend
        E["Public PHP Interface<br/>(User controllers, registration, reports)"]:::backend
        F["WebApp PHP Interface<br/>(Controllers and services for web clients)"]:::backend
    end

    subgraph "Database Layer"
        G["Database (scat.sql)"]:::database
    end

    subgraph "External Services"
        subgraph "SMS Gateway Integration"
            H["SMS Gateway (Mobile)"]:::external
            I["SMS Gateway (Public)"]:::external
            J["SMS Gateway (WebApp)"]:::external
        end
        subgraph "Email Service Integration"
            K["PHPMailer"]:::external
            L["SMTP Settings"]:::external
        end
    end

    A -->|"sendsRequest"| D
    B -->|"sendsLocation"| D
    D -->|"CRUD"| G
    E -->|"CRUD"| G
    F -->|"CRUD"| G
    D -->|"sendSMS"| H
    E -->|"sendSMS"| I
    F -->|"sendSMS"| J
    F -->|"sendEmail"| K
    F -->|"sendEmail"| L
    C -->|"logTx"| D
    C --> C1
    C --> C2

    %% Click Events
    click A "https://github.com/vimukthi101/scat/tree/master/AndroidApp/SCAT"
    click B "https://github.com/vimukthi101/scat/tree/master/AndroidApp/GPS"
    click C "https://github.com/vimukthi101/scat/tree/master/SmartCard"
    click C1 "https://github.com/vimukthi101/scat/tree/master/SmartCard/Read"
    click C2 "https://github.com/vimukthi101/scat/tree/master/SmartCard/Write"
    click D "https://github.com/vimukthi101/scat/tree/master/mobile/src"
    click E "https://github.com/vimukthi101/scat/tree/master/public"
    click F "https://github.com/vimukthi101/scat/tree/master/webApp"
    click G "https://github.com/vimukthi101/scat/blob/master/db/scat.sql"
    click H "https://github.com/vimukthi101/scat/blob/master/mobile/ssi/smsSettings.php"
    click I "https://github.com/vimukthi101/scat/blob/master/public/ssi/smsSettings.php"
    click J "https://github.com/vimukthi101/scat/blob/master/webApp/ssi/smsSettings.php"
    click K "https://github.com/vimukthi101/scat/blob/master/webApp/ssi/PHPMailerAutoload.php"
    click L "https://github.com/vimukthi101/scat/blob/master/webApp/ssi/smtpSettings.php"

    %% Styles
    classDef mobile fill:#f9e79f,stroke:#7d6608,stroke-width:2px;
    classDef embedded fill:#aed6f1,stroke:#2e86c1,stroke-width:2px;
    classDef backend fill:#d7bde2,stroke:#6c3483,stroke-width:2px;
    classDef database fill:#a9dfbf,stroke:#1e8449,stroke-width:2px;
    classDef external fill:#f5b7b1,stroke:#922b21,stroke-width:2px;
    
    class A,B mobile;
    class C,C1,C2 embedded;
    class D,E,F backend;
    class G database;
    class H,I,J,K,L external;
```
