Git Product home page Git Product logo

micro-mobility-platform-vl's Introduction

micro-mobility-platform

Prerequisites:

Execute the following command to check if any postgres instance is currently occupying port 5432 :

sudo ss -lptn 'sport = :5432'

If the result is not empty, please stop postgresql service with this command :

sudo service postgresql stop

Launch micromobility platform

  1. Open a terminal and navigate to the project home directory
  2. If you are using Linux, execute the following command : echo -e "AIRFLOW_UID=$(id -u)" > .env
  3. Launch the platform using docker compose by running the following commands in this order:
docker compose down --volumes  --rmi all
docker compose up airflow-init
docker compose up

Start the ingestion DAG

After all containers are started, the Airflow web interface should be available at http://0.0.0.0:8080/home.

Please use these credentials to log in :

  • user : airflow
  • password : airflow

Click on the activation button to enable live ingestion. When activated, the DAG will trigger an ingestion of bike share stations statuses and description every 5min for the following systems:

  • capital-bikeshare (Washington DC, USA)

alt text

You can verify that the ingestion is actually inserting rows in the postgres database by connecting to it :

  1. If not done already, install psql CLI : https://www.timescale.com/blog/how-to-install-psql-on-mac-ubuntu-debian-windows/
  2. Open a terminal and connect to the mobiliy_data database: psql postgresql://ingest:[email protected]:5432/mobility_data
  3. Query the populated tables. Examples:
    • SELECT * FROM stations.status_history LIMIT 10;
    • SELECT COUNT(1) FROM stations.status_history;
    • SELECT * FROM stations.inventory LIMIT 10;
    • SELECT COUNT(1) FROM stations.inventory;

Export hourly-aggregations

Exporting hourly aggregations is possible from the Rest API, already deployed inside the ingestion container.

API documentation should be available at http://0.0.0.0:8000/docs if docker-compose is still up.

Exports can be performed using two ways:

  1. Go to http://0.0.0.0:8000/docs in your web browser and use the "try it out" feature to choose the export mode of your choice
  2. Execute a GET request to the following URIs :

Tip: you can directly COPY/PASTE these URIs in your browser navigation bar.

Have fun!

micro-mobility-platform-vl's People

Contributors

vincelegendre avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.