# nadaelmasry/cephalometric-landmark-detection architecture

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

- Interactive diagram: https://gitdiagram.com/nadaelmasry/cephalometric-landmark-detection
- Repository: https://github.com/nadaelmasry/cephalometric-landmark-detection

## Overview

##### Main Components
- Frontend Client – The “frontend” directory contains HTML, CSS, and JavaScript files (including index.html, upload.html, result.html, etc.). This is used for user interactions (uploading patient images, viewing reports, help pages, etc.).
- Node.js API – The “node.js Api” folder indicates your backend Node.js application with folders for DB connection, models, controllers, routes, and services (e.g., cloudinary integration). It handles operations such as adding new patients, managing medical records, and interfacing with the MongoDB database.
- Flask API – The “flask api” directory holds several Python files and Jupyter notebooks that are used for deep learning operations (landmark positioning using UNet, Inception, and ResNet models), indicating the segmentation/detection part.
- Database – Though not a folder, the README specifies MongoDB as the database for storing patient data and records.
- Deep Learning Model – The “models notebooks” folder shows notebooks for training and experimenting with different models (binary mask UNet, Inception, ResNet). These represent the ML processes that are deployed via the Flask API.

##### Relationships and Interactions between Components
- The Frontend interacts with the Node.js API:
- The Node.js API communicates with the Database (MongoDB):
- The Node.js API integrates with the Flask API:
- The Flask API runs the deployed deep learning models:
- Internally, the Flask API leverages TensorFlow, OpenCV, and NumPy to perform image processing and landmark predictions. Indicate the incorporation of these technologies as annotations or labels near the Flask API component.

##### Architectural Patterns and Design Principles
- Separation of Concerns:
- Microservices or Service-Oriented Architecture:
- MVC-like pattern in Node.js API:
- Within the node.js Api folder, emphasize the controllers, routes, and models which indicate an MVC-inspired structure.
- Integration of ML Workflows:

## Diagram (Mermaid)

```mermaid
flowchart TD
    FE("Frontend Client"):::frontend
    NAPI("Node.js API"):::nodeapi
    FAPI("Flask API<br/>(TensorFlow,OpenCV,NumPy)"):::flask
    DB("MongoDB"):::database
    CLOUD("Cloud Storage/Service"):::cloud

    FE -->|"PatientDataUpload"| NAPI
    NAPI -->|"CRUD"| DB
    NAPI -->|"ImageUpload"| CLOUD
    NAPI -->|"InferenceRequest"| FAPI
    FAPI -->|"InferenceResponse"| NAPI

    subgraph "Node.js API Modules"
        direction TB
        DB_CONN("DB Connection<br/>(DB/connjection.js)"):::nodeapi
        USER_MODEL("User Model<br/>(DB/models/user.model.js)"):::nodeapi
        USER_CTRL("User Controller<br/>(user.controller.js)"):::nodeapi
        USER_ROUTE("User Route<br/>(user.route.js)"):::nodeapi
        MULTER("clodMulter.js"):::nodeapi
        CLOUDI("cloudinary.js"):::nodeapi
    end

    subgraph "Flask API Components"
        direction TB
        FL_MAIN("Main (3).py"):::flask
        FL_MODELS("Models (models.py)"):::flask
        FL_PRE("Preprocessing (preprocessing.py)"):::flask
        NOTEBOOKS("Notebooks<br/>REsINcep trial.ipynb,<br/>Unet load model.ipynb"):::flask
    end

    subgraph "Model Training Notebooks"
        direction TB
        NB1("Binary Mask Trial Unet.ipynb"):::flask
        NB2("Unet_and_get_ROIs_for_Stage2.ipynb"):::flask
        NB3("resnet_inception_final.ipynb"):::flask
        NB4("resnet_rois.ipynb"):::flask
    end

    %% Click Events
    click FE "https://github.com/nadaelmasry/cephalometric-landmark-detection/tree/main/frontend/"
    click NAPI "https://github.com/nadaelmasry/cephalometric-landmark-detection/tree/main/node.js Api/"
    click DB_CONN "https://github.com/nadaelmasry/cephalometric-landmark-detection/blob/main/node.js Api/DB/connjection.js"
    click USER_MODEL "https://github.com/nadaelmasry/cephalometric-landmark-detection/blob/main/node.js Api/DB/models/user.model.js"
    click USER_CTRL "https://github.com/nadaelmasry/cephalometric-landmark-detection/blob/main/node.js Api/controllers/user.controller.js"
    click USER_ROUTE "https://github.com/nadaelmasry/cephalometric-landmark-detection/blob/main/node.js Api/routes/user.route.js"
    click MULTER "https://github.com/nadaelmasry/cephalometric-landmark-detection/blob/main/node.js Api/service/clodMulter.js"
    click CLOUDI "https://github.com/nadaelmasry/cephalometric-landmark-detection/blob/main/node.js Api/service/cloudinary.js"
    click FAPI "https://github.com/nadaelmasry/cephalometric-landmark-detection/tree/main/flask api/"
    click FL_MAIN "https://github.com/nadaelmasry/cephalometric-landmark-detection/blob/main/flask api/main (3).py"
    click FL_MODELS "https://github.com/nadaelmasry/cephalometric-landmark-detection/blob/main/flask api/models.py"
    click FL_PRE "https://github.com/nadaelmasry/cephalometric-landmark-detection/blob/main/flask api/preprocessing.py"
    click NOTEBOOKS "https://github.com/nadaelmasry/cephalometric-landmark-detection/blob/main/flask api/REsINcep trial.ipynb"
    click NB1 "https://github.com/nadaelmasry/cephalometric-landmark-detection/blob/main/models notebooks/Binary Mask Trial Unet.ipynb"
    click NB2 "https://github.com/nadaelmasry/cephalometric-landmark-detection/blob/main/models notebooks/Unet_and_get_ROIs_for_Stage2.ipynb"
    click NB3 "https://github.com/nadaelmasry/cephalometric-landmark-detection/blob/main/models notebooks/resnet_inception_final.ipynb"
    click NB4 "https://github.com/nadaelmasry/cephalometric-landmark-detection/blob/main/models notebooks/resnet_rois.ipynb"

    %% Styles
    classDef frontend fill:#FFA500,stroke:#333,stroke-width:2px;
    classDef nodeapi fill:#87CEEB,stroke:#333,stroke-width:2px;
    classDef flask fill:#90EE90,stroke:#333,stroke-width:2px;
    classDef database fill:#C0C0C0,stroke:#333,stroke-width:2px;
    classDef cloud fill:#DDA0DD,stroke:#333,stroke-width:2px;
```
