predictions

package
v0.0.0-...-aef4854 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 16, 2019 License: MIT Imports: 11 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HtmlFetcher

type HtmlFetcher interface {
	GetHtml(ctx context.Context, url string) (*html.Node, error)
}

type Outcome

type Outcome int64
const (
	Unknown Outcome = iota
	Right
	Wrong
)

type PredictionListPageInfo

type PredictionListPageInfo struct {
	Index    int64
	LastPage int64
}

func ExtractPredictionListPageInfo

func ExtractPredictionListPageInfo(rootNode *html.Node, index int64) (pageInfo *PredictionListPageInfo)

type PredictionResponse

type PredictionResponse struct {
	Prediction int64
	Time       time.Time
	User       string
	Confidence float64
	Comment    string
}

func ExtractPredictionResponse

func ExtractPredictionResponse(responseNode *html.Node, prediction int64) (response *PredictionResponse)

type PredictionSummary

type PredictionSummary struct {
	Id             int64
	Title          string
	Creator        string
	Created        time.Time
	Deadline       time.Time
	MeanConfidence float64
	WagerCount     int64
	Outcome        Outcome
}

func ExtractPredictionSummary

func ExtractPredictionSummary(predictionNode *html.Node) (prediction *PredictionSummary)

func ExtractPredictionSummaryResponsePage

func ExtractPredictionSummaryResponsePage(id int64, responsePageNode *html.Node) (prediction *PredictionSummary)

type Source

type Source struct {
	// contains filtered or unexported fields
}

func NewSource

func NewSource(htmlFetcher HtmlFetcher, baseUrl string) *Source

func (*Source) AllPredictionResponses

func (s *Source) AllPredictionResponses(ctx context.Context, predictions []*PredictionSummary) (summaries []*PredictionSummary, responses []*PredictionResponse, err error)

func (*Source) AllPredictions

func (s *Source) AllPredictions(ctx context.Context) (predictions []*PredictionSummary, err error)

func (*Source) AllPredictionsSince

func (s *Source) AllPredictionsSince(ctx context.Context, t time.Time) (predictions []*PredictionSummary, err error)

func (*Source) Latest

func (s *Source) Latest(ctx context.Context) (*PredictionSummary, error)

func (*Source) PredictionPageCount

func (s *Source) PredictionPageCount(ctx context.Context) (int64, error)

func (*Source) RetrievePredictionListPage

func (s *Source) RetrievePredictionListPage(ctx context.Context, index int64) (predictions []*PredictionSummary, pageInfo *PredictionListPageInfo, err error)

func (*Source) RetrievePredictionResponses

func (s *Source) RetrievePredictionResponses(ctx context.Context, prediction int64) (summary *PredictionSummary, responses []*PredictionResponse, err error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL