Skip to content

Sistema que integra los datos de transporte urbano de Montevideo a través de una REST API, utilizando PostgreSQL + PostGIS para el manejo y análisis de datos espaciales.

License

Notifications You must be signed in to change notification settings

aguunu/mvd-mobility-data

Repository files navigation

Montevideo Mobility Data

About The Project

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.

Getting Started

Step 1: Create the .env File

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.

Step 2: Running the Application

You can run the application using either Poetry or Docker. Choose the method that best suits your workflow.

Option 1: Using Poetry

  1. Install Poetry (if you haven't already):
pip install poetry
  1. Install Dependencies:
poetry install
  1. Run the Server:
poetry run uvicorn app.main:app

Option 2: Using Docker Compose

  1. 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.

Endpoints

Once the server is running, you can access the documentation of all available endpoints at http://127.0.0.1:8000/docs.

Example

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.

Contributing

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

  1. Create your Feature Branch git checkout -b feature/AmazingFeature
  2. Commit your Changes git commit -m 'Add some AmazingFeature'
  3. Push to the Branch git push origin feature/AmazingFeature
  4. Open a Pull Request

License

This project is licensed under the MIT License - see the LICENSE file for details.

Authors

About

Sistema que integra los datos de transporte urbano de Montevideo a través de una REST API, utilizando PostgreSQL + PostGIS para el manejo y análisis de datos espaciales.

Topics

Resources

License

Stars

Watchers

Forks