Documentation ¶
Index ¶
- func CreateTable(projectID, datasetID string, tableID string, metadata *bigquery.TableMetadata) error
- func GetGeoCodeAddress(v *Venue) (string, error)
- func InsertRow(projectID string, datasetID string, s *ScoreBoard) error
- func MasterIdentity(v interface{}) (string, error)
- func Write(b *bytes.Buffer, projectID *string, bucketName string, objectName string, ...) error
- type Address
- type Competitor
- type EntityID
- type Event
- type GameDetail
- type GameID
- type GamePeriod
- type GamePlayersStats
- type GameStatus
- type Item
- type League
- type Link
- type LinkDimensions
- type NBJson
- type Player
- type PlayerAssignment
- type PlayerTeamsCareer
- type Position
- type Record
- type Score
- type ScoreBoard
- type Season
- type Stat
- type Team
- type TeamSeasonRecords
- type TeamSeasonRoster
- type Venue
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateTable ¶
func CreateTable(projectID, datasetID string, tableID string, metadata *bigquery.TableMetadata) error
CreateTable ...
func GetGeoCodeAddress ¶
GetGeoCodeAddress ... gets a geolocplaceID/pluscode for an address
func InsertRow ¶
func InsertRow(projectID string, datasetID string, s *ScoreBoard) error
InsertRow 1 row into named project and dataset. note that BigQuery supports Newline Delimited JSON (ndjson) so we need to determine if we have a singleton or an array
func MasterIdentity ¶
MasterIdentity will provide a basic "soure->target" mapping of different data sets against a set of common table keys... things like events, players, and even locations need to be mastered
Types ¶
type Address ¶
type Address struct { Street string `json:"street,omitempty"` City string `json:"city,omitempty"` State string `json:"state,omitempty"` Country string `json:"country,omitempty"` GeoLoc string `json:"geoloc,omitempty"` }
Address is the street address of the venue
type Competitor ¶
type Competitor struct { EntityID Name string `json:"name,omitempty"` Abbreviation string `json:"abbreviation"` Team *Team `json:"team"` Record Record `json:"record,omitempty"` Score int `json:"score"` LineScore *[]Score `json:"linescore,omitempty"` //"linescore":[{"score":"30"},{"score":"32"},{"score":"23"},{"score":"19"}]}, Location string `json:"location"` Color string `json:"color"` AlternateColor string `json:"alternateColor"` IsActive bool `json:"isActive"` IsAllStar bool `json:"isAllStar"` Links *[]Link `json:"logos"` }
Competitor ...
type EntityID ¶
type EntityID struct { ID string `json:"id"` Extracted *time.Time `json:"extract_time,omitempty"` ExtractedSrc string `json:"extract_src,omitempty"` }
EntityID provides the Monumental Foreign key resolution for key types, like Games, Players, Teams that help to resolve across a variety of source API's and data bases
type Event ¶
type Event struct { EntityID //EntityID.ID in form of "YYYY-MM-DD.AWY.HOM" "2017-02-03.TOR.BOS" where date is EST... GameID GameID `json:"gameId"` League League `json:"league"` Season Season `json:"season"` HomeTeam *Competitor `json:"homeTeam"` VisitTeam *Competitor `json:"visitTeam"` Venue *Venue `json:"location,omitempty"` Status *GameStatus `json:"status,omitempty"` Links *[]Link `json:"link,omitempty"` GameDetail *GameDetail `json:"gameDetail,omitempty"` }
Event ...
type GameDetail ¶
type GameDetail struct { StartTime *time.Time `json:"startTimeUTC,omitempty"` //"startTimeUTC":"2019-10-01T00:00:00.000Z", StartDateEastern string `json:"startDateEastern,omitempty"` //"startDateEastern":"20190930", StartTimeEastern string `json:"startTimeEastern,omitempty"` Period *GamePeriod `json:"period,omitempty"` // "period": {} Attendance int `json:"attendance,omitempty"` //"attendance":"18624", GameDurationMinutes int `json:"gameDuration,omitempty"` }
GameDetail .. extra detail about the game including things like startTime...
type GamePeriod ¶
type GamePeriod struct { Current int `json:"current"` //"current":4, Type int `json:"type"` //"type":0, MaxRegular int `json:"maxRegular"` //"maxRegular":4 IsHalftime bool `json:"isHalftime"` //`"isHalftime":false, IsEndOfPeriod bool `json:"isEndOfPeriod"` //"isEndOfPeriod":false }
GamePeriod provides a structure that holds information about the period/quarter/half... that can be used to show game progession
type GamePlayersStats ¶
type GamePlayersStats struct { PlayerID string `json:"gamePlayerID"` // for a player TeamID string `json:"teamID"` // on a team GameID string `json:"gameID"` // during a game Stats []*Stat `json:"gamePlayerStat"` // here is a slice of pointers to stats the stats }
GamePlayersStats ... may be used in boxScores to do game stats associated with Player on a Team
type GameStatus ¶
type GameStatus struct { Clock float32 `json:"clock"` Period int `json:"period"` State string `json:"description,omitempty"` Detail string `json:"detail,omitempty"` }
GameStatus ...
type Item ¶
type Item struct { Summary string `json:"summary"` Stats []struct { Name string `json:"name"` Value float64 `json:"value"` } `json:"stats"` }
Item is a stats element that includes a summary plus a name/value pair
type Link ¶
type Link struct { HRef string `json:"href"` //"http://www.espn.com/nba/team/_/name/tor/toronto-raptors", Rel []string `json:"rel,omitempty"` // ["clubhouse","desktop","team"], Alt string `json:"alt,omitempty"` // "Clubhouse" Dimension *LinkDimensions `json:"dimensions,omitempty"` IsLogo bool `json:"isLogo"` }
Link ...
type LinkDimensions ¶
LinkDimensions ...
type NBJson ¶
type NBJson interface {
// contains filtered or unexported methods
}
NBJson supports basic operators to create NBSJON
type Player ¶
type Player struct { EntityID EntityID IDESPN string `json:"idESPN,omitempty"` // e.g. "id":"3012", IDNBA string `json:"idNBA,omitempty"` FullName string `json:"fullName,omitempty"` // e.g. "fullName":"Kyle Lowry", DisplayName string `json:"displayName,omitempty"` // e.g. "displayName":"Kyle Lowry", ShortName string `json:"shortName,omitempty"` // e.g."K. Lowry", Links []Link `json:"links"` Jersey string `json:"jersey,omitempty"` // e.g. "jersey":"7", Headshot *Link `json:"headshot"` // e.g. "headshot":"https://a.espncdn.com/i/headshots/nba/players/full/3012.png", Position *Position `json:"position,omitempty"` Team *Team `json:"team" binding:"required"` Active bool `json:"active"` Career *PlayerTeamsCareer `json:"career,omitempty"` }
Player ...
func (*Player) MasterEntity ¶
MasterEntity returns a string that is used as the master identity (UID/key) for table/data structure
type PlayerAssignment ¶
type PlayerAssignment struct { Type string `json:"leagueType"` DateStart time.Time `json:"start"` DateEnd time.Time `json:"end"` Team *EntityID `json:"teamID"` Position Position `json:"position"` Injured bool `json:"wasInjured"` Simultaneous bool `json:"simultaneoud"` // there are times in which multiple teams simultaneously in events like olympics or international demo }
PlayerAssignment is a record in the history of a player inclusive of volunteer, highchool, college, national, olympic, international, club...
type PlayerTeamsCareer ¶
type PlayerTeamsCareer struct {
Program []*PlayerAssignment `json:"program,omitempty"`
}
PlayerTeamsCareer containst the longitudinal record of a player, it cannot be assumed that the list will be ordered so it is highly recommended that the json is sorted on start or end dates to d a start->end->start motion
type Score ¶
type Score struct {
Score float32 `json:"score,omitempty"`
}
Score ... used in linescore to show period score for a team/competitor
type ScoreBoard ¶
type ScoreBoard struct {
Events []Event `json:"events"`
}
ScoreBoard ... holding structure for a set of BoxScores
type Season ¶
type Season struct { SeasonYear int `json:"seasonYear,omitempty"` SeasonStage int `json:"seasonStageId,omitempty"` }
Season ...
type Stat ¶
type Stat struct { Key string `json:"key"` LongKey string `json:"longKey"` Value interface{} `json:"value"` }
Stat .. a well known stat both short/long verions if exists
type Team ¶
type Team struct { EntityID TeamIDNBA string `json:"teamIdNBA,omitempty"` //"teamId":"1610612745" TeamIDESPN string `json:"teamIdESPN,omitempty"` Abbreviation string `json:"abbreviation"` Name string `json:"name"` Location string `json:"teamLocation"` // e.g. "Atlanta" Hawks Logos []*Link `json:"logos,omitempty"` Links []*Link `json:"links,omitempty"` //TODO: how to treat historic record? Records []*TeamSeasonRecords `json:"records,omitempty"` Rosters []*TeamSeasonRoster `json:"rosters,omitempty"` // roster is copied to Competitor for a given game }
Team ...
type TeamSeasonRecords ¶
type TeamSeasonRecords struct { Season *Season `json:"season,omitempty"` Summary string `json:"summary,omitempty"` Stats []*Stat `json:"teamStat,omitempty"` }
TeamSeasonRecords ...
type TeamSeasonRoster ¶
TeamSeasonRoster ...
type Venue ¶
type Venue struct { EntityID LocalID string `json:"id"` FullName string `json:"fullName,omitempty"` Address *Address `json:"address,omitempty"` Capacity int `json:"capacity"` IsIndoor bool `json:"indoor"` }
Venue is the data around the sports venu
func (*Venue) MasterEntity ¶
MasterEntity returns a string that is used as the master identity (UID/key) for table/data structure element in this case Venue it is represented as a GeoCode