dsrusso

27 Jan 2015

This data scraper pulls an extensive xml profile for every business in a given area code that is registered to produce toxic materials.  The data obtained varies from latitude and longitude, to contact emails on file with the government. (See Sample Below)

from temboo.Library.EnviroFacts.Toxins import FacilitiesSearchByZip
from temboo.core.session import TembooSession
import time 

file = open("test.xml", "w")

# Create a session with your Temboo account details
session = TembooSession(***********, "myFirstApp", "******************")

# Instantiate the Choreo
facilitiesSearchByZipChoreo = FacilitiesSearchByZip(session)

# Get an InputSet object for the Choreo
facilitiesSearchByZipInputs = facilitiesSearchByZipChoreo.new_input_set()

counter =0

for i in range (15201 , 15295):
	counter += 1
# Set the Choreo inputs
	facilitiesSearchByZipInputs.set_Zip(i)

# Execute the Choreo
	facilitiesSearchByZipResults = facilitiesSearchByZipChoreo.execute_with_results(facilitiesSearchByZipInputs)

# # Print the Choreo outputs
# print("Response: " + facilitiesSearchByZipResults.get_Response())
	file.write(facilitiesSearchByZipResults.get_Response())
	file.write("\n")
	print counter, "zip:",i
	time.sleep(30)



file.close()

 

The end goal of using this data is to created city maps that visualize concentrations of possible toxic contamination. The next step i’d like to add to this process is cross referencing these concentrations with average income levels from the Census Bureau.


< ?xml version="1.0"?>

 
  15201BRBRSNEMCC
  BARBER SPRING
  ONE MCCANDLESS AVE
  PITTSBURGH
  ALLEGHENY
  42003
  PA
  15201
  3
  0
  BARBER SPRING
  ONE MCCANDLESS AVE
  PITTSBURGH
  PA
  
  
  15201-
  C
  
  
  NA
  WABTEC CORP
  402901
  795717
  
  
  
  
  
  
  
  
  0
  DAVID JABLONOWSKI
  4127827316
  
  DJABLONOWSKI@WABTEC.COM
  4127827316
  DJABLONOWSKI@WABTEC.COM
  
  WABTEC CORP
  
   
    1306204294351
    1
    15201BRBRSNEMCC
    007440473
    L
    2006
    DAVID JABLONOWSKI
    VICE PRESIDENT OF OPERATIONS
    0
    1
    03
    O
    01-JUN-07
    12-JUN-07
    DAVID JABLONOWSKI
    4127827316
    1
    
    1
    0
    1
    NA
    14-JUN-07
    0
    12-JUN-07
    14-JUN-07
    0
    0
    NA
    CHROMIUM
    0
    0
    0
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    M
   
   
    1309208100141
    1