# mdmoghnishah/cube26-rcy-0266-mdmoghnishah architecture

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

- Interactive diagram: https://gitdiagram.com/mdmoghnishah/cube26-rcy-0266-mdmoghnishah
- Repository: https://github.com/mdmoghnishah/cube26-rcy-0266-mdmoghnishah

## Overview

Recovery Manager is a seller-operations evidence-review application. Users connect with an organisation token, upload or import financial records, inspect assessments and reimbursement reconciliation, calculate conditional potential amounts, optionally request an AI summary, record a human review, and export a packet. The graph includes the documented reference-data import and evaluation capabilities. Some connections are based on README descriptions or SOURCE INDEX references; unsampled implementation details are not inferred.

Main entry points: [`backend/recovery/api.py`](https://github.com/mdmoghnishah/cube26-rcy-0266-mdmoghnishah/blob/main/backend/recovery/api.py) (HTTP API), [`backend/recovery/decisions.py`](https://github.com/mdmoghnishah/cube26-rcy-0266-mdmoghnishah/blob/main/backend/recovery/decisions.py) (Assessment orchestration), [`backend/recovery/db.py`](https://github.com/mdmoghnishah/cube26-rcy-0266-mdmoghnishah/blob/main/backend/recovery/db.py) (Org-scoped DB access), [`backend/recovery/packets.py`](https://github.com/mdmoghnishah/cube26-rcy-0266-mdmoghnishah/blob/main/backend/recovery/packets.py) (Review packet export)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["User interface"]
  node_frontend["Dashboard<br/>[page.js]"]
end

subgraph group_service["API and workflow"]
  node_api["HTTP API<br/>[api.py]"]
  node_auth["Org authentication<br/>[api.py]"]
  node_upload["Report upload<br/>[report_upload.py]"]
  node_importer["Reference importer<br/>[importer.py]"]
end

subgraph group_assessment["Evidence assessment"]
  node_decisions["Assessment orchestration<br/>[decisions.py]"]
  node_matcher["Evidence matching<br/>[matcher.py]"]
  node_prep["Prep evidence rules<br/>[prep_rules.py]"]
  node_shipment["Dispatch packaging rules<br/>[shipment_rules.py]"]
  node_returns["Return receipt rules<br/>[return_rules.py]"]
end

subgraph group_finance["Financial review"]
  node_reconciliation["Reimbursement reconciliation<br/>[reconciliation.py]"]
  node_claims["Potential amount calculation<br/>[claims.py]"]
  node_packets["Review packet export<br/>[packets.py]"]
  node_policies["Policy context<br/>[policies.py]"]
  node_evaluation["Assessment evaluation<br/>[evaluation.py]"]
end

subgraph group_persistence["Persistence and integrations"]
  node_db_access["Org-scoped DB access<br/>[db.py]"]
  node_database[("PostgreSQL records and reviews")]
  node_ai["AI summaries<br/>[ai.py]"]
end

node_operator(("Seller operator"))
node_openai["OpenAI API"]

node_operator -->|"uses"| node_frontend
node_frontend -->|"requests assessments"| node_api
node_api -->|"authenticates"| node_auth
node_api -->|"imports uploaded report"| node_upload
node_operator -->|"runs reference import"| node_importer
node_upload -->|"writes validated rows"| node_db_access
node_importer -->|"stores imported rows"| node_db_access
node_api -->|"runs assessment"| node_decisions
node_decisions -->|"matches charges"| node_matcher
node_decisions -->|"applies prep rules"| node_prep
node_prep -->|"checks dispatch packaging"| node_shipment
node_decisions -->|"assesses return charges"| node_returns
node_decisions -->|"reconciles reimbursements"| node_reconciliation
node_decisions -->|"saves assessments"| node_db_access
node_db_access -->|"reads and writes"| node_database
node_api -->|"reads decisions and reviews"| node_database
node_api -->|"queues unit summary"| node_ai
node_ai -->|"loads and updates summaries"| node_database
node_ai -->|"requests summary"| node_openai
node_api -.->|"calculates potential amount"| node_claims
node_api -->|"builds review packet"| node_packets
node_packets -->|"uses claim calculation"| node_claims
node_packets -->|"uses policy context"| node_policies
node_operator -->|"reviews evaluation outputs"| node_evaluation
node_evaluation -->|"evaluates potential claims"| node_claims
node_evaluation -->|"evaluates assessments"| node_decisions

click node_frontend "https://github.com/mdmoghnishah/cube26-rcy-0266-mdmoghnishah/blob/main/frontend/app/page.js"
click node_api "https://github.com/mdmoghnishah/cube26-rcy-0266-mdmoghnishah/blob/main/backend/recovery/api.py"
click node_auth "https://github.com/mdmoghnishah/cube26-rcy-0266-mdmoghnishah/blob/main/backend/recovery/api.py"
click node_upload "https://github.com/mdmoghnishah/cube26-rcy-0266-mdmoghnishah/blob/main/backend/recovery/report_upload.py"
click node_importer "https://github.com/mdmoghnishah/cube26-rcy-0266-mdmoghnishah/blob/main/backend/recovery/importer.py"
click node_decisions "https://github.com/mdmoghnishah/cube26-rcy-0266-mdmoghnishah/blob/main/backend/recovery/decisions.py"
click node_matcher "https://github.com/mdmoghnishah/cube26-rcy-0266-mdmoghnishah/blob/main/backend/recovery/matcher.py"
click node_prep "https://github.com/mdmoghnishah/cube26-rcy-0266-mdmoghnishah/blob/main/backend/recovery/prep_rules.py"
click node_shipment "https://github.com/mdmoghnishah/cube26-rcy-0266-mdmoghnishah/blob/main/backend/recovery/shipment_rules.py"
click node_returns "https://github.com/mdmoghnishah/cube26-rcy-0266-mdmoghnishah/blob/main/backend/recovery/return_rules.py"
click node_reconciliation "https://github.com/mdmoghnishah/cube26-rcy-0266-mdmoghnishah/blob/main/backend/recovery/reconciliation.py"
click node_claims "https://github.com/mdmoghnishah/cube26-rcy-0266-mdmoghnishah/blob/main/backend/recovery/claims.py"
click node_packets "https://github.com/mdmoghnishah/cube26-rcy-0266-mdmoghnishah/blob/main/backend/recovery/packets.py"
click node_policies "https://github.com/mdmoghnishah/cube26-rcy-0266-mdmoghnishah/blob/main/backend/recovery/policies.py"
click node_evaluation "https://github.com/mdmoghnishah/cube26-rcy-0266-mdmoghnishah/blob/main/backend/recovery/evaluation.py"
click node_db_access "https://github.com/mdmoghnishah/cube26-rcy-0266-mdmoghnishah/blob/main/backend/recovery/db.py"
click node_ai "https://github.com/mdmoghnishah/cube26-rcy-0266-mdmoghnishah/blob/main/backend/recovery/ai.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_frontend toneBlue
class node_api,node_auth,node_upload,node_importer toneAmber
class node_decisions,node_matcher,node_prep,node_shipment,node_returns,node_openai toneMint
class node_reconciliation,node_claims,node_packets,node_policies,node_evaluation toneRose
class node_db_access,node_database,node_ai,node_operator toneIndigo
```

## Components

### User interface

- [Dashboard](https://github.com/mdmoghnishah/cube26-rcy-0266-mdmoghnishah/blob/main/frontend/app/page.js): `frontend/app/page.js`

### API and workflow

- [HTTP API](https://github.com/mdmoghnishah/cube26-rcy-0266-mdmoghnishah/blob/main/backend/recovery/api.py): `backend/recovery/api.py`
- [Org authentication](https://github.com/mdmoghnishah/cube26-rcy-0266-mdmoghnishah/blob/main/backend/recovery/api.py): `backend/recovery/api.py`
- [Report upload](https://github.com/mdmoghnishah/cube26-rcy-0266-mdmoghnishah/blob/main/backend/recovery/report_upload.py): `backend/recovery/report_upload.py`
- [Reference importer](https://github.com/mdmoghnishah/cube26-rcy-0266-mdmoghnishah/blob/main/backend/recovery/importer.py): `backend/recovery/importer.py`

### Evidence assessment

- [Assessment orchestration](https://github.com/mdmoghnishah/cube26-rcy-0266-mdmoghnishah/blob/main/backend/recovery/decisions.py): `backend/recovery/decisions.py`
- [Evidence matching](https://github.com/mdmoghnishah/cube26-rcy-0266-mdmoghnishah/blob/main/backend/recovery/matcher.py): `backend/recovery/matcher.py`
- [Prep evidence rules](https://github.com/mdmoghnishah/cube26-rcy-0266-mdmoghnishah/blob/main/backend/recovery/prep_rules.py): `backend/recovery/prep_rules.py`
- [Dispatch packaging rules](https://github.com/mdmoghnishah/cube26-rcy-0266-mdmoghnishah/blob/main/backend/recovery/shipment_rules.py): `backend/recovery/shipment_rules.py`
- [Return receipt rules](https://github.com/mdmoghnishah/cube26-rcy-0266-mdmoghnishah/blob/main/backend/recovery/return_rules.py): `backend/recovery/return_rules.py`

### Financial review

- [Reimbursement reconciliation](https://github.com/mdmoghnishah/cube26-rcy-0266-mdmoghnishah/blob/main/backend/recovery/reconciliation.py): `backend/recovery/reconciliation.py`
- [Potential amount calculation](https://github.com/mdmoghnishah/cube26-rcy-0266-mdmoghnishah/blob/main/backend/recovery/claims.py): `backend/recovery/claims.py`
- [Review packet export](https://github.com/mdmoghnishah/cube26-rcy-0266-mdmoghnishah/blob/main/backend/recovery/packets.py): `backend/recovery/packets.py`
- [Policy context](https://github.com/mdmoghnishah/cube26-rcy-0266-mdmoghnishah/blob/main/backend/recovery/policies.py): `backend/recovery/policies.py`
- [Assessment evaluation](https://github.com/mdmoghnishah/cube26-rcy-0266-mdmoghnishah/blob/main/backend/recovery/evaluation.py): `backend/recovery/evaluation.py`

### Persistence and integrations

- [Org-scoped DB access](https://github.com/mdmoghnishah/cube26-rcy-0266-mdmoghnishah/blob/main/backend/recovery/db.py): `backend/recovery/db.py`
- **PostgreSQL records and reviews**
- [AI summaries](https://github.com/mdmoghnishah/cube26-rcy-0266-mdmoghnishah/blob/main/backend/recovery/ai.py): `backend/recovery/ai.py`

### Other components

- **Seller operator**
- **OpenAI API**

## Connections

- Seller operator → Dashboard: uses (evidence: `README.md`)
- Dashboard → HTTP API: requests assessments (evidence: `README.md`)
- HTTP API → Org authentication: authenticates (evidence: `backend/recovery/api.py`)
- HTTP API → Report upload: imports uploaded report (evidence: `backend/recovery/api.py`)
- Seller operator → Reference importer: runs reference import (evidence: `README.md`)
- Report upload → Org-scoped DB access: writes validated rows (evidence: `backend/recovery/report_upload.py`)
- Reference importer → Org-scoped DB access: stores imported rows (evidence: `backend/recovery/importer.py`)
- HTTP API → Assessment orchestration: runs assessment (evidence: `backend/recovery/api.py`)
- Assessment orchestration → Evidence matching: matches charges (evidence: `backend/recovery/decisions.py`)
- Assessment orchestration → Prep evidence rules: applies prep rules (evidence: `backend/recovery/decisions.py`)
- Prep evidence rules → Dispatch packaging rules: checks dispatch packaging (evidence: `backend/recovery/prep_rules.py`)
- Assessment orchestration → Return receipt rules: assesses return charges (evidence: `backend/recovery/decisions.py`)
- Assessment orchestration → Reimbursement reconciliation: reconciles reimbursements (evidence: `backend/recovery/decisions.py`)
- Assessment orchestration → Org-scoped DB access: saves assessments (evidence: `backend/recovery/decisions.py`)
- Org-scoped DB access → PostgreSQL records and reviews: reads and writes (evidence: `backend/recovery/db.py`)
- HTTP API → PostgreSQL records and reviews: reads decisions and reviews (evidence: `backend/recovery/api.py`)
- HTTP API → AI summaries: queues unit summary (evidence: `backend/recovery/api.py`)
- AI summaries → PostgreSQL records and reviews: loads and updates summaries (evidence: `backend/recovery/ai.py`)
- AI summaries → OpenAI API: requests summary (evidence: `backend/recovery/ai.py`)
- HTTP API → Potential amount calculation: calculates potential amount
- HTTP API → Review packet export: builds review packet (evidence: `backend/recovery/api.py`)
- Review packet export → Potential amount calculation: uses claim calculation (evidence: `backend/recovery/packets.py`)
- Review packet export → Policy context: uses policy context (evidence: `backend/recovery/packets.py`)
- Seller operator → Assessment evaluation: reviews evaluation outputs (evidence: `README.md`)
- Assessment evaluation → Potential amount calculation: evaluates potential claims (evidence: `backend/recovery/evaluation.py`)
- Assessment evaluation → Assessment orchestration: evaluates assessments (evidence: `backend/recovery/evaluation.py`)
