Currently, information on urban transport in the city of Montevideo is dispersed in different sources, which makes its manipulation difficult. In this project, we address the integration of geospatial data, including the real-time positioning of the fleet of vehicles in circulation. Building a REST API that provides mobility data of Montevideo city and also real-time data about vehicles in circulation.
Create a .env
file in the root directory of the project and add the following environment variables:
POSTGRES_HOST=your_postgres_host
POSTGRES_USER=your_postgres_user
POSTGRES_PASSWORD=your_postgres_password
POSTGRES_DB=your_postgres_db
CLIENT_ID=your_client_id
CLIENT_SECRET=your_client_secret
Make sure to replace the placeholders with your actual configuration values. CLIENT_ID
and CLIENT_SECRET
are used to get realtime data about vehicles in circulation. You can obtain a CLIENT_ID
and CLIENT_SECRET
here.
You can run the application using either Poetry or Docker. Choose the method that best suits your workflow.
Option 1: Using Poetry
- Install Poetry (if you haven't already):
pip install poetry
- Install Dependencies:
poetry install
- Run the Server:
poetry run uvicorn app.main:app
- Build the App Image and Start the Containers:
docker-compose up --build
This command will build the app image and start all defined services in the docker-compose.yml
file, including a PostgreSQL container.
Once the server is running, you can access the documentation of all available endpoints at http://127.0.0.1:8000/docs
.
To request data for a specific route (e.g., /routes/L5
), use the following command:
curl -X 'GET' \
'http://127.0.0.1:8000/routes/L5' \
-H 'accept: application/json'
You can expect a response body formatted as follows:
[
{
"routeId": 115,
"variantId": 1575,
"origin": "PUNTA ESPINILLO",
"destination": "PASO DE LA ARENA",
"upward": true
},
{
"routeId": 115,
"variantId": 1577,
"origin": "PASO DE LA ARENA",
"destination": "PUNTA ESPINILLO",
"upward": false
},
{
"routeId": 115,
"variantId": 2603,
"origin": "RINCÓN DEL CERRO",
"destination": "PASO DE LA ARENA",
"upward": null
},
{
"routeId": 115,
"variantId": 2604,
"origin": "PASO DE LA ARENA",
"destination": "RINCÓN DEL CERRO",
"upward": null
}
]
This response contains details about all route variants for line L5
, including their origin, destination, and direction.
If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement".
Fork the Project
- Create your Feature Branch
git checkout -b feature/AmazingFeature
- Commit your Changes
git commit -m 'Add some AmazingFeature'
- Push to the Branch
git push origin feature/AmazingFeature
- Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- Agustín Núñez - [email protected]
- Paula Abbona - [email protected]