python - Modelling Data with Google App Engine Datastore -
i building web application on google app engine in python harvest horse racing data of form. basic data structure course has many meetings has many races has many horses has 1 jockey , had 1 trainer. far have got following models (reduced number of fields sake of brevity).
class course(db.model): course_number = db.integerproperty() # course id (third party) course_description = db.stringproperty() # course name class meeting(db.model): course = db.referenceproperty(course) # reference course meeting_number = db.integerproperty() # lifetime meeting number course meeting_date = db.dateproperty() # meeting date class race(db.model): meeting = db.referenceproperty(meeting) # reference meeting race_number = db.integerproperty() # eg 1 1st race of meeting race_name = db.stringproperty() # race name time_of_race = db.timeproperty() # race time
i having trouble working out how store data on horses, trainers, jockeys in data store.
my application harvesting data last 2 years, saving relevant result information horse, trainer, jockey. information on particular horses result same trainer , jockey @ time point. on time horse can have different trainer , different jockey.
my main brain ache coming when realise in analysis may need @ result last 10 races either horse, jockey, trainer. results may not stored either because results occured outside of uk racing (data still available) or happened before date start complete race storage.
can shed light on how optimise storage of horse, jockey, trainer results can accomodate this?
source of data: http://form.horseracing.betfair.com/timeform required data can accessed via json requests.
you on right track using horseresult, trainerresult, , jockeyresult models. not forget, datastore not have grouping or aggregate functions, might want pre-compute aggregates or statistics of interest when loading data.
perhaps want have statistics type models tracking horse, jockey, , trainer performance on time , combinations of each. horsemonth, might track how many races horse involved in , how placed month.
i consider keeping details on how combinations of horse , jockey, or horse , trainer did on time. unfortunately not know enough horse racing give specific suggestions combinations meaningful.
since sounds tool largely own use, might mapper api. might of great value when exploring data.
if race not included in data, aside expanding harvest range, there may not lot can do. want return results have, , perhaps indicating there not enough data in date range?
Comments
Post a Comment