def algorithm_minus_one(self): symptom_dict = self.db_connection.get_global_symptom_count() done_list = self.bucket_object.get_asked_questions() print "Global:" print bcolors.FAIL + str(symptom_dict) print bcolors.OKBLUE for symptom in done_list: symptom_dict.pop(symptom) not_zero_flag = 0 for data in symptom_dict.values(): if data != "0": not_zero_flag = 1 break if not_zero_flag == 0: print bcolors.FAIL + "No historical data found!" print bcolors.OKBLUE return None else: top_symptom = keywithmaxval(symptom_dict) print bcolors.FAIL + "Global Historical Data found, using:" + top_symptom print bcolors.OKBLUE return top_symptom
def algorithm_minus_one(self): symptom_dict = self.db_connection.get_global_symptom_count() done_list = self.bucket_object.get_asked_questions() print "Global:" print bcolors.FAIL + str(symptom_dict) print bcolors.OKBLUE for symptom in done_list: symptom_dict.pop(symptom) not_zero_flag = 0 for data in symptom_dict.values(): if data != '0': not_zero_flag = 1 break if not_zero_flag == 0: print bcolors.FAIL + "No historical data found!" print bcolors.OKBLUE return None else: top_symptom = keywithmaxval(symptom_dict) print bcolors.FAIL + "Global Historical Data found, using:" + top_symptom print bcolors.OKBLUE return top_symptom
def get_top_critical_symptoms(self, number_of_symptoms=1): """ top_symptoms = heapq.nlargest(number_of_symptoms, self.symptom_critical_count, key=self.symptom_critical_count.get) """ top_symptoms = keywithmaxval(self.symptom_critical_count) return top_symptoms
def get_popular_symptoms(self, number_of_symptoms=1): """ top_symptoms = heapq.nlargest(number_of_symptoms, self.symptom_score, key=self.symptom_score.get) """ top_symptoms = keywithmaxval(self.symptom_score) return top_symptoms
def get_buckets_top_symptom(self, number_of_symptoms=1): self.calculate_highest_symptom() # print self.top_value_bucket_symptoms """ list_symptom = heapq.nlargest(number_of_symptoms, self.top_value_bucket_symptoms, key=self.top_value_bucket_symptoms.get) """ list_symptom = keywithmaxval(self.top_value_bucket_symptoms) return list_symptom
def algorithm_zero(self): symptom_dict = self.db_connection.get_symptom_data_for_chat_id(self.chat_id) done_list = self.bucket_object.get_asked_questions() for symptom in done_list: symptom_dict.pop(symptom) print bcolors.FAIL + str(symptom_dict) print bcolors.OKBLUE not_zero_flag = 0 for data in symptom_dict.values(): if data != "0": not_zero_flag = 1 break if not_zero_flag == 0: print bcolors.FAIL + "No historical data found for this user!" print bcolors.OKBLUE return None else: top_symptom = keywithmaxval(symptom_dict) print bcolors.FAIL + "Personal Historical Data found, using:" + top_symptom print bcolors.OKBLUE return top_symptom
def algorithm_zero(self): symptom_dict = self.db_connection.get_symptom_data_for_chat_id( self.chat_id) done_list = self.bucket_object.get_asked_questions() for symptom in done_list: symptom_dict.pop(symptom) print bcolors.FAIL + str(symptom_dict) print bcolors.OKBLUE not_zero_flag = 0 for data in symptom_dict.values(): if data != '0': not_zero_flag = 1 break if not_zero_flag == 0: print bcolors.FAIL + "No historical data found for this user!" print bcolors.OKBLUE return None else: top_symptom = keywithmaxval(symptom_dict) print bcolors.FAIL + "Personal Historical Data found, using:" + top_symptom print bcolors.OKBLUE return top_symptom