# charbeldaher34/resumes-ocr architecture

> Architecture diagram of the GitHub repository charbeldaher34/resumes-ocr, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-03-31). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/charbeldaher34/resumes-ocr
- Repository: https://github.com/charbeldaher34/resumes-ocr

## Overview

##### Main Components
- User Interface: Represented by the Streamlit application (app.py). This is the front-facing component where users provide their Gemini API key, select the directory of CV documents, and trigger the processing.
- Document Processing Core: Shown by the processing modules (processor.py and processor_async.py). These modules encapsulate the logic to parse and extract structured information from the CV documents.
- Gemini AI Integration: Highlight the role of Gemini AI (possibly invoked via gemini_module.py) where the CV document data is analyzed and converted into structured information.
- Data Management: Note that Pandas is used for handling data operations and exporting the results to a CSV file (cv_data.csv). Also indicate the default input documents directory (cvs/) where the CVs are stored.
- Configuration & Dependencies: Include the role of configuration files (pyproject.toml, .gitignore, .python-version, and uv.lock) which manage the project’s dependencies and setup.

##### Relationships and Interactions
- Processing Flow: The Streamlit UI (app.py) calls upon processor.py (or processor_async.py for future asynchronous processing) to handle file reading, document parsing, and data extraction.
- Data Output: After the processing is finished, the extracted data is managed by Pandas and then exported to a CSV file. Represent this flow from the processing logic to “Data Export (CSV)” storage.

##### Architectural Patterns and Principles
- Separation of Concerns: Clearly separate the UI (app.py), processing logic (processor.py/processor_async.py), and external integrations (Gemini AI). Each component should be illustrated with proper boundaries.
- API Key and Environment Configuration: Emphasize the importance of configuration settings (GEMINI_API_KEY via a .env file) that feed into the system at runtime.

##### Relevant Technologies and Frameworks
- Python 3.12+ is the foundation.
- Streamlit for the UI.
- Gemini AI for data extraction.
- PDF and DOCX libraries for document processing.
- Pandas for data management.
- uv tool for dependency management as indicated by uv.lock and usage instructions in the README.
- (Optional) pydantic-ai might be implicitly involved as described in the README.

- From the “CV Documents (cvs/)” to the “Document Processor”.
- From the “Streamlit UI” to call the processor.
- From the “Document Processor” to “Gemini AI” (for data extraction).
- From the “Document Processor” to “Pandas / CSV Export” for saving the output.
- You detail all components as well as data/control flows, staying true to the key architectural elements of the application.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% CV Documents Input
    E["CV Documents (cvs/)"]:::backend

    %% User Interface
    subgraph "User Interface"
        A["Streamlit UI (app.py)"]:::ui
    end

    %% Document Processing Modules
    subgraph "Document Processing"
        B1["Synchronous Processor (processor.py)"]:::backend
        B2["Asynchronous Processor (processor_async.py)"]:::backend
    end

    %% External Service Integration
    subgraph "External Services"
        C["Gemini AI Integration (gemini_module.py)"]:::external
    end

    %% Data Management
    subgraph "Data Management"
        D["CSV Data Export (Pandas)"]:::backend
    end

    %% Configuration & Dependencies
    subgraph "Configuration & Dependencies"
        F1[".gitignore"]:::config
        F2[".python-version"]:::config
        F3["pyproject.toml"]:::config
        F4["uv.lock"]:::config
    end

    %% Data & Control Flow Connections
    E -->|"provides docs"| B1
    E -->|"provides docs"| B2
    A -->|"triggers"| B1
    A -->|"triggers"| B2
    B1 -->|"calls"| C
    B2 -->|"calls"| C
    B1 -->|"exports"| D
    B2 -->|"exports"| D

    %% Configuration Influences (dotted connections)
    F1 -.->|"configures"| A
    F2 -.->|"configures"| B1
    F3 -.->|"configures"| B2
    F4 -.->|"configures"| C

    %% Click Events for Components
    click A "https://github.com/charbeldaher34/resumes-ocr/blob/main/app.py"
    click B1 "https://github.com/charbeldaher34/resumes-ocr/blob/main/processor.py"
    click B2 "https://github.com/charbeldaher34/resumes-ocr/blob/main/processor_async.py"
    click C "https://github.com/charbeldaher34/resumes-ocr/blob/main/gemini_module.py"
    click F1 "https://github.com/charbeldaher34/resumes-ocr/blob/main/.gitignore"
    click F2 "https://github.com/charbeldaher34/resumes-ocr/blob/main/.python-version"
    click F3 "https://github.com/charbeldaher34/resumes-ocr/blob/main/pyproject.toml"
    click F4 "https://github.com/charbeldaher34/resumes-ocr/blob/main/uv.lock"

    %% Styles
    classDef ui fill:#b3e5fc,stroke:#0277bd,stroke-width:2px;
    classDef backend fill:#c8e6c9,stroke:#2e7d32,stroke-width:2px;
    classDef external fill:#ffe082,stroke:#ff8f00,stroke-width:2px;
    classDef config fill:#ffccbc,stroke:#d84315,stroke-width:2px;
```
