Ozarking Around with nycRealEstateR

Introduction

This is a quick demonstration of one of my private packages nycRealEstateR. This package provides a wrapper around New York City’s property data ecosystem including, but not limited to, ACRIS, New York City Department of Finance, PLUTO.

This package will not be released for public use but I am open to assisting parties that interest in harnessing the power of the package at my own discretion.

In this tutorial I will analyze the recent activity of a very large construction lender, Arkansas based Bank of the Ozarks to see what they have been up to in 2017.

Background

I was recently exploring new mortgages recordations in Manhattan and I noticed something, that despite a significantly weakening condominium environment Bank of the Ozarks continues to be quite active and even financed a new project for Extell Development earlier in the month.

df_mortgages_recent <-
  nycRealEstateR::get_data_acris_boroughs_docs(
    boroughs = "Manhattan",
    date_start = "2017-05-01",
    date_end = Sys.Date(),
    document_names = c("ASSIGNMENT OF LEASES AND RENTS", "AGREEMENT", "MORTGAGE")
  )

df_mortgages_recent %>%
  filter(dateDocument >= "2017-05-01") %>% 
  select(
    idBlock,
    idBorough,
    idLot,
    dateDocument,
    typeDocument,
    amountDocument,
    dataParties,
    urlACRISDocumentMetadata
  ) %>%
  unnest() %>%
  filter(nameParty %>% str_detect("BANK OF THE OZARKS")) %>%
  select(nameParty,
         typeDocument,
         idBlock,
         urlACRISDocumentMetadata,
         amountDocument) %>%
  distinct() %>% 
  formattable::formattable()
nameParty typeDocument idBlock urlACRISDocumentMetadata amountDocument
BANK OF THE OZARKS AGREEMENT 1548 http://a836-acris.nyc.gov/DS/DocumentSearch/DocumentDetail?doc_id=2017051000297011 $85,332,981
BANK OF THE OZARKS AGREEMENT 1548 http://a836-acris.nyc.gov/DS/DocumentSearch/DocumentDetail?doc_id=2017051000297010 $85,332,981
BANK OF THE OZARKS MORTGAGE 1548 http://a836-acris.nyc.gov/DS/DocumentSearch/DocumentDetail?doc_id=2017051000297009 $1,106,112

GDELT Sanity Check.

Before delving into the property recordations I wanted to do a quick sanity check and use my gdeltr2 which wraps the incredible GDELT Project to build an interactive trelliscope of extracted mentions of Bank of the Ozarks from all the sources it tracks to see how often the company has been mentioned in recent years.

If you filter on the year and date variables you will see pretty significant mentions for 2017 which is what I expected. Lets move on to the actual activity in New York City.

2017 New York City Activity

Seeing the recent activity got me thinking it would be interesting to explore the company’s activity throughout 2017.

df_ozarks <-
  nycRealEstateR::get_data_acris_parties(search_terms = "BANK OF THE OZARKS",
                                         date_start = "2017-01-01",
                                         date_end = Sys.Date(),
                                         parse_all_documents = FALSE)
df_ozarks %>% 
  count(nameBorough, typeDocument) %>% 
  arrange(desc(n)) %>% 
  formattable::formattable()
nameBorough typeDocument n
QUEENS PARTIAL RELEASE OF MORTGAGE 147
MANHATTAN UCC3 AMENDMENT 97
MANHATTAN INITIAL UCC1 27
MANHATTAN PARTIAL RELEASE OF MORTGAGE 26
MANHATTAN ASSIGNMENT OF LEASES AND RENTS 24
MANHATTAN RELEASE 23
MANHATTAN MORTGAGE 17
QUEENS RELEASE 14
QUEENS UCC3 AMENDMENT 13
MANHATTAN ASSIGNMENT, MORTGAGE 12
QUEENS ASSIGNMENT, MORTGAGE 11
QUEENS MORTGAGE 11
MANHATTAN AGREEMENT 10
MANHATTAN UCC3 TERMINATION 10
BROOKLYN ASSIGNMENT, MORTGAGE 9
QUEENS AGREEMENT 7
BROOKLYN UCC3 TERMINATION 6
BROOKLYN PARTIAL RELEASE OF MORTGAGE 3
BROOKLYN UCC3 AMENDMENT 3
MANHATTAN SUNDRY MISCELLANEOUS 3
MANHATTAN UCC3 ASSIGNMENT 3
QUEENS SUBORDINATION OF MORTGAGE 3
QUEENS UCC3 TERMINATION 3
BROOKLYN AGREEMENT 2
MANHATTAN TERMINATION OF ASSIGN OF L&R 2
QUEENS ASSIGNMENT OF LEASES AND RENTS 2
QUEENS INITIAL UCC1 2
QUEENS SATISFACTION OF MORTGAGE 2
BRONX AGREEMENT 1
BRONX ASSIGNMENT, MORTGAGE 1
BROOKLYN RELEASE 1
BROOKLYN TERMINATION OF AGREEMENT 1
MANHATTAN SATISFACTION OF MORTGAGE 1
QUEENS UCC3 ASSIGNMENT 1

Amount by Document Type and Borough

This will interactively explore the amount recorded by borough and type of document.

library(highcharter)
all <- 
  df_ozarks %>% 
  group_by(nameBorough, typeDocument) %>% 
  summarise(amountTotal = sum(amountDocument, na.rm = T)) %>% 
  ungroup()

categories_grouped <- 
  all %>% 
  group_by(name = nameBorough) %>% 
  do(categories = .$typeDocument) %>% 
  list_parse()

hc <- highchart() %>% 
  hc_xAxis(categories = categories_grouped) %>% 
  hc_add_series(data = all, type = "bar", hcaes(y = amountTotal, color = typeDocument),
                showInLegend = FALSE) %>% 
  hc_add_theme(hc_theme_smpl()) %>% 
  hc_title(text = "Bank of the Ozarks 2017 Recordations") %>% 
  hc_subtitle(text = "Data from ACRIS via nycRealEstateR")

hc

Resolved Property Addresses

Next I am going to use my wrappers for PLUTO and New York City’s Property Tax Database to resolve the ACRIS data with actual addresses and some information about the respective borough, block, lot information.

df_pluto <- nycRealEstateR::import_pluto()
df_lots <- nycRealEstateR::import_tax_lots()

table <- df_ozarks %>% select(idBlock, idLot, idBorough) %>% distinct() %>% 
    inner_join(df_lots %>% select(idBorough, idLot, idBlock, nameAddress, areaBuildingSF, 
        areaLotSF, ratioFAR) %>% bind_rows(df_pluto %>% select(idBorough, idLot, 
        idBlock, nameAddress, areaBuildingSF, areaLotSF, ratioFARMax))) %>% 
    arrange(idBorough, idLot, idBlock)
table

OCR a Random Document

One of the most unique features of nycRealEstateR is its ability to OCR any recorded document on ACRIS. I am going to demonstrate that here by OCR-ing the most recent recorded loan agreement.

ocr_data <- df_ozarks %>% filter(nameBorough == "MANHATTAN") %>% filter(typeDocument == 
    "AGREEMENT") %>% filter(datetimeRecorded == max(datetimeRecorded)) %>% nycRealEstateR::ocr_acris_documents()

OCR Results

Press the first button to the left to unnest the data and explore the text.

listviewer::jsonedit(ocr_data)

All Documents

df_ozarks %>% 
  dplyr::select(-urlACRISDocumentPDF) %>% 
  tidyr::nest(.key = dataTypeDocument, -c(idBorough, nameBorough, typeDocument)) %>%
  arrange(idBorough) %>%
  listviewer::jsonedit()

Next Time

In my next post I will showcase fundManageR to explore what is going on with Bank of Ozarks in the securities market.