# himmsrathore/streamlet_project architecture

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

- Interactive diagram: https://gitdiagram.com/himmsrathore/streamlet_project
- Repository: https://github.com/himmsrathore/streamlet_project

## Overview

##### Project Type and Purpose
- This is a single-repository, full-stack (UI + processing) Python application.
- It uses Streamlit (via app.py) as a lightweight web interface.
- It ingests PDFs and CSVs, converts or “flattens” them, optionally translates English text to Hindi, and emits CSV outputs.

##### File Structure
- app.py: Streamlit frontend and orchestration layer.
- converter.py, project1_csv_converter.py, project2_pdf_to_csv.py, pdf_converter_test.py: PDF→CSV and CSV→CSV conversion modules and tests.
- train_flatten.py, flattening scripts: flattening/normalizing timetable data.
- eng_to_hindi.py, english_to_hindi_google.py: translation logic (local & Google API).
- *.csv, *.pdf, *.txt: sample inputs & outputs for testing and reference.
- requirements.txt: third-party library list (e.g., streamlit, pandas, google-translate).

##### README
- Use this opportunity to complement missing documentation.

##### Main Components & Their Relationships
a. External Actors
- User (Web Browser)
- Google Translate API (for cloud translation)
b. UI Layer
- Streamlit App (app.py)
c. Processing Services
1. PDF-to-CSV Converter
- project2_pdf_to_csv.py
- converter.py
- pdf_converter_test.py (testing)
2. CSV Converter / Flattener
- project1_csv_converter.py
- train_flatten.py
3. Translation Service
- eng_to_hindi.py (local translation logic)
- english_to_hindi_google.py (invokes Google API)
d. Data Storage (local filesystem)
- Input folder (PDFs, CSVs)
- Output folder (generated CSVs)
e. Dependencies
- Python runtime
- Streamlit
- Pandas, PyPDF2 or similar
- Google translate client

##### Architectural Patterns & Design Principles
- Monolithic modular architecture: clear separation of UI (Streamlit) and processing modules.
- Pipeline pattern: input → convert → flatten → translate → output.
- Test-driven approach for PDF conversion (pdf_converter_test.py).
- Single source of truth: files on disk (no database layer).

##### Final Checklist
- [ ] User & Browser interface clearly shown.
- [ ] Streamlit App layer with “app.py” label.
- [ ] File Store with Input/Output folders.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% External Actor
    User["User\n(Web Browser)"]:::user

    %% UI Layer
    App["Streamlit App\n(app.py)"]:::ui

    %% Dependencies
    Requirements["requirements.txt"]:::doc

    %% Services
    subgraph "PDF-to-CSV Service"
        PDFLogic["converter.py"]:::service
        PDFCore["project2_pdf_to_csv.py"]:::service
        PDFTest["pdf_converter_test.py"]:::test
    end

    subgraph "CSV Flattener Service"
        CSVCore["project1_csv_converter.py"]:::service
        CSVTrain["train_flatten.py"]:::service
    end

    subgraph "Translation Service"
        LocalTrans["eng_to_hindi.py"]:::service
        GoogleTrans["english_to_hindi_google.py"]:::service
        GoogleAPI["Google Translate API"]:::external
    end

    %% Data Store
    subgraph "File System"
        Input["Input Folder\n(paper1.pdf, sample_q.csv, timetable.csv)"]:::storage
        Output["Output Folder\n(sample_q_converted.csv, simple_pdf_output.csv, test_pdf_to_csv_output.csv, flattened_timetable.csv, flattened_timetable_dn.csv, english_only_output.csv, output_only_english.csv, questions_output.csv)"]:::storage
    end

    %% Connections
    User -->|"uses"| App
    Requirements -->|"environment"| App

    App -->|"invokes"| PDFLogic
    PDFLogic -->|"calls"| PDFCore
    PDFCore -->|"tests via"| PDFTest

    App -->|"invokes"| CSVCore
    CSVCore -->|"uses"| CSVTrain

    App -->|"invokes"| LocalTrans
    App -->|"invokes"| GoogleTrans
    GoogleTrans -->|"calls API"| GoogleAPI

    Input -->|"reads"| PDFLogic
    PDFLogic -->|"writes"| Output

    Input -->|"reads"| CSVCore
    CSVTrain -->|"writes"| Output

    Input -->|"reads"| LocalTrans
    LocalTrans -->|"writes"| Output

    Input -->|"reads"| GoogleTrans
    GoogleTrans -->|"writes"| Output

    %% Click Events
    click App "https://github.com/himmsrathore/streamlet_project/blob/main/app.py"
    click PDFLogic "https://github.com/himmsrathore/streamlet_project/blob/main/converter.py"
    click PDFCore "https://github.com/himmsrathore/streamlet_project/blob/main/project2_pdf_to_csv.py"
    click PDFTest "https://github.com/himmsrathore/streamlet_project/blob/main/pdf_converter_test.py"
    click CSVCore "https://github.com/himmsrathore/streamlet_project/blob/main/project1_csv_converter.py"
    click CSVTrain "https://github.com/himmsrathore/streamlet_project/blob/main/train_flatten.py"
    click LocalTrans "https://github.com/himmsrathore/streamlet_project/blob/main/eng_to_hindi.py"
    click GoogleTrans "https://github.com/himmsrathore/streamlet_project/blob/main/english_to_hindi_google.py"
    click Requirements "https://github.com/himmsrathore/streamlet_project/blob/main/requirements.txt"

    %% Styles
    classDef user fill:#D6E9FE,stroke:#4A90E2
    classDef ui fill:#AED6F1,stroke:#2E86C1
    classDef service fill:#A9DFBF,stroke:#27AE60
    classDef external fill:#FAD7A0,stroke:#D68910
    classDef storage fill:#D5DBDB,stroke:#808B96
    classDef test fill:#F5B7B1,stroke:#C0392B
    classDef doc fill:#F2D7D5,stroke:#CD6155
```
