# argonforfun-source/clinica-system-dev architecture

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

- Interactive diagram: https://gitdiagram.com/argonforfun-source/clinica-system-dev
- Repository: https://github.com/argonforfun-source/clinica-system-dev

## Overview

This repository appears to contain two overlapping product layers: the README describes a Firebase-backed clinic booking system, while the sampled source identifies a broader Argon Medical OS with EMR, billing, specialty modules, authentication, and recovery. The tree lacks the README’s HTML entry pages, so corresponding application nodes use the available JS files where identifiable. Several major modules are represented from the source index and README rather than inspected in full; uncertain wiring is omitted.

Main entry points: [`emr-specialty-loader.js`](https://github.com/argonforfun-source/clinica-system-dev/blob/main/emr-specialty-loader.js) (Specialty loader), [`emr-app.js`](https://github.com/argonforfun-source/clinica-system-dev/blob/main/emr-app.js) (Clinic dashboard), [`patient-app.js`](https://github.com/argonforfun-source/clinica-system-dev/blob/main/patient-app.js) (Patient app), [`billing-engine.js`](https://github.com/argonforfun-source/clinica-system-dev/blob/main/billing-engine.js) (Billing engine)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_clinic["Clinic access"]
  node_patient["Patient app<br/>[patient-app.js]"]
  node_clinic_dashboard["Clinic dashboard<br/>[emr-app.js]"]
  node_super_admin["Super admin<br/>[super-app.js]"]
end

subgraph group_clinical["Clinical workflows"]
  node_emr["EMR workflows<br/>[emr-app.js]"]
  node_specialty_loader["Specialty loader"]
  node_cardio["Cardiology<br/>[cardio_module.js]"]
  node_dental_chart["Dental chart"]
  node_dental_media["Dental media"]
  node_growth_chart["Growth charts"]
  node_treatment_plan["Treatment plans"]
end

subgraph group_operations["Clinic operations"]
  node_billing["Billing engine<br/>[billing-engine.js]"]
  node_pharmacy["Pharmacy<br/>[pharmacy-app.js]"]
  node_laboratory["Laboratory<br/>[lab-app.js]"]
  node_radiology["Radiology<br/>[radiology-app.js]"]
end

subgraph group_platform["Platform services"]
  node_auth_bridge["Auth bridge"]
  node_backup["Backup and restore"]
  node_cloud_functions["Cloud functions<br/>[index.js]"]
  node_service_worker["Offline support<br/>[sw.js]"]
end

node_realtime_db[("Firebase Realtime DB")]
node_firebase_auth["Firebase Auth"]
node_firebase_storage[("Firebase Storage")]
node_patient_actor(("Patient"))
node_clinic_staff(("Clinic staff"))
node_system_owner(("System owner"))

node_patient_actor -->|"books with"| node_patient
node_patient -.->|"writes bookings"| node_realtime_db
node_clinic_staff -->|"manages clinic"| node_clinic_dashboard
node_clinic_dashboard -.->|"reads and writes"| node_realtime_db
node_system_owner -->|"manages clinics"| node_super_admin
node_super_admin -.->|"configures clinics"| node_realtime_db
node_clinic_dashboard -.->|"authenticates via"| node_auth_bridge
node_auth_bridge -->|"signs in"| node_firebase_auth
node_clinic_dashboard -.->|"hosts workflows"| node_emr
node_emr -.->|"loads specialties"| node_specialty_loader
node_specialty_loader -.->|"dispatches to"| node_cardio
node_specialty_loader -.->|"dispatches to"| node_dental_chart
node_specialty_loader -.->|"dispatches to"| node_dental_media
node_specialty_loader -.->|"dispatches to"| node_growth_chart
node_specialty_loader -.->|"dispatches to"| node_treatment_plan
node_dental_media -->|"uploads media"| node_firebase_storage
node_billing -->|"reads and writes"| node_realtime_db
node_billing -.->|"uses session"| node_clinic_dashboard
node_backup -->|"stores backups"| node_firebase_storage
node_backup -.->|"restores data"| node_realtime_db
node_cloud_functions -->|"reads backup settings"| node_realtime_db
node_cloud_functions -->|"writes backups"| node_firebase_storage
node_patient -->|"supports offline"| node_service_worker

click node_patient "https://github.com/argonforfun-source/clinica-system-dev/blob/main/patient-app.js"
click node_clinic_dashboard "https://github.com/argonforfun-source/clinica-system-dev/blob/main/emr-app.js"
click node_super_admin "https://github.com/argonforfun-source/clinica-system-dev/blob/main/super-app.js"
click node_auth_bridge "https://github.com/argonforfun-source/clinica-system-dev/blob/main/%D9%85%D8%B9%D8%AF%D9%842/argon-auth-bridge.js"
click node_emr "https://github.com/argonforfun-source/clinica-system-dev/blob/main/emr-app.js"
click node_specialty_loader "https://github.com/argonforfun-source/clinica-system-dev/blob/main/emr-specialty-loader.js"
click node_cardio "https://github.com/argonforfun-source/clinica-system-dev/blob/main/specialty-modules/cardio_module.js"
click node_dental_chart "https://github.com/argonforfun-source/clinica-system-dev/blob/main/specialty-modules/dental_chart_module.js"
click node_dental_media "https://github.com/argonforfun-source/clinica-system-dev/blob/main/specialty-modules/dental_media_module.js"
click node_growth_chart "https://github.com/argonforfun-source/clinica-system-dev/blob/main/specialty-modules/growth_chart_module.js"
click node_treatment_plan "https://github.com/argonforfun-source/clinica-system-dev/blob/main/specialty-modules/treatment_plan_module.js"
click node_billing "https://github.com/argonforfun-source/clinica-system-dev/blob/main/billing-engine.js"
click node_pharmacy "https://github.com/argonforfun-source/clinica-system-dev/blob/main/pharmacy-app.js"
click node_laboratory "https://github.com/argonforfun-source/clinica-system-dev/blob/main/lab-app.js"
click node_radiology "https://github.com/argonforfun-source/clinica-system-dev/blob/main/radiology-app.js"
click node_backup "https://github.com/argonforfun-source/clinica-system-dev/blob/main/%D9%86%D8%B3%D8%AE/client-local-backup%20(2).js"
click node_cloud_functions "https://github.com/argonforfun-source/clinica-system-dev/blob/main/functions/index.js"
click node_service_worker "https://github.com/argonforfun-source/clinica-system-dev/blob/main/sw.js"

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_patient,node_clinic_dashboard,node_super_admin toneBlue
class node_emr,node_specialty_loader,node_cardio,node_dental_chart,node_dental_media,node_growth_chart,node_treatment_plan,node_realtime_db,node_firebase_storage toneAmber
class node_billing,node_pharmacy,node_laboratory,node_radiology toneMint
class node_auth_bridge,node_backup,node_cloud_functions,node_service_worker toneRose
class node_firebase_auth,node_patient_actor,node_clinic_staff,node_system_owner toneIndigo
```

## Components

### Clinic access

- [Patient app](https://github.com/argonforfun-source/clinica-system-dev/blob/main/patient-app.js): `patient-app.js`
- [Clinic dashboard](https://github.com/argonforfun-source/clinica-system-dev/blob/main/emr-app.js): `emr-app.js`
- [Super admin](https://github.com/argonforfun-source/clinica-system-dev/blob/main/super-app.js): `super-app.js`

### Clinical workflows

- [EMR workflows](https://github.com/argonforfun-source/clinica-system-dev/blob/main/emr-app.js): `emr-app.js`
- [Specialty loader](https://github.com/argonforfun-source/clinica-system-dev/blob/main/emr-specialty-loader.js): `emr-specialty-loader.js`
- [Cardiology](https://github.com/argonforfun-source/clinica-system-dev/blob/main/specialty-modules/cardio_module.js): `specialty-modules/cardio_module.js`
- [Dental chart](https://github.com/argonforfun-source/clinica-system-dev/blob/main/specialty-modules/dental_chart_module.js): `specialty-modules/dental_chart_module.js`
- [Dental media](https://github.com/argonforfun-source/clinica-system-dev/blob/main/specialty-modules/dental_media_module.js): `specialty-modules/dental_media_module.js`
- [Growth charts](https://github.com/argonforfun-source/clinica-system-dev/blob/main/specialty-modules/growth_chart_module.js): `specialty-modules/growth_chart_module.js`
- [Treatment plans](https://github.com/argonforfun-source/clinica-system-dev/blob/main/specialty-modules/treatment_plan_module.js): `specialty-modules/treatment_plan_module.js`

### Clinic operations

- [Billing engine](https://github.com/argonforfun-source/clinica-system-dev/blob/main/billing-engine.js): `billing-engine.js`
- [Pharmacy](https://github.com/argonforfun-source/clinica-system-dev/blob/main/pharmacy-app.js): `pharmacy-app.js`
- [Laboratory](https://github.com/argonforfun-source/clinica-system-dev/blob/main/lab-app.js): `lab-app.js`
- [Radiology](https://github.com/argonforfun-source/clinica-system-dev/blob/main/radiology-app.js): `radiology-app.js`

### Platform services

- [Auth bridge](https://github.com/argonforfun-source/clinica-system-dev/blob/main/%D9%85%D8%B9%D8%AF%D9%842/argon-auth-bridge.js): `معدل2/argon-auth-bridge.js`
- [Backup and restore](https://github.com/argonforfun-source/clinica-system-dev/blob/main/%D9%86%D8%B3%D8%AE/client-local-backup%20(2).js): `نسخ/client-local-backup (2).js`
- [Cloud functions](https://github.com/argonforfun-source/clinica-system-dev/blob/main/functions/index.js): `functions/index.js`
- [Offline support](https://github.com/argonforfun-source/clinica-system-dev/blob/main/sw.js): `sw.js`

### Other components

- **Firebase Realtime DB**
- **Firebase Auth**
- **Firebase Storage**
- **Patient**
- **Clinic staff**
- **System owner**

## Connections

- Patient → Patient app: books with (evidence: `README.md`)
- Patient app → Firebase Realtime DB: writes bookings
- Clinic staff → Clinic dashboard: manages clinic (evidence: `README.md`)
- Clinic dashboard → Firebase Realtime DB: reads and writes
- System owner → Super admin: manages clinics (evidence: `README.md`)
- Super admin → Firebase Realtime DB: configures clinics
- Clinic dashboard → Auth bridge: authenticates via
- Auth bridge → Firebase Auth: signs in (evidence: `معدل2/argon-auth-bridge.js`)
- Clinic dashboard → EMR workflows: hosts workflows (evidence: `emr-app.js`)
- EMR workflows → Specialty loader: loads specialties
- Specialty loader → Cardiology: dispatches to
- Specialty loader → Dental chart: dispatches to
- Specialty loader → Dental media: dispatches to
- Specialty loader → Growth charts: dispatches to
- Specialty loader → Treatment plans: dispatches to
- Dental media → Firebase Storage: uploads media (evidence: `specialty-modules/dental_media_module.js`)
- Billing engine → Firebase Realtime DB: reads and writes (evidence: `billing-engine.js`)
- Billing engine → Clinic dashboard: uses session
- Backup and restore → Firebase Storage: stores backups (evidence: `نسخ/client-local-backup (2).js`)
- Backup and restore → Firebase Realtime DB: restores data
- Cloud functions → Firebase Realtime DB: reads backup settings (evidence: `functions/index.js`)
- Cloud functions → Firebase Storage: writes backups (evidence: `functions/index.js`)
- Patient app → Offline support: supports offline (evidence: `README.md`)
