# northwell-health-orcca/itemized-statement architecture

> Architecture diagram of the GitHub repository northwell-health-orcca/itemized-statement, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-23). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/northwell-health-orcca/itemized-statement
- Repository: https://github.com/northwell-health-orcca/itemized-statement

## Overview

This is an invoice-statement RPA application: it loads HCX CSV requests, creates a processing run, skips or retries invoices according to prior outcomes, drives IDX through Selenium, and records each result. The workflow and database layers separate UI automation from run selection and durable history. The README documents CSV loading, per-invoice processing, printer delivery, retry behavior, and reconciliation; sampled excerpts show the orchestration and several UI calls, but not the full workflow or every page implementation.

Main entry points: [`pages/patient_services.py`](https://github.com/northwell-health-orcca/itemized-statement/blob/main/pages/patient_services.py) (Patient Services), [`IDXClient.py`](https://github.com/northwell-health-orcca/itemized-statement/blob/main/IDXClient.py) (IDX Client), [`main.py`](https://github.com/northwell-health-orcca/itemized-statement/blob/main/main.py) (Run Orchestrator), [`pages/base.py`](https://github.com/northwell-health-orcca/itemized-statement/blob/main/pages/base.py) (Page Helpers)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_processing["Run Processing"]
  node_main["Run Orchestrator<br/>[main.py]"]
  node_workflow["Invoice Workflow<br/>[workflow.py]"]
end

subgraph group_persistence["Persistence"]
  node_repository["Run Repository<br/>[repository.py]"]
  node_models["Data Models<br/>[models.py]"]
  node_sessions["DB Sessions<br/>[base.py]"]
  node_database[("SQL Database")]
end

subgraph group_automation["IDX Automation"]
  node_idx["IDX Client<br/>[IDXClient.py]"]
end

subgraph group_pages["IDX Pages"]
  node_login["Login Page<br/>[login.py]"]
  node_settings["Settings Page<br/>[settings.py]"]
  node_vtb["Tool Bar<br/>[vtb.py]"]
  node_patient["Patient Services"]
  node_invoice["Invoice List<br/>[invoice_list.py]"]
  node_select["Select Invoices<br/>[select_invoices.py]"]
  node_demand["Demand Statement"]
  node_device["Device Selection"]
  node_pagebase["Page Helpers<br/>[base.py]"]
  node_modal["Modal Handler<br/>[modal.py]"]
end

node_hcx["HCX CSV"]
node_printer["Designated Printer"]

node_hcx -->|"provides input"| node_main
node_main -->|"manages runs"| node_repository
node_main -->|"processes invoices"| node_workflow
node_main -->|"initializes and navigates"| node_idx
node_main -->|"records outcomes"| node_repository
node_repository -->|"queries and updates"| node_models
node_models -->|"declares on base"| node_sessions
node_repository -->|"reads and writes"| node_database
node_sessions -.->|"opens sessions"| node_database
node_workflow -->|"uses client"| node_idx
node_idx -->|"constructs"| node_login
node_idx -->|"constructs"| node_settings
node_idx -->|"constructs"| node_vtb
node_idx -->|"constructs"| node_patient
node_patient -->|"creates"| node_demand
node_patient -->|"creates"| node_device
node_patient -->|"creates"| node_invoice
node_patient -->|"creates"| node_select
node_pagebase -->|"uses"| node_modal
node_patient -->|"inherits"| node_pagebase
node_login -->|"inherits"| node_pagebase
node_settings -->|"inherits"| node_pagebase
node_vtb -->|"inherits"| node_pagebase
node_demand -.->|"sends statement"| node_printer

click node_main "https://github.com/northwell-health-orcca/itemized-statement/blob/main/main.py"
click node_workflow "https://github.com/northwell-health-orcca/itemized-statement/blob/main/workflow.py"
click node_repository "https://github.com/northwell-health-orcca/itemized-statement/blob/main/db/repository.py"
click node_models "https://github.com/northwell-health-orcca/itemized-statement/blob/main/db/models.py"
click node_sessions "https://github.com/northwell-health-orcca/itemized-statement/blob/main/db/base.py"
click node_idx "https://github.com/northwell-health-orcca/itemized-statement/blob/main/IDXClient.py"
click node_login "https://github.com/northwell-health-orcca/itemized-statement/blob/main/pages/login.py"
click node_settings "https://github.com/northwell-health-orcca/itemized-statement/blob/main/pages/settings.py"
click node_vtb "https://github.com/northwell-health-orcca/itemized-statement/blob/main/pages/vtb.py"
click node_patient "https://github.com/northwell-health-orcca/itemized-statement/blob/main/pages/patient_services.py"
click node_invoice "https://github.com/northwell-health-orcca/itemized-statement/blob/main/pages/pt_services/invoice_list.py"
click node_select "https://github.com/northwell-health-orcca/itemized-statement/blob/main/pages/pt_services/select_invoices.py"
click node_demand "https://github.com/northwell-health-orcca/itemized-statement/blob/main/pages/pt_services/demand_statement.py"
click node_device "https://github.com/northwell-health-orcca/itemized-statement/blob/main/pages/pt_services/device_selection.py"
click node_pagebase "https://github.com/northwell-health-orcca/itemized-statement/blob/main/pages/base.py"
click node_modal "https://github.com/northwell-health-orcca/itemized-statement/blob/main/pages/modals/modal.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_main,node_workflow toneBlue
class node_repository,node_models,node_sessions,node_database toneAmber
class node_idx toneMint
class node_login,node_settings,node_vtb,node_patient,node_invoice,node_select,node_demand,node_device,node_pagebase,node_modal toneRose
class node_hcx,node_printer toneIndigo
```

## Components

### Run Processing

- [Run Orchestrator](https://github.com/northwell-health-orcca/itemized-statement/blob/main/main.py): `main.py`
- [Invoice Workflow](https://github.com/northwell-health-orcca/itemized-statement/blob/main/workflow.py): `workflow.py`

### Persistence

- [Run Repository](https://github.com/northwell-health-orcca/itemized-statement/blob/main/db/repository.py): `db/repository.py`
- [Data Models](https://github.com/northwell-health-orcca/itemized-statement/blob/main/db/models.py): `db/models.py`
- [DB Sessions](https://github.com/northwell-health-orcca/itemized-statement/blob/main/db/base.py): `db/base.py`
- **SQL Database**

### IDX Automation

- [IDX Client](https://github.com/northwell-health-orcca/itemized-statement/blob/main/IDXClient.py): `IDXClient.py`

### IDX Pages

- [Login Page](https://github.com/northwell-health-orcca/itemized-statement/blob/main/pages/login.py): `pages/login.py`
- [Settings Page](https://github.com/northwell-health-orcca/itemized-statement/blob/main/pages/settings.py): `pages/settings.py`
- [Tool Bar](https://github.com/northwell-health-orcca/itemized-statement/blob/main/pages/vtb.py): `pages/vtb.py`
- [Patient Services](https://github.com/northwell-health-orcca/itemized-statement/blob/main/pages/patient_services.py): `pages/patient_services.py`
- [Invoice List](https://github.com/northwell-health-orcca/itemized-statement/blob/main/pages/pt_services/invoice_list.py): `pages/pt_services/invoice_list.py`
- [Select Invoices](https://github.com/northwell-health-orcca/itemized-statement/blob/main/pages/pt_services/select_invoices.py): `pages/pt_services/select_invoices.py`
- [Demand Statement](https://github.com/northwell-health-orcca/itemized-statement/blob/main/pages/pt_services/demand_statement.py): `pages/pt_services/demand_statement.py`
- [Device Selection](https://github.com/northwell-health-orcca/itemized-statement/blob/main/pages/pt_services/device_selection.py): `pages/pt_services/device_selection.py`
- [Page Helpers](https://github.com/northwell-health-orcca/itemized-statement/blob/main/pages/base.py): `pages/base.py`
- [Modal Handler](https://github.com/northwell-health-orcca/itemized-statement/blob/main/pages/modals/modal.py): `pages/modals/modal.py`

### Other components

- **HCX CSV**
- **Designated Printer**

## Connections

- HCX CSV → Run Orchestrator: provides input (evidence: `README.md`)
- Run Orchestrator → Run Repository: manages runs (evidence: `README.md`)
- Run Orchestrator → Invoice Workflow: processes invoices (evidence: `main.py`)
- Run Orchestrator → IDX Client: initializes and navigates (evidence: `main.py`)
- Run Orchestrator → Run Repository: records outcomes (evidence: `README.md`)
- Run Repository → Data Models: queries and updates (evidence: `db/repository.py`)
- Data Models → DB Sessions: declares on base (evidence: `db/models.py`)
- Run Repository → SQL Database: reads and writes (evidence: `README.md`)
- DB Sessions → SQL Database: opens sessions
- Invoice Workflow → IDX Client: uses client (evidence: `workflow.py`)
- IDX Client → Login Page: constructs (evidence: `IDXClient.py`)
- IDX Client → Settings Page: constructs (evidence: `IDXClient.py`)
- IDX Client → Tool Bar: constructs (evidence: `IDXClient.py`)
- IDX Client → Patient Services: constructs (evidence: `IDXClient.py`)
- Patient Services → Demand Statement: creates (evidence: `pages/patient_services.py`)
- Patient Services → Device Selection: creates (evidence: `pages/patient_services.py`)
- Patient Services → Invoice List: creates (evidence: `pages/patient_services.py`)
- Patient Services → Select Invoices: creates (evidence: `pages/patient_services.py`)
- Page Helpers → Modal Handler: uses (evidence: `pages/base.py`)
- Patient Services → Page Helpers: inherits (evidence: `pages/patient_services.py`)
- Login Page → Page Helpers: inherits (evidence: `pages/login.py`)
- Settings Page → Page Helpers: inherits (evidence: `pages/settings.py`)
- Tool Bar → Page Helpers: inherits (evidence: `pages/vtb.py`)
- Demand Statement → Designated Printer: sends statement
