Loading...
Loading...
Analyze TCM constitution data, identify constitution types, evaluate constitution characteristics, and provide personalized health preservation suggestions. Support correlation analysis with health data such as nutrition, exercise, and sleep.
npx skill4agent add huifer/wellally-health tcm-constitution-analyzerdata/constitutions.jsondata/constitution-recommendations.jsondata-example/tcm-constitution-tracker.jsondata-example/tcm-constitution-logs/YYYY-MM/YYYY-MM-DD.jsondata-example/profile.jsondata-example/nutrition-tracker.jsondata-example/fitness-tracker.jsondata-example/sleep-tracker.jsondef calculate_constitution_scores(answers):
"""
Based on the *TCM Constitution Classification and Judgment* standard
Calculation formula:
Converted score = [(Original score - Number of questions) / (Number of questions × 4)] × 100
Where:
- Original score = Sum of scores for each question
- Number of questions = Number of questions for this constitution
"""
scores = {}
for constitution, questions in CONSTITUTION_QUESTIONS.items():
original_score = sum(answers[q] for q in questions)
question_count = len(questions)
converted_score = ((original_score - question_count) / (question_count * 4)) * 100
scores[constitution] = round(converted_score, 1)
return scoresdef determine_constitution_type(scores):
"""
Determination logic:
1. Balanced Constitution determination:
- Score ≥ 60 points
- Scores of the other 8 constitutions are all < 40 points
2. Unbalanced Constitution determination:
- The constitution with the highest score is the determination result
3. Concurrent Constitution determination:
- Score of the constitution with the second-highest score ≥ 40 points
- Then it is a concurrent constitution
"""
peaceful_score = scores['平和质']
other_scores = {k: v for k, v in scores.items() if k != '平和质'}
# Determine if it is Balanced Constitution
if peaceful_score >= 60 and all(s < 40 for s in other_scores.values()):
return {
'primary': '平和质',
'secondary': [],
'type': 'balanced'
}
# Unbalanced Constitution determination
sorted_scores = sorted(other_scores.items(), key=lambda x: x[1], reverse=True)
primary = sorted_scores[0][0]
# Judge concurrent constitution
secondary = [k for k, v in sorted_scores[1:3] if v >= 40]
return {
'primary': primary,
'secondary': secondary,
'type': 'compound' if secondary else 'single'
}# TCM Constitution Identification and Evaluation Report
## Assessment Date
2025-06-20
## Assessment Results
### Constitution Type Determination
- **Primary Constitution**: Qi Deficiency Constitution
- **Concurrent Constitution**: Yang Deficiency Constitution
- **Constitution Type**: Concurrent Constitution
### Scores of Each Constitution
| Constitution Type | Score | Judgment |
|---------|------|------|
| Qi Deficiency Constitution | 78.5 | ⚠️ Unbalanced |
| Yang Deficiency Constitution | 62.3 | ⚠️ Unbalanced |
| Balanced Constitution | 42.1 | Normal |
| Phlegm-Dampness Constitution | 38.7 | Normal |
| Qi Stagnation Constitution | 35.2 | Normal |
| Yin Deficiency Constitution | 32.1 | Normal |
| Damp-Heat Constitution | 28.4 | Normal |
| Blood Stasis Constitution | 25.6 | Normal |
| Special Endowment Constitution | 18.3 | Normal |
---
## Constitution Characteristic Analysis
### Qi Deficiency Constitution Characteristics
**Physical Characteristics**:
- Soft muscles
- Easy fatigue
- Weak voice
- Prefer quiet and dislike talking
- Easy sweating
**Psychological Characteristics**:
- Introverted personality
- Dislike taking risks
- Unstable emotions
**Predisposition to Illness**:
- Prone to colds
- Prone to visceral ptosis
- Prone to fatigue
**Adaptability**:
- Intolerant to wind, cold, summer heat, and dampness pathogens
- Prone to illness in autumn
### Yang Deficiency Constitution Characteristics
**Physical Characteristics**:
- Fear of cold and cold limbs
- Cold hands and feet
- Prefer hot food and drinks
**Psychological Characteristics**:
- Mostly calm personality
- Introverted
**Predisposition to Illness**:
- Prone to phlegm-fluid retention, swelling, diarrhea
- Susceptible to cold pathogens
**Adaptability**:
- Intolerant to cold pathogens, tolerant to summer heat
- Prone to illness in winter
---
## Health Preservation Suggestions
### Dietary Conditioning
**Principle**: Replenish Qi and strengthen the spleen, warm and tonify kidney Yang
**Beneficial Foods**:
- Qi-replenishing: Chinese yam, jujube, astragalus, ginseng, atractylodes macrocephala
- Yang-warming: mutton, leeks, Chinese prickly ash, ginger, longan
- Spleen-strengthening: coix seed, poria cocos, hyacinth bean
**Foods to Avoid**:
- Raw and cold: ice cream, iced drinks, sashimi
- Greasy and heavy: fried food, fatty meat
- Spicy and hot: chili, Chinese prickly ash
**Recommended Recipes**:
1. Astragalus Stewed Chicken
2. Chinese Yam Porridge
3. Jujube and Poria Porridge
4. Angelica, Ginger and Mutton Soup
**Dietary Suggestions**:
- Eat small meals frequently, chew slowly
- Diet should be warm, avoid raw and cold
- Rest appropriately after meals
### Daily Life Regulation
**Work and Rest Suggestions**:
- Ensure sufficient sleep (more than 8 hours)
- Go to bed early and get up late
- Avoid staying up late
**Environmental Requirements**:
- Keep the environment warm and dry
- Avoid exposure to wind and cold
- Pay attention to keeping warm, especially the waist, abdomen, and feet
**Living Habits**:
- Avoid overwork
- Balance work and rest
- Can sunbathe appropriately
- Soak feet in warm water
### Exercise and Fitness
**Principle**: Gentle exercise, avoid strenuous exercise
**Recommended Exercises**:
- Tai Chi
- Baduanjin
- Walking
- Qigong
- Yoga
**Exercise Suggestions**:
- Frequency: 1-2 times a day
- Duration: 20-30 minutes each time
- Intensity: Low to moderate intensity
- Note: Should not feel overly fatigued
**Precautions**:
- Avoid strenuous exercise
- Rest promptly after exercise
- Progress gradually
- Avoid exercising in cold environments
### Emotional Regulation
**Principle**: Maintain a cheerful mood, avoid excessive thinking
**Regulation Methods**:
- Stay positive and optimistic
- Avoid excessive thinking
- Participate in social activities appropriately
- Learn to relax
**Emotional Management**:
- Cultivate hobbies
- Maintain social activities
- Learn to regulate emotions
### Acupoint Health Care
**Recommended Acupoints**:
#### 1. Zusanli (ST36)
- **Location**: 3 cun below the knee joint on the lateral side of the lower leg
- **Efficacy**: Strengthen the spleen and replenish Qi, invigorate the body
- **Method**: Massage for 3-5 minutes daily, moxibustion is optional
#### 2. Qihai (CV6)
- **Location**: 1.5 cun below the navel
- **Efficacy**: Tonify primordial Qi
- **Method**: Massage for 3-5 minutes daily, moxibustion is optional
#### 3. Guanyuan (CV4)
- **Location**: 3 cun below the navel
- **Efficacy**: Tonify primordial Qi and essence, warm and tonify kidney Yang
- **Method**: Massage for 3-5 minutes daily, moxibustion for 10-15 minutes is optional
### Traditional Chinese Medicine Conditioning
⚠️ **Important Reminder**: The following content is for reference only by TCM practitioners, do not take medicine without authorization
**Recommended Prescription**: Modified Si Junzi Decoction
**Source**: *Taiping Huimin Heji Ju Fang* (Formulas of the Peaceful Benevolent Dispensary)
**Prescription Composition**:
- Ginseng: 9-15g, greatly replenish primordial Qi
- Atractylodes macrocephala: 9-12g, strengthen the spleen and replenish Qi
- Poria cocos: 9-15g, strengthen the spleen and drain dampness
- Licorice: 6-9g, harmonize all herbs
**Modifications Based on Symptoms**:
- Severe Qi deficiency: Add astragalus 15-30g
- Spleen deficiency with excessive dampness: Add coix seed 15-30g, hyacinth bean 10-15g
- Poor appetite and abdominal distension: Add tangerine peel 6-9g, amomum villosum 3-6g
**Usage**: Decoct in water, 1 dose per day, take warm twice a day in the morning and evening
**Precautions**:
- ⚠️ Must be used after differentiation by a professional TCM practitioner
- ⚠️ Pregnant women, children, and the weak need guidance from a practitioner
- ⚠️ Avoid raw, cold, greasy, and spicy foods during medication
- ⚠️ Suspend use when having a cold or fever
- ⚠️ Stop using immediately and seek medical advice if adverse reactions occur during medication
---
## Seasonal Conditioning Suggestions
### Spring Conditioning
- Focus on nourishing Yang, conform to the ascending Qi of spring
- Eat more leeks, spinach, Chinese yam
- Maintain a cheerful mood, exercise appropriately
- Pay attention to wind protection and keeping warm
### Summer Conditioning
- Clear summer heat, nourish the heart spirit
- Eat more mung beans, wax gourd, bitter gourd
- Pay attention to heatstroke prevention and cooling
- Maintain a calm mood
### Autumn Conditioning
- Nourish and astringe, moisten dryness, nourish the lung
- Eat more tremella, lily, pear
- Pay attention to keeping warm, avoid catching cold
- Maintain emotional stability
### Winter Conditioning
- Focus on nourishing and storing, warm and tonify kidney Yang
- Eat more mutton, walnuts, chestnuts
- Pay attention to keeping warm, especially the waist and abdomen
- Go to bed early and get up late, avoid overwork
---
## Correlation with Other Health Indicators
### Constitution and Nutrition
- Qi Deficiency Constitution, Yang Deficiency Constitution: Suitable for warm and tonifying diet
- Yin Deficiency Constitution, Damp-Heat Constitution: Suitable for light diet
- Phlegm-Dampness Constitution: Suitable for low-fat, low-sugar diet, control weight
### Constitution and Exercise
- Qi Deficiency Constitution, Yang Deficiency Constitution: Focus on gentle exercise
- Damp-Heat Constitution, Phlegm-Dampness Constitution: Appropriately increase exercise intensity
- Yin Deficiency Constitution: Avoid strenuous exercise
### Constitution and Sleep
- Qi Deficiency Constitution, Yang Deficiency Constitution: Ensure sufficient sleep
- Yin Deficiency Constitution: Avoid staying up late
- Qi Stagnation Constitution: Soothe the liver and relieve stagnation, improve sleep quality
### Constitution and Chronic Diseases
- Phlegm-Dampness Constitution: Prone to hypertension, diabetes, hyperlipidemia
- Damp-Heat Constitution: Prone to metabolic syndrome
- Blood Stasis Constitution: Prone to cardiovascular diseases
- Qi Stagnation Constitution: Prone to depression, anxiety disorders
---
## Medical Safety Boundaries
⚠️ **Important Declaration**
This analysis is for health reference only and does not constitute medical diagnosis or treatment advice.
### Analysis Scope of Capabilities
✅ **Can Do**:
- TCM constitution identification and evaluation
- Constitution characteristic analysis
- General health preservation suggestions
- TCM knowledge popularization
- Constitution trend tracking
❌ **Cannot Do**:
- TCM disease diagnosis
- Prescribing TCM prescriptions
- Replacing TCM practitioner diagnosis and treatment
- Therapeutic operations such as acupuncture
- Handling serious health problems
### Danger Signal Detection
The following danger signals are detected during analysis:
1. **Severe Constitution Imbalance**:
- Score of a single unbalanced constitution > 80 points
- Multiple unbalanced constitutions coexist
2. **Health Risk Prompt**:
- Phlegm-Dampness Constitution → Risk of hypertension, diabetes
- Damp-Heat Constitution → Risk of metabolic syndrome
- Blood Stasis Constitution → Risk of cardiovascular diseases
- Qi Stagnation Constitution → Risk of depression
3. **Medical Referral Guidance**:
- Suspected disease symptoms → Suggest seeking medical advice
- Need TCM conditioning → Consult a TCM practitioner
- Ineffective constitution conditioning → Seek professional help
### Suggestion Levels
**Level 1: General Suggestions**
- Based on TCM constitution theory
- Suitable for general population
- No medical supervision required
**Level 2: Reference Suggestions**
- Based on user's constitution and health status
- Need to combine personal situation
- Suggest consulting a TCM practitioner
**Level 3: Medical Suggestions**
- Involve TCM conditioning
- Need confirmation by TCM practitioner
- Do not take TCM medicine without authorization
---
## Data Structure
### Constitution Assessment Record
```json
{
"date": "2025-06-20",
"questionnaire": {
"questions": [
{
"id": 1,
"constitution": "气虚质",
"question": "您容易疲乏吗?",
"answer": 4,
"weight": 1.0
}
],
"total_questions": 60
},
"results": {
"primary_constitution": "气虚质",
"secondary_constitutions": ["阳虚质"],
"constitution_scores": {
"平和质": 42.1,
"气虚质": 78.5,
"阳虚质": 62.3,
"阴虚质": 32.1,
"痰湿质": 38.7,
"湿热质": 28.4,
"血瘀质": 25.6,
"气郁质": 35.2,
"特禀质": 18.3
},
"constitution_type": "compound"
},
"characteristics": {
"physical": ["容易疲劳", "气短", "自汗"],
"psychological": ["性格内向", "不喜欢说话"]
},
"recommendations": {
"diet": {
"principles": ["补气健脾", "温补肾阳"],
"beneficial": ["山药", "大枣", "黄芪"],
"avoid": ["生冷寒凉", "油腻厚味"]
},
"exercise": "温和运动,如太极拳、散步",
"lifestyle": "规律作息,避免过度劳累",
"acupoints": ["足三里", "气海", "关元"]
}
}