Skip to content

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

Plot-to-Loan

A proof of concept built for LOLC Finance's competitive moat: convert an AgStar soil test into a pre-qualified LOLC Finance crop loan plus an optional Brown's tractor leasing offer, pushed to iPay for acceptance. One screen, one KPI (conversion rate from soil test to accepted offer).

It is advisory only — final underwriting happens in LOLC Finance's existing process. This tool just turns a single touchpoint (the soil test) into a qualified credit conversation.

The competitive idea

No other Sri Lankan lender has all four of these assets in one group:

Asset Role in Plot-to-Loan
AgStar — nationwide soil testing Source the soil test → drives the fertiliser plan + cash flow
LOLC Finance — largest NBFI crop-loan book Pre-qualified loan amount, downstream underwriting
Brown's — tractor / agri-equipment market leader Matched leasing offer for plots above a size threshold
iPay — group payment wallet Channel the farmer accepts the offer through

This PoC demonstrates the funnel working from end to end.

How it works

For each Plot-to-Loan:

  1. Soil test → fertiliser plan. Nutrient gaps (N, P, K) × extent × per-kg prices → recommended kg + total cost + pH advisory.
  2. Cash-flow projection. yield × extent × effective_price − base cost − fertiliser cost − marketing − consumption − existing debt → net repayment capacity → coverage ratio at the requested loan size.
  3. Pre-qualification band. Coverage ratio mapped through configurable bands (NOT_QUALIFIED / REVIEW / PRE_QUALIFIED / STRONG_QUALIFIED).
  4. Leasing match. Largest Brown's offer whose minimum-extent ≤ plot size and whose suitable-crops list includes the chosen crop.
  5. Accept → iPay. Farmer accepts on the screen; backend marks ACCEPTED and generates a simulated iPay reference number.

Every result carries the structural config version it was produced with, so each pre-qualification is reproducible. ML supplies only the predicted crop price (published to POST /api/prices); every other parameter lives in YAML config — retuning the model needs no code change.

Project layout

Path What
backend/ Spring Boot 3.5 / Java 21
backend/src/main/resources/config/ structural config: crops + nutrients, scoring + bands, Brown's leasing offers
backend/src/main/java/lk/loanassist/prequal/ the engine — pure deterministic Plot-to-Loan logic
frontend/ React 18 + TypeScript + Vite — one mobile-first screen

Prerequisites

  • Java 21+ and Maven 3.9+
  • Node 20+ and npm

Run

cd backend
mvn spring-boot:run            # :8080
cd frontend
npm install                    # only first time
npm run dev                    # :5173, proxies /api to :8080

Open http://localhost:5173, fill the soil-test screen, run the Plot-to-Loan.

Configuration

All structural config sits in backend/src/main/resources/config/:

  • crops.yaml — crops, seasons, per-zone yield + base cost benchmarks, nutrient needs per acre, optimal soil pH range, guaranteed price floor.
  • scoring.yaml — coverage-ratio target, marketing cost %, interest rate, ML price-confidence haircut, fertiliser prices per kg, pH yield haircut, pre-qualification bands.
  • leasing.yaml — Brown's leasing-offer catalog (asset price, monthly rental, term, minimum extent, suitable crops).

API

Method & path Purpose
GET /api/config structural config (UI renders dropdowns from this)
POST /api/prequalifications run a Plot-to-Loan; returns the record
POST /api/prequalifications/{id}/accept accept → simulated push to iPay
POST /api/prequalifications/{id}/decline decline the offer
GET /api/prequalifications/{id} fetch a stored record
GET /api/prequalifications list all records
GET /api/prequalifications/stats the conversion KPI (total / accepted / rate)
GET / POST /api/prices read / publish ML price predictions

The KPI

accepted / total from GET /api/prequalifications/stats. This is the single number that says whether the Plot-to-Loan funnel is working — and the only one worth scaling.

Plain-language pitch

(For a non-technical audience — investor, executive, business stakeholder.)

Right now, when an AgStar soil-testing officer visits a farmer's plot, they take the test, leave a fertiliser recommendation — and that's it. The farmer who needs a crop loan still has to find a bank, somehow prove they're creditworthy with no salary slip, fill paperwork, and wait weeks. If it comes at all.

We use something LOLC already owns that nobody else has under one roof:

  • AgStar — the soil test that travels to the farmer's plot.
  • LOLC Finance — the country's biggest finance company outside the banks.
  • Brown's — the market leader in tractors and farm equipment.
  • iPay — the digital wallet many of those farmers already use.

Today these four run in their own lanes. Plot-to-Loan stitches them together at one moment — the soil-test visit.

Here is what the farmer experiences. The agronomist arrives at the plot with a tablet, runs the soil test as usual, and on the same screen enters the basics — 3 acres of paddy in Polonnaruwa, say, and the soil readings. Within seconds the screen shows three things:

  • The fertiliser plan the farmer should apply, costed in rupees.
  • An offer — "you are pre-qualified for an LOLC Finance crop loan up to LKR 181,800 for this season."
  • And, if the plot is big enough, a bonus — "you also qualify for a Brown's 2-wheel tractor at LKR 12,500 a month."

The farmer accepts on the spot. The offer flows to their iPay wallet with a reference number. LOLC's credit team picks it up for the formal review. Weeks of paperwork becomes a yes-or-no conversation in a single visit.

For the business, this is a funnel nobody else in the country can copy:

  • State banks have the loans but no soil-testing arm.
  • Microfinance has the farmers but no fertiliser science.
  • AgStar alone has the soil test but no credit product behind it.
  • Only LOLC has all four under one roof.

The prototype is built and working end to end today. Every result is advisory — the screen says "pre-qualified," not "approved." LOLC's credit team still owns the final decision, so the bank's risk discipline stays intact while a previously one-way soil-test visit becomes a measurable commercial event.

There is one number that tells us whether it works: how many soil tests turn into accepted loan offers. If that number moves, every AgStar visit becomes a credit conversation — and every farmer who gets a fertiliser plan also gets a path to financing it.

PoC limitations / next steps

  • In-memory storage — records, prices do not survive a restart. Swap for a database before any real use.
  • AgStar integration is the data shape, not a live feed — the engine accepts a soil-test payload; the production version would adapt AgStar's recommendation API into this same shape.
  • iPay push is simulated — accept returns a synthetic reference. The production version calls iPay's lending-offer endpoint.
  • Numbers in crops.yaml, scoring.yaml, leasing.yaml are illustrative — replace with current DOA / DCS / Brown's data.
  • No authentication / roles.
  • No tests yetPreQualEngine is a pure function and the first thing worth covering.

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages