https://github.com/bm777/predictive-maintenance
Predictive maintenance using ML, hosted by FastAPI and Kafka
https://github.com/bm777/predictive-maintenance
anomaly-detection api-rest fastapi kafka-consumer kafka-producer predictive-maintenance
Last synced: 20 days ago
JSON representation
Predictive maintenance using ML, hosted by FastAPI and Kafka
- Host: GitHub
- URL: https://github.com/bm777/predictive-maintenance
- Owner: bm777
- License: mit
- Created: 2022-03-03T11:00:50.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2022-03-06T18:48:23.000Z (about 4 years ago)
- Last Synced: 2025-02-23T17:24:36.579Z (over 1 year ago)
- Topics: anomaly-detection, api-rest, fastapi, kafka-consumer, kafka-producer, predictive-maintenance
- Language: Python
- Homepage:
- Size: 413 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Predictive-maintenance
Predictive maintenance using ML, hosted by FastAPI and Kafka
# Settings
Try to clone the repo.
```
git clone https://github.com/bm777/predictive-maintenance.git
```
#### 0. Set up the kafka env
```
cd kafka
bin/zookeeper-server-start.sh config/zookeeper.properties
bin/kafka-server-start.sh config/server.properties
```
#### 1. Create the transactions, anomalies and normals topics in Kafka Consumer
```
cd kafka
bin/kafka-topics.sh --create --topic transactions --bootstrap-server localhost:9092
bin/kafka-topics.sh --create --topic anomalies --bootstrap-server localhost:9092
bin/kafka-topics.sh --create --topic normals --bootstrap-server localhost:9092
```
We can check our created topics by this command `kafka-topics.sh --bootstrap-server localhost:9092 --list`, the result should be three topics.
#### 2. The predictive maintenance thread & the topics
- The predictive maintenance thread is started automatically in fastapi's startup event. So no need to run `python streaming_kafka/predictive_maintenance.py`
- [optional] watch the topic of your choice {`transactions`, `anomalies`, and `normals` } in the consumer
```
bin/kafka-console-consumer.sh --topic transactions --from-beginning --bootstrap-server localhost:9092
bin/kafka-console-consumer.sh --topic anomalies --from-beginning --bootstrap-server localhost:9092
bin/kafka-console-consumer.sh --topic normals --from-beginning --bootstrap-server localhost:9092
```

#### 3. Start the producer (from our distributed users)
- Static producer: in making event in cascade :)
```
python streaming_kafka/producer.py
```
- Dynamic producer: using REST FastAPI
```
http://localhost:5500/event?data=11
```

#### 4. Alerts bot to slack
