How achraf-oubakouz/pipeline-monitor works
Pipeline Monitor generates sales records, streams them through Kafka into PostgreSQL, scans stored sales for anomalies, and exposes status/anomaly views plus Groq-backed natural-language explanations. Airflow provides a separate scheduled producer→consumer→detector workflow. The architecture and sampled source support these principal stages; the Airflow and regular-package implementations are duplicated. Kafka, PostgreSQL, and Groq are external runtime services.
Main entry points: pipeline_dag.py Airflow DAG tasks · producer.py Scheduled producer · consumer.py Scheduled consumer · app.py FastAPI dashboard and API
Components 15
Sales ingestion
- Sales generation and direct load
pipelines/sales_pipeline.py - Kafka producer
pipelines/producer.py - Kafka consumer
pipelines/consumer.py
Workflow scheduling
- Airflow DAG tasks
dags/pipeline_dag.py - Scheduled producer
dags/pipelines/producer.py - Scheduled consumer
dags/pipelines/consumer.py - Scheduled anomaly detector
dags/monitor/anomaly_detector.py
Anomaly monitoring
- Anomaly detection
monitor/anomaly_detector.py
Dashboard and explanations
- FastAPI dashboard and API
dashboard/app.py - Anomaly explanation
llm/explainer.py
Other components
- Browser user
- Airflow scheduler
- Kafka sales topic
- PostgreSQL sales table
- Groq Llama service
Connections 19
- Kafka producer → Sales generation and direct load: generates records
pipelines/producer.py - Kafka producer → Kafka sales topic: publishes records
pipelines/producer.py - Kafka consumer → Kafka sales topic: consumes records
pipelines/consumer.py - Kafka consumer → PostgreSQL sales table: appends sales
pipelines/consumer.py - Sales generation and direct load → PostgreSQL sales table: writes sales
pipelines/sales_pipeline.py - Anomaly detection → PostgreSQL sales table: reads sales
monitor/anomaly_detector.py - FastAPI dashboard and API → Anomaly detection: requests scan
dashboard/app.py - FastAPI dashboard and API → Anomaly explanation: requests explanation
dashboard/app.py - Anomaly explanation → Groq Llama service: requests completion
llm/explainer.py - Airflow scheduler → Airflow DAG tasks: triggers schedule
README.md - Airflow DAG tasks → Scheduled producer: runs first
dags/pipeline_dag.py - Airflow DAG tasks → Scheduled consumer: runs second
dags/pipeline_dag.py - Airflow DAG tasks → Scheduled anomaly detector: runs third
dags/pipeline_dag.py - Scheduled producer → Kafka sales topic: publishes records
dags/pipelines/producer.py - Scheduled producer → Sales generation and direct load: generates records
dags/pipelines/producer.py - Scheduled consumer → Kafka sales topic: consumes records
dags/pipelines/consumer.py - Scheduled consumer → PostgreSQL sales table: appends sales
dags/pipelines/consumer.py - Scheduled anomaly detector → PostgreSQL sales table: reads sales
dags/monitor/anomaly_detector.py - Browser user → FastAPI dashboard and API: queries dashboard
README.md