# tblacerda/conexaovida architecture

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

- Interactive diagram: https://gitdiagram.com/tblacerda/conexaovida
- Repository: https://github.com/tblacerda/conexaovida

## Overview

##### Project type and purpose
- From the file tree and README we see two major parts:
- “APP” – a Cordova/Ionic hybrid mobile front-end built with AngularJS, SCSS, Gulp and Bower.
- “WS-master” – a PHP-Slim based RESTful back-end (controllers, DAO layer, PHPMailer utility), with a MySQL schema.
- Purpose: A mobile app (“ConexaoVida”) for users to register symptoms, exams, notifications, patients, appointments, chat-bot interactions, backed by a web service.

##### File structure
- APP folder:
– config.json, gulpfile.js, package.json – build & config.
– www/ – compiled assets: index.html, templates (HTML views), js/ (Angular controllers, constants, util), lib/ (Ionic, Angular, Angular-UI-Router, Ionic-Material, waves, dataTables), css/, img/, service-worker.
– hooks/ – Cordova lifecycle scripts.
- WS-master folder:
– index.php, Slim framework (in /Slim and /midle/iconfigmidlews), application controllers (/control), DAOs (/dao), models (/model), configuration (config.php, config.ini), utilities (/util), PHPMailer under util/mailer.
– Banco-imip .mwb – MySQL Workbench files.

##### README
- This is a placeholder Readme with no architecture details. The project name at bottom (“ConexaoVida”) hints at medical/health context. We infer from code locations: controllers → DAO → DB.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Subgraph: Mobile Client
    subgraph "Mobile Client" 
        direction TB
        MC["Ionic/Cordova App"]:::frontend
        Gulp["Gulpfile & Config"]:::frontend
        ControllersFE["AngularJS Controllers"]:::frontend
        Templates["HTML Templates"]:::frontend
        Libs["Ionic & Angular Libraries"]:::frontend
        Styling["SCSS & CSS"]:::frontend
        Hooks["Cordova Hooks"]:::frontend
        OneSignalJS["OneSignal JS SDK"]:::external
    end

    %% Subgraph: API Layer
    subgraph "API Layer (PHP-Slim)" 
        direction TB
        Entry["index.php"]:::backend
        Router["Slim Router & Middleware"]:::backend
        ControllersBE["API Controllers"]:::backend
        UtilBE["Utility Functions"]:::backend
        ConfigPHP["Configuration Files"]:::backend
        Mailer["PHPMailer"]:::external
    end

    %% Subgraph: Data Layer
    subgraph "Data Layer"
        direction TB
        DAO["Data Access Objects"]:::backend
        Conexao["DB Connection Utility"]:::backend
        MySQL["MySQL Database"]:::datastore
        Schema["MySQL Schema & Workbench"]:::datastore
    end

    %% External Services
    subgraph "External Services"
        direction TB
        PushService["OneSignal Push Service"]:::external
        EmailService["SMTP / PHPMailer"]:::external
    end

    %% Connections
    MC -->|uses| Gulp
    MC -->|loads| ControllersFE
    MC -->|loads| Templates
    MC -->|includes| Libs
    MC -->|applies| Styling
    MC -->|invokes| Hooks
    ControllersFE -->|HTTP JSON| Entry
    OneSignalJS -->|push init| PushService
    Entry -->|routes requests| Router
    Router -->|calls| ControllersBE
    ControllersBE -->|uses| DAO
    ControllersBE -->|uses| UtilBE
    ControllersBE -->|sends email via| Mailer
    DAO -->|connects via| Conexao
    Conexao -->|queries| MySQL
    MySQL -->|defined by| Schema

    %% Click Events for Front-end
    click MC "https://github.com/tblacerda/conexaovida/tree/master/APP/www/"
    click Gulp "https://github.com/tblacerda/conexaovida/blob/master/APP/gulpfile.js"
    click Gulp "https://github.com/tblacerda/conexaovida/blob/master/APP/package.json"
    click Gulp "https://github.com/tblacerda/conexaovida/blob/master/APP/.bowerrc"
    click Gulp "https://github.com/tblacerda/conexaovida/blob/master/APP/config.json"
    click ControllersFE "https://github.com/tblacerda/conexaovida/tree/master/APP/www/js/controllers/"
    click Templates "https://github.com/tblacerda/conexaovida/tree/master/APP/www/templates/"
    click Libs "https://github.com/tblacerda/conexaovida/tree/master/APP/www/lib/ionic/"
    click Libs "https://github.com/tblacerda/conexaovida/tree/master/APP/www/lib/angular/"
    click Libs "https://github.com/tblacerda/conexaovida/tree/master/APP/www/lib/angular-ui-router/"
    click Styling "https://github.com/tblacerda/conexaovida/blob/master/APP/scss/ionic.app.scss"
    click Styling "https://github.com/tblacerda/conexaovida/tree/master/APP/www/css/"
    click Hooks "https://github.com/tblacerda/conexaovida/tree/master/APP/hooks/"
    click OneSignalJS "https://github.com/tblacerda/conexaovida/blob/master/APP/www/js/libs/onesignal.js"

    %% Click Events for API Layer
    click Entry "https://github.com/tblacerda/conexaovida/blob/master/WS-master/index.php"
    click Router "https://github.com/tblacerda/conexaovida/tree/master/WS-master/Slim/"
    click Router "https://github.com/tblacerda/conexaovida/tree/master/WS-master/midle/iconfigmidlews/Slim/"
    click ControllersBE "https://github.com/tblacerda/conexaovida/tree/master/WS-master/control/"
    click DAO "https://github.com/tblacerda/conexaovida/tree/master/WS-master/dao/"
    click Conexao "https://github.com/tblacerda/conexaovida/blob/master/WS-master/util/Conexao.php"
    click ConfigPHP "https://github.com/tblacerda/conexaovida/blob/master/WS-master/config.php"
    click ConfigPHP "https://github.com/tblacerda/conexaovida/blob/master/WS-master/midle/iconfigmidlews/config.ini"
    click Schema "https://github.com/tblacerda/conexaovida/blob/master/WS-master/bd/banco-imip.mwb"
    click Schema "https://github.com/tblacerda/conexaovida/blob/master/WS-master/bd/sql cidades estados .sql"
    click Mailer "https://github.com/tblacerda/conexaovida/tree/master/WS-master/util/mailer/"
    click UtilBE "https://github.com/tblacerda/conexaovida/blob/master/WS-master/util/Utilidades.php"
    click UtilBE "https://github.com/tblacerda/conexaovida/blob/master/WS-master/util/ConfigInfra.php"

    %% Styles
    classDef frontend fill:#e0f7fa,stroke:#006064,color:#004d40
    classDef backend fill:#e8f5e9,stroke:#1b5e20,color:#2e7d32
    classDef datastore fill:#fff3e0,stroke:#e65100,color:#bf360c
    classDef external fill:#eceff1,stroke:#37474f,color:#263238
```
