Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 269 lines (227 sloc) 8.067 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268
<!DOCTYPE html>
<html>
<head>
<title>Source | This is the Tagline - A project by Knight-Mozilla OpenNews</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<link href='http://fonts.googleapis.com/css?family=Open+Sans:400,300' rel='stylesheet' type='text/css'>
<style type="text/css">
body {
margin: 0;
}
#topbar {
position: fixed;
background-color: #e4e4e4;
height: 50px;
width: 100%;
margin-bottom: 50px;
top: 0px;
border-bottom: 1px solid #767676;
-moz-box-shadow: 0px 2px 4px #767676;
-webkit-box-shadow: 0px 2px 4px #767676;
box-shadow: 0px 2px 4px #767676;
}

#topbar #barstuff {
width: 800px;
height: 50px;
margin-right: auto;
margin-left: auto;
}

#topbar img.opennews {
padding-top:2px;
float: right;
}

#topbar img.sourcelogomin {
padding-top: 5px;
display: none;
}


header {
width: 800px;
margin-top: 100px;
margin-bottom: 50px;
margin-right: auto;
margin-left: auto;
}

article {
width: 800px;
margin-right: auto;
margin-left: auto;
font-family: Georgia;
font-size: 1.3em;
line-height: 1.8em;
}

h2 {
font-family: 'Open Sans', Helvetica, sans-serif;
font-weight: 400;
text-align: left;
margin-bottom: 20px;
color: #2e2e2d;
    text-transform: uppercase;
    font-size: 30px;
}

h3 {
font-family: 'Open Sans', Helvetica, sans-serif;
font-weight: 300;
text-align: left;
margin-bottom: 10px;
color: #2e2e2d;
    text-transform: uppercase;
    font-size: 24px;

}


h4 {
font-family: Georgia;
font-weight: normal;
font-size: 1.3em;
margin-top: 0px;
margin-bottom: 45px;
line-height: 1.2em;
color: rgba(250,121,7,0.94);
}

aside {
font-family: 'Open Sans', sans-serif;
font-weight: 300;
float: right;
width: 200px;
height: 100%;
padding-left: 30px;
font-size: .8em;
margin-top: 0px;
padding-top: 0px;
line-height: 1.1em;
}

aside #library{
margin-top: 50px;
}

aside #library ul {
list-style-type: square;
padding: 0;
margin-left: 20px;
}

aside #library li {
margin-bottom: 10px;
}

ul#nav {
margin-top: 12px;

margin-right: -12px;
float: right;
font-family: 'Open Sans', sans-serif;
font-weight: 300;
font-size: 16px;
text-transform: uppercase;
width: 300px;
text-shadow: 0px 1px 0px #f3f3f4;
}

#nav li {
margin-top: 15px;
display: inline;
}

#nav li a {
border-right: 1px solid #e4e4e4;
border-left: 1px solid #e4e4e4;
padding-top: 12px;
padding-bottom: 15px;
color: #333333;
text-decoration: none;
padding-right: 10px;
padding-left: 10px;

}

#nav li a:hover {
border-right: 1px solid #eeeeee;
border-left: 1px solid #eeeeee;
background-color: #c2c2c2;
}

img.opennews {
}

.fixed {
position: fixed;
top: 50px;
left: 600px;
}

.gist {
font-size: .7em;
line-height: 1.1em;
}

p.date {
margin-top: 10px;
}

p.byline {
font-weight: 400;
}
p.organization {
font-weight: 400;
margin-top: -10px;
}

footer {
width: 800px;
margin-left: auto;
margin-right: auto;
margin-top: 100px;
}
</style>
</head>
<body>
<div id="topbar">
<div id="barstuff">
<a href="http://www.mozillaopennews.org"><img src="media/opennewsmini.png" class="opennews"></a>
<img src="media/sourcemin.png" class="sourcelogomin">
<ul id="nav">
<li><a href="http://www.nytimes.com">Projects</a>
<li><a href="http://www.nytimes.com">Community</a>
<li><a href="http://www.nytimes.com">Code</a>
</ul>
</div>
</div>
<header>
<img src="media/source_logo.png" class="biglogo">
</header>
<article>
<h2>Untangling a Web of FEC Data</h2>
<h4>The ProPublica News Apps Team explains how they built a 'Tangled Web' of election contribution data</h4>
<aside>
<p class="date">March 23, 2012</p>
<p class="byline">by Al Shaw</p>
<p class="organization">ProPublica</p>
<div id="library">
Code in this piece
<ul>
<li>tootsie roll bear
<li>Carrot cake bonbon donut
<li>gingerbread dessert caramels
</ul>
</div>

</aside>
<p>Our Tangled Web graphic shows the 200 biggest recipients of expenditure money from the five major presidential campaigns (Gingrich, Obama, Paul, Romney and Santorum), as well as from major super PACs, from around the middle of 2011 through February, 2012.

<p>Campaign finance reporters Kim Barker and Justin Elliott dug into the top 200 recipients and assembled detailed descriptions most of them. Some of the companies receiving money from campaigns and committees incorporated shortly before this election cycle and are described here in detail for the first time. The graphic also shows examples of campaigns and super PACs sharing consultants, which as the New York Times detailed last month can raise questions about improper coordination.

<h3>Assembling the Data</h3>
<p>To assemble the data, we used the New York Times' Campaign Finance API to grab ID numbers for FEC filings. From there, we grabbed the filings thesmelves by passing each of the filing IDs to FECh, a handy Ruby gem also written by the Times. Then we filtered out ones marked as amendments or as quarterly, year-end or monthly aggregations.

<p>Using Google Refine, a tool for cleaning messy data, we clustered recipient organization names and merged ones that differed slightly; for example, we merged together payments marked “Google” and “Google Inc.” We then selected the top 200 recipients across all of the committees and campaigns we are tracking.

<p>We also needed to filter out line items that contained a back_reference_tran_id_number which are simply the itemization details of another expenditure we've already counted, like credit card payments.

<p>This is obviously very complicated stuff and we did have a hiccup: the first version of the graphic, which was live on our site for a few minutes, didn't filter out some filings that were superceded by amendments. We also hadn't taken out backreferenced transactions. Because of that, our numbers were much larger than they should have been. To get it right, we ended up running every step of our methodology by the FEC.

<h3>Making the Graphic</h3>

<p>The graphic itself is called a Sankey diagram. They're designed to show both flow direction and rate. The most famous Sankey diagram is probably Minard's map of Napoleon's 1812 Russia campaign, one of visualization expert Edward Tufte's favorite graphics.

<p>To make the diagram, we wrote scripts to output the top 200 recipients, as well as the campaigns and committees into a huge JSON hash. Using jQuery, we created divs on each side of the graph with heights proportional to each committee's share of all the money that went to a given payee. To create the flow lines, we used Raphael.js, a library that makes it easy to draw vector graphics on web pages. In Raphael, we drew lines with the thickness of each committee-payee div connecting them by their ids. To create the nice quadratic bezier curve, we used a little code from Tom Counsell's Sankey library. Basically, instead of drawing lines directly from one side to the other, we curved them by a specific ratio to give it the snake-like look typical of the Sankey diagram. Here's how that looks and works:

<iframe style="width: 100%; height: 300px" src="http://jsfiddle.net/XxGPu/21/embedded/" allowfullscreen="allowfullscreen" frameborder="0"></iframe>

<p>Special thanks to Derek Willis at the Times and Paul Clark at the FEC for helping us interpret the filing data.

</article>

<footer>
<a rel="license" href="http://creativecommons.org/licenses/by/3.0/"><img alt="Creative Commons License" style="border-width:0" src="http://i.creativecommons.org/l/by/3.0/88x31.png" /></a><br />
<p>Source is a project of Knight-Mozilla OpenNews.
</footer>
<script type="text/javascript">
$(document).ready(function () {
  var top = $('.biglogo').offset().top - parseFloat($('.biglogo').css('margin-top').replace(/auto/, 0));
  $(window).scroll(function (event) {
    // what the y position of the scroll is
    var y = $(this).scrollTop();
  
    // whether that's below the form
    if (y >= top) {
      // if so, add the fixed class
      $('.sourcelogomin').fadeIn('fast');
    } else {
      // otherwise remove it
      $('.sourcelogomin').hide();
    }
  });
});
</script>
</body>
</html>
Something went wrong with that request. Please try again.