How lositha/loanlens works
LoanLens is a Streamlit loan-offer analyzer. A user enters or pastes loan terms; the app extracts fields, computes payment and fee-inclusive borrowing cost, then compares prepaying with investing using historical Nifty 50 data and simulations. It presents the results with charts and a plain-language explanation. The app excerpt and source index establish the main module relationships; unsampled implementation details are not expanded.
Main entry points: streamlit_app.py Streamlit app · verdict.py Prepay or invest · backtest.py Historical returns · extractor.py AI offer reader
Components 12
User interface
- Streamlit app
app/streamlit_app.py
Loan analysis
- AI offer reader
src/loanlens/extractor.py - Rule-based reader
src/loanlens/regex_extractor.py - EMI calculator
src/loanlens/emi.py - Effective loan cost
src/loanlens/xirr.py
Investment comparison
- Nifty price history
data/nifty50.csv - Historical returns
src/loanlens/backtest.py - Return simulations
src/loanlens/montecarlo.py - Prepay or invest
src/loanlens/verdict.py
Explanations
- Plain-language explanation
src/loanlens/explainer.py
Other components
- Loan seeker
- Gemini API
Connections 15
- Loan seeker → Streamlit app: enters offer
- Streamlit app → AI offer reader: extracts terms
app/streamlit_app.py - Streamlit app → Rule-based reader: reads by rules
app/streamlit_app.py - AI offer reader → Gemini API: requests extraction
src/loanlens/extractor.py - Streamlit app → EMI calculator: calculates payment
app/streamlit_app.py - Streamlit app → Effective loan cost: calculates true cost
app/streamlit_app.py - Effective loan cost → EMI calculator: calculates payment
src/loanlens/xirr.py - Streamlit app → Historical returns: loads prices, compares history
app/streamlit_app.py - Historical returns → Nifty price history: reads prices
src/loanlens/backtest.py - Streamlit app → Return simulations: simulates returns
app/streamlit_app.py - Streamlit app → Prepay or invest: gets recommendation
app/streamlit_app.py - Prepay or invest → Historical returns: compares historical returns
src/loanlens/verdict.py - Prepay or invest → Return simulations: compares simulated returns
src/loanlens/verdict.py - Streamlit app → Plain-language explanation: requests explanation
app/streamlit_app.py - Plain-language explanation → Gemini API: rewrites facts
src/loanlens/explainer.py