# bambadiante/medicare architecture

> Architecture diagram of the GitHub repository bambadiante/medicare, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-01). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/bambadiante/medicare
- Repository: https://github.com/bambadiante/medicare

## Overview

Medicare is a Qt desktop hospital-management application. Its visible startup path opens a MySQL connection, requires login, then presents a main window for patient, physician, medication, and consultation workflows. The sampled forms perform SQL directly through the shared Qt SQL connection; no separate persistence layer is evident. The README only names the product, so broader capabilities and some form-to-form links are based on source-index references; unsampled behavior is not assumed.

Main entry points: [`MainWindow.cpp`](https://github.com/bambadiante/medicare/blob/main/MainWindow.cpp) (Main window), [`main.cpp`](https://github.com/bambadiante/medicare/blob/main/main.cpp) (Startup), [`PatientForm.cpp`](https://github.com/bambadiante/medicare/blob/main/PatientForm.cpp) (Patient records), [`MedecinListeForm.cpp`](https://github.com/bambadiante/medicare/blob/main/MedecinListeForm.cpp) (Physician records)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Application shell"]
  node_entry["Startup<br/>[main.cpp]"]
  node_login["Login dialog<br/>[LoginForm.cpp]"]
  node_window["Main window<br/>[MainWindow.cpp]"]
end

subgraph group_people["Patient and physician"]
  node_patienthub["Patient hub<br/>[PatientHubForm.cpp]"]
  node_patientlist["Patient records<br/>[PatientForm.cpp]"]
  node_patientadd["Add patient"]
  node_patientedit["Edit patient"]
  node_medhub["Physician hub<br/>[MedecinHubForm.cpp]"]
  node_medlist["Physician records"]
  node_medadd["Add physician<br/>[MedecinForm.cpp]"]
  node_mededit["Edit physician"]
end

subgraph group_clinical["Consultations"]
  node_consultform["New consultation"]
  node_patienthistory["Patient history"]
  node_physicianhistory["Physician history"]
  node_consultdetail["Consultation details"]
end

subgraph group_meds["Medication"]
  node_medicationhub["Medication hub"]
  node_medicationlist["Medication records"]
  node_medicationadd["Add medication<br/>[MedicamentForm.cpp]"]
  node_medicationedit["Edit medication"]
end

node_operator(("Staff user"))
node_db[("MySQL hospital DB")]

node_operator -->|"starts"| node_entry
node_entry -->|"opens connection"| node_db
node_entry -->|"requires authentication"| node_login
node_login -.->|"authenticates"| node_operator
node_entry -->|"shows after login"| node_window
node_window -->|"routes to"| node_patienthub
node_window -->|"routes to"| node_medhub
node_window -->|"routes to"| node_medicationhub
node_window -->|"routes to"| node_consultform
node_patienthub -->|"opens"| node_patientadd
node_patienthub -->|"opens"| node_patientlist
node_patientlist -->|"reads and deletes"| node_db
node_patientlist -->|"opens history"| node_patienthistory
node_patientlist -->|"opens editor"| node_patientedit
node_patientadd -.->|"writes patient"| node_db
node_patientedit -.->|"updates patient"| node_db
node_medhub -->|"opens"| node_medadd
node_medhub -->|"opens"| node_medlist
node_medlist -->|"reads and deletes"| node_db
node_medlist -->|"opens history"| node_physicianhistory
node_medlist -->|"opens editor"| node_mededit
node_medadd -.->|"writes physician"| node_db
node_mededit -.->|"updates physician"| node_db
node_consultform -->|"loads and saves"| node_db
node_patienthistory -.->|"loads history"| node_db
node_patienthistory -->|"opens details"| node_consultdetail
node_physicianhistory -->|"queries history"| node_db
node_medicationhub -->|"opens"| node_medicationadd
node_medicationhub -->|"opens"| node_medicationlist
node_medicationlist -->|"reads and deletes"| node_db
node_medicationlist -->|"opens editor"| node_medicationedit
node_medicationadd -.->|"writes medication"| node_db
node_medicationedit -.->|"updates medication"| node_db

click node_entry "https://github.com/bambadiante/medicare/blob/main/main.cpp"
click node_login "https://github.com/bambadiante/medicare/blob/main/LoginForm.cpp"
click node_window "https://github.com/bambadiante/medicare/blob/main/MainWindow.cpp"
click node_patienthub "https://github.com/bambadiante/medicare/blob/main/PatientHubForm.cpp"
click node_patientlist "https://github.com/bambadiante/medicare/blob/main/PatientForm.cpp"
click node_patientadd "https://github.com/bambadiante/medicare/blob/main/AjoutPatientForm.cpp"
click node_patientedit "https://github.com/bambadiante/medicare/blob/main/ModifierPatient.cpp"
click node_medhub "https://github.com/bambadiante/medicare/blob/main/MedecinHubForm.cpp"
click node_medlist "https://github.com/bambadiante/medicare/blob/main/MedecinListeForm.cpp"
click node_medadd "https://github.com/bambadiante/medicare/blob/main/MedecinForm.cpp"
click node_mededit "https://github.com/bambadiante/medicare/blob/main/ModifierMedecin.cpp"
click node_consultform "https://github.com/bambadiante/medicare/blob/main/ConsultationForm.cpp"
click node_patienthistory "https://github.com/bambadiante/medicare/blob/main/ConsultationPatient.cpp"
click node_physicianhistory "https://github.com/bambadiante/medicare/blob/main/ConsultationMedecin.cpp"
click node_consultdetail "https://github.com/bambadiante/medicare/blob/main/DetailConsultation.cpp"
click node_medicationhub "https://github.com/bambadiante/medicare/blob/main/MedicamentHubForm.cpp"
click node_medicationlist "https://github.com/bambadiante/medicare/blob/main/MedicamentListeForm.cpp"
click node_medicationadd "https://github.com/bambadiante/medicare/blob/main/MedicamentForm.cpp"
click node_medicationedit "https://github.com/bambadiante/medicare/blob/main/ModifierMedicament.cpp"

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_entry,node_login,node_window,node_operator toneBlue
class node_patienthub,node_patientlist,node_patientadd,node_patientedit,node_medhub,node_medlist,node_medadd,node_mededit,node_db toneAmber
class node_consultform,node_patienthistory,node_physicianhistory,node_consultdetail toneMint
class node_medicationhub,node_medicationlist,node_medicationadd,node_medicationedit toneRose
```

## Components

### Application shell

- [Startup](https://github.com/bambadiante/medicare/blob/main/main.cpp): `main.cpp`
- [Login dialog](https://github.com/bambadiante/medicare/blob/main/LoginForm.cpp): `LoginForm.cpp`
- [Main window](https://github.com/bambadiante/medicare/blob/main/MainWindow.cpp): `MainWindow.cpp`

### Patient and physician

- [Patient hub](https://github.com/bambadiante/medicare/blob/main/PatientHubForm.cpp): `PatientHubForm.cpp`
- [Patient records](https://github.com/bambadiante/medicare/blob/main/PatientForm.cpp): `PatientForm.cpp`
- [Add patient](https://github.com/bambadiante/medicare/blob/main/AjoutPatientForm.cpp): `AjoutPatientForm.cpp`
- [Edit patient](https://github.com/bambadiante/medicare/blob/main/ModifierPatient.cpp): `ModifierPatient.cpp`
- [Physician hub](https://github.com/bambadiante/medicare/blob/main/MedecinHubForm.cpp): `MedecinHubForm.cpp`
- [Physician records](https://github.com/bambadiante/medicare/blob/main/MedecinListeForm.cpp): `MedecinListeForm.cpp`
- [Add physician](https://github.com/bambadiante/medicare/blob/main/MedecinForm.cpp): `MedecinForm.cpp`
- [Edit physician](https://github.com/bambadiante/medicare/blob/main/ModifierMedecin.cpp): `ModifierMedecin.cpp`

### Consultations

- [New consultation](https://github.com/bambadiante/medicare/blob/main/ConsultationForm.cpp): `ConsultationForm.cpp`
- [Patient history](https://github.com/bambadiante/medicare/blob/main/ConsultationPatient.cpp): `ConsultationPatient.cpp`
- [Physician history](https://github.com/bambadiante/medicare/blob/main/ConsultationMedecin.cpp): `ConsultationMedecin.cpp`
- [Consultation details](https://github.com/bambadiante/medicare/blob/main/DetailConsultation.cpp): `DetailConsultation.cpp`

### Medication

- [Medication hub](https://github.com/bambadiante/medicare/blob/main/MedicamentHubForm.cpp): `MedicamentHubForm.cpp`
- [Medication records](https://github.com/bambadiante/medicare/blob/main/MedicamentListeForm.cpp): `MedicamentListeForm.cpp`
- [Add medication](https://github.com/bambadiante/medicare/blob/main/MedicamentForm.cpp): `MedicamentForm.cpp`
- [Edit medication](https://github.com/bambadiante/medicare/blob/main/ModifierMedicament.cpp): `ModifierMedicament.cpp`

### Other components

- **Staff user**
- **MySQL hospital DB**

## Connections

- Staff user → Startup: starts (evidence: `main.cpp`)
- Startup → MySQL hospital DB: opens connection (evidence: `main.cpp`)
- Startup → Login dialog: requires authentication (evidence: `main.cpp`)
- Login dialog → Staff user: authenticates
- Startup → Main window: shows after login (evidence: `main.cpp`)
- Main window → Patient hub: routes to (evidence: `MainWindow.cpp`)
- Main window → Physician hub: routes to (evidence: `MainWindow.cpp`)
- Main window → Medication hub: routes to (evidence: `MainWindow.cpp`)
- Main window → New consultation: routes to (evidence: `MainWindow.cpp`)
- Patient hub → Add patient: opens (evidence: `PatientHubForm.cpp`)
- Patient hub → Patient records: opens (evidence: `PatientHubForm.cpp`)
- Patient records → MySQL hospital DB: reads and deletes (evidence: `PatientForm.cpp`)
- Patient records → Patient history: opens history (evidence: `PatientForm.cpp`)
- Patient records → Edit patient: opens editor (evidence: `PatientForm.cpp`)
- Add patient → MySQL hospital DB: writes patient
- Edit patient → MySQL hospital DB: updates patient
- Physician hub → Add physician: opens (evidence: `MedecinHubForm.cpp`)
- Physician hub → Physician records: opens (evidence: `MedecinHubForm.cpp`)
- Physician records → MySQL hospital DB: reads and deletes (evidence: `MedecinListeForm.cpp`)
- Physician records → Physician history: opens history (evidence: `MedecinListeForm.cpp`)
- Physician records → Edit physician: opens editor (evidence: `MedecinListeForm.cpp`)
- Add physician → MySQL hospital DB: writes physician
- Edit physician → MySQL hospital DB: updates physician
- New consultation → MySQL hospital DB: loads and saves (evidence: `ConsultationForm.cpp`)
- Patient history → MySQL hospital DB: loads history
- Patient history → Consultation details: opens details (evidence: `ConsultationPatient.cpp`)
- Physician history → MySQL hospital DB: queries history (evidence: `ConsultationMedecin.cpp`)
- Medication hub → Add medication: opens (evidence: `MedicamentHubForm.cpp`)
- Medication hub → Medication records: opens (evidence: `MedicamentHubForm.cpp`)
- Medication records → MySQL hospital DB: reads and deletes (evidence: `MedicamentListeForm.cpp`)
- Medication records → Edit medication: opens editor (evidence: `MedicamentListeForm.cpp`)
- Add medication → MySQL hospital DB: writes medication
- Edit medication → MySQL hospital DB: updates medication
