How jessmed749/sentiment_analyzer_defeel works
Project type and purpose
• This is an event-driven microservice application (“Sentiment Analyzer DeFeel”) that uses Apache Kafka as its messaging backbone.
• The producer service ingests raw text events into a Kafka topic; the inference service consumes raw events, scores them using a sentiment model, and publishes scored events back to Kafka.
• Docker Compose (in infra/) orchestrates Kafka and Zookeeper locally.
File structure
• infra/
• docker-compose.yml – Defines Kafka and Zookeeper containers and exposes ports.
• producer/
• producer.py & prod.py – Logic to read/generate raw messages and publish to events.raw.
• run.py – Entry point for starting the producer service.
• inference/
• worker.py – Kafka consumer that reads events.raw, invokes the model, and produces to events.scored.
• models.py – The sentiment-scoring logic/class.
• Dockerfile & requirements.txt – Container and dependency setup for the inference service.
• docs/ – Markdown docs and design notes.
• Root requirements.txt – Common Python dependencies.
• .env.dev – Environment variables for development.
Key architectural patterns and components
a. Producer microservice (“Raw Event Emitter”)
b. Kafka cluster (broker + Zookeeper)
c. Two Kafka topics: events.raw and events.scored
d. Inference microservice (“Sentiment Scorer”)
e. (Optional) Downstream consumers or dashboards (not yet implemented)
• Use rectangles for services (producer, inference).
• Use a cloud/container outline for the Docker-Compose orchestrated environment.
• Blue for compute services,
• Orange for message bus components,
• Green for data stores or topics.
Detail level
• Environment variable usage from .env.dev (e.g., Kafka bootstrap address).