Giter Site home page Giter Site logo

idx's Introduction

IDX

This is the beggining of an RStudio package to fetch and analyze RE data. as of 4/21/2020, the getDeepSearchResults has been optimized to loop through fetched data. An array of Zillow API keys are rolled on each call. Failures are stored in as separate data frame. Basic.

Install

# 0.1 Install ----
library(devtools)
devtools::install_github("sptrsn/IDX",force = TRUE)

How To

# 1.0 LIBRARIES ----
library(IDX)

# unsure how many of these libs are actually required
# Manage configurations
library(config)

# EDA
library(DataExplorer)
library(skimr)

# Modeling
library(recipes)
library(parsnip)
library(yardstick)
library(DALEX)
library(iBreakDown)

# Core
library(tidyverse)
library(tidyquant)
library(lubridate)
library(leaflet)
library(plotly)
library(dplyr)
library(rvest)
library(sp)

# 2.0 Zillow API Keys ----
keys <- c(
    'onekey',
    'twokey'
    )

# 3.0 Fetch properties ---- 
properties <- read.csv("~/rStudio/zillowtape.csv",header=TRUE)

# 3.1 create empty containers for Zillow & error data ----
zillowData = data.frame()
failed = data.frame()

# 3.2 create counter to track key usage ----
keycounter <- 1

# 4.0 Loop properties ----
for(i in 1:nrow(properties)){
 
    tryCatch(
        {
                
            # 4.1 Modify col (2,3,4,5) to match address, city, state & zip in your data ----
            address <-as.character(properties[i,2])
            city    <-as.character(properties[i,3])
            state   <-as.character(properties[i,4])
            zipcode <-properties[i,5]
            
            current<-c(address,zipcode,city,state)
            
            # 4.2 call zillow api for property i ----
            response <- GetDeepSearchResults(
                address = address, 
                city    = city,
                state   = state,
                zipcode = zipcode,
                api_key = keys[keycounter]
            ) 
           
             # 4.3 increment | reset api key ----
            if(keycounter == length(keys)){ 
                keycounter <- 1
            }else{
                keycounter <- keycounter + 1
            }
            
            if(length(response)==1){
                
                print('bad###')
                print(address)
                print("__________________")    
                
                df <- data.frame(matrix(unlist(current), nrow=1, byrow=T),stringsAsFactors=FALSE)
                failed <- rbind(failed,df)
                
                next
                
            }else{
                
                row<-response
            }
            
            # apend zillow response to the zillowData container
            zillowData <- rbind(zillowData,row)
        },
        error=function(e){
            print("ERROR :",conditionMessage(e), "\n")
        }
    )
    
}# !End for loop


# 5.0 View final zillowData output ----
View(zillowData)


# 6.0 display properties if errors ----
if(nrow(failed) == 0){
    
    print("No Errors")
    
}else{
    
    #print("Failed properties being displayed")
    fieldNames<-c("address","zipcode","city","state")
    names(failed)<-fieldNames
    View(failed)
    
}


# 7.0 End ----

# Fields returned by getDeepSearchResults

#fieldNames<-c("address","zipcode","city","state","lat","long","region_name","region_id","type","zestimate","zest_lastupdated","zest_monthlychange","zest_percentile","zestimate_low","zestimate_high","rentzestimate","rent_lastupdated","rent_monthlychange","rentzestimate_low","rentzestimate_high","zpid","bathrooms","bedrooms","finishedSqFt","lastSoldDate","lastSoldPrice","lotSizeSqFt","taxAssessment","taxAssessmentYear","totalRooms","yearBuilt")


Original Source

This is a fork from https://github.com/xiyuansun/realEstAnalytics

Zillow

All calls to the API require a unique Zillow API key, which you can acquire by signing up at https://www.zillow.com/howto/api/APIOverview.htm .

idx's People

Contributors

sptrsn avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.