Overview
This guide will help you extract data from Mortgage Statements using Butler's OCR APIs in Python. In 15 minutes you'll be ready to add Python Mortgage Statement OCR into your product or workflow!
Before getting started, you'll want to make sure to do the following:
- Signup for a free Butler account at https://app.butlerlabs.ai
- Write down your Butler API key from the Settings menu. Follow the Getting Started guide for more details about how to do that.
Get your API ID
Sign into the Butler product, go to the Library and search for the Mortgage Statement model:
Click on the Mortgage Statement card, then press the Try Now button to create a new Mortgage Statement model:
Once on the model details page, go to the APIs tab:
Copy the API ID (also known as the Queue ID) and write it down. We'll use it in our code below.
Sample Python Mortgage Statement OCR Code
You can copy and paste the following Python sample code to process documents with OCR using the API.
# Ensure it's installed in your environment with pip install butler-sdk
from butler import Client
# Get API Key from https://docs.butlerlabs.ai/reference/uploading-documents-to-the-rest-api#get-your-api-key
api_key = '<api-key>'
# Get Queue ID from https://docs.butlerlabs.ai/reference/uploading-documents-to-the-rest-api#go-to-the-model-details-page
queue_id = '<queue_id>'
# Response is a strongly typed object
response = Client(api_key).extract_document(queue_id, 'mortgage_statement.pdf')
# Convert to a dictionary for printing
print(response.to_dict())
In-Product Sample Code
You can also copy the sample code directly from the product. This code will have your API ID and API Key already pre-populated for you!
Extracted Mortgage Statement Fields
Here is an example of what a Mortgage Statement JSON response looks like:
{
"documentId": "8491e900-5bbd-44e1-8fbb-e3ecb397f0e0",
"documentStatus": "Completed",
"fileName": "Sample Mortgage Statement.pdf",
"mimeType": "application/pdf",
"documentType": "Mortgage Statements",
"confidenceScore": "High",
"formFields": [
{
"fieldName": "Borrower Address",
"value": "4700 Oak Ridge Ln\nBethesda, MD 20814",
"confidenceScore": "High"
},
{
"fieldName": "Borrower Name 1",
"value": "Adam and Mary Jones",
"confidenceScore": "High"
},
{
"fieldName": "Due Date",
"value": "4/1/2012",
"confidenceScore": "High"
},
{
"fieldName": "Fees Due",
"value": "$160.00",
"confidenceScore": "High"
},
{
"fieldName": "Frequency",
"value": "Monthly",
"confidenceScore": "Low"
},
{
"fieldName": "Interest Due",
"value": "$1,048.07",
"confidenceScore": "High"
},
{
"fieldName": "Interest Rate",
"value": "4.75%",
"confidenceScore": "High"
},
{
"fieldName": "Loan Number",
"value": "1234567",
"confidenceScore": "High"
},
{
"fieldName": "Maturity Date",
"value": "September 2039",
"confidenceScore": "High"
},
{
"fieldName": "Principal Balance",
"value": "$264,776.43",
"confidenceScore": "High"
},
{
"fieldName": "Principal Due",
"value": "$386.46",
"confidenceScore": "High"
},
{
"fieldName": "Property Address",
"value": "4700 Oak Ridge Ln\nBethesda, MD 20814",
"confidenceScore": "High"
},
{
"fieldName": "Regular Payment Amount",
"value": "$1,669.71",
"confidenceScore": "High"
},
{
"fieldName": "Servicer Address",
"value": "8100 Market Ave\nBethesda, MD 20814",
"confidenceScore": "Low"
},
{
"fieldName": "Servicer Name",
"value": "Springside Mortgage",
"confidenceScore": "Low"
},
{
"fieldName": "Statement Date",
"value": "3/20/2012",
"confidenceScore": "High"
},
{
"fieldName": "Total Due",
"value": "$1,829.71",
"confidenceScore": "High"
},
{
"fieldName": "Total Escrow Due",
"value": "$235.18",
"confidenceScore": "High"
}
],
"tables": [
{
"tableName": "Transactions",
"confidenceScore": "Low",
"rows": [
{
"cells": [
{
"columnName": "Description",
"value": "Late Fee (charged because payment was received after 3/15/2012)",
"confidenceScore": "High"
},
{
"columnName": "Effective Date",
"value": "",
"confidenceScore": "Low"
},
{
"columnName": "Escrow Amount",
"value": "",
"confidenceScore": "Low"
},
{
"columnName": "Fees Amount",
"value": "",
"confidenceScore": "Low"
},
{
"columnName": "Interest Amount",
"value": "",
"confidenceScore": "Low"
},
{
"columnName": "Others Amount",
"value": "",
"confidenceScore": "Low"
},
{
"columnName": "Principal Amount",
"value": "",
"confidenceScore": "Low"
},
{
"columnName": "Total Amount",
"value": "",
"confidenceScore": "Low"
},
{
"columnName": "Total Charged",
"value": "$160.00",
"confidenceScore": "High"
},
{
"columnName": "Total Paid",
"value": "",
"confidenceScore": "Low"
},
{
"columnName": "Transaction Date",
"value": "3/16/12",
"confidenceScore": "High"
},
{
"columnName": "Unapplied Amount",
"value": "",
"confidenceScore": "Low"
}
]
},
{
"cells": [
{
"columnName": "Description",
"value": "Payment Received - Thank you",
"confidenceScore": "High"
},
{
"columnName": "Effective Date",
"value": "",
"confidenceScore": "Low"
},
{
"columnName": "Escrow Amount",
"value": "",
"confidenceScore": "Low"
},
{
"columnName": "Fees Amount",
"value": "",
"confidenceScore": "Low"
},
{
"columnName": "Interest Amount",
"value": "",
"confidenceScore": "Low"
},
{
"columnName": "Others Amount",
"value": "",
"confidenceScore": "Low"
},
{
"columnName": "Principal Amount",
"value": "",
"confidenceScore": "Low"
},
{
"columnName": "Total Amount",
"value": "",
"confidenceScore": "Low"
},
{
"columnName": "Total Charged",
"value": "",
"confidenceScore": "Low"
},
{
"columnName": "Total Paid",
"value": "$1,669.71",
"confidenceScore": "High"
},
{
"columnName": "Transaction Date",
"value": "3/17/12",
"confidenceScore": "High"
},
{
"columnName": "Unapplied Amount",
"value": "",
"confidenceScore": "Low"
}
]
}
]
}
]
}
Mortgage Statement API Response Details
For full details about the Mortgage Statement Model and its API response, see the Mortgage Statement page.