Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View tmthyjames's full-sized avatar
🤷‍♂️

Timothy Dobbins tmthyjames

🤷‍♂️
View GitHub Profile
@tmthyjames
tmthyjames / SQLCell.ipynb
Created August 14, 2016 22:53
SQL Magic Function for Jupyter Notebook
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@tmthyjames
tmthyjames / stealth_scraping.ipynb
Created August 27, 2016 23:45
Scraping EPA data using randomized time delays and a PhantomJS headless browser
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@tmthyjames
tmthyjames / KNNNBA.ipynb
Last active January 23, 2017 01:10
NBA K Nearest Neighbors
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
<!DOCTYPE html>
<html>
<head><meta charset="utf-8" />
<title>SQLCell Readme</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.1.10/require.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script>
<style type="text/css">
/*!
@tmthyjames
tmthyjames / geoflow.js
Created December 3, 2016 18:06
Concentric Circles for same lat,lng
var newLatLng = function(olat, olng, r, degrees){
var lat1 = olat * Math.PI/180.0;
var lon1 = olng * Math.PI/180.0;
var d = (r/6371)/1000; //radius of the earth in km, accounts for curvature
var lon, loc;
var tc = degrees * Math.PI/180.0; // convert to radians to use trig functions
var lat = Math.asin(Math.sin(lat1)*Math.cos(d)+Math.cos(lat1)*Math.sin(d)*Math.cos(tc));
lat = 180.0 * lat / Math.PI;
if (Math.cos(lat1) == 0){
lon = olng;
@tmthyjames
tmthyjames / point_spreads.ipynb
Created July 21, 2016 23:25
Point Spread Predictions for NBA/NCAA
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@tmthyjames
tmthyjames / README.md
Last active July 20, 2016 14:54
Treemap of Patient Leakage

This is a treemap representing patient leakage, inspired by Mike's block

View in full screen to see legend.

@tmthyjames
tmthyjames / README.md
Last active July 20, 2016 14:53
Spatial Sankey for Shared Patients Between Doctors and Hospitals

This example is inspired by yellowcap's block with many enhancements, including UI changes and rendering optimizations since I was dealing with larger data sets.

This spatial sankey graph shows the geographical flow of patients from doctors to general acute care hospitals. The selected hospital (green node) is the target hospital, which receives at least one visit from every physician (blue or red nodes). The physician nodes are colored red or blue based on their amount of patient leakage (inverse of marketshare: 1-marketshare). Leakage is defined as all visits to hospitals (usually general acute care hospitals) where the receiving hospital is not the physician's primary hospital. Blue nodes have the smallest leakage amount so they are known as loyalists because they send at least 75% of all general acute care hospital visits to the selected

@tmthyjames
tmthyjames / geojson.js
Last active July 20, 2016 02:33
Leaflet rendering and calculation of perfect geographical circles in python jupyter kernel
var radiusFromLatLon = function(latIn, lonIn, radius){
var locs = [];
var lat1 = parseFloat(latIn) * Math.PI/180.0;
var lon1 = parseFloat(lonIn) * Math.PI/180.0;
var d = radius/3956.0;
var range360 = Array.apply(null, Array(360)).map(function (_, i) {return i;});
for (var i in range360){
var lon, loc;
var tc = (range360[i] / 90.0) * Math.PI/2.0;
var lat = Math.asin(Math.sin(lat1)*Math.cos(d)+Math.cos(lat1)*Math.sin(d)*Math.cos(tc));
@tmthyjames
tmthyjames / nbaknn.ipynb
Last active July 6, 2016 03:15
nba k-nearest neighbor
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.