Table of Contents
This project is a loan application that prompts the user to enter financial and private data to determine if an applicant qualifies for a loan and the type of loan the applicant qualifies for. It also asks the user to save the qualifying loans as a new CSV file
- Python
- Clone the repo
git clone https://github.com/AnaIitico/loan_qualifier_app.git
- Install pip - package installer for Python here
- Install Python packages
pip install fire pip install questionary
This project is a loan application that prompts the user to enter financial and private data to determine if an applicant qualifies for a loan and the type of loan the applicant qualifies for. It also asks the user to save the qualifying loans as a new CSV file.
Here are some screenshots and code snippets of the working app
def save_qualifying_loans(qualifying_loans):
"""Saves the qualifying loans to a CSV file.
Requires confirmation before saving the file
Provides instructions for the file naming convention
Includes logic to avoid empty filenames
Args:
qualifying_loans (list of lists): The qualifying bank loans.
"""
#Ask if the user wants to save the file
question = questionary.confirm("Would you like to save the new file?").ask()
if question == False:
print("")
print("Thank you for using the app. Goodbye!")
quit()
else:
# Enter the new file name to be saved by the application
name = questionary.text("""Enter the new file name by following these rules:
1. Use lowercase letters
2. Don't leave empty spaces between words.
3. Use the underscore _ as a separator.
4. Include .csv at the end of the name.
5. For example: john_doe.csv"""
).ask()
if name == "":
print("")
print("You must enter a file name")
print("")
save_qualifying_loans(qualifying_loans)
if len(qualifying_loans) == 0:
output_path = Path(f"results/unqualified_loans/{name.lower()}")
save_csv(output_path, qualifying_loans)
else:
output_path = Path(f"results/qualified_loans/{name.lower()}")
save_csv(output_path, qualifying_loans)
def save_csv(output_path, qualifying_loans):
"""Saves the CSV file from path provided by user input.
Checks to make sure the file was written and notifies the user
Args:
output_path (Path): The csv file output path from user input.
qualifying_loans : List of qualifying loans from calculations.
Saves:
A list that contains the rows of qualifying loans for a customer.
"""
header = ["Lender", "Max Loan Amount", "Max LTV", "Max DTI", "Min Credit Score", "Interest Rate"]
with open(output_path, 'w', newline = '') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerow(header)
for loans in qualifying_loans:
csvwriter.writerow(loans)
if os.path.isfile(output_path):
print(f'The file {csvfile.name} was successfully written')
else:
print(f'The file {output_path} was not written')
See the open issues for a list of proposed features (and known issues).
Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are greatly appreciated.
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
Jose Tollinchi - @josetollinchi - jtollinchi1971@gmail.com
Project Link: https://github.com/AnaIitico/loan_qualifier_app