Welcome to the take home portion of your interview! We're excited to jam through some technical stuff with you, but first it'll help to get a sense of how you work through data and coding problems. Work through what you can independently, but do feel free to reach out if you have blocking questions or problems.
-
This requires Postgres (9.4+) & Rails(4.2+), so if you don't already have both installed, please install them.
-
Download the data file from: https://github.com/gospotcheck/ps-code-challenge/blob/master/Street%20Cafes%202020-21.csv
-
Add a varchar column to the table called
category
. -
Create a view with the following columns[provide the view SQL]
- post_code: The Post Code
- total_places: The number of places in that Post Code
- total_chairs: The total number of chairs in that Post Code
- chairs_pct: Out of all the chairs at all the Post Codes, what percentage does this Post Code represent (should sum to 100% in the whole view)
- place_with_max_chairs: The name of the place with the most chairs in that Post Code -max_chairs: The number of chairs at the place_with_max_chairs
Please also include a brief description of how you verified #4
-
Write a Rails script to categorize the cafes and write the result to the category according to the rules:[provide the script]
- If the Post Code is of the LS1 prefix type:
# of chairs less than 10: category = 'ls1 small'
# of chairs greater than or equal to 10, less than 100: category = 'ls1 medium'
# of chairs greater than or equal to 100: category = 'ls1 large'
- If the Post Code is of the LS2 prefix type:
# of chairs below the 50th percentile for ls2: category = 'ls2 small'
# of chairs above the 50th percentile for ls2: category = 'ls2 large'
- For Post Code is something else:
category = 'other'
Please share any tests you wrote for #5
- If the Post Code is of the LS1 prefix type:
-
Write a custom view to aggregate the categories [provide view SQL AND the results of this view]
- category: The category column
- total_places: The number of places in that category
- total_chairs: The total chairs in that category
-
Write a script in rails to:
- For street_cafes categorized as small, write a script that exports their data to a csv and deletes the records
- For street cafes categorized as medium or large, write a script that concatenates the category name to the beginning of the name and writes it back to the name column
Please share any tests you wrote for #7
-
Show your work and check your email for submission instructions.
-
Celebrate, you did great!