Project Name: loan tracker

đź’ˇ Inspiration

My inspiration for this project came from observing the sheer complexity and opacity of the syndicated loan market. LMA (Loan Market Association) agreements are robust, comprehensive, and—crucially—extremely dense.

I realized that while the financial world is moving toward instant settlement and automation, the foundational documents governing these loans are often static PDFs trapped in emails. Manual monitoring of these agreements leads to:

  1. Operational Risk: Missed covenant checks or interest payment dates.
  2. Inefficiency: Costly hours spent reading hundreds of pages just to extract a few key dates and ratios.

I wanted to bridge the gap between unstructured legal text and structured financial data, creating a "living" dashboard that turns a static contract into a dynamic monitoring tool.

đź’» What it does

My application takes a raw LMA loan agreement (PDF or text) and uses Generative AI to parse, classify, and extract critical data points. It then visualizes this data on a user-friendly dashboard.

Key Features:

  • Automated Extraction: Instantly pulls out parties involved, interest rate spreads, maturity dates, and facility amounts.
  • Covenant Monitoring: Identifies financial covenants and sets up tracking logic.
  • Interactive Dashboard: A visual interface to track the status of the loan, removing the need to search through a 200-page document manually.

⚙️ How I built it

I approached this problem by treating the legal agreement as a data ingestion challenge.

  1. OCR & Text Pre-processing: I used Python libraries to convert PDF documents into machine-readable text, cleaning up artifacts and headers to prepare the data for the model.
  2. AI Parsing Engine: I leveraged an LLM (Large Language Model) with a strictly typed schema to extract specific entities. I utilized prompt engineering to ensure the model could distinguish between Affirmative Covenants and Negative Covenants.
  3. Financial Logic Layer: I implemented a calculation engine to structure the extracted math. For instance, when the AI extracts a definition for the Leverage Ratio, my system maps it to the formula:

\text{Leverage Ratio} = \frac{\text{Total Net Debt}}{\text{EBITDA}}

It also parses interest rate logic, such as:

\text{Total Interest} = (\text{Reference Rate} + \text{Margin}) \times \text{Principal} \times \frac{\text{Days Elapsed}}{360}

  1. The Dashboard: The frontend was built using [React/Next.js/Streamlit], providing a clean UI where the extracted JSON data is rendered into timelines and metric cards.

đźš§ Challenges I faced

  • Hallucination vs. Accuracy: The biggest hurdle was ensuring the AI didn't "invent" clauses. I had to implement a verification step where the AI cites the page number and paragraph reference for every data point it extracts (Source Grounding).
  • Complex Nested Clauses: LMA agreements often define terms within terms. Handling the recursive nature of definitions (e.g., "EBITDA" depending on "Consolidated Net Income," which depends on "GAAP") required me to develop a multi-pass parsing strategy.
  • Token Limits: Processing a 150-page document exceeded standard context windows, forcing me to chunk the document intelligently by section (e.g., "Representations," "Undertakings") rather than arbitrarily.

đź§  What I learned

  • The Power of Structured Output: I learned that asking an LLM for "a summary" is useless for finance; asking for a specific JSON schema is powerful.
  • Legal-Text Nuance: I gained a deeper appreciation for the precision of legal language. Words like "shall," "may," and "provided that" drastically alter the logic flow of the application.
  • Full-Stack Integration: Building this solo taught me how to bridge the gap between backend AI logic and frontend usability. I learned that displaying too much data is as bad as too little; the dashboard needed to highlight exceptions (e.g., a breached covenant) rather than just dumping raw data.

NOTE

The website provided is not connected to gemini api, as that costs money to use and I do not want to allow others to use my api key and to incur charges. So the demo website provided does not actually integrate with gemini and use it.

Built With

Share this project:

Updates