0% found this document useful (0 votes)
13 views6 pages

Credit Approval System Assignment

The assignment involves creating a credit approval system using Django 4+ and Docker, focusing on backend development without a frontend. Key tasks include setting up data models, ingesting customer and loan data from provided Excel files, and building API endpoints for customer registration, loan eligibility checks, loan creation, and loan viewing. The project emphasizes code quality, organization, and the use of background tasks, with a submission deadline of 36 hours and a requirement for Dockerization of the application.

Uploaded by

sumitapathak.bg
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views6 pages

Credit Approval System Assignment

The assignment involves creating a credit approval system using Django 4+ and Docker, focusing on backend development without a frontend. Key tasks include setting up data models, ingesting customer and loan data from provided Excel files, and building API endpoints for customer registration, loan eligibility checks, loan creation, and loan viewing. The project emphasizes code quality, organization, and the use of background tasks, with a submission deadline of 36 hours and a requirement for Dockerization of the application.

Uploaded by

sumitapathak.bg
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Assignment for Internship - Backend

Credit Approval System


In this assignment you will be working on creating a credit approval
system based on past data as well as future transactions, the goal of this
assignment is to assess the proficiency with the Python/Django stack,
using background tasks as well handing operations on Databases.

1. Setup and Initialization


a) Setup
• For this assignment please use Django 4+ with Django Rest
Framework.
• There is no requirement to make a frontend for the
application.
• You need to build appropriate data models for the
application
• The entire application and all its dependencies should be
dockerized.
• The application should use a Postgresql DB
b) Initiliazation
You are provided with a “customer_data.xlsx” which is a table
of the existing customers with the following attributes
• customer_id
• first_name
• last_name
• phone_number
• monthly_salary
• approved_limit
• current_debt
Also you are provided with “loan_data.xlsx” which is a table of
past and exisiting loans by customers with the following
attributes
• customer id
• loan id
• loan amount
• tenure
• interest rate
• monthly repayment (emi)
• EMIs paid on time
• start date
• end date
Injest the provided data into the initial system using
background workers

2. API-
you need to build the following API endpoints with appropriate error
handling for and status codes for each.
Use compound interest scheme for calculation of monthly interest.
• /register
Add a new customer to the customer table with approved limit
based on salary using the following relation:

▪ approved_limit = 36 * monthly_salary (rounded to


nearest lakh)

a) Request body
Field Value
first_name First Name of customer
(string)
last_name Last Name of customer
(string)
age Age of customer (int)
monthly_income Monthly_income of individual
(int)
phone_number Phone number(int)

b) Response body
Field Value
customer_id Id of customer (int)
name Name of customer (string)
age Age of customer (int)
monthly_income Monthly_income of individual
(int)
approved_limit Approved credit limit (int)
phone_number Phone number (int)

• /check-eligibility
Check loan eligibility based on credit score of customer (out of
100 ) based on the historical loan data from “loan_data.xlsx”,
consider the following components while assigning a credit
score:
i. Past Loans paid on time
ii. No of loans taken in past
iii. Loan activity in current year
iv. Loan approved volume
v. If sum of current loans of customer > approved limit of
customer , credit score = 0
Based on the credit score of the customer , approve loans as
per the following:
▪ If credit_rating > 50 , approve loan
▪ If 50 > credit_rating > 30 , approve loans with
interest rate > 12%
▪ If 30> credit_rating > 10 , approve loans with interest
rate >16%
▪ If 10> credit_rating , don’t approve any loans
▪ If sum of all current EMIs > 50% of monthly salary ,
don’t approve any loans
▪ If the interest rate does not match as per credit
limit , correct the interest rate in the response, i.e
suppose credit_limit is calculated to be 20 for a
particular loan and the interest_rate is 8%, send a
corrected_interest_rate = 16% (lowest of slab) in
response

a) Request body
Field Value
customer_id Id of customer (int)
loan_amount Requested loan amount
(float)
interest_rate Interest rate on loan (float)
tenure Tenure of loan (int)

b) Response Body
Field Value
customer_id Id of customer (int)
approval can loan be approved (bool)
interest_rate Interest rate on loan (float)
corrected_interest_rate Corrected Interest Rate
based on credit rating , same
as interest rate if the interest
rate matches the slab (float)
tenure Tenure of loan (int)
monthly_installment Monthly installment to be
paid as repayment (float)

• /create-loan
Process a new loan based on eligibility.
a) Request body
Field Value
customer_id Id of customer (int)
loan_amount Requested loan amount
(float)
interest_rate Interest rate on loan (float)
tenure Tenure of loan (int)
b) Response Body
Field Value
loan_id Id of approved loan, null
otherwise (int)
customer_id Id of customer (int)
loan_approved Is the loan approved (bool)
message Appropriate message if loan
is not approved (string)
monthly_installment Monthly installment to be
paid as repayment (float)

• /view-loan/loan_id
View loan details and customer details
a) Response Body
Field Value
loan_id Id of approved loan (int)
customer JSON containing id ,
first_name , last_name,
phone_number, age of
customer (JSON)
loan_amount Is the loan approved (bool)
interest_rate Interest rate of the approved
loan (float)
monthly_installment Monthly installment to be
paid as repayment (float)
tenure Tenure of loan (int)

• /view-loans/customer_id

View all current loan details by customer id

b) Response Body (list of loan items , each loan item will have
the following body)
Field Value
loan_id Id of approved loan (int)
loan_amount Is the loan approved (bool)
interest_rate Interest rate of the approved
loan (float)
monthly_installment Monthly installment to be
paid as repayment (float)
repayments_left No of EMIs left (int)

3. General Guidelines
• Ensure code quality , organisation and segregation of responsibilities.
• Adding unit tests although is not nessecary, will be considered for bonus
points.
• The assignment should be submitted within 36 hours.
• The entire application and all its dependencies like DB should be
dockerized and should run from a single docker compose command.
• Please submit the github link of the repository.

Common questions

Powered by AI

To add a new customer into the system, one must use the '/register' API endpoint. The request body should include the customer's first name, last name, age, monthly income, and phone number. Based on the monthly income, the system calculates the approved credit limit by multiplying the monthly salary by 36, rounding it to the nearest lakh, and stores this in the customer table. The response confirms the registration with details including the customer ID, name, age, monthly income, approved limit, and phone number .

The approved credit limit for a new customer is determined by multiplying the customer's monthly salary by 36 and rounding it to the nearest lakh .

A corrected interest rate might be suggested in the loan approval response to align with the customer's credit rating. When the proposed interest rate does not match the expected slab rate based on the customer's credit limit, the system provides a corrected interest rate. For instance, if the credit rating implies a minimum rate of 16% but the proposed rate is lower, the corrected rate would be set to the minimum slab rate of 16% .

The benefits of using Django Rest Framework (DRF) for building APIs in the credit approval system include its flexible and modular architecture that facilitates the rapid development of robust APIs. DRF offers powerful serialization that integrates seamlessly with Django's ORM, enabling efficient processing and transformation of data. Additionally, DRF provides built-in support for authentication, permission handling, and documentation generation, contributing to the security and user-friendliness of the system's API .

Dockerizing the entire application and its dependencies is important because it ensures consistency of the environment across different stages of development, testing, and production. It facilitates easier deployment, scalability, and management of the application by encapsulating all necessary components within a container, allowing them to run identically on any system that supports Docker .

The credit approval system ensures code integrity and organization through code quality practices such as segregation of responsibilities in the code base. This includes organized structuring of application logic and functionalities into distinct modules, aiding in maintenance and scalability. Although unit tests are not mandatory, they are encouraged for bonus points, further promoting code reliability .

A loan might not be approved even if a customer's credit rating is sufficient if the sum of all current EMIs exceeds 50% of the customer's monthly salary or if the interest rate does not match the slab determined by the credit limit .

The key components to consider when assigning a credit score to a customer in the credit approval system include past loans paid on time, the number of loans taken in the past, loan activity in the current year, loan approved volume, and if the sum of the customer's current loans exceeds their approved limit. If so, the credit score is set to 0 .

The compound interest scheme affects the calculation of monthly interest by applying interest on the principal amount, which includes previously accrued interest. This results in a slightly higher accumulation of interest over time compared to simple interest. For loan processing, it means calculating the monthly repayment amount that accounts for this compounding effect, thus influencing the overall cost of the loan for the customer .

Background workers play a crucial role in the initialization of the credit approval system by handling the ingestion of initial data from provided Excel files into the system. This ensures that customer and loan data are efficiently processed and stored in the database without blocking the main application workflow, allowing the system to handle other tasks simultaneously .

You might also like