# jagadeesandev/marley architecture

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

- Interactive diagram: https://gitdiagram.com/jagadeesandev/marley
- Repository: https://github.com/jagadeesandev/marley

## Overview

Marley Health is a Frappe/ERPNext hospital information system. Its central user workflow spans patient and outpatient/inpatient care, requests for services, and resulting clinical or laboratory records, with billing and insurance alongside care delivery. The tree and README establish additional procedure, rehabilitation, facility, and code-standard capabilities. Edges are limited to relationships visible in excerpts, the source index, or README; unsampled subsystems are represented without inferred call chains.

Main entry points: [`healthcare/healthcare/doctype/service_request/service_request.py`](https://github.com/jagadeesandev/marley/blob/develop/healthcare/healthcare/doctype/service_request/service_request.py) (Service requests), [`healthcare/healthcare/doctype/patient_insurance_coverage/patient_insurance_coverage.py`](https://github.com/jagadeesandev/marley/blob/develop/healthcare/healthcare/doctype/patient_insurance_coverage/patient_insurance_coverage.py) (Patient coverage), [`healthcare/healthcare/doctype/sample_collection/sample_collection.py`](https://github.com/jagadeesandev/marley/blob/develop/healthcare/healthcare/doctype/sample_collection/sample_collection.py) (Sample collection), [`healthcare/healthcare/doctype/observation_template/observation_template.py`](https://github.com/jagadeesandev/marley/blob/develop/healthcare/healthcare/doctype/observation_template/observation_template.py) (Observation templates)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_care["Patient care"]
  node_practitioner["Practitioners"]
  node_appointments["Appointments"]
  node_patients["Patients<br/>[patient.py]"]
  node_encounters["Encounters"]
  node_inpatient["Inpatient care"]
  node_requests["Service requests<br/>[service_request.py]"]
  node_request_controller["Request lifecycle"]
end

subgraph group_clinical["Clinical services"]
  node_procedures["Clinical procedures"]
  node_observations["Observations<br/>[observation.py]"]
  node_observation_templates["Observation templates"]
  node_samples["Sample collection"]
  node_lab["Laboratory management<br/>[lab_test_list.js]"]
  node_rehabilitation["Rehabilitation<br/>[therapy_session.py]"]
  node_medication["Inpatient medication"]
end

subgraph group_operations["Facility operations"]
  node_facility["Service units"]
  node_fee["Fee validity<br/>[fee_validity.py]"]
  node_settings["Healthcare settings"]
end

subgraph group_finance["Billing and insurance"]
  node_insurance_coverage["Patient coverage"]
  node_insurance_policy["Insurance policies"]
  node_payors["Insurance payors<br/>[insurance_payor.py]"]
  node_eligibility["Item eligibility"]
  node_erp[("ERPNext accounts")]
end

subgraph group_integration["Configuration and integration"]
  node_setup["Healthcare setup<br/>[setup.py]"]
  node_abdm["India ABDM<br/>[abdm_config.py]"]
  node_abdm_utils["ABDM utilities<br/>[utils.py]"]
end

node_user(("Healthcare staff"))

node_user -.->|"uses care workflows"| node_appointments
node_requests -->|"inherits lifecycle"| node_request_controller
node_requests -->|"creates coverage"| node_insurance_coverage
node_requests -->|"creates procedure"| node_procedures
node_requests -->|"creates collection"| node_samples
node_requests -->|"uses observations"| node_observations
node_requests -->|"reads template"| node_observation_templates
node_samples -->|"uses observations"| node_observations
node_samples -->|"uses templates"| node_observation_templates
node_observation_templates -->|"delegates pricing"| node_procedures
node_insurance_coverage -->|"checks policy"| node_insurance_policy
node_insurance_coverage -->|"reads payor"| node_payors
node_insurance_coverage -->|"checks eligibility"| node_eligibility
node_medication -->|"reads settings"| node_settings
node_abdm_utils -->|"reads configuration"| node_abdm
node_practitioner -.->|"facility mapping"| node_facility
node_appointments -.->|"outpatient care"| node_encounters
node_inpatient -.->|"inpatient services"| node_medication
node_requests -.->|"laboratory capability"| node_lab
node_requests -.->|"rehabilitation capability"| node_rehabilitation
node_fee -.->|"billing integration"| node_erp
node_insurance_coverage -.->|"accounts integration"| node_erp
node_setup -->|"configures integration"| node_abdm

click node_practitioner "https://github.com/jagadeesandev/marley/blob/develop/healthcare/healthcare/doctype/healthcare_practitioner/healthcare_practitioner.py"
click node_appointments "https://github.com/jagadeesandev/marley/blob/develop/healthcare/healthcare/doctype/appointment_type/appointment_type.py"
click node_patients "https://github.com/jagadeesandev/marley/blob/develop/healthcare/healthcare/doctype/patient/patient.py"
click node_encounters "https://github.com/jagadeesandev/marley/blob/develop/healthcare/healthcare/doctype/patient_encounter/patient_encounter.py"
click node_inpatient "https://github.com/jagadeesandev/marley/blob/develop/healthcare/healthcare/doctype/inpatient_record/inpatient_record.py"
click node_requests "https://github.com/jagadeesandev/marley/blob/develop/healthcare/healthcare/doctype/service_request/service_request.py"
click node_request_controller "https://github.com/jagadeesandev/marley/blob/develop/healthcare/controllers/service_request_controller.py"
click node_procedures "https://github.com/jagadeesandev/marley/blob/develop/healthcare/healthcare/doctype/clinical_procedure_template/clinical_procedure_template.py"
click node_observations "https://github.com/jagadeesandev/marley/blob/develop/healthcare/healthcare/doctype/observation/observation.py"
click node_observation_templates "https://github.com/jagadeesandev/marley/blob/develop/healthcare/healthcare/doctype/observation_template/observation_template.py"
click node_samples "https://github.com/jagadeesandev/marley/blob/develop/healthcare/healthcare/doctype/sample_collection/sample_collection.py"
click node_lab "https://github.com/jagadeesandev/marley/blob/develop/healthcare/healthcare/doctype/lab_test/lab_test_list.js"
click node_rehabilitation "https://github.com/jagadeesandev/marley/blob/develop/healthcare/healthcare/doctype/therapy_session/therapy_session.py"
click node_facility "https://github.com/jagadeesandev/marley/blob/develop/healthcare/healthcare/doctype/healthcare_service_unit/healthcare_service_unit.py"
click node_fee "https://github.com/jagadeesandev/marley/blob/develop/healthcare/healthcare/doctype/fee_validity/fee_validity.py"
click node_settings "https://github.com/jagadeesandev/marley/blob/develop/healthcare/healthcare/doctype/healthcare_settings/healthcare_settings.py"
click node_medication "https://github.com/jagadeesandev/marley/blob/develop/healthcare/healthcare/doctype/inpatient_medication_entry/inpatient_medication_entry.py"
click node_insurance_coverage "https://github.com/jagadeesandev/marley/blob/develop/healthcare/healthcare/doctype/patient_insurance_coverage/patient_insurance_coverage.py"
click node_insurance_policy "https://github.com/jagadeesandev/marley/blob/develop/healthcare/healthcare/doctype/patient_insurance_policy/patient_insurance_policy.py"
click node_payors "https://github.com/jagadeesandev/marley/blob/develop/healthcare/healthcare/doctype/insurance_payor/insurance_payor.py"
click node_eligibility "https://github.com/jagadeesandev/marley/blob/develop/healthcare/healthcare/doctype/item_insurance_eligibility/item_insurance_eligibility.py"
click node_setup "https://github.com/jagadeesandev/marley/blob/develop/healthcare/setup.py"
click node_abdm "https://github.com/jagadeesandev/marley/blob/develop/healthcare/regional/india/abdm/abdm_config.py"
click node_abdm_utils "https://github.com/jagadeesandev/marley/blob/develop/healthcare/regional/india/abdm/utils.py"

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_practitioner,node_appointments,node_patients,node_encounters,node_inpatient,node_requests,node_request_controller toneBlue
class node_procedures,node_observations,node_observation_templates,node_samples,node_lab,node_rehabilitation,node_medication toneAmber
class node_facility,node_fee,node_settings toneMint
class node_insurance_coverage,node_insurance_policy,node_payors,node_eligibility,node_erp toneRose
class node_setup,node_abdm,node_abdm_utils,node_user toneIndigo
```

## Components

### Patient care

- [Practitioners](https://github.com/jagadeesandev/marley/blob/develop/healthcare/healthcare/doctype/healthcare_practitioner/healthcare_practitioner.py): `healthcare/healthcare/doctype/healthcare_practitioner/healthcare_practitioner.py`
- [Appointments](https://github.com/jagadeesandev/marley/blob/develop/healthcare/healthcare/doctype/appointment_type/appointment_type.py): `healthcare/healthcare/doctype/appointment_type/appointment_type.py`
- [Patients](https://github.com/jagadeesandev/marley/blob/develop/healthcare/healthcare/doctype/patient/patient.py): `healthcare/healthcare/doctype/patient/patient.py`
- [Encounters](https://github.com/jagadeesandev/marley/blob/develop/healthcare/healthcare/doctype/patient_encounter/patient_encounter.py): `healthcare/healthcare/doctype/patient_encounter/patient_encounter.py`
- [Inpatient care](https://github.com/jagadeesandev/marley/blob/develop/healthcare/healthcare/doctype/inpatient_record/inpatient_record.py): `healthcare/healthcare/doctype/inpatient_record/inpatient_record.py`
- [Service requests](https://github.com/jagadeesandev/marley/blob/develop/healthcare/healthcare/doctype/service_request/service_request.py): `healthcare/healthcare/doctype/service_request/service_request.py`
- [Request lifecycle](https://github.com/jagadeesandev/marley/blob/develop/healthcare/controllers/service_request_controller.py): `healthcare/controllers/service_request_controller.py`

### Clinical services

- [Clinical procedures](https://github.com/jagadeesandev/marley/blob/develop/healthcare/healthcare/doctype/clinical_procedure_template/clinical_procedure_template.py): `healthcare/healthcare/doctype/clinical_procedure_template/clinical_procedure_template.py`
- [Observations](https://github.com/jagadeesandev/marley/blob/develop/healthcare/healthcare/doctype/observation/observation.py): `healthcare/healthcare/doctype/observation/observation.py`
- [Observation templates](https://github.com/jagadeesandev/marley/blob/develop/healthcare/healthcare/doctype/observation_template/observation_template.py): `healthcare/healthcare/doctype/observation_template/observation_template.py`
- [Sample collection](https://github.com/jagadeesandev/marley/blob/develop/healthcare/healthcare/doctype/sample_collection/sample_collection.py): `healthcare/healthcare/doctype/sample_collection/sample_collection.py`
- [Laboratory management](https://github.com/jagadeesandev/marley/blob/develop/healthcare/healthcare/doctype/lab_test/lab_test_list.js): `healthcare/healthcare/doctype/lab_test/lab_test_list.js`
- [Rehabilitation](https://github.com/jagadeesandev/marley/blob/develop/healthcare/healthcare/doctype/therapy_session/therapy_session.py): `healthcare/healthcare/doctype/therapy_session/therapy_session.py`
- [Inpatient medication](https://github.com/jagadeesandev/marley/blob/develop/healthcare/healthcare/doctype/inpatient_medication_entry/inpatient_medication_entry.py): `healthcare/healthcare/doctype/inpatient_medication_entry/inpatient_medication_entry.py`

### Facility operations

- [Service units](https://github.com/jagadeesandev/marley/blob/develop/healthcare/healthcare/doctype/healthcare_service_unit/healthcare_service_unit.py): `healthcare/healthcare/doctype/healthcare_service_unit/healthcare_service_unit.py`
- [Fee validity](https://github.com/jagadeesandev/marley/blob/develop/healthcare/healthcare/doctype/fee_validity/fee_validity.py): `healthcare/healthcare/doctype/fee_validity/fee_validity.py`
- [Healthcare settings](https://github.com/jagadeesandev/marley/blob/develop/healthcare/healthcare/doctype/healthcare_settings/healthcare_settings.py): `healthcare/healthcare/doctype/healthcare_settings/healthcare_settings.py`

### Billing and insurance

- [Patient coverage](https://github.com/jagadeesandev/marley/blob/develop/healthcare/healthcare/doctype/patient_insurance_coverage/patient_insurance_coverage.py): `healthcare/healthcare/doctype/patient_insurance_coverage/patient_insurance_coverage.py`
- [Insurance policies](https://github.com/jagadeesandev/marley/blob/develop/healthcare/healthcare/doctype/patient_insurance_policy/patient_insurance_policy.py): `healthcare/healthcare/doctype/patient_insurance_policy/patient_insurance_policy.py`
- [Insurance payors](https://github.com/jagadeesandev/marley/blob/develop/healthcare/healthcare/doctype/insurance_payor/insurance_payor.py): `healthcare/healthcare/doctype/insurance_payor/insurance_payor.py`
- [Item eligibility](https://github.com/jagadeesandev/marley/blob/develop/healthcare/healthcare/doctype/item_insurance_eligibility/item_insurance_eligibility.py): `healthcare/healthcare/doctype/item_insurance_eligibility/item_insurance_eligibility.py`
- **ERPNext accounts**

### Configuration and integration

- [Healthcare setup](https://github.com/jagadeesandev/marley/blob/develop/healthcare/setup.py): `healthcare/setup.py`
- [India ABDM](https://github.com/jagadeesandev/marley/blob/develop/healthcare/regional/india/abdm/abdm_config.py): `healthcare/regional/india/abdm/abdm_config.py`
- [ABDM utilities](https://github.com/jagadeesandev/marley/blob/develop/healthcare/regional/india/abdm/utils.py): `healthcare/regional/india/abdm/utils.py`

### Other components

- **Healthcare staff**

## Connections

- Healthcare staff → Appointments: uses care workflows (evidence: `README.md`)
- Service requests → Request lifecycle: inherits lifecycle (evidence: `healthcare/healthcare/doctype/service_request/service_request.py`)
- Service requests → Patient coverage: creates coverage (evidence: `healthcare/healthcare/doctype/service_request/service_request.py`)
- Service requests → Clinical procedures: creates procedure (evidence: `healthcare/healthcare/doctype/service_request/service_request.py`)
- Service requests → Sample collection: creates collection (evidence: `healthcare/healthcare/doctype/service_request/service_request.py`)
- Service requests → Observations: uses observations (evidence: `healthcare/healthcare/doctype/service_request/service_request.py`)
- Service requests → Observation templates: reads template (evidence: `healthcare/healthcare/doctype/service_request/service_request.py`)
- Sample collection → Observations: uses observations (evidence: `healthcare/healthcare/doctype/sample_collection/sample_collection.py`)
- Sample collection → Observation templates: uses templates (evidence: `healthcare/healthcare/doctype/sample_collection/sample_collection.py`)
- Observation templates → Clinical procedures: delegates pricing (evidence: `healthcare/healthcare/doctype/observation_template/observation_template.py`)
- Patient coverage → Insurance policies: checks policy (evidence: `healthcare/healthcare/doctype/patient_insurance_coverage/patient_insurance_coverage.py`)
- Patient coverage → Insurance payors: reads payor (evidence: `healthcare/healthcare/doctype/patient_insurance_coverage/patient_insurance_coverage.py`)
- Patient coverage → Item eligibility: checks eligibility (evidence: `healthcare/healthcare/doctype/patient_insurance_coverage/patient_insurance_coverage.py`)
- Inpatient medication → Healthcare settings: reads settings (evidence: `healthcare/healthcare/doctype/inpatient_medication_entry/inpatient_medication_entry.py`)
- ABDM utilities → India ABDM: reads configuration (evidence: `healthcare/regional/india/abdm/utils.py`)
- Practitioners → Service units: facility mapping (evidence: `README.md`)
- Appointments → Encounters: outpatient care (evidence: `README.md`)
- Inpatient care → Inpatient medication: inpatient services (evidence: `README.md`)
- Service requests → Laboratory management: laboratory capability (evidence: `README.md`)
- Service requests → Rehabilitation: rehabilitation capability (evidence: `README.md`)
- Fee validity → ERPNext accounts: billing integration (evidence: `README.md`)
- Patient coverage → ERPNext accounts: accounts integration (evidence: `README.md`)
- Healthcare setup → India ABDM: configures integration (evidence: `healthcare/setup.py`)
