A command line app, analyze
, which pulls in an Oregon session law in PDF format:
and produces this metadata in JSON:
$ analyze 2016orLaw0001.pdf
{
"summary": "Relating to speed limits on highways that traverse state lines; creating new provisions; amending ORS 811.111; and declaring an emergency.",
"bill": {
"billNumber": 4047,
"billType": "HB"
},
"effectiveDate": "2016-03-01",
"year": 2016,
"affectedSections": {
"repealed": [],
"amended": [
"811.111"
]
}
}
A web app can easily import this and display it:
![Screenshot 2023-10-10 at 8 32 32 PM](https://private-user-images.githubusercontent.com/150670/274124669-29ebe973-53e7-48b9-9f5f-52cef04e8b0f.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTkzNjk0MDQsIm5iZiI6MTcxOTM2OTEwNCwicGF0aCI6Ii8xNTA2NzAvMjc0MTI0NjY5LTI5ZWJlOTczLTUzZTctNDhiOS05ZjVmLTUyY2VmMDRlOGIwZi5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjQwNjI2JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI0MDYyNlQwMjMxNDRaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT00MzlkY2I1NzIzOTQwZmQ2YTg4MDkzNDA1ZDQxMWI1NGY0MWI4ZTExYzQxYWNiNmEyNDRiNWNhMTVkM2M1NDg1JlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCZhY3Rvcl9pZD0wJmtleV9pZD0wJnJlcG9faWQ9MCJ9.I60YADsF0meaQtCqFv7-XrWYWqwTiEuYFCtoqKFvV2M)
Here it is in production. See Main.hs for the top-level code.
In the past, this kind of coding was in the same project as the rest of the application. E.g., here, it'd be a Ruby rake task because the app is in Rails.
But this new, separate repo decouples the data import process: instead of writing more Ruby code for my Rails app, the JSON data is a go-between format. In this way I can, e.g. use with other languages like Haskell when appropriate.