Created
September 16, 2015 11:46
-
-
Save unamandita/49d0464d1e09af15eda4 to your computer and use it in GitHub Desktop.
Midwives and c-sections: module #5 exercise
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
hospitalName | hospitalCounty | vaginalBirths | cesareanBirths | attendedByLicensedMidwife | artificialRuptureOfMembranes | medicinalInduction | internalFetalMonitoring | externalFetalMonitoring | augmentedLabor | fedExclusivelyBreastMilk | |
---|---|---|---|---|---|---|---|---|---|---|---|
Bronx-Lebanon Hospital Center - Concourse Division | BRONX | 0.662 | 0.338 | 0 | 0.08 | 0.081 | 0.113 | 0.525 | 0.07 | 0.014 | |
Montefiore Medical Center - North Division | BRONX | 0.665 | 0.335 | 0 | 0 | 0.085 | 0.003 | 0.997 | 0.042 | 0.274 | |
Montefiore Med Center - Jack D Weiler Hosp of A Einstein College Div | BRONX | 0.667 | 0.333 | 0.012 | 0 | 0.075 | 0.001 | 0.996 | 0.003 | 0.18 | |
Jacobi Medical Center | BRONX | 0.694 | 0.306 | 0.621 | 0.119 | 0.218 | 0.153 | 0.859 | 0.113 | 0.542 | |
Lincoln Medical & Mental Health Center | BRONX | 0.702 | 0.298 | 0 | 0.164 | 0.237 | 0.194 | 0.927 | 0.229 | 0.233 | |
North Central Bronx Hospital | BRONX | 0.742 | 0.258 | 0.677 | 0.079 | 0.218 | 0.209 | 0.952 | 0.123 | 0.088 | |
St Barnabas Hospital | BRONX | 0.746 | 0.254 | 0.204 | 0.042 | 0.155 | 0.046 | 0.685 | 0.14 | 0.159 | |
University Hospital of Brooklyn | KINGS | 0.474 | 0.526 | 0.001 | 0.083 | 0.092 | 0.015 | 0.948 | 0.173 | 0.531 | |
Brooklyn Hospital Center - Downtown Campus | KINGS | 0.615 | 0.385 | 0 | 0 | 0 | 0.001 | 0.992 | 0.001 | 0 | |
Wyckoff Heights Medical Center | KINGS | 0.634 | 0.366 | 0.003 | 0.266 | 0.107 | 0.192 | 0.949 | 0.353 | 0.215 | |
Coney Island Hospital | KINGS | 0.636 | 0.364 | 0.486 | 0.091 | 0.143 | 0.251 | 0.925 | 0.271 | 0.061 | |
Brookdale Hospital Medical Center | KINGS | 0.644 | 0.356 | 0.251 | 0.097 | 0.23 | 0.121 | 0.823 | 0.398 | 0.255 | |
New York Methodist Hospital | KINGS | 0.658 | 0.342 | 0.086 | 0.075 | 0.073 | 0.111 | 0.948 | 0.151 | 0.156 | |
Long Island College Hospital | KINGS | 0.66 | 0.34 | 0.077 | 0.026 | 0.134 | 0.149 | 0.986 | 0.337 | 0.216 | |
Lutheran Medical Center | KINGS | 0.663 | 0.337 | 0.018 | 0.521 | 0.338 | 0.013 | 0.997 | 0.226 | 0.563 | |
Woodhull Medical & Mental Health Center | KINGS | 0.701 | 0.299 | 0.605 | 0.056 | 0.187 | 0.287 | 0.927 | 0.2 | 0.423 | |
Kings County Hospital Center | KINGS | 0.747 | 0.253 | 0.137 | 0.319 | 0.131 | 0.24 | 0.985 | 0.243 | 0.315 | |
Maimonides Medical Center | KINGS | 0.763 | 0.237 | 0.201 | 0.047 | 0.133 | 0.112 | 0.946 | 0.2 | 0.18 | |
Lenox Hill Hospital | NEW YORK | 0.594 | 0.406 | 0 | 0.006 | 0.345 | 0 | 0.989 | 0.333 | 0.309 | |
New York Presbyterian Hospital - Columbia Presbyterian Center | NEW YORK | 0.597 | 0.403 | 0.001 | 0.187 | 0.219 | 0.09 | 0.856 | 0.145 | 0.494 | |
New York Presbyterian Hospital - Allen Pavilion | NEW YORK | 0.608 | 0.392 | 0.007 | 0.138 | 0.198 | 0.114 | 0.762 | 0.179 | 0.202 | |
New York Presbyterian Hospital - New York Weill Cornell Center | NEW YORK | 0.646 | 0.354 | 0 | 0.037 | 0.067 | 0.039 | 0.552 | 0.058 | 0.562 | |
Mount Sinai Hospital | NEW YORK | 0.655 | 0.345 | 0.088 | 0.141 | 0.198 | 0.022 | 0.991 | 0.204 | 0.279 | |
Harlem Hospital Center | NEW YORK | 0.666 | 0.334 | 0.003 | 0.041 | 0.141 | 0.321 | 0.945 | 0.158 | 0.286 | |
Bellevue Hospital Center | NEW YORK | 0.689 | 0.311 | 0.249 | 0.148 | 0.248 | 0.097 | 0.932 | 0.212 | 0.284 | |
St Lukes Roosevelt Hospital Center - Roosevelt Hospital Division | NEW YORK | 0.691 | 0.309 | 0.094 | 0.093 | 0.234 | 0.048 | 0.891 | 0.257 | 0.291 | |
NYU Hospitals Center | NEW YORK | 0.72 | 0.28 | 0 | 0.219 | 0.117 | 0.002 | 0.967 | 0.196 | 0.284 | |
Beth Israel Medical Center/Petrie Campus | NEW YORK | 0.726 | 0.274 | 0.137 | 0.112 | 0.12 | 0.114 | 0.794 | 0.216 | 0.095 | |
New York Downtown Hospital | NEW YORK | 0.728 | 0.272 | 0.018 | 0.013 | 0.046 | 0 | 0.945 | 0.014 | 0.908 | |
Metropolitan Hospital Center | NEW YORK | 0.733 | 0.267 | 0.241 | 0.096 | 0.146 | 0.207 | 0.972 | 0.291 | 0.703 | |
Jamaica Hospital Medical Center | QUEENS | 0.592 | 0.408 | 0.074 | 0.006 | 0.002 | 0 | 0.981 | 0.018 | 0.073 | |
Flushing Hospital Medical Center | QUEENS | 0.602 | 0.398 | 0.001 | 0.028 | 0.372 | 0.001 | 0.839 | 0.521 | 0.113 | |
Long Island Jewish Medical Center | QUEENS | 0.626 | 0.374 | 0.002 | 0.178 | 0.175 | 0.064 | 0.994 | 0.268 | 0.19 | |
St Johns Episcopal Hospital So Shore | QUEENS | 0.634 | 0.366 | 0 | 0.006 | 0.098 | 0.001 | 0.987 | 0.067 | 0.518 | |
New York Hospital Medical Center of Queens | QUEENS | 0.661 | 0.339 | 0 | 0.419 | 0.046 | 0.151 | 0.981 | 0.307 | 0.312 | |
Forest Hills Hospital | QUEENS | 0.668 | 0.332 | 0.002 | 0.069 | 0.069 | 0.058 | 0.973 | 0.103 | 0.101 | |
Queens Hospital Center | QUEENS | 0.692 | 0.308 | 0 | 0.066 | 0.213 | 0.1 | 0.787 | 0.25 | 0.724 | |
Elmhurst Hospital Center | QUEENS | 0.7 | 0.3 | 0.123 | 0.207 | 0.159 | 0.059 | 0.881 | 0.159 | 0.298 | |
Richmond University Medical Center | RICHMOND | 0.569 | 0.431 | 0.002 | 0.546 | 0.143 | 0.019 | 0.498 | 0.033 | 0.331 | |
Staten Island University Hosp-North | RICHMOND | 0.773 | 0.227 | 0.032 | 0.001 | 0.149 | 0.003 | 0.989 | 0.086 | 0.299 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<title>Adding Tooltips</title> | |
<script type="text/javascript" src="http://d3js.org/d3.v3.js"></script> | |
<style type="text/css"> | |
body { | |
font-family: "Helvetica"; | |
font-size: 24px; | |
background-color: white; | |
color: black; | |
padding-top: 10px; | |
padding-left: 20px; | |
padding-bottom: 10px; | |
} | |
h2 { | |
font-size: 14px; | |
font-weight: lighter; | |
} | |
svg { | |
background-color: white; | |
} | |
.axis path, | |
.axis line { | |
fill: none; | |
stroke: black; | |
shape-rendering: crispEdges; | |
} | |
.axis text { | |
font-family: sans-serif; | |
font-size: 11px; | |
} | |
circle:hover { | |
fill: #ff6699; | |
} | |
</style> | |
</head> | |
<body> | |
Midwife attendance and cesarean births at New York City hospitals in 2013 | |
<h2>The graph below shows the relationship between the percentage of births attended by licensed midwives (x-axis) and the percentage delivered via c-section (y-axis) at NYC hospitals in 2013. Source: <a href="https://health.data.ny.gov/Health/Hospital-Maternity-Information-Beginning-2008/net3-iygw">Health Data NY</a></h2> | |
<script type="text/javascript"> | |
var w = 650; | |
var h = 550; | |
var padding = [ 10, 10, 20, 35 ]; //Top, right, bottom, left | |
var xScale = d3.scale.linear() | |
.range([ padding[3], w - padding[1] - padding[3] ]); | |
var yScale = d3.scale.linear() | |
.range([ padding[0], h - padding[2] ]); | |
var xAxis = d3.svg.axis() | |
.scale(xScale) | |
.orient("bottom") | |
.tickFormat(function(d) { | |
return d + "%"; | |
}); | |
var yAxis = d3.svg.axis() | |
.scale(yScale) | |
.orient("left") | |
.tickFormat(function(d) { | |
return d + "%"; | |
}); | |
var svg = d3.select("body") | |
.append("svg") | |
.attr("width", w) | |
.attr("height", h); | |
d3.csv("hospital_maternity_info_2013.csv", function(data) { | |
xScale.domain([ | |
d3.min(data, function(d){ | |
return d.attendedByLicensedMidwife*100; | |
}), | |
d3.max(data, function(d){ | |
return d.attendedByLicensedMidwife*100; | |
}) | |
]); | |
yScale.domain([ | |
d3.max(data, function(d){ | |
return d.cesareanBirths*100; | |
}), | |
d3.min(data, function(d){ | |
return d.cesareanBirths*100; | |
}) | |
]); | |
svg.append("g") | |
.attr("class", "x axis") | |
.attr("transform", "translate(" + "0" + "," + (h - padding[2]) + ")") | |
.call(xAxis); | |
svg.append("g") | |
.attr("class", "y axis") | |
.attr("transform", "translate(" + padding[3] + ",0)") | |
.call(yAxis); | |
var circles = svg.selectAll("circle") | |
.data(data) | |
.enter() | |
.append("circle"); | |
circles.attr("cx", function(d){ | |
return xScale(d.attendedByLicensedMidwife*100); | |
}) | |
.attr("cy", function(d){ | |
return yScale(d.cesareanBirths*100); | |
}) | |
.attr("r", 0.1) | |
.attr("fill", "#ff0066") | |
.attr("stroke", "white") | |
.attr("opacity", 0.6) | |
.append("title") | |
.text(function(d) { | |
return "At " + d.hospitalName + ", " + Math.round(d.attendedByLicensedMidwife*1000)/10 + "% of births were attended by a licensed midwife, and " + Math.round(d.cesareanBirths*1000)/10 + " % were delivered via c-section."; | |
}); | |
circles.sort(function(a, b) { | |
return d3.ascending(+a.attendedByLicensedMidwife, +b.attendedByLicensedMidwife); | |
}) | |
.transition() | |
.delay(function(d, i) { | |
return i * 50; | |
}) | |
.duration(1000) | |
.attr("r", 5); | |
}); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment