-
Notifications
You must be signed in to change notification settings - Fork 0
/
Handling_Function.py
283 lines (239 loc) · 11.2 KB
/
Handling_Function.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
from Get_Value import *
worldShouldAnswerWith=["ALMOST","VERY MUCH","A LITTLE","SOMETIMES","YES","NEVER","NOT SURE","NO"]
EGDTest=["ULCERS AND EROSIONS IN DOUDENUM","ULCERS AND EROSIONS IN STOMACH","BLUNTED VILLI",
"SUPER FACIAL INFLAMMATORY INFILTRATE",
"DIFFUSE ULCERAION","PSEUDO POLPLUS","SUPERFICIAL CHRONIC INFLAMMATION","CRYPT ABSCESS",
"DEEP AND LONG FISSURES","COBBLESTONING"]
diarrehea=["dIARRHEA","NON_GROSSLY_BLOODY_DIARRHEA","GROSSLY_BLOODY_DIARRHEA","CHRONIC_GREASY_DIARRHEA"]
abdominal=["EPIGASTRIC_ABDOMINAL","LEFT_UPPER_QUADRANT","RIGHT_UPPER_QUADRANT","ABDOMINAL"]
vomitting=["VOMITING","BILE_VOMITTING","BLEEDING_VOMITING"]
EGDTestWord=["VERY CLEAR","A Little","NOT CLEAR"]
LABAnser=["HIGH","NORMAL","LOW"]
def Handling_EGD_input():
res=[]
print("-----------------------------------------------------------------------------------------------------------------------")
for index,item in enumerate(EGDTest):
print(index+1,"["+item+"] ",end=" ")
print("\n---------------------------------------------------------------------------------------------------------------------")
print("\n+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ")
for index,item in enumerate(EGDTestWord):
print(str(index+1)+"["+item+"]\t",end=" ")
print("\n+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +")
print("\nPLEASE MAKE THE ANSWER TOW NUMBER THE FIRST ONE IS THE [MANIFISTATION] THE SECOND ONE IS THE DEGREE OF MANIFASTAION.")
print("\n*****************************************************")
print("YOU CAN END THE INPUT BY ENTERING [E\e].")
print("*****************************************************\n")
while True:
f=input("The Number You Wont!")
if f in ["E","e"]:
break
try:
f=int(f)
if f>=1 and f<=len(EGDTest):
while True:
s=input("PLEASE ENTER CERTAINTY NUMBER FROM 1 TO %d"%(len(EGDTestWord)))
try:
s=int(s)
if s>=1 and s<=len(EGDTestWord):
g=get_The_Right_EGD(f-1)
c=get_CF_for_EGD(s-1)
res.append((g,c))
break
else:
continue
except ValueError:
print("PLEASE ENTER A VALID CERTAINTY NUMBER FROM 1 TO %d"%(len(EGDTestWord)))
continue
else :
print("PLEASE ENTER A VALID MANIFISTATION NUMBER FROM 1 TO %d"%(len(EGDTest)))
except ValueError:
print("PLEASE ENTER A VALID MANIFISTATION NUMBER FROM 1 TO %d"%(len(EGDTest)))
continue
if len(res)>0:
return res
else:return 0
def Handling_LAB_input():
res=[]
index=1
print("-----------------------------------------------------------------------------------")
for i in LABS:
i=str(i)
print(index,"["+i[5:]+"] ",end=" ")
index+=1
print("\n-----------------------------------------------------------------------------------")
index-=1
while True:
f=input("PLEASE ENTER THE NUMBER OF [ENZYM] YOU WON'T OR END BY PRESSING [e\E] ")
print("-----------------------------------------------------------------------------------")
if f in ["E","e"]:break
try:
f=int(f)
if f>=1 and f<=index:
for i,item in enumerate(LABAnser):
print(i+1,":"+item+" ",end=" ")
print("\n+ + + + + + + + + + + + + + + + + +\n")
while True:
s=input("PLEASE ENTER THE RIGHT RANGE. ")
try:
s=int(s)
if s>=1 and s<=3:
if s==2:
break
if f==index and s==1:
f=get_The_Right_Labs(f-1)
res.append((f,-0.9))
elif f<index and s==3:
f=get_The_Right_Labs(f-1)
res.append((f,-0.9))
else:
f=get_The_Right_Labs(f-1)
res.append((f,1))
break
except ValueError:
continue
except ValueError:
continue
if len(res)>0:
return res
else:
return 0
def Handling_ECHO_input():
res=[]
index=1
print("-------------------------------------------------------------------------------------")
for i in ECHO:
i=str(i)
print(index,"["+i[5:]+"] ",end=" ")
index+=1
print("\n-----------------------------------------------------------------------------------")
index-=1
while True:
f=input("PLEASE ENTER THE DESCRIPTION OF WHAT YOU CAN SEE IN THE [ECHO] OR YOU CAN END THE INPUT BY ENTERING [E\e] ")
print("-----------------------------------------------------------------------------------")
if f in ["E","e"]:break
try:
f=int(f)
if f>=1 and f<=index:
f=get_The_Right_Echo(f-1)
res.append(f)
except ValueError:
continue
if len(res)>0:
return res
else :
return 0
def Handling_Choice_input(Question):
print("------------------------------------------------------------------------------------------------")
for index,item in enumerate(worldShouldAnswerWith):
print(index+1,"["+item+"]\t",end=" ")
print("\n----------------------------------------------------------------------------------------------")
while True:
v=input(Question)
print("-------------------------------------------------------------------------------------------")
try:
v=int(v)
if v<=len(worldShouldAnswerWith) and v>=1:
break
else:
print("PLEASE CHOOSE A VALID VALUE FROM 1 To %d \n"%(len(worldShouldAnswerWith)))
except ValueError:
print("PLEASE CHOOSE A VALID VALUE FROM 1 To %d \n"%(len(worldShouldAnswerWith)))
continue
return v
def Handling_YES_NO_input(Question):
print ("THE ANSWER SHOULD BE (y\[n]) ")
ans=input(Question)
if ans in ["YES","yes","y","Y"]:
return 1
else:
return 0
def Handling_diarrhea():
ans=Handling_YES_NO_input("Is Ther Any Diarrhea ? ")
if ans==0:return 0
else :
print("-----------------------------------------------------------------------")
print("could you please choose one of this list to describe The [ DIARRHEA ] you Have ? ")
print("-----------------------------------------------------------------------\n")
for index,item in enumerate(diarrehea):
print(index+1,"["+item+"] ",end=" ")
while True:
f=input()
try:
f=int(f)
if f>=1 and f<=len(diarrehea):
if f==1:return Clinic.dIARRHEA
elif f==2:return Clinic.NON_GROSSLY_BLOODY_DIARRHEA
elif f==3:return Clinic.GROSSLY_BLOODY_DIARRHEA
elif f==4:return Clinic.CHRONIC_GREASY_DIARRHEA
except ValueError:
print("Enter A Valid Value !")
def Handling_Vomitting():
ans=Handling_YES_NO_input("Do you Have A VOMITTING ? ")
if ans==0:return 0
else :
print("-----------------------------------------------------------------------")
print("could you please choose one of this list to describe The [ VOMITTING ] you Have ? ")
print("-----------------------------------------------------------------------\n")
for index,item in enumerate(vomitting):
print(index+1,"["+item+"] ",end=" ")
while True:
f=input()
try:
f=int(f)
if f>=1 and f<=len(vomitting):
if f==1:return Clinic.VOMITING
elif f==2:return Clinic.BILE_VOMITTING
elif f==3:return Clinic.BLEEDING_VOMITING
except ValueError:
print("Enter A Valid Value !")
def Handling_Abdominal():
ans=Handling_YES_NO_input("Do you Have Abdominal Pain ? ")
res=[]
if ans==0:return 0
else :
res.append((Clinic.ABDOMINAL_PAIN,1))
print("-----------------------------------------------------------------------")
print("could you please choose one of this list to describe The [ ABDOMINAL PAIN ] you Have ? ")
print("-----------------------------------------------------------------------\n")
index=1
for i in abdominal:
print(index,"["+i+"] ",end=" ")
index+=1
index-=1
while True:
f=input()
try:
f=int(f)
if f==3:
ans=Handling_YES_NO_input("Is There any Pain In The SHOULDER ? ")
if ans == 1:res.append((Clinic.RIGHT_UPPER_QUADRANT_PAIN_SHOULDER_RIGHT,1))
else :res.append((Clinic.RIGHT_UPPER_QUADRANT_PAIN,1))
return res
elif f==2:
res.append((Clinic.LEFT_UPPER_QUADRANT_PAIN,1))
return res
elif f==1:
ans=Handling_YES_NO_input("Is There any Pain in The Back ? ")
if ans==1:res.append ((Clinic.EPIGASTRIC_ABDOMINAL_PAIN_WITH_BACK_PAIN,1))
ans=Handling_YES_NO_input("Is There any Pain In The Chest ? ")
if ans==1:res.append((Clinic.HEART_BURN,1))
ans=Handling_YES_NO_input("Dose Pain Worsed By Food ? ")
if ans == 1:res.append((Clinic.EPIGASTRIC_ABDOMINAL_PAIN_WORSED_WITH_FOOD,1))
else :
ans=Handling_YES_NO_input("Dose Pain Releved By Food ?")
if ans == 1:res.append((Clinic.EPIGASTRIC_ABDOMINAL_PAIN_RELIVED_WITH_FOOD,1))
if len(res)>0:
return res
else:
res.append((Clinic.EPIGASTRIC_ABDOMINAL_PAIN,1))
return res
elif f==4:
ans=Handling_YES_NO_input("Dose Pain Worsed by Food ?")
if ans==1:res.append((Clinic.ABDOMINAL_PAIN_WORSE_BY_FOOD,1))
ans =Handling_YES_NO_input("Dose Pain Worsed by Strees ?")
if ans==1:res.append((Clinic.ABDOMINAL_PAIN_WORSE_BY_STRESS,1))
return res
else :
print("Enter A Valid Value !")
except ValueError:
print("Enter A Valid Value ! ")