Skip to content

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

Notifications You must be signed in to change notification settings

Analitico-771/loan_qualifier_app

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Contributors Forks Stargazers Issues LinkedIn

Table of Contents
  1. About The Project
  2. Getting Started
  3. Usage
  4. Roadmap
  5. Contributing
  6. Contact
  7. Acknowledgements

About The Project

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

Built With

Getting Started

Prerequisites

  • Python

Installation

  1. Clone the repo
    git clone https://github.com/AnaIitico/loan_qualifier_app.git
  2. Install pip - package installer for Python here
  3. Install Python packages
    pip install fire
    pip install questionary

Usage

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.

Roadmap

Here are some screenshots and code snippets of the working app

Confirm Dialogue - Enter No and exit the program

Confirm Dialogue Screen Shot

Qualified Loans - saves to the qualified_loans folder

Qualified Loan Screen Shot

Unqualified Loans - saves to the unqualified_loans folder

Unqualified Loan Screen Shot

Enter Name - forces a retry. User can then enter y/n

Enter Name Screen Shot

Save Function

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)

Save to CSV Function

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).

Contributing

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.

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

Contact

Jose Tollinchi - @josetollinchi - jtollinchi1971@gmail.com

Project Link: https://github.com/AnaIitico/loan_qualifier_app

Acknowledgements

About

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

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages