This is a treemap representing patient leakage, inspired by Mike's block
View in full screen to see legend.
<!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"> | |
/*! |
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; |
This is a treemap representing patient leakage, inspired by Mike's block
View in full screen to see legend.
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
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)); |