How sumitkumar1503/hospitalmanagement works
Project type and purpose
• This is a monolithic, full-stack web application built with Django (Python) for Hospital Management.
• It supports three user roles (Admin, Doctor, Patient) and handles authentication, CRUD operations on doctors/patients/appointments, PDF invoice generation, and email contact.
File structure
• Top-level:
• manage.py – Django CLI entry point
• hospitalmanagement/ – Django project (settings.py, urls.py, wsgi/asgi)
• hospital/ – single Django app (models.py, views.py, forms.py, admin.py, migrations/)
• templates/hospital/ – server-rendered HTML templates by role & feature
• static/ – CSS, images, screenshots
• requirement.txt – dependencies (Django 3.0.5, xhtml2pdf, widget-tweaks)
• Architectural pattern: classical MVC (Model layer in hospital/models.py; Views in hospital/views.py; Controller logic in forms/views; Templates as the View in Django’s MTV).
• External integrations: SMTP (Gmail) for contact page; xhtml2pdf for PDF invoice generation.
Key insights from README
• Technology stack: Python 3.7.6, Django 3.0.5, Django-widget-tweaks, xhtml2pdf.
• Features: user signup/login flows with conditional approval for doctors/patients, appointment workflows, invoice download, contact form email.
• Deployment: local Django dev server, SQLite (default) or configured RDBMS.
Main components and interactions
a. Client tier
• Web browser (Admin UI, Doctor UI, Patient UI)
• Static assets (CSS, images) served via Django’s staticfiles or CDN
b. Application tier (Django server)
• URL router (hospitalmanagement/urls.py → hospital/views.py)
• Views & Forms (authentication, dashboard, CRUD, PDF generation endpoints)
• Business logic (approval workflows, invoice calc.)
• PDF generator module (xhtml2pdf integration)
• Email module (SMTP via Django’s EmailBackend)
c. Data tier
• Relational database (SQLite/PostgreSQL/MySQL) storing Users, Doctors, Patients, Appointments, DischargeRecords, Invoices, etc.
d. External services
• SMTP server (Gmail) for contact emails
e. Optional deployment layer (Gunicorn/UWGI, Nginx as reverse proxy/static server)
Data flows:
1. Browser → HTTP request → Django URL router → View → (Model ↔ DB) → Template → HTTP response
2. PDF invoice request → View → xhtml2pdf → generated PDF → HTTP response or file download
3. Contact form submit → View → SMTP → external mail delivery
Architectural patterns & principles
• Model-Template-View (MTV) – Django’s variation of MVC.
• Role-based access control: Admin vs Doctor vs Patient URL namespaces and templates.
• Layered architecture: Presentation (templates/static), Application (views/forms), Data (models/DB).
• Single app monolith—no microservices, but clearly separated responsibilities by module/file.
Detail without over-splitting
• Related views (e.g., Appointment Views) under one component.
• You capture all essential architectural elements: roles, MVC/MTV separation, database, PDF/email services.