The task has been completed using Python 3.8 and Django 2.2.9.
##Overview
Django has been used to create a candidate class and a Score Class.
The import and sort scripts have been written in pure Python.
##Assumptions
- Pyhon 3.8 is installed on the machine and available from the CLI as python38
- Virtualenvwrapper is installed
##Instructions
-
create a folder and clone the repo into it
mkdir arctic-shores cd arctic-shores git clone git@github.com:mkjmckinlay/arctic-shores.git .
-
Create a Virtual Enviroment and then activate it
mkvirtualenv -p /usr/bin/python38 venv . venv/bin/activate
-
install the requirements
pip install requirements.txt
-
create the database and admin user
python manage.py migrate python manage.py createsuperuser
-
Start the Django Webserver
python manage.py runserver 0.0.0.0:8000
the script assumes that the csv is in the files folder and is called candidates.csv
python importer.py
The code displays a message advising if a result has been added, If the Candidate reference is invalid(In this case Candiate is not created) and if the score is outside of the range (0.0-100.0)
python sorter.py
The script imports the json file and sorted the results by score before outputting to a csv file called sorted.csv(this is created in the files folder)