# binary0011247/voice-based-patient-call-system__ architecture

> Architecture diagram of the GitHub repository binary0011247/voice-based-patient-call-system__, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/binary0011247/voice-based-patient-call-system__
- Repository: https://github.com/binary0011247/voice-based-patient-call-system__

## Overview

##### Project Type and Purpose
- This is a full-stack, microservices-style “Voice-Based Patient Call System” comprised of:
- A mobile frontend (React Native/Expo) used by patients and nurses.
- A web-based admin portal (Next.js/React).
- A Node.js/Express backend (“CareConnect-backend”) that exposes REST endpoints, implements business logic (controllers/services/models), and persists data.
- An AI microservice (FastAPI + Python) that converts audio to text and classifies urgency.
- A database (likely MongoDB given the model/service structure).
- An external Azure Speech-to-Text API used by the AI service.

##### File Structure Highlights
- Top-level directories:
- AI-part/ — Python FastAPI app plus Dockerfile, docker-compose.yaml, model artifacts, speech-to-text and classification modules.
- SpringBoardApp_Admin_App/CareConnect-Admin-App/ — Next.js or CRA admin portal (app/ directory, components/, routes, package.json).
- SpringBoardApp_FrontEnd/CareConnect/ — Expo/React Native mobile app (app/(screens)/, components/, hooks/, constants/).
- backend-careconnect/CareConnect-backend/ — Node.js Express REST API (controllers/, routes/, models/, services/db.js, index.js).

##### Additional Insights from README
- Admin app runs on port 8081 via `npm start`.
- Frontend mobile runs under Expo (`npx expo start`).
- AI service can be containerized or run with `uvicorn app:app`. It exposes `/docs` and inference endpoints on port 8000.
- The model must be downloaded into AI-part/model.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Frontend Layer
    subgraph "Mobile App (Expo/React Native)"
        direction TB
        PatientApp["Patient/Nurse App"]:::frontend
    end
    subgraph "Admin Portal (Next.js/React)"
        direction TB
        AdminPortal["Admin Web Portal"]:::frontend
    end

    %% Backend Layer
    subgraph "Backend API Service (Node.js/Express)"
        direction TB
        APIIndex["index.js"]:::backend
        Controllers["Controllers (controller/)"]:::backend
        Routes["Routes (routes/)"]:::backend
        Models["Models (model/)"]:::backend
        Services["DB Services (services/db.js & services/*.js)"]:::backend
    end

    %% AI Microservice Layer
    subgraph "AI Microservice (FastAPI + Python)" 
        direction TB
        AIEntry["app.py"]:::service
        Classifier["Urgency Classification Module"]:::service
        SpeechSub["Azure STT Submodule"]:::service
        DockerCfg["Dockerfile & docker-compose.yaml"]:::service
    end

    %% Data Stores / External
    Database[(MongoDB)]:::database
    AzureAPI(["Azure Speech-to-Text API"]):::external

    %% Data Flows
    PatientApp -->|"HTTPS REST"| APIIndex
    AdminPortal -->|"HTTPS REST"| APIIndex
    PatientApp -->|"Audio Payload"| AIEntry
    APIIndex -->|"REST call"| AIEntry
    APIIndex -->|"CRUD"| Database
    Controllers -->|"uses"| Services
    Services -->|"connects to"| Database
    AIEntry -->|"HTTP SDK"| AzureAPI
    Classifier -->|"calls"| SpeechSub
    SpeechSub -->|"SDK REST"| AzureAPI

    %% Click Events
    click PatientApp "https://github.com/binary0011247/voice-based-patient-call-system__/tree/master/SpringBoardApp_FrontEnd/CareConnect/"
    click AdminPortal "https://github.com/binary0011247/voice-based-patient-call-system__/tree/master/SpringBoardApp_Admin_App/CareConnect-Admin-App/"
    click APIIndex "https://github.com/binary0011247/voice-based-patient-call-system__/blob/master/backend-careconnect/CareConnect-backend/index.js"
    click Controllers "https://github.com/binary0011247/voice-based-patient-call-system__/tree/master/backend-careconnect/CareConnect-backend/controller/"
    click Routes "https://github.com/binary0011247/voice-based-patient-call-system__/tree/master/backend-careconnect/CareConnect-backend/routes/"
    click Models "https://github.com/binary0011247/voice-based-patient-call-system__/tree/master/backend-careconnect/CareConnect-backend/model/"
    click Services "https://github.com/binary0011247/voice-based-patient-call-system__/blob/master/backend-careconnect/CareConnect-backend/services/db.js"
    click AIEntry "https://github.com/binary0011247/voice-based-patient-call-system__/blob/master/AI-part/app.py"
    click Classifier "https://github.com/binary0011247/voice-based-patient-call-system__/tree/master/AI-part/Urgency_classifier/"
    click SpeechSub "https://github.com/binary0011247/voice-based-patient-call-system__/blob/master/AI-part/audio_to_text/speect_to_text_using_azure.py"
    click DockerCfg "https://github.com/binary0011247/voice-based-patient-call-system__/blob/master/AI-part/docker-compose.yaml"

    %% Styles
    classDef frontend fill:#D0E8FF,stroke:#0366d6,color:#0366d6;
    classDef backend fill:#DFFFE0,stroke:#28a745,color:#155724;
    classDef service fill:#E8F5E9,stroke:#66BB6A,color:#1B5E20;
    classDef database fill:#FFF4E5,stroke:#FF9800,color:#E65100;
    classDef external fill:#F0F0F0,stroke:#9E9E9E,color:#424242;
```
