# pranjal1-1/gramcred architecture

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

- Interactive diagram: https://gitdiagram.com/pranjal1-1/gramcred
- Repository: https://github.com/pranjal1-1/gramcred

## Overview

GramCred is an offline-first financial intelligence platform for rural micro-enterprises. Its documented workflow brings enterprise and financial records together with market, weather, and crop information to produce forecasts, risk signals, explanations, and actionable analytics. The README describes a PySide6 presentation layer over application use cases, a framework-independent domain, ports, and infrastructure adapters; the sampled implementation currently shows configuration, structured logging, and SQLite setup, not the product workflow itself. Other capability nodes reflect the README and documentation tree; their runtime wiring is not shown.

Main entry points: [`docs/06_AI_ARCHITECTURE.md`](https://github.com/pranjal1-1/gramcred/blob/master/docs/06_AI_ARCHITECTURE.md) (Financial intelligence), [`docs/05_UI_UX_SPECIFICATION.md`](https://github.com/pranjal1-1/gramcred/blob/master/docs/05_UI_UX_SPECIFICATION.md) (Desktop UI), [`src/gramcred/application`](https://github.com/pranjal1-1/gramcred/tree/master/src/gramcred/application) (Application use cases), [`src/gramcred/domain`](https://github.com/pranjal1-1/gramcred/tree/master/src/gramcred/domain) (Business domain)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_product["User capabilities"]
  node_presentation["Desktop UI"]
  node_enterprise["Enterprise data<br/>[02_SRS.md]"]
  node_records["Financial records"]
  node_market["Market prices"]
  node_weather["Weather data"]
  node_crops["Crop information"]
  node_insights["Financial intelligence"]
  node_forecasts["Forecasts"]
  node_risk["Risk signals"]
  node_explanations["Explanations"]
  node_analytics["Actionable analytics"]
end

subgraph group_core["Application and domain"]
  node_usecases["Application use cases"]
  node_domain["Business domain"]
  node_ports["Domain ports<br/>[__init__.py]"]
end

subgraph group_infra["Infrastructure"]
  node_sync["Offline sync"]
  node_database["SQLite engine<br/>[engine.py]"]
  node_store[("Local database")]
  node_config["App configuration<br/>[__init__.py]"]
  node_logging["Structured logging<br/>[__init__.py]"]
end

node_operator(("Enterprise user"))

node_operator -->|"uses"| node_presentation
node_presentation -->|"presents"| node_usecases
node_usecases -->|"orchestrates"| node_domain
node_domain -->|"depends on"| node_ports
node_ports -->|"implemented by"| node_database
node_database -->|"reads and writes"| node_store
node_enterprise -->|"informs"| node_insights
node_records -->|"informs"| node_insights
node_market -->|"informs"| node_insights
node_weather -->|"informs"| node_insights
node_crops -->|"informs"| node_insights
node_insights -->|"produces"| node_forecasts
node_insights -->|"produces"| node_risk
node_insights -->|"produces"| node_explanations
node_insights -->|"produces"| node_analytics
node_config -->|"configures"| node_logging
node_operator -.->|"reviews"| node_analytics
node_sync -.->|"synchronizes"| node_store

click node_presentation "https://github.com/pranjal1-1/gramcred/blob/master/docs/05_UI_UX_SPECIFICATION.md"
click node_enterprise "https://github.com/pranjal1-1/gramcred/blob/master/docs/02_SRS.md"
click node_records "https://github.com/pranjal1-1/gramcred/blob/master/docs/04_DATA_AND_DATABASE_DESIGN.md"
click node_market "https://github.com/pranjal1-1/gramcred/blob/master/docs/17_DATA_PIPELINES.md"
click node_weather "https://github.com/pranjal1-1/gramcred/blob/master/docs/17_DATA_PIPELINES.md"
click node_crops "https://github.com/pranjal1-1/gramcred/blob/master/docs/17_DATA_PIPELINES.md"
click node_insights "https://github.com/pranjal1-1/gramcred/blob/master/docs/06_AI_ARCHITECTURE.md"
click node_forecasts "https://github.com/pranjal1-1/gramcred/blob/master/docs/06_AI_ARCHITECTURE.md"
click node_risk "https://github.com/pranjal1-1/gramcred/blob/master/docs/06_AI_ARCHITECTURE.md"
click node_explanations "https://github.com/pranjal1-1/gramcred/blob/master/docs/06_AI_ARCHITECTURE.md"
click node_analytics "https://github.com/pranjal1-1/gramcred/blob/master/docs/10_REPORTING_ANALYTICS.md"
click node_usecases "https://github.com/pranjal1-1/gramcred/tree/master/src/gramcred/application"
click node_domain "https://github.com/pranjal1-1/gramcred/tree/master/src/gramcred/domain"
click node_ports "https://github.com/pranjal1-1/gramcred/blob/master/src/gramcred/domain/ports/__init__.py"
click node_sync "https://github.com/pranjal1-1/gramcred/blob/master/docs/08_SYNC_AND_OFFLINE.md"
click node_database "https://github.com/pranjal1-1/gramcred/blob/master/src/gramcred/infrastructure/database/engine.py"
click node_config "https://github.com/pranjal1-1/gramcred/blob/master/src/gramcred/infrastructure/config/__init__.py"
click node_logging "https://github.com/pranjal1-1/gramcred/blob/master/src/gramcred/infrastructure/logging/__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_presentation,node_enterprise,node_records,node_market,node_weather,node_crops,node_insights,node_forecasts,node_risk,node_explanations,node_analytics,node_operator toneBlue
class node_usecases,node_domain,node_ports toneAmber
class node_sync,node_database,node_store,node_config,node_logging toneMint
```

## Components

### User capabilities

- [Desktop UI](https://github.com/pranjal1-1/gramcred/blob/master/docs/05_UI_UX_SPECIFICATION.md): `docs/05_UI_UX_SPECIFICATION.md`
- [Enterprise data](https://github.com/pranjal1-1/gramcred/blob/master/docs/02_SRS.md): `docs/02_SRS.md`
- [Financial records](https://github.com/pranjal1-1/gramcred/blob/master/docs/04_DATA_AND_DATABASE_DESIGN.md): `docs/04_DATA_AND_DATABASE_DESIGN.md`
- [Market prices](https://github.com/pranjal1-1/gramcred/blob/master/docs/17_DATA_PIPELINES.md): `docs/17_DATA_PIPELINES.md`
- [Weather data](https://github.com/pranjal1-1/gramcred/blob/master/docs/17_DATA_PIPELINES.md): `docs/17_DATA_PIPELINES.md`
- [Crop information](https://github.com/pranjal1-1/gramcred/blob/master/docs/17_DATA_PIPELINES.md): `docs/17_DATA_PIPELINES.md`
- [Financial intelligence](https://github.com/pranjal1-1/gramcred/blob/master/docs/06_AI_ARCHITECTURE.md): `docs/06_AI_ARCHITECTURE.md`
- [Forecasts](https://github.com/pranjal1-1/gramcred/blob/master/docs/06_AI_ARCHITECTURE.md): `docs/06_AI_ARCHITECTURE.md`
- [Risk signals](https://github.com/pranjal1-1/gramcred/blob/master/docs/06_AI_ARCHITECTURE.md): `docs/06_AI_ARCHITECTURE.md`
- [Explanations](https://github.com/pranjal1-1/gramcred/blob/master/docs/06_AI_ARCHITECTURE.md): `docs/06_AI_ARCHITECTURE.md`
- [Actionable analytics](https://github.com/pranjal1-1/gramcred/blob/master/docs/10_REPORTING_ANALYTICS.md): `docs/10_REPORTING_ANALYTICS.md`

### Application and domain

- [Application use cases](https://github.com/pranjal1-1/gramcred/tree/master/src/gramcred/application): `src/gramcred/application`
- [Business domain](https://github.com/pranjal1-1/gramcred/tree/master/src/gramcred/domain): `src/gramcred/domain`
- [Domain ports](https://github.com/pranjal1-1/gramcred/blob/master/src/gramcred/domain/ports/__init__.py): `src/gramcred/domain/ports/__init__.py`

### Infrastructure

- [Offline sync](https://github.com/pranjal1-1/gramcred/blob/master/docs/08_SYNC_AND_OFFLINE.md): `docs/08_SYNC_AND_OFFLINE.md`
- [SQLite engine](https://github.com/pranjal1-1/gramcred/blob/master/src/gramcred/infrastructure/database/engine.py): `src/gramcred/infrastructure/database/engine.py`
- **Local database**
- [App configuration](https://github.com/pranjal1-1/gramcred/blob/master/src/gramcred/infrastructure/config/__init__.py): `src/gramcred/infrastructure/config/__init__.py`
- [Structured logging](https://github.com/pranjal1-1/gramcred/blob/master/src/gramcred/infrastructure/logging/__init__.py): `src/gramcred/infrastructure/logging/__init__.py`

### Other components

- **Enterprise user**

## Connections

- Enterprise user → Desktop UI: uses (evidence: `README.md`)
- Desktop UI → Application use cases: presents (evidence: `README.md`)
- Application use cases → Business domain: orchestrates (evidence: `README.md`)
- Business domain → Domain ports: depends on (evidence: `README.md`)
- Domain ports → SQLite engine: implemented by (evidence: `README.md`)
- SQLite engine → Local database: reads and writes (evidence: `src/gramcred/infrastructure/database/engine.py`)
- Enterprise data → Financial intelligence: informs (evidence: `README.md`)
- Financial records → Financial intelligence: informs (evidence: `README.md`)
- Market prices → Financial intelligence: informs (evidence: `README.md`)
- Weather data → Financial intelligence: informs (evidence: `README.md`)
- Crop information → Financial intelligence: informs (evidence: `README.md`)
- Financial intelligence → Forecasts: produces (evidence: `README.md`)
- Financial intelligence → Risk signals: produces (evidence: `README.md`)
- Financial intelligence → Explanations: produces (evidence: `README.md`)
- Financial intelligence → Actionable analytics: produces (evidence: `README.md`)
- App configuration → Structured logging: configures (evidence: `src/gramcred/infrastructure/logging/__init__.py`)
- Enterprise user → Actionable analytics: reviews
- Offline sync → Local database: synchronizes
