This project involves the development of a REST API for a Fleet Management Software designed to track the locations of the vehicles of a taxi company in Beijing, China. The API allows for the management and querying of the locations of nearly 10,000 taxis.
- Python: Main programming language.
- Flask: Framework for web application development.
- SQLAlchemy: ORM for easier database interaction.
- PostgreSQL: Relational database management system.
- Postman: Tool used for API testing.
- Description: Provides a list of all taxis.
- Method: GET
- Route: /taxis
- Parameters: page (optional), limit (optional)
- Description: Provides all locations of a taxi given its ID and a specific date.
- Method: GET
- Route: /trajectories
- Parameters: taxiId (required), date (optional)
- Description: Gets the last reported location of each taxi.
- Method: GET
- Route: /trajectories/latest
- Parameteres: page (optional), limit (optional)
- Description: Set of endpoints to perform CRUD operations on the platform's users.
- Methods: GET, POST, PATCH, DELETE
- Routes:
- List users: /users
- Create user: /users
- Update user: /users/uid
- Delete user: /users/uid
- Description: Allows users to authenticate using their email and password, and receive a JSON Web Token.
- Method: POST
- Route: /auth/login
- Description: Ensures all API endpoints are protected using a JWT token in the authorization header of each request.
- Implementation: Flask middleware to verify JWT tokens on protected routes.
- Description: Exports all locations of a taxi on a specific date in Excel format and sends the file via email.
- Method: GET
- Route: /trajectories/export
- Parameters: taxiId, date, email (all required)
A CLI was developed to efficiently load over 17 million location records from text files into the PostgreSQL database. It handles the process of reading and inserting data by generating SQL queries for each text file.