MINISTRY OF SCIENCE AND TECHNOLOGY
POSTS AND TELECOMMUNICATIONS INSTITUTE OF TECHNOLOGY
SUBJECT: SOFTWARE ARCHITECTURE & DESIGN
FINAL PROJECT: HEALTH-CARE SYSTEM DEVELOPMENT
Họ và tên : Phan Hoàng Trung
Mã sinh viên : B21DCCN735
Lớp : E21CNPM3
Giảng viên : PGS.TS. Trần Đình Quế
Hanoi, 2025
CHAPTER 1: REQUIREMENT OF HEALTH-CARE
I. Determine Requirements
1. Business model by natural
language
Overview
This healthcare system facilitates the seamless interaction between various
stakeholders such as patients, doctors, nurses, administrators, pharmacists, insurance
providers, and laboratory technicians. Each stakeholder has distinct roles and
responsibilities that ensure the effective and efficient operation of the healthcare
facility. The model integrates both the front-end user experience and back-end
functionalities necessary for optimal healthcare delivery.
Key Stakeholders and Their Functions
1. Patient
o Needs: Access to personal health data, ability to schedule appointments,
manage prescriptions, and process payments.
o Business Value: Patients drive the demand for healthcare services.
Providing them with easy access to health records, appointments,
prescriptions, and billing information enhances satisfaction and
engagement.
o Revenue Model: Payments for medical services, prescriptions, and
insurance processing.
2. Doctor
o Needs: Access to patient history, ability to schedule consultations, order
diagnostic tests, and prescribe treatments.
o Business Value: Doctors are the primary providers of healthcare
services. Streamlining their workflows (appointments, diagnoses, lab
tests) improves operational efficiency, reduces time spent on
administrative tasks, and enhances patient care.
o Revenue Model: Payment for consultations, treatments, and medical
procedures.
3. Nurse
2
o Needs: Access to patient records, ability to assist with care and
treatment, and record vital signs.
o Business Value: Nurses provide essential support to doctors in patient
care and treatment. Efficient management of their tasks through a unified
system ensures better patient outcomes and optimized resource
utilization.
o Revenue Model: Indirectly impacts revenue by supporting the overall
operational flow and patient care quality.
4. Administrator
o Needs: Oversee system security, manage staff schedules, ensure
compliance, and handle hospital billing.
o Business Value: The administrator ensures the smooth functioning of
the healthcare facility. They are responsible for maintaining compliance
with regulations, streamlining staffing, handling billing and insurance,
and generating performance reports.
o Revenue Model: Indirectly impacts revenue by ensuring smooth and
secure operations.
5. Pharmacist
o Needs: Process prescriptions, manage pharmacy inventory, and
communicate with doctors and patients.
o Business Value: Pharmacists ensure patients receive the correct
medications. By managing the medication supply chain, pharmacists
play a crucial role in maintaining treatment consistency and safety.
o Revenue Model: Earnings from dispensing medications, pharmacy
services, and insurance claims.
6. Insurance Provider
o Needs: Verify insurance coverage, process claims, and communicate
with patients and administrators.
o Business Value: Insurance providers manage the financial risk for
patients and the healthcare facility. Efficient claim processing and
communication reduce administrative burden and ensure timely
reimbursement for services rendered.
3
o Revenue Model: Premiums collected from patients and reimbursement
for claims submitted by healthcare providers.
7. Laboratory Technician
o Needs: Conduct tests, upload results, and notify doctors and patients of
test outcomes.
o Business Value: Lab technicians provide diagnostic support that informs
treatment decisions. Timely and accurate test results contribute to better
patient outcomes and faster medical interventions.
o Revenue Model: Revenue is generated from lab test fees and associated
diagnostic services.
Value Proposition
For Patients: The system provides easy access to medical records,
appointments, prescriptions, and billing, leading to a seamless healthcare
experience.
For Healthcare Providers (Doctors, Nurses, Pharmacists): The system
automates administrative tasks such as scheduling, patient records management,
and prescription handling, allowing them to focus more on patient care.
For Administrators: The system ensures efficient management of resources,
user access, compliance, and billing, driving operational efficiency and
reducing administrative overhead.
For Insurance Providers: The system streamlines the claims process and
insurance verification, leading to faster reimbursement and improved relations
with healthcare providers.
For Laboratory Technicians: The system ensures timely test result uploads,
improving communication with doctors and patients and enhancing overall
treatment accuracy.
Revenue Model
1. Direct Revenue:
o Consultation Fees: Payment from patients for doctor visits.
4
o Prescription Fees: Payment from patients for medications dispensed by
pharmacists.
o Lab Test Fees: Payment for medical testing services.
o Insurance Payments: Reimbursement received from insurance
providers for covered medical treatments.
2. Indirect Revenue:
o Operational Efficiency: Streamlined processes, reduced time spent on
administrative tasks, and reduced human error lead to cost savings for
the hospital or clinic.
o Patient Retention: A smoother, more transparent system enhances
patient satisfaction, leading to repeat visits and referrals.
Cost Structure
Personnel Costs: Salaries of doctors, nurses, administrators, pharmacists, and
laboratory technicians.
Technology Infrastructure: Costs for developing, maintaining, and upgrading
the software platform, including servers, security, and data management.
Insurance & Compliance: Expenses related to ensuring system security,
compliance with healthcare regulations, and managing insurance
reimbursements.
Supplies and Inventory: Costs of medications, medical equipment, and
laboratory materials required for patient care and testing.
Operational Flow
1. Patient Engagement:
o The patient accesses the system to book appointments, view medical
records, and receive prescriptions. They can also pay medical bills and
view lab test reports.
2. Healthcare Delivery:
o The doctor accesses the patient’s history, diagnoses, and prescribes
treatments, which may involve ordering lab tests or prescriptions.
5
o Nurses assist with the care, update vital records, and administer
treatments as prescribed.
3. Backend Operations:
o Administrators manage the system, handle billing and insurance, and
generate reports.
o Pharmacists dispense medications as per doctor prescriptions and
manage pharmacy inventory.
o Insurance providers process claims and ensure financial coverage.
o Laboratory technicians perform tests, upload results, and notify doctors
and patients.
4. Outcome:
o The integration of these roles ensures a streamlined process that
improves patient care, reduces wait times, enhances communication, and
increases operational efficiency, ultimately leading to improved patient
satisfaction and organizational success.
2. Actors
- Patient:
+ Patients are the primary users who interact with the system
to register an account, book or cancel appointments, view their personal
medical records and lab test results, receive prescriptions, pay medical
bills, and update their personal information as needed.
- Doctor:
+ Doctors are responsible for managing and scheduling
appointments, accessing patient histories, diagnosing illnesses,
prescribing treatments, ordering lab tests, writing detailed medical
reports, viewing laboratory results, and communicating with patients
and staff to provide effective healthcare services.
- Nurse:
+ Nurses assist doctors in patient care activities. They record
and update patient vitals, administer medications, assist in diagnosis
and treatment processes, and update patient records to ensure that all
clinical information is accurate and current.
6
- Admin:
+ Administrators manage user accounts and access rights
within the system, maintain system security and regulatory compliance,
schedule doctors and nurses, oversee billing and insurance claim
processes, generate operational reports and analytics, and maintain the
hospital’s inventory and resources.
- Pharmacist:
+ Pharmacists verify and process prescriptions issued by
doctors. They manage the pharmacy’s medication inventory, dispense
prescribed medications to patients, and communicate with both doctors
and patients to ensure safe and effective medication use.
- Insurance Provider:
+ Insurance providers verify patients’ insurance information,
process insurance claims submitted by the billing department,
communicate with patients and administrative staff regarding insurance
matters, and make decisions to approve or reject insurance claims
based on policy coverage.
- Laboratory Technician:
+ Laboratory technicians conduct medical tests based on
orders from doctors, upload test results into the system for review by
doctors and patients, notify relevant stakeholders once results are
ready, and maintain laboratory equipment and testing data to ensure
operational efficiency and accuracy.
3. Functions with respect to actors
1. Patient
Responsibilities:
o Register and login to access the system
o Book or cancel appointments
o View medical records and lab reports
o Receive prescriptions
o Pay medical bills
o Update personal information
7
2. Doctor
Responsibilities:
o Schedule/manage appointments
o Access patient history
o Diagnose and prescribe treatments
o Order lab tests
o Write medical reports
o Communicate with patients and staff
3. Nurse
Responsibilities:
o Assist in patient care
o Record and update patient vitals
o Administer medications
o Assist doctors in diagnosis and treatment
o Update patient records
4. Administrator
Responsibilities:
o Manage users and access rights
o Maintain system security and compliance
o Schedule doctors and nurses
o Handle billing and insurance processing
o Generate reports and analytics
o Manage hospital inventory and resources
5. Pharmacist
Responsibilities:
o Verify and dispense medications
o Manage pharmacy inventory
o Process prescriptions
8
o Communicate with doctors and patients
6. Insurance Provider
Responsibilities:
o Verify patient insurance details
o Process insurance claims
o Communicate with patients and administrators
o Approve or reject insurance requests
7. Laboratory Technician
Responsibilities:
o Conduct medical tests
o Upload test results
o Notify doctors and patients about test reports
o Maintain lab equipment and data
4. Use case Diagrams
4.1. Overall use case of all system
4.2. Patient
- Book/Cancel Appointments
9
- View Medical Records
- Receive Prescriptions
10
- Pay Medical Bills
- View Lab Test Reports
11
- Update Personal Information
4.3. Doctor
- Schedule/Manage Appointments
12
- Access Patient History
- Diagnose & Prescribe Treatments (chẩn đoán -> kê đơn) //
validate prescription vì có luồng kê đơn thuốc thì phải validate
- Order Lab Tests
13
- Write Medical Reports
- View Lab Test Results
- Communicate with Patients & Staff
4.4. Nurse
- Assist in Patient Care
14
- Record & Update Patient Vitals
- Administer Medications
- Assist Doctors in Diagnosis & Treatment
- Update Patient Records
4.5. Administrator
- Manage Users & Access Rights
15
- Maintain System Security & Compliance
- Schedule Doctors & Nurses
- Manage Billing & Insurance Processing
- Generate Reports & Analytics
- Maintain Hospital Inventory & Resources
4.6. Pharmacist
- Verify & Dispense Medications
- Manage Pharmacy Inventory
- Process Prescriptions
- Communicate with Doctors & Patients
16
- Manage stock
- Process payments
4.7. Insurance Provider
- Verify Patient Insurance Details
17
- Process Insurance Claims
- Communicate with Patients & Administrators
- Approve/Reject Insurance Requests
18
4.8. Laboratory Technician
- Conduct Medical Tests
- Upload Test Results
- Notify Doctors & Patients of Test Reports
- Maintain Lab Equipment & Data
5. System Functions
5.1. User Authentication & Authorization
This function ensures secure access to the system. It allows users to register and log in
with credentials, and assigns roles (e.g., patient, doctor, admin). Based on roles, users
get specific access to features and data. Authorization ensures data privacy and
protects sensitive medical information.
5.2. Electronic Health Records (EHR) Management
Manages the digital version of a patient’s medical history. Includes personal details,
diagnosis, treatment history, medications, allergies, immunization records, and visit
notes. Doctors and authorized staff can update, view, and share EHRs with proper
permissions.
5.3. Appointment Scheduling
Enables patients to book, reschedule, or cancel appointments with doctors. Doctors
and staff can view and manage their schedules. The system can also block time slots,
manage availability, and send appointment confirmations or reminders.
19
5.4. Billing & Insurance Processing
Automates patient billing, including service charges, consultation fees, and medical
procedures. It can generate invoices and track payments. Insurance integration allows
validation of patient insurance, claims submission, and tracking reimbursement status.
5.5. Prescription & Pharmacy Management
Doctors can generate and update digital prescriptions. The system stores prescription
history and ensures it's accessible to pharmacies. It may also manage drug inventory,
medication dispensing, and alert for drug interactions or allergies.
5.6. Medical Test & Report Management
Handles scheduling of lab tests, uploading and storing diagnostic reports (e.g., blood
tests, X-rays, MRIs). Patients and doctors can access results through the portal. It may
also include integration with lab systems for automatic report uploads.
5.7. Notification & Communication (Email, SMS Alerts)
Sends alerts and reminders for appointments, prescription refills, test results, and
billing updates via SMS or email. It also supports secure messaging between patients
and healthcare providers for better communication.
6. Activity Diagrams
6.1. Patient Booking an Appointment
20
6.2. Doctor Diagnosing and Prescribing Treatment
21
22
23
24
25
6.3. Laboratory Technician Conducting and Uploading Test Results
26
27
28
29
6.4. Pharmacist Dispensing Medication
30
31
32
33
34
35
6.5. Administrator Managing User Roles
36
6.6. Insurance Provider Processing a Claim
37
38
II. Analyze Requirements
1. Decompose the system in
microservices with Django
Here’s the breakdown of your microservices architecture with the structure and detailed
description presented in a clean, decorated manner:
Detailed Microservices Breakdown
1. API Gateway Service
Responsibility: Single entry point for clients, handles request routing, load balancing
Tech Stack: Django + Django REST Framework (DRF) + Django Ninja (for
OpenAPI)
Key Components:
o API routing configuration
o Authentication token validation
o Rate limiting
o Request/response transformation
2. Authentication Service
Responsibility: User registration, authentication, authorization
Tech Stack: Django + DRF + JWT/OAuth2
Key Components:
o User registration
o Login/logout
o JWT token issuance
o Role-based access control
3. Patient Service
Responsibility: Patient profile management, medical records
Tech Stack: Django + DRF + PostgreSQL
39
Key Components:
o Patient registration
o Medical history
o Personal information management
o API for other services
4. Doctor Service
Responsibility: Doctor profile management, schedules, specialties
Tech Stack: Django + DRF + PostgreSQL
Key Components:
o Doctor profiles
o Availability management
o Specializations and expertise
o Performance metrics
5. Appointment Service
Responsibility: Appointment scheduling, management
Tech Stack: Django + DRF + Redis + PostgreSQL
Key Components:
o Appointment booking
o Schedule management
o Availability checks
o Appointment history
6. Prescription Service
Responsibility: Digital prescription creation and management
Tech Stack: Django + DRF + PostgreSQL
Key Components:
o Prescription creation
o Medication details
o Dosage instructions
o Prescription history
7. Pharmacy Service
Responsibility: Medication management, dispensing
Tech Stack: Django + DRF + PostgreSQL
Key Components:
o Inventory management
o Prescription verification
40
o Medication dispensing
o Billing integration
8. Laboratory Service
Responsibility: Lab test management, results
Tech Stack: Django + DRF + PostgreSQL + Celery
Key Components:
o Test order management
o Result recording
o Sample tracking
o Result delivery
9. Billing Service
Responsibility: Invoice generation, payment processing
Tech Stack: Django + DRF + PostgreSQL + Stripe/Payment Gateway
Key Components:
o Invoice generation
o Payment processing
o Transaction history
o Integration with insurance
10. Insurance Service
Responsibility: Insurance policy management, claims
Tech Stack: Django + DRF + PostgreSQL
Key Components:
o Policy verification
o Claims processing
o Coverage calculation
o Payment reconciliation
11. Notification Service
Responsibility: Multi-channel notifications
Tech Stack: Django + DRF + Redis + Celery
Key Components:
o Email notifications
o SMS notifications
o Push notifications
o Notification preferences
41
12. Reporting Service
Responsibility: Analytics, reports generation
Tech Stack: Django + DRF + PostgreSQL + Pandas + Celery
Key Components:
o Data aggregation
o Report generation
o Analytics dashboard
o Export functionality
13. File Storage Service
Responsibility: Medical images, documents storage
Tech Stack: Django + DRF + AWS S3/MinIO
Key Components:
o Secure file uploads
o Access control
o File versioning
o DICOM image support
2. Classes with attributes of service
models (models)
1. Authentication Service Models
User
email: EmailField (unique)
username: CharField (30 chars, unique)
first_name: CharField (30 chars)
last_name: CharField (30 chars)
date_joined: DateTimeField (auto)
is_active: BooleanField
is_staff: BooleanField
role: CharField (20 chars, choices)
Role
name: CharField (50 chars)
description: TextField
permissions: ManyToManyField
Permission
name: CharField (100 chars)
42
codename: CharField (100 chars)
service: CharField (50 chars)
2. Patient Service Models
PatientProfile
user_id: UUIDField (unique)
date_of_birth: DateField
gender: CharField (10 chars, choices)
blood_group: CharField (5 chars, choices)
address: TextField
city: CharField (50 chars)
state: CharField (50 chars)
postal_code: CharField (10 chars)
country: CharField (50 chars)
phone_number: CharField (15 chars)
emergency_contact_name: CharField (100 chars)
emergency_contact_phone: CharField (15 chars)
created_at: DateTimeField (auto)
updated_at: DateTimeField (auto)
MedicalHistory
patient: ForeignKey (PatientProfile)
condition: CharField (100 chars)
diagnosed_date: DateField
treatment_summary: TextField
is_chronic: BooleanField
notes: TextField
Allergy
patient: ForeignKey (PatientProfile)
allergen: CharField (100 chars)
reaction: TextField
severity: CharField (20 chars, choices)
diagnosed_date: DateField
3. Doctor Service Models
DoctorProfile
user_id: UUIDField (unique)
license_number: CharField (50 chars, unique)
specialization: ForeignKey (Specialization)
qualification: CharField (200 chars)
43
experience_years: PositiveIntegerField
bio: TextField
consultation_fee: DecimalField (10,2)
available_for_online_consultation: BooleanField
rating: DecimalField (3,2)
total_reviews: PositiveIntegerField
created_at: DateTimeField (auto)
updated_at: DateTimeField (auto)
Specialization
name: CharField (100 chars)
description: TextField
Availability
doctor: ForeignKey (DoctorProfile)
day_of_week: IntegerField (choices)
start_time: TimeField
end_time: TimeField
is_available: BooleanField
DoctorReview
doctor: ForeignKey (DoctorProfile)
patient_id: UUIDField
rating: IntegerField (1-5)
comments: TextField
created_at: DateTimeField (auto)
4. Appointment Service Models
Appointment
appointment_id: UUIDField (primary key)
doctor_id: UUIDField
patient_id: UUIDField
appointment_date: DateField
start_time: TimeField
end_time: TimeField
status: CharField (20 chars, choices)
appointment_type: CharField (20 chars, choices)
reason: TextField
notes: TextField
created_at: DateTimeField (auto)
updated_at: DateTimeField (auto)
canceled_reason: TextField (optional)
canceled_by: CharField (20 chars, optional)
44
TimeSlot
doctor_id: UUIDField
date: DateField
start_time: TimeField
end_time: TimeField
is_available: BooleanField
appointment: OneToOneField (Appointment, optional)
5. Prescription Service Models
Prescription
prescription_id: UUIDField (primary key)
patient_id: UUIDField
doctor_id: UUIDField
appointment_id: UUIDField (optional)
diagnosis: TextField
notes: TextField
created_at: DateTimeField (auto)
valid_until: DateField
status: CharField (20 chars, choices)
Medication
prescription: ForeignKey (Prescription)
name: CharField (100 chars)
dosage: CharField (50 chars)
frequency: CharField (50 chars)
duration: CharField (50 chars)
instructions: TextField
quantity: PositiveIntegerField
refills: PositiveIntegerField
6. Pharmacy Service Models
PharmacyProfile
user_id: UUIDField (unique)
name: CharField (100 chars)
license_number: CharField (50 chars, unique)
address: TextField
city: CharField (50 chars)
state: CharField (50 chars)
postal_code: CharField (10 chars)
country: CharField (50 chars)
phone_number: CharField (15 chars)
45
email: EmailField
operating_hours: JSONField
is_active: BooleanField
MedicationInventory
pharmacy: ForeignKey (PharmacyProfile)
name: CharField (100 chars)
generic_name: CharField (100 chars)
manufacturer: CharField (100 chars)
description: TextField
dosage_form: CharField (50 chars)
strength: CharField (50 chars)
stock_quantity: PositiveIntegerField
unit_price: DecimalField (10,2)
requires_prescription: BooleanField
expiry_date: DateField
PrescriptionProcessing
prescription_id: UUIDField
pharmacy: ForeignKey (PharmacyProfile)
status: CharField (20 chars, choices)
processed_by: UUIDField
processed_at: DateTimeField (auto)
pickup_ready_time: DateTimeField (optional)
pickup_method: CharField (20 chars, choices)
notes: TextField
7. Laboratory Service Models
LaboratoryProfile
user_id: UUIDField (unique)
name: CharField (100 chars)
license_number: CharField (50 chars, unique)
address: TextField
city: CharField (50 chars)
state: CharField (50 chars)
postal_code: CharField (10 chars)
phone_number: CharField (15 chars)
email: EmailField
operating_hours: JSONField
TestType
name: CharField (100 chars)
description: TextField
preparation_instructions: TextField
46
price: DecimalField (10,2)
turnaround_time_hours: PositiveIntegerField
requires_fasting: BooleanField
LabTestOrder
order_id: UUIDField (primary key)
patient_id: UUIDField
doctor_id: UUIDField
laboratory: ForeignKey (LaboratoryProfile)
order_date: DateTimeField (auto)
status: CharField (20 chars, choices)
priority: CharField (20 chars, choices)
clinical_information: TextField
LabTest
test_order: ForeignKey (LabTestOrder)
test_type: ForeignKey (TestType)
status: CharField (20 chars, choices)
TestResult
lab_test: OneToOneField (LabTest)
technician_id: UUIDField
performed_at: DateTimeField (auto)
result_data: JSONField
interpretation: TextField
is_abnormal: BooleanField
comments: TextField
verified_by: UUIDField (optional)
verified_at: DateTimeField (optional)
3. Determine functions in services
(Views)
1. Authentication Service Views
User Management
register_user(): Create new user accounts
login_user(): Authenticate and issue JWT tokens
logout_user(): Invalidate user tokens
verify_token(): Validate authentication tokens
refresh_token(): Generate new access token using refresh token
47
change_password(): Allow users to update passwords
reset_password_request(): Initiate password reset process
reset_password_confirm(): Complete password reset with token
Role Management
list_roles(): Get available roles in the system
get_role_permissions(): View permissions assigned to a role
assign_role(): Assign role to a user
update_role_permissions(): Modify permissions for a role
2. Patient Service Views
Patient Profile Management
create_patient_profile(): Create new patient profile
get_patient_profile(): Retrieve patient information
update_patient_profile(): Update patient details
deactivate_patient_profile(): Deactivate patient account
Medical Records Management
add_medical_history(): Add past medical conditions
update_medical_history(): Modify existing medical history
list_medical_history(): View patient's medical history
delete_medical_history(): Remove incorrect records
Allergy Management
add_allergy(): Record patient allergies
update_allergy(): Modify allergy information
list_allergies(): View patient's allergies
delete_allergy(): Remove allergy record
Patient Portal Functions
get_patient_appointments(): Retrieve patient's appointments
get_patient_prescriptions(): Retrieve patient's prescriptions
get_patient_lab_results(): Retrieve patient's lab results
48
get_patient_invoices(): Retrieve patient's billing information
3. Doctor Service Views
Doctor Profile Management
create_doctor_profile(): Create new doctor profile
get_doctor_profile(): Retrieve doctor information
update_doctor_profile(): Update doctor details
list_doctors(): Get list of doctors with filters
deactivate_doctor_profile(): Deactivate doctor account
Specialization Management
list_specializations(): Get medical specializations
get_doctors_by_specialization(): Find doctors by specialty
Availability Management
set_doctor_availability(): Define doctor's working hours
get_doctor_availability(): View doctor's schedule
update_doctor_availability(): Modify availability
set_leave_period(): Mark vacation or unavailable periods
Doctor Dashboard Functions
get_doctor_appointments(): Retrieve scheduled appointments
get_doctor_patients(): List patients under doctor's care
search_patients(): Find patients by criteria
Review Management
get_doctor_reviews(): Retrieve reviews for a doctor
get_doctor_rating(): Calculate average rating
4. Appointment Service Views
Appointment Booking
check_doctor_availability(): Check available slots
book_appointment(): Create new appointment
49
reschedule_appointment(): Change appointment time
cancel_appointment(): Cancel existing appointment
Appointment Management
list_appointments(): View appointments with filters
get_appointment_details(): Retrieve single appointment
update_appointment_status(): Mark as completed/missed
add_appointment_notes(): Add notes to appointment
Time Slot Management
generate_time_slots(): Create slots based on availability
get_available_slots(): List open time slots
block_time_slot(): Mark slot as unavailable
release_time_slot(): Make blocked slot available again
5. Prescription Service Views
Prescription Management
create_prescription(): Create new prescription
get_prescription(): Retrieve prescription details
update_prescription(): Modify existing prescription
cancel_prescription(): Cancel active prescription
list_prescriptions(): View prescriptions with filters
Medication Management
add_medication(): Add medication to prescription
update_medication(): Modify medication details
remove_medication(): Remove medication from prescription
list_medications(): View medications in a prescription
Prescription Status Management
update_prescription_status(): Change status (active/completed/canceled)
renew_prescription(): Create renewal for existing prescription
verify_prescription_validity(): Check if prescription is valid
50
6. Pharmacy Service Views
Pharmacy Profile Management
create_pharmacy_profile(): Register new pharmacy
get_pharmacy_profile(): Retrieve pharmacy information
update_pharmacy_profile(): Update pharmacy details
list_pharmacies(): View pharmacies with filters
Medication Inventory Management
add_medication_inventory(): Add new medication to inventory
update_medication_inventory(): Update medication details
adjust_stock_quantity(): Change available quantity
list_inventory(): View inventory with filters
search_medications(): Find medications by criteria
check_medication_availability(): Verify if medication is in stock
Prescription Processing
receive_prescription(): Accept prescription for processing
verify_prescription(): Validate prescription authenticity
process_prescription(): Mark prescription as being filled
complete_prescription(): Mark prescription as dispensed
reject_prescription(): Decline to fill with reason
list_pending_prescriptions(): View prescriptions to be processed
Pharmacy Dashboard Functions
get_daily_dispensing_summary(): View daily activity
get_low_stock_alerts(): Identify inventory needing restock
get_expiring_medications(): List medications near expiration
7. Laboratory Service Views
Laboratory Profile Management
create_laboratory_profile(): Register new laboratory
51
get_laboratory_profile(): Retrieve laboratory information
update_laboratory_profile(): Update laboratory details
list_laboratories(): View laboratories with filters
Test Type Management
add_test_type(): Add new available test
update_test_type(): Modify test details
deactivate_test_type(): Remove test from offerings
list_test_types(): View available tests
get_test_type_details(): Get information about specific test
Lab Test Order Management
create_test_order(): Create new test order
get_test_order(): Retrieve test order details
update_test_order(): Update test order information
cancel_test_order(): Cancel ordered test
list_test_orders(): View test orders with filters
Test Result Management
record_test_result(): Enter test results
update_test_result(): Modify entered results
verify_test_result(): Approve results by supervisor
get_test_result(): Retrieve test results
list_test_results(): View results with filters
mark_result_abnormal(): Flag results requiring attention
Laboratory Dashboard Functions
get_pending_tests(): View tests awaiting processing
get_completed_tests(): View processed tests
get_pending_verification(): List results needing verification
8. Billing Service Views
Invoice Management
52
create_invoice(): Generate new invoice
get_invoice(): Retrieve invoice details
update_invoice(): Modify invoice information
cancel_invoice(): Cancel existing invoice
list_invoices(): View invoices with filters
generate_invoice_pdf(): Create downloadable invoice
Invoice Item Management
add_invoice_item(): Add service/item to invoice
update_invoice_item(): Modify item details
remove_invoice_item(): Delete item from invoice
list_invoice_items(): View items in an invoice
Payment Management
process_payment(): Record new payment
get_payment(): Retrieve payment details
refund_payment(): Process payment refund
list_payments(): View payments with filters
Insurance Claim Management
create_insurance_claim(): Submit claim to insurance
update_claim_status(): Update claim processing status
get_claim_details(): Retrieve claim information
list_insurance_claims(): View claims with filters
Billing Dashboard Functions
get_payment_summary(): View payment statistics
get_overdue_invoices(): List unpaid invoices
get_revenue_report(): Generate revenue analytics
9. Insurance Service Views
Insurance Provider Management
create_insurance_provider(): Add new insurance company
53
get_insurance_provider(): Retrieve provider details
update_insurance_provider(): Update provider information
list_insurance_providers(): View providers with filters
Insurance Policy Management
create_insurance_policy(): Add new patient policy
get_insurance_policy(): Retrieve policy details
update_insurance_policy(): Modify policy information
cancel_insurance_policy(): End active policy
list_insurance_policies(): View policies with filters
Coverage Plan Management
create_coverage_plan(): Define coverage details
update_coverage_plan(): Modify coverage terms
get_coverage_details(): Retrieve coverage information
verify_service_coverage(): Check if service is covered
Claim Processing
receive_claim(): Accept claim for processing
process_claim(): Review and decide on claim
approve_claim(): Accept claim with payment amount
reject_claim(): Decline claim with reason
get_claim_status(): Check claim processing status
list_pending_claims(): View claims needing processing
Insurance Dashboard Functions
get_claims_summary(): View claim statistics
get_policy_expiration_alerts(): List soon-expiring policies
get_coverage_utilization(): Analyze coverage usage
10. Notification Service Views
Notification Management
create_notification(): Create new notification
54
get_notification(): Retrieve notification details
mark_notification_read(): Mark as viewed/read
delete_notification(): Remove notification
list_notifications(): View notifications with filters
Notification Channel Management
update_notification_preferences(): Set preferred channels
get_notification_preferences(): Retrieve preferences
enable_channel(): Activate notification channel
disable_channel(): Deactivate notification channel
Notification Delivery
send_email_notification(): Send email message
send_sms_notification(): Send text message
send_push_notification(): Send mobile push notification
deliver_in_app_notification(): Create in-app alert
get_delivery_status(): Check notification delivery
Batch Notification
send_batch_notification(): Notify multiple recipients
schedule_notification(): Schedule future notification
cancel_scheduled_notification(): Cancel pending notification
11. Reporting Service Views
Report Template Management
create_report_template(): Create new report definition
get_report_template(): Retrieve template details
update_report_template(): Modify template
delete_report_template(): Remove template
list_report_templates(): View available templates
Report Generation
generate_report(): Create new report instance
55
get_report_status(): Check report generation progress
get_report(): Retrieve generated report
download_report(): Export report as file
list_generated_reports(): View created reports
Report Scheduling
create_report_schedule(): Schedule recurring report
get_schedule_details(): Retrieve schedule information
update_report_schedule(): Modify schedule
delete_report_schedule(): Remove schedule
list_report_schedules(): View active schedules
pause_schedule(): Temporarily disable schedule
resume_schedule(): Re-enable paused schedule
Data Sources Management
list_data_sources(): View available data connections
test_data_source(): Verify connection works
get_available_fields(): List queryable data fields
12. File Storage Service Views
File Management
upload_file(): Add new file to storage
get_file(): Retrieve file metadata
download_file(): Get file contents
delete_file(): Remove file from storage
list_files(): View files with filters
search_files(): Find files by criteria
File Metadata Management
update_file_metadata(): Modify file description/tags
get_file_metadata(): Retrieve file context
add_file_tags(): Add classification tags
56
remove_file_tags(): Delete tags from file
File Access Control
share_file(): Grant access to another user
revoke_file_access(): Remove user access
list_file_shares(): View active file sharing
get_file_access_logs(): View access history
Image Processing
generate_thumbnail(): Create image preview
resize_image(): Modify image dimensions
convert_file_format(): Change file type
4. Determine templates
1. Authentication Service Templates
User Authentication Templates
login.html: User login form
register.html: New user registration form
forgot_password.html: Password reset request form
reset_password.html: New password creation form
two_factor_auth.html: Two-factor authentication verification
User Profile Templates
user_profile.html: User profile information display and edit
change_password.html: Password change form
Role Management Templates
role_list.html: Display available roles
role_details.html: Show role permissions
assign_role.html: Assign role to user
2. Patient Service Templates
Patient Profile Templates
patient_registration.html: New patient registration form
57
patient_profile.html: Patient information display and edit
patient_dashboard.html: Patient portal homepage
emergency_contacts.html: Emergency contact management
Medical Records Templates
medical_history.html: View and manage medical history
allergy_list.html: View and manage allergies
vaccination_history.html: Immunization record
vital_signs.html: Historical vital signs display
Patient Portal Templates
patient_appointments.html: View upcoming and past appointments
patient_prescriptions.html: View active and past prescriptions
patient_lab_results.html: View test results
patient_invoices.html: View billing and payment history
3. Doctor Service Templates
Doctor Profile Templates
doctor_registration.html: New doctor registration form
doctor_profile.html: Doctor information display and edit
doctor_dashboard.html: Doctor portal homepage
doctor_availability.html: Set working hours and availability
Patient Management Templates
doctor_patient_list.html: View patients under doctor's care
patient_details_view.html: Comprehensive patient information
patient_search.html: Find patients by criteria
Appointment Templates
doctor_appointment_calendar.html: Calendar view of scheduled appointments
appointment_details.html: Details of a specific appointment
past_appointments.html: History of previous appointments
Review Templates
doctor_reviews.html: Display doctor ratings and reviews
doctor_statistics.html: Performance metrics and statistics
4. Appointment Service Templates
Appointment Booking Templates
58
specialty_selection.html: Choose medical specialty
doctor_selection.html: Choose doctor within specialty
timeslot_selection.html: Select available appointment time
appointment_form.html: Enter appointment details
appointment_confirmation.html: Confirm booking details
Appointment Management Templates
appointment_list.html: View all appointments with filters
appointment_details.html: View/edit specific appointment
reschedule_appointment.html: Change appointment time
cancel_appointment.html: Cancel with reason
Calendar Templates
calendar_day_view.html: Single day appointment view
calendar_week_view.html: Weekly appointment calendar
calendar_month_view.html: Monthly appointment overview
5. Prescription Service Templates
Prescription Creation Templates
new_prescription.html: Create new prescription form
medication_selection.html: Select medications to prescribe
medication_details.html: Specify dosage and instructions
Prescription Management Templates
prescription_list.html: View all prescriptions with filters
prescription_details.html: View/edit specific prescription
renew_prescription.html: Create renewal form
Patient Prescription Templates
patient_current_prescriptions.html: Active medications
patient_medication_history.html: Past medications
prescription_instructions.html: Detailed usage instructions
6. Pharmacy Service Templates
Pharmacy Profile Templates
pharmacy_registration.html: New pharmacy registration form
pharmacy_profile.html: Pharmacy information display and edit
pharmacy_dashboard.html: Pharmacy portal homepage
Inventory Management Templates
59
inventory_list.html: View medication inventory
add_medication.html: Add new medication to inventory
medication_details.html: View/edit medication information
inventory_adjustments.html: Update stock quantities
low_stock_alerts.html: View medications needing restock
expiring_medications.html: View medications near expiration
Prescription Processing Templates
pending_prescriptions.html: View prescriptions to be processed
process_prescription.html: Process individual prescription
dispensed_prescriptions.html: View completed prescriptions
prescription_verification.html: Verify prescription authenticity
dispensing_form.html: Record medication dispensing details
pickup_confirmation.html: Confirm medication pickup
Reports Templates
dispensing_summary.html: Daily/weekly dispensing activity
inventory_report.html: Current inventory status
7. Laboratory Service Templates
Laboratory Profile Templates
laboratory_registration.html: New lab registration form
laboratory_profile.html: Lab information display and edit
laboratory_dashboard.html: Lab portal homepage
Test Management Templates
test_type_list.html: View available test types
test_type_details.html: View/edit test specifications
add_test_type.html: Add new test to offerings
Test Order Templates
pending_test_orders.html: View ordered tests awaiting processing
test_order_details.html: View detailed test request
sample_collection.html: Record sample collection
test_order_status.html: View test processing status
Result Entry Templates
result_entry_form.html: Enter test results
result_review.html: Review entered results
result_verification.html: Approve results by supervisor
abnormal_results.html: Flag results requiring attention
Result Reporting Templates
60
test_result_details.html: View complete test results
test_result_pdf.html: Printable test result report
patient_result_history.html: Historical test results by patient
8. Billing Service Templates
Invoice Management Templates
invoice_creation.html: Generate new invoice form
invoice_list.html: View all invoices with filters
invoice_details.html: View/edit specific invoice
add_invoice_item.html: Add service/item to invoice
invoice_pdf.html: Printable invoice
Payment Management Templates
payment_processing.html: Record payment form
payment_list.html: View payment history
payment_details.html: View specific payment
refund_processing.html: Process refund form
payment_receipt.html: Generate payment receipt
Insurance Claim Templates
claim_submission.html: Submit insurance claim form
claim_status.html: Track claim processing status
claim_details.html: View claim information
claims_list.html: View all claims with filters
Financial Dashboard Templates
billing_dashboard.html: Overview of financial metrics
revenue_summary.html: Income analytics view
outstanding_invoices.html: Unpaid invoices report
9. Insurance Service Templates
Insurance Provider Templates
provider_registration.html: Add insurance provider form
provider_details.html: Provider information display
provider_list.html: View all insurance providers
Policy Management Templates
policy_creation.html: Create new policy form
policy_details.html: Policy information display
policy_list.html: View all policies with filters
61
coverage_details.html: Display coverage specifications
coverage_verification.html: Verify service coverage form
policy_renewal.html: Renew expiring policy form
Claim Processing Templates
claims_dashboard.html: Claims processing overview
pending_claims.html: View claims awaiting processing
claim_processing.html: Review and decide on claim form
claim_approval.html: Approve claim with payment amount
claim_rejection.html: Reject claim with reason
processed_claims.html: View completed claims
Analytics Templates
claims_analytics.html: Claims processing statistics
coverage_utilization.html: Coverage usage analysis
expiring_policies.html: Soon-expiring policies list
10. Notification Service Templates
Notification Management Templates
notification_center.html: Central notification dashboard
notification_list.html: View all notifications with filters
notification_details.html: View specific notification
notification_preferences.html: Set notification channel preferences
create_notification.html: Create manual notification form
Notification Display Templates
notification_toast.html: Real-time popup notification
notification_badge.html: Unread notification count indicator
notification_dropdown.html: Quick access notification list
email_notification_template.html: Email message layout
sms_notification_template.html: Text message format
Batch Notification Templates
batch_notification_form.html: Send to multiple recipients
schedule_notification.html: Schedule future notification
notification_schedule_list.html: View scheduled notifications
11. Reporting Service Templates
Report Template Management
report_template_list.html: View available report templates
62
report_template_creation.html: Create new report definition
report_template_editor.html: Configure report parameters and layout
Report Generation Templates
report_parameters.html: Enter report generation criteria
report_generation_status.html: View processing progress
report_viewer.html: Display generated report
report_download_options.html: Export format selection
Report Scheduling Templates
schedule_report.html: Create recurring report schedule
report_schedule_list.html: View active schedules
schedule_details.html: Modify schedule parameters
scheduled_reports_history.html: View previously generated reports
Analytics Dashboard Templates
analytics_dashboard.html: Visual analytics overview
custom_report_builder.html: Interactive report creation tool
data_visualization.html: Charts and graphs generation
12. File Storage Service Templates
File Management Templates
file_upload.html: Add new file form
file_list.html: View files with filters and search
file_details.html: View file metadata and options
file_viewer.html: Preview file contents
edit_file_metadata.html: Update file description/tags
File Sharing Templates
share_file.html: Grant access to other users form
shared_files_list.html: View active file sharing
file_access_log.html: View file access history
file_permissions.html: Manage access control
Image Management Templates
image_viewer.html: Enhanced image viewing interface
image_editor.html: Basic image manipulation tools
medical_imaging.html: Specialized medical image viewer
document_viewer.html: PDF and document viewer
63
5. Determine REST API connecting
services
1. Authentication Service API
Base URL: /api/v1/auth/
User Authentication
POST /login: Authenticate user and return JWT token
POST /logout: Invalidate user token
POST /refresh: Refresh access token
POST /register: Register new user
POST /password-reset: Request password reset
POST /password-reset/confirm: Confirm password reset
GET /verify-token: Validate token and return user info
User Management
GET /users/{user_id}: Get user information
PUT /users/{user_id}: Update user information
GET /users: List users with filters
PATCH /users/{user_id}/status: Update user status
Role Management
GET /roles: List available roles
GET /roles/{role_id}/permissions: List permissions for role
POST /users/{user_id}/roles: Assign role to user
GET /users/{user_id}/permissions: Get user permissions
2. Patient Service API
Base URL: /api/v1/patients/
Patient Profiles
POST /profiles: Create patient profile
GET /profiles/{patient_id}: Get patient profile
64
PUT /profiles/{patient_id}: Update patient profile
PATCH /profiles/{patient_id}/status: Update patient status
Medical Records
POST /profiles/{patient_id}/medical-history: Add medical history record
GET /profiles/{patient_id}/medical-history: Get patient's medical history
PUT /profiles/{patient_id}/medical-history/{record_id}: Update record
Allergies
POST /profiles/{patient_id}/allergies: Add allergy
GET /profiles/{patient_id}/allergies: List patient allergies
PUT /profiles/{patient_id}/allergies/{allergy_id}: Update allergy
Patient Portal Data
GET /profiles/{patient_id}/appointments: Get patient appointments
GET /profiles/{patient_id}/prescriptions: Get patient prescriptions
GET /profiles/{patient_id}/lab-results: Get patient lab results
GET /profiles/{patient_id}/invoices: Get patient invoices
3. Doctor Service API
Base URL: /api/v1/doctors/
Doctor Profiles
POST /profiles: Create doctor profile
GET /profiles/{doctor_id}: Get doctor profile
PUT /profiles/{doctor_id}: Update doctor profile
GET /profiles: List doctors with filters
GET /specializations/{specialization_id}/doctors: Get doctors by
specialization
Availability
POST /profiles/{doctor_id}/availability: Set doctor availability
GET /profiles/{doctor_id}/availability: Get doctor availability
PUT /profiles/{doctor_id}/availability/{availability_id}: Update availability
65
POST /profiles/{doctor_id}/leave: Schedule leave period
Doctor Dashboard
GET /profiles/{doctor_id}/appointments: Get doctor appointments
GET /profiles/{doctor_id}/patients: Get doctor's patients
GET /profiles/{doctor_id}/reviews: Get doctor reviews
GET /profiles/{doctor_id}/rating: Get doctor rating
4. Appointment Service API
Base URL: /api/v1/appointments/
Appointment Management
POST /: Create new appointment
GET /{appointment_id}: Get appointment details
PUT /{appointment_id}: Update appointment
PATCH /{appointment_id}/status: Update appointment status
GET /: List appointments with filters
DELETE /{appointment_id}: Cancel appointment
Time Slot Management
GET /doctors/{doctor_id}/time-slots: Get available slots for doctor
GET /time-slots: Get available slots with filters
POST /time-slots: Create time slot
PATCH /time-slots/{slot_id}: Update time slot availability
Appointment Data
GET /doctors/{doctor_id}/schedule: Get doctor's schedule
GET /patients/{patient_id}/appointments: Get patient's appointments
GET /statistics: Get appointment statistics
5. Prescription Service API
Base URL: /api/v1/prescriptions/
Prescription Management
66
POST /: Create prescription
GET /{prescription_id}: Get prescription details
PUT /{prescription_id}: Update prescription
PATCH /{prescription_id}/status: Update prescription status
GET /: List prescriptions with filters
Medication Management
POST /{prescription_id}/medications: Add medication to prescription
PUT /{prescription_id}/medications/{medication_id}: Update medication
DELETE /{prescription_id}/medications/{medication_id}: Remove
medication
GET /{prescription_id}/medications: List medications in prescription
Prescription Data
GET /doctors/{doctor_id}/prescriptions: Get doctor's prescriptions
GET /patients/{patient_id}/prescriptions: Get patient's prescriptions
GET /patients/{patient_id}/active-medications: Get active medications
6. Pharmacy Service API
Base URL: /api/v1/pharmacy/
Pharmacy Profiles
POST /profiles: Create pharmacy profile
GET /profiles/{pharmacy_id}: Get pharmacy profile
PUT /profiles/{pharmacy_id}: Update pharmacy profile
GET /profiles: List pharmacies with filters
Medication Inventory
POST /inventory: Add medication to inventory
GET /inventory: List inventory with filters
GET /inventory/{inventory_id}: Get inventory item
PUT /inventory/{inventory_id}: Update inventory item
PATCH /inventory/{inventory_id}/stock: Update stock quantity
67
Prescription Processing
POST /prescriptions/{prescription_id}/process: Begin processing
prescription
GET /prescriptions/{prescription_id}/status: Check prescription status
PATCH /prescriptions/{prescription_id}/status: Update processing status
GET /prescriptions/pending: List pending prescriptions
POST /prescriptions/{prescription_id}/dispense: Mark prescription as
dispensed
POST /prescriptions/{prescription_id}/reject: Reject prescription
Inventory Checks
GET /medications/{medication_name}/availability: Check if medication
available
GET /inventory/low-stock: Get low stock items
GET /inventory/expiring: Get soon-expiring medications
7. Laboratory Service API
Base URL: /api/v1/laboratory/
Laboratory Profiles
POST /profiles: Create laboratory profile
GET /profiles/{lab_id}: Get laboratory profile
PUT /profiles/{lab_id}: Update laboratory profile
GET /profiles: List laboratories with filters
Test Management
POST /test-types: Add test type
GET /test-types: List available tests
GET /test-types/{test_id}: Get test details
PUT /test-types/{test_id}: Update test details
Test Orders
POST /test-orders: Create test order
68
GET /test-orders/{order_id}: Get order details
PUT /test-orders/{order_id}: Update test order
PATCH /test-orders/{order_id}/status: Update order status
GET /test-orders: List test orders with filters
Test Results
POST /test-orders/{order_id}/results: Record test results
GET /test-orders/{order_id}/results: Get test results
PUT /test-orders/{order_id}/results: Update test results
PATCH /test-orders/{order_id}/results/verification: Verify test results
GET /patients/{patient_id}/test-results: Get patient's test results
8. Billing Service API
Base URL: /api/v1/billing/
Invoice Management
POST /invoices: Create invoice
GET /invoices/{invoice_id}: Get invoice details
PUT /invoices/{invoice_id}: Update invoice
PATCH /invoices/{invoice_id}/status: Update invoice status
GET /invoices: List invoices with filters
GET /invoices/{invoice_id}/pdf: Generate invoice PDF
Invoice Items
POST /invoices/{invoice_id}/items: Add invoice item
PUT /invoices/{invoice_id}/items/{item_id}: Update invoice item
DELETE /invoices/{invoice_id}/items/{item_id}: Remove invoice item
GET /invoices/{invoice_id}/items: List invoice items
Payment Processing
POST /payments: Process payment
GET /payments/{payment_id}: Get payment details
POST /payments/{payment_id}/refund: Process refund
69
GET /payments: List payments with filters
GET /invoices/{invoice_id}/payments: Get invoice payments
Insurance Claims
POST /claims: Create insurance claim
GET /claims/{claim_id}: Get claim details
PATCH /claims/{claim_id}/status: Update claim status
GET /claims: List claims with filters
GET /invoices/{invoice_id}/claim: Get invoice claim
9. Insurance Service API
Base URL: /api/v1/insurance/
Provider Management
POST /providers: Create insurance provider
GET /providers/{provider_id}: Get provider details
PUT /providers/{provider_id}: Update provider
GET /providers: List providers with filters
Policy Management
POST /policies: Create insurance policy
GET /policies/{policy_id}: Get policy details
PUT /policies/{policy_id}: Update policy
PATCH /policies/{policy_id}/status: Update policy status
GET /patients/{patient_id}/policies: Get patient's policies
Coverage Management
POST /policies/{policy_id}/coverage: Set coverage details
GET /policies/{policy_id}/coverage: Get coverage details
PUT /policies/{policy_id}/coverage: Update coverage
GET /policies/{policy_id}/coverage/{service_type}: Check service coverage
Claim Processing
POST /claims/{claim_id}/process: Begin claim processing
70
GET /claims/{claim_id}: Get claim details
PATCH /claims/{claim_id}/status: Update claim status
POST /claims/{claim_id}/approve: Approve claim with amount
POST /claims/{claim_id}/reject: Reject claim with reason
GET /claims/pending: List pending claims
10. Notification Service API
Base URL: /api/v1/notifications/
Notification Management
POST /: Create notification
GET /{notification_id}: Get notification details
PATCH /{notification_id}/read: Mark notification as read
DELETE /{notification_id}: Delete notification
GET /: List notifications with filters
User Preferences
GET /users/{user_id}/preferences: Get notification preferences
PUT /users/{user_id}/preferences: Update notification preferences
PATCH /users/{user_id}/channels/{channel}: Enable/disable channel
Sending Methods
POST /email: Send email notification
POST /sms: Send SMS notification
POST /push: Send push notification
POST /batch: Send batch notification
POST /scheduled: Schedule future notification
DELETE /scheduled/{notification_id}: Cancel scheduled notification
Status Tracking
GET /{notification_id}/status: Check notification delivery status
GET /users/{user_id}/unread-count: Get unread notification count
71
11. Reporting Service API
Base URL: /api/v1/reports/
Report Templates
POST /templates: Create report template
GET /templates/{template_id}: Get template details
PUT /templates/{template_id}: Update report template
DELETE /templates/{template_id}: Delete report template
GET /templates: List report templates
Report Generation
POST /generate: Generate new report
GET /reports/{report_id}: Get report details
GET /reports/{report_id}/status: Check generation status
GET /reports/{report_id}/download: Download report file
GET /reports: List generated reports
Report Scheduling
POST /schedules: Create report schedule
GET /schedules/{schedule_id}: Get schedule details
PUT /schedules/{schedule_id}: Update report schedule
DELETE /schedules/{schedule_id}: Delete report schedule
GET /schedules: List report schedules
PATCH /schedules/{schedule_id}/status: Pause/resume schedule
Data Sources
GET /data-sources: List available data sources
POST /data-sources/test: Test data source connection
GET /data-sources/{source_id}/fields: Get available data fields
12. File Storage Service API
Base URL: /api/v1/files/
File Management
72
POST /upload: Upload new file
GET /{file_id}: Get file metadata
GET /{file_id}/download: Download file
DELETE /{file_id}: Delete file
GET /: List files with filters
File Metadata
PUT /{file_id}/metadata: Update file metadata
GET /{file_id}/metadata: Get file metadata
POST /{file_id}/tags: Add file tags
DELETE /{file_id}/tags/{tag}: Remove file tag
File Sharing
POST /{file_id}/share: Share file with user
DELETE /{file_id}/share/{user_id}: Revoke user access
GET /{file_id}/shares: List file shares
GET /{file_id}/access-logs: View access history
Image Processing
GET /{file_id}/thumbnail: Generate image thumbnail
POST /{file_id}/resize: Resize image
POST /{file_id}/convert: Convert file format
III. Conclusion
73
CHAPTER 2: DESIGN HEALTH-CARE SYSTEM WITH
MICROSERVICES AND DJANGO
I. Design services/components
Relation between services:
- Patient Service
+ Authentication Service
+ Doctor Service: to schedule an appointment, see list
doctors
+ EHR Service: To access medical history
+ Appointment Service: To book/cancel appointments
+ Prescription Service: To view prescriptions
+ Billing Service: For paying medical bills
+ Notification Service: For appointment reminders, test
results
- Doctor Service
+ Appointment Service: Manages their availability and
appointments
+ Patient Service: retrieve patient’s medical history,retrieve
contact information for communication
74
+ EHR Service: Reads patient history, adds diagnosis
+ Prescription Service: Writes prescriptions
+ Laboratory Service: Orders tests
+ Notification Service: Notifies patients about follow-ups or
test requests
- Appointment Service
+ Patient Service: For booking/canceling appointments
+ Doctor Service: For checking availability
+ Notification Service: Sends reminders to patients and
doctors
- EHR Service
+ Patient Service: Allows patients to view records
+ Doctor Service: Doctors update diagnosis, notes
+ Laboratory Service: Stores test results
+ Prescription Service: Stores prescribed treatments
+ Admin Service: For access control and audit
- Prescription Service
+ Doctor Service: Creates prescription
+ Patient Service: Lets patients view them
+ Pharmacy Service: Validates and fulfills prescriptions
+ EHR Service: Updates prescription history
+ Billing Service: Calculates costs
+ Notification Service: Notifies patient prescription is ready
- Billing Service
+ Patient Service: Displays bills
+ Pharmacy Service: Adds prescription cost
+ Laboratory Service: Adds lab test costs
+ Appointment Service: Adds consultation fees
+ Notification Service: notification billing status
75
- Pharmacy Service
+ Prescription Service: Verifies prescription
+ Billing Service: Sends cost details
+ EHR Service: Updates dispensed drugs
+ Notification Service: Informs patient about ready meds
- Laboratory Service
+ Doctor Service: Receives test orders
+ EHR Service: Uploads test results
+ Billing Service: Charges for tests
+ Notification Service: Alerts patients and doctors
- Notification Service
+ All services (Patient, Doctor, Appointment, Lab,
Pharmacy, etc.): Sends alerts, confirmations, updates via SMS/email
- Admin Service
+ All services: Manages user roles, permissions, system
configurations, and logs
76
II. Design classes and methods in component
1. Patient
2. Doctor
77
3. Appointment
4. EHR
78
5. Prescription
6. Bill
7. Laboratory
III. Design API
1. API Gateway
79
Function: Acts as the central point of entry for all client requests. Routes
requests to appropriate services and handles load balancing, security, and
authentication.
Endpoints:
o /auth (POST) - Handles authentication requests.
o /api/v1/{service} (GET/POST/PUT/DELETE) - Routes requests to
specific services (e.g., /api/v1/doctor, /api/v1/patient).
2. Auth Service
Function: Manages user authentication and session management for patients,
doctors, administrators, and other users.
Endpoints:
o /login (POST) - User login.
o /register (POST) - New user registration.
o /logout (POST) - Log out a user.
o /refresh (POST) - Refresh access tokens for session management.
3. Doctor Service
Function: Manages doctor-specific functionalities such as scheduling
appointments, viewing patient data, and writing prescriptions.
Endpoints:
o /appointments (GET/POST) - Retrieve and schedule appointments.
o /patients (GET) - Access patient history.
o /prescriptions (POST) - Write prescriptions.
o /reports (GET) - Access and write medical reports.
4. Patient Service
Function: Allows patients to manage their health information, book
appointments, and view test results.
Endpoints:
o /appointments (GET/POST) - Book/cancel appointments.
o /medical-records (GET) - View medical records.
o /bills (GET) - View and pay medical bills.
80
o /test-reports (GET) - View lab test results.
5. Laboratory Service
Function: Manages lab test requests and results.
Endpoints:
o /tests (POST) - Order lab tests.
o /results (GET) - Retrieve lab results.
o /notify (POST) - Notify doctors and patients of test results.
6. Billing Service
Function: Handles medical billing, insurance, and payments.
Endpoints:
o /invoices (GET) - Retrieve billing invoices.
o /insurance-claims (POST) - Process insurance claims.
o /payments (POST) - Make payments for services.
7. EHR (Electronic Health Record) Service
Function: Manages electronic health records for patients.
Endpoints:
o /records (GET) - Retrieve patient medical records.
o /update-record (PUT) - Update patient records.
8. Appointment Service
Function: Manages appointment scheduling and notifications.
Endpoints:
o /appointments (GET/POST) - Book or cancel appointments.
o /reminders (POST) - Send appointment reminders.
9. Notification Service
Function: Sends notifications related to appointments, prescriptions, test
results, and more.
Endpoints:
o /send (POST) - Send notifications to patients, doctors, or staff.
o /notifications (GET) - Retrieve sent notifications.
81
10. Prescription Service
Function: Handles the prescription generation and management.
Endpoints:
o /prescriptions (POST) - Generate new prescriptions.
o /view (GET) - View prescriptions for patients.
11. Pharmacy Service
Function: Manages pharmacy inventory, prescription fulfillment, and
medication dispensing.
Endpoints:
o /medications (GET) - Retrieve list of available medications.
o /dispense (POST) - Dispense medications based on prescriptions.
o /inventory (GET) - Check inventory levels for medications.
Inter-Service Communication (API REST)
The services communicate with each other using RESTful APIs, with each
component making requests to other services as needed:
o For example, the Doctor Service might call the Lab Service to order a
lab test and then retrieve the results from the Laboratory Service.
o The Patient Service might use the Billing Service to retrieve medical
bills or insurance claims, while the Pharmacy Service will interface
with the Prescription Service to fulfill medications.
IV. Design Database
1. User Table (for Patients, Doctors, Administrators, and Staff)
This table stores general user information, such as login credentials and role (patient,
doctor, admin, etc.).
Table: users
Field Type Description
Primary Key, Unique
user_id INT
identifier for each user
username VARCHAR(255) Username for login
password_hash VARCHAR(255) Hashed password for
82
Field Type Description
security
ENUM('patient', 'doctor', 'admin', 'nurse',
Role of the user in the
role 'pharmacist', 'insurance_provider',
system
'lab_technician')
email VARCHAR(255) User's email address
first_name VARCHAR(100) User's first name
last_name VARCHAR(100) User's last name
phone_number VARCHAR(15) User's phone number
Date and time when the
created_at TIMESTAMP
user was created
Date and time when the
updated_at TIMESTAMP user information was last
updated
2. Patient Table
This table stores specific information about patients.
Table: patients
Field Type Description
patient_id INT Primary Key, Unique identifier for each patient
user_id INT Foreign Key from users table
dob DATE Date of birth
address TEXT Patient's address
insurance_id INT Foreign Key to the insurance details
emergency_contact VARCHAR(255) Emergency contact details
3. Doctor Table
This table stores information about doctors, including specialties and availability.
Table: doctors
83
Field Type Description
doctor_id INT Primary Key, Unique identifier for each doctor
user_id INT Foreign Key from users table
specialty VARCHAR(255) Doctor's medical specialty
available_from TIME Doctor's working hours start time
available_to TIME Doctor's working hours end time
4. Appointment Table
This table stores information about appointments between patients and doctors.
Table: appointments
Field Type Description
Primary Key, Unique identifier for
appointment_id INT
each appointment
patient_id INT Foreign Key from patients table
doctor_id INT Foreign Key from doctors table
appointment_time DATETIME Date and time of the appointment
ENUM('pending', 'completed',
status Status of the appointment
'canceled')
Date and time when the
created_at TIMESTAMP
appointment was created
Date and time when the
updated_at TIMESTAMP
appointment was last updated
5. Prescription Table
This table tracks prescriptions written by doctors for patients.
Table: prescriptions
Field Type Description
prescription_id INT Primary Key, Unique identifier for each prescription
84
Field Type Description
patient_id INT Foreign Key from patients table
doctor_id INT Foreign Key from doctors table
medication VARCHAR(255) Name of the prescribed medication
dosage VARCHAR(255) Dosage instructions
start_date DATE Prescription start date
end_date DATE Prescription end date
created_at TIMESTAMP Date and time when the prescription was written
Date and time when the prescription was last
updated_at TIMESTAMP
updated
6. Billing Table
This table stores billing information related to patient services.
Table: billing
Field Type Description
Primary Key, Unique identifier for
bill_id INT
each bill
patient_id INT Foreign Key from patients table
amount DECIMAL(10, 2) Total amount for the medical services
insurance_claim DECIMAL(10, 2) Amount covered by insurance
paid_amount DECIMAL(10, 2) Amount paid by the patient
ENUM('unpaid', 'paid',
bill_status Status of the bill
'pending')
Date and time when the bill was
created_at TIMESTAMP
created
Date and time when the bill was last
updated_at TIMESTAMP
updated
7. Lab Test Table
85
This table stores information about medical lab tests ordered for patients.
Table: lab_tests
Field Type Description
test_id INT Primary Key, Unique identifier for each test
patient_id INT Foreign Key from patients table
test_type VARCHAR(255) Type of medical test
test_date DATETIME Date and time when the test was conducted
result TEXT Results of the test
ENUM('pending',
status Status of the test
'completed')
Foreign Key from doctors table (doctor who
doctor_id INT
ordered the test)
8. Notification Table
This table stores notifications sent to patients and doctors.
Table: notifications
Field Type Description
Primary Key, Unique identifier
notification_id INT
for each notification
user_id INT Foreign Key from users table
message TEXT The content of the notification
ENUM('appointment', 'prescription',
type Type of notification
'lab_result', 'billing')
status ENUM('sent', 'read') Status of the notification
Date and time when the
created_at TIMESTAMP
notification was created
9. Insurance Table
This table tracks patient insurance details.
86
Table: insurance
Field Type Description
Primary Key, Unique identifier for
insurance_id INT
each insurance
patient_id INT Foreign Key from patients table
provider_name VARCHAR(255) Name of the insurance provider
policy_number VARCHAR(255) Insurance policy number
coverage_type VARCHAR(255) Type of insurance coverage
start_date DATE Insurance start date
end_date DATE Insurance end date
ENUM('active', 'expired',
status Insurance status
'pending')
Relationships
1. Users and Patients: One-to-one relationship (Each user can be a patient).
2. Users and Doctors: One-to-one relationship (Each user can be a doctor).
3. Patients and Appointments: One-to-many relationship (A patient can have
many appointments).
4. Doctors and Appointments: One-to-many relationship (A doctor can have
many appointments).
5. Patients and Prescriptions: One-to-many relationship (A patient can have
many prescriptions).
6. Doctors and Prescriptions: One-to-many relationship (A doctor can prescribe
many medications).
7. Patients and Lab Tests: One-to-many relationship (A patient can have many
lab tests).
8. Doctors and Lab Tests: One-to-many relationship (A doctor can order many
lab tests).
9. Patients and Billing: One-to-many relationship (A patient can have multiple
bills).
87
10. Patients and Notifications: One-to-many relationship (A patient can receive
many notifications).
11. Patients and Insurance: One-to-one relationship (A patient can have one
insurance record).
V. Conclusion
88