# jaypatel1511/nmtc-calc architecture

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

- Interactive diagram: https://gitdiagram.com/jaypatel1511/nmtc-calc
- Repository: https://github.com/jaypatel1511/nmtc-calc

## Overview

nmtc-calc is a pedagogical Python model of a simplified single-CDE NMTC leveraged structure, not an underwriting tool. A user supplies an NMTCDeal, then independently requests the capital-stack structure, statutory credit schedule, credit-only investor analysis, QALICB subsidy analysis, and cash-flow/DSCR waterfall. Results disclose supplied versus derived figures and refuse unsupported calculations. The package also offers sensitivity sweeps. The graph follows the documented API and sampled source references; unsampled implementation details are not inferred beyond those references.

Main entry points: [`nmtccalc/data/schema.py`](https://github.com/jaypatel1511/nmtc-calc/blob/main/nmtccalc/data/schema.py) (Deal contract), [`nmtccalc/utils/__init__.py`](https://github.com/jaypatel1511/nmtc-calc/blob/main/nmtccalc/utils/__init__.py) (Sensitivity sweeps), [`nmtccalc/_format.py`](https://github.com/jaypatel1511/nmtc-calc/blob/main/nmtccalc/_format.py) (Money formatting), [`nmtccalc/models/waterfall.py`](https://github.com/jaypatel1511/nmtc-calc/blob/main/nmtccalc/models/waterfall.py) (Cash flow waterfall)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_inputs["Deal inputs"]
  node_deal["Deal contract<br/>[schema.py]"]
end

subgraph group_model["NMTC analyses"]
  node_transaction["Capital stack<br/>[transaction.py]"]
  node_credits["Credit schedule<br/>[credits.py]"]
  node_investor["Investor returns<br/>[investor.py]"]
  node_subsidy["QALICB subsidy<br/>[subsidy.py]"]
  node_waterfall["Cash flow waterfall<br/>[waterfall.py]"]
  node_sensitivity["Sensitivity sweeps<br/>[__init__.py]"]
end

subgraph group_support["Rules and support"]
  node_statute["Statutory rules<br/>[statute.py]"]
  node_errors["Validation errors<br/>[exceptions.py]"]
  node_format["Money formatting<br/>[_format.py]"]
end

node_user(("Analyst"))

node_user -->|"supplies inputs"| node_deal
node_user -->|"requests structure"| node_transaction
node_user -->|"requests schedule"| node_credits
node_user -->|"requests analysis"| node_investor
node_user -->|"requests analysis"| node_subsidy
node_user -->|"requests analysis"| node_waterfall
node_user -->|"requests sweep"| node_sensitivity
node_deal -->|"provides inputs"| node_transaction
node_deal -->|"provides inputs"| node_credits
node_deal -->|"provides inputs"| node_investor
node_deal -->|"provides inputs"| node_subsidy
node_deal -->|"provides inputs"| node_waterfall
node_deal -->|"provides base case"| node_sensitivity
node_transaction -->|"uses rules"| node_statute
node_credits -->|"uses schedule rules"| node_statute
node_investor -->|"uses allowance rules"| node_statute
node_subsidy -->|"uses statutory guidance"| node_statute
node_waterfall -->|"uses recapture rules"| node_statute
node_deal -->|"validates against rules"| node_statute
node_deal -->|"raises refusals"| node_errors
node_waterfall -->|"warns on shortfall"| node_errors
node_deal -->|"formats refusal details"| node_format
node_transaction -->|"formats figures"| node_format
node_credits -->|"formats figures"| node_format
node_investor -->|"formats figures"| node_format
node_subsidy -->|"formats figures"| node_format
node_waterfall -->|"formats figures"| node_format
node_sensitivity -->|"formats sweep tables"| node_format
node_sensitivity -->|"analyzes each case"| node_investor
node_sensitivity -->|"analyzes each case"| node_subsidy
node_sensitivity -->|"checks servicing"| node_waterfall
node_sensitivity -->|"recomputes schedule"| node_credits

click node_deal "https://github.com/jaypatel1511/nmtc-calc/blob/main/nmtccalc/data/schema.py"
click node_transaction "https://github.com/jaypatel1511/nmtc-calc/blob/main/nmtccalc/models/transaction.py"
click node_credits "https://github.com/jaypatel1511/nmtc-calc/blob/main/nmtccalc/models/credits.py"
click node_investor "https://github.com/jaypatel1511/nmtc-calc/blob/main/nmtccalc/models/investor.py"
click node_subsidy "https://github.com/jaypatel1511/nmtc-calc/blob/main/nmtccalc/models/subsidy.py"
click node_waterfall "https://github.com/jaypatel1511/nmtc-calc/blob/main/nmtccalc/models/waterfall.py"
click node_sensitivity "https://github.com/jaypatel1511/nmtc-calc/blob/main/nmtccalc/utils/__init__.py"
click node_statute "https://github.com/jaypatel1511/nmtc-calc/blob/main/nmtccalc/statute.py"
click node_errors "https://github.com/jaypatel1511/nmtc-calc/blob/main/nmtccalc/exceptions.py"
click node_format "https://github.com/jaypatel1511/nmtc-calc/blob/main/nmtccalc/_format.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_deal toneBlue
class node_transaction,node_credits,node_investor,node_subsidy,node_waterfall,node_sensitivity toneAmber
class node_statute,node_errors,node_format toneMint
class node_user toneIndigo
```

## Components

### Deal inputs

- [Deal contract](https://github.com/jaypatel1511/nmtc-calc/blob/main/nmtccalc/data/schema.py): `nmtccalc/data/schema.py`

### NMTC analyses

- [Capital stack](https://github.com/jaypatel1511/nmtc-calc/blob/main/nmtccalc/models/transaction.py): `nmtccalc/models/transaction.py`
- [Credit schedule](https://github.com/jaypatel1511/nmtc-calc/blob/main/nmtccalc/models/credits.py): `nmtccalc/models/credits.py`
- [Investor returns](https://github.com/jaypatel1511/nmtc-calc/blob/main/nmtccalc/models/investor.py): `nmtccalc/models/investor.py`
- [QALICB subsidy](https://github.com/jaypatel1511/nmtc-calc/blob/main/nmtccalc/models/subsidy.py): `nmtccalc/models/subsidy.py`
- [Cash flow waterfall](https://github.com/jaypatel1511/nmtc-calc/blob/main/nmtccalc/models/waterfall.py): `nmtccalc/models/waterfall.py`
- [Sensitivity sweeps](https://github.com/jaypatel1511/nmtc-calc/blob/main/nmtccalc/utils/__init__.py): `nmtccalc/utils/__init__.py`

### Rules and support

- [Statutory rules](https://github.com/jaypatel1511/nmtc-calc/blob/main/nmtccalc/statute.py): `nmtccalc/statute.py`
- [Validation errors](https://github.com/jaypatel1511/nmtc-calc/blob/main/nmtccalc/exceptions.py): `nmtccalc/exceptions.py`
- [Money formatting](https://github.com/jaypatel1511/nmtc-calc/blob/main/nmtccalc/_format.py): `nmtccalc/_format.py`

### Other components

- **Analyst**

## Connections

- Analyst → Deal contract: supplies inputs (evidence: `README.md`)
- Analyst → Capital stack: requests structure (evidence: `README.md`)
- Analyst → Credit schedule: requests schedule (evidence: `README.md`)
- Analyst → Investor returns: requests analysis (evidence: `README.md`)
- Analyst → QALICB subsidy: requests analysis (evidence: `README.md`)
- Analyst → Cash flow waterfall: requests analysis (evidence: `README.md`)
- Analyst → Sensitivity sweeps: requests sweep (evidence: `README.md`)
- Deal contract → Capital stack: provides inputs (evidence: `README.md`)
- Deal contract → Credit schedule: provides inputs (evidence: `README.md`)
- Deal contract → Investor returns: provides inputs (evidence: `README.md`)
- Deal contract → QALICB subsidy: provides inputs (evidence: `README.md`)
- Deal contract → Cash flow waterfall: provides inputs (evidence: `README.md`)
- Deal contract → Sensitivity sweeps: provides base case (evidence: `README.md`)
- Capital stack → Statutory rules: uses rules (evidence: `nmtccalc/models/transaction.py`)
- Credit schedule → Statutory rules: uses schedule rules (evidence: `nmtccalc/models/credits.py`)
- Investor returns → Statutory rules: uses allowance rules (evidence: `nmtccalc/models/investor.py`)
- QALICB subsidy → Statutory rules: uses statutory guidance (evidence: `nmtccalc/models/subsidy.py`)
- Cash flow waterfall → Statutory rules: uses recapture rules (evidence: `nmtccalc/models/waterfall.py`)
- Deal contract → Statutory rules: validates against rules (evidence: `nmtccalc/data/schema.py`)
- Deal contract → Validation errors: raises refusals (evidence: `nmtccalc/data/schema.py`)
- Cash flow waterfall → Validation errors: warns on shortfall (evidence: `nmtccalc/models/waterfall.py`)
- Deal contract → Money formatting: formats refusal details (evidence: `nmtccalc/data/schema.py`)
- Capital stack → Money formatting: formats figures (evidence: `nmtccalc/models/transaction.py`)
- Credit schedule → Money formatting: formats figures (evidence: `nmtccalc/models/credits.py`)
- Investor returns → Money formatting: formats figures (evidence: `nmtccalc/models/investor.py`)
- QALICB subsidy → Money formatting: formats figures (evidence: `nmtccalc/models/subsidy.py`)
- Cash flow waterfall → Money formatting: formats figures (evidence: `nmtccalc/models/waterfall.py`)
- Sensitivity sweeps → Money formatting: formats sweep tables (evidence: `nmtccalc/utils/__init__.py`)
- Sensitivity sweeps → Investor returns: analyzes each case (evidence: `nmtccalc/utils/__init__.py`)
- Sensitivity sweeps → QALICB subsidy: analyzes each case (evidence: `nmtccalc/utils/__init__.py`)
- Sensitivity sweeps → Cash flow waterfall: checks servicing (evidence: `nmtccalc/utils/__init__.py`)
- Sensitivity sweeps → Credit schedule: recomputes schedule (evidence: `nmtccalc/utils/__init__.py`)
