From ef63c1de7e2a148b6b00c4c423b44bbf15e0aedf Mon Sep 17 00:00:00 2001 From: Dev Date: Thu, 24 Mar 2022 16:19:47 -0500 Subject: [PATCH] add ability to load manual JSON for metrics --- competition/data.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/competition/data.py b/competition/data.py index 1eb6447..da8117a 100644 --- a/competition/data.py +++ b/competition/data.py @@ -1,6 +1,7 @@ import requests import pull import pandas as pd +import json def pull_new_tba_matches(apikey, competition, cutoff): api_key= apikey @@ -11,6 +12,12 @@ def pull_new_tba_matches(apikey, competition, cutoff): out.append({"match" : i['match_number'], "blue" : list(map(lambda x: int(x[3:]), i['alliances']['blue']['team_keys'])), "red" : list(map(lambda x: int(x[3:]), i['alliances']['red']['team_keys'])), "winner": i["winning_alliance"]}) return out +def pull_new_tba_matches_manual(apikey, competition, cutoff): + filename = competition+"-wins.json" + with open(filename, 'r') as f: + data = json.load(f) + return data + def get_team_match_data(client, competition, team_num): db = client.data_scouting mdata = db.matchdata