Skip to content

Architecture

Edoardo BAROLO edited this page Jul 17, 2026 · 1 revision

Architecture

src/jhora/
├── types/          Enums: Graha, Rasi, Nakshatra, Varga, Bhava, Dasa
├── ephemeris/      Swiss Ephemeris wrapper (18 API functions)
├── charts/         ChartBuilder → ChartData (frozen, immutable)
├── calc/           18 modules: strengths, yogas, dasas, transits...
├── dasas/          12 dasa systems
├── ai/             AI engine, RAG, JSON export, embeddings, teacher
├── interpreter/    Chart reading, knowledge base
├── export/         HTML report generator
├── io/             Atlas (SQLite/FTS5), JHD parser
├── core/           Unified database (get_db singleton)
├── cli/            Typer CLI (27 commands)
├── tui/            prompt_toolkit menu system
└── ui/             PyQt6 GUI (8-category tabs, chart widget, dasa timeline)

Design Principles

ChartData is immutable. Once computed, never modified. Thread-safe, cacheable.

All calculations are pure. Same input → same output. No state, no side effects.

Database via get_db(). Never open SQLite directly. Thread-safe connection pool.

CLI, GUI, TUI parity. Every calc/ module must be wired into:

  1. CLI command (src/jhora/cli/main.py)
  2. GUI tab or table (src/jhora/ui/main_window.py)
  3. TUI action (src/jhora/tui/main.py)

AI sees everything. New computed data must be added to src/jhora/ai/analysis.pybuild_analysis_text().

Data Flow

Birth Data → ChartBuilder → ChartData (frozen)
                ↓
    ┌───────────┼───────────┐
    ↓           ↓           ↓
  Shadbala    Yogas      Dasas
    ↓           ↓           ↓
    └───────────┼───────────┘
                ↓
        build_analysis_text()
                ↓
        RAG Prompt → LLM → Response

Database

Single data/jhora.db (SQLite, ~6.5MB):

  • cities — 34,006 cities with FTS5
  • knowledge_texts — 16 textbooks (1.96M chars) with FTS5
  • textbook_chunks — vector embeddings (optional)
  • charts + chart_planets — user-saved charts
  • preferences — key-value store

Clone this wiki locally