Coding challenge written with Django Framework.
This project assumes you had already installed these tools:
After necessary tools, you need to install the sold house pricing
dataset from here.
Then you need to add header row for this raw data by using command below on terminal:
echo 'transaction_unique_identifier,price,date_of_transfer,postcode,property_type,old_or_new,duration,paon,saon,street,locality,town,district,country,ppd_category_type,record_status' | cat - latest.csv > temp && mv temp latest.csv
In order to use django with postgresql, you need to follow this link.
First we need to create a virtualenv
by using below commands:
virtualenv venv -p [python3 location like /usr/local/bin/python3]
source venv/bin/activate
- Go to the project directory like
cd /home/challenge-directory/
pip install -r requirements.txt
Below are the commands that is need for populating the empty postgresql table, then running the API:
python manage.py makemigrations
python manage.py migrate
python manage.py populate_db [file-location]
python manage.py runserver
There are two endpoints for timeseries and histogram:
/timeseries
: This endpoint only accepts GET request and params are:
{
"postcode": required,
"from_date": optional (format: [Month Year]),
"to_date": optional (example: September 2018)
}
/histogram
: This endpoint only accepts GET request and params are:
{
"postcode": required,
"date": optional (format: [Month Year], example: September 2018)
}
Tools used for deploying and serving endpoints: