Skip to content
This repository was archived by the owner on Jan 18, 2023. It is now read-only.

Historic Event By Location

Kelvin edited this page Oct 30, 2020 · 7 revisions

Historic Event by Location Method

historic.get_events_by_location(
    search_items, 
    location_type, 
    csv=False, 
    output_dir='/output'
)

This method first runs the HistoricSummary product for the given IDs to get all relevant historic event ids in the given location IDs, then runs the HistoricEvent product on the extracted historic events.

This method returns an array of array of HistoricSummary and HistoricEvent products for the given IDs. Optionally creates a csv file.

Arguments:

  • search_items: list/file of EventIds, events to retrieve historic event information for.
  • location_type: string, one of {property, neighborhood, city, zcta, tract, county, cd, state}, for the search item type.
  • csv: bool, whether to create a CSV for the retrieved data.
  • output_dir: string, location to output the created CSV (if csv is True).

Example (Command Line):

# Call historic.get_events_by_location on a list with 2 FSIDs
python -m firststreet -p historic.get_events_by_location -i 190836953;193139123 -l property

# Call historic.get_events_by_location on a file of SearchItems
python -m firststreet -p historic.get_events_by_location -f sample.txt -l property

Example (Python File):

# Contents of sample.py
# Create a `FirstStreet` object.  
import firststreet
fs = firststreet.FirstStreet("api-key")

# Call historic.get_events_by_location on a list with 2 property FSIDs
historic_event = fs.historic.get_events_by_location([190836953, 193139123], location_type="property", csv=True)

# Call historic.get_events_by_location on a file of SearchItems
historic_event = fs.historic.get_event("sample.txt", csv=True)

Historic Event By Location Output

Output:

List with 2 items:

  1. List of HistoricSummary products (See the Historic Summary page for more information)

  2. List of HistoricEvent products (See the Historic Event page for more information)

Clone this wiki locally