Horse Racing Forum - PaceAdvantage.Com - Horse Racing Message Board

Go Back   Horse Racing Forum - PaceAdvantage.Com - Horse Racing Message Board > Thoroughbred Horse Racing Discussion > Handicapping Software


Reply
 
Thread Tools Rate Thread
Old 03-15-2005, 02:55 PM   #1
richrosa
Registered User
 
Join Date: Dec 2004
Posts: 661
Web Based Software Authors

Greetings All,

Has anyone out here programmed and developed their own handicapping software using one of the web-based programming languages?

My personal program, which is quire raw but functional, is written in PHP/MySQL and includes a utility to download charts from tsnhorse.com and parse them. One of my biggest challenges has been to parse the race conditions from a chart into a simple race classification. I would like to collaborate on a solution to that problem if anyone has code for that.

If you are doing your own web-based software, lets compare notes. I have some PHP classes for parsing BRIS files that I've indicated that I would be willing to "open source" for the benefit of those who need those files.

Regards,
Richard Rosa
Old Bethpage, NY
(Home of the Nassau(NY) OTB Race Palace)
richrosa is offline   Reply With Quote Reply
Old 03-15-2005, 03:38 PM   #2
sjk
Registered User
 
Join Date: Feb 2003
Posts: 2,105
Don't know a thing about web based programming but I can see where the conditions at tsnhorse are hard to parse. You might want to look at the Equibase charts.
sjk is offline   Reply With Quote Reply
Old 03-15-2005, 03:47 PM   #3
BillW
Comfortably Numb
 
BillW's Avatar
 
Join Date: Sep 2001
Location: Lexington, Ky
Posts: 6,174
Rich,

I struggle with the same problem. Parsing the race conditions text can be a pain as it seems that each track adds their twist to formats and wording. While I have no definitive solution to offer you, I will throw out something that I do for you (and others) to comment on.

I will initially try to get an idea of whether the race is a NWnL, NWnX, open etc. then as a final pass I will look at the field and if all have a single (allowance) win I will classify the race as NW2L (NW2X) regardless of what the race is written for (NW3L?). Likewise, if all horses are bred in the state where the race is being run, I'll classify as statebred regardless of whether it was written that way or not. I'll do the same thing for age (all 3 YO in a 3&Up race -> classified as a 3YO race). I do rely on parsing for NWnY and NWn$ races, although, I guess I could look at using this idea for NWnY type races also.

This is more of a "prototype" technique than one that is well worked out, so I don't have data on its effectiveness (not even sure how I would go about proving it to be "better"?), but it does provide a more objective technique than simply relying on parsing the condx text.


Constructive comments welcome .

Bill
BillW is offline   Reply With Quote Reply
Old 03-15-2005, 04:23 PM   #4
raybo
EXCEL with SUPERFECTAS
 
raybo's Avatar
 
Join Date: Mar 2004
Posts: 10,206
Race Conditions

I ran into the same thing with the race conditions years ago when I first started designing my spreadsheet. I was able to get the correct conditions some of the time using Bris' data, but there were times when that wouldn't work. I have since decided to give up on trying to get the race conditions and just use Bris' RR and CR data to determine what classes the horses have been running against. I realize this isn't a solution to the problem but it gets me in the ballpark, as far as what the competition's class abilities are. That doesn't help regarding the querying of charts inside your database for historical purposes, I realize.

Are the Bris' charts their own? Or do they just get them from another source and simply provide them as is? I admit that I have never investigated where the charts come from and what types of manipulations are done by the venders to the original source files. I suppose, if you went to the source and suggested a change in the way the conditions are presented, maybe they would take note and start providing relevent data regarding the conditions for those of us who input these files into our own programs.
__________________
Ray
Horseracing's like the stock market except you don't have to wait as long to go broke.

Excel Spreadsheet Handicapping Forum

Charter Member: Horseplayers Association of North America
raybo is offline   Reply With Quote Reply
Old 03-15-2005, 04:30 PM   #5
BillW
Comfortably Numb
 
BillW's Avatar
 
Join Date: Sep 2001
Location: Lexington, Ky
Posts: 6,174
raybo,

They are from Equibase. I assume they are acquired in "source form" and formatted for the web by the individual websites (Bris/TSN/Equibase).

BTW, I too use the Bris/TSN RR and CR - it does make determining the class of a race less of a priority.

Bill

Last edited by BillW; 03-15-2005 at 04:31 PM.
BillW is offline   Reply With Quote Reply
Old 03-15-2005, 04:38 PM   #6
headhawg
crusty old guy
 
headhawg's Avatar
 
Join Date: Aug 2003
Location: Snarkytown USA
Posts: 3,919
Quote:
Originally Posted by raybo
Are the Bris' charts their own? Or do they just get them from another source and simply provide them as is?
There is a big similarity between Bris and Equibase charts so I'm guessing that Equibase supplies the data and the Bris programmers format it in a slightly different way. I'm no programmer, but I assume if you had "raw" data and you knew the format of that data, you could easily write a program that could dump to an html (web page) format. I think a lot software provides output in html format, including cj's program and JCapper.
headhawg is offline   Reply With Quote Reply
Old 03-15-2005, 05:45 PM   #7
raybo
EXCEL with SUPERFECTAS
 
raybo's Avatar
 
Join Date: Mar 2004
Posts: 10,206
headhawg: "I'm no programmer, but I assume if you had "raw" data and you knew the format of that data, you could easily write a program that could dump to an html (web page) format."

The problem isn't, "dumping" the data to an html or a program of any kind. That is the easy part. Breaking apart the data to get at the actual conditions, as written by the racing secretary or whoever "writes" the races, is the problem. Sure you can search the text for "Clm, Alw", "NW1, NW2", etc. but to get the complete racing conditions goes much farther than that. For example: to get "NW2" for a race in Excel you could just do:

=if(Find("Non-winners of two races",Z2,1)>0,"NW2",0) (or something similar, I think that's the formula I used to use, there are other ways of getting to it)

This formula looks for the text "Non-winners of two races" within the data in cell "Z2" and starts looking at the first character in the data, "1". If it's there then it will give you the starting position of the text within the data and you can go from there. But,the coding gets very complex after the initial race type like "clm, mdn, msw, alw", etc., because all race conditions aren't as simple as "NW1" or "NW2", like it could read "Non-winners of a race since" (whatever). There are many possibilities.

However, someone probably has taken the time to write the code, so maybe they will speak up and offer to give up the code.
__________________
Ray
Horseracing's like the stock market except you don't have to wait as long to go broke.

Excel Spreadsheet Handicapping Forum

Charter Member: Horseplayers Association of North America
raybo is offline   Reply With Quote Reply
Old 03-15-2005, 06:00 PM   #8
headhawg
crusty old guy
 
headhawg's Avatar
 
Join Date: Aug 2003
Location: Snarkytown USA
Posts: 3,919
raybo,

I probably wasn't being clear. What I meant was that Equibase has to know the race conditions before they put it in html format for browser viewing. At some point it is in a "raw" data state (text, csv, some proprietary binary format, etc.) -- they themselves don't need to parse it from an html page, their own or someone else's. And in that same vein, Bris probably doesn't parse it from Equibase charts to make their own charts -- they probably get the "raw" data file right from Equibase and put it in their own web format, accounting for the differences in the page design, but the similarity in the output (e.g., race chart comments).

HH
headhawg is offline   Reply With Quote Reply
Old 03-15-2005, 06:18 PM   #9
raybo
EXCEL with SUPERFECTAS
 
raybo's Avatar
 
Join Date: Mar 2004
Posts: 10,206
headhawg: I guess we're talking about 2 different things. What appears on the vendors' websites, as a chart that you can read, is not what I use and probably not what richrosa uses either. I assume that, because he is downloading the chart data and using a parsing program to input the data file into his database program, that he is using something similar to Bris' comma delimited data files for programmers. This is "raw" data, whether manipulated by Bris' or not. The race conditions in that raw data are in text form and must be taken apart by the programmer to get at the actual race conditions.
__________________
Ray
Horseracing's like the stock market except you don't have to wait as long to go broke.

Excel Spreadsheet Handicapping Forum

Charter Member: Horseplayers Association of North America
raybo is offline   Reply With Quote Reply
Old 03-15-2005, 08:32 PM   #10
Jeff P
Registered User
 
Jeff P's Avatar
 
Join Date: Dec 2001
Location: JCapper Platinum: Kind of like Deep Blue... but for horses.
Posts: 5,290
Quote:
One of my biggest challenges has been to parse the race conditions from a chart into a simple race classification. I would like to collaborate on a solution to that problem if anyone has code for that.
Richard,

Some time ago, I started work on a pet project: a web enabled Visual Basic html parser (Bris Charts) for my own use. One of the things it does is parse the actual race conditions from the html right off the web and run it through a function that converts it to a string similar to what you might see in the Form: fMCLM25000s, CLM12500NW2L, OCLM50000N3L, KYDERBY-G1, etc. and then write this string, along with other info, to a comma delimited text file. I never finished this project- other projects always seem to pop up whenever it looks like I might get some free time to devote to it.

Right now my plate is kind of full. There are still new things to add to JCapper and I've committed to a number of other custom programming projects.

But, if your timeframe allows development to wait until late April or early May... I'd love to bring this project to completion and I'd certainly be open to collaboration in one form or another.

--jp
__________________
Team JCapper: 2011 PAIHL Regular Season ROI Leader after 15 weeks
www.JCapper.com

Last edited by Jeff P; 03-15-2005 at 08:36 PM.
Jeff P is offline   Reply With Quote Reply
Old 03-15-2005, 09:14 PM   #11
richrosa
Registered User
 
Join Date: Dec 2004
Posts: 661
Thanks all who replied.

Jeff, I'm glad you started the project on parsing conditions. I knew someone had started it.

For the record, here's what I'm trying to do:

From Bris/TSN:

Conditions: 5F Dirt. FOR THREE YEAR OLDS AND UPWARD WHICH HAVE NEVER WON TWO RACES. Three Year Olds, 112 lbs.; Older, 121 lbs. Non-winners of a race since February 15 Allowed 3 lbs. A race since January 15 Allowed 6 lbs. Claiming Price $5,000.

I need to parse this english into something my database understands like: Clm5000n2l

Regardless of what programming language one uses, the logic to parse this would be similar, so I see Jeff and I working together on this to parse this properly. VB and PHP differ a bit on regualr expressions, but I'm familiar with both to collaborate.

I have written my own pace/handicapping program, not because I can do it better, but rather to have more control on the output, and because I'm fortunate to have the programming ability to engineer it. The second phase of the project is to make use of the charts database I have assembled for the last 18 months by parsing the charts at BRIS/TSN into a database format (MySQL) that I have yet to make constructive use of. Today my program uses BRIS files as the data, but certainly I have designs on using my own charts database to reconstruct my own data to supply the program to lower my costs of operations and make more races and spot plays available to me.

I mentioned earlier that if there was interest, I would happily release the BRIS file parser that reads the data into a MySQL database as open source and a contribution to this fine community. For us technical folks, it would be GPL, so I would hope any enhancements were contributed back into the program.
richrosa is offline   Reply With Quote Reply
Old 03-15-2005, 09:19 PM   #12
DJofSD
Screw PC
 
Join Date: Jun 2003
Posts: 15,728
Jeff P and I have "crossed paths" previously since we're working in parallel.

I saw the same thing when developing my Delphi app to parse the BRIS charts. I decided there were more important things to extract from the charts than the exact conditions, so I've moved on. I'll likely go back to filling in that hole eventually.

Good luck.

DJofSD
DJofSD is offline   Reply With Quote Reply
Old 03-15-2005, 10:25 PM   #13
raybo
EXCEL with SUPERFECTAS
 
raybo's Avatar
 
Join Date: Mar 2004
Posts: 10,206
richrosa: "I need to parse this english into something my database understands like: Clm5000n2l"


I just looked at the data structure for the "Exotic Results Datafile" from Bris that I use in conjunction with my handicapping program to run scenarios on sets of races. I never noticed it before but the race conditions are not included in the files. This is surprising to me, although I haven't noticed it earlier because I didn't have a real need for the conditions anyway. I wonder why Bris doesn't supply this info like they do with their DRF, MCP, ALW delimited files. Maybe I'll ask them why they don't include it.

If they included it in delimited file format and if you would invest the time to put in all the possible combinations, you could get the info you are looking for and reduce it to the form you want. If it can be done from the PPs using delimited file data in Excel, I am quite sure you, as a programmer using much more powerful language, can do the job with the charts data.
__________________
Ray
Horseracing's like the stock market except you don't have to wait as long to go broke.

Excel Spreadsheet Handicapping Forum

Charter Member: Horseplayers Association of North America
raybo is offline   Reply With Quote Reply
Old 03-16-2005, 02:49 AM   #14
Brian Flewwelling
Not a Schrub Fan!
 
Join Date: Oct 2002
Location: Cranbrook, BC
Posts: 288
Parsing the Class Abbrev

the following function has been written and adapted many times. it is not ready for production use, but may be the type of thing you are looking for.
Before running this, the Top Claiming Price, or the Purse are requied ,,, see the end of the function.

if this has some interest for your use, i can help you with the details.

Function fnParseOutRaceType(sTemp As String) As String
' Copied from db
' Extract the Race Type (Claim, maiden,,,) from race description
' and return the reduced string to the calling function
' 19991129 2002-09-06
Dim rst As Recordset
Dim sClass As String
Dim sRestrictions As String
Dim iBracketOpen As Long
Dim sClassAbbrev As String
Dim sAbbrev As String
Dim bStateBred As Byte, booIsClm As Boolean

sClass = Trim(Left$(sTemp, InStr(sTemp, "-") - 1))
' Go Lookup ClassAbbrev
Set rst = pubEqDB.OpenRecordset("RaceClassLookup")
rst.Index = "Class"
rst.Seek "=", sClass
If rst.NoMatch Then
Beep
sAbbrev = InputBox("Enter the Class Abbreviation for: " & sClass)
With rst
.AddNew
!RaceClass = sClass
!ClassAbbrev = sAbbrev
.Update
End With
Else
sAbbrev = rst!ClassAbbrev
booIsClm = rst![IsClaiming]
End If
rst.Close
' clear basic Class from sTemp
sTemp = Replace(sTemp, sClass, "")
sTemp = Trim(Replace(sTemp, "-", ""))
' Check for and fetch restrictions - (s), (nw...)
If InStr(sTemp, "State Bred") Then
bStateBred = True
sTemp = Replace(sTemp, "State Bred", Space(1))
End If
'check for State Bred as (S ... )
iBracketOpen = InStr(sTemp, "(")
If iBracketOpen Then
sRestrictions = Mid$(sTemp, iBracketOpen + 1, InStr(sTemp, ")") - iBracketOpen - 1)
sTemp = Replace(sTemp, "(" & sRestrictions & ")", "")
sRestrictions = LCase(Replace(sRestrictions, " ", ""))
If bStateBred Then sRestrictions = sRestrictions & "s"
End If

' combine the bits Requires that Claiming Prices and Purses determined
If booIsClm Then
sClassAbbrev = sAbbrev & pubOneRace.ClaimPriceTop & sRestrictions
Else
sClassAbbrev = sAbbrev & Format(pubOneRace.Purse) & sRestrictions
End If

fnParseOutRaceType = sClassAbbrev

End Function


Brian
__________________
Brian
Brian Flewwelling is offline   Reply With Quote Reply
Old 03-16-2005, 11:33 AM   #15
osophy_junkie
Finish Line Profit
 
Join Date: May 2004
Posts: 143
Quote:
Conditions: 5F Dirt. FOR THREE YEAR OLDS AND UPWARD WHICH HAVE NEVER WON TWO RACES. Three Year Olds, 112 lbs.; Older, 121 lbs. Non-winners of a race since February 15 Allowed 3 lbs. A race since January 15 Allowed 6 lbs. Claiming Price $5,000.

I need to parse this english into something my database understands like: Clm5000n2l
You can break the important pieces into chunks at every "period space". Then your left with distance/surface, age and nw restrictions, weight conditions x 3, class type and price. Class type and price is always last and distance/surface is always first.

From there you can use lookup tables to get abreviations. The only difficult part would be parsing the "non winner since" weight restrictions. Converting the month to a numerical representation would be a good start.

Ed
osophy_junkie is offline   Reply With Quote Reply
Reply





Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

» Advertisement
» Current Polls
Wh deserves to be the favorite? (last 4 figures)
Powered by vBadvanced CMPS v3.2.3

All times are GMT -4. The time now is 07:05 AM.


Powered by vBulletin® Version 3.8.9
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Copyright 1999 - 2023 -- PaceAdvantage.Com -- All Rights Reserved
We are a participant in the Amazon Services LLC Associates Program, an affiliate advertising program
designed to provide a means for us to earn fees by linking to Amazon.com and affiliated sites.