Skip to content

Instantly share code, notes, and snippets.

@scotthmurray
Forked from cliff145/hospitalStaffing.csv
Last active September 15, 2015 00:49
Show Gist options
  • Save scotthmurray/a18e2faacc9867053394 to your computer and use it in GitHub Desktop.
Save scotthmurray/a18e2faacc9867053394 to your computer and use it in GitHub Desktop.
Stuck with Y-Axis Mapping
Facility BeginDate EndDate County ControlType HoursType ProductiveHours ProductiveHoursPatient
KINDRED HOSPITAL - SACRAMENTO 1/1/2013 8/31/2013 Sacramento Investor Daily Cost Centers 97,925 12.25
KINDRED HOSPITAL - SACRAMENTO 1/1/2013 8/31/2013 Sacramento Investor Management & Supervision 84,775 10.6
SAN LEANDRO HOSPITAL 1/1/2013 10/30/2013 Alameda Non-Profit Daily Cost Centers 172,742 9.08
PACIFIC HOSPITAL OF LONG BEACH 1/1/2013 10/8/2013 Los Angeles Investor Daily Cost Centers 345,127 8.94
SAN LEANDRO HOSPITAL 1/1/2013 10/30/2013 Alameda Non-Profit Registered Nurse 161,559 8.49
VERDUGO HILLS HOSPITAL 1/1/2013 7/15/2013 Los Angeles Non-Profit Ancillary Cost Centers 202,102 7.99
VERDUGO HILLS HOSPITAL 1/1/2013 7/15/2013 Los Angeles Non-Profit Daily Cost Centers 183,345 7.25
SAN LEANDRO HOSPITAL 1/1/2013 10/30/2013 Alameda Non-Profit Technician & Specialist 128,689 6.76
SAN LEANDRO HOSPITAL 1/1/2013 10/30/2013 Alameda Non-Profit General Services Cost Centers 126,937 6.67
SAN LEANDRO HOSPITAL 1/1/2013 10/30/2013 Alameda Non-Profit Ancillary Cost Centers 117,881 6.2
VERDUGO HILLS HOSPITAL 1/1/2013 7/15/2013 Los Angeles Non-Profit Registered Nurse 154,836 6.12
VERDUGO HILLS HOSPITAL 1/1/2013 7/15/2013 Los Angeles Non-Profit Technician & Specialist 133,714 5.29
PACIFIC HOSPITAL OF LONG BEACH 1/1/2013 10/8/2013 Los Angeles Investor Clerical & Other Administrative 186,594 4.83
SAN LEANDRO HOSPITAL 1/1/2013 10/30/2013 Alameda Non-Profit Ambulatory Cost Centers 81,761 4.3
SAN LEANDRO HOSPITAL 1/1/2013 10/30/2013 Alameda Non-Profit Contracted Other 81,592 4.29
VERDUGO HILLS HOSPITAL 1/1/2013 7/15/2013 Los Angeles Non-Profit Aides & Orderlies 108,319 4.28
KINDRED HOSPITAL - SACRAMENTO 1/1/2013 8/31/2013 Sacramento Investor Ancillary Cost Centers 33,083 4.14
PACIFIC HOSPITAL OF LONG BEACH 1/1/2013 10/8/2013 Los Angeles Investor Technician & Specialist 157,691 4.08
SAN LEANDRO HOSPITAL 1/1/2013 10/30/2013 Alameda Non-Profit Clerical & Other Administrative 75,916 3.99
KINDRED HOSPITAL - SACRAMENTO 1/1/2013 8/31/2013 Sacramento Investor Technician & Specialist 31,940 3.99
PACIFIC HOSPITAL OF LONG BEACH 1/1/2013 10/8/2013 Los Angeles Investor Registered Nurse 143,987 3.73
PACIFIC HOSPITAL OF LONG BEACH 1/1/2013 10/8/2013 Los Angeles Investor Management & Supervision 141,701 3.67
VERDUGO HILLS HOSPITAL 1/1/2013 7/15/2013 Los Angeles Non-Profit Clerical & Other Administrative 90,384 3.58
KINDRED HOSPITAL - SACRAMENTO 1/1/2013 8/31/2013 Sacramento Investor Administrative Services Cost Centers 28,108 3.51
PACIFIC HOSPITAL OF LONG BEACH 1/1/2013 10/8/2013 Los Angeles Investor Ancillary Cost Centers 129,292 3.35
PACIFIC HOSPITAL OF LONG BEACH 1/1/2013 10/8/2013 Los Angeles Investor Administrative Services Cost Centers 126,806 3.28
KINDRED HOSPITAL - SACRAMENTO 1/1/2013 8/31/2013 Sacramento Investor General Services Cost Centers 25,967 3.25
PACIFIC HOSPITAL OF LONG BEACH 1/1/2013 10/8/2013 Los Angeles Investor General Services Cost Centers 114,224 2.96
PACIFIC HOSPITAL OF LONG BEACH 1/1/2013 10/8/2013 Los Angeles Investor Contracted Other 100,647 2.61
KINDRED HOSPITAL - SACRAMENTO 1/1/2013 8/31/2013 Sacramento Investor Environmental & Food Services 20,746 2.59
SAN LEANDRO HOSPITAL 1/1/2013 10/30/2013 Alameda Non-Profit Administrative Services Cost Centers 44,338 2.33
KINDRED HOSPITAL - SACRAMENTO 1/1/2013 8/31/2013 Sacramento Investor Aides & Orderlies 18,464 2.31
SAN LEANDRO HOSPITAL 1/1/2013 10/30/2013 Alameda Non-Profit Fiscal Services Cost Centers 42,510 2.23
SAN LEANDRO HOSPITAL 1/1/2013 10/30/2013 Alameda Non-Profit Environmental & Food Services 41,762 2.2
VERDUGO HILLS HOSPITAL 1/1/2013 7/15/2013 Los Angeles Non-Profit General Services Cost Centers 55,053 2.18
KINDRED HOSPITAL - SACRAMENTO 1/1/2013 8/31/2013 Sacramento Investor Licensed Vocational Nurse 16,312 2.04
SAN LEANDRO HOSPITAL 1/1/2013 10/30/2013 Alameda Non-Profit Aides & Orderlies 38,454 2.02
PACIFIC HOSPITAL OF LONG BEACH 1/1/2013 10/8/2013 Los Angeles Investor Fiscal Services Cost Centers 76,197 1.97
VERDUGO HILLS HOSPITAL 1/1/2013 7/15/2013 Los Angeles Non-Profit Fiscal Services Cost Centers 42,906 1.7
VERDUGO HILLS HOSPITAL 1/1/2013 7/15/2013 Los Angeles Non-Profit Management & Supervision 37,987 1.5
VERDUGO HILLS HOSPITAL 1/1/2013 7/15/2013 Los Angeles Non-Profit Administrative Services Cost Centers 37,754 1.49
VERDUGO HILLS HOSPITAL 1/1/2013 7/15/2013 Los Angeles Non-Profit Ambulatory Cost Centers 36,022 1.42
PACIFIC HOSPITAL OF LONG BEACH 1/1/2013 10/8/2013 Los Angeles Investor Ambulatory Cost Centers 52,247 1.35
SAN LEANDRO HOSPITAL 1/1/2013 10/30/2013 Alameda Non-Profit Contracted Registry Nursing 21,219 1.12
SAN LEANDRO HOSPITAL 1/1/2013 10/30/2013 Alameda Non-Profit Management & Supervision 18,991 1
PACIFIC HOSPITAL OF LONG BEACH 1/1/2013 10/8/2013 Los Angeles Investor Education Cost Centers 38,619 1
PACIFIC HOSPITAL OF LONG BEACH 1/1/2013 10/8/2013 Los Angeles Investor Other 37,294 0.97
PACIFIC HOSPITAL OF LONG BEACH 1/1/2013 10/8/2013 Los Angeles Investor Licensed Vocational Nurse 37,059 0.96
SAN LEANDRO HOSPITAL 1/1/2013 10/30/2013 Alameda Non-Profit Licensed Vocational Nurse 17,987 0.95
KINDRED HOSPITAL - SACRAMENTO 1/1/2013 8/31/2013 Sacramento Investor Clerical & Other Administrative 7,125 0.89
KINDRED HOSPITAL - SACRAMENTO 1/1/2013 8/31/2013 Sacramento Investor Other 6,218 0.78
PACIFIC HOSPITAL OF LONG BEACH 1/1/2013 10/8/2013 Los Angeles Investor Contracted Registry Nursing 29,907 0.77
PACIFIC HOSPITAL OF LONG BEACH 1/1/2013 10/8/2013 Los Angeles Investor Aides & Orderlies 29,276 0.76
VERDUGO HILLS HOSPITAL 1/1/2013 7/15/2013 Los Angeles Non-Profit Licensed Vocational Nurse 18,997 0.75
PACIFIC HOSPITAL OF LONG BEACH 1/1/2013 10/8/2013 Los Angeles Investor Environmental & Food Services 18,356 0.48
VERDUGO HILLS HOSPITAL 1/1/2013 7/15/2013 Los Angeles Non-Profit Other 10,656 0.42
KINDRED HOSPITAL - SACRAMENTO 1/1/2013 8/31/2013 Sacramento Investor Fiscal Services Cost Centers 2,613 0.33
KINDRED HOSPITAL - SACRAMENTO 1/1/2013 8/31/2013 Sacramento Investor Contracted Registry Nursing 1,736 0.22
VERDUGO HILLS HOSPITAL 1/1/2013 7/15/2013 Los Angeles Non-Profit Contracted Registry Nursing 1,856 0.07
KINDRED HOSPITAL - SACRAMENTO 1/1/2013 8/31/2013 Sacramento Investor Registered Nurse 351 0.04
VERDUGO HILLS HOSPITAL 1/1/2013 7/15/2013 Los Angeles Non-Profit Contracted Other 433 0.02
KINDRED HOSPITAL - SACRAMENTO 1/1/2013 8/31/2013 Sacramento Investor Contracted Other 29 0
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Loading CSV Data with D3</title>
<script type="text/javascript" src="http://d3js.org/d3.v3.js"></script>
<style type="text/css">
body {
background-color: #FDD8FF;
font-family: Arial;
font-size: 25px;
text-align: center;
}
p {
font-size: 40px;
text-align: left;
}
svg {
background-color: #FDD8FF;
fill: gray;
}
.axis path,
.axis line {
fill: none;
stroke: black;
shape-rendering: crispEdges;
}
.axis text {
font-family: sans-serif;
font-style: 11px;
}
rect:hover {
fill: #79007F;
}
g.bar text {
fill: black;
font-size: 10px;
text-anchor: end;
}
</style>
</head>
<body>
<p>Hospitals' Productive Hours per Patient, CA 2013</p>
<script type="text/javascript">
var w = 400;
var h = 800;
var padding = [ 20, 10, 30, 150 ] //top, right, bottom, left
var widthScale = d3.scale.linear()
.range([0, w - padding[1] - padding[3] ]);
var heightScale = d3.scale.ordinal()
.rangeRoundBands([ padding[0], h - padding[2] ], 0.1);
var colorScale = d3.scale.ordinal()
.domain(["Sacramento", "Alameda", "Los Angeles"])
.range(["orange", "blue", "green"]);
var xAxis = d3.svg.axis()
.scale(widthScale)
.orient("bottom");
var yAxis = d3.svg.axis()
.scale(heightScale)
.orient("left");
var svg = d3.select("body")
.append("svg")
.attr("width", w)
.attr("height", h);
d3.csv("hospitalStaffing.csv", function(data) {
data.sort(function(a, b) {
return d3.descending(+a.ProductiveHoursPatient, +b.ProductiveHoursPatient);
});
widthScale.domain([ 0, d3.max(data, function(d) {
return +d.ProductiveHoursPatient;
}) ]);
heightScale.domain(d3.range(data.length));
console.log(heightScale.domain());
var groups = svg.selectAll("g.bar")
.data(data)
.enter()
.append("g")
.attr("class", "bar");
groups.append("rect")
.attr("x", padding[3])
.attr("y", function(d, i) {
return heightScale(i);
})
.attr("width", function(d) {
return widthScale(d.ProductiveHoursPatient);
})
.attr("height", heightScale.rangeBand())
.attr("fill", function(d) {
return colorScale(d.County);
});
groups.append("text")
.attr("x", padding[3] - 3)
.attr("y", function(d, i) {
return heightScale(i) + 10;
})
.text(function(d) {
return d.County;
});
groups.append("title")
.text(function(d) {
return d.Facility + ": " + d.ProductiveHoursPatient;
});
svg.append("g")
.attr("class", "x axis")
.attr("transform", "translate(" + padding[3] + "," + (h - padding[2]) + ")")
.call(xAxis);
// svg.append("g")
// .attr("class", "y axis")
// .attr("transform", "translate(" + (padding[3] - 5) + ",0)")
// .call(yAxis);
});
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment