# plinder-org/plinder architecture

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

- Interactive diagram: https://gitdiagram.com/plinder-org/plinder
- Repository: https://github.com/plinder-org/plinder

## Overview

##### Main Components

a. Data Processing Pipeline
- Input Sources (PDB, BindingDB, ChEMBL)
- Data Processing Components
- Storage Systems (Google Cloud Storage)
- Quality Control Pipeline

b. Core Framework Components
- Index Management System
- Structure Processing System
- Score Calculation System
- Dataset Loading System
- Split Management System

c. Evaluation Framework
- Benchmark System
- Metrics Collection
- Results Analysis

##### Component Relationships

Layer 1 - Data Ingestion and Storage:
- Data sources feeding into the processing pipeline
- Docker containers for processing (visible in dockerfiles/)
- GCS bucket storage system

Layer 2 - Core Processing:
- Structure the core components (from src/plinder/core/):
- Index management (index/)
- Structure processing (structure/)
- Score calculations (scores/)
- Dataset management (loader/)
- Split handling (split/)

Layer 3 - API and Interface:
- Public API endpoints
- Documentation system
- Evaluation harness integration

##### Key Flows to Highlight

a. Data Processing Flow:
**Raw Data Sources → Docker Containers → Processing Pipeline → GCS Storage**

b. Usage Flow:
**User Request → API → Core Components → Data Retrieval → Results**

c. Evaluation Flow:
**Test Data → Benchmark System → Metrics Collection → Results Analysis**

##### Important Subsystems

Dedicated sections for:
- Pipeline Configuration (flows/configs/)
- Quality Control Systems
- Documentation Generation (docs/)
- Test Framework (tests/)

##### Integration Points

Highlight:
- Docker container integration
- Cloud storage interaction
- External API connections
- Testing framework integration

##### Technical Details

- Python package dependencies
- Docker container relationships
- Database schemas
- API endpoints
- Configuration systems

##### The extensive testing and documentation infrastructure

Remember to include version control and release management components, as the system supports different PLINDER versions and iterations.

## Diagram (Mermaid)

```mermaid
graph TB
    %% Define styles
    classDef storage fill:#3498db,stroke:#2980b9,color:white
    classDef processing fill:#2ecc71,stroke:#27ae60,color:white
    classDef api fill:#f1c40f,stroke:#f39c12,color:black
    classDef validation fill:#e74c3c,stroke:#c0392b,color:white
    classDef external fill:#9b59b6,stroke:#8e44ad,color:white
    classDef docs fill:#95a5a6,stroke:#7f8c8d,color:white

    subgraph DataSources["External Data Sources"]
        PDB[PDB]:::external
        BindingDB[BindingDB]:::external
        ChEMBL[ChEMBL]:::external
    end

    subgraph DataProcessing["Data Processing Pipeline"]
        DI["Data Ingestion"]:::processing
        PC["Pipeline Configuration"]:::processing
        QC["Quality Control"]:::validation
        SI["Storage Integration"]:::storage
    end

    subgraph CoreFramework["Core Framework"]
        subgraph IndexMgmt["Index Management"]
            IM["Index System"]:::processing
        end
        
        subgraph StructureProc["Structure Processing"]
            SP["Structure Handler"]:::processing
        end
        
        subgraph ScoreCalc["Score Calculation"]
            SC["Score System"]:::processing
        end
        
        subgraph DatasetMgmt["Dataset Management"]
            DL["Dataset Loader"]:::processing
            SM["Split Manager"]:::processing
        end
    end

    subgraph EvalFramework["Evaluation Framework"]
        BS["Benchmark System"]:::processing
        DE["Docking Evaluation"]:::processing
        RA["Results Analysis"]:::processing
    end

    subgraph DataMgmt["Data Management"]
        DB["Database Handler"]:::storage
        SMP["Small Molecule Processor"]:::processing
        STM["Structure Manager"]:::processing
    end

    subgraph Documentation["Documentation"]
        API["API Docs"]:::docs
        TUT["Tutorials"]:::docs
        EX["Examples"]:::docs
    end

    subgraph Testing["Testing Framework"]
        CT["Core Tests"]:::validation
        DT["Data Tests"]:::validation
        ET["Evaluation Tests"]:::validation
    end

    %% Relationships
    PDB & BindingDB & ChEMBL --> DI
    DI --> QC
    QC --> SI
    PC --> DI

    SI --> DB
    DB --> DL
    SP --> STM
    STM --> SC
    DL --> BS
    SM --> BS
    BS --> DE
    DE --> RA

    %% Click events
    click DI "https://github.com/plinder-org/plinder/blob/main/flows/data_ingest.py"
    click PC "https://github.com/plinder-org/plinder/tree/main/flows/configs/"
    click QC "https://github.com/plinder-org/plinder/blob/main/src/plinder/data/final_structure_qc.py"
    click SI "https://github.com/plinder-org/plinder/blob/main/src/plinder/core/utils/gcs.py"
    click IM "https://github.com/plinder-org/plinder/tree/main/src/plinder/core/index/"
    click SP "https://github.com/plinder-org/plinder/tree/main/src/plinder/core/structure/"
    click SC "https://github.com/plinder-org/plinder/tree/main/src/plinder/core/scores/"
    click DL "https://github.com/plinder-org/plinder/tree/main/src/plinder/core/loader/"
    click SM "https://github.com/plinder-org/plinder/tree/main/src/plinder/core/split/"
    click BS "https://github.com/plinder-org/plinder/tree/main/src/plinder/eval/"
    click DE "https://github.com/plinder-org/plinder/tree/main/src/plinder/eval/docking/"
    click RA "https://github.com/plinder-org/plinder/blob/main/src/plinder/eval/docking/make_plots.py"
    click DB "https://github.com/plinder-org/plinder/blob/main/src/plinder/data/databases.py"
    click SMP "https://github.com/plinder-org/plinder/blob/main/src/plinder/data/smallmolecules.py"
    click STM "https://github.com/plinder-org/plinder/tree/main/src/plinder/data/structure/"
    click API "https://github.com/plinder-org/plinder/tree/main/docs/api/"
    click TUT "https://github.com/plinder-org/plinder/tree/main/docs/tutorial/"
    click EX "https://github.com/plinder-org/plinder/tree/main/docs/examples/"
    click CT "https://github.com/plinder-org/plinder/tree/main/tests/core/"
    click DT "https://github.com/plinder-org/plinder/tree/main/tests/data/"
    click ET "https://github.com/plinder-org/plinder/blob/main/tests/test_eval.py"

    %% Legend
    subgraph Legend
        L1[Storage]:::storage
        L2[Processing]:::processing
        L3[API/Interface]:::api
        L4[Validation]:::validation
        L5[External]:::external
        L6[Documentation]:::docs
    end
```
