|
1 | | -# Health Care Management System |
2 | | - |
3 | | -     |
4 | | - |
5 | | -A modern microservices-based healthcare management system built with **FastAPI**, featuring secure patient data management, appointment scheduling, and real-time notifications. Designed for clinics and hospitals to streamline operations while maintaining HIPAA compliance standards. |
6 | | - |
7 | | - <!-- Add actual diagram path --> |
8 | | - |
9 | | -## ✨ Key Features |
10 | | - |
11 | | -- **Patient Management** |
12 | | - 📝 Secure registration with insurance/ID tracking |
13 | | - 🔍 Advanced search and profile updates |
14 | | -- **Doctor Management** |
15 | | - ⚕️ Specialization-based profiles with availability schedules |
16 | | - 📅 Dynamic calendar integration |
17 | | -- **Smart Appointment System** |
18 | | - 🚨 Conflict-free scheduling with double-booking prevention |
19 | | - 🔔 Real-time notifications via email/SMS |
20 | | -- **Medical Records** |
21 | | - 🔒 Encrypted storage with role-based access control |
22 | | - ⛓️ Audit trails for data integrity |
23 | | -- **Performance Optimizations** |
24 | | - ⚡ Redis caching for high-frequency data |
25 | | - 🐇 RabbitMQ-powered async task processing |
26 | | - |
27 | | -## 🛠 Tech Stack |
28 | | - |
29 | | -- **Backend Framework**: FastAPI 0.109 |
30 | | -- **Database**: PostgreSQL 15 + SQLAlchemy ORM |
31 | | -- **Cache/Queue**: Redis 7 + RabbitMQ 3.12 |
32 | | -- **Auth**: JWT + OAuth2 |
33 | | -- **Docs**: Swagger/OpenAPI 3.0 |
34 | | -- **Testing**: Pytest + HTTPX |
35 | | -- **Deployment**: Docker + Docker Compose |
36 | | - |
37 | | -## 🚀 Quick Start |
38 | | - |
39 | | -### Prerequisites |
40 | | - |
41 | | -- Docker 24.0+ & Docker Compose 2.20+ |
42 | | -- Python 3.11+ |
43 | | - |
44 | | -### Installation |
45 | | - |
46 | | -1. Clone repository: |
47 | | - ```bash |
48 | | - git clone https://github.com/devalentineomonya/Health-Care-Management-System-Python-FastAPI.git |
49 | | - cd Health-Care-Management-System-Python-FastAPI |
50 | | - ``` |
51 | | -2. Create `.env` file: |
52 | | - ```env |
53 | | - SECRET_KEY=your_ultra_secure_key |
54 | | - DATABASE_URL=postgresql://user:pass@db:5432/healthcare |
55 | | - REDIS_URL=redis://redis:6379/0 |
56 | | - RABBITMQ_URL=amqp://guest:guest@rabbitmq:5672/ |
57 | | - SMTP_ENABLED=true |
58 | | - ``` |
59 | | -3. Start services: |
60 | | - ```bash |
61 | | - docker-compose up -d --build |
62 | | - ``` |
63 | | -4. Access API at `http://localhost:8000` |
64 | | - |
65 | | -## 📚 API Documentation |
66 | | - |
67 | | -- **Interactive Swagger UI**: `http://localhost:8000/docs` |
68 | | -- **ReDoc**: `http://localhost:8000/redoc` |
69 | | - |
70 | | - <!-- Add screenshot --> |
71 | | - |
72 | | -## 🗄 Database Schema |
73 | | - |
74 | | -```mermaid |
75 | | -erDiagram |
76 | | - patients ||--o{ appointments : has |
77 | | - patients ||--o{ medical_records : "stores" |
78 | | - doctors ||--o{ appointments : accepts |
79 | | - doctors ||--o{ availabilities : "has" |
80 | | - users ||--o{ patients : "represents" |
81 | | - users ||--o{ doctors : "represents" |
82 | | -
|
83 | | - patients { |
84 | | - uuid id PK |
85 | | - string insurance_number |
86 | | - timestamp created_at |
87 | | - } |
88 | | -
|
89 | | - doctors { |
90 | | - uuid id PK |
91 | | - string specialization |
92 | | - jsonb availability_slots |
93 | | - } |
94 | | -
|
95 | | - appointments { |
96 | | - uuid id PK |
97 | | - timestamp start_time |
98 | | - timestamp end_time |
99 | | - string status |
100 | | - } |
101 | | -``` |
| 1 | +# Health Care Management System — Python / FastAPI |
102 | 2 |
|
103 | | -## 🔒 Security Features |
| 3 | +This repository implements a Health Care Management System API using FastAPI. It includes services for appointments, doctors, patients, users, and a notification worker. |
104 | 4 |
|
105 | | -- **JWT Authentication** with 15-minute token expiration |
106 | | -- **Role-Based Access Control** (Patient, Doctor, Admin) |
107 | | -- 🔑 Argon2 password hashing |
108 | | -- 🛡️ Rate limiting (100 requests/minute) |
109 | | -- 🕵️ Input validation with Pydantic V2 |
110 | | -- 🔐 HTTPS-ready configuration |
| 5 | +Maintainers |
| 6 | +- Repository owner: turabbb |
| 7 | +- Primary contributor (this branch): umarm |
111 | 8 |
|
112 | | -## ⚙️ Project Structure |
| 9 | +Quickstart (local) |
113 | 10 |
|
114 | | -``` |
115 | | -healthcare-system/ |
116 | | -├── app/ |
117 | | -│ ├── api/ # Route handlers |
118 | | -│ ├── core/ # Config, security, middleware |
119 | | -│ ├── crud/ # Database operations |
120 | | -│ ├── db/ # SQLAlchemy models |
121 | | -│ ├── schemas/ # Pydantic models |
122 | | -│ └── main.py # FastAPI entrypoint |
123 | | -├── tests/ # Pytest suites |
124 | | -├── docker-compose.yml # Multi-service setup |
125 | | -├── Dockerfile # Production build |
126 | | -└── requirements.txt # Python dependencies |
127 | | -``` |
| 11 | +1. Create a virtual environment and activate it: |
128 | 12 |
|
129 | | -## 🌐 Production Deployment |
130 | | - |
131 | | -1. Configure reverse proxy (Nginx): |
| 13 | +```powershell |
| 14 | +python -m venv .venv |
| 15 | +.\.venv\Scripts\Activate.ps1 |
| 16 | +``` |
132 | 17 |
|
133 | | - ```nginx |
134 | | - server { |
135 | | - listen 443 ssl; |
136 | | - server_name healthcare.example.com; |
| 18 | +2. Install dependencies: |
137 | 19 |
|
138 | | - ssl_certificate /path/to/fullchain.pem; |
139 | | - ssl_certificate_key /path/to/privkey.pem; |
| 20 | +```powershell |
| 21 | +pip install -r requirements.txt |
| 22 | +``` |
140 | 23 |
|
141 | | - location / { |
142 | | - proxy_pass http://app:8000; |
143 | | - proxy_set_header Host $host; |
144 | | - } |
145 | | - } |
146 | | - ``` |
| 24 | +3. Run the API locally: |
147 | 25 |
|
148 | | -2. Enable automated backups for PostgreSQL |
149 | | -3. Monitor with: |
150 | | - - Prometheus/Grafana for metrics |
151 | | - - ELK Stack for logging |
152 | | - - Uptime Robot for availability |
| 26 | +```powershell |
| 27 | +uvicorn app.main:app --reload --host 127.0.0.1 --port 8000 |
| 28 | +``` |
153 | 29 |
|
154 | | -## 🤝 Contributing |
| 30 | +4. Run tests: |
155 | 31 |
|
156 | | -1. Fork the repository |
157 | | -2. Create feature branch: |
158 | | - ```bash |
159 | | - git checkout -b feat/amazing-feature |
160 | | - ``` |
161 | | -3. Follow PEP8 guidelines and write tests |
162 | | -4. Submit PR with: |
163 | | - - Detailed description |
164 | | - - Screenshots (if UI changes) |
165 | | - - Updated documentation |
| 32 | +```powershell |
| 33 | +pip install pytest |
| 34 | +pytest -q |
| 35 | +``` |
166 | 36 |
|
167 | | -## 🚧 Roadmap |
| 37 | +Docker / Compose |
168 | 38 |
|
169 | | -- [ ] Telemedicine integration (WebRTC) |
170 | | -- [ ] Patient mobile app (Flutter) |
171 | | -- [ ] AI-powered appointment suggestions |
172 | | -- [ ] Insurance claim processing module |
173 | | -- [ ] Multi-tenant architecture support |
| 39 | +This project includes a `Dockerfile` and `docker-compose.yml`. To run with Docker Compose: |
174 | 40 |
|
175 | | -## 📄 License |
| 41 | +```powershell |
| 42 | +docker-compose up --build |
| 43 | +``` |
176 | 44 |
|
177 | | -MIT License - See [LICENSE](LICENSE) for details. |
| 45 | +Repository layout (key files) |
| 46 | +- `app/` — FastAPI application and routes |
| 47 | +- `core/` — configuration, security helpers, notifications |
| 48 | +- `crud/` — CRUD layer for DB models |
| 49 | +- `db/` — SQLAlchemy models and session |
| 50 | +- `schemas/` — Pydantic schemas |
| 51 | +- `tests/` — pytest tests (basic smoke tests on this branch) |
| 52 | + |
| 53 | +Notes |
| 54 | +- This branch `feat/testing-docs` adds baseline tests and documentation. |
| 55 | +- For issues or contributions, open a pull request against `main` and assign to `turabbb`. |
0 commit comments