diff --git a/data analysis/data/SandstormCargoShipBalls.csv b/data analysis/data/SandstormCargoShipBalls.csv index 45ad1826..8e024506 100644 --- a/data analysis/data/SandstormCargoShipBalls.csv +++ b/data analysis/data/SandstormCargoShipBalls.csv @@ -1,3 +1,6 @@ -0.0 0.0,1.0 +2.0 +0.0 +0.0 +0.0 0.0 diff --git a/data analysis/data/SandstormCargoShipHatches.csv b/data analysis/data/SandstormCargoShipHatches.csv index eeac11fb..c6e537cb 100644 --- a/data analysis/data/SandstormCargoShipHatches.csv +++ b/data analysis/data/SandstormCargoShipHatches.csv @@ -1,3 +1,6 @@ -1.0 0.0,0.0 +5.0 +1.0 +0.0 +5.0 0.0 diff --git a/data analysis/data/SandstormLowerRocketBalls.csv b/data analysis/data/SandstormLowerRocketBalls.csv index f738a146..49c9e867 100644 --- a/data analysis/data/SandstormLowerRocketBalls.csv +++ b/data analysis/data/SandstormLowerRocketBalls.csv @@ -1,3 +1,6 @@ -0.0 0.0,0.0 +2.0 +0.0 +0.0 +0.0 0.0 diff --git a/data analysis/data/SandstormLowerRocketHatches.csv b/data analysis/data/SandstormLowerRocketHatches.csv index eeac11fb..06f291ee 100644 --- a/data analysis/data/SandstormLowerRocketHatches.csv +++ b/data analysis/data/SandstormLowerRocketHatches.csv @@ -1,3 +1,6 @@ -1.0 0.0,0.0 +1.0 +1.0 +0.0 +2.0 0.0 diff --git a/data analysis/data/SandstormUpperRocketBalls.csv b/data analysis/data/SandstormUpperRocketBalls.csv index f738a146..49c9e867 100644 --- a/data analysis/data/SandstormUpperRocketBalls.csv +++ b/data analysis/data/SandstormUpperRocketBalls.csv @@ -1,3 +1,6 @@ -0.0 0.0,0.0 +2.0 +0.0 +0.0 +0.0 0.0 diff --git a/data analysis/data/SandstormUpperRocketHatches.csv b/data analysis/data/SandstormUpperRocketHatches.csv index f738a146..9d772be8 100644 --- a/data analysis/data/SandstormUpperRocketHatches.csv +++ b/data analysis/data/SandstormUpperRocketHatches.csv @@ -1,3 +1,6 @@ -0.0 0.0,0.0 +3.0 +0.0 +0.0 +3.0 0.0 diff --git a/data analysis/data/TeleopCargoShipBalls.csv b/data analysis/data/TeleopCargoShipBalls.csv index c9c11728..4db3e0b4 100644 --- a/data analysis/data/TeleopCargoShipBalls.csv +++ b/data analysis/data/TeleopCargoShipBalls.csv @@ -1,3 +1,6 @@ -0.0 0.0,5.0 0.0 +0.0 +0.0 +4.0 +0.0 diff --git a/data analysis/data/TeleopCargoShipHatches.csv b/data analysis/data/TeleopCargoShipHatches.csv index 1d8e9288..f9f26589 100644 --- a/data analysis/data/TeleopCargoShipHatches.csv +++ b/data analysis/data/TeleopCargoShipHatches.csv @@ -1,3 +1,6 @@ -0.0 0.0,1.0 +0.0 +0.0 +1.0 +0.0 1.0 diff --git a/data analysis/data/TeleopLowerRocketBalls.csv b/data analysis/data/TeleopLowerRocketBalls.csv index 119e509d..d0724031 100644 --- a/data analysis/data/TeleopLowerRocketBalls.csv +++ b/data analysis/data/TeleopLowerRocketBalls.csv @@ -1,3 +1,6 @@ -0.0 0.0,4.0 0.0 +0.0 +0.0 +0.0 +0.0 diff --git a/data analysis/data/TeleopLowerRocketHatches.csv b/data analysis/data/TeleopLowerRocketHatches.csv index f738a146..1192ed32 100644 --- a/data analysis/data/TeleopLowerRocketHatches.csv +++ b/data analysis/data/TeleopLowerRocketHatches.csv @@ -1,3 +1,6 @@ -0.0 0.0,0.0 0.0 +0.0 +0.0 +2.0 +1.0 diff --git a/data analysis/data/TeleopUpperRocketBalls.csv b/data analysis/data/TeleopUpperRocketBalls.csv index f738a146..f8e9b678 100644 --- a/data analysis/data/TeleopUpperRocketBalls.csv +++ b/data analysis/data/TeleopUpperRocketBalls.csv @@ -1,3 +1,6 @@ -0.0 0.0,0.0 0.0 +0.0 +0.0 +0.0 +0.0 diff --git a/data analysis/data/TeleopUpperRocketHatches.csv b/data analysis/data/TeleopUpperRocketHatches.csv index eb0a027a..db584999 100644 --- a/data analysis/data/TeleopUpperRocketHatches.csv +++ b/data analysis/data/TeleopUpperRocketHatches.csv @@ -1,3 +1,6 @@ -13.0 0.0,0.0 0.0 +13.0 +0.0 +1.0 +0.0 diff --git a/data analysis/data/cargoBalls.csv b/data analysis/data/cargoBalls.csv index 91ae8f89..933eab9b 100644 --- a/data analysis/data/cargoBalls.csv +++ b/data analysis/data/cargoBalls.csv @@ -1,3 +1,6 @@ -10.0 0.0,7.0 +0.0 +10.0 7.0 +8.0 +0.0 diff --git a/data analysis/data/hatchPanels.csv b/data analysis/data/hatchPanels.csv index 9a0744d6..26e74eda 100644 --- a/data analysis/data/hatchPanels.csv +++ b/data analysis/data/hatchPanels.csv @@ -1,3 +1,6 @@ -1.0 0.0,7.0 0.0 +1.0 +0.0 +1.0 +0.0 diff --git a/data analysis/data/match.csv b/data analysis/data/match.csv index 0c4f3d44..dc0c7092 100644 --- a/data analysis/data/match.csv +++ b/data analysis/data/match.csv @@ -1,3 +1,6 @@ -match-23 match-18,match-3 +match-5 +match-23 match-18 +match-5 +match-1 diff --git a/data analysis/data/notes.csv b/data analysis/data/notes.csv index 026e047b..c509d0ee 100644 --- a/data analysis/data/notes.csv +++ b/data analysis/data/notes.csv @@ -1,3 +1,6 @@ -yeeee ,si papa +"" +yeeee nine +"" +"" diff --git a/data analysis/data/observationType.csv b/data analysis/data/observationType.csv index 8ea07c8b..0e4b7307 100644 --- a/data analysis/data/observationType.csv +++ b/data analysis/data/observationType.csv @@ -1,3 +1,6 @@ -Quantitative Quantitative,Quantitative Quantitative +Quantitative +Quantitative +Quantitative +Quantitative diff --git a/data analysis/data/teamDBRef.csv b/data analysis/data/teamDBRef.csv index 98771ec5..ce7f1233 100644 --- a/data analysis/data/teamDBRef.csv +++ b/data analysis/data/teamDBRef.csv @@ -1,3 +1,6 @@ -team-2022 team-16,team-16 +team-2016 +team-2022 team-2451 +team-3695 +team-5148 diff --git a/data analysis/superscript.py b/data analysis/superscript.py index 4f8f3dcf..c4da6f05 100644 --- a/data analysis/superscript.py +++ b/data analysis/superscript.py @@ -3,9 +3,12 @@ #Notes: #setup: -__version__ = "1.0.6.000" +__version__ = "1.0.6.001" __changelog__ = """changelog: +1.0.6.001: + - fixed multiple bugs + - works now 1.0.6.000: - added pulldata function - service now pulls in, computes data, and outputs data as planned @@ -240,6 +243,14 @@ def pulldata(): out = [] var = {} + temp = [] + + for i in range(len(list_teams)): + + temp.append(list_teams[i][0]) + + list_teams = temp + for i in range(len(full)): for j in range(len(full[i])): for key in list(full[i][j].keys()): @@ -247,6 +258,8 @@ def pulldata(): if "Quantitative" in key: quant_keys.append(key) + + #print(full[i][j].get(key).get('teamDBRef')[5:] in list_teams) if full[i][j].get(key).get('teamDBRef')[5:] in list_teams: @@ -260,7 +273,7 @@ def pulldata(): var[individual_keys[k]] = full[i][j].get(key).get(individual_keys[k]) out.append(var) - + sorted_out = [] for i in out: diff --git a/data analysis/test.py b/data analysis/test.py new file mode 100644 index 00000000..79e7ee46 --- /dev/null +++ b/data analysis/test.py @@ -0,0 +1,97 @@ +import firebase_admin +from firebase_admin import credentials +from firebase_admin import firestore +import csv +import numpy as np + +# Use a service account +cred = credentials.Certificate('keys/keytemp.json') +#add your own key as this is public. email me for details +firebase_admin.initialize_app(cred) + +db = firestore.client() + +teams=db.collection('data').document('team-2022').collection("Central 2019").get() +full=[] +tms=[] +for team in teams: + + tms.append(team.id) + reports=db.collection('data').document('team-2022').collection("Central 2019").document(team.id).collection("matches").get() + + for report in reports: + data=[] + data.append(db.collection('data').document('team-2022').collection("Central 2019").document(team.id).collection("matches").document(report.id).get().to_dict()) + full.append(data) + +quant_keys = [] + +list_teams = ["2022", "16", "2451"] + +out = [] +var = {} + +for i in range(len(full)): + for j in range(len(full[i])): + for key in list(full[i][j].keys()): + + if "Quantitative" in key: + + quant_keys.append(key) + + if full[i][j].get(key).get('teamDBRef')[5:] in list_teams: + + var = {} + measured_vars = [] + + for k in range(len(list(full[i][j].get(key).keys()))): + + individual_keys = list(full[i][j].get(key).keys()) + + var[individual_keys[k]] = full[i][j].get(key).get(individual_keys[k]) + + out.append(var) + +sorted_out = [] + +for i in out: + + j_list = [] + + key_list = [] + + sorted_keys = sorted(i.keys()) + + for j in sorted_keys: + + key_list.append(i[j]) + + j_list.append(j) + + sorted_out.append(key_list) + +var_index = 0 +team_index = 0 + +big_out = [] + +for j in range(len(i)): + big_out.append([]) + for t in range(len(list_teams)): + big_out[j].append([]) + +for i in sorted_out: + + team_index = list_teams.index(sorted_out[sorted_out.index(i)][j_list.index('teamDBRef')][5:]) + + for j in range(len(i)): + + big_out[j][team_index].append(i[j]) + +for i in range(len(big_out)): + + with open('data/' + j_list[i] + '.csv', "w+", newline = '') as file: + + writer = csv.writer(file, delimiter = ',') + writer.writerows(big_out[i]) +