Explore recent developments in consumer credit markets.
Nothing presented in the issues or in this repo is a final product unless it is marked as such or appears on http://www.consumerfinance.gov/data-research/consumer-credit-trends/. Some copy or formulas may be replaced with dummy text to ensure that we follow any and all privacy and security procedures at the CFPB. All the designs, layouts, and evolution of our decision making process are accurate.
We are working under an agile framework, and plan to use this repo to publish, receive feedback, and iterate on that feedback as often as possible. Our goal is to see user trends and reactions to our work. We want as much feedback as possible to help us make informed decisions so that we can make this tool better. Unfortunately, we will not be able to respond to every piece of feedback or comment we receive, but intend to respond with our progress through the evolution of the tool.
This project requires that you have Node.js installed.
To run this website locally:
- Clone repo
- Create an
env.js
file and add your Github personal access token there:
cp src/static/js/env_SAMPLE.js src/static/js/env.js
- In Terminal, run
./setup.sh
from the root directory. This will install the required Node modules for the project. - Run the following command:
gulp watch
This should open a new window in your browser with the /dev/index.html
file visible at http://localhost:3000/
When working on feature branches that are still in development, use the workflow described above in the Installation instructions.
For publishing the graphs to compiled HTML for use in a production environment, use the following Release workflow.
-
Create a pull request for any new code contributions.
-
To share the compiled files with your code changes, follow the Github Pages and Travis setup steps.
-
Once your pull requested is reviewed and merged, Travis CI will deploy the compiled HTML files to Github pages, which can be reviewed at https://cfpb.github.io/consumer-credit-trends/.
-
When the Github pages charts are approved for deployment to production, use Jenkins to trigger the deployment to consumerfinance.gov.
Generate compiled files for sharing your work with reviewers by pushing your PR feature branch code to your forked repo. This requires some configuration in Travis.
.... add steps here to fork and set up github token and all that.
You only need to do these steps once.
-
Fork the consumer-credit-trends repository to your personal Github account.
-
Enable Travis for the forked repository by visiting https://travis-ci.org/yourGithubUsername/consumer-credit-trends/ updating the URL with your Github username. Click 'Activate repository' to allow Travis CI to access your repo.
-
Go to Settings from your repo. This is where you will add your Github Personal Access Token to trigger the build to your fork's
gh-pages
branch. -
Create a Personal Access Token in your Github Settings page.
-
Copy the Personal Access Token and paste it into the value field in Travis CI Settings under 'Environment Variables.'
-
Enter 'GITHUB_TOKEN' in the 'name' field for Travis CI.
-
Do NOT turn on the 'Display value in build log' button. Click Add.
- Push your code from your local feature branch to your fork's master branch (here named
origin
):
git push origin feature-branch:master
-
This will trigger a Travis CI deployment to gh-pages. View your build in Travis at
-
View your changes on your forked gh-pages branch at the following URL, replacing with your username: https://yourUsername.github.io/consumer-credit-trends/
To test the release workflow on your local machine, follow these steps to generate compiled HTML files of the graphs.
gulp release
- Check out and pull from the latest
gh-pages
branch from upstream.
git checkout gh-pages
git pull upstream gh-pages
- Create a new branch and check it out locally:
git checkout -b release-v2000
- Merge your feature branch work into your release branch locally:
git merge feature-branch-2000
- Build the front end using gulp:
gulp build
- In a new Terminal window, run the release task to generate your production-ready HTML:
gulp release
- Review your production HTML locally to check that it's ready to commit (no server required - just open the HTML file at
consumer-credit-trends/index.html
in your browser). - Commit your production ready files,
index.html
and thecharts
folder, to your release branch and push to Github:
git add index.html
git add charts
git commit -m ''
git push origin release-v2000
- Submit your pull request to the
gh-pages
branch for review. - Optional: test your production pages in Github by merging your release branch to your fork of
gh-pages
. You can then post the link to your PR for others to easily review.
git checkout gh-pages
git merge release-v2000
git push origin gh-pages
- Once it's merged, visit https://cfpb.github.io/consumer-credit-trends/ to view the published HTML files.
Documentation about the data is available and contains definitions for each column and field value in the csv files.
Common errors and their causes:
window.setTimeout( getSVG, 10000 );
^
TypeError: Cannot read property 'setTimeout' of undefined
This error happens when you run gulp release
without a local server running. Make sure you have the gulp watch
task running in a separate Terminal window when you run gulp release
. See Release Workflow instructions for more details.
Using gulpfile ~/Sites/consumer-credit-trends/gulpfile.js
Starting 'connect'...
Finished 'connect' after 35 ms
Starting 'clean:releaseFiles'...
Finished 'clean:releaseFiles' after 6.93 ms
Starting 'release:copyFiles'...
events.js:160
throw er; // Unhandled 'error' event
^
Error: listen EADDRINUSE :::8081
You are already running a server with gulp watch
, so the release task fails. Close the terminal process or window running gulp watch
and re-run the gulp release
task.
Use the issue tracker to follow the development conversation. If you find a bug not listed in the issue tracker, please [file a bug report](https://github.com/cfpb/consumer-credit-trends/issues/new?body= %23%23%20URL%0D%0D%0D%23%23%20Actual%20Behavior%0D%0D%0D%23%23%20Expected%20Behavior %0D%0D%0D%23%23%20Steps%20to%20Reproduce%0D%0D%0D%23%23%20Screenshot&labels=bug).
We welcome your feedback and contributions. See the contribution guidelines for more details.
Additionally, you may want to consider contributing to the Chart Builder, which is the chart generator and library used to create the d3 data visualizations in this project.
This project uses:
- Capital Framework for its user interface and layout components.
- CFPB Chart Builder for its data visualizations.