# jaypatel1511/cdfi-benchmark architecture

> Architecture diagram of the GitHub repository jaypatel1511/cdfi-benchmark, 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/cdfi-benchmark
- Repository: https://github.com/jaypatel1511/cdfi-benchmark

## Overview

cdfi-benchmark is a Python tool for comparing CDFI/MDI financial performance with FDIC-sourced peers. The main workflow is institution lookup and financial retrieval, peer selection, metric calculation and grading, then report or table generation. Its schema layer carries institution and benchmark data, including threshold provenance and reporting-period rules. The README also documents synthetic peer groups and ranking capabilities. Connections between the sampled modules are shown only where the excerpts or README support them; some internal calls are not visible in the partial excerpts.

Main entry points: [`cdfibenchmark/data/fdic.py`](https://github.com/jaypatel1511/cdfi-benchmark/blob/main/cdfibenchmark/data/fdic.py) (FDIC API access), [`cdfibenchmark/report/generator.py`](https://github.com/jaypatel1511/cdfi-benchmark/blob/main/cdfibenchmark/report/generator.py) (Benchmark report), [`cdfibenchmark/peers/selector.py`](https://github.com/jaypatel1511/cdfi-benchmark/blob/main/cdfibenchmark/peers/selector.py) (Peer selection), [`cdfibenchmark/metrics/calculator.py`](https://github.com/jaypatel1511/cdfi-benchmark/blob/main/cdfibenchmark/metrics/calculator.py) (Metrics and ranking)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_acquisition["FDIC Data"]
  node_fdic["FDIC API access<br/>[fdic.py]"]
end

subgraph group_domain["Benchmark Domain"]
  node_schema["Profiles and benchmarks<br/>[schema.py]"]
  node_errors["Typed errors<br/>[exceptions.py]"]
  node_api["Package API<br/>[__init__.py]"]
end

subgraph group_analysis["Peer Analysis"]
  node_peer_select["Peer selection<br/>[selector.py]"]
  node_metrics["Metrics and ranking<br/>[calculator.py]"]
end

subgraph group_outputs["Results"]
  node_report["Benchmark report<br/>[generator.py]"]
end

node_user(("Analyst"))
node_fdic_service{{"FDIC BankFind"}}

node_user -->|"requests data"| node_fdic
node_fdic -->|"fetches records"| node_fdic_service
node_fdic -->|"parses profiles"| node_schema
node_fdic -->|"raises on failure"| node_errors
node_user -->|"builds peer group"| node_peer_select
node_peer_select -.->|"loads peer data"| node_fdic
node_peer_select -.->|"computes peer metrics"| node_metrics
node_user -->|"generates report"| node_report
node_user -->|"requests ranking"| node_metrics
node_api -->|"exports functions"| node_fdic
node_api -->|"exports functions"| node_peer_select
node_api -->|"exports functions"| node_metrics
node_api -->|"exports functions"| node_report
node_metrics -->|"uses definitions"| node_schema
node_report -.->|"uses definitions"| node_schema
node_report -.->|"renders results"| node_metrics
node_report -.->|"renders caveats"| node_peer_select

click node_fdic "https://github.com/jaypatel1511/cdfi-benchmark/blob/main/cdfibenchmark/data/fdic.py"
click node_schema "https://github.com/jaypatel1511/cdfi-benchmark/blob/main/cdfibenchmark/data/schema.py"
click node_errors "https://github.com/jaypatel1511/cdfi-benchmark/blob/main/cdfibenchmark/exceptions.py"
click node_peer_select "https://github.com/jaypatel1511/cdfi-benchmark/blob/main/cdfibenchmark/peers/selector.py"
click node_metrics "https://github.com/jaypatel1511/cdfi-benchmark/blob/main/cdfibenchmark/metrics/calculator.py"
click node_report "https://github.com/jaypatel1511/cdfi-benchmark/blob/main/cdfibenchmark/report/generator.py"
click node_api "https://github.com/jaypatel1511/cdfi-benchmark/blob/main/cdfibenchmark/__init__.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_fdic toneBlue
class node_schema,node_errors,node_api toneAmber
class node_peer_select,node_metrics toneMint
class node_report toneRose
class node_user,node_fdic_service toneIndigo
```

## Components

### FDIC Data

- [FDIC API access](https://github.com/jaypatel1511/cdfi-benchmark/blob/main/cdfibenchmark/data/fdic.py): `cdfibenchmark/data/fdic.py`

### Benchmark Domain

- [Profiles and benchmarks](https://github.com/jaypatel1511/cdfi-benchmark/blob/main/cdfibenchmark/data/schema.py): `cdfibenchmark/data/schema.py`
- [Typed errors](https://github.com/jaypatel1511/cdfi-benchmark/blob/main/cdfibenchmark/exceptions.py): `cdfibenchmark/exceptions.py`
- [Package API](https://github.com/jaypatel1511/cdfi-benchmark/blob/main/cdfibenchmark/__init__.py): `cdfibenchmark/__init__.py`

### Peer Analysis

- [Peer selection](https://github.com/jaypatel1511/cdfi-benchmark/blob/main/cdfibenchmark/peers/selector.py): `cdfibenchmark/peers/selector.py`
- [Metrics and ranking](https://github.com/jaypatel1511/cdfi-benchmark/blob/main/cdfibenchmark/metrics/calculator.py): `cdfibenchmark/metrics/calculator.py`

### Results

- [Benchmark report](https://github.com/jaypatel1511/cdfi-benchmark/blob/main/cdfibenchmark/report/generator.py): `cdfibenchmark/report/generator.py`

### Other components

- **Analyst**
- **FDIC BankFind**

## Connections

- Analyst → FDIC API access: requests data (evidence: `README.md`)
- FDIC API access → FDIC BankFind: fetches records (evidence: `cdfibenchmark/data/fdic.py`)
- FDIC API access → Profiles and benchmarks: parses profiles (evidence: `cdfibenchmark/data/fdic.py`)
- FDIC API access → Typed errors: raises on failure (evidence: `cdfibenchmark/data/fdic.py`)
- Analyst → Peer selection: builds peer group (evidence: `README.md`)
- Peer selection → FDIC API access: loads peer data (evidence: `cdfibenchmark/peers/selector.py`)
- Peer selection → Metrics and ranking: computes peer metrics (evidence: `cdfibenchmark/peers/selector.py`)
- Analyst → Benchmark report: generates report (evidence: `README.md`)
- Analyst → Metrics and ranking: requests ranking
- Package API → FDIC API access: exports functions (evidence: `cdfibenchmark/__init__.py`)
- Package API → Peer selection: exports functions (evidence: `cdfibenchmark/__init__.py`)
- Package API → Metrics and ranking: exports functions (evidence: `cdfibenchmark/__init__.py`)
- Package API → Benchmark report: exports functions (evidence: `cdfibenchmark/__init__.py`)
- Metrics and ranking → Profiles and benchmarks: uses definitions (evidence: `cdfibenchmark/metrics/calculator.py`)
- Benchmark report → Profiles and benchmarks: uses definitions (evidence: `cdfibenchmark/report/generator.py`)
- Benchmark report → Metrics and ranking: renders results (evidence: `cdfibenchmark/report/generator.py`)
- Benchmark report → Peer selection: renders caveats (evidence: `cdfibenchmark/report/generator.py`)
