eRegulations is a web-based tool that makes regulations easier to find, read and understand with features such as inline official interpretations, highlighted defined terms, and a revision comparison view.
eRegs is made up of several core components for parsing and serving regulations:
- regulations-parser: Parse eCFR regulations
- regulations-schema: RegML schema definition
- regulations-xml-parser: Parse RegML regulations
- fr-notices: eCFR XML for CFPB regulations
- regulations-xml: RegML for CFPB regulations
- regulations-stub: eRegs JSON for CFPB regulations
The following diagram should give a rough idea of what the relationships between these repositories are in the CFPB eRegs workflow.
This repository contains scripts that boostrap a coherent eRegulations working environment, either locally or in a Vagrant virtual machine.
pip install virtualenv
pip install virtualenvwrapper export WORKON_HOME=~/envs mkdir -p $WORKON_HOME source `which virtualenvwrapper.sh`
Node dependencies (nvm, grunt)
The nvm nvm gives more detail about how to use nvm. For now, you can simply run the following (and add them to your shell's profile or run commands file):
export NVM_DIR="$HOME/.nvm" source $NVM_DIR/nvm.sh
regulations-site requires Node 4, grunt, and browserify, so use
to install and use Node, and then install the later two using npm:
nvm install 4 nvm use 4 npm install -g grunt-cli browserify
Once you have these requirements installed you can run the
This will clone all of the eRegs repositories, make seperate virtualenvs for them, and setup their dependencies.
You also have the option of only bootstrapping specific components of eRegulations. For example:
./regs_bootstrap.sh -b core -b site
This will bootstrap just the API (
core) and the site, without the
parser. This would be useful for serving regulations that have already
been parsed (which then just need to be added to the API).
regs_bootstrap.sh takes the following arguments:
-v, verbose output. The output of all commands will be provided regardless of success or failure
-d, set Django debug flags to true in regulations-core and regulations-site.
-c [URL], API url to configure for regulations-parser and regulations-site
-b [...]component to bootstrap, either
site. This can be provided up to three times.
Bootstrap with Vagrant
To bootstrap eRegs in a Vagrant virtual
machine, you'll need to install Vagrant locally. Everything else should
be taken care of by this repository's
brew install vagrant
The eRegs bootstrapping process will be performed as part of the Vagrant provisioning process. All one needs to do is provision the Vagrant virtual machine.
You can also connect to the virtual machine via SSH.
Before you can use regulations-site to browse any regulations, you'll need to parse some with regulations-parser. To do this you'll need to SSH into the virtual machine and run the parser.
To parse the CFPB's Regulation D, from eCFR, for example, you would do the following:
workon regparser cd /vagrant/regulations-xml-parser ./regml.py ecfr 12 ../fr-notices/annual/CFR-2012-title12-vol8-part1004.xml ./regml.py json 12 1004
This will put eRegs JSON for Regulation D in
regulations-stub/stub. You can
load that JSON into the API using regulation-stub's
cd /vagrant/regulations-stub ./send_to.py -a http://localhost:8000/ -r 1004
For more information on parsing regulations, please see the regulations-xml-parser README
Because all of the components are stored in your Vagrant project directory you can use your favorite IDE or editor to work on them and see your changes running in the virtual machine.