If you're a developer who wants to work on the broker prototype, you're in the right place.
These instructions explain how to set up the DATA Act pilot for development. The development environment requires node.js and npm for the front end. For the back end there are two separate process to run the app: vagrant or python virtualenv.
From the command line, clone the project repository from GitHub to your local environment:
$ git clone git@github.com:18F/data-act-pilot.git
Note: if you don't have a GitHub account and want to get a read-only version of the code, use this command instead:
$ git clone git://github.com/18F/data-act-pilot.git
-
Install node.js, which also installs the npm package manager needed to get the website up and running: https://github.com/nodejs/node-v0.x-archive/wiki/Installation
-
Install the front end dependencies:
npm install
-
Run the front end build:
npm run build
There are two separate ways to run the Python-based backend:
- Python virtualenv
- Vagrant
Use Vagrant if your machine doesn't already have a Python environment set up. Also use Vagrant if you're developing on a Windows machine. Otherwise, python virtualenv is the easier option.
-
Make sure that Python 2.7 and Python virtualenv are installed.
-
Create a virtual environment for the site:
virtualenv -p /usr/bin/python2.7 ~/virtualenvs/data-act`
-
Activate the virtualenv you just created:
source ~/virtualenvs/data-act/bin/activate
-
Change to the folder that contains the web application:
cd app/
-
Install the backend dependencies:
pip install -r requirements.txt
-
Run the web app:
python app.py
-
Visit
http://127.0.0.1:5000
in your web browser to see the live application.
Note: The username and password are both blank with this setup
-
Install VirtualBox (https://www.virtualbox.org/wiki/Downloads) and Vagrant (https://www.vagrantup.com/).
-
Run the command to bring Vagrant up. This can take a significant amount of time the first time you run it but should be faster on subsequent runs.
$ vagrant up
-
Once the Vagrant box is up and running, ssh into it and start the web application:
$ vagrant ssh
[you should now be on the Vagrant box]
$ cd /vagrant/app
$ python app.py -
Visit
http://127.0.0.1:5050
in your web browser to see the live application. -
Once you're finished developing, you can bring down the Vagrant box by typing
vagrant halt
on the command line and bring it up again by typingvagrant up
.
Note: The username and password are both blank with this setup
This project is a prototype, so we don't expect the code to run in a production environment. That said, there may be a need to update things like data element names and validation rules as the pilot progresses. These directions are for developers who want to do that.
If you need to add a data element to one of the four csv templates or update one of the current data element names:
- Make your change to the templates .csv files that are stored in the project's schema folder.
- If you add a row and or change the elementMappingName in a current row, you'll have to make some changes to the website's validation process. Keep reading!
- For each .csv template you update, make sure to also update its corresponding rules.csv file. These files drive the validation process.
- Find the
*._rules.csv
files here. - Make sure values of the fieldname column in the
*_rules.csv
files match the values in the elementMappingName columns of the .csv templates (see previous step). - Update the VALIDATION dictionary in app.py to make sure the field names there match any changes you make to the .csv templates.
- Find the
Validations in this prototype are driven by rules expressed in .csv files.
To update the basic validations (required fields, data types, field length, and uniqueness/cardinality), update the corresponding file in the rules folder.