![]() |
Re: FRC Event Data in XML Format
Minor changes;
Set the cache time to 1 minute. I really like Dave's idea and will look at implementing that next time I get a chance to really muck with it. I also defaulted the year to 2009, come January I need to remember to default it to 2010. There is also now some text at the landing page telling you the options. This might get a little nicer over time but is by no means a priority. |
Re: FRC Event Data in XML Format
Quote:
|
Re: FRC Event Data in XML Format
http://frcfeed.appspot.com/2009/ct/q...ations/results
Code:
Traceback (most recent call last):Would it be possible to produce JSON instead of XML? It's easier to parse in many situations. [s]Also, how frequently is this data refreshed? Do you generate it live off FIRST's servers, or are you caching it?[/s] I see there's a one minute cache time. Thanks! -Greg |
Re: FRC Event Data in XML Format
Quote:
Here is my gift for you http://frcfeed.appspot.com/2009/detroit/rankings/json The request system has been made a little more robust. It still doesn't report what you are missing but it will dump you to the instruction page. You can request it in xml, json, or human. Human just makes it easier to read for a human, best way is to just try it out and see yourself. It really shouldn't be used for stuff, it is mostly for debugging on my part. If you find any bugs just let me know. Just for reference, the URL is now: frcfeed.appspot.com/{year/}event/{qualification or elimination/}what{/format} |
Re: FRC Event Data in XML Format
Quote:
|
Re: FRC Event Data in XML Format
If their server supports it, you could turn the cache down to one or two minutes and send an If-Modified-Since header, in which case the server will tell you if nothing has changed and not send a response. In addition, for games in years past, why not increase the cache to an hour or even a day? The score probably won't change.
A few notes on syntax, looking at /2009/Greater Toronto/awards: Spaces are not allowed in tag names - it is parsed as an attribute without a value. There is a leading nonbreaking space ( ) in many of the tag values (Home town, name, team). is not a predefined entity, you will need a DTD declaration if you want to define it. Or just replace them with a standard space. It looks like FIRST doesn't use any entity other than , but you will need to be careful if in the future they do, that has to get parsed correctly. The ampersands need to be escaped, too, into "&" . As for URL parsing, are you using a regular expression? Code:
(/(\d{4}))?(/(.+))(/(qualification|elimination))?(/(awards|schedule|rankings|results))(/(json|xml|human))? |
Re: FRC Event Data in XML Format
Quote:
I will get to doing the escaping stuff today, I'll replace the spaces in the tag name with a _ and pull out the characters. I will also take care of ampersand and quotes while I am at it. Thanks for your comments. |
Re: FRC Event Data in XML Format
Further proving I have no life, I have made the changes to the XML document to replace the spaces with underscores.
Just for fun I also added the ability to slice the results. Somewhere after specifying the event you can add a two numbers with a - in between (1-8 for example) as an element in the request and it will only return elements 1-8. This doesn't work on Awards, but that wouldn't make any sense anyway. For example this new feature can be seen at http://frcfeed.appspot.com/dt/rankings/1-8/human/ which will return the top 8 teams in Detroit. Enjoy. Edit: You don't have to specify the beginning OR the end, you can use -8 to represent the top 8 or you could use 30- to return the bottom ten. Anyone who has ever used Python slices should be familiar with this concept. |
Re: FRC Event Data in XML Format
I like the "human" format idea (a lot) for quick data reference. But, since the data is already in an XML format, would it be possible to make the "human" page list the data in a table (with the XML tags as column titles, and such) instead of just the plain-text XML? It's not a crucial addition, but an idea nonetheless.
|
Re: FRC Event Data in XML Format
It also occurs to me that releasing the source code to this project would probably be highly beneficial for the FIRST community.
Any chance of a Google Code project so that people can check the code out themselves and play with it? Hopefully you'll even get improvements contributed back! [edit] Also, any chance of getting "attending teams" on here? [/edit] |
Re: FRC Event Data in XML Format
Quote:
I will take a look at grabbing attending teams. Just throwing the parser at it didn't work but I think I might be able to make it work by tweaking some of the options but I haven't done that yet. Again, I'll let you know. As for making the data tabular, using FIRST's own site is probably a better use for that. |
Re: FRC Event Data in XML Format
The source code is now available via subversion at http://code.google.com/p/frcfeed/ If you are interested in making changes let me know and we can work something out. I apologize that the code is as sloppy looking as it is I am working on cleaning it up and adding more comments.
A word on the eval(...) statements, I felt this would be the easiest way of handling multiple formats or multiple new options. In the next couple days I will try to put a wiki page together on adding new formats and new options. http://code.google.com/p/frcfeed/wiki/HowToUse Link to Wiki on how to use. Expect this to be fleshed out more over the next couple days. If you find parts that are hard to read just let me know and I will try to reword them. |
Re: FRC Event Data in XML Format
There have been some minor updates:
The request can come in any order now, as long as you specify an What and an Event and the When where applicable it will do its best to figure out what you meant. Human format has been tweaked to be tabular. XML option should be a little more standard. I am now using an XML generator instead of just string concatenation. Got rid of all evals in the python code. I also cleaned up the code to use one function in the place of 4. Also, as a small project I decided to put together some a Javascript object for getting data. I forgot how ugly Javascript's object stuff is. I have included it below. Code:
function Event(eventCode,year){Code:
kettering = new Event("Kettering",2009); |
Re: FRC Event Data in XML Format
Due to the fact that I continue to have little to no life I started a complete rewrite of the parser. It currently handles:
I don't have any exact numbers because I haven't figured it out yet but the new parser seems to run significantly faster. Before I wrap it up and release it I am asking for some feedback, What additional pages would you like to see? Formats? Options? |
Re: FRC Event Data in XML Format
Well, I have placed the new version out a day later than I wanted to but it is out. I added Team_List, Team_Info and Team_History as options. Team_List requires an event and an optional year (year currently defaults to the current year) Team_Info and Team_History require a team number.
So, during testing I decided to see what events had errors. The results are below. Code:
mn-rankings: GoodRunning all those requests used 1% of my CPU time and 3% of my bandwidth. The good news? This is without any sort of caching so I will not be adding any caching to this version in the foreseeable future unless I start hitting my limits. |
| All times are GMT -5. The time now is 19:46. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi