示例#1
0
    def handle(self, *args, **options):
        """Run the data collection and analysis."""
        today = datetime.datetime.today()
        print '****** Processing data analysis at %s.*******\n' % today

        #print analysis.calculate_summary_stats()
        #print analysis.calculate_action_stats()
        #print analysis.calculate_user_stats()

        outfile = open('user_timestamps.csv', 'w')
        analysis.user_timestamps(None, "2012-09-04", "2012-10-01", outfile)
        outfile.close()

        outfile = open('user_point_timestamps.csv', 'w')
        analysis.user_point_timestamps("2012-09-04", "2012-10-01", outfile)
        outfile.close()

        outfile = open('energy_goal_timestamps.csv', 'w')
        analysis.energy_goal_timestamps("2012-09-04", "2012-10-01", outfile)
        outfile.close()

        today = datetime.datetime.today()
        print '****** End processing data analysis at %s.*******\n' % today
示例#2
0
def analysis_view(request, command):
    """analysis"""
    _ = request

    if command == "summary":
        result = analysis.calculate_summary_stats()
    elif command == "actions":
        result = analysis.calculate_action_stats()
    elif command == "users":
        result = analysis.calculate_user_stats()
    elif command == "timestamps":
        team = request.GET.get("team", "")
        date_start = request.GET.get("date_start", "")
        date_end = request.GET.get("date_end", "")
        result = analysis.user_timestamps(team, date_start, date_end)
    else:
        result = "please specify an analysis command."

    return HttpResponse(result, content_type="text", mimetype='text/plain')
示例#3
0
def analysis_view(request, command):
    """analysis"""
    _ = request

    if command == "summary":
        result = analysis.calculate_summary_stats()
    elif command == "actions":
        result = analysis.calculate_action_stats()
    elif command == "users":
        result = analysis.calculate_user_stats()
    elif command == "user_summary":
        users = request.GET.get("user", "")
        result = analysis.calculate_user_summary(users)
    elif command == "timestamps":
        team = request.GET.get("team", "")
        date_start = request.GET.get("date_start", "")
        date_end = request.GET.get("date_end", "")
        result = analysis.user_timestamps(team, date_start, date_end)
    else:
        result = "please specify an analysis command."

    return HttpResponse(result, content_type="text", mimetype='text/plain')