Skip to content
HmbleCreatorPublic

About

An Intelligent Harness Architecture for Astronomical Star catalogs and Astronomy Data, bridging natural language and the cosmos.

Resources

Code of conduct

Contributing

Security policy

Stars

1 star

Watchers

0 watching

Forks

Repository files navigation

TaarYaLogo

Project Status Python Pytest License Papers Stars Regions Benchmark Semantic Release Tag

Illuminating the Cosmos

TaarYa is an agentic astronomy research platform that combines spatial search, semantic paper retrieval, graph context, and an interactive observatory workflow.

Overview

TaarYa connects:

  • PostgreSQL + Q3C for sky-region and cone-search queries
  • Qdrant for semantic paper retrieval
  • Neo4j for graph relationships
  • a FastAPI backend with Chat and Explore interfaces
  • scientific exports such as VOTable, CSV, JSON, DS9 regions, and MESA inlists

The goal is to make astronomy exploration feel like a grounded research workflow rather than a collection of disconnected tools.

Current Status

As of eval-v9 (2026-11-03), the project has completed live datastore reconciliation and full evaluation harness verification.

Verified HTTP surface (11/13 endpoints green)

Method Endpoint Status
GET /health, /ready, /api/stats, /api/regions 200 OK
GET /api/stars/cone-search 200 OK
POST /api/stars/cone-search (new) 200 OK
GET/POST /api/search/hybrid 200 OK
POST /api/papers/search 200 OK
GET /api/stars/discovery, /api/stars/count 200 OK

Live Software Regression Suite (50 queries, verified live rerun)

Category Total Passed Partial Failed Pass Rate Mean Latency
Semantic 16 16 0 0 100.0% 47.2 ms
Spatial 14 9 1 4 64.3% 22.7 ms
Discovery 13 1 5 7 7.7% 15.0 ms
Hybrid 7 7 0 0 100.0% 239.4 ms
Overall 50 33 6 11 66.0% --

Recomputed directly from execution records in eval/benchmark_results.json (results_sha256: f4ebae22797cbd4c) via verify_benchmark.py. Family rows sum identically to the overall total ($9+16+1+7=33$ passed, $1+0+5+0=6$ partial, $4+0+7+0=11$ failed).

Retrieval Ablation (leak-free, 3 valid regions)

Configuration P@10 MRR nDCG@10
Spatial-Only 0.433 0.502 0.437
Semantic-Only 0.000 0.000 0.000
Hybrid (no graph) 0.633 0.669 0.645
Full Hybrid 0.433 0.502 0.426

Hybrid (spatial+semantic) is the best-performing configuration ($+46.2%$ P@10 and $+33.3%$ MRR over spatial-only). Full Hybrid adds cluster co-members via graph traversal but dilutes P@10 since the ground-truth is anomaly-based.

Verified Live Counts & Reconciled Stores (eval-v9 snapshot)

  • PostgreSQL Star Rows: 34,860 (34,300 real Gaia DR3 catalog stars + 560 synthetic benchmark fixtures)
  • Neo4j Star Nodes: 34,860 ($\Delta = 0$ star gap vs. PostgreSQL following reconciliation)
  • Neo4j Paper Nodes: 6,464
  • Qdrant Paper Points: 6,464 ($\Delta = 0$ paper gap vs. Neo4j following reconciliation)
  • Neo4j Cluster Nodes: 42 seeded sky regions (7 mapping to published open clusters in Hunt & Reffert 2023)
  • Neo4j Edges:
    • MEMBER_OF: 33,525 (radial cone-search ingestion bounds)
    • COVERS: 481
    • MENTIONED_IN: 5,420 (cluster-mediated heuristic linking)
  • Pytest Suite: 163 passed offline (pytest tests/ --ignore=tests/test_backends.py; 5 live-DB tests in test_retrieval.py and test_ingestion.py skip automatically when local PostgreSQL/Neo4j/Qdrant services are stopped).

See docs/audits/SYSTEM_AUDIT_2026-04-27.md for the bottleneck and remediation audit.

Key Features

  • Hybrid retrieval: PostgreSQL/Q3C + Qdrant + Neo4j
  • Coverage-aware chat agent with streaming responses
  • Discovery-oriented star ranking
  • Explore page with embedded Aladin-based sky view
  • Observatory workflow in Chat for result-linked sky inspection
  • Provenance-aware scientific export utilities
  • Evaluation tooling under eval/

Architecture

flowchart LR
    subgraph UI["Web Workbench - static/"]
        CHAT["chat.html + chat.js (Research Agent UI)"]
        EXPLORE["explore.html (Aladin Sky View)"]
        DASH["dashboard.html (Status and 3D Volume)"]
        TESSUI["tess.html (TESS Light Curves)"]
        TOOLSUI["settings.html + benchmark.html + stellar_detail.html"]
    end

    subgraph API["FastAPI Backend - src/main.py and src/api/"]
        SEARCH_API["search.py, stars.py, papers.py, regions.py"]
        AGENT_API["agent.py, sessions.py, projects.py"]
        DATA_API["tess.py, scientific.py, ingestion.py"]
    end

    subgraph CORE["Agent, Services and Hybrid Retrieval"]
        AGENT["src/agent/ (LangChain + Ollama glm-4.6:cloud + SSE streaming)"]
        RETR["src/retrieval/ (Q3C spatial, Qdrant vectors, Neo4j graph, discovery)"]
        TESS_SVC["src/services/tess_service.py (MAST SPOC + BLS screening)"]
        SCI["src/utils/ + src/extensions/ (HR, SED, VOTable, DS9, MESA, SAMP)"]
        AGENT --> RETR
    end

    subgraph STORES["Storage and External Archives"]
        PG["PostgreSQL 15 + Q3C (Catalog Stars, Projects, Sessions)"]
        QD["Qdrant (ArXiv Abstract Vectors)"]
        NEO["Neo4j 5 (Star-Cluster-Paper Knowledge Graph)"]
        ING["src/ingestion/ + scripts/reconcile_stores.py"]
        EXT["External Archives (Gaia DR3 TAP+, ArXiv, MAST, SIMBAD, Vizier)"]
        EXT --> ING
        ING --> PG
        ING --> QD
        ING --> NEO
    end

    CHAT --> AGENT_API
    EXPLORE --> SEARCH_API
    DASH --> SEARCH_API
    TESSUI --> DATA_API
    TOOLSUI --> DATA_API

    AGENT_API --> AGENT
    SEARCH_API --> RETR
    DATA_API --> TESS_SVC
    DATA_API --> SCI
    TESS_SVC --> EXT

    RETR --> PG
    RETR --> QD
    RETR --> NEO
Loading

Main components:

  1. src/main.py: FastAPI app, routes, startup checks, static serving
  2. src/retrieval/: spatial, semantic, graph, hybrid, and discovery search layers
  3. src/agent/: prompt building, tool orchestration, grounded chat, streaming agent flow
  4. src/api/: public HTTP routes for stars, papers, search, sessions, ingestion, agent, and scientific outputs
  5. static/: Chat, Explore, Dashboard, Settings, and observatory-side UI
  6. eval/: benchmark and ablation scripts
  7. tests/: pytest modules plus scientific verification scripts

Tech Stack

  • Backend: FastAPI, SQLAlchemy, Python 3.10+
  • Spatial DB: PostgreSQL 15 + Q3C
  • Vector DB: Qdrant
  • Graph DB: Neo4j
  • LLM runtime: Ollama + LangChain
  • Default Ollama model: glm-4.6:cloud
  • Frontend: vanilla JS / HTML / CSS with Aladin integration

Installation and Setup

Prerequisites

  • Docker Desktop
  • Python 3.10+
  • uv recommended for dependency management
  • Ollama installed locally
  • Ollama model available locally or via your configured Ollama setup:
    • glm-4.6:cloud

One-click startup

Windows:

  • run scripts\start_taarya.bat

Linux / macOS:

chmod +x scripts/start_taarya.sh
./scripts/start_taarya.sh

Manual startup

  1. Start services:
docker compose up -d
  1. Ensure the Ollama model exists:
ollama pull glm-4.6:cloud
  1. Install dependencies:
uv sync
  1. Run the app locally if you are not using the containerized app:
uv run python -m src.main

Open:

  • http://localhost:8000

Docker runtime notes:

  • the app container reaches Ollama on the host via host.docker.internal
  • override with DOCKER_OLLAMA_BASE_URL and DOCKER_OLLAMA_MODEL if needed

Verification

Recommended Verification Path

The cleanest path is the running app container:

docker exec taarya-app sh -lc "mkdir -p /tmp/pytest-cache && python -m pytest /app/tests -q -o cache_dir=/tmp/pytest-cache"
docker exec taarya-app python /app/tests/verify_scientific.py
docker exec taarya-app python /app/tests/verify_research_grade.py
docker exec taarya-app python /app/tests/verify_interop.py
docker exec taarya-app python /app/tests/verify_rigor.py

Project-Environment Verification

uv run python -m pytest tests

Focused agent checks:

uv run python -m pytest tests/test_streaming_contract.py tests/test_langchain_compat.py

Environment warning:

  • the current Windows Anaconda/base environment is not a trustworthy verifier for this repo because compiled imports such as pydantic_core and numpy have failed there during collection/import
  • prefer Docker or a fresh uv/.venv environment

Evaluation & Verification Harness

TaarYa includes an automated evaluation and data-integrity harness under taarya_workflows/real/ and eval/. It keeps synthetic regression fixtures strictly separated from real astronomical catalogs, verifies zero-gap synchronization across PostgreSQL, Neo4j, and Qdrant, and outputs deterministic JSON verification artifacts under results/.

flowchart TD
    subgraph DataStores["Production Datastores"]
        PG["PostgreSQL 15 + Q3C (34,300 real + 560 fixtures)"]
        NEO["Neo4j 5 Graph (34,860 stars, 6,464 papers, 42 clusters)"]
        QD["Qdrant Vector DB (6,464 all-MiniLM-L6-v2 embeddings)"]
        RECON["scripts/reconcile_stores.py (Zero-gap multi-store sync)"]
        RECON --> PG
        RECON --> NEO
        RECON --> QD
    end

    subgraph SnapshotHarness["1. Snapshot and Drift Guard"]
        SNAP["snapshot_counts.py"]
        COUNTS["results/counts.json (Synthetic segregated from real data)"]
        SNAP --> COUNTS
    end

    subgraph AstrometricHarness["2. Empirical Gaia DR3 Cluster Harness (HR23)"]
        CONES["cluster_cones.py (19 open clusters, uniform G <= 16 cuts)"]
        AUDIT_CONE["cone_sample_audit.py (abs(b) crowding bias check)"]
        RETR["cluster_retrieval.py (Seed-box, Mahalanobis, k-NN, PPR, HDBSCAN)"]
        SIG_TEST["Exact Sign-Flip Permutation Tests + Holm-Bonferroni + R-Precision"]
        RESL_M["results/membership.json"]
        RESL_R["results/retrieval.json"]
        CONES --> AUDIT_CONE --> RETR --> SIG_TEST
        RETR --> RESL_M
        RETR --> RESL_R
    end

    subgraph RegressionHarness["3. 50-Prompt Software Regression Suite"]
        Q_JSON["eval/benchmark_queries.json (50 curated multi-backend queries)"]
        RUNNER["eval/run_benchmark.py (Spatial, Semantic, Discovery, Hybrid)"]
        REC_JSON["eval/benchmark_results.json (Raw per-query records + timestamps)"]
        VERIFY["verify_benchmark.py (Pure-function recomputation from records)"]
        RESL_B["results/benchmark.json (SHA-256 record hashes pinned)"]
        Q_JSON --> RUNNER --> REC_JSON --> VERIFY --> RESL_B
    end

    subgraph TOIHarness["4. TESS Exoplanet Crowding Baseline"]
        TOI_DATA["NASA Exoplanet Archive / ExoFOP (8,151 TOI targets)"]
        TOI_PY["toi.py (Aperture dilution vs. 21 arcsec pixels)"]
        RESL_T["results/toi.json (Logistic regression AUC + delta CI)"]
        TOI_DATA --> TOI_PY --> RESL_T
    end

    PG --> SNAP
    NEO --> SNAP
    QD --> SNAP
Loading

Core Evaluation Subsystems

1. Datastore Reconciliation & Live Snapshotting

  • Continuous Store Synchronization (scripts/reconcile_stores.py): Reconciles PostgreSQL, Neo4j, and Qdrant until $\Delta \text{stars} = 0$ and $\Delta \text{papers} = 0$.
  • Corpus Segregation (taarya_workflows/real/snapshot_counts.py): Queries live database counts and segregates synthetic test fixtures (SYNTHETIC_BENCHMARK, 560 rows) from real astronomical observations (GAIA, GAIA_DR3, 34,300 rows) into results/counts.json.

2. Empirical Gaia DR3 Astrometric Retrieval Harness

  • Golden Ground Truth: Uses the Hunt & Reffert (2023) catalog (A&A 673, A114) covering 19 open clusters selected by uniform astrometric cuts ($N_{\text{stars}} \in [100, 1000]$, $G \le 16$, radial cones).
  • Crowding Bias Guard (cone_sample_audit.py): Confirms uniform magnitude cuts across clusters and validates that dropped dense fields sit at low Galactic latitudes ($|b| \approx 2.2^\circ$) due to TAP+ timeouts.
  • Method Comparison: Benchmarks Seed-box retrieval against Mahalanobis distance, 3D astrometric $k$-NN, Personalized PageRank on graphs, and HDBSCAN.
  • Hypothesis Testing: Uses exact sign-flip permutation tests ($2^{19} = 524{,}288$ permutations), Holm-Bonferroni corrections, and unconstrained R-precision.

3. TESS Exoplanet (TOI) Crowding Baseline

  • Evaluates transit false-positive vetting across 8,151 NASA Exoplanet Archive / ExoFOP TOI targets.
  • Computes crowding dilution coefficients ($D$) against TESS $21''$ detector pixels and $42''$ apertures (results/toi.json).

4. Software Regression Suite & Record Verification

  • Executes 50 multi-backend queries across 4 task families (eval/run_benchmark.py) and saves timestamped records in eval/benchmark_results.json.
  • verify_benchmark.py recomputes pass/partial/fail totals from per-query records ($9 + 16 + 1 + 7 = 33$ passed) and writes input SHA-256 hashes to results/benchmark.json.

5. Paired Double-Blind Study Harness (eval/)

  • Generates counterbalanced Latin-square scenario assignments (eval/prepare_study.py) for human-in-the-loop astronomical workflows (TaarYa vs. TOPCAT vs. PyVO).
  • Computes paired bootstrap confidence intervals across Precision@k, Recall@k, reciprocal rank, nDCG@k, and task completion time (eval/study_harness.py).

Reproducibility Commands

# 1. Reconcile datastores to 0 gap
python scripts/reconcile_stores.py

# 2. Live snapshot of datastores (writes results/counts.json)
python -m taarya_workflows.real.snapshot_counts --out results/counts.json --toi-csv data/tess_cache/nasa_tois.csv

# 3. Run 50-query software regression suite
python eval/run_benchmark.py
python -m taarya_workflows.real.verify_benchmark eval/benchmark_results.json --queries eval/benchmark_queries.json --out results/benchmark.json

# 4. Run offline unit & verification pytest suite (163 passed, 5 skipped offline)
pytest tests/ --ignore=tests/test_backends.py

Legacy Ablation and Discovery Scripts

Formal ablation (generates eval/ablation_table.tex):

python eval/ablation_formal.py --publish
python eval/ablation_formal.py --offline

Discovery validation:

python eval/validate_discovery.py --offline

Benchmark assets:

  • benchmark queries: eval/benchmark_queries.json
  • metrics helpers: eval/metrics.py
  • latest results: eval/benchmark_results.json, eval/ablation_results.json

Data Ingestion

The server does not ingest automatically on startup.

API-triggered ingestion:

curl -X POST http://localhost:8000/api/ingest/gaia
curl -X POST http://localhost:8000/api/ingest/arxiv
curl -X POST http://localhost:8000/api/ingest/graph

Graph population:

# Populate MENTIONED_IN edges via cluster-mediated linking
curl -X POST http://localhost:8000/api/ingest/mentioned-in

# Expand sky coverage with additional clusters (optionally fetch Gaia stars)
curl -X POST http://localhost:8000/api/ingest/expand-coverage \
  -H 'Content-Type: application/json' \
  -d '{"fetch_gaia": true, "max_stars_per_region": 500}'

Behavior:

  • Gaia, file-based catalog, and ArXiv ingestion now trigger Neo4j synchronization automatically by default
  • graph auto-sync can be disabled with GRAPH_AUTO_SYNC=false
  • POST /api/ingest/graph forces a full Neo4j reconciliation if the graph ever falls behind
  • POST /api/ingest/mentioned-in runs cluster-mediated linking on demand
  • POST /api/ingest/expand-coverage seeds extended sky regions with optional Gaia TAP+ fetch

CLI ingestion:

uv run python -m src.ingestion.seed
uv run python src/ingestion/arxiv_ingest.py

Sky coverage expansion:

uv run python scripts/expand_sky_coverage.py --dry-run
uv run python scripts/expand_sky_coverage.py
uv run python scripts/expand_sky_coverage.py --fetch-gaia

Frontend Notes

Current UI architecture (static/):

  • Unified 3-layer design token system (static/design-tokens.json, static/css/tokens.css, static/css/base.css, static/css/components.css) with Obsidian Dark and Warm Slate (light-dark()) themes
  • Single shared navigation shell (static/partials/sidebar.html + static/js/sidebar.js) loaded across all 7 routes: chat.html, explore.html, dashboard.html, tess.html, benchmark.html, settings.html, and stellar_detail.html
  • Native <dialog> invoker controls (commandfor/command), IME-safe Enter handlers (!e.isComposing), and DOM replaceChildren() rendering

Known Caveats

  • MENTIONED_IN edges (5,420) are populated via cluster-mediated heuristic linking (confidence=0.6), not direct Gaia source-ID extraction. ArXiv abstracts rarely contain raw 18-digit Gaia IDs.
  • find_related_stars has been constrained to 1-hop cluster membership only — the old 2-hop wildcard injected noise and degraded Full Hybrid precision.
  • Full Hybrid adds co-cluster stars but dilutes P@10 when ground truth is anomaly-based; use Hybrid (no graph) for best IR metrics.
    • The 50-query software regression suite (66.0%, 33/50 passed) runs against the mixed production + 560-row synthetic store; empirical cluster and transit evaluations run via taarya_workflows/real/ harnesses (results/membership.json, results/retrieval.json, results/toi.json).
  • SQLAlchemy 2.x declarative_base() deprecation in src/models.py produces an import warning.
  • Live database integration tests require PostgreSQL + Q3C, Neo4j, and Qdrant running locally; use pytest tests/ --ignore=tests/test_backends.py for offline unit checks.

Roadmap

  • Core ingestion and retrieval pipeline
  • Graph-backed and hybrid retrieval
  • Unified token-based UI and multi-page workbench cleanup
  • Runtime hardening for LangChain / Ollama integration
  • Coverage-aware agent grounding
  • Containerized verification closure
  • POST endpoint aliases for all search APIs
  • Graph precision fix (cluster-only traversal)
  • Formal ablation with leak-free ground truth
  • Cluster-mediated MENTIONED_IN linking (5,420 edges)
  • Background embedding model warm-up (eliminates ~19 s cold-start)
  • Empirical HR23 + TESS baseline harnesses and reproducibility scripts (taarya_workflows/real/)
  • SQLAlchemy 2.x declarative_base() deprecation cleanup & src/ deep-module refactor
  • External-catalog cross-match validation expansion

License

MIT. See LICENSE.

Citation

@article{kumar2026taarya,
  title={TaarYa: Cross-Catalog Discovery Support for Astronomy with Hybrid Retrieval},
  author={Kumar, Amit and others},
  journal={Astronomy and Computing},
  year={2026},
  url={https://github.com/HmbleCreator/TaarYa}
}

About

An Intelligent Harness Architecture for Astronomical Star catalogs and Astronomy Data, bridging natural language and the cosmos.

Resources

Code of conduct

Contributing

Security policy

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages