# danish-zaman-khan/opdpro_application architecture

> Architecture diagram of the GitHub repository danish-zaman-khan/opdpro_application, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-13). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/danish-zaman-khan/opdpro_application
- Repository: https://github.com/danish-zaman-khan/opdpro_application

## Overview

OPDPro is a local outpatient-clinic management application: staff use its Django interface to register patients, book and document visits, then manage prescriptions, reports, and invoices. The Windows launcher initializes the local server and provides first-run administrator setup plus backup/restore controls; an optional Android WebView client is documented as requiring a separately deployed HTTPS backend. The graph preserves the README’s principal clinical and administrative areas. Edges reflect calls or model references shown in excerpts or documented setup; unshown routes and wiring are intentionally not inferred.

Main entry points: [`billing/views.py`](https://github.com/danish-zaman-khan/opdpro_application/blob/main/billing/views.py) (Invoices and payments), [`desktop_launcher.py`](https://github.com/danish-zaman-khan/opdpro_application/blob/main/desktop_launcher.py) (Desktop launcher), [`appointment/models.py`](https://github.com/danish-zaman-khan/opdpro_application/blob/main/appointment/models.py) (Visit records), [`patients/models.py`](https://github.com/danish-zaman-khan/opdpro_application/blob/main/patients/models.py) (Patient profiles)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Local runtime"]
  node_desktop["Desktop launcher"]
  node_local_data["Local data and backups<br/>[local_data.py]"]
  node_android["Android WebView<br/>[MainActivity.kt]"]
end

subgraph group_identity["Clinic staff and patients"]
  node_staff[("Staff accounts<br/>[models.py]")]
  node_staff_admin["Staff administration<br/>[admin.py]"]
  node_patient_views["Patient records<br/>[views.py]"]
  node_patients[("Patient profiles<br/>[models.py]")]
  node_doctors["Doctor profiles<br/>[forms.py]"]
end

subgraph group_care["Visit care"]
  node_appointments["Appointments<br/>[views.py]"]
  node_appointment_data[("Visit records<br/>[models.py]")]
  node_prescriptions["Prescriptions<br/>[views.py]"]
  node_prescription_data[("Prescription catalogue<br/>[models.py]")]
  node_reports["Lab and imaging reports<br/>[views.py]"]
  node_report_data[("Report records<br/>[models.py]")]
end

subgraph group_operations["Clinic operations"]
  node_billing["Invoices and payments<br/>[views.py]"]
  node_billing_data[("Billing records<br/>[models.py]")]
  node_clinic_settings[("Clinic configuration<br/>[models.py]")]
  node_notifications["Staff notifications"]
  node_notification_data[("Notification records<br/>[models.py]")]
end

node_staff_actor(("Clinic staff"))
node_clinic_admin(("Clinic administrator"))
node_patient_actor(("Patient"))
node_local_store[("Local clinic database")]
node_windows_user(("Windows user"))
node_https_backend["HTTPS backend"]

node_clinic_admin -->|"sets up"| node_desktop
node_desktop -->|"creates admin"| node_staff
node_desktop -.->|"configures paths"| node_local_data
node_desktop -->|"initializes"| node_local_store
node_local_data -.->|"stores clinic data"| node_local_store
node_windows_user -->|"opens"| node_desktop
node_staff_actor -->|"manages accounts"| node_staff_admin
node_staff_admin -->|"manages"| node_staff
node_patient_actor -->|"registers"| node_patient_views
node_patient_views -->|"reads and writes"| node_patients
node_staff_actor -->|"books visits"| node_appointments
node_appointments -->|"reads and writes"| node_appointment_data
node_appointment_data -->|"references patient"| node_patients
node_doctors -->|"edits profile"| node_staff
node_staff_actor -->|"creates and dispenses"| node_prescriptions
node_prescriptions -->|"reads and writes"| node_prescription_data
node_prescriptions -->|"selects patient"| node_patients
node_prescriptions -->|"links visit"| node_appointment_data
node_staff_actor -->|"uploads and reviews"| node_reports
node_reports -->|"reads and writes"| node_report_data
node_reports -->|"selects patient"| node_patients
node_reports -->|"links visit"| node_appointment_data
node_staff_actor -->|"manages billing"| node_billing
node_billing -->|"reads and writes"| node_billing_data
node_billing -->|"selects patient"| node_patients
node_billing -->|"links visit"| node_appointment_data
node_billing -->|"reads configuration"| node_clinic_settings
node_staff_actor -.->|"views alerts"| node_notifications
node_notifications -->|"queries unread"| node_notification_data
node_android -.->|"connects to"| node_https_backend

click node_staff "https://github.com/danish-zaman-khan/opdpro_application/blob/main/usermanagement/models.py"
click node_staff_admin "https://github.com/danish-zaman-khan/opdpro_application/blob/main/usermanagement/admin.py"
click node_patient_views "https://github.com/danish-zaman-khan/opdpro_application/blob/main/patients/views.py"
click node_patients "https://github.com/danish-zaman-khan/opdpro_application/blob/main/patients/models.py"
click node_appointments "https://github.com/danish-zaman-khan/opdpro_application/blob/main/appointment/views.py"
click node_appointment_data "https://github.com/danish-zaman-khan/opdpro_application/blob/main/appointment/models.py"
click node_doctors "https://github.com/danish-zaman-khan/opdpro_application/blob/main/doctors/forms.py"
click node_prescriptions "https://github.com/danish-zaman-khan/opdpro_application/blob/main/prescriptions/views.py"
click node_prescription_data "https://github.com/danish-zaman-khan/opdpro_application/blob/main/prescriptions/models.py"
click node_reports "https://github.com/danish-zaman-khan/opdpro_application/blob/main/reports/views.py"
click node_report_data "https://github.com/danish-zaman-khan/opdpro_application/blob/main/reports/models.py"
click node_billing "https://github.com/danish-zaman-khan/opdpro_application/blob/main/billing/views.py"
click node_billing_data "https://github.com/danish-zaman-khan/opdpro_application/blob/main/billing/models.py"
click node_clinic_settings "https://github.com/danish-zaman-khan/opdpro_application/blob/main/settings/models.py"
click node_notifications "https://github.com/danish-zaman-khan/opdpro_application/blob/main/user_notifications/context_processors.py"
click node_notification_data "https://github.com/danish-zaman-khan/opdpro_application/blob/main/user_notifications/models.py"
click node_desktop "https://github.com/danish-zaman-khan/opdpro_application/blob/main/desktop_launcher.py"
click node_local_data "https://github.com/danish-zaman-khan/opdpro_application/blob/main/local_data.py"
click node_android "https://github.com/danish-zaman-khan/opdpro_application/blob/main/android/app/src/main/java/com/opdpro/mobile/MainActivity.kt"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_desktop,node_local_data,node_android,node_windows_user toneBlue
class node_staff,node_staff_admin,node_patient_views,node_patients,node_doctors,node_local_store toneAmber
class node_appointments,node_appointment_data,node_prescriptions,node_prescription_data,node_reports,node_report_data toneMint
class node_billing,node_billing_data,node_clinic_settings,node_notifications,node_notification_data toneRose
class node_staff_actor,node_clinic_admin,node_patient_actor,node_https_backend toneIndigo
```

## Components

### Local runtime

- [Desktop launcher](https://github.com/danish-zaman-khan/opdpro_application/blob/main/desktop_launcher.py): `desktop_launcher.py`
- [Local data and backups](https://github.com/danish-zaman-khan/opdpro_application/blob/main/local_data.py): `local_data.py`
- [Android WebView](https://github.com/danish-zaman-khan/opdpro_application/blob/main/android/app/src/main/java/com/opdpro/mobile/MainActivity.kt): `android/app/src/main/java/com/opdpro/mobile/MainActivity.kt`

### Clinic staff and patients

- [Staff accounts](https://github.com/danish-zaman-khan/opdpro_application/blob/main/usermanagement/models.py): `usermanagement/models.py`
- [Staff administration](https://github.com/danish-zaman-khan/opdpro_application/blob/main/usermanagement/admin.py): `usermanagement/admin.py`
- [Patient records](https://github.com/danish-zaman-khan/opdpro_application/blob/main/patients/views.py): `patients/views.py`
- [Patient profiles](https://github.com/danish-zaman-khan/opdpro_application/blob/main/patients/models.py): `patients/models.py`
- [Doctor profiles](https://github.com/danish-zaman-khan/opdpro_application/blob/main/doctors/forms.py): `doctors/forms.py`

### Visit care

- [Appointments](https://github.com/danish-zaman-khan/opdpro_application/blob/main/appointment/views.py): `appointment/views.py`
- [Visit records](https://github.com/danish-zaman-khan/opdpro_application/blob/main/appointment/models.py): `appointment/models.py`
- [Prescriptions](https://github.com/danish-zaman-khan/opdpro_application/blob/main/prescriptions/views.py): `prescriptions/views.py`
- [Prescription catalogue](https://github.com/danish-zaman-khan/opdpro_application/blob/main/prescriptions/models.py): `prescriptions/models.py`
- [Lab and imaging reports](https://github.com/danish-zaman-khan/opdpro_application/blob/main/reports/views.py): `reports/views.py`
- [Report records](https://github.com/danish-zaman-khan/opdpro_application/blob/main/reports/models.py): `reports/models.py`

### Clinic operations

- [Invoices and payments](https://github.com/danish-zaman-khan/opdpro_application/blob/main/billing/views.py): `billing/views.py`
- [Billing records](https://github.com/danish-zaman-khan/opdpro_application/blob/main/billing/models.py): `billing/models.py`
- [Clinic configuration](https://github.com/danish-zaman-khan/opdpro_application/blob/main/settings/models.py): `settings/models.py`
- [Staff notifications](https://github.com/danish-zaman-khan/opdpro_application/blob/main/user_notifications/context_processors.py): `user_notifications/context_processors.py`
- [Notification records](https://github.com/danish-zaman-khan/opdpro_application/blob/main/user_notifications/models.py): `user_notifications/models.py`

### Other components

- **Clinic staff**
- **Clinic administrator**
- **Patient**
- **Local clinic database**
- **Windows user**
- **HTTPS backend**

## Connections

- Clinic administrator → Desktop launcher: sets up (evidence: `desktop_launcher.py`)
- Desktop launcher → Staff accounts: creates admin (evidence: `desktop_launcher.py`)
- Desktop launcher → Local data and backups: configures paths (evidence: `desktop_launcher.py`)
- Desktop launcher → Local clinic database: initializes (evidence: `desktop_launcher.py`)
- Local data and backups → Local clinic database: stores clinic data
- Windows user → Desktop launcher: opens (evidence: `README.md`)
- Clinic staff → Staff administration: manages accounts (evidence: `README.md`)
- Staff administration → Staff accounts: manages (evidence: `usermanagement/admin.py`)
- Patient → Patient records: registers (evidence: `patients/views.py`)
- Patient records → Patient profiles: reads and writes (evidence: `patients/views.py`)
- Clinic staff → Appointments: books visits (evidence: `appointment/views.py`)
- Appointments → Visit records: reads and writes (evidence: `appointment/views.py`)
- Visit records → Patient profiles: references patient (evidence: `appointment/models.py`)
- Doctor profiles → Staff accounts: edits profile (evidence: `doctors/forms.py`)
- Clinic staff → Prescriptions: creates and dispenses (evidence: `prescriptions/views.py`)
- Prescriptions → Prescription catalogue: reads and writes (evidence: `prescriptions/views.py`)
- Prescriptions → Patient profiles: selects patient (evidence: `prescriptions/views.py`)
- Prescriptions → Visit records: links visit (evidence: `prescriptions/views.py`)
- Clinic staff → Lab and imaging reports: uploads and reviews (evidence: `reports/views.py`)
- Lab and imaging reports → Report records: reads and writes (evidence: `reports/views.py`)
- Lab and imaging reports → Patient profiles: selects patient (evidence: `reports/views.py`)
- Lab and imaging reports → Visit records: links visit (evidence: `reports/views.py`)
- Clinic staff → Invoices and payments: manages billing (evidence: `billing/views.py`)
- Invoices and payments → Billing records: reads and writes (evidence: `billing/views.py`)
- Invoices and payments → Patient profiles: selects patient (evidence: `billing/views.py`)
- Invoices and payments → Visit records: links visit (evidence: `billing/views.py`)
- Invoices and payments → Clinic configuration: reads configuration (evidence: `billing/views.py`)
- Clinic staff → Staff notifications: views alerts
- Staff notifications → Notification records: queries unread (evidence: `user_notifications/context_processors.py`)
- Android WebView → HTTPS backend: connects to (evidence: `README.md`)
