# mehenni-ui/skin_cancer_app architecture

> Architecture diagram of the GitHub repository mehenni-ui/skin_cancer_app, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2024-12-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/mehenni-ui/skin_cancer_app
- Repository: https://github.com/mehenni-ui/skin_cancer_app

## Overview

##### Main Components

a) User Interface Layer:
- Two main activities (MainActivity and MainActivity2)
- Camera interface integration
- UI resources (layouts, drawables, and menu components)

b) Machine Learning Layer:
- TensorFlow Lite model integration (modelTF.tflite)
- Image processing pipeline
- Classification system for 7 skin cancer types

c) Device Hardware Integration:
- Camera access
- Storage access for images
- System resources

**┌─ User Interface Layer ─────────────────┐**
- ┌─ Activities ──┐  ┌─ Resources ────┐  │
- MainActivity  │  │ Layout Files   │  │
- MainActivity2 │  │ Drawables      │  │
- ┘  │ Themes         │  │
- ┘ │
- ┘
- ↕
**┌─ Processing Layer ──────────────────────┐**
- ┌─ Image Processing ─┐ ┌─ ML Engine ──┐ │
- Image Capture      │ │ TFLite Model │ │
- Image Preprocessing│ │ Classifier   │ │
- ┘ └──────────────┘  │
- ┘
- ↕
**┌─ Hardware Interface Layer ─────────────┐**
- ┌─ Device APIs ────────────────────┐   │
- Camera API                       │   │
- Storage Access                   │   │
- ┘    │
- ┘

##### Important Elements to Highlight

a) Data Flow:
- How images flow from camera capture to ML processing
- Result display path back to UI

b) Key Technologies:
- TensorFlow Lite integration
- CNN model implementation
- Android camera API usage

##### Technical Details

- Model input/output specifications
- Supported image formats
- Memory management considerations
- Performance optimization points
- Security considerations for medical data

##### Implementation Notes

- Relationship between activities
- Where the 7 cancer type classifications occur
- User interaction points
- System permission requirements

Remember to include annotations for:
- Model accuracy metrics
- Image processing steps
- Classification output format
- User feedback mechanisms

This will provide a complete picture of how the application processes images and delivers results to users while maintaining the medical-grade accuracy required for skin cancer detection.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Styles and classes
    classDef ui fill:#3498db,stroke:#2980b9,color:white
    classDef ml fill:#2ecc71,stroke:#27ae60,color:white
    classDef hw fill:#e67e22,stroke:#d35400,color:white
    classDef res fill:#95a5a6,stroke:#7f8c8d,color:white

    %% User Interface Layer
    subgraph UI["User Interface Layer"]
        Activities["Activities"]
        Resources["Resources"]
        
        subgraph ACT["Activities Components"]
            MA["MainActivity"]
            MA2["MainActivity2"]
        end
        
        subgraph RES["Resource Components"]
            Layouts["Layout Files"]
            Drawables["Drawables"]
            Themes["Themes"]
            Menu["Menu"]
        end
        
        Activities --> ACT
        Resources --> RES
    end

    %% Processing Layer
    subgraph PL["Processing Layer"]
        ImgProc["Image Processing"]
        MLEngine["ML Engine"]
        
        subgraph IP["Image Processing Pipeline"]
            ImgCapture["Image Capture"]
            ImgPrep["Image Preprocessing"]
        end
        
        subgraph ML["Machine Learning"]
            TFModel["TFLite Model"]
            Classifier["Classifier<br/>(7 Cancer Types)<br/>90%+ Accuracy"]
        end
        
        ImgProc --> IP
        MLEngine --> ML
    end

    %% Hardware Layer
    subgraph HW["Hardware Interface Layer"]
        DeviceAPI["Device APIs"]
        
        subgraph API["System Integration"]
            Camera["Camera API"]
            Storage["Storage Access"]
            Permissions["System Permissions"]
        end
        
        DeviceAPI --> API
    end

    %% Connections between layers
    UI --> PL
    PL --> HW

    %% Click events for component mapping
    click MA "https://github.com/mehenni-ui/Skin_Cancer_App/blob/master/app/src/main/java/mohamed/mehenni/skincancer/MainActivity.java"
    click MA2 "https://github.com/mehenni-ui/Skin_Cancer_App/blob/master/app/src/main/java/mohamed/mehenni/skincancer/MainActivity2.java"
    click Layouts "https://github.com/mehenni-ui/Skin_Cancer_App/tree/master/app/src/main/res/layout"
    click Drawables "https://github.com/mehenni-ui/Skin_Cancer_App/tree/master/app/src/main/res/drawable"
    click Menu "https://github.com/mehenni-ui/Skin_Cancer_App/blob/master/app/src/main/res/menu/menu_info.xml"
    click TFModel "https://github.com/mehenni-ui/Skin_Cancer_App/blob/master/app/src/main/ml/modelTF.tflite"
    click Permissions "https://github.com/mehenni-ui/Skin_Cancer_App/blob/master/app/src/main/AndroidManifest.xml"
    click Themes "https://github.com/mehenni-ui/Skin_Cancer_App/blob/master/app/src/main/res/values/themes.xml"

    %% Style applications
    class MA,MA2 ui
    class ImgCapture,ImgPrep,TFModel,Classifier ml
    class Camera,Storage,Permissions hw
    class Layouts,Drawables,Themes,Menu res
```
