# mahamsid/3a04 architecture

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

- Interactive diagram: https://gitdiagram.com/mahamsid/3a04
- Repository: https://github.com/mahamsid/3a04

## Overview

##### Main Components
- Backend API Server:
- api.py is the entry point for the backend services.
- It hosts multiple Python modules that cover different functionalities:
▪ UltrasoundAnalyzer: Contains a trained PCOS model (ultrasound_pcos_model.h5/keras) along with scripts like train_model.py.
▪ Account System: Handles user/account operations including account creation, login, search, authentication, deletion etc.
▪ Calculation Services: In “calculateResults”, several modules perform various calculations (e.g., UltrasoundCalculation.py, bloodCalculation.py, symptomCalculation.py, overall_calculation.py, and likelihood_calculation_service.py).
▪ Upload Results: Contains scripts (e.g., discussBloodTest.py, discussSymptoms.py, discussUltrasound.py) indicating processing/parsing of uploaded diagnostic data.
▪ Data Sources: Several data files (CSV, Excel, TXT) are present under “backend/data” to serve as a database or prompt templates.
▪ Additional scripts such as results_viewer_service.py and test.py provide further utility or testing functionalities.
- Frontend (pcos-app):
- Contains multiple screens (LoginScreen, HomeScreen, BloodUploadScreen, UltrasoundUploadScreen, SymptomUploadScreen, ResultsViewerServiceScreen) that likely interact with the backend over API calls.
- The “app.json”, “package.json”, and supporting files indicate that this is a mobile or web-based frontend built with a JavaScript/TypeScript framework.
- Deliverables and Documentation:
- The Deliverables folder and README file assist with documentation and reporting. They are not runtime elements but important for project context and delivery.

##### Relationships and Data Flow
- The Frontend interacts with the Backend API:
- Within the Backend:
- The Account System module manages user validation and authentication, communicating with databases (in this case, CSV files and possibly Excel databases from “backend/data”).
- The UltrasoundAnalyzer integrates a pre-trained machine learning model for ultrasound image analysis.
- The Calculation Services perform diagnostics calculations that likely take user inputs (e.g., from uploaded files or form inputs) and generate a result.
- Upload Results utilities process input files and route the processed data into the correct calculations.
- Data Storage:
- Data files such as PCOSLikelihoodDB.xlsx, CSV files, and promptTemplate.txt act as the backend data storage or configurations that feed into the calculations.

##### Architectural Patterns and Technologies
- Separation of Concerns: Notice the clear modularization (Ultrasound analysis, account management, calculations, results upload) to separate different responsibilities.
- Integration of Machine Learning Model: The UltrasoundAnalyzer component integrates pre-trained TensorFlow/Keras models indicated by the installation instructions (tensorflow, keras, numpy, etc.).
- RESTful API Pattern: The backend likely exposes endpoints (through api.py) accessed by the frontend.
- Frontend: Built as a standalone application with multiple screens suggesting a modern client-side framework.

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Frontend Layer"
        FE1["PCOS App (Frontend)"]:::frontend
        FE2["LoginScreen"]:::frontend
        FE3["HomeScreen"]:::frontend
        FE4["BloodUploadScreen"]:::frontend
        FE5["UltrasoundUploadScreen"]:::frontend
        FE6["SymptomUploadScreen"]:::frontend
        FE7["ResultsViewerServiceScreen"]:::frontend
        FE1 --> FE2
        FE1 --> FE3
        FE1 --> FE4
        FE1 --> FE5
        FE1 --> FE6
        FE1 --> FE7
    end

    subgraph "Backend Layer"
        BE1["Backend API Server (Python) - api.py"]:::backend
        subgraph "Service Modules"
            BA["UltrasoundAnalyzer Module"]:::module
            BB["Account System Module"]:::module
            BC["Calculation Services"]:::module
            BD["Upload Results Module"]:::module
        end
        BS["Data Sources (Data Files)"]:::data
        BE1 --> BA
        BE1 --> BB
        BE1 --> BC
        BE1 --> BD
        BA --> BS
        BB --> BS
        BC --> BS
        BD --> BS
        BA ---|"Uses_TensorFlow_Keras"| BA
    end

    FE1 -->|"API_calls"| BE1

    subgraph "Documentation"
        DOC["Deliverables/Documentation (README & Deliverables)"]:::documentation
    end

    BE1 -->|"Config_docs"| DOC

    click FE1 "https://github.com/mahamsid/3a04/tree/main/pcos-app"
    click BE1 "https://github.com/mahamsid/3a04/blob/main/backend/api.py"
    click BA "https://github.com/mahamsid/3a04/tree/main/backend/UltrasoundAnalyzer"
    click BB "https://github.com/mahamsid/3a04/tree/main/backend/account_system/account_system"
    click BC "https://github.com/mahamsid/3a04/tree/main/backend/calculateResults"
    click BD "https://github.com/mahamsid/3a04/tree/main/backend/uploadResults"
    click BS "https://github.com/mahamsid/3a04/tree/main/backend/data"
    click DOC "https://github.com/mahamsid/3a04/tree/main/Deliverables"

    classDef frontend fill:#B3E5FC,stroke:#0277BD,stroke-width:2px;
    classDef backend fill:#C8E6C9,stroke:#2E7D32,stroke-width:2px;
    classDef module fill:#FFF9C4,stroke:#F9A825,stroke-width:2px;
    classDef data fill:#FFCCBC,stroke:#BF360C,stroke-width:2px;
    classDef documentation fill:#D1C4E9,stroke:#673AB7,stroke-width:2px;
```
