示例#1
0
def preprocess(inputs):
    
    featureList=[]
    
    for eachLine in tableContent:
        bp_diastolic_min = ''
        bp_diastolic_max = ''
        heartbeat_min = ''
        heartbeat_max = ''
        sleep_min = ''
        sleep_max = ''
        bp_systolic_min = ''
        bp_systolic_max = ''
        activity_min = ''
        activity_max = ''
        age_min = ''
        age_max = ''
        
        toBeSelected=True
         
        print "-------- ----"
        print eachLine.bp_systolic_min
        print eachLine.bp_systolic_max
        print (inputs["bloodPressures"][dailydata]["systolic"]>=eachLine.bp_systolic_min and inputs["bloodPressures"][dailydata]["systolic"]<=eachLine.bp_systolic_max)or((eachLine.bp_systolic_min=='')and(eachLine.bp_systolic_max==''))
        print inputs["bloodPressures"][dailydata]["systolic"]
        print "------------"
        
        if (((eachLine.bp_systolic_min=='')and(eachLine.bp_systolic_max=='')) or checkSystolic(inputs, eachLine)):
            bp_systolic_min = eachLine.bp_systolic_min
            bp_systolic_max = eachLine.bp_systolic_max
        else:
            toBeSelected=False
            
        if (((eachLine.bp_diastolic_min=='')and(eachLine.bp_diastolic_max=='')) or checkDiastolic(inputs, eachLine)):
            bp_diastolic_min = eachLine.bp_diastolic_min
            bp_diastolic_max = eachLine.bp_diastolic_max
        else:
            toBeSelected=False
            
        if (((eachLine.heartbeat_min=='')and(eachLine.heartbeat_max=='')) or checkHeartBeats(inputs, eachLine)):
            heartbeat_min = eachLine.heartbeat_min
            heartbeat_max = eachLine.heartbeat_max
        else:
            toBeSelected=False
            
        if (((eachLine.sleep_min=='')and(eachLine.sleep_max=='')) or checkSleep(inputs, eachLine)):
            sleep_min = eachLine.sleep_min
            sleep_max = eachLine.sleep_max
        else:
            toBeSelected=False
            
        if (((eachLine.activity_min=='')and(eachLine.activity_max=='')) or checkActivity(inputs, eachLine)):
            activity_min = eachLine.activity_min
            activity_max = eachLine.activity_max
        else:
            toBeSelected=False
            
        if (((eachLine.age_min=='')and(eachLine.age_max=='')) or checkAge(inputs, eachLine)):
            age_min = eachLine.age_min
            age_max = eachLine.age_max
        else:
            toBeSelected=False
            
        if toBeSelected:
            oneFeature = Features(bp_systolic_min, bp_systolic_max, bp_diastolic_min, bp_diastolic_max,
            heartbeat_min, heartbeat_max, sleep_min, sleep_max, activity_min, activity_max,
            age_min, age_max)

            oneFeature.print_features()
            featureList.append(oneFeature)
            
    else:
        if(len(featureList)>0):
            return featureList[0]
        else:
            return None
示例#2
0
def preprocess(inputs):
    
    print '-------Sleep--------'
    sleepList=getSleepList(inputs)
    evaluateSleep(sleepList)
    print '-------Activities--------'
    activitiesList=getActivitiesList(inputs)
    evaluateActivities(activitiesList)
    print '-------Heart Beats--------'
    heartBeatsList=getHeartBeatsList(inputs)
    evaluateHeartBeats(heartBeatsList)
    print '-------Blood Pressure--------'
    bloodPressuresList=getBloodPressuresList(inputs)
    evaluateBloodPressures(bloodPressuresList)
     
    featureList=[] 
      
    for eachLine in tableContent:
        bp_diastolic_min = ''
        bp_diastolic_max = ''
        heartbeat_min = ''
        heartbeat_max = ''
        sleep_min = ''
        sleep_max = ''
        bp_systolic_min = ''
        bp_systolic_max = ''
        activity_min = ''
        activity_max = ''
        age_min = ''
        age_max = ''
         
        toBeSelected=True
        
        if (((eachLine.bp_systolic_min=='')and(eachLine.bp_systolic_max=='')) or checkSystolic(inputs, eachLine)):
            bp_systolic_min = eachLine.bp_systolic_min
            bp_systolic_max = eachLine.bp_systolic_max
        else:
            toBeSelected=False
            
        if (((eachLine.bp_diastolic_min=='')and(eachLine.bp_diastolic_max=='')) or checkDiastolic(inputs, eachLine)):
            bp_diastolic_min = eachLine.bp_diastolic_min
            bp_diastolic_max = eachLine.bp_diastolic_max
        else:
            toBeSelected=False
            
        if (((eachLine.heartbeat_min=='')and(eachLine.heartbeat_max=='')) or checkHeartBeats(inputs, eachLine)):
            heartbeat_min = eachLine.heartbeat_min
            heartbeat_max = eachLine.heartbeat_max
        else:
            toBeSelected=False
            
        if (((eachLine.sleep_min=='')and(eachLine.sleep_max=='')) or checkSleep(inputs, eachLine)):
            sleep_min = eachLine.sleep_min
            sleep_max = eachLine.sleep_max
        else:
            toBeSelected=False
            
        if (((eachLine.activity_min=='')and(eachLine.activity_max=='')) or checkActivity(inputs, eachLine)):
            activity_min = eachLine.activity_min
            activity_max = eachLine.activity_max
        else:
            toBeSelected=False
             
        if (((eachLine.age_min=='')and(eachLine.age_max=='')) or checkAge(inputs, eachLine)):
            age_min = eachLine.age_min
            age_max = eachLine.age_max
        else:
            toBeSelected=False
            
        if toBeSelected:
            oneFeature = Features(bp_systolic_min, bp_systolic_max, bp_diastolic_min, bp_diastolic_max,
            heartbeat_min, heartbeat_max, sleep_min, sleep_max, activity_min, activity_max,
            age_min, age_max)

            oneFeature.print_features()
            featureList.append(oneFeature)
            
    else:
        if(len(featureList)>0):
            return featureList[0]
        else:
            return None