DeepSky-Classifier
DeepSky-Classifier is a high-performance astronomical data pipeline and inference engine.
DeepSky-Classifier
DeepSky-Classifier is an astronomical data pipeline and machine learning system that automates extraction, processing, and classification of celestial bodies (Stars, Galaxies, Quasars) using spectral data from multiple sky surveys.
Built with Python 3.13, uv, Pydantic V2, and Scikit-Learn.
Architecture
Stack
| Component | Technology | Purpose |
|---|---|---|
| Language | Python 3.13 | Modern syntax, type hints, match/case |
| Package Manager | uv | Rust-based, instant dependency resolution |
| Extraction | Astroquery + PyVO | SDSS SQL queries and Gaia TAP access |
| Validation | Pydantic V2 | Strict schema contracts at every boundary |
| Storage | Parquet + SQLAlchemy 2 | Columnar analytics + relational metadata |
| ML | Scikit-Learn | Random Forest ensemble classification |
| Orchestration | Prefect 3 | Resilient flows with retries and observability |
| Quality | Ruff + Pytest | Linting and test coverage |
Project Structure
src/
core/
config.py Pipeline configuration
database.py SQLAlchemy engine and session management
integrity.py SHA-256 file verification
models.py ORM models (raw + curated tables)
schemas.py Pydantic schemas (raw, curated, validation)
etl/
catalogs/
base.py Abstract catalog extractor interface
gaia.py Gaia DR3 TAP extractor
sdss.py SDSS DR17 extractor
crossmatch.py Catalog cross-matching utilities
federated.py Multi-catalog federated pipeline
ingest.py SDSS-only baseline pipeline
persist.py Parquet/CSV persistence
validate.py Row-level schema validation with quarantine
ml/
evaluate.py Classification metrics
features.py Feature selection and contract
train.py Random Forest training with artifact persistence
utils/
logger.py Colored logging
workflows/
pipeline.py Prefect-orchestrated end-to-end flow
tests/
test_features.py Feature contract stability
test_query.py SDSS query generation
test_schemas.py Schema validation boundaries
Data Sources
| Source | Parameters | Classification Contribution |
|---|---|---|
| SDSS DR17 | Optical photometry (u, g, r, i, z), redshift | Baseline: temperature, distance, velocity |
| Gaia DR3 | Parallax, proper motion (pmra, pmdec) | Galactic vs extragalactic separation |
Installation
Prerequisites
- Python 3.13+
- uv
Setup
Run the SDSS-only Pipeline
Run the Federated Pipeline (SDSS + Gaia)
Train the Model
Run the Full Orchestrated Pipeline
Run Tests
Lint
Run with Docker Compose
Brings up the full architecture: Postgres on an isolated backend network, the API reachable only through Nginx on edge, TLS terminated at the edge. Matches the addressing plan documented in the mémoire (bloc 1, §9.3). Postgres also gets two roles instead of one: deepsky_admin owns the schema and is the only role migrate connects as, deepsky_app is DML-only (no CREATE/DROP) and is what api and pipeline connect as — see docker/postgres/init-app-role.sh.
The API is then only reachable through Nginx at https://localhost/health (self-signed cert, expect a browser warning locally). To run the ETL pipeline once against the containerised stack:
License
This project is licensed under the GNU GPLv3 License. See the LICENSE file for details.
Pierre Roy