GithubHelp home page GithubHelp logo

san089 / optimizing-public-transportation Goto Github PK

View Code? Open in Web Editor NEW
26.0 4.0 11.0 508 KB

A real-time event pipeline around Kafka Ecosystem for Chicago Transit Authority.

License: MIT License

Python 88.31% HTML 4.41% Shell 7.28%
kafka-streams kafka-producer kafka-consumer kafka-connect kafka-cluster kafka-topic faust kafka-sql kafka-schema-registry kafka-api kafka-application

optimizing-public-transportation's Introduction

Optimizing-Public-Transportation

Architecture

Architecture

Overview

In this project we construct a streaming event pipeline around Apache Kafka and its ecosystem. Using public dataset from Chicago Transit Authority we constructed an event pipeline around Kakfa that allows to simulate and display status of train in real time.

Arrival and Turnstiles -> Producers that create train arrival and turnstile information into our kafka cluster. Arrivals indicate that a train has arrived at a particular station while the turnstile event indicate a passanger has entered the station.

Weather -> A REST Proxy prodcer that periodically emits weather data by a REST Proxy and emits that to the kafka cluster.

Postgres SQL and Kafka Connect -> Extract data from stations and push it to kafka cluster.

Kafka status server -> Consumes data from kafka topics and display on the UI.

Results

Environment

  • Docker (I used bitnami kafka image available here
  • Python 3.7

Running and Testing

First make sure all the service are up and running: For docker use:

docker-compose up

Docker-Compose will take 3-5 minutes to start, depending on your hardware. Once Docker-Compose is ready, make sure the services are running by connecting to them using DOCKER URL provided below:

Also, you need to install requirements as well, use below command to create a virtual environment and install requirements:

  1. cd producers
  2. virtualenv venv
  3. . venv/bin/activate
  4. pip install -r requirements.txt

Same for the consumers, setup environment as below:

  1. cd consumers
  2. virtualenv venv
  3. . venv/bin/activate
  4. pip install -r requirements.txt

Running Simulation

Run the producers using simulation.py in producers folder:

python simulation.py

Run the Faust Stream Processing Application:

cd consumers
faust -A faust_stream worker -l info

Run KSQL consumer as below:

cd consumers
python ksql.py

To run consumer server:

cd consumers
python server.py

Resources

Confluent Python Client Documentation
Confluent Python Client Usage and Examples
REST Proxy API Reference
Kafka Connect JDBC Source Connector Configuration Options

optimizing-public-transportation's People

Contributors

san089 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

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