You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

336 lines
12 KiB

#!/usr/bin/env python3
def head_age(gender, age):
if gender == 'boys':
band2 = (2.87342*(10**-7))*(age**5) \
- (0.0000509098*(age**4)) \
+ (0.00343161*(age**3)) \
- (0.111613*(age**2)) \
+ (1.89389*(age)) \
+ 37
band_m2 = (2.67918*(10**-7))*(age**5) \
- (0.0000488281*(age**4)) \
+ (0.00339988*(age**3)) \
- (0.113802*(age**2)) \
+ (1.92986*(age)) \
+ 31.8
# girls
else:
band2 = (2.51173*(10**-7))*(age**5) \
- (0.0000452112*(age**4)) \
+ (0.00311294*(age**3)) \
- (0.103906*(age**2)) \
+ (1.81319*(age**1)) \
+ 36.3
band_m2 = (2.37778*(10**-7))*(age**5) \
- (0.0000430009*(age**4)) \
+ (0.00297309*(age**3)) \
- (0.0993634*(age**2)) \
+ (1.72528*(age**1)) \
+ 31.5
return (band2, band_m2)
def is_head_normal(gender, age, head):
h = head_age(gender, age)
if float(head) < h[0] and float(head) > h[1]:
ans = 'Normal'
elif float(head) >= h[0]:
ans = 'Makrosefali'
else:
ans = 'Mikrosefali'
return ans
def weight_age(band, gender, age):
if gender == 'boys':
if band == -3:
if age <= 24:
w = (6.78168)*(10**-8)*(age**6) \
- (3.25521)*(10**-6)*(age**5) \
- (0.0000217014)*(age**4) \
+ (0.00403646)*(age**3) \
- (0.0934201)*(age**2) \
+ (1.03625)*(age) \
+ 2.
elif age <= 48:
w = (-1.35525)*(10**-20)*(age**5) \
- (0.0000488281)*(age**4) \
+ (0.00742187)*(age**3) \
- (0.417969)*(age**2) \
+ (10.4312)*(age) \
- 88.1
else:
w = (0.075)*(age) \
+ 7.8
elif band == -2:
if age <= 12:
w = (0.000112847)*(age**5) \
- (0.00373264)*(age**4) \
+ (0.0480903)*(age**3) \
- (0.326736)*(age**2) \
+ (1.5725)*(age) \
+ 2.2
else:
w = (1.3262)*(10**-6)*(age**4) \
- (0.000199653)*(age**3) \
+ (0.00999421)*(age**2) \
- (0.0616821)*(age) \
+ 7.65926
# band == 2
else:
if age <= 12:
w = (0.0000564236)*(age**6) \
- (0.00210937)*(age**5) \
+ (0.0296007)*(age**4) \
- (0.186979)*(age**3) \
+ (0.430694)*(age**2) \
+ (0.931667)*(age) \
+ 4.5
else:
w = (-2.00939)*(10**-7)*(age**4) \
+ (0.0000434028)*(age**3) \
- (0.00344329)*(age**2) \
+ (0.360417)*(age) \
+ 8.1
# girls
else:
if band == 2:
if age <= 12:
w = (-8.3348)*(10**-19)*(age**6) \
+ (0.000078125)*(age**5) \
- (0.00286458)*(age**4) \
+ (0.0411458)*(age**3) \
- (0.313542)*(age**2) \
+ (1.78417)*(age) \
+ 4.1
else:
w = (-1.00469)*(10**-6)*(age**4) \
+ (0.000159144)*(age**3) \
- (0.00853588)*(age**2) \
+ (0.45625)*(age) \
+ 7.
elif band == -2:
if age <= 12:
w = (-0.0000195313)*(age**6) \
+ (0.000716146)*(age**5) \
- (0.0102865)*(age**4) \
+ (0.0763021)*(age**3) \
- (0.346042)*(age**2) \
+ (1.35833)*(age) \
+ 2.2
else:
w = (1.40657)*(10**-6)*(age**4) \
- (0.000207369)*(age**3) \
+ (0.0098669)*(age**2) \
- (0.0243056)*(age) \
+ 6.3
# band == -3
else:
if age <= 12:
w = (-0.000015191)*(age**6) \
+ (0.000455729)*(age**5) \
- (0.00490451)*(age**4) \
+ (0.0263021)*(age**3) \
- (0.130139)*(age**2) \
+ (0.9375)*(age) \
+ 2.
else:
w = (6.02816)*(10**-7)*(age**4) \
- (0.0000916281)*(age**3) \
+ (0.00407986)*(age**2) \
+ (0.0715278)*(age) \
+ 5.
return w
def is_weight_normal(gender, age, weight):
# kelebihan
if weight > weight_age(2, gender, age):
ans = 'Gizi Berlebih'
# buruk
elif weight < weight_age(-3, gender, age):
ans = 'Gizi Buruk'
# kurang
elif weight < weight_age(-2, gender, age):
ans = 'Gizi Kurang'
# normal
else:
ans = 'Gizi Normal'
return ans
def height_age(band, gender, age):
if gender == 'boys':
if band == 2:
if age <= 12:
w = (-0.000141059)*(age**6) \
+ (0.00527344)*(age**5) \
- (0.0766059)*(age**4) \
+ (0.55599)*(age**3) \
- (2.25382)*(age**2) \
+ (7.31667)*(age) \
+ 54.
elif age <= 60:
w = (-5.42535)*(10**-6)*(age**4) \
+ (0.000921103)*(age**3) \
- (0.0606771)*(age**2) \
+ (2.52153)*(age) \
+ 57.5
elif age <= 156:
w = (-1.21268*10**-10*age**7) \
+ (8.84224*10**-8*age**6) \
- (0.0000272657*age**5) \
+ (0.00460575*age**4) \
- (0.459965*age**3) \
+ (27.1377*age**2) \
- (874.633*age) \
+ (11976.1)
else:
w = (-1.49603*10**-21*age**5) \
+ (1.3325*10**-18*age**4) \
+ (0.0000578704*age**3) \
- (0.0381944*age**2) \
+ (8.46667*age) \
- (442.)
elif band == -2:
if age <= 12:
w = (age**6)/5120 \
- (59)*(age**5)/7680 \
+ (29)*(age**4)/256 \
- (289)*(age**3)/384 \
+ (307)*(age**2)/160 \
+ (143)*(age)/60 \
+ 46
elif age <= 60:
w = (-2.00939)*(10**-6)*(age**4) \
+ (0.000385802)*(age**3) \
- (0.0292245)*(age**2) \
+ (1.54861)*(age) \
+ 56.
elif age <= 156:
w = (-2.29799*10**-10*age**7) \
+ (1.66984*10**-7*age**6) \
- (0.0000513287*age**5) \
+ (0.00864673*age**4) \
- (0.861622*age**3) \
+ (50.7566*age**2) \
- (1635.17*age) \
+ (22302.5)
else:
w = (1.33959*10**-7*age**5) \
- (0.000122975*age**4) \
+ (0.0449653*age**3) \
- (8.19132*age**2) \
+ (744.347*age) \
- (26884.)
# band == -3
elif band == 3:
if age <= 12:
elif age <= 60:
elif age <= 156:
w = (-1.32896*10**-10*age**7) \
+ (9.32598*10**-8*age**6) \
- (0.0000276375*age**5) \
+ (0.00448211*age**4) \
- (0.429503*age**3) \
+ (24.3144*age**2) \
- (752.203*age) \
+ (9914.)
else:
w = (-2.84663*10**-7*age**5) \
+ (0.000264235*age**4) \
- (0.0977165*age**3) \
+ (17.9897*age**2) \
- (1647.88*age) \
+ (60224.5)
else:
if age <= 12:
w = (0.0000868056)*(age**6) \
- (0.00325521)*(age**5) \
+ (0.0451389)*(age**4) \
- (0.268229)*(age**3) \
+ (0.380556)*(age**2) \
+ (4)*(age) \
+ 44.
elif age <= 60:
w = (-3.01408)*(10**-6)*(age**4) \
+ (0.000506366)*(age**3) \
- (0.0342882)*(age**2) \
+ (1.59375)*(age) \
+ 53.5
elif age <= 156:
w = (-7.86301*10**-11*age**7) \
+ (5.61884*10**-8*age**6) \
- (0.0000169749*age**5) \
+ (0.00280946*age**4) \
- (0.275046*age**3) \
+ (15.9234*age**2) \
- (504.133*age) \
+ (6821.2)
else:
w = (2.84663*10**-7*age**5) \
- (0.000252178*age**4) \
+ (0.0888431*age**3) \
- (15.5626*age**2) \
+ (1356.22*age) \
- (46931.5)
# girls
else:
if band == 2:
if age <= 12:
w = (-0.0000108507)*(age**6) \
+ (0.000585938)*(age**5) \
- (0.0128038)*(age**4) \
+ (0.144531)*(age**3) \
- (0.948611)*(age**2) \
+ (5.4125)*(age) \
+ 53
else:
w = (2.00939)*(10**-6)*(age**4) \
- (0.000192901)*(age**3) \
- (0.00202546)*(age**2) \
+ (1.29861)*(age) \
+ 64.
elif band == -2:
if age <= 12:
w = (0.000173611)*(age**6) \
- (0.00638021)*(age**5) \
+ (0.0876736)*(age**4) \
- (0.539062)*(age**3) \
+ (1.20903)*(age**2) \
+ (2.63333)*(age) \
+ 46
else:
w = (4.01878)*(10**-6)*(age**4) \
- (0.000530478)*(age**3) \
+ (0.0185185)*(age**2) \
+ (0.597222)*(age) \
+ 60.
# band == -3
else:
if age <= 12:
w = (age**6)/4608 \
- (age**5)/128 \
+ (121)*(age**4)/1152 \
- (61)*(age**3)/96 \
+ (209)*(age**2)/144 \
+ (29)*(age)/12 \
+ 44
else:
w = (-4.01878)*(10**-6)*(age**4) \
+ (0.000626929)*(age**3) \
- (0.0393519)*(age**2) \
+ (1.72222)*(age) \
+ 50.
return w
def is_height_normal(gender, age, height):
if height < height_age(-3, gender, age):
ans = 'Sangat pendek'
elif height < height_age(-2, gender, age):
ans = 'Pendek'
elif height > height_age(2, gender, age):
ans = 'Tinggi'
else:
ans = 'Normal'
return ans
# def is_weight_length_normal(gender, length, height):