{"id":23364262,"url":"https://github.com/bharatseva/worker","last_synced_at":"2025-06-14T09:38:04.586Z","repository":{"id":261490521,"uuid":"879352806","full_name":"BharatSeva/Worker","owner":"BharatSeva","description":"Worker Service for Bharatseva that processes logs, appointments, medical records, and sending mails.","archived":false,"fork":false,"pushed_at":"2024-12-01T05:28:02.000Z","size":231,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-07T22:29:08.810Z","etag":null,"topics":["backend","bharatseva","consumer-service","python","rabbitmq"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"agpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/BharatSeva.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-10-27T17:22:21.000Z","updated_at":"2024-12-01T05:28:05.000Z","dependencies_parsed_at":"2024-12-02T07:47:47.027Z","dependency_job_id":null,"html_url":"https://github.com/BharatSeva/Worker","commit_stats":null,"previous_names":["bharatseva/consumer-service","bharatseva/worker"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/BharatSeva/Worker","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BharatSeva%2FWorker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BharatSeva%2FWorker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BharatSeva%2FWorker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BharatSeva%2FWorker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/BharatSeva","download_url":"https://codeload.github.com/BharatSeva/Worker/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BharatSeva%2FWorker/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259796304,"owners_count":22912688,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["backend","bharatseva","consumer-service","python","rabbitmq"],"created_at":"2024-12-21T13:14:43.728Z","updated_at":"2025-06-14T09:38:04.526Z","avatar_url":"https://github.com/BharatSeva.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# Worker Service  [![Deploy to AzureVM](https://github.com/BharatSeva/Worker/actions/workflows/deploy.yaml/badge.svg)](https://github.com/BharatSeva/Worker/actions/workflows/deploy.yaml)  \nA robust **Python-based Worker Service** designed for the **Bharat Seva+** backend system. This service leverages message-driven architecture to handle events and data processing efficiently. It continuously listens to RabbitMQ queues, processes logs, appointments, and medical records, and manages email notifications. Processed data is stored in PostgreSQL and MongoDB, enabling structured and unstructured data handling for reliable service delivery.\n\n---\n\n## Features\n\n- **Asynchronous Processing**: Consumes and processes messages from RabbitMQ, allowing non-blocking tasks.\n- **Database Integration**:\n  - **PostgreSQL**: Stores structured, relational data, ideal for transactions and structured healthcare records.\n  - **MongoDB**: Stores document-based data, suitable for unstructured and flexible data requirements.\n- **Email Notifications**: Sends timely notifications for appointments and other healthcare updates to patients and staff.\n- **Reliable Message Queueing**: Efficient message handling using RabbitMQ for logging, appointments, medical records, and updates.\n  \n---\n\n## Table of Contents\n- [Requirements](#requirements)\n- [Installation](#installation)\n- [Configuration](#configuration)\n- [Usage](#usage)\n- [Docker Setup](#docker-setup)\n- [License](#license)\n\n---\n\n## Requirements\n\n- **Python** 3.8+\n- **RabbitMQ** (with appropriate queues configured)\n- **PostgreSQL** and **MongoDB** databases\n\n### Python Packages:\n- `pika` (for RabbitMQ integration)\n- `psycopg2` (for PostgreSQL interaction)\n- `pymongo` (for MongoDB interaction)\n- `smtplib` (for email handling)\n\n---\n\n## Installation\n\n1. **Clone the Repository**:\n    ```bash\n    git clone https://github.com/BharatSeva/Worker.git\n    cd Worker\n    ```\n\n2. **Install Dependencies**:\n    ```bash\n    pip install -r requirements.txt\n    ```\n\n---\n\n## Configuration\n\n### Environment Variables\n\nConfigure environment variables for secure access to services. You can set these in a `.env` file or export them in the shell. Below are the required environment variables:\n\n```plaintext\n# RabbitMQ\nRABBITMQ_HOST=rabbitmq\nRABBITMQ_PORT=5672\nRABBITMQ_USER=rootuser\nRABBITMQ_PASSWORD=rootuser\n\n# MongoDB\nMONGODB_URL=mongodb://rootuser:rootuser@mongodb:27017?authSource=admin\nMONGODB_USER=rootuser\nMONGODB_PASSWORD=rootuser\n\n# PostgreSQL\nPOSTGRESQL_URL=postgres://rootuser:rootuser@postgres:5432/postgres?sslmode=disable\nPOSTGRESQL_USER=rootuser\nPOSTGRESQL_PASSWORD=rootuser\nPOSTGRESQL_PORT=5432\nPOSTGRESQL_HOST=postgres\nPOSTGRESQL_DB=postgres\n\n# SMTP for Email Notifications\nSMTP_HOST=smtp.gmail.com\nSMTP_PORT=465\nSMTP_EMAIL=\u003cyour-email\u003e\nSMTP_PASSWORD=\u003cyour-one-time-password\u003e\n```\n### Setting Up RabbitMQ Queues\nEnsure that the following RabbitMQ queues are available:\n- logs\n- patient_records\n- appointments_queue\n- appointment_update\n\n## Usage\nThe service continuously listens to the specified RabbitMQ queues and processes messages accordingly.\n\nRun the Consumer Service:\n\n```bash\npython main.py\n```\nRun Using Docker: Build and run the service within a Docker container if Docker is part of your deployment setup. This service is configured for containerized environments.\n\n### Docker Setup\nBuild the Docker Image:\n\n```bash\ndocker build -t worker .\n```\nRun the Docker Container:\n\n```bash\ndocker run -d --env-file .env worker\n```\n## License\nThis project is licensed under the AGPL-3.0 License. See the [LICENSE](./LICENSE) file for more details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbharatseva%2Fworker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbharatseva%2Fworker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbharatseva%2Fworker/lists"}