Has anyone written any Ruby libraries for working with Cato's Deep Bills Project?
-
I suspect this should be over at Stack Overflow. I suppose if a question needs to mention a specific programming language then it's beyond the scope of Open Data.– SnubianCommented Jul 22, 2013 at 23:05
-
Some of these 'older' enterprise technologies (like ws-security for SOAP) have pretty poor Ruby support, and can be a pain to implement using JRuby. I'm surprised there isn't a better selection of gems to deal with these, but I can see why writing and maintaining gems that comprehensively address these technologies wouldn't be at the top of my todo list.– eebbesenCommented Jul 24, 2013 at 2:47
-
1Snubian, why is Open Data tooling outside of the scope of Open Data? On Stackoverflow, I'm likely to get hypothetical answers of the sort "it's XML so just parse it." Over here, I'm more likely to find people who have actually used Deep Bills.– user94154Commented Jul 25, 2013 at 11:47
3 Answers
Since Deepbills is based on the official XML that Congress publishes, I think it'd be pretty easy to add support for passing through Deepbills' extra tags and attributes to the Ruby gem I made for working with Congress' bills, us-documents:
https://github.com/unitedstates/documents
It's a tool for stripping a lot of tags out of Congress' bill XML, and giving you semantic-less HTML that can be integrated and styled much more easily than the original XML.
Adding support for Deepbills might be as simple as adding new names to the whitelist of tags to preserve.
Disclosure: I'm the consultant currently working on the Deepbills project with Cato.
Short answer: not that we are currently aware of.
Let me ask - in what way do you wish to work with the data? If you mean retrieval of the marked-up documents then that can be done via JSON for individual documents, though that would be horribly painful for large quantities - it's meant as a way to do differentials from the compressed complete download. Both methods are described here.
If you mean actually doing work with the XML and extracting information then you may wish to accomplish this with XSL rather than Ruby. There are some sample scripts that we use against the files to create some documents for use on Wikipedia and you can find them here.
For the most recent set of extracts I have actually been using XSL to create documents that I then process with Perl; while some of these operations are certainly possible with XSL/XQuery, I'm quicker in Perl and I find the result less brittle for ongoing maintenance & some prototyping. So I have done some simple outputs with XSL into a form that lends itself well to regex parsing and then done multi-pass work on that intermediate output.
You may find that a similar approach would work well for you if you wish to stick with Ruby. Simply use the JSON retrieval format to get an individual bill and apply a transform, perhaps with the xslt gem, using some of our XSL as an inspiration.
Yes, I released an initial gem, Catobills, last weekend. It doesn't take advantage of all of the XML markup, but it's a start.