Example #1
0
def chat(symptom_i, diseases=[]):
    k = 2
    for i in get_disease.data_clean.keys():
        if symptom_i in get_disease.data_clean[i]["sym"]:
            #                 print(get_disease.data_clean[i]["sym"])
            diseases.append(i)
#     return [get_disease.disease_id[i] for i in diseases]
#     print(len([get_disease.disease_id[i] for i in diseases]))
    print(len(diseases))
    new_sym = get_disease.get_diseases(diseases, k)
    k += 1

    while (stop_loop(new_sym, diseases)):
        poss_d = diseases
        if get_disease.sym_id[new_sym] == "dont know":
            ans = 0
        else:
            print(get_disease.sym_id[new_sym])
            ans = int(input())
        diseases = []
        if ans == 1:
            for i in poss_d:
                if new_sym in get_disease.data_clean[i]["sym"]:
                    diseases.append(i)
        else:
            for i in poss_d:
                if new_sym not in get_disease.data_clean[i]["sym"]:
                    diseases.append(i)
        print(len([get_disease.disease_id[i] for i in diseases]))
        if new_sym == -1:
            return [get_disease.disease_id[i] for i in diseases]
        new_sym = get_disease.get_diseases(diseases)
        k += 1
    return [get_disease.disease_id[i] for i in diseases]
Example #2
0
def next_sym(new_sym, diseases, ans):
    #     while(stop_loop(new_sym,diseases)):
    poss_d = diseases
    if get_disease.sym_id[new_sym] == "dont know":
        ans = 0
#         else:

#             yield(get_disease.sym_id[new_sym])
#             ans=int(input())
    diseases = []
    if ans == 1:
        for i in poss_d:
            if new_sym in get_disease.data_clean[i]["sym"]:
                diseases.append(i)
    else:
        for i in poss_d:
            if new_sym not in get_disease.data_clean[i]["sym"]:
                diseases.append(i)


#         print(len([get_disease.disease_id[i] for i in diseases]))
    if ans == -1:
        return new_sym, diseases
    new_sym = get_disease.get_diseases(diseases)

    return new_sym, diseases
def next_sym(new_sym, diseases, ans):
    poss_d = diseases
    if new_sym == 0:
        ans = 0
    elif get_disease.sym_id[new_sym] == "dont know":
        ans = 0

    diseases = []

    if ans == 1:
        for i in poss_d:
            if new_sym in get_disease.data_clean[i]["sym"]:
                diseases.append(i)

    else:
        for i in poss_d:
            if new_sym not in get_disease.data_clean[i]["sym"]:
                diseases.append(i)

    if ans == -1:
        return new_sym, diseases

    new_sym = get_disease.get_diseases(diseases)

    return new_sym, diseases
def first_time(symptom_i):
    diseases = []

    for i in get_disease.data_clean.keys():

        if symptom_i in get_disease.data_clean[i]["sym"]:
            diseases.append(i)
    print(diseases)
    new_sym = get_disease.get_diseases(diseases)
    return new_sym, diseases
Example #5
0
def first_time(symptom_i):
    diseases = []
    for i in get_disease.data_clean.keys():
        if symptom_i in get_disease.data_clean[i]["sym"]:
            #                 print(get_disease.data_clean[i]["sym"])
            diseases.append(i)


#     return [get_disease.disease_id[i] for i in diseases]
#     print(len([get_disease.disease_id[i] for i in diseases]))
#     print(len(diseases))
    new_sym = get_disease.get_diseases(diseases)
    return new_sym, diseases
Example #6
0
def chat(symptom_i,diseases=[]):
    k=2
    
    for i in get_disease.data_clean.keys():            
        if symptom_i in get_disease.data_clean[i]["sym"]:
            diseases.append(i)

    new_sym=get_disease.get_diseases(diseases)
    
    while(stop_loop(new_sym,diseases)):
        
        poss_d=diseases
        
        if get_disease.sym_id[new_sym]=="dont know":
            ans=0
        
        else:
            print('Are you suffering from ' + get_disease.sym_id[new_sym] + '?')
            ans=input()
            ans=int(ans)
        
        diseases=[]
        
        if ans==1:
            for i in poss_d:
                if new_sym in get_disease.data_clean[i]["sym"]:
                    diseases.append(i)
        else:
            for i in poss_d:
                if new_sym not in get_disease.data_clean[i]["sym"]:
                    diseases.append(i)
        
        if new_sym==-1:
            return [get_disease.disease_id[i] for i in diseases]
        
        new_sym=get_disease.get_diseases(diseases)

    return [get_disease.disease_id[i] for i in diseases]