Skip to content

Task development for COex - includes database, csv, REST API, Django Rest Framework, ...

Notifications You must be signed in to change notification settings

jiri-one/coex_django_task

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

55 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

COex Backend Test Day

Objectives:

  • Create an application in Django using any packages/libraries
  • version all source code using GIT
  • design a database model to store the imported data in the next step
  • Let the categories (Category column) be implemented as a linked model
  • create a management command to import data from the supplied file
  • create output/listing of internal IDs and names of all locations using
    • a) REST endpoint (preferred - ideally DRF and JSON format)
    • b) Django Views
  • add filtering to the page/endpoint by category and whether the location is available with a dog
  • create a page/endpoint to display complete data for one location
  • create a way to add comments to each location
  • create a page with the statistics of the places that are stored in the DB
    • Number of places
    • an overview of the categories and the number of sites in each category
    • the site with the most comments
    • farthest place from the centre of the country
    • number/estimate of English places
  • on the page/endpoint listing all places, add the current temperature for each place in degrees Celsius (use API from https://open-meteo.com/ for example)
    • the page should have a mechanism/cache that will query the data only 1 per hour (preventing repeated requests that return the same value)

Assignment Notes:

  • admin login via coex:coex
  • admin commands are: temperature_update, temperature_update_async, reimport_csv and reimport_csv_async
  • you will need your own secret key, just run python utils/new_secret_key.py
  • cache refresh is set to 2 hours
  • For the purposes of this example only, the admin command temperature_update uses the openmeteo_py library, while temperature_update_async uses the httpx library
  • temperature_update_async command is super fast because of async tasks. The sync version took about 6,5 minutes (command temperature_update), basic async version from brach async_temp took more then 2 minutes and the last version from main branch (or from async_test branch) took only 30 seconds!
  • reimport_csv_async safe only few second, it depends on hardware and on DB type (sqlite is slow)

About

Task development for COex - includes database, csv, REST API, Django Rest Framework, ...

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published