How manjeetgodara/medico-backend-dev works
Project type and purpose
• This is a modular, monolithic Django-based backend (“Medico-Backend”) serving as the core API for a healthcare/medico platform.
• It exposes REST endpoints, runs scheduled background jobs, handles transactions, notifications, search, promotions, and user management.
File structure
• Top-level project folder “MLP” contains Django project settings (settings.py), URL routing (urls.py), ASGI/WSGI entrypoints, and Celery integration (celery.py).
• Apps under root:
• cronjob – standalone scripts for periodic notifications (e.g., pendingnotifications.py, subscription_expiry.py)
• misc, notification_settings, promotions, search, transactions, users – each is a Django app with models.py, views.py/serializers.py, tests, URLs, services.
• Services folder inside MLP: reusable utilities (email services under MLP/services/emails, templating under MLP/services/templates, SES wrapper under MLP/services/utils).
• importData.py & db.json/demo_data.json – data import scripts.
• requirements.txt – lists dependencies.
README
• Minimal (“# Medico-Backend”) but confirms this repository is the central backend.
Main components & their interactions
a. Web/API Layer
• Gunicorn/Uvicorn + Django ASGI/WSGI serves HTTP(S) traffic
• URL routing delegates requests to app views (users, search, transactions, promotions, notification_settings, misc)
• Views/serializers orchestrate business logic and access the database via Django ORM
• Authentication/authorization handled in users app (decorators, consumers, signals)
b. Database
• A relational database (PostgreSQL/MySQL) storing all Django models across apps
• Migrations folder in each app indicates strong schema evolution
c. Background Task Layer
• Celery worker(s), configured in MLP/celery.py
• Message broker (Redis/RabbitMQ) receives tasks from Django and dispatches to workers
• cronjob app provides scheduled tasks either via Celery Beat or external cron invoking cronjob/main.py
• Tasks implemented in cronjob/*.py and possibly triggered by Django services
d. Email & Notification Services
• MLP/services/emails/email_services.py defines high-level email operations
• Templates in MLP/services/templates for various notification types
• SES wrapper (MLP/services/utils/seswrapper.py) integrates with AWS SES
e. External Services
• AWS SES for email delivery
• Payment gateway(s) in transactions/service.py (e.g., MIHPay, Apple transactions)
• Possibly caching layer (Redis) if used for session or rate-limiting
f. Data Import Utility
• importData.py reads db.json/demo_data.json to seed or migrate data
Architectural patterns & design principles
• Layered pattern: Presentation (views/serializers), Business (service.py), Data (models/migrations)
• Modular apps encourage separation of concerns
• Asynchronous processing via Celery for non-blocking tasks (emails, notifications, batch jobs)
• Template-based email generation keeps content separate from logic
• Cronjob scripts decouple periodic job definitions from core Django apps