def main():
    # user_id, age, gender, heartrate, Systolic_BP, Diastolic_BP, blood_oxygen, temperature, time):
    data = {}
    LINES = open("input").read().splitlines()
    for idx, line in enumerate(LINES):
        items = line.split()
        #print(items)
        Data = input_module(items[0], items[1], items[2], items[3], items[4],
                            items[5], items[6], items[7], items[8])
        #Data=input_module.implement_filter(Data)
        data[idx] = Data.dic
        print data[idx]

    #def __init__(self, Systolic_BP, Diastolic_BP, Heart_Rate, Heart_Oxy_Level, Body_temp):
    for idx, content in enumerate(data):
        process = Analyzer(data[idx]["Systolic_BP"], data[idx]["Diastolic_BP"],
                           data[idx]["heartrate"], data[idx]["blood_oxygen"],
                           data[idx]["temperature"])
        signal_loss = process.Signal_Loss(data[idx]["heartrate"],
                                          data[idx]["temperature"])
        shock_alert = process.Shock_Alert(data[idx]["heartrate"],
                                          data[idx]["temperature"])
        oxygen_supply = process.Oxygen_Supply(data[idx]["blood_oxygen"])
        fever = process.Fever(data[idx]["temperature"])
        hypotension = process.Hypotension(data[idx]["Systolic_BP"],
                                          data[idx]["Diastolic_BP"])
        hypertension = process.Hypertension(data[idx]["Systolic_BP"],
                                            data[idx]["Diastolic_BP"])

        result = Output_Module.display_basic_iuput_data(
            signal_loss, shock_alert, oxygen_supply, fever, hypotension,
            hypertension)
        print 'Patient', idx, 'Alert'
        print result
Exemplo n.º 2
0
def process():
    # user_id, age, gender, heartrate, Systolic_BP, Diastolic_BP, blood_oxygen, temperature, time):
    #def __init__(self, Systolic_BP, Diastolic_BP, Heart_Rate, Heart_Oxy_Level, Body_temp):
    data = Input_module.input()
    time.sleep(0.5)
    for idx, content in enumerate(data):
        process = Analyzer(data[idx]["Systolic_BP"], data[idx]["Diastolic_BP"],
                           data[idx]["heartrate"], data[idx]["blood_oxygen"],
                           data[idx]["temperature"])
        signal_loss = process.Signal_Loss(data[idx]["heartrate"],
                                          data[idx]["temperature"])
        shock_alert = process.Shock_Alert(data[idx]["heartrate"],
                                          data[idx]["temperature"])
        oxygen_supply = process.Oxygen_Supply(data[idx]["blood_oxygen"])
        fever = process.Fever(data[idx]["temperature"])
        hypotension = process.Hypotension(data[idx]["Systolic_BP"],
                                          data[idx]["Diastolic_BP"])
        hypertension = process.Hypertension(data[idx]["Systolic_BP"],
                                            data[idx]["Diastolic_BP"])

        result = Output_Module.display_basic_iuput_data(
            signal_loss, shock_alert, oxygen_supply, fever, hypotension,
            hypertension)
        print('--------------------------------------')
        print('Patient  No', idx, 'Alert')
        for index in result:
            print(index, ':', result[index])
Exemplo n.º 3
0
def process_thread():
    while True:
        print("analyzing")
        data_dic = input_queue.get()
        if data_dic is None:
            break

        # use analyzer to trigger the alert
        myAnalyzer = Analyzer(data_dic["Systolic_BP"],
                              data_dic["Diastolic_BP"], data_dic["Heart_Rate"],
                              data_dic["Heart_O2_Level"],
                              data_dic["Body_temp"])
        # call functions to trigger the alert
        Signal_Loss = myAnalyzer.Signal_Loss(myAnalyzer.Heart_Rate,
                                             myAnalyzer.Body_temp)
        Shock_Alert = myAnalyzer.Shock_Alert(myAnalyzer.Heart_Rate,
                                             myAnalyzer.Body_temp)
        Oxygen_Supply = myAnalyzer.Oxygen_Supply(myAnalyzer.Heart_O2_Level)
        Fever = myAnalyzer.Fever(myAnalyzer.Body_temp)
        Hypotension = myAnalyzer.Hypotension(myAnalyzer.Systolic_BP,
                                             myAnalyzer.Diastolic_BP)
        Hypertension = myAnalyzer.Hypertension(myAnalyzer.Systolic_BP,
                                               myAnalyzer.Diastolic_BP)

        # generate regular output base on presented data
        basic_result = receive_basic_iuput_data(Signal_Loss, Shock_Alert,
                                                Oxygen_Supply, Fever,
                                                Hypotension, Hypertension)
        time.sleep(1)
        print("done")
        output_queue.put(basic_result)