Documentation

A Zi Wei Dou Shu chart engine, field-for-field identical to JS iztro, plus pattern judgement, knowledge packs and reverse birth-date lookup — with LLM-ready text output. A Rust core, callable from Rust, Python, Go and JavaScript / TypeScript.

Zi Wei Dou Shu — Chinese "Purple Star" astrology — charts a life from a birth date and hour. This library turns that birth moment into a complete chart, and into text a language model can read in one call — let the library get the chart right; let the AI do the reading.

One call produces the Markdown below — the full basic info, palace overview, patterns and the first palace, with the other eleven palaces following in the same shape. Paste it into any language model and start asking questions:

# Natal Chart 2000-8-16 Tiger hour female

## Basic Info
- Solar: 2000-8-16 · Lunar: 2000-7-17 · Hour: Tiger hour (03:00~05:00)
- Pillars: geng chen - jia shen - bing woo - geng yin · Zodiac: dragon · Sign: leo
- Five Elements Class: wood 3rd · Soul Star: rebel · Body Star: scholar
- Soul Palace: woo · Body Palace: xu (career) · Original Palace: chen (spouse)
- Birth-Year Mutagen: sun [A]→children, warrior [B]→wealth, moon [C]→friends, fortunate [D]→health

## Palace Overview
| Palace | Major Stars | Minor Stars | Decadal |
|---|---|---|---|
| **soul** woo | emperor([+3]) | artist([-3]) | 3-12 |
| siblings si | advisor([-1]) | — | 13-22 |
| spouse chen [Original Palace] | marshal([+3]) | helper, impulsive([-3]) | 23-32 |
| children mao | sun([+3]) [A], sage([+3]) | — | 33-42 |
| wealth yin | warrior([+1]) [B], minister([+3]) | horse | 43-52 |
| health chou | fortunate([-2]) [D], advocator([-2]) | assistant, fickle | 53-62 |
| surface zi | wolf([+2]) | spark([-3]) | 63-72 |
| friends hai | moon([+3]) [C] | — | 73-82 |
| career xu [Body Palace] | judge([0]), empress([+3]) | officer | 83-92 |
| property you | — | ideologue, driven([-3]) | 93-102 |
| spirit shen | rebel([+1]) | scholar([+1]), money | 103-112 |
| parents wei | — | aide, tangled([+3]) | 113-122 |

## Patterns
- **Empress and Minister Facing the Palace** (soul): empress([+3]), minister([+3])

## Palaces

### soul (ren woo) · Decadal 3-12
- Major Stars: emperor([+3])
- Minor Stars: artist([-3])
- Adjective Stars: refined, lucky, intercepted, instigated, considery(Y)
- Trine & Opposite: Opposite surface · Trine wealth, career
- Stem ren Flying: sage [A]→children, emperor [B]→soul, officer [C]→career, warrior [D]→wealth
- Twelve Gods: Changsheng·weak, Boshi·dragon, Suiqian·downcast, Jiangqian·disastery
- Age Fortune Years: 5, 17, 29, 41, 53, 65, 77, 89, 101, 113

… (the other eleven palaces)

Reading the sample

Lunar reads year-month-day of the lunar calendar (2000-7-17 = the 17th day of the 7th lunar month, 2000; a leap month reads leap-4). Pillars is the four pillars in iztro's own romanization — close to pinyin, but note 午 renders as woo to avoid clashing with 戊 wu. Bracket notation: ([+3]) is brightness on a -3…+3 scale, [A]/[B]/[C]/[D] are the four mutagens, and →children names the palace the mutagen star sits in. The full conventions are on the to_text page.

Whether a chart is correct has one hard standard here: zero field-level divergence from JS iztro v2.6.3, held by 747,572 golden test cases — see Accuracy. Defaults match iztro exactly; the Zhongzhou school and every boundary convention are switchable, because parity with iztro is an engineering standard, not a claim that any one school is the only correct one.

Where to start

API reference for each language:

Three things iztro doesn't have

These are the semantic layers above the raw chart — the part an AI pipeline actually consumes — and upstream iztro has no equivalent API for any of them:

Find your path

Several programming languages, one result

Every binding calls the same Rust core, so charts come out identical field for field. The predicate methods are built on language-independent keys, so one analysis rule — written in Rust, Python, Go or JavaScript — yields the same answer on a chart rendered in any output language.

use x_iztro::*;

let chart = by_solar("2000-8-16", 2, Gender::Female, true, Language::EnUS, Config::default())?;
let soul = chart.palace(Palace::Soul).unwrap();

println!("{}", soul.has(&[StarKey::ZiweiMaj]));

They all report the same answer — the Soul palace of this chart holds Ziwei, the Emperor star (Python prints True; the others print true). All of them use the language-independent key ziweiMaj: render the same chart in English or Japanese and the answer doesn't change.

On this page