Esempio n. 1
0
#Last Updated: 3/15/18
from CSVExporter import *
from scoutRotator import *
from SPR import ScoutPrecision
import DataModel
import firebaseCommunicator
import traceback
import numpy as np
import Math
from pydub import AudioSegment
from pydub.playback import play

PBC = firebaseCommunicator.PyrebaseCommunicator()
fb = PBC.firebase
comp = DataModel.Competition(PBC)
calc = Math.Calculator(comp)
spr = ScoutPrecision()

while (True):
    comp.updateTeamsAndMatchesFromFirebase()
    comp.updateTIMDsFromFirebase()
    cmd = raw_input('>>> ').split()
    if cmd[0] == 'exp':
        try:
            if cmd[1] == 'timd':
                if cmd[2] == '-all':
                    CSVExportTIMDALL(comp)
                    comp.PBC.sendExport('EXPORT-TIMDALL.csv')
                elif cmd[2] == '-other':
                    print('')
            elif cmd[1] == 'team':
Esempio n. 2
0

url = 'scouting-2018-temp'

config = {
	"apiKey": "AIzaSyBXfDygtDWxzyRaLFO75XeGc2xhfvLLwkU ",
    "authDomain": url + ".firebaseapp.com",
    "databaseURL": "https://" + url + ".firebaseio.com",
    "projectId": url,
    "storageBucket": url + ".appspot.com",
    "messagingSenderId": "333426669167"

}
'''
pbc = firebaseCommunicator.PyrebaseCommunicator()
comp = DataModel.Competition(pbc)
db = pbc.firebase
'''
seed = {}
for team in db.child('Teams').get().val():
	seed[team] = db.child('Teams').child(team).child('calculatedData').child('actualNumRPs').get().val()
print(seed)
seed = sorted(seed.items(), key = operator.itemgetter(1))[::-1]
print(seed)
for item in range(len(seed)):
	db.child('Teams').child(seed[item][0]).child('calculatedData').child('actualSeed').set(item + 1)



dc_team = {
		'scoutName' : ['string', 'string', 'string'], #String
Esempio n. 3
0
#Last Updated: 8/26/17
import DataModel
import firebaseCommunicator
import TBACommunicator
import utils

############# Getting TBA Data ###################
#Set to '<your initials>:TBA_communicator:0'

TBAC = TBACommunicator.TBACommunicator()
FBC = firebaseCommunicator.PyrebaseCommunicator()
competition = DataModel.Competition(FBC)
competition.eventCode = TBAC.code
competition.PBC.JSONteams = TBAC.makeEventTeamsRequest()
competition.PBC.JSONmatches = TBAC.makeEventMatchesRequest()
competition.PBC.wipeDatabase()
competition.PBC.addSlackProfilesToFirebase()
competition.PBC.addSingleKeysToFirebase()
competition.PBC.addTeamsToFirebase()
competition.PBC.addMatchesToFirebase()
competition.updateTeamsAndMatchesFromFirebase()
competition.PBC.addTIMDsToFirebase(
    competition.matches
)  #You need to create the matches and teams before you call this
Esempio n. 4
0
#Last Updated: 8/26/17
import TBACommunicator
import numpy as np
from schemaUtils import SchemaUtils
import DataModel 
import firebaseCommunicator as f
import Math

#Taking data from TBA, setting up the schemaUtils class, and defining variables to use later on
comp = DataModel.Competition(f.PyrebaseCommunicator())
calculator = Math.Calculator(comp)
su = SchemaUtils(comp, calculator) #Add actual parameters before competition
TBA = TBACommunicator.TBACommunicator()
listOfMatches = TBA.makeEventMatchesRequest()
teamsToListPlacement = {}
listOfTeams = TBA.makeEventTeamsRequest()

#Creates the base array to be added to later
matrix = np.zeros((len(listOfTeams), len(listOfTeams)), dtype = np.int)
print(listOfTeams)

#Enumerates each team from the list of teams into teamsToListPlacement
for listPlacement in range(0, (len(listOfTeams) - 1)): teamsToListPlacement[listOfTeams[listPlacement]] = listPlacement

#Iterates through all of the matches and adds to the matrix
for match in listOfMatches:
	for team in su.teamsInMatch(match):
		if getTeamAllianceIsRedInMatch(team, match) == True:
			for allianceTeam in getAllianceInMatch(match, True):
				matrix[teamsToListPlacement.get(team)][teamsToListPlacement.get(allianceTeam)] += 1
		elif getTeamAllianceIsRedInMatch(team, match) == False: