Phenotype_detector / Content.py
hpratapsingh's picture
Update Content.py
e6b168c
def starting(input):
if 'hello' in input or 'hii' in input or 'hi' in input or 'wake up' in input:
response = "Hii !! If you want to know about your body's constituion and wellness, you are at the right place.\nLet's start. Are you ready?"
else:
response = questions(input)
return response
response_list = []
prakriti1 = ''
def questions(input):
if input == 'sure':
return 'Q1. What is your age?'
if 'years' in input or 'year' in input:
response_list.append(int(input.split()[0]))
return 'Q2. What is your weight? (Approx or Exact)'
if 'kg' in input or 'pounds' in input or 'kgs' in input or 'kilograms' in input:
response_list.append(float(input.split()[0]))
return 'Q3. What is your height?(Approx or Exact)'
if 'ft' in input or 'feet' in input:
response_list.append(float(input.split()[0]))
return 'Q4. In which region do you live? (Ex. Hilly, Plain, Deserty, Coastal, etc)'
if input in ['hilly', 'coastal', 'plain', 'highlands', 'lowlands', 'desert', 'deserty', 'plateau']:
response_list.append(input)
return 'Q5. What is your skin type? (Cracked, Clear, Dry, Oily, Smooth, etc.)'
if all(item in ['cracked', 'clear', 'dry', 'smooth', 'oily', 'cold', 'warm', ',', 'and'] for item in input.split()):
response_list.extend(input.split())
return 'Q6. How does your hair feel?(Dry, Rough, Thin, Breaking, Scanty, Oily, Thick, Glossy, Long, Curly, Medium, etc.)'
if all(item in ['dry', 'rough', 'thin', 'breaking', 'scanty', 'oily', 'thick', 'glossy', 'long', 'curly', ',', 'and'] for item in input.split()):
response_list.extend(input.split())
return 'Q7. What kind of food you like normally?(Sweet, Hot, Warm, Cold, Fried, Watery foods, Spicy, Bitter, Salty, Junk Food, etc.)'
if all(item in['sweet', 'hot', 'warm', 'cold', 'fried', 'watery', 'spicy','salty', 'sour', 'bitter', ',', 'and', 'salty', 'junk', 'food', 'foods'] for item in input.split()):
response_list.extend(input.split())
return "Q8. Does your body generally remain warm, cold or hot?"
if input.split()[0] in ['hot', 'cold', 'warm', 'generally', 'and']:
response_list.extend(input.split())
return 'Q9. Do you get irritated or angry often?'
if input == 'yes' or input == 'no':
ynresponse(input, 'irritation')
return 'Q10. How much is your appetite? (Like it large, mormal or low)'
if input in ['large', 'normal', 'low']:
response_list.append(input)
return answer(response_list)
if input == 'yes why not' or input == 'no not now':
return ynresponse(input.split()[0], 'know more')
def ynresponse(yn, condition):
if condition == 'irritation':
if yn == 'yes':
response_list.append("irritable")
else:
response_list.append('slight irritation')
if condition == 'know more':
if yn == "yes":
if prakriti == 'vata':
return 'Vata is one of the three doshas in Ayurvedic medicine, along with pitta and kapha. It is responsible for controlling various movements in the body, such as blood flow, elimination, and breath. Vata is a combination of air and ether, and it is characterized as dry, light, cold, rough, moving, and always changing. People with a predominantly vata dosha are often energetic, creative, and lively. They tend to be light sleepers with sensitive digestion.To bring the vata dosha back into balance, it is recommended to go to bed earlier, eat regularly, and keep the body warm. Physical activities that focus on balance and flexibility, such as yoga, dancing, or tai chi, are also beneficial. Thank You'
elif prakriti == 'pitta':
return 'Pitta is one of the three doshas in Ayurveda, a traditional Indian system of medicine. According to Ayurveda, the world is made up of five elements: air, water, fire, earth, and space. These elements combine to form three doshas: vata, kapha, and pitta. Pitta is believed to be responsible for the body’s metabolic system, temperature regulation, and transformation of the body and mind. The main qualities of pitta are hot, sharp, intense, light, bitter, and spreading Pitta’s elemental makeup consists of fire and water. It is responsible for all chemical and metabolic transformations in the body. When in balance, pitta brings intelligence, courage, clarity, charisma, and the light of understanding. However, when in excess, it can cause imbalances related to excess heat such as anger, jealousy, irritated skin, sharp hunger, and difficulty sleeping. Thank You'
else:
return 'Kapha is one of the three doshas in Ayurveda, a system of holistic medicine from India. It is influenced by water and earth elements and has qualities such as cold, heaviness, steadiness, softness, and stability. Kapha body type is characterized by a large frame, stocky body, oily and smooth skin, thick and wavy hair, and strong bones and muscles. Kapha personality is calm, sensitive, romantic, cool, cheerful, lazy, forgiving, and tolerant. Thank You'
def answer(response : list):
global prakriti
bmi_index = (0.37*0.37)*(response[1]/(response[2]*response[2]))
if bmi_index <18.44:
response.append('underweight')
elif bmi_index>18.44 and bmi_index<24.88:
response.append('normal')
elif bmi_index>24.88:
response.append('overweight')
if response[2]>5.9 and response[1]<66:
response.append('tall')
height = response[2]
age = response[0]
weight = response[1]
if height<5.9 and height>5.3 and weight<=66:
response.append('normal height')
if height<5.3 and weight>65:
response.append('short')
vata = ['underweight', 'thin', 'tall', 'hilly', 'plain', 'cracked', 'dry', 'rough', 'thin', 'breaking', 'sweet', 'sour', 'salty', 'cold', 'slight irritation']
pitta = ['normal', 'normal height', 'deserty', 'plain', 'smooth', 'oily', 'scanty', 'good', 'medium', 'spicy', 'hot', 'fried', 'irritable' ]
kapha = ['overweight', 'short', 'coastal', 'plain', 'oily', 'cold', 'long', 'glossy', 'thick', 'watery', 'bitter', 'sour', 'junk', 'warm' ]
vatacount = 0
for i in range(len(response)):
if response[i] in vata:
vatacount += 1
pittacount = 0
for i in range(len(response)):
if response[i] in pitta:
pittacount += 1
kaphacount = 0
for i in range(len(response)):
if response[i] in kapha:
kaphacount += 1
if vatacount>pittacount and vatacount>kaphacount:
ans = 'After carefully analyzing your responses I say your prakriti is Vata. Do you wish to know more about your prakriti?'
prakriti = 'vata'
elif pittacount>vatacount and pittacount>kaphacount:
ans = 'After carefully analyzing your responses I say your prakriti is Pitta. Do you wish to know more about your prakriti?'
prakriti = 'pitta'
else:
ans = 'After carefully analyzing your responses I say your prakriti is Kapha. Do you wish to know more about your prakriti?'
prakriti = 'kapha'
return ans
ans = questions('hot')
print(ans)