# lgm1213/appideaemhr architecture

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

- Interactive diagram: https://gitdiagram.com/lgm1213/appideaemhr
- Repository: https://github.com/lgm1213/appideaemhr

## Overview

This is a multi-tenant electronic medical record application for clinics. A signed-in clinic user enters through the tenant-scoped web interface, works with patient records and clinical workflows, and can export encounter billing documents. The routes also expose scheduling, messaging, imaging, administration, and discrete clinical data. The graph emphasizes those documented product areas; sampled code confirms tenant authorization and encounter exports, while several other subsystems are represented from route declarations only. The README provides no additional product detail, and unsampled controller behavior is not inferred.

Main entry points: [`app/controllers/encounters_controller.rb`](https://github.com/lgm1213/appideaemhr/blob/main/app/controllers/encounters_controller.rb) (Encounter workflow), [`app/controllers/application_controller.rb`](https://github.com/lgm1213/appideaemhr/blob/main/app/controllers/application_controller.rb) (Tenant access), [`app/controllers/patients_controller.rb`](https://github.com/lgm1213/appideaemhr/blob/main/app/controllers/patients_controller.rb) (Patient records), [`app/controllers/imaging_studies_controller.rb`](https://github.com/lgm1213/appideaemhr/blob/main/app/controllers/imaging_studies_controller.rb) (Imaging studies)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_access["Access and administration"]
  node_application_controller["Tenant access"]
  node_admin_controllers["Clinic administration"]
end

subgraph group_clinical["Patient care"]
  node_patient_records["Patient records"]
  node_encounter_workflow["Encounter workflow"]
  node_clinical_data["Clinical data"]
  node_imaging["Imaging studies"]
  node_dicom_viewer["DICOM viewer"]
  node_domain_models["Domain models"]
  node_database[("Application database<br/>[schema.rb]")]
  node_document_upload["Document upload"]
end

subgraph group_operations["Clinic operations"]
  node_appointments["Appointments"]
  node_messages["Messaging"]
  node_cpt_search["CPT code search"]
  node_facility_provider["Facilities and providers"]
end

subgraph group_exports["Clinical exports"]
  node_superbill["Superbill export"]
  node_cms1500["CMS-1500 export"]
  node_ccda["CCDA export<br/>[ccda_generator.rb]"]
  node_prescription["Prescription export"]
end

node_clinic_user(("Clinic user"))

node_clinic_user -->|"requests access"| node_application_controller
node_clinic_user -->|"manages clinic"| node_admin_controllers
node_clinic_user -->|"opens chart"| node_patient_records
node_clinic_user -->|"records encounter"| node_encounter_workflow
node_clinic_user -->|"updates clinical data"| node_clinical_data
node_clinic_user -->|"opens imaging"| node_imaging
node_clinic_user -->|"manages schedule"| node_appointments
node_clinic_user -->|"sends messages"| node_messages
node_clinic_user -->|"manages clinic resources"| node_facility_provider
node_clinic_user -.->|"searches codes"| node_cpt_search
node_application_controller -->|"authorizes organization"| node_domain_models
node_encounter_workflow -->|"queries and saves"| node_domain_models
node_encounter_workflow -->|"generates PDF"| node_superbill
node_encounter_workflow -->|"generates claim"| node_cms1500
node_patient_records -->|"exports CCDA"| node_ccda
node_clinic_user -->|"prints medication"| node_prescription
node_imaging -.->|"presents study"| node_dicom_viewer
node_clinic_user -.->|"uploads document"| node_document_upload

click node_application_controller "https://github.com/lgm1213/appideaemhr/blob/main/app/controllers/application_controller.rb"
click node_admin_controllers "https://github.com/lgm1213/appideaemhr/tree/main/app/controllers/admin"
click node_patient_records "https://github.com/lgm1213/appideaemhr/blob/main/app/controllers/patients_controller.rb"
click node_encounter_workflow "https://github.com/lgm1213/appideaemhr/blob/main/app/controllers/encounters_controller.rb"
click node_clinical_data "https://github.com/lgm1213/appideaemhr/tree/main/app/controllers"
click node_imaging "https://github.com/lgm1213/appideaemhr/blob/main/app/controllers/imaging_studies_controller.rb"
click node_dicom_viewer "https://github.com/lgm1213/appideaemhr/blob/main/app/javascript/controllers/dicom_viewer_controller.js"
click node_appointments "https://github.com/lgm1213/appideaemhr/blob/main/app/controllers/appointments_controller.rb"
click node_messages "https://github.com/lgm1213/appideaemhr/blob/main/app/controllers/messages_controller.rb"
click node_cpt_search "https://github.com/lgm1213/appideaemhr/blob/main/app/javascript/controllers/cpt_search_controller.js"
click node_facility_provider "https://github.com/lgm1213/appideaemhr/blob/main/app/controllers/facilities_controller.rb"
click node_domain_models "https://github.com/lgm1213/appideaemhr/tree/main/app/models"
click node_database "https://github.com/lgm1213/appideaemhr/blob/main/db/schema.rb"
click node_superbill "https://github.com/lgm1213/appideaemhr/blob/main/app/services/superbill_generator.rb"
click node_cms1500 "https://github.com/lgm1213/appideaemhr/blob/main/app/services/cms1500_generator.rb"
click node_ccda "https://github.com/lgm1213/appideaemhr/blob/main/app/services/ccda_generator.rb"
click node_prescription "https://github.com/lgm1213/appideaemhr/blob/main/app/services/prescription_generator.rb"
click node_document_upload "https://github.com/lgm1213/appideaemhr/blob/main/app/services/document_upload_service.rb"

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_application_controller,node_admin_controllers,node_clinic_user toneBlue
class node_patient_records,node_encounter_workflow,node_clinical_data,node_imaging,node_dicom_viewer,node_domain_models,node_database,node_document_upload toneAmber
class node_appointments,node_messages,node_cpt_search,node_facility_provider toneMint
class node_superbill,node_cms1500,node_ccda,node_prescription toneRose
```

## Components

### Access and administration

- [Tenant access](https://github.com/lgm1213/appideaemhr/blob/main/app/controllers/application_controller.rb): `app/controllers/application_controller.rb`
- [Clinic administration](https://github.com/lgm1213/appideaemhr/tree/main/app/controllers/admin): `app/controllers/admin`

### Patient care

- [Patient records](https://github.com/lgm1213/appideaemhr/blob/main/app/controllers/patients_controller.rb): `app/controllers/patients_controller.rb`
- [Encounter workflow](https://github.com/lgm1213/appideaemhr/blob/main/app/controllers/encounters_controller.rb): `app/controllers/encounters_controller.rb`
- [Clinical data](https://github.com/lgm1213/appideaemhr/tree/main/app/controllers): `app/controllers`
- [Imaging studies](https://github.com/lgm1213/appideaemhr/blob/main/app/controllers/imaging_studies_controller.rb): `app/controllers/imaging_studies_controller.rb`
- [DICOM viewer](https://github.com/lgm1213/appideaemhr/blob/main/app/javascript/controllers/dicom_viewer_controller.js): `app/javascript/controllers/dicom_viewer_controller.js`
- [Domain models](https://github.com/lgm1213/appideaemhr/tree/main/app/models): `app/models`
- [Application database](https://github.com/lgm1213/appideaemhr/blob/main/db/schema.rb): `db/schema.rb`
- [Document upload](https://github.com/lgm1213/appideaemhr/blob/main/app/services/document_upload_service.rb): `app/services/document_upload_service.rb`

### Clinic operations

- [Appointments](https://github.com/lgm1213/appideaemhr/blob/main/app/controllers/appointments_controller.rb): `app/controllers/appointments_controller.rb`
- [Messaging](https://github.com/lgm1213/appideaemhr/blob/main/app/controllers/messages_controller.rb): `app/controllers/messages_controller.rb`
- [CPT code search](https://github.com/lgm1213/appideaemhr/blob/main/app/javascript/controllers/cpt_search_controller.js): `app/javascript/controllers/cpt_search_controller.js`
- [Facilities and providers](https://github.com/lgm1213/appideaemhr/blob/main/app/controllers/facilities_controller.rb): `app/controllers/facilities_controller.rb`

### Clinical exports

- [Superbill export](https://github.com/lgm1213/appideaemhr/blob/main/app/services/superbill_generator.rb): `app/services/superbill_generator.rb`
- [CMS-1500 export](https://github.com/lgm1213/appideaemhr/blob/main/app/services/cms1500_generator.rb): `app/services/cms1500_generator.rb`
- [CCDA export](https://github.com/lgm1213/appideaemhr/blob/main/app/services/ccda_generator.rb): `app/services/ccda_generator.rb`
- [Prescription export](https://github.com/lgm1213/appideaemhr/blob/main/app/services/prescription_generator.rb): `app/services/prescription_generator.rb`

### Other components

- **Clinic user**

## Connections

- Clinic user → Tenant access: requests access
- Clinic user → Clinic administration: manages clinic
- Clinic user → Patient records: opens chart
- Clinic user → Encounter workflow: records encounter
- Clinic user → Clinical data: updates clinical data
- Clinic user → Imaging studies: opens imaging
- Clinic user → Appointments: manages schedule
- Clinic user → Messaging: sends messages
- Clinic user → Facilities and providers: manages clinic resources
- Clinic user → CPT code search: searches codes
- Tenant access → Domain models: authorizes organization (evidence: `app/controllers/application_controller.rb`)
- Encounter workflow → Domain models: queries and saves (evidence: `app/controllers/encounters_controller.rb`)
- Encounter workflow → Superbill export: generates PDF (evidence: `app/controllers/encounters_controller.rb`)
- Encounter workflow → CMS-1500 export: generates claim (evidence: `app/controllers/encounters_controller.rb`)
- Patient records → CCDA export: exports CCDA
- Clinic user → Prescription export: prints medication
- Imaging studies → DICOM viewer: presents study
- Clinic user → Document upload: uploads document
