Created
March 13, 2014 17:41
-
-
Save stevef/9533180 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.example.api.models | |
import com.example.api.dao._ | |
import java.util.Date | |
import com.mongodb.casbah.Imports._ | |
import com.novus.salat._ | |
import com.novus.salat.global._ | |
import org.joda.time.DateTime | |
import org.json4s.CustomSerializer | |
import org.json4s._ | |
import org.slf4j.{Logger, LoggerFactory} | |
import org.json4s.Extraction.decompose | |
case class MLBPlayByPlay(datetime: Date, gamedate: Date, game_id: Int, home_team_id: Int, away_team_id: Int, | |
home_team_score: Int, away_team_score: Int, sport: String, season_year: Int, season_type: String, location: String, status: String, | |
home_team_abbr: String, away_team_abbr: String, hp_umpire: String, fb_umpire: String, sb_umpire: String, tb_umpire: String, | |
plays: Seq[MLBPlayByPlaySeq] = Seq.empty, updated_at: Date) | |
case class MLBPlayByPlaySeq(batter: Option[MLBBatter] = None, next_batter: Option[MLBBatter] = None, pitchers: Seq[MLBPitcher] = Seq.empty, pitches: Seq[MLBPitches] = Seq.empty, | |
fielders: Seq[MLBFielder] = Seq.empty, seq_id: Int, inning: Option[Int] = None, outs: Option[Int] = None, no_play: Option[Int] = None, | |
home_team_score: Int, away_team_score: Int, narrative: Option[String] = None) | |
case class MLBBatter(batter_id: Int, team_id: Int, first_name: String, last_name: String, action: Option[String] = None, out: Option[Int] = None, adv: Option[Int] = None, | |
to_base: Option[Int] = None, scored: Option[Int] = None, bats: Option[String] = None, appear: Option[Int] = None, pos: Option[String] = None, | |
pitcher_id: Option[Int] = None, pthrows: Option[String] = None, error_ids: Option[String] = None, location: Option[String] = None, traj: Option[String] = None, | |
field: Option[String] = None, coords: Option[String] = None, ab: Option[Int] = None, gndout: Option[Int] = None) | |
case class MLBPitcher(pitcher_id: Int, team_id: Int, first_name: String, last_name: String, inning: Option[Int] = None, outs: Int, throws: String, bbats: String, ab: Int, bf: Int) | |
case class MLBFielder(fielder_id: Int, team_id: Int, first_name: String, last_name: String, pos: String, assist: Int, put_out: Int) | |
case class MLBPitches(count: Int, total_pitches: Int, balls: Int, strikes: Int, value: String, batter_id: Int, pitcher_id: Int, runner_1_id: Int, runner_2_id: Int, | |
runner_3_id: Int, final_pitch: String) | |
object MLBPlayByPlay { | |
def findByGameId(gameId: Int = 0) = { | |
val res = MLBPlayByPlayDAO.findByGameId(gameId) | |
res.map(grater[MLBPlayByPlay].asObject(_)).toList.headOption | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment