Skip to content

Instantly share code, notes, and snippets.

@michellemho
michellemho / overpass_fun.md
Last active October 6, 2023 09:14
CartoCamp Overpass Tutorial
@michellemho
michellemho / neighborhoods.md
Last active March 20, 2017 19:39
Proposal for FOSS4G Presentation

Title: What defines a neighborhood?

General Topic: Research

General Theme: TBD ("Local, state, and federal agency adoption and use" or "Data science"?)

What defines a neighborhood? We generally think of neighborhoods as geographic areas of similar characteristics. But what set of characteristics and what level of similiarity? What determines where the boundary lines actually gets drawn? Perceptions of where neighborhoods begin and end vary greatly from person to person. Neighborhoods defined from a data point-of-view also differ greatly. This talk presents several statistical techniques on defining neighborhoods from spatial clustering algorithms to origin-destination based approaches, and examines how neighborhood change-over-time can be represented. How a neighborhood gets defined affects residents, real estate, and researchers alike.

Literature Review

"Sales Territory Design: Thirty Years of Modeling and Implementation" Zoltners and Sinha (2005)

Sales Territory Alignment:

  • "The assignment of accounts and associated selling activities to salespeople and teams"
  • Also known as sales territory design, assignment, deployment, realignment and districting

Salesforce Structures

  • Generalist structure: salesperson assigned to specific geographic area
@michellemho
michellemho / store_demographics_time.md
Created June 14, 2017 19:31
CARTO dashboard workflow

Workflow:

  1. Find population density to each store location to determine "urban-ness" (the 2015 5-year ACS estimate is used)
  2. Also find median income at each store location at birth date and death date. So if a store opened in 2010, the 2010 5-year estimate is used.
  3. If the population density is greater than 5000 people / sq. km., create isochrones of 10 minute walking radius. Else, 10 minutes of driving time.
  4. For each polygon, find total population at time of death date.
  5. Calculate % change in median income from birth to death date.
  6. Expand the table to create an "time interval" table for the time widget
  7. Add both the store location table and expanded time interval table to a map
  8. "Filter by Layer" analysis on the time interval layer, choosing the store location layer as the filter
  9. "Filter by Layer" analysis on the store location layer, choosing the filtered time interval layer as the filter
@michellemho
michellemho / index.html
Created June 27, 2017 20:23
Santa Clara Map
<html>
<head>
<title>A D3 map of Santa Clara County</title>
<script src='https://d3js.org/d3.v4.min.js'></script>
<script src="https://d3js.org/topojson.v1.min.js"></script>
<script src="static/d3-tip.js"></script>
<script src='scc_zcta.js'></script>
<style type="text/css">
/* Legend Font Style */
@michellemho
michellemho / DEP_EXT_get_competitors.sql
Last active October 6, 2017 14:49
Get Competitors Analysis
/*
DEP_EXT_get_competitors
Return a table of competitors in the same industry of a selected retailer in the underlying source query
Example: A user has a dataset of retail brands and the industry. In the underlying source query (via a widget),
a single retailer is selected (ie. Dunkin Donuts). Then, this function will return a table of the competing retailers
in the coffee industry (ie. Starbucks, Peets, etc.).
If more than one retailer is selected, then all competitors will be returned.
So if Dunkin Donuts AND Stop&Shop are selected in the widget, then Starbucks, Peets, Wegmans, Whole Foods, etc. will be
returned in the table. If two retailers in the same industry are selected, the competitors are returned in the table
without the two retailers.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@michellemho
michellemho / index.html
Last active January 19, 2018 15:37
Quickstart Guide
<!DOCTYPE html>
<html>
<head>
<title>Guide | CARTO</title>
<meta name="viewport" content="initial-scale=1.0">
<meta charset="utf-8">
<!-- Include Leaflet -->
<script src="https://unpkg.com/[email protected]/dist/leaflet.js"></script>
<link href="https://unpkg.com/[email protected]/dist/leaflet.css" rel="stylesheet">
<!-- Include CARTO.js -->
@michellemho
michellemho / index.html
Last active January 19, 2018 15:31
CARTO.js Category dataview example
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>CARTO.js Category dataview example</title>
<!-- Include Leaflet 1.2.0 Library -->
<link rel="stylesheet" href="https://unpkg.com/[email protected]/dist/leaflet.css" />
<script src="https://unpkg.com/[email protected]/dist/leaflet.js"></script>
<!-- Fonts -->
<!-- <link href='https://fonts.googleapis.com/css?family=Open+Sans:300,400,600,700' rel='stylesheet' type='text/css'> -->
@michellemho
michellemho / index.html
Last active June 22, 2018 17:59
CARTO.js ON FIRE
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>CARTO.js ON FIRE!</title>
<!-- Include Leaflet 1.2.0 Library -->
<link rel="stylesheet" href="https://unpkg.com/[email protected]/dist/leaflet.css" />
<script src="https://unpkg.com/[email protected]/dist/leaflet.js"></script>
<!-- Fonts -->
<!-- <link href='https://fonts.googleapis.com/css?family=Open+Sans:300,400,600,700' rel='stylesheet' type='text/css'> -->