# docling-project/docling-eval architecture

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

- Interactive diagram: https://gitdiagram.com/docling-project/docling-eval
- Repository: https://github.com/docling-project/docling-eval

## Overview

● Benchmark Modules: Under “docling_eval/benchmarks”, there are multiple subdirectories (cvat_annotation, doclaynet_v1, doclaynet_v2, dpbench, funsd, omnidocbench, tableformer_huggingface_otsl, xfund). These modules encapsulate logic for different evaluation benchmarks. Represent each as a separate node or group of nodes that can be labeled by the benchmark or at least “Benchmark Engines.”
● Converters: The “docling_eval/converters” package (including its models subdirectories) handles the conversion of documents into a format suitable for evaluation. This is an important processing component.
● Visualization: The “docling_eval/visualisation” module handles the transformation of evaluation results into visuals (constants and visualization routines). Indicate this as the result presentation layer.

##### Relationships and Interactions
● The CLI (front-end) takes user input – options and parameters for evaluation tasks – and then routes these calls.
● Each Benchmark module (like those for DP-Bench and OmniDocBench) acts as a plug-in that uses the common pipeline (converter → evaluator → visualizer). You might group these as “Benchmark Adapters”.
● Optionally, show integration with pre-defined examples and tests (docs/examples and tests directories) that validate the overall flow.

##### Architectural Patterns and Design Principles
● Modularity: Every functional section (CLI, converters, evaluators, benchmarks, visualization) is cleanly separated into its own Python package.
● Pipeline-based Flow: The process follows a clear sequence of steps where data is converted, evaluated, and then visualized.
● Consistent Interfaces: Although not explicitly shown in the files, the similar structure of “create.py” scripts across different benchmarks suggests a common interface pattern for invoking benchmark evaluations.

##### Relevant Technologies and Frameworks
● Python Packaging: Use of Poetry (see .github/actions/setup-poetry) suggests an emphasis on dependency management.
● CLI Framework: The CLI is implemented in Python (likely using argparse or click, as implied by the help output).
● Testing & CI: GitHub workflows and pre-commit configurations highlight continuous integration and code quality processes.
● External Evaluations and Visualization: The system relies on standard Python libraries and potentially machine learning / data evaluation frameworks (likely hinted by the references to reading order and table structure evaluators).

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "User Interaction and CLI"
        CLI["CLI (docling_eval/cli/main.py)"]:::interface
    end

    subgraph "Processing Pipeline"
        CONV["Converters (docling_eval/converters)"]:::proc
        EVAL["Evaluators (docling_eval/evaluators/)"]:::proc
        VIS["Visualization (docling_eval/visualisation)"]:::output
    end

    subgraph "Benchmark Modules"
        BM1["CVAT Annotation"]:::benchmark
        BM2["DocLayNet V1"]:::benchmark
        BM3["DocLayNet V2"]:::benchmark
        BM4["DP-Bench"]:::benchmark
        BM5["FUNSD"]:::benchmark
        BM6["OmniDocBench"]:::benchmark
        BM7["Tableformer (Huggingface OTSL)"]:::benchmark
        BM8["XFund"]:::benchmark
    end

    subgraph "Supporting Modules"
       CI["GitHub CI/CD"]:::support
       EX["Examples (docs/examples)"]:::support
       TEST["Tests (tests/)"]:::support
    end

    CLI -->|"passes_input"| CONV
    CONV -->|"sends_data"| BM1
    CONV -->|"sends_data"| BM2
    CONV -->|"sends_data"| BM3
    CONV -->|"sends_data"| BM4
    CONV -->|"sends_data"| BM5
    CONV -->|"sends_data"| BM6
    CONV -->|"sends_data"| BM7
    CONV -->|"sends_data"| BM8
    BM1 -->|"invokes_evaluation"| EVAL
    BM2 -->|"invokes_evaluation"| EVAL
    BM3 -->|"invokes_evaluation"| EVAL
    BM4 -->|"invokes_evaluation"| EVAL
    BM5 -->|"invokes_evaluation"| EVAL
    BM6 -->|"invokes_evaluation"| EVAL
    BM7 -->|"invokes_evaluation"| EVAL
    BM8 -->|"invokes_evaluation"| EVAL
    CONV -->|"or_directly"| EVAL
    EVAL -->|"produces_metrics"| VIS

    CLI --- CI
    CLI --- EX
    CLI --- TEST

    click CLI "https://github.com/docling-project/docling-eval/blob/main/docling_eval/cli/main.py"
    click BM1 "https://github.com/docling-project/docling-eval/tree/main/docling_eval/benchmarks/cvat_annotation/"
    click BM2 "https://github.com/docling-project/docling-eval/blob/main/docling_eval/benchmarks/doclaynet_v1/create.py"
    click BM3 "https://github.com/docling-project/docling-eval/blob/main/docling_eval/benchmarks/doclaynet_v2/create.py"
    click BM4 "https://github.com/docling-project/docling-eval/blob/main/docling_eval/benchmarks/dpbench/create.py"
    click BM5 "https://github.com/docling-project/docling-eval/blob/main/docling_eval/benchmarks/funsd/create.py"
    click BM6 "https://github.com/docling-project/docling-eval/blob/main/docling_eval/benchmarks/omnidocbench/create.py"
    click BM7 "https://github.com/docling-project/docling-eval/blob/main/docling_eval/benchmarks/tableformer_huggingface_otsl/create.py"
    click BM8 "https://github.com/docling-project/docling-eval/blob/main/docling_eval/benchmarks/xfund/create.py"
    click CONV "https://github.com/docling-project/docling-eval/blob/main/docling_eval/converters/conversion.py"
    click EVAL "https://github.com/docling-project/docling-eval/tree/main/docling_eval/evaluators/"
    click VIS "https://github.com/docling-project/docling-eval/blob/main/docling_eval/visualisation/visualisations.py"
    click CI "https://github.com/docling-project/docling-eval/tree/main/.github/actions/setup-poetry/"
    click EX "https://github.com/docling-project/docling-eval/tree/main/docs/examples/"
    click TEST "https://github.com/docling-project/docling-eval/tree/main/tests/"

    classDef interface fill:#f9c,stroke:#333,stroke-width:2px;
    classDef proc fill:#bbf,stroke:#333,stroke-width:2px;
    classDef benchmark fill:#cfc,stroke:#333,stroke-width:2px;
    classDef output fill:#ffe,stroke:#333,stroke-width:2px;
    classDef support fill:#ddd,stroke:#333,stroke-width:2px;
```
