# navjyotsingh17/aadhaar_masking architecture

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

- Interactive diagram: https://gitdiagram.com/navjyotsingh17/aadhaar_masking
- Repository: https://github.com/navjyotsingh17/aadhaar_masking

## Overview

This repository is an Aadhaar-document masking service: a client submits document bytes to the Flask API, which checks the supplied password and delegates masking to the image-processing engine before returning status and, when masked, document bytes. The API also exposes classification and audit-related routes. Audit queries and logging configuration are visible, but the excerpts do not establish every route’s behavior or the engine’s detailed OCR/detection call sequence; those internals are therefore kept consolidated.

Main entry points: [`app/app.py`](https://github.com/navjyotsingh17/aadhaar_masking/blob/main/app/app.py) (Flask API), [`wsgi.py`](https://github.com/navjyotsingh17/aadhaar_masking/blob/main/wsgi.py) (WSGI server), [`services/mask_image.py`](https://github.com/navjyotsingh17/aadhaar_masking/blob/main/services/mask_image.py) (Masking engine), [`models`](https://github.com/navjyotsingh17/aadhaar_masking/tree/main/models) (Model weights)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Service runtime"]
  node_wsgi["WSGI server<br/>[wsgi.py]"]
  node_api["Flask API<br/>[app.py]"]
end

subgraph group_processing["Document processing"]
  node_masking["Masking engine<br/>[mask_image.py]"]
  node_models["Model weights"]
end

subgraph group_operations["Audit and logs"]
  node_auditdb[("Audit database<br/>[app.py]")]
  node_logger["Log setup<br/>[logging_config.py]"]
end

subgraph group_security["Request security"]
  node_crypto["Password crypto<br/>[encrypt_decrypt.py]"]
end

node_client(("Document client"))

node_client -->|"submits request"| node_wsgi
node_wsgi -->|"serves app"| node_api
node_api -->|"decrypts password"| node_crypto
node_api -->|"delegates masking"| node_masking
node_masking -->|"loads weights"| node_models
node_api -->|"queries audit data"| node_auditdb
node_api -->|"configures logging"| node_logger
node_api -.->|"returns result"| node_client

click node_wsgi "https://github.com/navjyotsingh17/aadhaar_masking/blob/main/wsgi.py"
click node_api "https://github.com/navjyotsingh17/aadhaar_masking/blob/main/app/app.py"
click node_masking "https://github.com/navjyotsingh17/aadhaar_masking/blob/main/services/mask_image.py"
click node_models "https://github.com/navjyotsingh17/aadhaar_masking/tree/main/models"
click node_auditdb "https://github.com/navjyotsingh17/aadhaar_masking/blob/main/app/app.py"
click node_logger "https://github.com/navjyotsingh17/aadhaar_masking/blob/main/config/logging_config.py"
click node_crypto "https://github.com/navjyotsingh17/aadhaar_masking/blob/main/utils/encrypt_decrypt.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_wsgi,node_api,node_client toneBlue
class node_masking,node_models toneAmber
class node_auditdb,node_logger toneMint
class node_crypto toneRose
```

## Components

### Service runtime

- [WSGI server](https://github.com/navjyotsingh17/aadhaar_masking/blob/main/wsgi.py): `wsgi.py`
- [Flask API](https://github.com/navjyotsingh17/aadhaar_masking/blob/main/app/app.py): `app/app.py`

### Document processing

- [Masking engine](https://github.com/navjyotsingh17/aadhaar_masking/blob/main/services/mask_image.py): `services/mask_image.py`
- [Model weights](https://github.com/navjyotsingh17/aadhaar_masking/tree/main/models): `models`

### Audit and logs

- [Audit database](https://github.com/navjyotsingh17/aadhaar_masking/blob/main/app/app.py): `app/app.py`
- [Log setup](https://github.com/navjyotsingh17/aadhaar_masking/blob/main/config/logging_config.py): `config/logging_config.py`

### Request security

- [Password crypto](https://github.com/navjyotsingh17/aadhaar_masking/blob/main/utils/encrypt_decrypt.py): `utils/encrypt_decrypt.py`

### Other components

- **Document client**

## Connections

- Document client → WSGI server: submits request (evidence: `Readme.md`)
- WSGI server → Flask API: serves app (evidence: `wsgi.py`)
- Flask API → Password crypto: decrypts password (evidence: `app/app.py`)
- Flask API → Masking engine: delegates masking (evidence: `app/app.py`)
- Masking engine → Model weights: loads weights (evidence: `services/mask_image.py`)
- Flask API → Audit database: queries audit data (evidence: `app/app.py`)
- Flask API → Log setup: configures logging (evidence: `app/app.py`)
- Flask API → Document client: returns result
