# aaramis/decaf architecture

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

- Interactive diagram: https://gitdiagram.com/aaramis/decaf
- Repository: https://github.com/aaramis/decaf

## Overview

##### Main Components
- CLI Interface: Represent the command-line interface (invoked via commands like “decaf process …”) that serves as the entry point for users.
- Core Library Modules: Showcase the key packages under the “decaf” directory, especially:
– Preprocessing: Handles input data transformation, filtering, and preparation.
– Utils: Provides shared utilities (data helper functions, common algorithms, etc.).
- Deep Learning / Classification Engine: Even if not explicitly separate, highlight the part of the core code that leverages deep learning to classify sequences and detect contaminants.
- File I/O & Format Support: Illustrate how FASTQ and FASTA files are received, processed, and output.
- Testing & Continuous Integration: Optionally include a component for unit tests (in the “tests” directory) and external workflows (as seen in the “.github/workflows” directory).
- Documentation & Configuration: Indicate that the project contains integrated documentation (using MkDocs in “docs” and “my-project/docs”) along with configuration files (pyproject.toml, setup.py, requirements.txt).

##### Relationships and Interactions
- The CLI routes the command to the appropriate backend modules: first into preprocessing where raw DNA sequence data (FASTQ/FASTA) gets ingested.
- Then the classification engine (core module possibly within preprocessing or a dedicated sub-component) processes the data, using deep learning models for filtering contaminant sequences.
- Utility modules assist in common tasks (such as logging, data transformation, or additional validations).
- Processed/Filtered output is then written back as cleaned files.
- Side modules handle tasks such as testing (auto-run via GitHub Actions) and documentation build/deployment.

##### Architectural Patterns and Design Principles
- Modular Design: Emphasize separation into distinct modules (CLI, preprocessing, utils) to allow extensibility for other genetic markers or taxa.
- Pipeline Structure: Data flows sequentially from input through preprocessing to deep learning classification and result output.
- Integration of DevOps: Use of CI/CD workflows for testing, linting, and documentation deployment ensures consistent quality.
- Clear Separation of Concerns helps in isolating core functionality from auxiliary services (environment configuration and documentation).

##### Relevant Technologies and Frameworks
- Python ecosystem (virtual environments, pip dependencies, black for code formatting).
- Command-Line Interface design (the “decaf” command in decaf-env/bin).
- Deep learning (while specific frameworks aren’t named, indicating “deep learning” is a core technology is important).
- MkDocs for documentation, as shown by mkdocs.yml and docs directories.
- GitHub Actions for continuous integration.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Global Entities
    A["User / CLI"]:::external

    %% Core Processing Pipeline
    B["CLI Interface"]:::core
    C["Preprocessing Module"]:::core
    D["Deep Learning Classifier"]:::core
    E["Shared Utilities"]:::core
    F["File I/O & Format Support"]:::core

    %% Auxiliary Services: Testing & Continuous Integration
    subgraph "Testing & Continuous Integration"
        T["Unit Tests"]:::aux
        W["GitHub Workflows"]:::aux
    end

    %% Auxiliary Services: Documentation & Configuration
    subgraph "Documentation & Configuration"
        Doc1["Docs"]:::aux
        Doc2["Project Docs"]:::aux
        Doc3["mkdocs.yml"]:::aux
        Doc4["pyproject.toml"]:::aux
        Doc5["requirements.txt"]:::aux
        Doc6["setup.py"]:::aux
    end

    %% Data Flow Connections
    A -->|"invokes"| B
    B -->|"processes_input"| C
    C -->|"calls_DL_model"| D
    C -->|"reads/writes"| F
    C -->|"utilizes"| E
    D -->|"returns_results"| C

    %% Auxiliary Integrations from the CLI Interface
    B -->|"triggers_tests"| T
    B -->|"initiates_workflow"| W
    B -->|"builds_docs"| Doc1
    B -->|"builds_docs"| Doc2
    B -->|"reads_config"| Doc3
    B -->|"reads_config"| Doc4
    B -->|"reads_config"| Doc5
    B -->|"reads_config"| Doc6

    %% Click Events for Component Mapping
    click B "https://github.com/aaramis/decaf/tree/main/decaf-env/bin/decaf"
    click C "https://github.com/aaramis/decaf/tree/main/decaf/preprocessing"
    click E "https://github.com/aaramis/decaf/tree/main/decaf/utils"
    click T "https://github.com/aaramis/decaf/tree/main/tests"
    click W "https://github.com/aaramis/decaf/tree/main/.github/workflows"
    click Doc1 "https://github.com/aaramis/decaf/tree/main/docs"
    click Doc2 "https://github.com/aaramis/decaf/tree/main/my-project/docs"
    click Doc3 "https://github.com/aaramis/decaf/blob/main/mkdocs.yml"
    click Doc4 "https://github.com/aaramis/decaf/blob/main/pyproject.toml"
    click Doc5 "https://github.com/aaramis/decaf/blob/main/requirements.txt"
    click Doc6 "https://github.com/aaramis/decaf/blob/main/setup.py"

    %% Styles
    classDef external fill:#f9f,stroke:#333,stroke-width:2px;
    classDef core fill:#bbf,stroke:#333,stroke-width:2px;
    classDef aux fill:#cfc,stroke:#333,stroke-width:2px;
```
