# BreazeHome County Records App

This app provides the BreazeHome Database with daily, up-to-date County Records for homes in Miami Dade County.


### Django REST Framework API Endpoints Available
County Records
Lien Records

### Document Types In The Dataset
General Liens,
Federal Tax Liens,
Judgement Liens,
Deeds,
Mortgages,
Quick Claim Deeds,
Foreclosures,
Satisfaction of Mortgage,
Judgements,
Affidavits,
Order of Commencement,
Code Violations

## Import Script Guides


### Instructions
In order to run the daily import scipt, do the following...

1. In your terminal go to the breaze/breaze-api-django directory
2. Activate your development environment `source venv/bin/activate`
3. Now go to the county_records/import_scripts directory
4. Open the file last_download_date in any code editor
5. This file contains one line and has a date written in   'mmddyyyy' format. This date is the last valid download from the Miami Dade API that the script has successfully completed.
6. Change the date to your desired date if you need to.
4. Run the command `python3 download_daily_import.py`
5. The script will now run. It will take anywhere from 5-30 minutes to complete. Completion time is dependent on how large the CSV file is.


### Tasks
The script will do the following every time it runs.

1. Check the file last_download_date and extract the date.
2. Download the daily ZIP file for the next day from the Miami-Dade FTP
2. Unzip the downloaded ZIP file, which contains a .EXP file
3. **The script will utilize the secondary python file feed_md_records.py for the EXP parsing.**
4. Insert new records into the BreazeHome DB, or update existing records.
5. Once the EXP file has been parsed, it will be deleted from the system.
6. ZIP file will be moved to its volume in the BreazeHome DB for storage.
7. The last_download_date file gets updated with the most recent date.


## Miami Dade FTP-API
Dr. Rishe has provided us with Miami-Dade FTP-API access using his account. <br />
**IF YOU NEED API CREDENTIALS, ASK THE PRODUCT OWNER** </br>
**WE ARE ONLY ALLOWED TWO FTP-API CALLS PER DAY!!** <br />   
**DO NOT SHARE THE CREDENTAILS!!!** <br />  
**SEEK APPROVAL FROM YOUR SCRUM MASTER BEFORE RUNNING ANY IMPORT SCRIPTS!!!** <br /> 
