Giter Site home page Giter Site logo

geturf's Introduction

GetUrf

For the Riot Games API Challenge. Fetch URF match data and send to a database.

Data Flow

  1. Get 5 minute timestamps starting from 1427866500 (for NA).
  2. Send timestamps to the endpoint api-challenge-v4.1 to get a list of URF match IDs.
  3. For each match ID, get match data from the endpoint match-v2.2.
  4. Transform result (remove unused fields, etc). 4. Create tables for matches, players, bans.
  5. Save to the database (firebase -> local -> server db).
  6. Figure out queries to send to site + Visualize (https://github.com/hzoo/urf).

Setup

  • io.js: nvm install 1.6.3 && nvm use 1.6.3
  • ES6 with Babel
  • MySQL 5.6 (local or server): apt-get install mysql-server
    • Setup a database and name it what you will put in DB_NAME.
    • Add all the tables from ./data/create-tables.js

Create a json file at ./data/config.json.

{
    "LOL_REGION": "LOL-REGION-HERE", // ex: na
    "LOL_TOKEN": "LOL-API-TOKEN-HERE",
    "DB_HOST": "DB-HOST-HERE", // localhost unless you use a service
    "DB_USER": "DB-USER-HERE",
    "DB_PASSWORD": "DB-PASSWORD-HERE",
    "DB_NAME": "DB-DATABASE-NAME",
    "SSL_CA": "blah.pem",
    "SSL_CERT": "blah.pem",
    "SSL_KEY": "blah.pem"
}

run npm start

Structure

  • npm start runs fetch/index.js
    • This sets up the database and lolapi wrapper
  • fetch/fetch-urf-game-ids.js is run
    • This specificially fetches the URF matchIds by computing each 5 minute time interval (just add 300 to the timestamp) (starting with some initial value) and continuing to send arrays of matchIds to the database.
  • fetch/fetch-urf-match-data.js is run
    • This fetches the match data and removes data not used and modifies it so the data can be put in the different database tables (matches, players (each game), and bans.
  • This was able to continuously run until all the matches were fetched in a region and then I would change the LOL_REGION config.

Misc

  • Running on Heroku (It's fetches different regions by changing the LOL_REGION config var).
  • Database is using Cloud SQL (tested locally).
  • It ended up being a lot easier/faster to just work with things I've used before or have some experience with rather than trying to use something new.

geturf's People

Contributors

hzoo avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.