# Dependencies ## Core Library Wiring ### Database Layer ``` ibis → DuckDB → MotionDatabase singleton (database.py) ↑ sqlglot (ibis dependency) ``` ### Data Processing ``` pandas → (used throughout for DataFrame operations) numpy → (used by sklearn, scipy, umap) scipy → spatial.procrustes for window alignment ``` ### ML Pipeline ``` sklearn.cluster → KMeans, Procrustes sklearn.preprocessing → StandardScaler umap → UMAP (optional, graceful fallback) ``` ### Visualization ``` plotly → explorer_helpers.py chart builders st.plotly_chart → explorer.py rendering ``` ### Streamlit ``` streamlit → all pages, @st.cache_data decorators ``` ## Optional Dependencies | Package | Required | Fallback | |---------|----------|----------| | `umap` | No | Use raw SVD vectors (first 2 dims) | | `plotly` | Yes | Raises ImportError | | `duckdb` | Yes | — | | `ibis` | Yes | — | | `sklearn` | Yes | — | ## Singleton Instances | Module | Instance | Type | |--------|----------|------| | `database.py` | `db` | `MotionDatabase` | | `config.py` | `config` | `Config` (dataclass) | | `config.py` | `PARTY_COLOURS` | `dict[str, str]` | ## Key Imports by File ``` explorer.py: - import streamlit as st - from database import db - from explorer_helpers import * explorer_helpers.py: - import pandas as pd - import plotly.graph_objects as go - from database import db (optional, for type hints) database.py: - import ibis - import duckdb - from config import config, PARTY_COLOURS config.py: - from dataclasses import dataclass, field - import streamlit as st (optional, for warnings) ``` ## Environment - Python ≥3.13 - Environment variables via `.env` (DB path, API keys) - No `.env` values in constraint files (security)