How patrick0-cpu/loan-decision-engine works
This is a Streamlit loan-officer decision-support prototype: submitted applications become worker-processed cases, documents are read and checked, financial and risk results inform a model recommendation, and an officer makes the final decision. Separate event handling and an approval-gated outbox govern external actions. The dashboard also provides portfolio/model views, a read-only data assistant, audit and operations tools. The README documents several subsystems whose source was not sampled; those links are shown only where documented, and the graph does not imply unverified internal calls.
Main entry points: workflow.py Application workflow · events.py Event recording · worker.py Event worker · 4_Officer_review_queue.py Officer review
Components 30
Intake and documents
- Bulk intake
app/bulk_tab.py - Document reader
loan_system/document_reader.py - Field extraction
loan_system/extraction.py - Content guard
loan_system/guard.py - Document checks
loan_system/doc_check.py
Case assessment
- Application workflow
loan_system/workflow.py - Financial calculations
loan_system/calculations.py - Consistency checks
loan_system/consistency.py - EBM risk scorer
loan_system/risk_scorer.py - Input snapshot
loan_system/snapshot.py - Kev recommendation
loan_system/decision.py
Human review and operations
- Officer review
app/pages/4_Officer_review_queue.py - Operations monitor
app/pages/6_Operations.py - Queue priority
loan_system/queue_priority.py - Approval gate
loan_system/oversight.py - Emergency stop
loan_system/emergency.py - Workload monitor
loan_system/monitor.py - Role authorization
loan_system/auth.py
Dashboard and data
- Streamlit dashboard
app/shared.py - Application intake
app/pages/3_Score_an_applicant.py - Audit log view
app/pages/5_Audit_log.py - Data assistant
loan_system/assistant.py - Read-only data queries
loan_system/query.py - Optional tracing
loan_system/tracing.py
Events and external actions
- Event recording
loan_system/events.py - Event worker
worker.py - Action outbox
loan_system/outbox.py - Simulated receiver
loan_system/receiver/client.py - SQLite database
loan_system/db.py
Other components
- Loan officer
Connections 36
- Loan officer → Streamlit dashboard: uses
README.md - Loan officer → Application intake: submits case
README.md - Streamlit dashboard → Data assistant: offers chat
README.md - Application intake → Event recording: records application
- Bulk intake → Event recording: records events
app/bulk_tab.py - Event recording → Event worker: claims events
worker.py - Event worker → Application workflow: processes case
worker.py - Application workflow → Document reader: reads documents
loan_system/workflow.py - Document reader → Field extraction: extracts fields
loan_system/document_reader.py - Application workflow → Content guard: scans content
loan_system/guard.py - Application workflow → Document checks: checks documents
README.md - Application workflow → Financial calculations: calculates metrics
loan_system/workflow.py - Application workflow → Consistency checks: checks consistency
loan_system/workflow.py - Application workflow → EBM risk scorer: scores risk
loan_system/workflow.py - Application workflow → Input snapshot: records snapshot
loan_system/workflow.py - Application workflow → Kev recommendation: requests recommendation
loan_system/workflow.py - Application workflow → Queue priority: sets priority
loan_system/workflow.py - Loan officer → Officer review: reviews case
README.md - Officer review → Event recording: records decision
app/pages/4_Officer_review_queue.py - Officer review → Queue priority: orders cases
app/pages/4_Officer_review_queue.py - Officer review → Application workflow: reruns checks
app/pages/4_Officer_review_queue.py - Event worker → Approval gate: applies decision
README.md - Approval gate → Action outbox: queues approved actions
README.md - Event worker → Action outbox: executes actions
worker.py - Action outbox → Simulated receiver: sends or looks up
README.md - Operations monitor → Event recording: records interventions
app/pages/6_Operations.py - Operations monitor → Workload monitor: shows workload
app/pages/6_Operations.py - Operations monitor → Emergency stop: controls stop
app/pages/6_Operations.py - Data assistant → Read-only data queries: builds data queries
loan_system/assistant.py - Read-only data queries → SQLite database: reads data
loan_system/query.py - Event worker → SQLite database: persists workflow
worker.py - Event recording → SQLite database: stores events
loan_system/events.py - Approval gate → Role authorization: checks approvers
loan_system/oversight.py - Audit log view → SQLite database: reads audit records
- Application workflow → Optional tracing: records spans
loan_system/workflow.py - Loan officer → Operations monitor: intervenes
README.md