Skip to content

Commit f1c1ee3

Browse files
authored
Merge pull request #522 from kentang2017/copilot/add-goetia-module
feat(goetia): Add Goetia / Solomonic Astrology module (72-spirit system)
2 parents 573c0b1 + b67d40c commit f1c1ee3

13 files changed

Lines changed: 6619 additions & 1 deletion

File tree

api_server.py

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@
5656
from astro.sports import analyze_sports_horary
5757
from astro.esoteric import compute_esoteric_chart
5858
from astro.enochian import compute_enochian_chart
59+
from astro.goetia import compute_goetia_chart
5960
from astro.harmonic import compute_multi_harmonic
6061
from astro.primary_directions import compute_primary_directions
6162
from astro.electional.calculator import (
@@ -1291,7 +1292,31 @@ async def enochian_chart(params: BirthParams) -> ChartResponse:
12911292
raise HTTPException(status_code=500, detail=str(exc)) from exc
12921293

12931294

1294-
class ElectionalParams(BirthParams):
1295+
@app.post("/api/goetia", response_model=ChartResponse, tags=["Systems"])
1296+
async def goetia_chart(params: BirthParams) -> ChartResponse:
1297+
"""Compute a Goetia / Solomonic Astrology chart.
1298+
1299+
Maps the natal chart to the 72-spirit system of the Ars Goetia (Lesser Key of Solomon):
1300+
- Personalized demon recommendations based on natal planetary positions, houses, and elements
1301+
- Electional timing windows for the next 30 days (best times to call each spirit)
1302+
- Demon sigil SVG visualizations and Goetia Natal Overview circular chart
1303+
- Bilingual (EN/ZH) ritual steps, invocations, banishing instructions, and safety notes
1304+
- Complete 72-demon database with rank, planet, element, zodiac sign, and powers
1305+
1306+
Ref: S.L. MacGregor Mathers & Aleister Crowley, *The Goetia* (1904);
1307+
Joseph H. Peterson, *The Lesser Key of Solomon* (Ibis Press, 2001);
1308+
Stephen Skinner & David Rankine, *The Goetia of Dr Rudd* (Golden Hoard, 2007).
1309+
"""
1310+
try:
1311+
kw = _base_kwargs(params)
1312+
chart = compute_goetia_chart(**kw)
1313+
return ChartResponse(system="goetia", data=_chart_to_dict(chart))
1314+
except Exception as exc:
1315+
logger.exception("Goetia chart computation failed")
1316+
raise HTTPException(status_code=500, detail=str(exc)) from exc
1317+
1318+
1319+
12951320
"""Parameters for Electional Astrology / Vedic Muhurta."""
12961321

12971322
tradition: str = Field(

astro/goetia/__init__.py

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
"""
2+
astro/goetia/__init__.py — Goetia / Solomonic Astrology 子包
3+
4+
格提亞占星(Goetia / Solomonic Astrology)體系:
5+
- 所羅門魔法傳統 72 柱魔神的占星整合系統
6+
- 根據出生盤推薦個人化魔神
7+
- 選時占星(Electional)功能:建議最佳召喚時機
8+
- 魔神印記(Sigil)SVG 視覺化
9+
- 儀式建議與召喚語(中英雙語)
10+
- 與 Enochian 模組風格保持一致
11+
12+
Public API:
13+
compute_goetia_chart — 計算完整的個人化 Goetia 命盤 (pure function)
14+
render_streamlit — Streamlit UI 渲染器(延遲載入)
15+
render_demon_sigil_svg — 魔神印記 SVG
16+
render_goetia_natal_svg — Goetia Natal Overview 圓形圖 SVG
17+
render_element_balance_svg — 元素平衡圖 SVG
18+
render_recommendation_summary_svg — 推薦魔神摘要 SVG
19+
GoetiaChart — 命盤結果 dataclass
20+
DemonData — 魔神資料 dataclass
21+
DemonRecommendation — 推薦結果 dataclass
22+
ElectionalWindow — 選時窗口 dataclass
23+
"""
24+
25+
from .goetia import compute_goetia_chart
26+
27+
from .constants import (
28+
GoetiaChart,
29+
DemonData,
30+
DemonRecommendation,
31+
ElectionalWindow,
32+
GoetiaPlanetPoint,
33+
SIGNS_EN,
34+
SIGNS_ZH,
35+
SIGN_PLANET,
36+
SIGN_ELEMENT,
37+
ELEMENT_SIGNS,
38+
ELEMENT_ZH,
39+
PLANET_ZH,
40+
PLANET_COLORS,
41+
RANK_ZH,
42+
)
43+
44+
from .visualization import (
45+
render_demon_sigil_svg,
46+
render_goetia_natal_svg,
47+
render_element_balance_svg,
48+
render_recommendation_summary_svg,
49+
)
50+
51+
from .data import (
52+
load_demons,
53+
load_demon_by_number,
54+
load_demons_by_planet,
55+
load_demons_by_sign,
56+
load_demons_by_element,
57+
)
58+
59+
60+
def render_streamlit(*args, **kwargs): # type: ignore[no-redef]
61+
"""Lazy-load the Streamlit renderer for this package."""
62+
from ui.handlers.tab_goetia.render import render_streamlit as _fn
63+
return _fn(*args, **kwargs)
64+
65+
66+
__all__ = [
67+
# Core computation
68+
"compute_goetia_chart",
69+
# Data classes
70+
"GoetiaChart",
71+
"DemonData",
72+
"DemonRecommendation",
73+
"ElectionalWindow",
74+
"GoetiaPlanetPoint",
75+
# Renderer (Streamlit)
76+
"render_streamlit",
77+
# SVG visualizations
78+
"render_demon_sigil_svg",
79+
"render_goetia_natal_svg",
80+
"render_element_balance_svg",
81+
"render_recommendation_summary_svg",
82+
# Constants
83+
"SIGNS_EN",
84+
"SIGNS_ZH",
85+
"SIGN_PLANET",
86+
"SIGN_ELEMENT",
87+
"ELEMENT_SIGNS",
88+
"ELEMENT_ZH",
89+
"PLANET_ZH",
90+
"PLANET_COLORS",
91+
"RANK_ZH",
92+
# Data loaders
93+
"load_demons",
94+
"load_demon_by_number",
95+
"load_demons_by_planet",
96+
"load_demons_by_sign",
97+
"load_demons_by_element",
98+
]

0 commit comments

Comments
 (0)