This project is about simulating a real time voting scenario, process the data and visualise results on dashboard in near real time.
We can generate 2 kinds of entities
- Candidates for voting
- Voters
To generate Candidates data
python candidate_generator.py
To generate Voters data
python voters_generator.py
To start the kafka brokers and confluent kafka webui run
cd docker-files
docker-compose up -d docker-compose.yaml
From confluent kafka webui at http://locahost:9021 create the required kafka topics
To start generating votes data to kafka topic created in previous step, run:
python votes_producer.py
To start processing the votes data sent to Kafka topic, submit a spark job to your spark cluster. I have used my local spark cluster.
spark-submit --packages org.apache.spark:spark-sql-kafka-0-10_2.12:3.5.0 sparkCode/streaming.py
Now the processed voting data is being sent to the output kafka topics by spark pipeline. Start the dashboard app to visulise the data.
python dashboard/dashboard.py