Add pyjhora_batch: headless batch horoscope reports (PDF/TXT/JHD) - #63
Closed
jivrajss wants to merge 2 commits into
Closed
Add pyjhora_batch: headless batch horoscope reports (PDF/TXT/JHD)#63jivrajss wants to merge 2 commits into
jivrajss wants to merge 2 commits into
Conversation
Two bugs prevented driving ChartTabbed without the interactive GUI: 1. compute_horoscope() calls config.initialize_runtime(), but `config` was only imported deep in the module under a __main__ guard, so at runtime it raised `NameError: name 'config' is not defined`. The exception was caught and logged, leaving self._horo unset and producing an empty PDF. Import `config` at module scope. 2. During construction, combo-box currentIndexChanged signals fire _kundali_chart_selection_changed -> _update_tab_chart_information -> _fill_panchangam_info, which dereference self._horo before the horoscope is computed (self._horo is None). Under PyQt6 an unhandled exception in a slot aborts the process. Guard both methods to return early when self._horo is None. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
A batch layer over PyJHora's engine: a CSV/Excel of birth details in,
per-person reports out. Reimplements no calculations.
The report is extracted once as structured data (report_data.build_report)
and then rendered, so no output path needs Qt on screen:
* text_writer -> wrapped plain-text report
* pdf_writer -> vector PDF via reportlab, ~150 KB and searchable, versus
~10 MB of 130-DPI JPEG for the Qt widget capture. That
capture is still available as --pdf-mode screenshot, since
it alone includes the drawn chart diagrams.
* jhd_writer -> Jagannatha Hora .jhd, importable into the app. Every field
packs D.MMSS, longitude is East-negative, lines are CRLF;
the layout was derived byte-for-byte from a real export.
The Yoga and Raja Yoga tables report the yoga and the condition that matched,
and nothing else. The language resources carry a third "prediction" field, but
it is fixed boilerplate keyed on the yoga name -- identical for every chart the
yoga fires in -- and several yogas match very loosely, e.g.
_matrunasa_yoga_198_calculation is true whenever the Moon is hemmed by,
associated with, or aspected by any natural malefic, which covers most charts.
Printed next to a person's name and birth time, "The person's mother will have
a very early death" reads as an individual prognosis rather than as the
classical rule text it is.
CLI: --no-pdf / --no-jhd / --no-txt, --pdf-mode {vector,screenshot},
repeatable --dhasa (default vimsottari, 'all' for every system), -w N workers.
reportlab is required for the vector PDF; openpyxl (Excel input), pytest and
pypdf (tests) stay optional. Fixtures use a synthetic reference chart, and
the panchanga and D1 expectations are captured from ChartTabbed so they
cross-check the headless path rather than restating its own output.
169 passed, 1 skipped.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
jivrajss
force-pushed
the
feat/headless-batch-generation
branch
from
July 29, 2026 08:19
78c97b7 to
a495f61
Compare
Author
|
Superseded by #64 — same changes, clean branch. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this adds
A thin batch layer (
pyjhora_batch/) on top of PyJHora that turns a CSV/Excellist of birth details into a horoscope PDF and an importable Jagannatha Hora
.jhdper row. It reuses PyJHora's engine and PDF renderer — no calculationsare reimplemented.
python -m pyjhora_batch input.csv -o reports/ --workers autopyjhora_batch.generate_pdf(record, out_path)batch.log, afailures.csvfor retry, and optional multiprocessing(spawn pool, one QApplication per worker)
.jhdfiles (PyJHora has no native.jhdexport)Bug fixes (required for headless use), commit
bd58591compute_horoscope()referencedconfig.initialize_runtime(...)butconfigwas only imported under a
__main__guard →NameErrorthat silently leftself._horounset. Importedconfigat module scope._fill_panchangam_info/_update_tab_chart_informationbeforeself._horoexists; under PyQt6 anunhandled slot exception aborts the process. Added
self._horo is Noneguards.Note
ChartTabbed'sdate_of_birth/time_of_birth/place_of_birthconstructor kwargsare currently not applied (it falls back to now + IP location). The batch wrapper
works around this by injecting values via the public setters with networking off.
Happy to also submit a constructor fix separately if of interest.