# himanshu-skid19/automated-multimodal-literature-review architecture

> Architecture diagram of the GitHub repository himanshu-skid19/automated-multimodal-literature-review, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-19). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/himanshu-skid19/automated-multimodal-literature-review
- Repository: https://github.com/himanshu-skid19/automated-multimodal-literature-review

## Overview

##### Project type and purpose
- This is a specialized, full-stack AI tool (an open-source Multimodal RAG QA system) that ingests text and image data, indexes it in a vector store (Qdrant), and exposes a chat interface (via Chainlit) to answer user queries by retrieving relevant documents and augmenting an LLM’s generation.

##### File structure
- Top-level scripts and entry points:
- app.py: the Chainlit-based chat server / API layer
- run_llava.py: wrapper for running the multimodal LLM (LLaVA)
- build_vector_store.py & read_docs.py: ingestion pipeline (read files, preprocess, embed, upsert)
- query.py: retrieval + RAG orchestration for a single query
- imports.py / keys.py: shared settings, API‐key management
- table_trans.py: table‐specific preprocessing for documents
- Storage and indexing:
- qdrant_mm_db/: local snapshot of the Qdrant collection
- storage/*.json: JSON‐based docstore, index_store, graph_store
- files/: raw uploaded PDF or image assets
- Configuration:
- .chainlit/: Chainlit configuration (UI layout, language translations)
- requirements.txt: Python dependencies (PyTorch, qdrant-client, Chainlit, etc.)

##### README for additional insights
- Confirms a Docker-based Qdrant vector store
- Emphasizes “Multimodal Data Integration,” “Advanced RAG Techniques,” “Wide Application Range”

##### Detail without over-splitting
- Related scripts under a single component (e.g., “Ingestion Service” encloses read_docs.py + build_vector_store.py + table_trans.py).
- Still call out the distinct phases: “Preprocessing,” “Embedding,” “Indexing,” “Retrieval,” “Generation.”

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Chainlit UI Layer
    subgraph "Chainlit UI Layer"
        direction TB
        UI["Chainlit Chat UI"]:::compute
        ChainlitConfig[".chainlit (Config)"]:::config
    end

    %% API Layer
    subgraph "Orchestration API Layer"
        direction TB
        API["app.py (Chainlit Server)"]:::compute
    end

    %% Ingestion Service
    subgraph "Ingestion Service"
        direction TB
        ReadDocs["read_docs.py"]:::compute
        BuildVS["build_vector_store.py"]:::compute
        TableTrans["table_trans.py"]:::compute
    end

    %% Retrieval & Inference Pipeline
    subgraph "Retrieval & Inference Pipeline"
        direction TB
        Query["query.py"]:::compute
        RunLlava["run_llava.py"]:::compute
    end

    %% Storage Layer
    subgraph "Storage & DB"
        direction TB
        Files["files/ (Raw Uploads)"]:::storage
        StorageJS["storage/ (JSON Stores)"]:::storage
        QdrantDB["qdrant_mm_db/ (Vector DB)"]:::external
    end

    %% Shared Config
    Imports["imports.py"]:::config
    Keys["keys.py"]:::config
    Requirements["requirements.txt"]:::config

    %% Data Flows
    UI -->|"user query"| API
    API -->|"ingest command"| ReadDocs
    ReadDocs -->|"preprocessed docs"| BuildVS
    BuildVS -->|"upsert embeddings"| QdrantDB
    BuildVS -->|"store metadata"| StorageJS
    TableTrans -->|"table preprocessing"| BuildVS

    API -->|"run query"| Query
    Query -->|"retrieve top-k"| QdrantDB
    Query -->|"metadata lookup"| StorageJS
    Query -->|"pass to model"| RunLlava
    RunLlava -->|"generated answer"| API
    API -->|"response"| UI

    %% Config relations
    Imports --> API
    Keys --> API
    Imports --> ReadDocs
    Keys --> ReadDocs
    Imports --> Query
    Keys --> Query

    %% Dependency Spec
    Requirements

    %% Click Events
    click ChainlitConfig "https://github.com/himanshu-skid19/automated-multimodal-literature-review/tree/main/.chainlit/"
    click UI "https://github.com/himanshu-skid19/automated-multimodal-literature-review/tree/main/.chainlit/"
    click API "https://github.com/himanshu-skid19/automated-multimodal-literature-review/blob/main/app.py"
    click ReadDocs "https://github.com/himanshu-skid19/automated-multimodal-literature-review/blob/main/read_docs.py"
    click BuildVS "https://github.com/himanshu-skid19/automated-multimodal-literature-review/blob/main/build_vector_store.py"
    click TableTrans "https://github.com/himanshu-skid19/automated-multimodal-literature-review/blob/main/table_trans.py"
    click QdrantDB "https://github.com/himanshu-skid19/automated-multimodal-literature-review/tree/main/qdrant_mm_db/"
    click Query "https://github.com/himanshu-skid19/automated-multimodal-literature-review/blob/main/query.py"
    click RunLlava "https://github.com/himanshu-skid19/automated-multimodal-literature-review/blob/main/run_llava.py"
    click Files "https://github.com/himanshu-skid19/automated-multimodal-literature-review/tree/main/files/"
    click StorageJS "https://github.com/himanshu-skid19/automated-multimodal-literature-review/tree/main/storage/"
    click Imports "https://github.com/himanshu-skid19/automated-multimodal-literature-review/blob/main/imports.py"
    click Keys "https://github.com/himanshu-skid19/automated-multimodal-literature-review/blob/main/keys.py"
    click Requirements "https://github.com/himanshu-skid19/automated-multimodal-literature-review/blob/main/requirements.txt"

    %% Styles
    classDef compute fill:#a2d2ff,stroke:#000,stroke-width:1px
    classDef storage fill:#caffbf,stroke:#000,stroke-width:1px
    classDef external fill:#ffb4a2,stroke:#000,stroke-width:1px
    classDef config fill:#ffe5b4,stroke:#000,stroke-width:1px,stroke-dasharray:5 5
```
