This repo introduces a simple Django app that utilises OpenWeather API to create a board of weather information of arbitrary locations that a user can manage.
- Add a place to get weather data
- Type a location of interest in the search bar
- Select the desired option
- Press the Add button
- Remove a place from the board
- Press a Rubbish Bin icon on the card corresponding to the location you're looking to remove
- Update the weather details
- Currently implemented via repeated adding of the place. If the place being added already exists, the weather info will be updated for the existing record and no new place will be added.
Suggest locations from entered details and based on the geo-coding API recommendations.
Manage the raw backend using an admin account (needs to be set on the server from within the container)
- Docker client needs to be installed and running
- .env file in the same directory as the source code
- sample file with the required params is available at
sample-env-file
- Note, admin console CSS wouldn't work properly unless the app is in the DEBUG mode (set DJANGO_DEBUG=1 in .env), it has to do with serving static files in the production environment which I've not setup for the purposes of this exercise.
- sample file with the required params is available at
- Once ready, from the code directory run:
docker compose up
- Access the app at
http://0.0.0.0:8000/
- Use
Ctr+C
to stop the container - Clean up (remove the container and the image)
docker compose down --rmi all
-
Backend:
- Django
- OpenWeatherAPI
- SQLite managed by Django
- PyTest
-
Frontend:
- Django HTML templates
- Ajax
- jQuery
- Bootstrap
For tests with coverage details from the working directory of the container (/wdir
) run:
pytest --cov --cov-config /wdir/src/.coveragerc src
There is a total of 9 tests as described below:
- Open Weather API - test the API connection and API handling fundtionality, namely OpenWeatherAPI class & data containers
- Backend endpoint testing - test IO for backend endpoints
- Frontend template selection - test that a correct template is executed
- Database management - test that objects are created in and removed from the database as expected
- [FIXED] Frontend: refactor card construction/list management
- [FIXED] Backend: improve the consistency of the naming
- Currently, location coordinates & autocomplete names are fetched from geo-coding but the final location names used on cards are extracted from the weather API and are obtained via the cords.
- This often results in slight discrepancies between "what was added" and "what is shown on the card"
- Solutions: (i) reuse geo-coding names or (ii) have a consistent coord-location mapping
- Backend: standard handler to a response
- Backend: standardised error management
- Add CI/CD
- [Simple] Add a button to update card info in a more convenient way
- [Simple] Make cards look nice, add weather icons
- [Med] Add card-level functionality to generate holiday/things to do ideas
- [Med] Add card-level functionality to gather hottest events
- [Hard] Add card-level functionality to gather sentiment and most popular articles/insta/X posts about the place