Back to Docs

BaZi Health & Constitution

POST/api/v1/chinese/bazi/health

Analyze BaZi chart for constitution tendencies and health-related susceptibility themes. Based on classical BaZi/TCM (Five Element) correspondences - not medical advice.

⚠️ Important Disclaimer

This endpoint provides constitution analysis based on classical BaZi/TCM frameworks. It does not constitute medical advice, diagnosis, or treatment. Outputs describe "tendencies" and "patterns" in traditional terms, not biomedical claims. Always consult qualified healthcare professionals for medical concerns.

Full URL

https://astro-api-1qnc.onrender.com/api/v1/chinese/bazi/health

Endpoint Capabilities

Constitution Analysis

Temperature (hot/cold), moisture (dry/damp), and yin/yang balance classification

Seasonal Weighting

Element strength adjusted by month branch (season) for accurate balance

Ten Gods Stress Patterns

Depletion risk, overwork risk, pressure load from natal Ten Gods

TCM Correspondences

Classical Five Element organ-system mappings with confidence scores

Instability Markers

Clashes, punishments, and harms scored with impact levels

Timing Risk Analysis

Decade and annual peaks when unfavorable elements are activated

How Element Balance is Calculated

1. Raw Element Counting

Each of the 4 pillars contributes element points:

  • Heavenly Stem: 20 points to its element
  • Earthly Branch main: 20 points to its element
  • Hidden Stems (藏干): Up to 10 points each, weighted by proportion (main=60-100%, secondary=30%, tertiary=10%)

Total raw points ≈ 200 across all 5 elements.

2. Seasonal Strength Multipliers

Elements are stronger or weaker depending on the birth month (season):

Spring (寅卯辰): Wood ×1.4-1.5 | Fire ×1.0 | Earth ×0.6-1.1 | Metal ×0.5-0.7 | Water ×0.8-0.9

Summer (巳午未): Wood ×0.8-0.9 | Fire ×1.2-1.5 | Earth ×1.0-1.3 | Metal ×0.5-0.7 | Water ×0.4-0.5

Autumn (申酉戌): Wood ×0.4-0.6 | Fire ×0.6-0.8 | Earth ×0.9-1.2 | Metal ×1.2-1.5 | Water ×0.9-1.1

Winter (亥子丑): Wood ×0.9-1.1 | Fire ×0.4-0.5 | Earth ×0.6-1.1 | Metal ×0.8-1.0 | Water ×1.2-1.5

3. Effective Distribution Formula

effective_pre_normalized = raw_absolute × seasonal_multiplier
effective_distribution = normalize(effective_pre_normalized) → percentages

How Rooting is Calculated

Rooting shows how much each element is "grounded" in the Earthly Branches (地支). An element with high rooting has stable support.

Algorithm

  • For each branch, sum hidden stem weights by element (main=1.0, secondary=proportional)
  • Branch main element adds +1.0 to its element's rooting
  • Normalize all elements to 0-1 scale
Example: Branch 巳 (Si/Snake) contains 丙 Fire 60%, 庚 Metal 30%, 戊 Earth 10%
→ Fire +0.6, Metal +0.3, Earth +0.1 to rooting_raw

How Constitution is Calculated

Temperature Score (-1 to +1)

Each element has a temperature property:

Fire: +1.0 (hot) | Wood: +0.2 (warm) | Earth: 0.0 (neutral) | Metal: -0.3 (cool) | Water: -0.8 (cold)

Temperature score = Σ(element_% × temperature_property)

Result: >0.25 = hot, <-0.25 = cold, else = balanced

Moisture Score (-1 to +1)

Water: +0.8 (damp) | Earth: +0.5 (damp) | Wood: +0.3 (moist) | Metal: -0.5 (dry) | Fire: -0.8 (dry)

Result: >0.2 = damp, <-0.2 = dry, else = balanced

How Timing Risk is Calculated

Timing analysis identifies periods when unfavorable elements (忌神) are activated.

Strain Index Components

  • Unfavorable element in Luck Pillar stem: +0.3
  • Unfavorable element in Luck Pillar branch: +0.3
  • Branch clash with natal branch: +0.4

Driver Explanation

Drivers explain the mechanism, e.g., "壬 (Water) drains weak Earth DM (忌神)" rather than just labeling elements as unfavorable.

Filtering

Only decades overlapping with analysis_range (default: current year + 10) are returned.

Request Parameters

ParameterTypeRequiredDescription
yearintegerYesYear of birth
monthintegerYesMonth of birth (1-12)
dayintegerYesDay of birth (1-31)
hourintegerNoHour of birth (0-23). Default: 12
minuteintegerNoMinute of birth (0-59). Default: 0
latfloatNoLatitude (-90 to 90). Required if city not provided.
lngfloatNoLongitude (-180 to 180). Required if city not provided.
citystringNoCity name for coordinate lookup. Default: 'Unknown'
sexstringNo'M' (male) or 'F' (female). Default: 'M'
include_timingbooleanNoInclude decade and annual risk analysis. Default: true
timing_years_aheadintegerNoNumber of years to analyze for timing peaks. Default: 10

Sample Code

import requests
import json

url = "https://astro-api-1qnc.onrender.com/api/v1/chinese/bazi/health"

payload = {
    "year": 1990,
    "month": 6,
    "day": 15,
    "hour": 14,
    "minute": 0,
    "lat": 48.8566,
    "lng": 2.3522,
    "sex": "M",
    "include_timing": True,
    "timing_years_ahead": 10
}

headers = {
    "Content-Type": "application/json",
    "x-api-key": "YOUR_API_KEY"
}

response = requests.post(url, headers=headers, json=payload)
print(response.json())

Response Structure

bazi_context - Day Master, favorable/unfavorable elements, balance strategy with rationale

element_balance - Raw counts, seasonal multipliers, effective distribution, rooting scores

constitution - Temperature, moisture with component breakdown and scales

timing - Decade/annual peaks with strain type and mechanism-explaining drivers

data_quality - Model transparency (rooting method, transformations applied)

{
  "bazi_context": {
    "day_master": "己",
    "day_master_element": "Earth",
    "day_master_strength": "Weak",
    "favorable_elements": ["Fire", "Earth"],
    "unfavorable_elements": ["Wood", "Water"],
    "rationale": ["Weak Earth DM needs support elements"],
    "balance_strategy": {
      "priority_elements": ["Fire", "Earth"],
      "reason": ["Favorable elements support weak Earth DM"]
    }
  },
  "element_balance": {
    "raw_absolute": {"Wood": 80.0, "Fire": 67.0, "Earth": 24.0, "Metal": 26.0, "Water": 3.0},
    "raw_total": 200.0,
    "raw_distribution": {"Wood": 40.0, "Fire": 33.5, "Earth": 12.0, "Metal": 13.0, "Water": 1.5},
    "effective_pre_normalized": {"Wood": 120.0, "Fire": 67.0, "Earth": 14.4, "Metal": 13.0, "Water": 2.4},
    "effective_distribution": {"Wood": 55.3, "Fire": 30.9, "Earth": 6.6, "Metal": 6.0, "Water": 1.1},
    "effective_method": "raw_absolute × seasonal_multiplier = effective_pre_normalized, then normalized to %",
    "seasonal_adjustments": {
      "month_branch": "卯",
      "multipliers": {"Wood": 1.5, "Fire": 1.0, "Earth": 0.6, "Metal": 0.5, "Water": 0.8}
    },
    "rooting_scores": {"Wood": 0.29, "Fire": 0.25, "Earth": 0.21, "Metal": 0.15, "Water": 0.10},
    "rooting_raw": {"Wood": 2.3, "Fire": 2.0, "Earth": 1.7, "Metal": 1.2, "Water": 0.8},
    "dominant_elements": ["Wood", "Fire"],
    "weak_elements": ["Metal", "Water"]
  },
  "constitution": {
    "temperature": "hot",
    "temperature_score": 0.35,
    "temperature_scale": "[-1 (cold) to +1 (hot)]",
    "temperature_components": {"Wood": 0.11, "Fire": 0.31, "Earth": 0.0, "Metal": -0.02, "Water": -0.01},
    "moisture": "balanced",
    "moisture_score": 0.05
  },
  "timing": {
    "decade_peaks": [
      { 
        "period": "2026-2036", 
        "gan_zhi": "壬午", 
        "strain_index": 0.65, 
        "strain_type": "depletion",
        "drivers": ["壬 (Water) drains weak Earth DM (忌神)"],
        "level": "elevated" 
      }
    ],
    "year_peaks": [
      { "year": 2028, "gan_zhi": "戊申", "strain_index": 0.48, "level": "moderate" }
    ],
    "analysis_range": "2026-2035"
  },
  "data_quality": {
    "rooting_model": "basic_hidden_stems",
    "hidden_stems_weighting": "proportional",
    "transformations": "not_applied"
  },
  "disclaimer": "This analysis is based on classical BaZi/TCM correspondences..."
}