COLOR_PRIMARY = RGBColor(27, 54, 93)
COLOR_SECONDARY = RGBColor(74, 119, 122)
COLOR_TEXT = RGBColor(43, 43, 43)
# Configure Default Base Typographic Style
style_normal = doc.styles['Normal']
style_normal.font.name = 'Arial'
style_normal.font.size = Pt(10.5)
style_normal.font.color.rgb = COLOR_TEXT
style_normal.paragraph_format.line_spacing = 1.25
style_normal.paragraph_format.space_after = Pt(6)
def set_cell_background(cell, color_hex):
shading_elm = parse_xml(f'<w:shd {nsdecls("w")} w:fill="{color_hex}"/>')
cell._tc.get_or_add_tcPr().append(shading_elm)
def set_cell_margins(cell, top=120, bottom=120, left=180, right=180):
tcPr = cell._tc.get_or_add_tcPr()
tcMar = OxmlElement('w:tcMar')
for m, val in [('w:top', top), ('w:bottom', bottom), ('w:left', left), ('w:right', right)]:
node = OxmlElement(m)
node.set(qn('w:w'), str(val))
node.set(qn('w:type'), 'dxa')
tcMar.append(node)
tcPr.append(tcMar)
def add_heading_1(text):
p = doc.add_paragraph()
p.paragraph_format.space_before = Pt(20)
p.paragraph_format.space_after = Pt(8)
p.paragraph_format.keep_with_next = True
run = p.add_run(text)
run.font.size = Pt(14)
run.font.bold = True
run.font.color.rgb = COLOR_PRIMARY
return p
def add_heading_2(text):
p = doc.add_paragraph()
p.paragraph_format.space_before = Pt(14)
p.paragraph_format.space_after = Pt(4)
p.paragraph_format.keep_with_next = True
run = p.add_run(text)
run.font.size = Pt(11.5)
run.font.bold = True
run.font.color.rgb = COLOR_SECONDARY
return p
# Title Block
p_title = doc.add_paragraph()
p_title.paragraph_format.space_before = Pt(10)
p_title.paragraph_format.space_after = Pt(2)
run_title = p_title.add_run("JYOTISH YOGA LOGIC ENGINE MANUAL")
run_title.font.size = Pt(22)
run_title.font.bold = True
run_title.font.color.rgb = COLOR_PRIMARY
p_sub = doc.add_paragraph()
p_sub.paragraph_format.space_after = Pt(24)
run_sub = p_sub.add_run("Programmatic Specifications for BPHS, Jataka Tattva, and Saravali Yoga Formulations")
run_sub.font.size = Pt(11)
run_sub.font.italic = True
run_sub.font.color.rgb = COLOR_SECONDARY
# Section 1
add_heading_1("1. Architectural Overview & Compute Pipelines")
doc.add_paragraph(
"This specification sheet defines the mathematical foundations and conditional criteria needed "
"to translate classical Vedic astrology configurations into deterministic code. It prevents "
"false positives by evaluating planetary states sequentially using real-time ephemeris input vectors."
)
# Section 2
add_heading_1("2. Mathematical Modifiers & Filters")
doc.add_paragraph(
"A planetary yoga can only be considered functional if it passes baseline modification filtering. "
"Combustion, planetary war (Graha Yuddha), and positional boundaries (Rashi Sandhi) can change "
"a planet's performance coefficient from active to inert before core combinations are processed."
)
# Section 3: Master Table Configuration
add_heading_1("3. Core Classical Yoga Permutation Directory")
yoga_data = [
["Pancha Mahapurusha", "Ruchaka Yoga", "Mars in Kendra (1, 4, 7, 10) in Own/Exalted sign. Commands high physical energy and operational focus."],
["Pancha Mahapurusha", "Bhadra Yoga", "Mercury in Kendra in Own/Exalted sign. Drives strategic commerce, software architectures, logic."],
["Pancha Mahapurusha", "Hamsa Yoga", "Jupiter in Kendra in Own/Exalted sign. Institutional authority, jurisprudence, academic design."],
["Pancha Mahapurusha", "Malavya Yoga", "Venus in Kendra in Own/Exalted sign. High-fidelity design, diplomatic mastery, asset management."],
["Pancha Mahapurusha", "Sasa Yoga", "Saturn in Kendra in Own/Exalted sign. Systematic scaling, multi-threaded workforce coordination."],
["Nabhasa (Asraya)", "Rajju Yoga", "All 7 planets in Moveable signs. High operational pivot speeds, geographical fluidity."],
["Nabhasa (Asraya)", "Musala Yoga", "All 7 planets in Fixed signs. Deep structural asset retention, structural resistance to change."],
["Nabhasa (Asraya)", "Nala Yoga", "All 7 planets in Dual signs. Conceptual flexibility, variable execution paths, multi-threaded analysis."],
["Prosperity & Power", "Vipareeta Raja", "6/8/12 lords sitting strictly within 6/8/12 houses. Converts external crashes into rapid system ascents."],
["Prosperity & Power", "Neechabhanga", "Debilitation canceled by sign/exaltation lord sitting in Kendra houses from Lagna or Moon."]
]
table = doc.add_table(rows=len(yoga_data) + 1, cols=3)
table.alignment = WD_TABLE_ALIGNMENT.CENTER
col_widths = [Inches(1.5), Inches(1.5), Inches(3.5)]
hdr_cells = table.rows[0].cells
hdr_cells[0].text = "Category"
hdr_cells[1].text = "Yoga Name"
hdr_cells[2].text = "Programmatic Definition & Output Profile"
for cell in hdr_cells:
set_cell_background(cell, COLOR_PRIMARY_HEX)
set_cell_margins(cell)
p = cell.paragraphs[0]
p.alignment = WD_ALIGN_PARAGRAPH.CENTER
run = p.runs[0]
run.font.bold = True
run.font.color.rgb = RGBColor(255, 255, 255)
run.font.size = Pt(9.5)
for r_idx, row_data in enumerate(yoga_data):
row_cells = table.rows[r_idx + 1].cells
bg_color = COLOR_LIGHT_BG_HEX if r_idx % 2 == 1 else "FFFFFF"
for c_idx, text in enumerate(row_data):
row_cells[c_idx].text = text
set_cell_background(row_cells[c_idx], bg_color)
set_cell_margins(row_cells[c_idx])
p = row_cells[c_idx].paragraphs[0]
p.runs[0].font.size = Pt(9)
if c_idx < 2:
p.runs[0].font.bold = True
for row in table.rows:
for idx, width in enumerate(col_widths):
row.cells[idx].width = width
# Section 4
add_heading_1("4. Dynamic Muhurta & Transit Intersection Validation")
doc.add_paragraph(
"A natal configuration represents a chart's potential capacity, but its execution window is unlocked "
"by the Vimshottari Dasha state machine. Physical activation occurs when real-time transiting "
"longitudes cross the exact natal coordinates within a strict 3-degree, 20-minute operational orb."
)
output_path = "Jyotish_Yoga_Logic_Engine_Manual.docx"
doc.save(output_path)
print(f"Document built successfully at: {output_path}")
if __name__ == "__main__":
create_jyotish_engine_document()