# jaypatel1511/hmda-analyzer architecture

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

## Overview

hmda-analyzer is a Python library for analyzing CFPB HMDA mortgage-loan application data. Users load sample, local CSV, or API data, then run disparity, geographic, lender, or CRA-proxy analyses and optionally generate a report. The loader uses a dedicated HTTP layer for CFPB requests; schema definitions and geography-vintage checks support data validation and interpretation. The README and excerpts establish the main capabilities and several calls, but not every internal dependency; uncertain links are omitted.

Main entry points: [`hmdaanalyzer/__init__.py`](https://github.com/jaypatel1511/hmda-analyzer/blob/main/hmdaanalyzer/__init__.py) (Public API), [`hmdaanalyzer/report/generator.py`](https://github.com/jaypatel1511/hmda-analyzer/blob/main/hmdaanalyzer/report/generator.py) (Report generator), [`hmdaanalyzer/analysis/lender.py`](https://github.com/jaypatel1511/hmda-analyzer/blob/main/hmdaanalyzer/analysis/lender.py) (Lender analysis), [`hmdaanalyzer/analysis/disparity.py`](https://github.com/jaypatel1511/hmda-analyzer/blob/main/hmdaanalyzer/analysis/disparity.py) (Disparity analysis)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ingestion["Data ingestion"]
  node_loader["HMDA loaders<br/>[loader.py]"]
  node_http["HTTP fetch<br/>[_http.py]"]
end

subgraph group_validation["Data safeguards"]
  node_schema["LAR schema<br/>[schema.py]"]
  node_exceptions["Typed refusals<br/>[exceptions.py]"]
  node_vintage["Geography vintage"]
end

subgraph group_analysis["Analysis"]
  node_disparity["Disparity analysis<br/>[disparity.py]"]
  node_geographic["Geographic analysis<br/>[geographic.py]"]
  node_lender["Lender analysis<br/>[lender.py]"]
  node_cra["CRA proxy<br/>[cra_proxy.py]"]
  node_methodology["Methodology notes"]
end

subgraph group_reporting["Reporting"]
  node_report["Report generator<br/>[generator.py]"]
  node_exports["Public API<br/>[__init__.py]"]
end

node_user(("Python user"))
node_api["CFPB Data API"]

node_user -->|"calls"| node_exports
node_exports -->|"exports"| node_loader
node_exports -->|"exports"| node_disparity
node_exports -->|"exports"| node_geographic
node_exports -->|"exports"| node_lender
node_exports -->|"exports"| node_cra
node_exports -->|"exports"| node_report
node_loader -->|"fetches via"| node_http
node_http -->|"requests data"| node_api
node_loader -->|"validates against"| node_schema
node_loader -->|"tags provenance"| node_vintage
node_disparity -->|"uses constants"| node_schema
node_disparity -->|"raises"| node_exceptions
node_geographic -->|"checks geography"| node_vintage
node_geographic -->|"raises"| node_exceptions
node_lender -->|"uses rates"| node_disparity
node_lender -->|"checks geography"| node_vintage
node_lender -->|"raises"| node_exceptions
node_cra -->|"raises"| node_exceptions
node_cra -->|"loads notes"| node_methodology
node_report -->|"calls"| node_disparity
node_report -->|"calls"| node_geographic
node_report -->|"calls"| node_lender
node_report -->|"uses constants"| node_schema
node_report -->|"handles refusals"| node_exceptions

click node_loader "https://github.com/jaypatel1511/hmda-analyzer/blob/main/hmdaanalyzer/data/loader.py"
click node_http "https://github.com/jaypatel1511/hmda-analyzer/blob/main/hmdaanalyzer/_http.py"
click node_schema "https://github.com/jaypatel1511/hmda-analyzer/blob/main/hmdaanalyzer/data/schema.py"
click node_exceptions "https://github.com/jaypatel1511/hmda-analyzer/blob/main/hmdaanalyzer/exceptions.py"
click node_vintage "https://github.com/jaypatel1511/hmda-analyzer/blob/main/hmdaanalyzer/geography_vintage.py"
click node_disparity "https://github.com/jaypatel1511/hmda-analyzer/blob/main/hmdaanalyzer/analysis/disparity.py"
click node_geographic "https://github.com/jaypatel1511/hmda-analyzer/blob/main/hmdaanalyzer/analysis/geographic.py"
click node_lender "https://github.com/jaypatel1511/hmda-analyzer/blob/main/hmdaanalyzer/analysis/lender.py"
click node_cra "https://github.com/jaypatel1511/hmda-analyzer/blob/main/hmdaanalyzer/analysis/cra_proxy.py"
click node_methodology "https://github.com/jaypatel1511/hmda-analyzer/tree/main/hmdaanalyzer/methodology"
click node_report "https://github.com/jaypatel1511/hmda-analyzer/blob/main/hmdaanalyzer/report/generator.py"
click node_exports "https://github.com/jaypatel1511/hmda-analyzer/blob/main/hmdaanalyzer/__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_loader,node_http,node_user toneBlue
class node_schema,node_exceptions,node_vintage toneAmber
class node_disparity,node_geographic,node_lender,node_cra,node_methodology,node_api toneMint
class node_report,node_exports toneRose
```

## Components

### Data ingestion

- [HMDA loaders](https://github.com/jaypatel1511/hmda-analyzer/blob/main/hmdaanalyzer/data/loader.py): `hmdaanalyzer/data/loader.py`
- [HTTP fetch](https://github.com/jaypatel1511/hmda-analyzer/blob/main/hmdaanalyzer/_http.py): `hmdaanalyzer/_http.py`

### Data safeguards

- [LAR schema](https://github.com/jaypatel1511/hmda-analyzer/blob/main/hmdaanalyzer/data/schema.py): `hmdaanalyzer/data/schema.py`
- [Typed refusals](https://github.com/jaypatel1511/hmda-analyzer/blob/main/hmdaanalyzer/exceptions.py): `hmdaanalyzer/exceptions.py`
- [Geography vintage](https://github.com/jaypatel1511/hmda-analyzer/blob/main/hmdaanalyzer/geography_vintage.py): `hmdaanalyzer/geography_vintage.py`

### Analysis

- [Disparity analysis](https://github.com/jaypatel1511/hmda-analyzer/blob/main/hmdaanalyzer/analysis/disparity.py): `hmdaanalyzer/analysis/disparity.py`
- [Geographic analysis](https://github.com/jaypatel1511/hmda-analyzer/blob/main/hmdaanalyzer/analysis/geographic.py): `hmdaanalyzer/analysis/geographic.py`
- [Lender analysis](https://github.com/jaypatel1511/hmda-analyzer/blob/main/hmdaanalyzer/analysis/lender.py): `hmdaanalyzer/analysis/lender.py`
- [CRA proxy](https://github.com/jaypatel1511/hmda-analyzer/blob/main/hmdaanalyzer/analysis/cra_proxy.py): `hmdaanalyzer/analysis/cra_proxy.py`
- [Methodology notes](https://github.com/jaypatel1511/hmda-analyzer/tree/main/hmdaanalyzer/methodology): `hmdaanalyzer/methodology`

### Reporting

- [Report generator](https://github.com/jaypatel1511/hmda-analyzer/blob/main/hmdaanalyzer/report/generator.py): `hmdaanalyzer/report/generator.py`
- [Public API](https://github.com/jaypatel1511/hmda-analyzer/blob/main/hmdaanalyzer/__init__.py): `hmdaanalyzer/__init__.py`

### Other components

- **Python user**
- **CFPB Data API**

## Connections

- Python user → Public API: calls (evidence: `README.md`)
- Public API → HMDA loaders: exports (evidence: `hmdaanalyzer/__init__.py`)
- Public API → Disparity analysis: exports (evidence: `hmdaanalyzer/__init__.py`)
- Public API → Geographic analysis: exports (evidence: `hmdaanalyzer/__init__.py`)
- Public API → Lender analysis: exports (evidence: `hmdaanalyzer/__init__.py`)
- Public API → CRA proxy: exports (evidence: `hmdaanalyzer/__init__.py`)
- Public API → Report generator: exports (evidence: `hmdaanalyzer/__init__.py`)
- HMDA loaders → HTTP fetch: fetches via (evidence: `hmdaanalyzer/data/loader.py`)
- HTTP fetch → CFPB Data API: requests data (evidence: `hmdaanalyzer/_http.py`)
- HMDA loaders → LAR schema: validates against (evidence: `hmdaanalyzer/data/loader.py`)
- HMDA loaders → Geography vintage: tags provenance (evidence: `hmdaanalyzer/data/loader.py`)
- Disparity analysis → LAR schema: uses constants (evidence: `hmdaanalyzer/analysis/disparity.py`)
- Disparity analysis → Typed refusals: raises (evidence: `hmdaanalyzer/analysis/disparity.py`)
- Geographic analysis → Geography vintage: checks geography (evidence: `hmdaanalyzer/analysis/geographic.py`)
- Geographic analysis → Typed refusals: raises (evidence: `hmdaanalyzer/analysis/geographic.py`)
- Lender analysis → Disparity analysis: uses rates (evidence: `hmdaanalyzer/analysis/lender.py`)
- Lender analysis → Geography vintage: checks geography (evidence: `hmdaanalyzer/analysis/lender.py`)
- Lender analysis → Typed refusals: raises (evidence: `hmdaanalyzer/analysis/lender.py`)
- CRA proxy → Typed refusals: raises (evidence: `hmdaanalyzer/analysis/cra_proxy.py`)
- CRA proxy → Methodology notes: loads notes (evidence: `hmdaanalyzer/analysis/cra_proxy.py`)
- Report generator → Disparity analysis: calls (evidence: `hmdaanalyzer/report/generator.py`)
- Report generator → Geographic analysis: calls (evidence: `hmdaanalyzer/report/generator.py`)
- Report generator → Lender analysis: calls (evidence: `hmdaanalyzer/report/generator.py`)
- Report generator → LAR schema: uses constants (evidence: `hmdaanalyzer/report/generator.py`)
- Report generator → Typed refusals: handles refusals (evidence: `hmdaanalyzer/report/generator.py`)
