A webapp for accessing information about the FIRST Robotics Competition.
HTML Python JavaScript CSS PHP Ruby
Latest commit ef0d3d3 Jan 20, 2017 @fangeugene fangeugene committed on GitHub Force cache clearing to default module
Permalink
Failed to load latest commit information.
common show all future events this year in myTBA Jan 9, 2017
consts Advanced search rework (#1735) Jan 7, 2017
context_cache Add ability to compute event week without computing all at once Sep 17, 2016
controllers Run district migration on b2 Jan 18, 2017
database Update cache clearing to get key id Jan 18, 2017
datafeeds Base District Model (#1747) Jan 18, 2017
git_hooks Use paver make in post-checkout git hook May 4, 2016
helpers Force cache clearing to default module Jan 20, 2017
lib Add uncommitted .gitignore Oct 25, 2016
models Base District Model (#1747) Jan 18, 2017
notifications Web notifications, Fixes #1182 (#1667) Oct 26, 2016
react/gameday2 [GD2] Test for video grid (#1746) Jan 13, 2017
renderers Add team social media to history pages. Fixes #1629 Oct 22, 2016
static Use svg for lamp Jan 7, 2017
subtrees New colors Jan 6, 2017
template_engine Event filter, Search for nearby teams and events (#1689) Oct 31, 2016
templates Base District Model (#1747) Jan 18, 2017
templates_jinja2 Advanced search rework (#1735) Jan 7, 2017
test_data Support two champs in 2017. Fixes #1670 (#1673) Oct 25, 2016
tests Fix location helper tests Jan 18, 2017
utils Youtube import scripts Dec 10, 2013
.babelrc [GD2] Design overhaul! (#1716) Dec 19, 2016
.eslintrc.js [GD2] Design overhaul! (#1716) Dec 19, 2016
.gitignore Robust locations for Teams and Events (#1715) Dec 20, 2016
.travis.yml Python package cleanup (#1666) Oct 24, 2016
LICENSE.md add license May 12, 2014
README.md Robust locations for Teams and Events (#1715) Dec 20, 2016
admin_main.py Base District Model (#1747) Jan 18, 2017
api_main.py Make sure page number API requests have at least one chararcter Aug 7, 2016
apiv3_main.py Apiv3 Part2 (#1730) Jan 5, 2017
app-backend-tasks-b2.yaml Use app engine built in pytz Jan 19, 2017
app-backend-tasks.yaml Use app engine built in pytz Jan 19, 2017
app.yaml Use app engine built in pytz Jan 19, 2017
app_shared.yaml Python package cleanup (#1666) Oct 24, 2016
appengine_config.py Python package cleanup (#1666) Oct 24, 2016
backend_main.py Run district migration on b2 Jan 18, 2017
backend_main_b2.py Run district migration on b2 Jan 18, 2017
bulkloader.yaml Fix whitespace in bulkloader.yaml Sep 21, 2013
compile_jinja2_templates.py Precompile jinja2 for production Dec 11, 2015
cron.yaml Start scraping 2017 events Jul 24, 2016
cron_main.py Move build search index to frontend instances Jan 7, 2017
deploy.py Python package cleanup (#1666) Oct 24, 2016
deploy_requirements.txt Use app engine built in pytz Jan 19, 2017
dispatch.yaml Manage Deployments With gcloud Utility (#1588) Aug 5, 2016
do_compress.py Web notifications, Fixes #1182 (#1667) Oct 26, 2016
gulpfile.js [GD2] Design overhaul! (#1716) Dec 19, 2016
index.yaml Keyless Eventwizard (#1693) Oct 31, 2016
linter.py catch error if pep8 is not installed Aug 5, 2013
main.py Advanced search rework (#1735) Jan 7, 2017
mobile_main.py iOS Support in myTBA (#1512) Oct 8, 2016
package.json [GD2] Implements multichat (#1725) Jan 3, 2017
pavement.py Python package cleanup (#1666) Oct 24, 2016
queue.yaml Increase search index task queue rate Dec 20, 2016
requirements.txt Python package cleanup (#1666) Oct 24, 2016
run_tests.py Consolidate Suggestion Review Code and Write Tests (#1719) Dec 21, 2016
tba_config.py 2017 build season landing page (#1734) Jan 7, 2017
test_keys_template.json Robust locations for Teams and Events (#1715) Dec 20, 2016
travis_requirements.txt Require pytz for travis tests Jan 19, 2017

README.md

The Blue Alliance

The Blue Alliance is a FIRST Robotics tool to help teams scout for, compete at, and relive competitions. You can see how the whole site works here, or even write code to make it better!

Help Build The Blue Alliance

Stay in Touch

Add Data

  • Facebook Join our group, #moardata @ The Blue Alliance, to submit video and match data we're missing on the site.
  • Submit missing videos using the "Add Video" links on the site.
  • Submit missing webcasts, team photos, etc using other links on the site.

Contributing Code

  1. Fork this project!
  2. Make a branch to hold your changes.
  3. Make changes!
  4. Send over a pull request from your fork.
  5. We'll review it, and push your changes to the site!

If you're having trouble getting set up, reach out to us at our mailing list and we'll help you through it!

Setup

  1. Learn a bit about Git and GitHub:
  2. Install Python 2.7.X
  3. Install App Engine
    • Specifically use the Python SDK
    • Windows/OS X: Run the installer and allow it make symbolic links (it might ask you to enter your root password)
    • Linux: Unzip the .zip file and add the location of your google_appengine directory to your PATH environment variable.
  4. Get the latest version of The Blue Alliance
    • Fork TBA by clicking on "Fork" in the top right of its GitHub page
    • Run git clone https://github.com/USERNAME/the-blue-alliance.git where USERNAME is your GitHub username, or use GitHub's Windows or OS X app to clone it to your computer
    • For detailed instructions see the GitHub guide on contributing
  5. Install initial required Python packages
    • pip install -r requirements.txt
  6. Install Node.js which includes Node Package Manager
  7. Install UglifyJS2 by running npm install uglify-js -g
  8. Install gulp by running npm rm --global gulp && npm install --global gulp-cli. This removes any version of gulp that was previously installed globally so it doesn't conflict with gulp-cli. Gulp is used as the build tool for Gameday2.
  9. Install all node dependencies by running npm install. This includes less, which is used to build CSS files for production, as well as a number of packages used in Gameday2.
  10. Fill out static/javascript/tba_js/tba_keys_template.js and save it in the same directory as tba_keys.js. It's okay to leave a key blank if you're not doing any development that requires it, but the file tba_keys.js must exist or else JavaScript won't compile.
  11. Fill out test_keys_template.json and save it in the same directory as test_keys.json. These are used for unit testing on your local machine only.
  12. Run paver setup to install remaining dependencies and do an initial build of static files (CSS, HTML templates, javascript) to get you going
  13. Run the app in GoogleAppEngineLauncher according to the directions below, and visit the local URL to see your own copy of The Blue Alliance!

Run a local dev server

  1. Import the project into Google App Engine Launcher
    • NOTE: If you have the Linux version, skip to step 2, as it does not come packaged with the App Engine Launcher. You will be manually adding the ports and modules as options when launching the server.
    • Open App Engine Launcher
    • File > Add Existing Application...
    • Set the Application Path to your the-blue-alliance directory
    • Set port 8088
    • Add modules (dispatch.yaml, app.yaml, app-backend-tasks.yaml, and app-backend-tasks-b2.yaml) as extra flags https://cloud.google.com/appengine/docs/python/modules/#devserver.
  2. Run the app in App Engine Launcher and view its Logs window
    • If you are using the Linux version, you can start the application by moving into your the-blue-alliance directory and running dev_appserver.py --port 8088 dispatch.yaml app.yaml app-backend-tasks.yaml app-backend-tasks-b2.yaml on the command line.
  3. You should now have a basic development installation!
  4. Get some data into the local server
  5. Ignore these warnings in the local dev server:
    • pytz is required to calculate future run times for cron jobs with timezones (The pytz library is in the source tree and works fine.)

Run an App Engine server

See myTBA Configuration for how to create and configure an App Engine server.

Setup notes:

  • You could edit the app.yaml file to change its application: setting from tbatv-dev-hrd to your app's Project ID, but then you'll have to remember to not check in that edit. Better yet, write a script like the following mydeploy.sh file (that filename is in .gitignore):

    #!/bin/sh
    appcfg.py --oauth2 --application=<MY_PROJECT_ID> update app.yaml app-backend-tasks.yaml
    appcfg.py --oauth2 --application=<MY_PROJECT_ID> update_dispatch .
    
  • Note that it needs your application's "Project ID", not its "Project name".

  • The --oauth2 argument of appcfg.py saves repeating the login steps each time. If you skip it or deploy via the App Engine Launcher, you'll have to enter your name and password each time. If you use 2-Step Verification for your Google account (you should!), that means generating an App password each time.
  • The cron.yaml file in master will create cron jobs that use up daily free AE Datastore quotas.
    • To avoid that in a dev server, checkout a no-op version of cron.yaml.
    • If it's already happening in a dev server, deploy a no-op cron.yaml via appcfg.py update_cron, then delete the tasks in the usfirst queue.)
    • If you try to deploy a server while it's over Datastore quota, appcfg will say "there was an error updating your indexes. Please retry later with appcfg.py update_indexes." The fix is to wait until the next day's quota then use appcfg.py update_indexes or appcfg.py update.
  • When you set sitevars, the server automatically internalizes them.
  • You don't need a sitevar for firebase.secrets even though that's the placeholder text for a new sitevar name.
  • Ignore these deployment warnings:
    • Cannot upload both <filename>.py and <filename>.pyc
    • Could not guess mimetype for static/ovp/<filename>.xap. Using application/octet-stream.
    • WARNING old_run.py:88 This function, oauth2client.tools.run(), and the use of the gflags library are deprecated and will be removed in a future version of the library.
  • Ignore these warnings in a deployed server's logs:
    • Exception: Missing sitevar: firebase.secrets. Can't write to Firebase (It just means that no push notifications to GameDay will be sent, which is OK for a dev server.)
  • Make sure static/javascript/tba_js/tba_keys.js exists

Notes:

Paver Commands

Paver is an easy way automate repetitive tasks. For The Blue Alliance, these tasks are stored in pavement.py. To install paver, use one of the methods below:

Paver commands include:

  • paver javascript -- combine and compress JavaScript files
  • paver less -- translate LESS files to CSS and combine with other CSS files
  • paver setup -- build CSS and JavaScript files
  • paver lint
  • paver test_fast -- run tests that don't require HTTP

CSS Icon Sprites

Icons get combined into single files called sprites to reduce the number of HTTP requests needed to render a page. To simplify development, we add icons normally (not to the sprite), and every so often we will combine them all into a sprite and fix all necessary CSS.

Potentially useful: http://spriteme.org/

Testing

Build Status

Testing is implemented using a combination of unittest2 and the Google App Engine testbed framework. Test coverage is a work in progress, and focuses on maintaining datafeed integrity in the face of optimizations and changes to FIRST's data formats.

To run the tests, or just the offline (fast) tests:

  • paver test
  • paver test_fast