Giter Site home page Giter Site logo

racing_data's People

Contributors

justjasongreen avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

racing_data's Issues

Implement Performance Calculations

Add the following calculated properties to the Performance class:

  • Actual Distance (race distance adjusted for barrier less lengths)
  • Actual Weight (weight carried plus average weight of a racehorse)
  • Momentum (actual weight times speed)
  • Profit (starting price for a win else 0, less 1)
  • Speed (actual distance / winning time)
  • Spell (number of days since most recent prior performance)
  • Up (number of performances, including this one, since a spell of 90 days or more)

TypeError in Runner.up

Accessing the Runner.up property when Runner.spell is None (that is, it is the horse's first run) results in a TypeError (unorderable types: NoneType() >= int())

Property Cache Returns Stale Data

Subsequent calls to the Race.runners property from different Race objects seems to repeatedly return the list of runners for the first Race object from which it was accessed.

Create Database Indexes

Create database indexes supporting all queries executed by the Provider, during Provider initialisation.

Enable Flake8 Checks

Re-enable flake8 checks and ensure integration with Travis CI continues to work.

TypeError in Runner.actual_distance

A TypeError (unsupported operand type(s) for ** or pow(): 'NoneType' and 'int') occurs on line 21 of runner.py when attempting to access the Runner.actual_distance property.

Implement Query Locks

Currently, accessing provider methods that make use of the find_or_create and find_or_create_one methods in a multithreading environment can result in duplicated data making its way into the database.

To prevent this, a query locking mechanism needs to be implemented, wrapping the find_or_create and find_or_create_one methods in a contextual lock that prevents one thread from searching for a given entity and failing to find it while another thread is in the process of creating it, but in such a way that the lock doesn't prevent unaffected queries from running in parallel.

Entity Time To Live

Implement the optional ability to specify an 'entity time to live' that will override entity expiration if the entity has already been updated within a specified time period. This should avoid unnecessary rescraping of entities within a given session when working with future data.

The default should be NO entity time to live so that existing update tests continue to pass.

TypeError in Runner.at_distance

A TypeError (unsupported operand type(s) for -: 'NoneType' and 'int') occurs on line 66 of runner.py when attempting to generate the Runner.at_distance performance list property.

Entity Strings

Implement human readable string representations for the various entity types.

Update README

Update README.rst to include a brief overview of performance lists and the calculated properties added to runners and performances.

TypeError in Runner.actual_distance

When attempting to access the actual_distance property for a runner in a race that has no track_circ and/or track_straight value, a TypeError (unorderable types: int() < NoneType()) occurs on line 22 of runner.py.

TypeError in Performance.actual_weight

When attempting to access the Performance.actual_weight property for a performance without a 'carried' value, a TypeError (unsupported operand type(s) for +: 'NoneType' and 'float') occurs on line 25 of performance.py.

Implement Runner Calculations

Add the following calculated properties to the Runner class:

  • Actual Distance (race distance adjusted for barrier and track circ/straight values)
  • Actual Weight (carrying plus average weight of a racehorse)
  • Age
  • Carrying (weight less jockey claiming)
  • Result
  • Spell (days since previous performance)
  • Starting Price
  • Up (number of races, including this one, since a spell of 90 days or more)

Also add the following performance list properties to the Runner class:

  • At Distance (performances within 100m of the current race)
  • At Distance On Track (union of at distance and on track)
  • At Up (performances with the same up number as the current race)
  • Career (ALL performances prior to the current race date)
  • Last 10 (up to the last 10 performances prior to the current race date)
  • Last 12 Months (performances within 12 months prior to the current race date)
  • On Firm (track condition)
  • On Good (track condition)
  • On Heavy (track condition)
  • On Soft (track condition)
  • On Synthetic (track condition)
  • On Track (performances on the same track as the current race)
  • On Turf (non-synthetic track conditions)
  • Since Rest (performances since the last spell of 90 days or more prior to the current race)
  • With Jockey (performances with same jockey as the current race)

Update README

Update the 'Basic Usage' section of the README.rst file with brief instructions about using the provider and the various entity types.

TypeError in Performance.actual_distance

A TypeError (unsupported operand type(s) for *: 'NoneType' and 'float') still occurs in the Performance.actual_distance property.

The NoneType could be representing either 'barrier' or 'lengths' attributes.

ZeroDivisionError in Performance.speed

When attempting to access the Performance.speed property for a performance with a winning time of 0.0, a ZeroDivisionError (float division by zero) occurs on line 87 of performance.py.

Implement Performance Lists

Implement a PerformanceList class that extends the built-in list type and provides the following calculated properties based on the performances in the list:

  • Starts
  • Wins
  • Win Percentage
  • Seconds
  • Second Percentage
  • Thirds
  • Third Percentage
  • Fourths
  • Fourth Percentage
  • Places
  • Place Percentage
  • Earnings
  • Earnings Potential (earnings / total of prize pools)
  • Starting Prices (tuple of minimum, maximum and average starting prices)
  • Return on Investment (total profits / number of starts)
  • Result Potential (1 - total of results / total of starters)
  • Momentums (tuple of minimum, maximum and average momentums)

Alternative Track Names

Analysis of scraped data has revealed that the same track can be identified by different names over time. This causes an issue with the Runner.on_track and Runner.at_distance_on_track performance list properties, as they filter past performances for those that have an identical track as the current meet.

Need to come up with some way to relate alternative track names so relevant performances can still be found in these instances...

Fix Coveralls Integration

For some reason, py.test is not collecting any coverage information on Travis CI (despite the fact it works fine locally!) as of this morning, and thus Coveralls is reporting code coverage of 0%

Implement Association Properties

Add (cached) properties to the various entities that permit easier access to associated entities, such as:

  • meet.races
  • race.meet
  • races.runners
  • runner.race
  • runner.horse
  • runner.jockey
  • runner.trainer
  • horse.performances
  • performance.horse
  • jockey.performances
  • performance.jockey

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.