# ronit26mehta/pdf-ops architecture

> Architecture diagram of the GitHub repository ronit26mehta/pdf-ops, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-12). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ronit26mehta/pdf-ops
- Repository: https://github.com/ronit26mehta/pdf-ops

## Overview

##### Project type and purpose
- SecureDrop is a monolithic, full-stack web application built with Flask.
- Its stated purpose is to masquerade as a complaint management system while covertly collecting user device and behavioral data, embedding that data in downloaded PDFs, and using AI to analyze harassing patterns.

##### File structure
- Top-level files
- app.py – the main Flask application entry point
- Procfile – deployment config (e.g., Heroku)
- requirements.txt – Python dependencies
- README.md – project overview and instructions
- Directories
- static/ – client-side assets (scripts.js, captured images folder)
- docs/ – PDF and LaTeX documentation describing the system
- No explicit templates/ folder is shown, so HTML views may be rendered directly in app.py or bundled inline; JavaScript logic lives in static/scripts.js.
- The absence of a database directory suggests file-based storage (logs, image captures) rather than an RDBMS/NoSQL store.

##### README for additional insights
- Key features: user authentication, permissions prompting (location, camera, microphone), data collection (IP, geolocation, device fingerprint), PDF generation with steganography, encrypted tracking links, AI analysis (Gemini API), email reporting (SMTP), logging.
- Workflow: login → grant permissions → view “complaints” → download PDF with embedded UUID link → user later clicks link → callback hits /verify endpoint → logs correlate identity → scheduled AI analysis batches and sends summary emails.
- Dependencies reveal subcomponents: ReportLab (PDF), cryptography & stegano (data embedding), PyPDF2 (PDF parsing), google-generativeai, netifaces, faker.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Layer 1: Client
    subgraph "Layer 1: Client"
        Browser["Browser"]:::client
        JS["Permission & Tracking JS"]:::client
    end

    Browser -->|Prompt permissions| JS
    JS -->|POST /collect| DataCollector
    Browser -->|GET /login| Auth
    Browser -->|GET /download PDF| PDFGen
    Browser -->|Click tracking link| Verify

    %% Layer 2: Server (Flask)
    subgraph "Layer 2: Server (Flask)"
        Auth["Auth Module"]:::server
        DataCollector["Data Collector Module"]:::server
        PDFGen["PDF Generator Module<br/>(ReportLab + cryptography + stegano)"]:::server
        Verify["Verification Endpoint"]:::server
        AISched["AI Scheduler (cron)"]:::server
        Emailer["Email Module<br/>(smtplib)"]:::server
        Logger["Logger Module"]:::server
        Env[".env Config"]:::serverConfig
    end

    JS --> DataCollector
    Auth -->|Validate credentials| Logger
    DataCollector -->|Write logs & images| FS
    PDFGen -->|Generate & embed data| FS
    Verify -->|Log callback| Logger
    Verify --> FS
    AISched -->|Read logs| FS
    AISched -->|Batch data| Gemini
    AISched -->|Trigger email| Emailer
    Emailer -->|Send report| SMTP

    Env -.-> AISched
    Env -.-> Emailer

    %% Layer 3: External Services
    subgraph "Layer 3: External Services"
        Gemini["Gemini AI API"]:::external
        SMTP["SMTP Server"]:::external
    end

    %% Layer 4: Persistence
    subgraph "Layer 4: Persistence"
        FS["File System Storage"]:::storage
    end

    %% Docs & Config
    subgraph "Docs & Config"
        README["README.md"]:::docs
        DocsDir["docs/"]:::docs
        Req["requirements.txt"]:::docs
        Proc["Procfile"]:::docs
        StaticDir["static/"]:::client
    end

    %% Click Events
    click JS "https://github.com/ronit26mehta/pdf-ops/blob/main/static/scripts.js"
    click Auth "https://github.com/ronit26mehta/pdf-ops/blob/main/app.py"
    click DataCollector "https://github.com/ronit26mehta/pdf-ops/blob/main/app.py"
    click PDFGen "https://github.com/ronit26mehta/pdf-ops/blob/main/app.py"
    click Verify "https://github.com/ronit26mehta/pdf-ops/blob/main/app.py"
    click AISched "https://github.com/ronit26mehta/pdf-ops/blob/main/app.py"
    click Emailer "https://github.com/ronit26mehta/pdf-ops/blob/main/app.py"
    click Logger "https://github.com/ronit26mehta/pdf-ops/blob/main/app.py"
    click README "https://github.com/ronit26mehta/pdf-ops/blob/main/README.md"
    click DocsDir "https://github.com/ronit26mehta/pdf-ops/tree/main/docs/"
    click Req "https://github.com/ronit26mehta/pdf-ops/blob/main/requirements.txt"
    click Proc "https://github.com/ronit26mehta/pdf-ops/tree/main/Procfile"
    click StaticDir "https://github.com/ronit26mehta/pdf-ops/tree/main/static/"

    %% Styles
    classDef client fill:#add8e6,stroke:#333,stroke-width:1px
    classDef server fill:#90ee90,stroke:#333,stroke-width:1px
    classDef external fill:#ffcc99,stroke:#333,stroke-width:1px
    classDef storage fill:#d3d3d3,stroke:#333,stroke-width:1px
    classDef docs fill:#f0e68c,stroke:#333,stroke-width:1px
    classDef serverConfig fill:#98fb98,stroke:#333,stroke-width:1px
```
