How naturalstupid/pyjhora works
1. Overall shape
JHora is a Python package, not a single app: the core is an astrology computation engine, with a PyQt6 UI layered on top. The repository is organized around domain modules for panchanga, horoscope charts, dhasa systems, compatibility, prediction, and transit calculations.
2. Core computation boundary
The main computational boundary is jhora.panchanga.drik plus related panchanga modules. This layer computes time- and location-based astronomical values such as sunrise/sunset, tithi, nakshatra, yogam, karana, lunar months, special lagnas, planet positions, eclipse dates, and entry/transit events. Most higher-level horoscope features depend on these outputs.
3. Ephemeris and astronomical data
Planetary calculations depend on Swiss Ephemeris and the bundled ephemeris files under src/jhora/data/ephe. The README explicitly notes that accuracy is driven by the installed Swiss Ephemeris data. These files are a key external data dependency and are required for the core math to work.
4. Horoscope chart subsystem
jhora.horoscope.chart builds on the panchanga layer to produce chart-centric outputs: rāśi/divisional charts, bhava houses, arudhas, ashtakavarga, yogas, doshas, strengths, sphutas, and relationship/aspect tables. This is the central analysis layer for horoscope interpretation and is where most chart-derived data is assembled.
5. Dhasa engines
jhora.horoscope.dhasa is split into graha, raasi, annual, and sudharsana_chakra subpackages. Each module implements a specific dhasa-bhukti system and shares common inputs like planetary positions, nakshatra, divisional chart context, and configured year-duration rules. This subsystem is structurally separate from chart computation, but it consumes chart results heavily.
6. Transit, prediction, and compatibility
Three adjacent analysis subsystems sit on top of the core chart data:
- match for marriage compatibility tables and scoring,
- prediction for rule-based general/longevity-style interpretations,
- transit for tajaka, sahams, and annual/monthly/60-hour transit analysis.
These are downstream consumers of the same horoscope state, but each has its own domain rules.
7. Place and calendar data
Location lookup is handled by place_db.py and data files such as CSV/SQLite/DB place databases in src/jhora/data. The README notes support for multiple engines: CSV, pickle, and SQLite. Location data feeds latitude/longitude/time zone/elevation into panchanga and chart computations, so place resolution is a first-class dependency, not just UI input.
8. Configuration and constants
config.py, const.py, and _package_info.py define package-wide modes and defaults such as ayanamsa behavior, node handling, chart options, and feature flags. This is an important boundary because many algorithms are parameterized by global configuration rather than hardcoded behavior.
9. UI layer
jhora.ui contains multiple independent PyQt widgets rather than a single monolithic interface. The main surfaces are horo_chart_tabs.py for the full multi-tab experience, panchangam.py for one-page panchanga, vedic_calendar.py, match_ui.py, vedic_clock.py, vratha_finder.py, and chart-style dialogs. These widgets are presentation-only clients of the computation layer.
10. Internationalization and resource files
The lang directory holds multilingual strings and message catalogs in English, Tamil, Telugu, Hindi, Kannada, and Malayalam. UI text and some output labels are driven from these resources, so language selection is a presentation concern that does not alter the underlying calculations.
11. Static reference datasets
The package ships multiple domain datasets: marriage compatibility tables, festival CSVs, pancha pakshi data, geonames place data, user/factory settings, and documentation exports. These files are part of runtime behavior, not just documentation, because many calculations and lookups are table-driven.
12. Testing and verification
src/jhora/tests contains a substantial test suite, including book-exercise baselines and regression outputs. The README calls out thousands of tests and special baseline JSON files. Architecturally, this is important because the project treats numerical correctness and compatibility with published astrology references as a primary quality gate.
13. Packaging and runtime model
The repo is packaged as a Python library with pyproject.toml, requirements.txt, and src/jhora/setup.py. At runtime, it is intended both for direct library use and for launching PyQt widgets. There is also an MCP server wrapper mentioned in the README, which positions the library as a backend computation engine for other tools.
14. Key dependency flow
The main data flow is: place/date/time input enters the UI or API, panchanga/drik computes astronomical state, chart modules derive horoscope structures, and then dhasa/prediction/match/transit modules interpret those structures. Output is rendered in UI tabs, dialogs, or exported reports/PDFs, with tests validating the same pipeline against reference examples.
Main entry points: charts.py Charts · drik.py Drik · horo_chart_tabs.py Horoscope UI · msg_strings_en.txt Lang pack
Components 21
Core math
Time, place, and astronomical computations used by all higher layers.
Horoscope analysis
Chart construction and downstream interpretive systems.
- Charts · Builds rasi and divisional chart structures from panchanga state.
src/jhora/horoscope/chart/charts.py - Chart factors · House, arudha, ashtakavarga, strength, sphuta, yoga, and dosha logic.
src/jhora/horoscope/chart/house.py - Graha dhasa · Planet-based dhasa engines such as vimsottari and yogini.
src/jhora/horoscope/dhasa/graha/vimsottari.py - Raasi dhasa · Sign-based dhasa engines such as narayana, kalachakra, and sudasa.
src/jhora/horoscope/dhasa/raasi/narayana.py - Annual dhasa · Yearly timing systems including mudda and patyayini.
src/jhora/horoscope/dhasa/annual/mudda.py - Sudharsana · Sudharsana chakra timing and progression analysis.
src/jhora/horoscope/dhasa/sudharsana_chakra.py - Match · Marriage compatibility scoring and table lookup.
src/jhora/horoscope/match/compatibility.py - Prediction · General and longevity interpretation rules.
src/jhora/horoscope/prediction/general.py - Transit · Tajaka, saham, and transit-based annual analysis.
src/jhora/horoscope/transit/tajaka.py
UI layer
PyQt presentation surfaces over the computation engine.
- Horoscope UI · Main multi-tab chart and analysis workspace.
src/jhora/ui/horo_chart_tabs.py - Panchangam UI · Panchanga, calendar, and time-oriented presentation surfaces.
src/jhora/ui/panchangam.py - Match UI · User interface for compatibility and match analysis.
src/jhora/ui/match_ui.py
Runtime data
Bundled ephemeris, lookup tables, and localized resources.
- Lang pack · Multilingual UI strings and output labels.
src/jhora/lang/msg_strings_en.txt - Ephemeris data · Swiss Ephemeris files used by the core astronomical engine.
src/jhora/data/ephe/sepl_00.se1 - Place data · Bundled CSV/DB place databases for geocoding and locality lookup.
src/jhora/data/geonames_places_5k.db
Package/runtime
Library entrypoints, configuration, and packaging metadata.
- Config · Package-wide modes, defaults, and feature flags.
src/jhora/config.py - Constants · Shared symbolic values and global calculation switches.
src/jhora/const.py - Package info · Package version and distribution metadata.
src/jhora/_package_info.py
Connections 25
- Config → Drik: modes · Configuration alters astronomical and calendar calculations.
- Constants → Drik: constants · Shared constants parameterize the core engine.
- Package info → Horoscope UI: launch info · Package metadata supports runtime/package presentation.
- Place data → Place DB: lookup · Location engines are backed by bundled place datasets.
- Place DB → Drik: coords · Resolved latitude, longitude, timezone, and elevation feed panchanga math.
- Ephemeris data → Drik: ephemeris · Swiss Ephemeris files drive planetary and lunar calculations.
- Drik → Panchanga: calendar state · Derived astronomical state powers secondary panchanga modules.
- Drik → Charts: inputs · Charts are built from panchanga and planetary outputs.
- Panchanga → Charts: derived values · Calendar and event calculations feed chart assembly.
- Charts → Chart factors: structure · Core chart data is analyzed into houses, yogas, strengths, and related factors.
- Charts → Graha dhasa: chart state · Graha dhasa systems consume planetary and nakshatra context.
- Charts → Raasi dhasa: chart state · Raasi dhasa systems consume sign and divisional chart context.
- Charts → Annual dhasa: chart state · Annual dhasa systems reuse horoscope-derived inputs.
- Charts → Sudharsana: chart state · Sudharsana analysis is computed from the horoscope baseline.
- Chart factors → Prediction: interpret · Rule-based prediction layers consume chart-derived factors.
- Charts → Match: compatibility inputs · Compatibility scoring uses the same horoscope state.
- Charts → Transit: baseline · Transit analysis is anchored to the natal chart.
- Lang pack → Horoscope UI: strings · UI labels and messages are localized from resource files.
- Lang pack → Panchangam UI: strings · Calendar views use localized text resources.
- Lang pack → Match UI: strings · Compatibility UI uses localized text resources.
- Horoscope UI → Charts: invoke · Main UI triggers chart generation and analysis workflows.
- Horoscope UI → Prediction: show results · Predictions are surfaced in the main workspace.
- Horoscope UI → Transit: show results · Transit analysis is surfaced in the main workspace.
- Panchangam UI → Drik: compute · Panchanga views directly invoke core calculations.
- Match UI → Match: score · Compatibility UI drives the match engine.