# sanjabh11/medical-maven-analyzer architecture

> Architecture diagram of the GitHub repository sanjabh11/medical-maven-analyzer, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-01-24). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/sanjabh11/medical-maven-analyzer
- Repository: https://github.com/sanjabh11/medical-maven-analyzer

## Overview

##### Main Components

Frontend Layer:
- Core Components (ChatInterface, ImageUploader, AnalysisResults)
- Medical Features (SymptomChecker, VitalsMonitor, FirstAidGuide)
- UI Components Library
- Upload Handling System

Backend Layer:
- API Routes
- File Processing Service
- Analysis Service

External Services Layer:
- Connections to:
- Google Healthcare API
- Supabase (Database & Storage)
- DeepSeek API (for AI analysis)

##### Component Relationships

- User Interface → Backend Services
- File Upload → Storage System
- Analysis Requests → AI Services
- Data Persistence → Supabase
- Real-time Communications → Chat System

##### Specific Implementation Details

Create sections showing:
a) Authentication Flow:
- Supabase Authentication
- API Key Management

b) File Processing Pipeline:
- Upload Zone
- Compression
- Analysis
- Results Display

c) Integration Points:
- Google Healthcare API Connection
- Supabase Client Integration
- AI Analysis Services

##### Technical Stack Indicators

Technology badges for:
- React/TypeScript
- Vite
- Tailwind CSS
- Supabase
- Google Healthcare API

##### Data Flow Patterns

Illustrate:
- File upload flow
- Analysis request/response cycle
- Real-time chat communication
- Health data processing pipeline

##### Security Layer

Show:
- API Key Management
- Data Encryption Points
- Secure Storage Zones

##### External Services Layer (APIs/Integrations)

Important Notes:
- Keep components grouped by functionality (medical, analysis, UI, etc.)
- Clear boundaries between different services
- Version/date information
- Scale indicators for system capacity

Remember to maintain a balance between detail and clarity, focusing on the key architectural decisions while avoiding overwhelming detail at the component level.

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph "Frontend Layer"
        UI["UI Components Library"]
        CoreComp["Core Components"]
        MedFeatures["Medical Features"]
        UploadSystem["Upload Handling System"]
        
        subgraph "Core Components"
            Chat["Chat Interface"]
            ImgUp["Image Uploader"]
            Analysis["Analysis Results"]
        end
        
        subgraph "Medical Features"
            Symptom["Symptom Checker"]
            Vitals["Vitals Monitor"]
            FirstAid["First Aid Guide"]
            ImgAnalyzer["Image Analyzer"]
        end
        
        subgraph "Upload System"
            UploadZone["Upload Zone"]
            FilePreview["File Preview"]
            Compression["Image Compression"]
        end
    end
    
    subgraph "Backend Layer"
        Server["Backend Server"]
        APIRoutes["API Routes"]
        FileProc["File Processing"]
        AnalysisServ["Analysis Service"]
    end
    
    subgraph "External Services"
        GoogleHealth["Google Healthcare API"]
        Supabase["Supabase DB & Storage"]
        DeepSeek["DeepSeek API"]
    end
    
    subgraph "Security Layer"
        APIKeys["API Key Management"]
        DeepSeekKeys["DeepSeek API Keys"]
        GoogleKeys["Google API Keys"]
    end
    
    subgraph "Services"
        MedSearch["Medical Search Service"]
        ConfigSidebar["Configuration Sidebar"]
    end
    
    %% Relationships
    CoreComp --> Server
    UploadSystem --> FileProc
    FileProc --> DeepSeek
    Server --> Supabase
    Server --> GoogleHealth
    APIKeys --> Server
    MedFeatures --> MedSearch
    MedSearch --> GoogleHealth
    
    %% Styling
    classDef frontend fill:#3498db,stroke:#2980b9,color:white
    classDef backend fill:#2ecc71,stroke:#27ae60,color:white
    classDef external fill:#9b59b6,stroke:#8e44ad,color:white
    classDef security fill:#f1c40f,stroke:#f39c12,color:black
    classDef service fill:#e67e22,stroke:#d35400,color:white
    
    class UI,CoreComp,MedFeatures,UploadSystem,Chat,ImgUp,Analysis,Symptom,Vitals,FirstAid,ImgAnalyzer,UploadZone,FilePreview,Compression frontend
    class Server,APIRoutes,FileProc,AnalysisServ backend
    class GoogleHealth,Supabase,DeepSeek external
    class APIKeys,DeepSeekKeys,GoogleKeys security
    class MedSearch,ConfigSidebar service
    
    %% Click Events
    click UI "https://github.com/sanjabh11/medical-maven-analyzer/tree/main/src/components/ui/"
    click Chat "https://github.com/sanjabh11/medical-maven-analyzer/blob/main/src/components/ChatInterface.tsx"
    click ImgUp "https://github.com/sanjabh11/medical-maven-analyzer/blob/main/src/components/ImageUploader.tsx"
    click Analysis "https://github.com/sanjabh11/medical-maven-analyzer/blob/main/src/components/AnalysisResults.tsx"
    click Symptom "https://github.com/sanjabh11/medical-maven-analyzer/blob/main/src/components/medical/SymptomChecker.tsx"
    click Vitals "https://github.com/sanjabh11/medical-maven-analyzer/blob/main/src/components/medical/VitalsMonitor.tsx"
    click FirstAid "https://github.com/sanjabh11/medical-maven-analyzer/blob/main/src/components/medical/FirstAidGuide.tsx"
    click ImgAnalyzer "https://github.com/sanjabh11/medical-maven-analyzer/blob/main/src/components/medical/ImageAnalyzer.tsx"
    click UploadZone "https://github.com/sanjabh11/medical-maven-analyzer/blob/main/src/components/upload/UploadZone.tsx"
    click FilePreview "https://github.com/sanjabh11/medical-maven-analyzer/blob/main/src/components/upload/FilePreview.tsx"
    click Compression "https://github.com/sanjabh11/medical-maven-analyzer/blob/main/src/utils/imageCompression.ts"
    click GoogleHealth "https://github.com/sanjabh11/medical-maven-analyzer/tree/main/src/integrations/googleHealthcare/"
    click Supabase "https://github.com/sanjabh11/medical-maven-analyzer/tree/main/src/integrations/supabase/"
    click Server "https://github.com/sanjabh11/medical-maven-analyzer/blob/main/server/index.ts"
    click APIKeys "https://github.com/sanjabh11/medical-maven-analyzer/blob/main/src/utils/apiKeyManager.ts"
    click DeepSeekKeys "https://github.com/sanjabh11/medical-maven-analyzer/blob/main/src/utils/deepSeekApiKeyManager.ts"
    click GoogleKeys "https://github.com/sanjabh11/medical-maven-analyzer/blob/main/src/utils/googleApiKeyManager.ts"
    click MedSearch "https://github.com/sanjabh11/medical-maven-analyzer/blob/main/src/services/medicalSearch.ts"
    click ConfigSidebar "https://github.com/sanjabh11/medical-maven-analyzer/blob/main/src/components/ConfigurationSidebar.tsx"
```
