def extractLocation(main=False, onto=None, functType=None, loconto=None, activity=None, time="present"): clear() loc = AGLocation(loconto, onto) print(texts[time]["ventilation"].format(name=loconto.name)) uindex = userMenu(list([x[0] for x in ventilation])+["I don't know."]) if uindex < len(ventilation): loc.ventilation = ventilation[uindex][1] clear() print(texts[time]["distancing"].format(name=loconto.name)) uindex = userMenu(list([x[0] for x in distancing])+["I don't know."]) if uindex < len(distancing): loc.distancing = distancing[uindex][1] if activity.name == "Consuming": clear() print(textsmain[main]["eatingwhere"]) uindex = userMenu(list([x[0] for x in eating_where])+["I don't know."]) if uindex < len(eating_where): loc.eating_where = eating_where[uindex][1] clear() print(textsmain[main]["groupseating"].format(name=loconto.name)) uindex = userMenu(list([x[0] for x in seating])+["I don't know."]) if uindex < len(seating): loc.seating = seating[uindex][1] return loc
def getWeight(main, person): weightvalues = [("Underweight", "Underweight"), ("On expected weight", "On_Weight"), ("Overweight", "Overweight")] print(texts[main]["weight"].format(name=person.name)) uindex = userMenu([x[0] for x in weightvalues]) person.weight = weightvalues[uindex][1]
def extractTransportation(main=False, onto=None, personname=None, placename=None, time="present"): clear() print(texts[main][time]["transpstart"].format(name=personname, place=placename)) tra = AGTransportation(onto) uindex = userMenu([x[0] for x in transps] + ["I don't know."]) if uindex < len(transps): tra.trans = transps[uindex][1] return tra
def covidTest(main, person): testvalues = [("Positive", "Positive_Test"), ("Negative", "Negative_Test")] print(texts[main]["covidtest"].format(name=person.name)) uindex = userMenu([x[0] for x in testvalues]) person.covidtest = testvalues[uindex][1]
def getGender(main, person): genders = ["Male", "Female"] print(texts[main]["gender"].format(name=person.name)) uindex = userMenu(genders) person.gender = genders[uindex]
def extractPerson(main=False, onto=None, functType=None, name=None, time="present"): if onto is None: raise Exception("Parameters found None") if main and functType is None: usernametext = "Alright! Tell me about yourself. What is your name?: " healthparamsaux = healthparams elif functType == "liveswith": usernametext = texts[main]["liveswithintroduce"].format(name=name) healthparamsaux = healthliveswith main = False elif functType == "companions": usernametext = texts[main]["companionsintroduce"] healthparamsaux = healthcompanions main = False else: pass #debug username = input(usernametext) person = AGPerson(username, onto) if username in ag.globalAgent().people: name = renameUser(username, ag.globalAgent().people.keys()) if name is None: return ag.globalAgent().people[name] person.name = name ag.globalAgent().addPerson(person) if main: userparamstext = "What else could be of interest about you? This data will help me give you a better analysis." else: userparamstext = "What else could be of interest about " + username + "? This data will help me give you a better analysis." while (True): clear() print(userparamstext) uindex = userMenu( list(x[0] for x in healthparamsaux) + ["That's enough data."]) if uindex == len(healthparamsaux): break else: clear() healthparamsaux[uindex][1](main, person) if uindex == len(healthparamsaux) - 1: healthparamsaux = healthparamsaux[:uindex] elif uindex == 0: healthparamsaux = healthparamsaux[uindex + 1:] else: healthparamsaux = healthparamsaux[:uindex] + healthparamsaux[ uindex + 1:] if functType != "liveswith": liveswith = extractLivingwith(main=main, person=person, onto=onto) person.toOnto() if liveswith is not None: person.linkLivesWith(liveswith) gears = extractProtectionGear(main=main, onto=onto, personname=person.name, placename=name) if gears is not None: person.gears = gears person.updateGears() clear() while (True): resp = input(texts[main]["pastactivityyesno"].format(name=person.name)) if resp.lower() == "no": break elif resp.lower() == "yes": clear() pastActivities = AC.extractActivity( main=main, entranceText=texts[main]["pastactivitytell"].format( name=person.name), onto=onto, locations=[ "Bookshop", "Boutique", "Cafe", "Library", "Restaurant", "Shop", "Stadium" ], time="past", agent=person) clear() else: clear() print("Please introduce yes or no.") person.toOnto() return person