-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCOVID-19 QUESTIONNAIRE (VOICE BASED INPUT AND OUTPUT).py
184 lines (180 loc) · 6.83 KB
/
COVID-19 QUESTIONNAIRE (VOICE BASED INPUT AND OUTPUT).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
import pyttsx3
import speech_recognition as sr
import time
def questionnaire():
r = sr.Recognizer()
engine = pyttsx3.init()
user_reply1 = "Do you live in the same house as that of the case?"
engine.say(user_reply1)
engine.runAndWait()
engine.stop()
with sr.Microphone()as source:
print("Please Reply in yes or no")
audio = r.listen(source)
user_reply10 = r.recognize_google(audio)
user_reply1 = format(user_reply10)
user_reply2 = "Are you their intimate partner?"
engine.say(user_reply2)
engine.runAndWait()
engine.stop()
with sr.Microphone()as source:
print("Please Reply in yes or no")
audio = r.listen(source)
user_reply20 = r.recognize_google(audio)
user_reply2 = format(user_reply20)
user_reply3 = "Have you provided any care to the patient while he or she was sick?"
engine.say(user_reply3)
engine.runAndWait()
engine.stop()
with sr.Microphone()as source:
print("Please Reply in yes or no")
audio = r.listen(source)
user_reply30 = r.recognize_google(audio)
user_reply3 = format(user_reply30)
if user_reply1 == "no" and user_reply2 == "no" and user_reply3 == "no":
user_reply4 = "Were you in the same indoor environment like a classroom with the patient for 15 minutes or more during his or her infectious period? "
engine.say(user_reply4)
engine.runAndWait()
engine.stop()
with sr.Microphone()as source:
print("Please Reply in yes or no")
audio = r.listen(source)
user_reply40 = r.recognize_google(audio)
user_reply4 = format(user_reply40)
if user_reply4 == "no":
engine.say("NO IDENTIFIABLE RISK")
engine.runAndWait()
engine.stop()
elif user_reply4 == "yes":
user_reply7 = "Were you within 6 feet of the patient for 15 minutes or more?"
engine.say(user_reply7)
engine.runAndWait()
engine.stop()
with sr.Microphone()as source:
print("Please Reply in yes or no")
audio = r.listen(source)
user_reply70 = r.recognize_google(audio)
user_reply7 = format(user_reply70)
user_reply8 = "Has the patient coughed or sneezed on you since 48 hours before they fell ill?"
engine.say(user_reply8)
engine.runAndWait()
engine.stop()
with sr.Microphone()as source:
print("Please Reply in yes or no")
audio = r.listen(source)
user_reply80 = r.recognize_google(audio)
user_reply8 = format(user_reply80)
if user_reply7 == "no" and user_reply8 == "no":
engine.say("NO IDENTIFIABLE RISK")
engine.runAndWait()
engine.stop()
elif user_reply7 == "yes" or user_reply8 == "yes":
engine.say("MEDIUM RISK")
engine.runAndWait()
engine.stop()
user_reply9 = "Do you have fever coughness or shortness of breath?"
engine.say(user_reply9)
engine.runAndWait()
engine.stop()
with sr.Microphone()as source:
print("Please Reply in yes or no")
audio = r.listen(source)
user_reply90 = r.recognize_google(audio)
user_reply9 = format(user_reply90)
if user_reply9 == "yes":
engine.say("Isolate yourself until at least seven days have passed since sympton onset and 72 hours since fever resolved and respiratory symptoms improved .Seek testing if possible.")
engine.runAndWait()
engine.stop()
elif user_reply9 == "no":
engine.say("Quarantine for 14 days since your last exposure to the patient. Stay home as much as possible and six feet from others when you must go out. Watch for any symptoms")
engine.runAndWait()
engine.stop()
else:
print("Please type your answer that is- yes or no(in lowercase).")
print("----RESTART----")
time.sleep(1)
questionnaire()
else:
print("Please type your answer that is- yes or no(in lowercase).")
print("----RESTART----")
time.sleep(1)
questionnaire()
else:
print("Please type your answer that is- yes or no(in lowercase).")
print("----RESTART----")
time.sleep(1)
questionnaire()
elif user_reply1 == "yes" or user_reply2 == "yes" or user_reply3 == "yes":
user_reply5 = "While the patient has been ill, has he or she been spending most of the time in a different room from you?"
engine.say(user_reply5)
engine.runAndWait()
engine.stop()
with sr.Microphone()as source:
print("Please Reply in yes or no")
audio = r.listen(source)
user_reply50 = r.recognize_google(audio)
user_reply5 = format(user_reply50)
user_reply6 = "When you are in the same room, and in all your interactions, are you using aface mask or gloves?"
engine.say(user_reply6)
engine.runAndWait()
engine.stop()
with sr.Microphone()as source:
print("Please Reply in yes or no")
audio = r.listen(source)
user_reply60 = r.recognize_google(audio)
user_reply6 = format(user_reply60)
if user_reply5 == "yes" and user_reply6 == "yes":
engine.say("MEDIUM RISK")
engine.runAndWait()
engine.stop()
user_reply9 = "Do you have fever coughness or shortness of breath?"
engine.say(user_reply9)
engine.runAndWait()
engine.stop()
with sr.Microphone()as source:
print("Please Reply in yes or no")
audio = r.listen(source)
user_reply90 = r.recognize_google(audio)
user_reply9 = format(user_reply90)
if user_reply9 == "yes":
engine.say("Isolate yourself until at least seven days have passed since sympton onset and 72 hours since fever resolved and respiratory symptoms improved .Seek testing if possible.")
engine.runAndWait()
engine.stop()
elif user_reply9 == "no":
engine.say("Quarantine for 14 days since your last exposure to the patient. Stay home as much as possible and six feet from others when you must go out. Watch for any symptoms")
engine.runAndWait()
engine.stop()
else:
print("Please type your answer that is- yes or no(in lowercase).")
print("----RESTART----")
time.sleep(1)
questionnaire()
elif user_reply5 == "no" or user_reply6 == "no":
engine.say("HIGH RISK")
engine.runAndWait()
engine.stop()
user_reply9 = input("Do you have fever coughness or shortness of breath?")
if user_reply9 == "yes":
engine.say("Isolate yourself until at least seven days have passed since sympton onset and 72 hours since fever resolved and respiratory symptoms improved. Seek testing if possible.")
engine.runAndWait()
engine.stop()
elif user_reply9 == "no":
engine.say("Quarantine for 14 days since your last exposure to the patient. Stay home as much as possible and six feet from others when you must go out. Watch for any symptoms")
engine.runAndWait()
engine.stop()
else:
print("Please type your answer that is- yes or no(in lowercase).")
print("----RESTART----")
time.sleep(1)
questionnaire()
else:
print("Please type your answer that is- yes or no(in lowercase).")
print("----RESTART----")
time.sleep(1)
questionnaire()
else:
print("Please type your answer that is- yes or no(in lowercase).")
print("----RESTART----")
time.sleep(1)
questionnaire()
questionnaire()