โ๏ธ๐ค๏ธ Personal trip planner integrating weather data from OpenWeater's Public API
- Table of Contents
- ๐ Demo
- System Design
- Entity-Relationship Diagram
- Database SQL
- ๐กFeatures
- ๐งโ๐ป Installation Steps
- The process
- Licence
- Author
In order to see the application I created my own relationship model, identifying a one-to-many relationship between users and trips.
Managing a foreign key user_id for the connection between the users table to the trips table.
Why all NOT NULL? Users: In users I limited to place only basic fields, but of relevance of the users, getting to restrict some as unique as are the user name and mail, as this way I make sure not to have duplicity in this table.
trips: In trips, having to know when and where a person leaves a place and where he will arrive and his arrival date, I knew I could not build a trip without this information.
In the case of the dates I handled them in timestamp format to know the date and time of departure and arrival of the traveler, since a restriction is that the entire trip can not last more than 8 days equivalent to (192 hours), then a solution that could be implemented, would be through a query to make a summation of the total time of the trips and if it exceeds the limit of 192 to alert the user that the travel time is going to be exceeded.
My bases for choosing a related database are:
- I have knowledge of the types of data I am going to store, plus they are related to each other.
- Besides being able to relate more entities:
- example: that I can link a trip with types of transports I will use or the type of luggage I should carry per trip would be superb.
- I have a better understanding of how they work and they allow me to be flexible with queries.
Here're some of the projects's best features:
- Endpoint to retrive all the travels โ
- Endpoint to retrive the detail of a travel โ
- Endpoint to create a travel โ
- Endpoint to retrive weater forecast โ
- Implementation of container technologies โ
-
Clone the repository
-
Create your virtual enviromen with the command
py -m venv venv
-
Install requirements in your virtual enviroment
pip install -r requirements.txt
-
Create the env file in the root of the project
.env
and copy the content of the.env.example
to configurate environment variables. -
Note: if you want to consult the forecast by city, I recommend you to register in the platforma OpenWeater, get and API KEY and add in you file .env to access to this infromation.
-
You can run the following command to buil the image.
$ docker-compose build
-
Once the image is built, run the container:
$ docker-compose up -d
-
If you want to be faster in launching the project you can use the following command to perform the above two steps in one.
$ docker-compose up --build
-
Now go to http://127.0.0.1:8000/docs and enjoy the app.
Technologies used in this project:
- Docker ๐
- Python ๐
- FastAPI ๐
- Pydantic ๐ฏ
- PostgreSQL ๐
- SQLAlchemy โ๏ธ
To get started you just need to download docker on your machine, I leave the link right here. โก๏ธ Docker.
This project is licensed under the MIT License
Made with ๐ by javieramayapat