diff --git a/.gitignore b/.gitignore index f52c5638..3bf25761 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,4 @@ data analysis/keys/keytemp.json data analysis/__pycache__/analysis.cpython-37.pyc apps/android/source/app/src/main/res/drawable-v24/uuh.png apps/android/source/app/src/main/java/com/example/titanscouting/tits.java + diff --git a/data analysis/__pycache__/analysis.cpython-37.pyc b/data analysis/__pycache__/analysis.cpython-37.pyc index c771d368..3b48150e 100644 Binary files a/data analysis/__pycache__/analysis.cpython-37.pyc and b/data analysis/__pycache__/analysis.cpython-37.pyc differ diff --git a/data analysis/__pycache__/superscript.cpython-37.pyc b/data analysis/__pycache__/superscript.cpython-37.pyc index 8cb176ff..94d0ef72 100644 Binary files a/data analysis/__pycache__/superscript.cpython-37.pyc and b/data analysis/__pycache__/superscript.cpython-37.pyc differ diff --git a/data analysis/__pycache__/tbarequest.cpython-37.pyc b/data analysis/__pycache__/tbarequest.cpython-37.pyc index d08db16a..74ad6d9b 100644 Binary files a/data analysis/__pycache__/tbarequest.cpython-37.pyc and b/data analysis/__pycache__/tbarequest.cpython-37.pyc differ diff --git a/data analysis/analysis.py b/data analysis/analysis.py index 479f79de..e9fe227c 100644 --- a/data analysis/analysis.py +++ b/data analysis/analysis.py @@ -1104,4 +1104,4 @@ def stdev(data, xbar=None): try: return var.sqrt() except AttributeError: - return math.sqrt(var) \ No newline at end of file + return math.sqrt(var) diff --git a/data analysis/data/scores.csv b/data analysis/data/scores.csv index 7311e18c..0390da65 100644 --- a/data analysis/data/scores.csv +++ b/data analysis/data/scores.csv @@ -1 +1,3 @@ -21, 23, 39, 50, 89, 97, 191, 213, 233, 236, 272, 289, 308, 310, 314, 317, 329, 355, 428, 436 1, 25, 34, 106, 112, 132, 146, 167, 184, 223, 256, 267, 304, 337, 339, 370, 411, 460, 485, 494 7, 11, 55, 81, 92, 144, 151, 157, 165, 174, 177, 220, 241, 312, 320, 341, 343, 347, 419, 473 6, 9, 11, 28, 31, 194, 200, 201, 246, 298, 340, 351, 355, 364, 388, 395, 414, 422, 429, 442 33, 73, 102, 103, 137, 183, 200, 212, 218, 242, 249, 264, 294, 302, 310, 378, 400, 408, 457, 473 \ No newline at end of file +29,63,35,37,26,51,35,58,30,61,45 +26,62,45,37,42,29,59,44,40 +35,63,62,18,56,65,42,77,82,63,76,50,47,69,57,65,85,70,38,67,89,74,71,67,70,71,95,77,45 diff --git a/data analysis/data/teams.csv b/data analysis/data/teams.csv index a49e3650..b2f8e892 100644 --- a/data analysis/data/teams.csv +++ b/data analysis/data/teams.csv @@ -1 +1 @@ -2022 2011 1101 821374 5 \ No newline at end of file +2022 2451 16 \ No newline at end of file diff --git a/data analysis/superscript.py b/data analysis/superscript.py index 5c0af40a..6952a61b 100644 --- a/data analysis/superscript.py +++ b/data analysis/superscript.py @@ -3,9 +3,12 @@ #Notes: #setup: -__version__ = "1.0.5.003" +__version__ = "1.0.6.000" __changelog__ = """changelog: +1.0.6.000: + - added pulldata function + - service now pulls in, computes data, and outputs data as planned 1.0.5.003: - hotfix: actually pushes data correctly now 1.0.5.002: @@ -51,7 +54,8 @@ import warnings import glob import numpy as np import time -import tbarequest as tbS +import tbarequest as tba +import csv def titanservice(): @@ -197,9 +201,24 @@ def titanservice(): #db.collection(u'stats').document(u'stats-noNN').set(score_out) def pulldata(): - #TODO - pass + teams = analysis.load_csv('data/teams.csv') + scores = [] + for i in range(len(teams)): + team_scores = [] + request_data_object = tba.req_team_matches(teams[i][0], 2019, "UDvKmPjPRfwwUdDX1JxbmkyecYBJhCtXeyVk9vmO2i7K0Zn4wqQPMfzuEINXJ7e5") + json_data = request_data_object.json() + json_data = sorted(json_data, key=lambda k: k.get('actual_time', 0), reverse=False) + for j in range(len(json_data)): + if "frc" + teams[i][0] in json_data[j].get('alliances').get('blue').get('team_keys'): + team_scores.append(json_data[j].get('alliances').get('blue').get('score')) + elif "frc" + teams[i][0] in json_data[j].get('alliances').get('red').get('team_keys'): + team_scores.append(json_data[j].get('alliances').get('red').get('score')) + scores.append(team_scores) + with open("data/scores.csv", "w+", newline = '') as file: + writer = csv.writer(file, delimiter = ',') + writer.writerows(scores) + def service(): while True: