DEV Community

Cover image for Building a Data Pipeline for Digital Loan Discovery
Sneha Wani
Sneha Wani

Posted on

Building a Data Pipeline for Digital Loan Discovery

A digital loan marketplace has a deceptively difficult data problem.

A borrower may provide income, employment type, requested amount,
existing obligations, and credit information. Lending partners may
expose similar information using completely different field names,
formats, and business rules.

If that data is passed directly into a recommendation or matching
engine, the system can produce inconsistent results.

A better approach is to treat data processing as a first-class
engineering layer.

This article walks through a practical pipeline for validating borrower
data, normalizing financial signals, evaluating product rules, and
preparing structured data for explainable loan discovery.

The Pipeline at a Glance

A simplified architecture can look like this:

Borrower Input
      |
      v
+-------------------+
| API / Ingestion   |
+---------+---------+
          |
          v
+-------------------+
| Validation        |
+---------+---------+
          |
          v
+-------------------+
| Normalization     |
+---------+---------+
          |
          v
+-------------------+
| Feature Creation  |
+---------+---------+
          |
          v
+-------------------+
| Eligibility Rules |
+---------+---------+
          |
          v
+-------------------+
| Matching / Rank   |
+---------+---------+
          |
          v
+-------------------+
| Explanation       |
+---------+---------+
          |
          v
     Loan Options
Enter fullscreen mode Exit fullscreen mode

The important point is that AI does not need to own every stage.

Deterministic processing, business rules, and machine-learning
components can each have a clearly defined responsibility.

1. Start With a Canonical Borrower Schema

Different interfaces may collect the same information using different
names.

For example:

{
  "monthlyIncome": "65000",
  "employmentType": "salaried",
  "loanAmount": "500000"
}
Enter fullscreen mode Exit fullscreen mode

Another source could provide:

{
  "income_per_month": 65000,
  "employment": "SAL",
  "requested_loan": 500000
}
Enter fullscreen mode Exit fullscreen mode

Both describe similar information, but the downstream system should not
need to understand every external representation.

Create a canonical internal schema instead:

{
  "income": {
    "amount": 65000,
    "currency": "INR",
    "frequency": "monthly"
  },
  "employment": {
    "type": "salaried"
  },
  "loanRequest": {
    "amount": 500000,
    "currency": "INR"
  }
}
Enter fullscreen mode Exit fullscreen mode

This becomes the contract between ingestion and the rest of the
platform.

2. Validate Before You Normalize

Normalization should not replace validation.

For example, the system should detect:

monthlyIncome = -50000
Enter fullscreen mode Exit fullscreen mode

before converting it into another representation.

A validation layer can check:

  • Required fields
  • Data types
  • Numeric ranges
  • Currency
  • Date formats
  • Employment categories
  • Requested loan amount
  • Duplicate records
  • Missing values

A simple validation function might look like:

def validate_income(income):
    if income is None:
        return False

    if income <= 0:
        return False

    return True
Enter fullscreen mode Exit fullscreen mode

Production systems will need considerably more robust validation, but
the principle remains the same:

Invalid data should fail early.

3. Normalize Financial Values

Financial data frequently arrives in human-readable formats.

For example:

₹65,000
65K
65000
65,000 INR
Enter fullscreen mode Exit fullscreen mode

These should be converted into a consistent representation:

{
  "amount": 65000,
  "currency": "INR"
}
Enter fullscreen mode Exit fullscreen mode

The same principle applies to:

  • Loan amounts
  • Income
  • Existing EMIs
  • Account balances
  • Tenure
  • Dates
  • Interest-rate representations

Normalization makes comparison possible.

4. Separate Raw Data From Derived Features

Do not overwrite the original borrower data with calculated values.

Instead, maintain separate layers.

Raw Data
   |
   +--> Normalized Data
           |
           +--> Derived Features
Enter fullscreen mode Exit fullscreen mode

For example:

{
  "income": 65000,
  "existingEmi": 12000,
  "requestedAmount": 500000,
  "derived": {
    "emiToIncomeRatio": 0.1846
  }
}
Enter fullscreen mode Exit fullscreen mode

The raw values remain available for auditing, while derived features can
be regenerated if the calculation changes.

5. Build Product Data Using the Same Principle

Borrower data is only half of the problem.

Loan products from different partners can also have inconsistent
schemas.

Partner A:

{
  "min_amount": 100000,
  "max_amount": 1000000,
  "min_income": 30000
}
Enter fullscreen mode Exit fullscreen mode

Partner B:

{
  "loan_min": 100000,
  "loan_max": 1000000,
  "minimum_monthly_salary": 30000
}
Enter fullscreen mode Exit fullscreen mode

Normalize both into an internal product model:

{
  "productType": "personal_loan",
  "minAmount": 100000,
  "maxAmount": 1000000,
  "minimumIncome": 30000
}
Enter fullscreen mode Exit fullscreen mode

Now the matching engine can work against one predictable schema.

6. Keep Eligibility Rules Deterministic Where Possible

Not every problem needs machine learning.

If a lender's product requires a minimum income, that can be represented
as an explicit rule:

def amount_is_supported(product, requested_amount):
    return (
        product["minAmount"]
        <= requested_amount
        <= product["maxAmount"]
    )
Enter fullscreen mode Exit fullscreen mode

Multiple rules can then be combined:

def potentially_eligible(borrower, product):
    return (
        borrower["income"] >= product["minimumIncome"]
        and
        amount_is_supported(
            product,
            borrower["loanRequest"]["amount"]
        )
    )
Enter fullscreen mode Exit fullscreen mode

This has an important advantage: engineers can inspect exactly why a
product passed or failed a rule.

7. Eligibility Is Not the Same as Ranking

Once a product passes basic rules, the system may still have multiple
potentially relevant options.

This is where ranking can be useful.

For example:

Candidate Products
       |
       v
+----------------------+
| Product A            |
| Product B            |
| Product C            |
+----------+-----------+
           |
           v
     Ranking Layer
           |
           v
Relevant Options
Enter fullscreen mode Exit fullscreen mode

A ranking system could consider signals such as:

  • Requested amount fit
  • Product type
  • Borrower profile
  • Stated requirements
  • Available product characteristics

The ranking layer should remain separate from the final lending
decision.

8. Where AI Can Add Value

AI or machine-learning models can help identify patterns across multiple
signals.

A simplified conceptual model might be:

score = model.predict({
    "income": income,
    "requested_amount": requested_amount,
    "employment_type": employment_type,
    "existing_obligations": existing_obligations
})
Enter fullscreen mode Exit fullscreen mode

However, the output should be treated as a system signal rather than
automatically translated into:

Loan approved
Enter fullscreen mode Exit fullscreen mode

A better architecture is:

Data
  |
  v
Validation
  |
  v
Eligibility
  |
  v
AI / Ranking
  |
  v
Explainable Options
  |
  v
Partner Lender
  |
  v
Final Decision
Enter fullscreen mode Exit fullscreen mode

This separation is particularly important in financial applications.

9. Add Explainability to the Data Model

A matching engine should not return only an opaque product identifier.

Instead:

{
  "productId": "partner_product_123",
  "matchSignals": [
    "requested_amount_fit",
    "employment_profile_match",
    "product_type_match"
  ]
}
Enter fullscreen mode Exit fullscreen mode

The frontend can turn these structured signals into readable
explanations.

For example:

Why this option was shown:

- The requested amount falls within the product range.
- The product supports the stated employment profile.
- The product matches the selected loan type.
Enter fullscreen mode Exit fullscreen mode

This approach also helps customer-support teams debug unexpected
results.

10. Make Data Freshness Observable

Financial product information can change.

A product record should therefore carry metadata such as:

{
  "productId": "123",
  "version": 17,
  "source": "partner_api",
  "lastUpdated": "2026-09-25T10:30:00Z"
}
Enter fullscreen mode Exit fullscreen mode

The system can then monitor:

Product freshness
       |
       +--> Fresh
       |
       +--> Aging
       |
       +--> Stale
Enter fullscreen mode Exit fullscreen mode

A stale product should not silently behave like a current product.

11. Version Rules and Models

If a result changes, engineers need to know what changed.

Track versions for:

  • Matching rules
  • Product configuration
  • Model versions
  • Feature definitions
  • Data sources

For example:

{
  "modelVersion": "ranking-v3",
  "rulesVersion": "2026.09.4",
  "productVersion": 17
}
Enter fullscreen mode Exit fullscreen mode

This makes debugging and experimentation substantially easier.

12. Design for Idempotency

Data pipelines often receive retries.

Suppose the same borrower event is delivered twice:

Event 123
   |
   +--> Worker
   |
   +--> Retry
Enter fullscreen mode Exit fullscreen mode

Without idempotency, the system might process the same event twice.

Use a unique event identifier:

{
  "eventId": "evt_8f31a",
  "type": "borrower_profile_updated"
}
Enter fullscreen mode Exit fullscreen mode

The processing layer can maintain an idempotency record and safely
ignore duplicate events.

13. Add Observability at Every Stage

A production data pipeline should make each stage measurable.

For example:

Ingestion       12 ms
Validation      8 ms
Normalization   15 ms
Eligibility     27 ms
Ranking         41 ms
Explanation     10 ms
----------------------
Total           113 ms
Enter fullscreen mode Exit fullscreen mode

Useful metrics include:

  • Validation failures
  • Missing-field rates
  • Normalization errors
  • Rule rejection counts
  • Matching latency
  • Ranking latency
  • Model errors
  • Stale product records
  • Explanation failures

Without these metrics, diagnosing production issues becomes much harder.

14. Protect Sensitive Financial Data

Borrower information can contain sensitive financial data.

A practical architecture should include controls around:

Client
   |
   v
API Gateway
   |
   v
Authentication
   |
   v
Authorization
   |
   v
Data Services
   |
   v
Encrypted Storage
   |
   v
Audit Logs
Enter fullscreen mode Exit fullscreen mode

The data pipeline should also follow data-minimization principles.

If a data field is not required for a legitimate processing purpose,
there is a strong engineering reason not to collect or retain it
unnecessarily.

15. How This Fits a Loan Marketplace

A digital loan marketplace can use this type of architecture to organize
borrower information and help surface potentially relevant loan options
from multiple lending partners.

For example, SwipeLoan is a digital loan
marketplace that helps eligible borrowers explore loan options from
multiple RBI-registered lending partners. SwipeLoan is not a lender, and
the respective partner lender makes the final lending decision.

From an engineering perspective, this means the platform can focus on:

Data
  ↓
Matching
  ↓
Discovery
  ↓
Comparison
Enter fullscreen mode Exit fullscreen mode

while keeping the partner lender's underwriting and lending decision
separate.

16. A Reference Data Flow

Putting the components together:

                    Borrower
                       |
                       v
              +----------------+
              | API / Ingestion|
              +--------+-------+
                       |
                       v
              +----------------+
              |   Validation   |
              +--------+-------+
                       |
                       v
              +----------------+
              | Normalization  |
              +--------+-------+
                       |
                       v
              +----------------+
              | Feature Layer  |
              +--------+-------+
                       |
                       v
              +----------------+
              | Rules Engine   |
              +--------+-------+
                       |
                       v
              +----------------+
              | AI / Ranking   |
              +--------+-------+
                       |
                       v
              +----------------+
              | Explainability |
              +--------+-------+
                       |
                       v
                Loan Options
                       |
                       v
                Partner Lender
                       |
                       v
              Final Lender Decision
Enter fullscreen mode Exit fullscreen mode

Each stage has a defined responsibility, which makes the overall system
easier to test and maintain.

17. Engineering Checklist

Before shipping a digital loan discovery pipeline, ask:

Data

  • Are input schemas defined?
  • Are financial values normalized?
  • Are raw and derived data separated?
  • Are missing values handled explicitly?

Rules

  • Are eligibility rules versioned?
  • Can engineers explain why a product was filtered?
  • Are lender-specific rules represented correctly?

AI

  • Is ranking separated from approval?
  • Are model versions tracked?
  • Can important outputs be explained?

Product Data

  • Is partner data normalized?
  • Is freshness tracked?
  • Are stale records detected?

Reliability

  • Is processing idempotent?
  • Are retries safe?
  • Are failures observable?

Security

  • Is sensitive data protected?
  • Is access controlled?
  • Is unnecessary data collection avoided?

Conclusion

A reliable digital loan discovery system is fundamentally a
data-engineering problem before it becomes an AI problem.

The quality of the final recommendation depends on the quality of the
data entering the system, the consistency of normalization, the clarity
of eligibility rules, the freshness of product information, and the
observability of every processing stage.

AI can add value through ranking and personalization, but it works best
when surrounded by deterministic validation, structured data models,
explainability, versioning, and clear system boundaries.

For fintech engineers, the goal should not simply be to build a smarter
model.

It should be to build a system that can explain what data it used,
what rules were applied, why an option was surfaced, and where the final
lending decision actually belongs
.

Top comments (0)