# datadome/sliceline architecture

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

- Interactive diagram: https://gitdiagram.com/datadome/sliceline
- Repository: https://github.com/datadome/sliceline

## Overview

##### Project type and purpose
- Sliceline is an open-source Python library (packaged for PyPI) that implements the “SliceLine” algorithm for fast, linear‐algebra-based slice finding in ML model debugging.
- It is not a web app or microservice but a reusable library, with supporting demos, docs, CI/CD, and packaging.

##### File structure
- Top-level:
- .github/workflows: CI pipelines for testing, releases, documentation.
- docs/: Sphinx documentation source, ReadTheDocs integration.
- notebooks/: Jupyter tutorials demonstrating library usage.
- sliceline/: core Python package—`slicefinder.py` (API & algorithm), `validation.py` (input checks).
- tests/: pytest test suite and fixtures.
- setup files (pyproject.toml, setup.cfg, Makefile) for build, lint, packaging.

##### README for additional insights
- Confirms Python ≥3.10, pip installation, basic usage (`fit`, `transform`, `top_slices_`).
- Points to demo notebooks and the original research paper.
- Mentions packaging/publishing (PyPI wheels) and docs on ReadTheDocs.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% User Clients
    subgraph "User Clients"
        direction TB
        NB1["Notebook: Titanic dataset"]:::client
        NB2["Notebook: California housing dataset"]:::client
    end

    %% Core Package
    subgraph "Core Package: sliceline/"
        direction TB
        API["Slicefinder API & Algorithm"]:::api
        VAL["Validation Module"]:::api
        API -->|"uses validation"| VAL
    end

    %% Output Objects
    subgraph "Output"
        direction TB
        TS["top_slices_ & transformed data"]:::data
    end

    %% Dev Tooling & Packaging
    subgraph "Packaging & Repo Metadata"
        direction TB
        PYP["pyproject.toml"]:::pack
        SETC["setup.cfg"]:::pack
        MK["Makefile"]:::pack
        PRE[".pre-commit-config.yml"]:::pack
        REPO["README.rst, CODE_OF_CONDUCT.md, CONTRIBUTING.md, LICENSE"]:::pack
    end

    %% Test Suite
    subgraph "Test Suite: tests/"
        direction TB
        TSUI["tests/"]:::test
        CFT["conftest.py"]:::test
        TST["test_slicefinder.py"]:::test
        EXP["experiment.py"]:::test
        TSUI --> CFT
        TSUI --> TST
        TSUI --> EXP
    end

    %% Documentation
    subgraph "Documentation: docs/"
        direction TB
        DSRC["docs/source/"]:::doc
        IDX["index.rst"]:::doc
        SLICERST["Slicefinder.rst"]:::doc
        CONF["conf.py"]:::doc
        BUILD["make.bat"]:::doc
        DSRC --> IDX
        DSRC --> SLICERST
        DSRC --> CONF
    end

    %% CI/CD
    subgraph "CI/CD Workflows"
        direction TB
        WF1["push-pull.yml"]:::ci
        WF2["test-release.yml"]:::ci
        WF3["release.yml"]:::ci
    end

    %% External Services
    subgraph "External Services"
        direction TB
        GH["GitHub"]:::external
        PYPI["PyPI"]:::external
        RTD["ReadTheDocs"]:::external
    end

    %% Interactions
    NB1 -->|"calls fit()/transform() on"| API
    NB2 -->|"calls fit()/transform() on"| API
    API -->|"produces"| TS

    GH -->|"on push/pull triggers"| WF1
    GH -->|"on tag triggers"| WF2
    GH -->|"on release triggers"| WF3
    WF1 -->|"runs pytest"| TSUI
    WF2 -->|"builds & publishes wheel"| PYPI
    WF3 -->|"publishes release"| PYPI
    DSRC -->|"Sphinx build"| BUILD
    BUILD -->|"deploy docs to"| RTD

    %% Click Events
    click NB1 "https://github.com/datadome/sliceline/blob/main/notebooks/1. Implementing Sliceline on Titanic dataset.ipynb"
    click NB2 "https://github.com/datadome/sliceline/blob/main/notebooks/2. Implementing Sliceline on California housing dataset.ipynb"
    click API "https://github.com/datadome/sliceline/blob/main/sliceline/slicefinder.py"
    click VAL "https://github.com/datadome/sliceline/blob/main/sliceline/validation.py"
    click TSUI "https://github.com/datadome/sliceline/tree/main/tests/"
    click CFT "https://github.com/datadome/sliceline/blob/main/tests/conftest.py"
    click TST "https://github.com/datadome/sliceline/blob/main/tests/test_slicefinder.py"
    click EXP "https://github.com/datadome/sliceline/blob/main/tests/experiment.py"
    click DSRC "https://github.com/datadome/sliceline/tree/main/docs/source/"
    click IDX "https://github.com/datadome/sliceline/blob/main/docs/source/index.rst"
    click SLICERST "https://github.com/datadome/sliceline/blob/main/docs/source/Slicefinder.rst"
    click CONF "https://github.com/datadome/sliceline/blob/main/docs/source/conf.py"
    click BUILD "https://github.com/datadome/sliceline/blob/main/docs/make.bat"
    click WF1 "https://github.com/datadome/sliceline/blob/main/.github/workflows/push-pull.yml"
    click WF2 "https://github.com/datadome/sliceline/blob/main/.github/workflows/test-release.yml"
    click WF3 "https://github.com/datadome/sliceline/blob/main/.github/workflows/release.yml"
    click PYP "https://github.com/datadome/sliceline/blob/main/pyproject.toml"
    click SETC "https://github.com/datadome/sliceline/blob/main/setup.cfg"
    click MK "https://github.com/datadome/sliceline/tree/main/Makefile"
    click PRE "https://github.com/datadome/sliceline/blob/main/.pre-commit-config.yml"

    %% Styles
    classDef client fill:#FFE4B5,stroke:#333,stroke-width:1px
    classDef api fill:#ADD8E6,stroke:#333,stroke-width:1px
    classDef data fill:#D3D3D3,stroke:#333,stroke-width:1px
    classDef pack fill:#F0F0F0,stroke:#333,stroke-width:1px
    classDef test fill:#98FB98,stroke:#333,stroke-width:1px
    classDef doc fill:#FFDEAD,stroke:#333,stroke-width:1px
    classDef ci fill:#DDA0DD,stroke:#333,stroke-width:1px
    classDef external fill:#D3D3D3,stroke:#333,stroke-width:1px
```
