|
|
||
|---|---|---|
| src/idea180_credimesh_federated_privacy | ||
| tests | ||
| .gitignore | ||
| AGENTS.md | ||
| README.md | ||
| pyproject.toml | ||
| test.sh | ||
README.md
idea180-credimesh-federated-privacy
CrediMesh is a federated underwriting core for privacy-preserving mortgage evaluation.
This repository provides a deterministic orchestration slice for:
- privacy-minimized shared signals from income and appraisal adapters
- graph-of-contracts registration and conformance checks
- an ADMM-lite solver for affordability, collateral, and rate reconciliation
- Ed25519-signed audit events
- SQLite-backed governance persistence
What it does
The package evaluates a LocalUnderwritingProblem by:
- transforming borrower evidence into
SharedSignalrecords with strict privacy budgets - checking those signals against contract metadata in a graph registry
- reconciling affordability and collateral constraints with a deterministic solver
- writing tamper-evident audit entries into SQLite without storing raw borrower payloads
Modules
models.py: request, signal, plan, budget, and audit modelsidentity.py: Ed25519 DID-style identitiescontracts.py: contract specs, conformance, and registry graphadapters.py: income verification and property appraisal adapterssolver.py: deterministic underwriting solverledger.py: SQLite governance ledgerorchestrator.py: end-to-end flow
Quick start
from idea180_credimesh_federated_privacy import CrediMeshOrchestrator, LocalUnderwritingProblem, SQLiteGovernanceLedger, create_identity
problem = LocalUnderwritingProblem(
borrower_id="borrower-1",
lender_id="lender-a",
requested_amount=400000,
property_value=520000,
annual_income=180000,
monthly_obligations=900,
)
with SQLiteGovernanceLedger(":memory:") as ledger:
orchestrator = CrediMeshOrchestrator(create_identity("lender-a"), ledger)
result = orchestrator.evaluate(
problem,
[
{"gross_monthly_income": 15000, "employment_months": 48, "employer_stability_score": 9.0},
{"gross_monthly_income": 15200, "employment_months": 50, "employer_stability_score": 8.8},
],
{"appraised_value": 535000, "confidence": 0.9, "comparables_count": 6, "days_on_market": 18},
)
print(result.plan.model_dump())
Testing
Run the local verification gate:
bash test.sh
That script installs dependencies, runs pytest, and executes python3 -m build.
Design rules
- Keep borrower data minimized at the signal boundary.
- Preserve deterministic replay for identical inputs.
- Update tests whenever contract behavior changes.
- Keep the SQLite ledger append-only and privacy-safe.