Astrology7 MIN READ21 / 31

Varga Engine — High-Level Design

Status: Draft for review · Part of: Astro Composer · Updated: 2026-10-24

The varga engine maps one sidereal D1 (natal chart) longitude into each of the sixteen Shodasavarga signs, then builds the varga frame from the same mapping. It is pure arithmetic over a rulebook table: no binder call, no second position, and no varga computed from another varga.

1. Purpose

Divisional charts (vargas) are the most convention-sensitive layer in the composer.

The variants are real: D10 has at least three starting rules in use, D30 is not divided equally, and D16, D20, D40 and D45 differ between editions. If each screen encodes its own table, one birth yields two D9 charts — both “correct” under some convention — and the difference stays invisible.

The varga engine exists so that:

  1. every varga is one total, deterministic mapping from a D1 longitude to a sign;
  2. the variant scheme is a named rulebook entry, not a code branch;
  3. the varga lagna (rising sign) and the varga bodies come from the same mapping function;
  4. a response states which rulebook produced it, so two charts compare honestly.

2. Where it sits

chart core · D1 frame (lagna, longitudes, sign ids) ──┐
                                                      ├──▶ varga engine ──▶ varga charts
rulebook · varga tables (parts, start rules) ─────────┘
  • Upstream: chart core supplies the D1 lagna, each body’s full longitude and its binder sign id. The facade supplies the requested varga ids and one rulebook handle.
  • Downstream: the facade assembles the varga layer into POST /v1/charts; later varga-based strength readers consume the same signs.
  • Never: no binder call, no D1 sign recomputation, no chaining one varga into another, no dasha, panchang or interpretation from a varga.

Input contract

Input Source Used for
D1 body longitudes Chart core, from binder positions Part index inside the 30° sign
D1 sign ids Chart core, from binder positions Table base and vargottama comparison
D1 lagna longitude and sign Chart core frame Varga lagna through the same mapping
Requested varga ids Request and profile Which charts to produce, in what order
Varga tables Rulebook handle Parts, starting rule, D30 spans, variant scheme
Zodiac Profile Sidereal guard for the classical tables

Output contract

Output Shape Read by
vargas[id].lagna Varga lagna sign Response, house placement inside the varga
vargas[id].bodies[] Body, varga sign, part index Response, varga strength later
vargas[id].houses[] Whole-sign house rosters in the varga Response, later varga readers
vargottama D9 sign equals D1 sign, per body Response, strength and interpretation inputs
unsupported Requested varga ids the profile cannot serve Facade error or degraded layer

3. Responsibilities

Area Owns Deterministic rule
Varga selection D1 plus the requested divisional charts D1 is read from chart core, never rebuilt
Part index Position inside the 30° sign Equal parts except D30; half-open intervals
Sign mapping Part index to a varga sign Rulebook start rule and direction; one lookup
Varga frame The lagna’s varga sign and its houses The same mapping function used for bodies
Vargottama D1 sign equals D9 sign Derived from the two mapped signs; never overridden
Table integrity Parts and signs cover the sign exactly Checked when the rulebook loads, not per request
Output Requested charts only, canonical order Sign ids and part index; no fabricated degree

4. Architecture

Varga Engine — High-Level Design Reference design. Chart core supplies D1 longitudes, sign ids and the lagna; the rulebook supplies part counts, start rules and D30 spans. The varga engine indexes the part, maps it to a varga sign, maps the lagna with the same function, derives vargottama and assembles each requested chart. No varga is computed from another varga. Varga Engine — High-Level Design Sixteen divisional charts from one D1 longitude, with the variant scheme pinned in the rulebook. Chart core · D1 frame lagna · longitudes · sign ids binder facts, full precision Rulebook · varga tables parts · start rules · D30 spans content-addressed, read-only Varga engine · one total mapping, sixteen charts Varga selection D1 plus requested vargas D1 read from chart core Part indexer equal parts except D30 half-open part boundaries Sign mapper start rule from rulebook one lookup, no code branch Varga frame lagna mapped by same function whole-sign houses inside varga Vargottama D1 sign equals D9 sign derived, never overridden Varga builder signs and part index only no fabricated varga degree One mapping function for lagna and bodies. A gap or overlap in a table fails at load, not per request. Chart response · varga layer signs · houses · vargottama requested vargas only Varga strength · later same signs, same rulebook no second table Matching · D9 inputs · later reads signs only never remaps a longitude D1 facts tables varga charts dependency pure module engine output boundary Reference design · not deployed behaviour.

Diagram: reference design, not deployed behaviour.

The engine has no orchestration of its own. It is a mapping service with one rule: the same function turns a planet’s longitude and the lagna’s longitude into a varga sign. Otherwise one frame could mix two conventions.

5. Rules

  1. From D1 only. A varga is never computed from another varga. Chaining divisions compounds rounding and yields charts no published table matches.
  2. One mapping function. Bodies, the lagna and later points all use the same longitude → varga sign function. Varga houses then apply chart core’s whole-sign sign-distance rule to the resulting ids, never a second house rule.
  3. The mapping is total. For every varga, each of the 30° of a sign maps to exactly one part and one sign. A gap, overlap or uncovered degree is a rulebook defect, caught at load.
  4. Half-open parts. A longitude exactly on a part boundary belongs to the next part; exactly 30° is the next sign. No epsilon fudge hides a boundary.
  5. No varga degree. A varga response carries a sign id and a part index, never a degree inside the varga sign; that would imply precision the division lacks.
  6. Starting rules are data. Movable/fixed/dual, odd/even, elemental starts, reversed D2 halves and D30’s unequal spans live in the rulebook. A new scheme is a table row, not a branch.
  7. D30 is asserted, not assumed. Its spans must sum to 30° and reverse in even signs; the rulebook load fails otherwise.
  8. Vargottama is derived. “D1 sign equals D9 sign” falls out of the mapping and is reported as a flag. It is never stored as separate data or special-cased.
  9. Sidereal only. The classical tables are defined on the sidereal zodiac. A tropical profile reports the varga layer unsupported rather than mapping tropical degrees.
  10. D1 is passed through. The response’s D1 chart is the chart core chart, not a re-mapped copy, so a varga can never contradict the natal chart.
  11. Unknown ids fail. An unserved varga id is a validation error, never skipped silently.
  12. Deterministic order. Varga ids follow natural order (D1, D2 … D60) and bodies follow the chart’s canonical order, so two responses diff byte for byte.

6. Edge cases

Case Behaviour
Longitude exactly on a part boundary Next part, per the half-open rule
Longitude 29.9999° versus 30.0° Sign boundary follows chart core’s D1 sign; no local wrap
D2 halves Only Cancer or Leo, reversed in even signs
D9 movable, fixed and dual starts Three rulebook rows; no movable-only shortcut
D30 unequal spans 5/5/8/7/5°, reversed in even signs, asserted at load
D10, D16, D20, D40, D45 variants Named rulebook row; response names the rulebook hash
Retrograde body Varga sign unchanged; motion does not enter the mapping
Rahu or Ketu Mapped like any other point when the profile includes it
Varga lagna on a part boundary Same half-open rule as a body
Vargottama in a fixed or dual sign Derived from the D9 mapping; never forced
All sixteen vargas requested Sixteen bounded passes over the same D1 values
No varga layer requested Engine is not invoked; D1 is chart core’s output alone
Rulebook missing a varga row UNKNOWN_RULEBOOK at load, not an implicit default

7. Out of scope

  • D1 frame, house placement, dignity and combustion (chart core).
  • Vimshottari periods and the proportional division used by dashas (dasha engine).
  • Varga strength, varga dignity and ashtakavarga scoring (later layers).
  • Panchang, transits, matching and muhurta rules.
  • Interpretation, remedies and chart drawing.
  • Binder access, caching and provenance (facade and binder).

8. Planned code

Piece Responsibility
varga/VargaCatalog Canonical ids, names, part counts and order
varga/VargaTable Rulebook rows, start rules and load-time integrity checks
varga/PartIndexer Equal and unequal subdivision of a sign
varga/VargaSignMapper Part index and rulebook row to a varga sign
varga/VargaChartBuilder Varga lagna, bodies and whole-sign houses
varga/VargottamaResolver D1/D9 sign comparison per body
varga/VargaSelection Requested set, validation and deterministic order