# sandeepkasturi/soulcare-ai architecture

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

- Interactive diagram: https://gitdiagram.com/sandeepkasturi/soulcare-ai
- Repository: https://github.com/sandeepkasturi/soulcare-ai

## Overview

##### Project type and purpose
- Project type: A lightweight full-stack-style application (single-tier Streamlit “frontend” + orchestration + external AI “backend” service).
- Purpose: Expose mental-health functionalities (wellness coaching, drug info, medical report analysis, expert advice) via a Streamlit web UI, using Gemini-pro for AI processing.

##### File structure
- README.md – project overview, features, setup instructions.
- project.py – the only code file. Contains Streamlit UI definitions, input forms, calls to `configure(api_key=…)`, and functions that call the Gemini-pro API.
- requirements.txt – lists Python dependencies (streamlit, google-api-client or similar).

There is no internal database or microservices. The app relies on:
- Streamlit’s server runtime (handles HTTP, session state).
- Google Gemini-pro API (external AI service).
- Streamlit secrets management (`st.secrets["api_key"]`).

##### Extract additional insights from the README
- Tech stack: Python + Streamlit UI framework.
- External dependency: Gemini-pro API (Google AI Studio).
- No mention of persistence layers – all data is ephemeral in memory.
- Deployment goal: host on Streamlit Cloud or similar.

##### Main components
a. User (Browser) – client making HTTP requests and rendering the UI.
b. Streamlit App Server – hosts `project.py` and executes the UI + orchestration code.
c. Secret Manager – abstraction for `st.secrets` storing the API key.
d. Gemini-pro API – Google’s large-language-model service.
e. (Optional) Streamlit Cloud or Hosting Infrastructure – AWS/Heroku/Streamlit Cloud.

##### Relationships & Data Flow
1. User enters input in the Streamlit web UI.
2. Streamlit App Server processes UI events, retrieves API key from Secret Manager.
3. App server issues an HTTPS request to the Gemini-pro API (passes user prompt + api_key).
4. Gemini-pro returns a response (analysis, advice, summary).
5. App server renders the response back in the Streamlit UI.

##### Architectural patterns & design principles
- Two-tier architecture:
– Presentation tier (Streamlit UI + project.py code).
– Service tier (external AI API).
- Single responsibility: project.py handles both UI definition and orchestration; secret management is decoupled via `st.secrets`.
- Stateless interactions: no local database; each user action is a new API call.
- Security: API key never checked into source control; stored in `st.secrets`.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Main user interaction
    User["User Browser"]:::ui
    App["Streamlit App Server (project.py)"]:::logic
    Gemini["Google Gemini-pro API"]:::external
    Secrets["st.secrets Secret Store"]:::secret

    %% Documentation and dependencies
    subgraph "Project Files"
        Doc["README.md"]:::doc
        Req["requirements.txt"]:::doc
    end

    %% Data Flow
    User -- "HTTP Request / UI Input" --> App
    App -- "Retrieves API Key" --> Secrets
    App -- "HTTPS API Call (prompt + api_key)" --> Gemini
    Gemini -- "Response (analysis, summary)" --> App
    App -- "Renders UI (HTML/CSS)" --> User

    %% File References
    click App "https://github.com/sandeepkasturi/soulcare-ai/blob/main/project.py"
    click Doc "https://github.com/sandeepkasturi/soulcare-ai/blob/main/README.md"
    click Req "https://github.com/sandeepkasturi/soulcare-ai/blob/main/requirements.txt"

    %% Styles
    classDef ui fill:#AED8E6,stroke:#333,stroke-width:1px
    classDef logic fill:#C8E6C9,stroke:#333,stroke-width:1px,stroke-dasharray: 5 5
    classDef external fill:#FFCC80,stroke:#333,stroke-width:1px
    classDef secret fill:#E0E0E0,stroke:#333,stroke-width:1px,stroke-dasharray: 2 2
    classDef doc fill:#E8EAF6,stroke:#3F51B5,stroke-width:1px,stroke-dasharray: 2 2
```
