Пример #1
0
def recentProbeDataScores():
    profiles = Profile.objects.all()
    for profile in profiles:
        startTime = socialhealth_tasks.getStartTime(6, True)
        currentTime = time.time()
        timeRanges = [
            (start, start + 3600)
            for start in range(int(startTime), int(currentTime), 3600)
        ]

        probeAnswerKeys = {
            'recentActivityProbeByHour': 'ActivityProbe',
            'recentSmsProbeByHour': 'SmsProbe',
            'recentCallLogProbeByHour': 'CallLogProbe',
            'recentBluetoothProbeByHour': 'BluetoothProbe',
            'recentWifiProbeByHour': 'WifiProbe',
            'recentSimpleLocationProbeByHour': 'LocationProbe',
            'recentRunningApplicationsProbeByHour': 'RunningApplicationsProbe',
            'recentHardwareInfoProbeByHour': 'HardwareInfoProbe',
            'recentAppUsageProbeByHour': 'AppUsageProbe'
        }

        #        print profile
        token = socialhealth_tasks.getToken(profile, "app-uuid")
        internalDataStore = socialhealth_tasks.getInternalDataStore(
            profile, "Living Lab", "Social Health Tracker", token)

        for probeAnswerKey, probe in probeAnswerKeys.iteritems():
            #            print probe
            probeLevels = aggregateForUser(probe, internalDataStore,
                                           probeAnswerKey, timeRanges,
                                           probeForTimeRange, False)
def recentProbeDataScores():
    #    profile = Profile.objects.get(uuid = uuid)
    profiles = Profile.objects.all()
    for profile in profiles:
        startTime = socialhealth_tasks.getStartTime(6, True)
        currentTime = time.time()
        timeRanges = [(start, start + 3600) for start in range(int(startTime), int(currentTime), 3600)]

        probeAnswerKeys = {
            "recentActivityProbeByHour": "ActivityProbe",
            "recentSmsProbeByHour": "SmsProbe",
            "recentCallLogProbeByHour": "CallLogProbe",
            "recentBluetoothProbeByHour": "BluetoothProbe",
            "recentWifiProbeByHour": "WifiProbe",
            "recentSimpleLocationProbeByHour": "LocationProbe",
            "recentRunningApplicationsProbeByHour": "RunningApplicationsProbe",
            "recentHardwareInfoProbeByHour": "HardwareInfoProbe",
            "recentAppUsageProbeByHour": "AppUsageProbe",
        }

        print profile
        token = socialhealth_tasks.getToken(profile, "app-uuid")
        internalDataStore = socialhealth_tasks.getInternalDataStore(
            profile, "Living Lab", "Social Health Tracker", token
        )

        for probeAnswerKey, probe in probeAnswerKeys.iteritems():
            print probe
            probeLevels = aggregateForUser(
                probe, internalDataStore, probeAnswerKey, timeRanges, probeForTimeRange, False
            )
            print probeLevels
def recentProbeDataScores():
    profiles = Profile.objects.all()
    for profile in profiles:
        startTime = socialhealth_tasks.getStartTime(6, True)
        currentTime = time.time()
        timeRanges = [
            (start, start + 3600)
            for start in range(int(startTime), int(currentTime), 3600)
        ]

        probeAnswerKeys = {
            'recentActivityProbeByHour': 'ActivityProbe',
            'recentSmsProbeByHour': 'SmsProbe',
            'recentCallLogProbeByHour': 'CallLogProbe',
            'recentBluetoothProbeByHour': 'BluetoothProbe',
            'recentWifiProbeByHour': 'WifiProbe',
            'recentSimpleLocationProbeByHour': 'LocationProbe',
            'recentRunningApplicationsProbeByHour': 'RunningApplicationsProbe',
            'recentHardwareInfoProbeByHour': 'HardwareInfoProbe',
            'recentAppUsageProbeByHour': 'AppUsageProbe'
        }

        internalDataStore = getInternalDataStore(profile, "Living Lab",
                                                 "MIT-FIT", "")

        #for testing, currently use the following user
        #if profile.uuid == "341cc5cd-0f42-45f1-9f66-273ac3ed8b2e":
        for probeAnswerKey, probe in probeAnswerKeys.iteritems():
            probeLevels = aggregateForUser(probe, internalDataStore,
                                           probeAnswerKey, timeRanges,
                                           probeForTimeRange, False)
def recentProbeDataScores():
    profiles = Profile.objects.all()
    for profile in profiles:
        startTime = socialhealth_tasks.getStartTime(6, True)
        currentTime = time.time()
        timeRanges = [(start, start + 3600) for start in range(int(startTime), int(currentTime), 3600)]

        probeAnswerKeys = {'recentActivityProbeByHour': 'ActivityProbe', 'recentSmsProbeByHour': 'SmsProbe', 'recentCallLogProbeByHour': 'CallLogProbe', 
                       'recentBluetoothProbeByHour': 'BluetoothProbe', 'recentWifiProbeByHour': 'WifiProbe', 'recentSimpleLocationProbeByHour': 'LocationProbe', 
                       'recentRunningApplicationsProbeByHour': 'RunningApplicationsProbe', 'recentHardwareInfoProbeByHour': 'HardwareInfoProbe', 
                       'recentAppUsageProbeByHour': 'AppUsageProbe'}

        internalDataStore = getInternalDataStore(profile, "Living Lab", "MIT-FIT", "")

	#for testing, currently use the following user
	#if profile.uuid == "341cc5cd-0f42-45f1-9f66-273ac3ed8b2e":
	for probeAnswerKey, probe in probeAnswerKeys.iteritems():
	    probeLevels = aggregateForUser(probe, internalDataStore, probeAnswerKey, timeRanges, probeForTimeRange, False)