Skip to content

isabella232/regulations-stub

 
 

Repository files navigation

regulations-stub

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 three core components:

This repository contains JSON that corresponds to CFPB regulations that have been parsed by regulations-parser and which can be loaded into regulations-core with the scripts included in this responsitory. This allows a working eRegulations setup to be created without needing to run the parser.

To get the rest of the eRegulations stack up and working, please see the regulations-bootstrap repository.

Requirements

Requirements for the send_to.py script can be satisfied with pip:

$ pip install -r requirements.txt

Usage

This repository includes a send_to.py script which can send the JSON in the stub folder to either a running instance of regulations-core or to an Amazon S3 bucket. It can send either all of the JSON for a particular regulation or a single JSON file.

send_to.py requires one of the following options that specify where the JSON should be sent:

It requires one of the following options that specify what JSON should be sent:

  • -r, --regulation: The specific regulation part number to upload (eg. 1026).
  • -f, --files: Specific JSON files to upload.

If you want to send JSON that does not live in the same directory as the send_to.py script you can specify that:

  • -s, --stub-base: The base filesystem path for the JSON to be sent (default: ./stub).

Sending a regulation to regulations-core

To send a particular regulation to a running regulations-core instance, you can use the send_to.py from the root of regulations-stub like so:

./send_to.py -a http://localhost:7000 -r 1005

This will look in the stub/ subfolder of regulations-stub for all JSON files related to the regulation with part number 1005 (CFPB Regulation E) and upload them to regulations-core running at http://localhost:7000.

Sending a regulation to S3

To send a particular regulation to an Amazon S3 bucket you will need to create the S3 bucket and then set the environment variables AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY with the appropriate accesss credentials. Then you can use the send_to.py from the root of regulations-stub like so:

./send_to.py -b a-regulations-bucket -r 1005

This will look in the stub/ subfolder of regulations-stub for all JSON files related to the regulation with part number 1005 (CFPB Regulation E) and upload them to the S3 bucket named a-regulations-bucket.

Sending specific JSON files

To send a specific JSON file or files, you can use send_to.py like so:

./send_to.py -a http://localhost:7000 -f regulation/1005/2011-31725

This will send the file regulation/1005/2011-31725 in the stub/ subfolder of regulations-stub to the regulations-core API running at http://localhost:7000.

Configuring regulations-parser

To write new JSON files to regulations-stub, you'll need to configure regulations-parser accordingly. This is relatively straight-forward; modify API_BASE and OUTPUT_DIR in regulations-parser's local_settings.py file like so:

API_BASE=""
OUTPUT_DIR="../regulations-stub/stub"

With the path to regulations-stub in OUTPUT_DIR reflecting its actual location on the filesystem. API_BASE can also be commented-out entirely by placing a # in front of it.

Open source licensing info

  1. TERMS
  2. LICENSE
  3. CFPB Source Code Policy

About

(DEPRECATED) Output from CFPB's regulations-parser

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 96.9%
  • Shell 3.1%