Expand description
Accurate, typed time-based Chai Bu rotating Qimen Dunjia charts.
Calendar calculation and plate construction are separated into independent crates. This crate adds the three wonders/six instruments, nine stars, eight doors, eight deities, duty star/door, void branches and travelling horse. Its output records conventions explicitly so another program can reproduce it.
let request = qimen_core::ChartRequest::new(2026, 9, 18, 14);
let chart = qimen_core::calculate(&request)?;
assert_eq!(chart.palaces.len(), 9);
assert_eq!(chart.schema_version, "1.1");Structs§
- Branch
Growth - One growth stage at one concrete palace branch.
- Calculation
Request - The shared JSON/MCP request: civil fields plus optional
extensions. - Calculator
- A reusable deterministic calculator configured once for many civil inputs.
- Calendar
Request - Proleptic Gregorian input and explicit calculation conventions.
- Calendar
Result - Calendar data required for a reproducible Qimen chart.
- Chart
- A complete, reproducible, language-independent Qimen chart.
- Chart
Extensions - Optional annotations. Absent fields were not requested, rather than negative.
- Civil
Date Time - An unambiguous second-resolution civil timestamp with a fixed UTC offset.
- Conventions
- Explicit conventions needed when comparing results between schools/software.
- Cycle
- A stem–branch pair within the sixty-position sexagenary cycle.
- DayHorse
- Optional day horse, independent of the existing hour-based palace marker.
- Door
Pressure - Door pressure for a single occupied door palace.
- Door
Pressures - Door-pressure results for all eight doors.
- Door
Strength - Strength of a moving door.
- Extension
Options - The optional annotations to calculate after constructing a base chart.
- Four
Pillars - The four sexagenary pillars, with exact term boundaries for year and month.
- Growth
Stages - Twelve-stage results and the polarity/earth convention used.
- Heaven
Stem - A heavenly-plate stem, including its provenance and center-hosting identity.
- Hidden
Stem - A constructed hidden stem in one numeric palace.
- Hidden
Stems - Nine-palace hidden-stem calculation and its actual starting point.
- Horse
- A travelling horse; its containing field identifies the source pillar.
- Leaders
- Duty star and duty door, preserving the original center palace when relevant.
- Lunar
Date - Modern Chinese lunar-calendar rules applied to the local Gregorian date.
- Palace
- All fixed and moving components of one Luo Shu palace.
- Palace
Strength - All strength annotations for a single palace.
- Pillar
Voids - The two void branches of each pillar; palace markers use the hour pair.
- Punishments
- 六仪击刑 evaluations, with plate identities retained.
- Solar
Term - One solar-term boundary in the request’s fixed UTC offset.
- Star
Strength - Strength of a moving star under both explicitly recorded environments.
- Stem
Growth - Growth stages for one stem occurrence.
- Stem
Placement - Identity of a stem occurrence; hosted stems must not be silently collapsed.
- Stem
Punishment - Punishment evaluation for one stem occurrence.
- Stem
Strength - Strength of one stem occurrence.
- Stem
Tomb - Tomb evaluation for one stem occurrence.
- Strengths
- Strength annotations with the exact seasonal environment used.
- Tombs
- Tomb evaluations; applicability remains distinct from a negative result.
- Xun
- The hour’s ten-position period and its hidden 甲 stem.
Enums§
- Annotation
Basis - The pillar used for a chart-level branch annotation.
- Branch
- The twelve earthly branches in their traditional order.
- Calendar
Error - A rejected input or calendar conversion failure.
- Center
Palace Rule - The supported center-palace convention.
- DayBoundary
- Civil-clock convention for the day pillar.
- DayHorse
Rule - Supported day-horse conventions.
- Deity
- One of the eight deities, starting from the duty star’s current palace.
- Direction
- Palace directions on the Later Heaven / Luo Shu arrangement.
- Door
- One of the eight doors.
- Door
Pressure Rule - Supported door-pressure conventions.
- Dun
- Yang or yin dun, determined by the current solar term.
- Element
- One of the five traditional elements.
- Element
Strength State - Ordinary five-element strength, used for doors and stems.
- Error
- An invalid calendar request, malformed JSON, or serialization failure.
- Growth
Rule - Supported twelve-stage growth conventions.
- Growth
Stage - One of the twelve stages of stem growth.
- Hidden
Stem Rule - Supported 暗干 construction conventions.
- Method
- A supported chart construction method.
- Punishment
Rule - Supported 六仪击刑 conventions.
- Star
- One of the nine stars; 天禽 is explicitly carried with 天芮.
- Star
Strength State - Nine-star strength; 废 is distinct from the ordinary element’s 死.
- Stem
- The ten heavenly stems in their traditional order.
- Stem
Plate - A plate carrying a stem annotation.
- Strength
Rule - Supported element-strength conventions.
- Tian
QinRule - The supported placement of the central star.
- Tomb
Rule - Supported stem-tomb conventions; these must not be conflated.
- Trigram
- One of the eight Later Heaven trigrams.
- Yuan
- The five-day yuan determined from the day’s 甲/己 head.
Constants§
- SCHEMA_
VERSION - Version of the serialized chart structure.
Functions§
- calculate
- Calculates the four pillars and complete nine-palace chart.
- calculate_
json - Parses a strict JSON request and returns a compact serialized chart.
- calculate_
json_ pretty - Produces an indented JSON chart for human-readable command-line output.
- calculate_
with_ options - Calculates a chart with per-call extension settings.
Type Aliases§
- Chart
Request - Calendar input for the default time-based Chai Bu rotating chart.