The State Decoded is a free, open source, web-based application to display laws online. Although it's meant for laws, it'll basically work for any structured legal text. It makes legal text searchable, interconnected, and machine-readable, adding an API, bulk downloads, and powerful semantic analysis tools. With The State Decoded, legal codes become vastly easier to read, more useful, and more open. Here's an actual before-and-after from the Code of Virginia:
Sure! This project can be seen in action on the site for Virginia. If you want to install it, you can download and run it in Docker.
Start:
cp .env.example .env # first time only; defaults work out of the box
./deploy/docker-run.shThis builds the PHP 8 / Apache image, starts a MySQL 8 database, and serves the site at http://localhost:8080/. The admin panel is at http://localhost:8080/admin/ (username admin, password admin — both configurable in .env).
The site will be empty until you import a legal code. See the import documentation for instructions, then use the admin panel or run docker compose -f deploy/docker-compose.yml exec app php statedecoded parse to kick off the parser.
Stop:
./deploy/docker-stop.sh # stops containers; database is preserved
docker compose -f deploy/docker-compose.yml down -v # stops containers and wipes the databaseRun tests:
./docker-test.shOptional: Memcached
docker compose -f deploy/docker-compose.yml --profile cache up -d
# Add CACHE_HOST=memcached and CACHE_PORT=11211 to .env and restart the app.The 1.0 release was used in production on a half-dozen different sites, with no serious bugs, and is certainly in good enough shape to be used on websites that aren't official, government-run repositories of the law.
There are two ways.
- Natively, The State Decoded imports XML in The State Decoded XML format. If you have your legal code as XML, you can adapt the provided XSLT to transform it into the proper format. Or if you don't have your legal code as XML, you can convert it into XML.
- Skip XML entirely and modify the included parser to import it in the format in which you have it.
Project documentation can be found at docs.statedecoded.com, which explains how to install the software, configure it, customize it, use the API, and more. The documentation is stored as a GitHub project, with its content automatically published via Jekyll, so in addition to reading the documentation, you are welcome to make improvements to it!
- Use State Decoded sites and share your feedback in the form of filing issues—suggestions for new features, notifications of bugs, etc.
- Write or edit documentation on the wiki.
- Read through unresolved issues and comment on those on which you have something to add, to help resolve them.
- Contribute code to fix bugs or add features.
- Comb through existing code to clean it up—standardizing code formatting, adding docblocks, or editing/adding comments.
Development of The State Decoded was funded by the John S. and James L. Knight Foundation’s News Challenge.
