# juliethcp/jani-s architecture

> Architecture diagram of the GitHub repository juliethcp/jani-s, 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/juliethcp/jani-s
- Repository: https://github.com/juliethcp/jani-s

## Overview

##### Main Components
- Frontend (React Application): This includes all the React components under the “src/components” directory such as AgeComponent, FaceTrackerComponent, EmotionBarsComponent, etc. These components provide functionality for facial recognition (using Morphcast), voice recognition (using the “speech to text” library), and visual outputs (emotion bars, modals, etc.).
- AI SDK / Helpers: Within “src/helpers/ai-sdk” you have a set of scripts (like loader.js and externalScriptsLoader.js) that facilitate communication with external libraries or APIs (e.g., the Morphcast API integration for facial recognition).
- Backend (Python API Server): As detailed in the README, this separate service is responsible for interacting with and managing 10 AI models for tasks such as answering questions and performing predictions. It acts as the central engine that responds to frontend requests.
- External Services:
- Morphcast API for real-time facial detection and analysis.
- Voice recognition integration/speech-to-text processing through a specific React library.

##### Relationships and Interactions
- The React frontend serves as the user interface. Users interact with the application, initiating actions (such as speaking or presenting their face) which are captured by React components.
- Specific components like FaceTrackerComponent and AgeComponent call the integrated Morphcast API via the AI SDK, fetching real-time data about emotions, age, and facial features.
- The voice recognition component (Dictaphone) captures audio, converts it to text, and forwards that information to the backend.
- The Python backend receives requests from the frontend through defined API endpoints. Once received, it hands off the input to the respective AI models, processes the return data, and sends the result back to the frontend.

##### Architectural Patterns and Technologies
- Client-Server Pattern: The clear division between a React-based frontend and a Python-based backend API.
- Microservices-like Approach (at a component level): Frontend components are modular—each facet of recognition (facial, vocal, gender, mood, etc.) is isolated in its own component.
- Integration with External APIs: Use of the Morphcast API and speech-to-text library.
- The AI SDK in the “helpers” folder shows an abstraction layer that decouples the frontend logic from the specifics of external technologies.

##### Detailed Elements
- React Application’s public folder (especially index.html) to indicate that it provides the entry point for the UI.
- Don’t forget to denote that the backend is a separate server process, even if not present in the given file tree.

##### Final Recommendations
- Verify that every external dependency (like Morphcast and speech-to-text libraries) is shown, with data flows marked from the frontend components to these external services.
- Incorporate annotations if needed to briefly describe the tech or purpose of each component (e.g., “React component handling emotion analysis using Morphcast data”).

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Frontend Layer: User Interface (React Components)
    subgraph "Frontend Layer: User Interface (React Components)"
        FE1["AgeComponent (Facial Recognition)"]:::frontend
        FE2["FaceTrackerComponent (Facial Tracking)"]:::frontend
        FE3["EmotionBarsComponent (Emotion Display)"]:::frontend
        FE4["Dictaphone (Voice Recognition)"]:::frontend
        FE5["Public UI Entry (index.html)"]:::public
    end

    %% Integration Layer: AI SDK / Helpers
    subgraph "Integration Layer: AI SDK / Helpers"
        SDK1["loader.js"]:::helpers
        SDK2["externalScriptsLoader.js"]:::helpers
        SDK3["Source.js"]:::helpers
    end

    %% External Services
    subgraph "External Services"
        EXT1["Morphcast API (Facial Analysis)"]:::external
        EXT2["Speech-to-Text Service"]:::external
    end

    %% Backend Layer
    subgraph "Backend Layer"
        BE1["Python API Server"]:::backend
        BE2["10 AI Models"]:::backend
    end

    %% Data Flow Relationships
    FE1 -->|"calls_via_SDK"| SDK1
    FE1 -->|"calls_via_SDK"| SDK2
    FE2 -->|"calls_Morphcast"| EXT1
    FE4 -->|"sends_voice_data"| EXT2
    FE1 -->|"api_request"| BE1
    FE2 -->|"face_data"| BE1
    FE3 -->|"emotion_data"| BE1
    FE4 -->|"transcribed_text"| BE1

    SDK1 -->|"loads_scripts_for"| EXT1
    SDK2 -->|"loads_scripts_for"| EXT1

    BE1 -->|"processes_with"| BE2

    EXT1 -->|"returns_analysis"| FE1
    EXT2 -->|"returns_transcription"| FE4

    %% Click Events
    click FE1 "https://github.com/juliethcp/jani-s/blob/develop/src/components/AgeComponent.js"
    click FE2 "https://github.com/juliethcp/jani-s/blob/develop/src/components/FaceTrackerComponent.js"
    click FE3 "https://github.com/juliethcp/jani-s/blob/develop/src/components/EmotionBarsComponent.js"
    click FE4 "https://github.com/juliethcp/jani-s/blob/develop/src/components/Dictaphone.js"
    click FE5 "https://github.com/juliethcp/jani-s/blob/develop/public/index.html"
    click SDK1 "https://github.com/juliethcp/jani-s/blob/develop/src/helpers/ai-sdk/loader.js"
    click SDK2 "https://github.com/juliethcp/jani-s/blob/develop/src/helpers/ai-sdk/externalScriptsLoader.js"
    click SDK3 "https://github.com/juliethcp/jani-s/blob/develop/src/helpers/ai-sdk/Source.js"

    %% Styles
    classDef frontend fill:#ADD8E6,stroke:#000,stroke-width:2px;
    classDef helpers fill:#90EE90,stroke:#000,stroke-width:2px;
    classDef external fill:#FFB6C1,stroke:#000,stroke-width:2px;
    classDef backend fill:#FFD700,stroke:#000,stroke-width:2px;
    classDef public fill:#D3D3D3,stroke:#000,stroke-width:2px;
```
