To get a sense of your coding style and ability, without the pressure of coding on a whiteboard during an interview, we have a take-home coding assignment for you. We'd like to see what you can get done in around 2 or 3 hours on the following project.
-
Create a single page where the user can input their state, county, and income.
-
When the user submits the form, produce a visualization of the user's income compared to the income brackets of all others within the county.
-
The client html file can be found here:
client/index.html
and the script here:client/scripts/index.js
. -
The page must work on the latest Chrome (you don't need to worry about older browsers)
-
JQuery and Lodash libraries are included for your convenience in
client/scripts/index.js
. Using a visualization or graphing library isn't required for this task, but feel free to use one if you feel like it is necessary. Make sure that new libraries are referenced in thepackage.json
and play nice with browserify. -
This can be done in raw Javascript, jQuery, or any JS-based framework that you are most comfortable with (React, Angular, etc).
Sample mockup form:
+------------------+
State: | ▽ |
+------------------+
+------------------+
County: | ▽ |
+------------------+
+------------------+
Income: | |
+------------------+
+--------+
| OK |
+--------+
Results:
+---------------------------------------------+
| |
| |
| |
| |
| |
| |
| [Visualization goes here] |
| |
| |
| |
| |
| |
| |
| |
+---------------------------------------------+
-
Download/Install nodejs 6.9.2 or newer: https://nodejs.org/en/download/
-
Download/clone this repo (https://github.com/pepperdata/censustestapp) and complete your work on your local copy.
-
Run
npm install
oryarn install
-
Request an API key from http://api.census.gov/data/key_signup.html. (Be sure to activate your key by clicking on the link in the email).
-
Find this line in server/index.js (not to be confused with client/scripts/index.js):
const APIkey = require('./apikey_local');
and replace the second part with your API key
const APIkey = 'myapikey12345';
-
Run
npm start
on linux/OSx run node_modules/grunt-cli/bin/grunt build && node server/index.js -
Navigate to
http://localhost:3000
in your browser.
This repo comes with an existing Node back end that pulls data from the US Census American Community Survey API and serves it in a more user-friendly format. See below for more details.
http://localhost:3000/counties?state=[STATE_CODE]
example:
http://localhost:3000/counties?state=06
will get a list of counties in California, returned in JSON format.
The first element of the list is a description of the fields - each county is represented as a 3 element array where the first element is the county name, the second is the state code, and the last is the county code.
NOTE: State codes are provided in client/data/state-codes.js
.
http://localhost:3000/incomes?state=[STATE_CODE]&county=[COUNTY_CODE]
example:
http://localhost:3000/incomes?state=06&county=001
will get income data from Alameda County, California.
Each bracket looks something like this:
{
"code": "DP03_0052E",
"min": 0,
"max": 9999,
"households": 24702
},
Min is the minimum income for that bracket, max is the maximum, and households is the total number of households whose income falls between those.
- incomeDataAll includes all types of households
- incomeDataFamilies only includes family households
- incomeDataNonFamilies only includes non-family households
The returned JSON object also contains median incomes (a single value) for all 3 groups.
To submit your assignment, mail us your diff: git diff HEAD
, zip up your project: npm run-script compress
, and mail us the zipped result: public/census-app.zip
. Feel free to include any comments you wish like what's working/what's not working, what you would do if you had more time, or any issues you ran into on this assignment.