# rudra8984/pii-protection architecture

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

- Interactive diagram: https://gitdiagram.com/rudra8984/pii-protection
- Repository: https://github.com/rudra8984/pii-protection

## Overview

##### Main Components

a) Client Layer:
- Web Interface (HTML/CSS/JavaScript)
- User Portal (login, signup, image upload)
- Manager Portal (data management interface)

b) Application Layer:
- Django Web Server
- Authentication System
- OCR Processing Module (Tesseract)
- Encryption Module (AES)

c) Data Layer:
- MySQL Database
- Blob Storage (for encrypted documents)

##### User Authentication Flow
- Login/Signup endpoints
- Session management
- Access control

##### Image Processing Flow
- Image upload
- OCR processing
- PII detection
- Encryption
- Storage

##### Manager Access Flow
- Manager authentication
- Data retrieval
- Decryption process

##### Specific Implementation Details

- `pii/views.py` - Controller logic
- `pii/models.py` - Data models
- `pii/ocrencrypt.py` - OCR and encryption services
- `pii/imageshow.py` - Image handling
- `pii/useridshow.py` - User management

**[Client Layer]**
- ↓↑
**[Web Server (Django)]**
- ↓↑
**[Application Services]**
- Auth Service
- OCR Service
- Encryption Service
- Image Processing Service
- ↓↑
**[Data Layer]**
- MySQL DB
- Blob Storage

##### Important Elements to Emphasize

- Security boundaries
- Data flow directions
- Encryption points
- Access control checkpoints
- Service interactions

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Client
        WI[Web Interface]
        UP[User Portal]
        MP[Manager Portal]
        WI --> UP
        WI --> MP
    end

    subgraph "Django Web Server"
        DC[Django Core]:::core
        UR["URL Router"]:::core
        VC["View Controllers"]:::core
    end

    subgraph "Application Services"
        AS[Authentication Service]:::security
        OCR[OCR Processing]:::processing
        ES[Encryption Service]:::security
        IP[Image Processing]:::processing
        UMP[User Management]:::processing
    end

    subgraph "Data Storage"
        DB[(MySQL Database)]:::storage
        BS[(Blob Storage)]:::storage
    end

    %% Client to Server Connections
    UP --> DC
    MP --> DC
    
    %% Server Internal Flow
    DC --> UR
    UR --> VC
    
    %% Service Connections
    VC --> AS
    VC --> OCR
    VC --> ES
    VC --> IP
    VC --> UMP
    
    %% Data Layer Connections
    AS --> DB
    ES --> BS
    IP --> BS
    UMP --> DB
    OCR --> ES

    %% Click Events
    click WI "https://github.com/Rudra8984/pii-protection/tree/master/pii/templates/"
    click UP "https://github.com/Rudra8984/pii-protection/blob/master/pii/templates/login.html"
    click MP "https://github.com/Rudra8984/pii-protection/blob/master/pii/templates/manager.html"
    click DC "https://github.com/Rudra8984/pii-protection/blob/master/myproject/settings.py"
    click UR "https://github.com/Rudra8984/pii-protection/blob/master/myproject/urls.py"
    click VC "https://github.com/Rudra8984/pii-protection/blob/master/pii/views.py"
    click OCR "https://github.com/Rudra8984/pii-protection/blob/master/pii/ocrencrypt.py"
    click ES "https://github.com/Rudra8984/pii-protection/blob/master/pii/ocrencrypt.py"
    click IP "https://github.com/Rudra8984/pii-protection/blob/master/pii/imageshow.py"
    click UMP "https://github.com/Rudra8984/pii-protection/blob/master/pii/useridshow.py"
    click DB "https://github.com/Rudra8984/pii-protection/blob/master/pii/models.py"

    %% Styling
    classDef core fill:#90EE90
    classDef security fill:#FFD700
    classDef processing fill:#ADD8E6
    classDef storage fill:#FF6B6B

    %% Legend
    subgraph Legend
        L1[Core Components]:::core
        L2[Security Services]:::security
        L3[Processing Services]:::processing
        L4[Storage Systems]:::storage
    end
```
