Building the Analysis Engine --- Favorable Element and 22 Spirit Indicators
The Pillars Are Built; Now They Need to Be Read
Parts 6 through 8 covered the Manselyeok and time corrections. The four pillars (Year, Month, Day, Hour) are now calculated accurately. But four pillars by themselves are just "data." Transforming that data into "meaning" is the job of the analysis engine.
The analysis engine performs four main tasks: Five Elements ratio analysis, Ten Gods relationship mapping, Favorable Element (Yongsin, 用神) determination, and Combinations/Clashes/Punishments detection. On top of that come the Twelve Life Stages placement, Spirit Indicators (Sinsal, 神煞) evaluation, and Major Fate Cycle (Daewoon, 大運) / Annual Fate (Sewoon, 歲運) calculation. This installment focuses on the most critical piece --- Favorable Element determination --- and the feature that sparked the most discussion --- Spirit Indicators.
Favorable Element: The Prescription for Your Chart
The Favorable Element is the central concept of Saju interpretation. In a sentence: it is the process of determining which Element (or Ten Gods category) the chart most needs. Think of it as a medical analogy --- diagnose the chart's Element composition, then prescribe what will bring it into balance.
There are broadly three schools of Favorable Element determination. The Suppression-Support method (Eokbu-beop, 抑扶法) asks whether the Day Stem ("the self") is strong or weak, then prescribes weakening Elements for a strong self or strengthening Elements for a weak one. The Seasonal Regulation method (Johu-beop, 調候法) emphasizes birth season: born in winter, you need warming Elements; born in summer, you need cooling ones. The Comprehensive Flow method (Tongbyeon-beop, 通變法) reads the overall flow and structure of the chart holistically to determine what is needed.
Our app adopts the Suppression-Support method as the default, for three reasons. First, it is the most systematically codifiable --- its rules translate well into algorithms. Second, it is the most widely used in modern practice. Third, the professional apps from benchmarking overwhelmingly defaulted to it.
Turning Suppression-Support into an Algorithm
Here is a simplified overview of the Suppression-Support method in code.
Step one: determine whether the Day Stem is strong or weak. Sum up how much of the chart shares the Day Stem's Element (Companion: Rob Wealth and Friend) and how much generates it (Resource: Indirect and Direct Seal). That total represents the Day Stem's "power." On the other side, sum the Elements that overcome the Day Stem (Authority: Seven Killings and Direct Officer), the Elements the Day Stem overcomes (Wealth: Indirect and Direct), and the Elements the Day Stem generates (Output: Eating God and Hurting Officer). That total represents "resistance."
This calculation goes beyond simple counting. The Month Branch carries the most weight. If the Month Branch shares the Day Stem's Element, this is called "Obtaining Season" (deuk-ryeong, 得令), which significantly strengthens the Day Stem. If the Day Stem has "roots" in any Branch (i.e., its Element appears as a Hidden Stem), that is "Penetrating Root" (tong-geun, 通根), also strengthening. These secondary factors must be reflected as weighted scores for accurate strong/weak determination.
Step two: determine the Favorable Element. If the Day Stem is strong, the Elements that weaken it become favorable. If weak, the Elements that strengthen it become favorable. The logic sounds simple, but "how strong is strong enough?" --- the threshold --- is subtle. There is no mathematically precise boundary.
The design document settled on a scoring system that uses relative ratios rather than absolute thresholds. If the Day Stem's side exceeds 50% of total points, the chart is classified as "Strong Self" (sin-gang, 身強); below 50% is "Weak Self" (sin-yak, 身弱). The 50% mark itself varies by school, but it is the most commonly used benchmark.
AI collaboration was especially valuable for the weighting details. How much weight should the Month Branch carry? What is the weight for a Penetrating Root? Claude proposed specific values referencing Saju theory, and I adjusted them by comparing against professional apps' outputs.
22 Spirit Indicators: From P3 to Must-Have
In the initial project design, Spirit Indicators (Sinsal, 神煞) were classified as P3 --- future expansion. Five Elements analysis, Ten Gods, and Favorable Element were the core; Spirit Indicators were a nice-to-have.
That classification changed during benchmarking. Every single professional Saju app displayed 20 or more Spirit Indicators. And when I investigated the most-searched Saju keywords, queries like "do I have the Driving Horse indicator," "Peach Blossom in my chart," and "what does the Heavenly Noble mean" dominated the top results.
From a user's perspective, this makes perfect sense. "Your Five Elements ratio is Wood 30%, Fire 20%" is abstract information. "Your chart contains the Driving Horse indicator" is immediately intuitive and attention-grabbing. Spirit Indicators --- despite being specialized terms --- are guessable from their names alone, making them an excellent entry point for Saju beginners.
Spirit Indicators were promoted from P3 to P1 (must-have). I implemented a total of 22, organized into three categories.
Auspicious Indicators (Gil-sin, 吉神) carry positive meanings. The Heavenly Noble (Cheon-eul Gwi-in, 天乙貴人) signifies receiving help from benefactors. The Literary Noble (Mun-chang Gwi-in, 文昌貴人) favors academics and examinations. The Heavenly Virtue (Cheon-deok Gwi-in, 天德貴人) and Monthly Virtue (Wol-deok Gwi-in, 月德貴人) signify receiving heavenly and lunar blessings.
Cautionary Indicators (Hyung-sin, 凶神) suggest areas requiring attention. The Blade (Yang-in, 羊刃) represents intense, sharp energy. The Void (Gong-mang, 空亡) represents emptiness. The White Tiger (Baek-ho-sal, 白虎煞) signals caution regarding accidents or health.
Then there are context-dependent indicators. The Driving Horse (Yeok-ma-sal, 驛馬煞) signifies movement and change --- positive when it means international opportunities and active lifestyles, cautionary when it means restless wandering. The Peach Blossom (Do-hwa-sal, 桃花煞) relates to charm and romantic relationships --- positive as popularity and attractiveness, cautionary as relationship complications.
Implementing Spirit Indicators
Technically, Spirit Indicators are straightforward. Most follow the pattern: "When the Day Pillar's (or Year Pillar's) Branch is X, if the chart contains Branch Y, then indicator Z is present." For the Heavenly Noble, if the Day Stem is Gap (甲), the Noble sits in Chuk (丑) and Mi (未); if the Day Stem is Eul (乙), it sits in Ja (子) and Sin (申). Define this mapping for all 10 Day Stems and you are done.
Claude organizing the evaluation conditions for all 22 Spirit Indicators into accurate tables dramatically shortened implementation time. However, school differences cropped up here too. For the Heavenly Noble mapping with Day Stem Gyeong (庚), some schools place it at Chuk (丑) and Mi (未) while others differ. AI flagged these divergences upfront, and I selected based on the design document principle: "use the most common standard as the default."
Implementing all 22 indicator tables at once drove home how painful this task would have been without AI. For a developer who is not a domain expert, manually researching the evaluation conditions for each of 22 Spirit Indicators from Saju textbooks would take days. AI delivering all of it in structured form in one pass let me focus on implementation and verification.
Major Fate Cycles and Annual Fate: The Time Axis
If the four pillars are "the map of innate destiny," the Major Fate Cycle (Daewoon, 大運) and Annual Fate (Sewoon, 歲運) are "the environment that shifts over time." The most common question in Saju consultations is "How is my fortune this year?" --- and the answer comes from Major Fate Cycles and Annual Fate.
The Major Fate Cycle operates in 10-year periods. Starting from the Month Pillar, it progresses forward or backward through the 60 Stem-Branch Cycle, each Major Fate lasting 10 years. Whether forward or backward depends on gender and the Year Stem's polarity. Male with a Yang Year Stem: forward. Male with a Yin Year Stem: reverse. Female: the opposite.
Calculating the starting age of the Major Fate Cycle has its own unique logic. Count the days from birth to the next Solar Term (for forward progression) or previous Solar Term (for reverse), then divide by 3. If the gap is 21 days, the Major Fate Cycle begins at age 7.
Annual Fate is the fortune for each year. It analyzes how the Stem-Branch pair of a given year interacts with the natal chart. Since 2025 is the year of Eul-Sa (乙巳), you would analyze the impact of Eul (乙) and Sa (巳) on the chart. Annual Fate operates in conjunction with the Major Fate Cycle, meaning "Major Fate + Annual Fate + natal chart" form a three-layer structure that must be read together.
The trickiest implementation detail was the Major Fate starting age calculation. Precisely counting days from birth to the relevant Solar Term requires the same KASI data from earlier. The Manselyeok module and the analysis engine naturally came to share the same Solar Term data --- a case that demonstrated the strength of the "independent step-based functions + shared data" architecture established in Part 6.
Unit Testing: A Non-Negotiable for Manselyeok and Saju
Building the analysis engine drove home the importance of unit testing. In a typical web app, unit tests are "nice to have." In a Saju app, they are "non-negotiable."
The reason is simple. If one Manselyeok calculation or one Ten Gods evaluation is wrong, every analysis and interpretation built on top of it collapses. And these errors are invisible to casual inspection. When the result says "Day Stem Gap Wood's Indirect Wealth is Mu Earth," knowing whether that is correct requires Saju domain knowledge.
Tests written in Vitest cover three areas. First, foundational data: are the Stem-Element mappings correct, is the 60 Cycle sequence right, are the Hidden Stem tables accurate? Second, pillar calculation: given a specific birth date and time, do the four pillars match the expected values? Expected values come from verified professional Manselyeok sites. At least 20 birth dates serve as test cases, with all four pillars verified for each. Third, analysis results: does the Five Elements ratio sum to 100%, are Ten Gods classifications consistent with theoretical rules, does the Favorable Element logic correctly classify Strong/Weak Self? Spirit Indicator tests check whether expected indicators appear for known charts (such as publicly available celebrity charts).
The most useful test case strategy was concentrating on Solar Term boundaries. Testing birth dates on the exact day of the Start of Spring, the Awakening of Insects, Late Night Hour time windows, and DST periods --- covering these edge cases implicitly covers the normal cases.
Claude helped significantly with test case generation. Asking "Generate test cases for Start of Spring boundaries, Late Night Hour, and DST periods" produced specific birth dates, times, and expected results for each scenario. Of course, every expected value was manually verified against professional Manselyeok sites before being used in tests.
What I Learned Along the Way
First, Favorable Element determination sits at the boundary between "clearly codifiable rules" and "areas requiring interpretive judgment." The broad framework of strong/weak classification can be coded, but the nuanced weighting and thresholds require empirical tuning.
Second, what users actually want and what developers think is important can differ. Spirit Indicators' promotion from P3 to P1 was thanks to benchmarking. Another confirmation of the value of "use before you build."
Third, Major Fate and Annual Fate calculations require the Manselyeok module and analysis engine to share the same data. If the architecture's data flow is not designed correctly, a major refactoring awaits.
Fourth, unit testing in the Saju domain is not optional. Invisible calculation errors can undermine the entire app's credibility.
Fifth, AI excels at structuring large volumes of domain data tables (22 Spirit Indicators' evaluation conditions, etc.) in one pass. But that data's accuracy must always be verified against external sources.
Next Up
The analysis engine is complete. The four pillars are calculated, Five Elements ratios produced, Ten Gods classified, Favorable Element determined, Spirit Indicators detected. Now the question becomes: are these results actually correct? Cross-verification against professional apps, testing strategies for "multiple right answers," and the reality that Manselyeok accuracy determines everything --- Part 10 covers it all.
댓글
댓글 쓰기