-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprompts.py
43 lines (33 loc) · 1.23 KB
/
prompts.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
import random
def generateUserPrompt(taxa, med, taxa3_key = ""):
trad = random.uniform(0.0, 1.0)
mrad = random.randint(1, len(med)) # 49 as size of medication list (TODO: change with len/size of medlist)
urad = random.randint(0, 2)
urgency = ['low', 'medium', 'high']
i = 1
if taxa3_key != None:
while i < len(taxa):
if taxa[i][2] == taxa3_key:
break
else:
i+=1
else:
#Changed 3 to len(taxa)[0]
while trad > float(taxa[i][len(taxa[0])-1]) and i < len(taxa)-1:
i += 1
prompt = "Create an " + taxa[i][0] + " message (no more than 500 characters) regarding the medicine "
prompt += med[mrad][0]
prompt += " sent by a patient about the " + taxa[i][1]
if taxa[i][2] != "NA":
prompt += " "
prompt += taxa[i][2]
prompt += " with "
prompt += urgency[urad]
prompt += " urgency via the patient portal"
#added this part
if taxa[i][3]:
if taxa[i][3] != "NA":
prompt += ". "+taxa[i][3] + "."
else:
prompt += "."
return [prompt, taxa[i][0], taxa[i][1], taxa[i][2], taxa[i][3], med[mrad][0], urgency[urad]]