Loan Qualification System
This project is a loan qualification system that determines if a user is qualified for a loan based on their credit score, monthly debt, monthly income, and desired loan amount. The system will prompt the user to enter their information and will output whether they are qualified for the loan, and well get their credit score, monthly income etc from Plaid API.
We set up a sandbox environment for the Plaid API, and we will be using the sandbox environment to get the user's information. The user will be prompted to enter their information, and the system will use the Plaid API to get the user's information.
So we have the requirements for a loan from "Bank of America" (tentative), and we cross reference using our backend to check whether a person is qualified for the loan. If not, we display what the difference for qualifications are.
We create a frontend where users can login, and then also check using this information. We structure the requests in JSON format, and we will be using Flask to handle the requests.
API Calls needs to be included through Plaid API.
In addition, this project needs to include flask and python.
We also set up a database with user information, specifically user logins and passwords. We will be using SQLite for this project.
To install the necessary libraries, you can use the following command:
pip install -r requirements.txt
Then you can run the app by running the following command:
./run_docker.sh
Then check the docker container by running the following command:
docker ps
Then you can run the following command to check the logs:
docker logs <container_id>
To use the app, you can go to the following URL:
http://localhost:5000/
You can then enter your information and the system will determine if you are qualified for the loan.
At the same time, these requests can work for API requests as well.
Here’s a translated version of the route documentation you can copy into a README file:
- Request Type: POST
- Purpose: Creates a new user account with a username and password.
username
(String): User's chosen username.password
(String): User's chosen password.
Success Response Example:
- Code: 200
- Content:
{ "message": "Account created successfully" }
{
"username": "newuser123",
"password": "securepassword"
}
{
"message": "Account created successfully",
"status": "200"
}
-
Request Type: POST
-
Purpose: Logs a user in with their username and password.
username
(String): User's username.password
(String): User's password.
Success Response Example:
-
Code: 200
-
Content:
{ "message": "Login successful" }
Here’s a translated version of your code as route documentation for a README file:
- Route:
/create_link_token
- Request Type: POST
- Purpose: Creates a new Plaid Link Token for initiating user connections.
None
Success Response Example:
- Code: 200
- Content:
{ "link_token": "your_generated_link_token" }
Error Response Example:
- Code: 500
- Content:
{ "error": "Error message here" }
- Route:
/exchange_public_token
- Request Type: POST
- Purpose: Exchanges a public token for an access token.
public_token
(String): Public token received from Plaid Link.
Success Response Example:
- Code: 200
- Content:
{ "access_token": "your_access_token" }
Error Response Example:
- Code: 500
- Content:
{ "error": "Error message here" }
- Route:
/transactions
- Request Type: GET
- Purpose: Retrieves transactions for a given access token.
access_token
(String): Access token to authenticate the request.
Success Response Example:
- Code: 200
- Content:
{ "transactions": [ { "transaction_id": "12345", "amount": 100, "date": "2023-01-01" } ] }
Error Response Example:
- Code: 500
- Content:
{ "error": "Error message here" }
- Route:
/fetch_income
- Request Type: GET
- Purpose: Fetches income information for a given access token.
access_token
(String): Access token to authenticate the request.
Success Response Example:
- Code: 200
- Content:
{ "income": { "income_data": "data here" } }
Error Response Example:
- Code: 500
- Content:
{ "error": "Error message here" }
- Route:
/fetch_liabilities
- Request Type: GET
- Purpose: Fetches liabilities for a given access token.
access_token
(String): Access token to authenticate the request.
Success Response Example:
- Code: 200
- Content:
{ "liabilities": { "liabilities_data": "data here" } }
Error Response Example:
- Code: 500
- Content:
{ "error": "Error message here" }
- Route:
/simulate_credit_score
- Request Type: GET
- Purpose: Simulates a credit score based on fetched income and liabilities.
access_token
(String): Access token to authenticate the request.
Success Response Example:
- Code: 200
- Content:
{ "credit_score": 750 }
Error Response Example:
- Code: 500
- Content:
{ "error": "Error message here" }
Here’s the translated version of your code as route documentation for a README file:
- Route:
/index
- Request Type: GET, POST
- Purpose: Renders the index page.
- Renders
index.html
.
- Route:
/create-account
- Request Type: GET, POST
- Purpose: Renders a form to create a new user account or processes the account creation logic.
username
(String): Chosen username of the user.email
(String): Email address of the user.password
(String): Chosen password.confirm-password
(String): Re-entry of the password for confirmation.
- Renders
create-account.html
with messages (success or error):- Error Messages:
- "All fields are required."
- "Passwords do not match."
- "Username already exists."
- "Email already exists."
- "An error occurred. Please try again."
- Success Message:
- "Account created! Username: {username}, Email: {email}"
- Error Messages:
- Route:
/update-password
- Request Type: GET, POST
- Purpose: Renders a form to update a user's password or processes the password update logic.
username
(String): Username of the user.email
(String): Email address of the user.password
(String): New password.
- Renders
update-password.html
with messages (success or error):- Error Messages:
- "All fields are required."
- "User not found. Please check the username or email."
- "An error occurred while updating the password."
- Success Response:
- Redirects to
/login
upon successful password update.
- Redirects to
- Error Messages:
- Route:
/login
- Request Type: GET, POST
- Purpose: Renders a login form or processes user login.
username
(String): Username of the user.password
(String): Password of the user.
- Renders
login.html
with messages (success or error):- Error Messages:
- "All fields are required."
- "Invalid username or password."
- Success Message:
- "Welcome back, {username}!"
- Redirects to
/index
upon successful login.
- Error Messages:
This project was created by: Ananiya Kinfe Eugen Nesbakken Nuo Chen