aaronsw / watchdog

The watchdog project.

This URL has Read+Write access

watchdog / templates / politician.html
100644 324 lines (278 sloc) 15.778 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
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
$def with (pol, pos)
 
$if pol.is_current:
    $var head: <script src="http://maps.google.com/maps?file=api&amp;v=2&amp;key=ABQIAAAA32O3YO3sztAoMSWYheUtTBQYu38vSyEOJo4J0P8Mwlrd5U_lzhQ2ZoxaOYKY-qh7R36VeBWvCtHU5g" type="text/javascript"></script> <script src="/static/js/gmap-wms.js"></script> <script src="/static/js/distmap.js"></script> <script type="text/javascript">distcenter('googlemap', "$((pol.district and pol.district.name or '').replace('-0', '').replace('-', ''))", [$(pol.district and pol.district.center_lat or 0.0), $(pol.district and pol.district.center_lng or 0.0), $(pol.district and pol.district.zoom_level and (pol.district.zoom_level - 2) or 0.0)])</script>
 
$var title: $pol.title $pol.firstname $pol.middlename $pol.lastname
 
$var sidebar: None
 
$if pol.is_current:
    $var pretext: <div id="sidebarmap" style="width: 248px; height: 386px;clear: right; margin-top: -24px;"><div id="googlemap" class="sidemap"></div></div>
    
$var width: 90%
$var color: white
 
 
<style>
    table.contributors { width: 100%; }
    table.contributors td { text-align: right;}
    table.contributors th { font-weight: normal;}
    table.interest_group_agreement td { text-align: right;}
    .intro {margin-top: 4.5px;}
</style>
 
<div class="rep-info">
<h1>$pol.title $pol.firstname $pol.middlename $pol.lastname</h1>
 
<table class="structure"><tr>
 
$if pol.photo_path:
    <td style="padding-right: 10px; width: 5em;"><a href="http://watchdog.net$pol.photo_path"><img src="http://watchdog.net$pol.photo_path" alt="Headshot" class="headshot" style="padding: 7px; border: 1px solid #999;" /></a><br /><div class="postit" style="clear: both !important; text-align: center; margin-bottom: 10px; padding: 3px; border: none"><a href="/share?url=$getpath()&title=$pol.firstname $pol.middlename $pol.lastname"><strong>Share this page</strong></a></div></td>
 
<td rowspan="2" style="line-height: 15px;">
 
  $if pol.nickname: <b>Nickname:</b> known as "$pol.nickname"<br />
  $if pol.birthday:
      <div class="intro"><b>Birthdate:</b> b. $pol.birthday</div>
      $if pol.birthplace: <div class="intro"><b>Birthplace:</b> $pol.birthplace</div>
      
 
  $if pol.district:
      <div class="intro"><b>District:</b> represents <a href="/us/$(pol.district and pol.district.name or '')">$(pol.district and pol.district.name or 'None')</a></div>
  $if pol.party:
<div class="intro"><b>Political Party:</b> $pol.party</div>
  $if pol.religion:
<div class="intro"><b>Religion:</b> $pol.religion</div>
 
$if pol.education:
    <div class="intro"><b>Education:</b> $pol.education</div>
$if pol.last_elected_year:
    $if pol.pct_vote_received == 100:
         <div class="intro"><b>Last elected</b> in $pol.last_elected_year, unopposed.</div>
    $else:
         <div class="intro"><b>Last elected</b> in $pol.last_elected_year receiving $commify(pol.n_vote_received) ($pol.pct_vote_received%) votes.</div>
$else:
    <div class="intro"><b>Last elected:</b> Former member of congress.</div>
 
 
$#pol.opponents
$#pol.past_votes
$if pol.officeurl:
  <div class="intro"><a href="$pol.officeurl">Official website</a></div>
<!-- <span style="color: #EE4400">Phone Number: 000-000-0000</span><br /> -->
  
</td></tr><tr>
 
$if pol.capitolwords:
     <td colspan="2" style="color: #638f45;">
     <a href="http://capitolwords.org/lawmaker/$pol.bioguideid" style="text-decoration: underline; color: #638f45">Capitol Word Frequency</a>&nbsp;&rarr;&nbsp;
         $for w in pol.capitolwords:
             <nobr><a href="http://capitolwords.org/word/$w.word">$w.word</a> <sup>($w.word_count)</sup></nobr>
 
</td><tr><tr><td colspan="3"><div class="disclaimer" style="padding-top: 6x; margin-bottom: 12px; text-align: left;">
  $if pol.votesmartid:
  Biographical information from
      <a href="http://votesmart.org/bio.php?can_id=$pol.votesmartid" class="external">Project Vote Smart</a>,
      <a href="$pol.wikipedia" class="external">Wikipedia</a>.
  $if pol.photo_credit_text:
      Photo from
      <a href="$pol.photo_credit_url" class="external">$pol.photo_credit_text</a>.
  </div>
</td></tr>
</table>
</div>
 
<table class="structure" style="border-top: 1px solid #ccc;">
<tr><td width="50%">
<h2 class="rep">Money</h2>
 
$def spark(label, data, polid, by, unit='', url=None):
    $if label:
        <td style="white-space:nowrap; padding-left: 6px;">$:label</td>
    $if not data:
        $ data = 0
    $ display = commify(data) + ' ' + unit
    $if unit == '$':
        $ display = unit + commify(data)
    $elif unit and unit[0] == '%':
        $ display = '%.0f' % (abs(data) * 100) + unit
    $if url:
        <td class="sparkdata"><a href="$url">$display</a></td>
    $else:
        <td class="sparkdata" style="width: 100%">$display</td>
    <td class="sparkline"><a href="/p/by/$by#$polid"
           ><img src="/p/by/$by/distribution.png?point=$data"
                 class="sparkline" /></a></td>
    <td class="sparknum"><sup>(#${pos('politician',by,polid)})</sup></td>
 
<table class="structure charted"><tbody>
$if pol.money_raised:
    <tr class="even">
      $:spark('Raised', pol.money_raised, pol.id, 'money_raised', '$')
    </tr><tr class="odd">
      $:spark('Spent', pol.pct_spent, pol.id, 'pct_spent', '%')
    </tr><tr class="even">
      $:spark('From self', pol.pct_self, pol.id, 'pct_self', '%')</td>
    </tr><tr class="odd">
      $:spark('From individuals', pol.pct_indiv, pol.id, 'pct_indiv', '%')</td>
    </tr><tr class="even">
      $:spark('From PACs', pol.pct_pac, pol.id, 'pct_pac', '%')
    </tr>
    <tr><td colspan="4" class="disclaimer" style="text-align: left">PAC = Political Action Committees. Money data from <nobr><a href="http://www.fec.gov/" class="external">the FEC</a>for the 200X cycle.</td></tr>
$else:
    <tr><th>No information available.</td></tr>
</tbody></table>
</td><td class="width: 50%">
<h2 class="rep">Earmarks</h2>
 
<table class="charted structure"><tbody>
$if pol.n_earmark_requested:
  <tr class="even">
    $:spark('Requested', pol.n_earmark_requested, pol.id, 'n_earmark_requested', url='/p/'+pol.id+'/earmarks')
  </tr><tr class="odd">
    $:spark('Total cost', pol.amt_earmark_requested, pol.id, 'amt_earmark_requested', '$')
  </tr><tr class="even">
    $:spark('Received', pol.n_earmark_received, pol.id, 'n_earmark_received')
  </tr><tr class="odd">
    $:spark('Total cost', pol.amt_earmark_received, pol.id, 'amt_earmark_received', '$')
  </tr>
  <tr><td colspan="4" class="disclaimer" style="text-align: left">Data for fiscal year 2008 from <a href="http://taxpayer.net/earmarks.php" class="external">Taxpayers for Common Sense</a>.</td></tr>
$else:
    <tr><th>No information available.</td></tr>
</tbody></table>
</td></tr><tr><td width="50%" style="padding-bottom: 10px;">
 
<h2 class="rep" style="clear: both;">Voting Analysis</h2>
 
<table class="charted structure" style="width: 100%"><tbody>
$if pol.nominate:
    <tr class="even">
    $:spark('Ideology', pol.nominate, pol.id, 'nominate', '% right-wing' if pol.nominate >= 0 else '% left-wing')
    </tr>
$if pol.predictability:
    <tr class="odd">
    $:spark('Predictable', pol.predictability, pol.id, 'predictability', '%')
    </tr>
    <tr><td colspan="4" class="disclaimer" style="text-align: left">Data and terminology from <a href="http://voteview.com/" class="external">VoteView</a>. Unpredictable measures how often members vote against their party.</td></tr>
$else:
    <tr><th>No information available.</td></tr>
</tbody></table>
 
<h2 class="rep">Speeches</h2>
 
<table class="charted structure" border="0"><tbody>
$if pol.n_speeches:
  <tr class="even">
    $:spark('Spoke', pol.n_speeches, pol.id, 'n_speeches', 'times', 'http://www.govtrack.us/congress/person.xpd?tab=speeches&id='+(pol.govtrackid or ''))
  </tr><tr class="odd">
    $:spark('Avg. length', pol.words_per_speech, pol.id, 'words_per_speech', 'words')
  </tr>
  <tr><td colspan="4" class="disclaimer" style="text-align: left">Data for 110th Congress from <a href="http://www.govtrack.us/congress/person.xpd?id=$pol.govtrackid" class="external">GovTrack</a>.</td></tr>
$else:
    <tr><th>No information available.</td></tr>
  </tbody></table>
  
</td><td width="50%">
 
<h2 class="rep">Bills</h2>
 
<table class="charted structure"><tbody>
$if pol.n_bills_cosponsored:
  <tr class="even">
    $:spark('Co-sponsored', pol.n_bills_cosponsored, pol.id, 'n_bills_cosponsored')
  </tr>
  <tr class="odd">
    $:spark('Introduced', pol.n_bills_introduced, pol.id, 'n_bills_introduced', url='/p/'+pol.id+'/introduced')
  </tr>
  <tr class="even">
    $:spark('Debated', pol.n_bills_debated, pol.id, 'n_bills_debated')
  </tr>
  <tr class="odd">
    $:spark('Enacted', pol.n_bills_enacted, pol.id, 'n_bills_enacted')
  </tr>
  <tr><td colspan="4" class="disclaimer" style="text-align: left">Data from <a href="http://www.govtrack.us/congress/person.xpd?id=$pol.govtrackid" class="external">GovTrack</a>.</td></tr>
$else:
    <tr><th>No information available.</td></tr>
</tbody></table>
 
</td></tr>
 
 
$if pol.related_groups:
    <tr><td colspan="2" class="rule" >
    <h2 class="rep">Interest Group Alignment</h2>
    <table cellpadding="0" cellspacing="0" width="100%" class="interest_group_agreement">
    $ trclass = "odd"
    <tbody>
    <tr><td colspan="2" style="text-align: left; padding-bottom: 4px;" class="disclaimer">Interest Group Alignment compares a politician’s votes to positions taken by interest groups. <a href="http://watchdog.net/blog/alignment">[ more ]</a></td></tr>
    <tr><th style="padding-left: 6px;">Group</td><th style="text-align: right; padding-right: 25px;">Agreement</td></tr>
    $for group in pol.related_groups:
        <tr class="$loop.parity">
          <td style="padding-left: 6px; text-align: left;">$group.longname</td>
          <td>$int(group.agreement * 100)% (<a href="/p/$pol.id/$group.id">$group.agreed/$group.total votes</a>)</td>
         </tr>
    <tr><td colspan="2" style="text-align: left;"><span style="color: #EE4400"><a href="/p/$pol.id/groups" class="more">More interest groups</a>&nbsp;&rarr;</span></td></tr>
    <tr><td colspan="4" class="disclaimer" style="text-align: left">Data from <a href='http://maplight.org/map/us/legislator' class="external">Maplight.org </a>, for the 11Xth Congress.</td></tr>
    </tbody></table></td></tr><tr>
 
 
$if pol.handshakes:
    <tr><td colspan="2" class="rule">
    <h2 class="rep">Handshakes</h2>
    <table cellpadding="0" cellspacing="0" width="100%" class="handshakes">
    <tbody>
        <tr><td colspan="5" style="text-align: left; padding-bottom: 4px;" class="disclaimer">Handshakes are funds that are donated to a politician by a employees of a company, and flow back out to the same company.</td></tr><tr>
            <tr>
            <td width='50%'><b>Earmark Recipient</b></td>
            <td colspan="2"><b>Donations</b></td>
            <th>Earmarks</th>
            <th>Cycle</th></tr>
    $for h in pol.handshakes:
        $ corporation = h.corporation.replace(' ', '-')
        <tr class="$loop.parity">
           <td>$h.corporation.title()</td>
           <td class="sparkdata">\$$commify(h.corp2pol)</td>
           <td class="sparkline">
               $ query = 'from=%s&to=%s&point=%s' % (urlquote(h.corporation), h.politician_id, h.corp2pol)
               <a href="/contrib/?$query">
                   <img src="/contrib/distribution.png?$query" class="sparkline" />
               </a>
           </td>
           <td>\$$h.pol2corp</td>
           <td>$h.year</td>
        </tr>
    </tbody></table>
    </td></tr>
 
 
$if pol.contributors:
    <td colspan="2">
    <h2 class="rep">Top Contributors</h2>
    <table class="charted structure contributors" style="width: 100%"><tbody>
        <tr><td colspan="3" style="text-align: left; padding-bottom: 4px;" class="disclaimer">Individuals reporting the same zip code who have donated to a lawmaker's political campaign. Use with caution: based on raw FEC data.</td></tr>
    $for c in pol.contributors:
        $ names = c.name.lower().replace(',', '').split(' ')
        $ name = '_'.join(names[1:])+'_'+names[0]
        <tr class="$loop.parity">
            <th>$loop.index <a href="/contrib/$c.zip/$name">$format_name(c.name.title())</a></th>
            <td>\$$commify(int(c.amt))</td>
            <td style="text-align: left;"> $:date_range(c.from_date, c.to_date)</td>
        </tr>
      <tr><td colspan="3" style="text-align: left;"><span style="color: #EE4400">
          <a href="/p/$pol.id/contribs" class="more">More contributors</a>&nbsp;&rarr;</span></td></tr>
     <tr><td colspan="3" class="disclaimer" style="text-align: left">Source: FEC data from the 1980 to 2000 election cycles.</td></tr>
    </tbody></table>
    </td>
    </tr>
 
$def niceurl(url):
    $:url.lower().replace(' ', '_')
 
$if pol.contributor_employers:
    <tr>
    <td colspan="2" class="rule">
    <h2 class="rep">Top Contributor Employers</h2>
    <table class="charted structure contributors" style="width: 100%"><tbody>
    <tr><td colspan="2" style="text-align: left; padding-bottom: 4px;" class="disclaimer">Campaigns disclose the employers of their contributors; this list aggregates them. Use with caution: this list is based on raw FEC data</td></tr>
    $for c in pol.contributor_employers:
        <tr class="$loop.parity">
            <th>$loop.index <a href="/empl/$:niceurl(c.employer_stem)">$c.employer_stem.title()</a></th>
            <td>\$$commify(int(c.amt))</td>
        </tr>
    <tr><td colspan="2" style="text-align: left;"><span style="color: #EE4400"><a href="/p/$pol.id/contrib-employers" class="more">More contributors</a>&nbsp;&rarr;</span></td></tr>
    <tr><td colspan="2" class="disclaimer" style="text-align: left">Source: FEC data from the 1980 to 2000 election cycles.</td></tr>
    </tbody></table>
 
</td></tr><tr>
    
$if pol.lob_contribs:
     <tr><td colspan="2" class="rule">
     <h2 class="rep">Top Lobby Contributors</h2>
     <table class="charted structure contributors" style="width: 100%"><tbody>
     <tr><td colspan="4" style="text-align: left; padding-bottom: 4px;" class="disclaimer">New rules require lobbyists to disclose their giving, and giving by the PACs they control. Use with caution: This data compiled from raw filings</td></tr>
     $for c in pol.lob_contribs:
         $def whom():
      ${(c.contact_name if c.contact_name else ((c.prefix or '') + ' ' + (c.firstname or '') + ' ' + (c.middlename or '') + ' ' + (c.lastname or '') + ' ' + (c.suffix or ''))).title()}
         <tr class="$loop.parity">
             <th>$loop.index <a href="/lob/f/$c.filing_id">$:whom() - $c.name.title()</a></th>
      <td>\$$commify(c.amount)</td>
         </tr>
     <tr><td colspan="2" style="text-align: left;"><span style="color: #EE4400"><a href="/p/$pol.id/lobby" class="more">More lobby contributors</a>&nbsp;&rarr;</span></td></tr>
     <tr><td colspan="4" class="disclaimer" style="text-align: left">Source: Senate Office of Public Records LD-203 disclosure database; data from 2008.</td></tr>
     </tbody></table>
     </td>
    </tr>
      <tr><td colspan="4" class="disclaimer" style="text-align: left">Some campaign finance information from <a href="http://opensecrets.org/politicians/summary.asp?CID=$pol.opensecretsid" class="external">Open Secrets</a>.</td></tr>
 
</table>
 
<br /><br />
<p><strong>Developers:</strong> Get this page in <a href="${pol.id.lower()}.n3">N3</a>, <a href="${pol.id.lower()}.xml">XML</a>, or <a href="${pol.id.lower()}.json">JSON</a>.</p>
 
<p><em>Also known as:</em>
  $pol.govtrackid (GovTrack),
  $pol.opensecretsid (OpenSecrets),
  $pol.bioguideid (Congressional Bio),
  $pol.icpsrid (ICPSR),
  $pol.votesmartid (Vote Smart)\
$if pol.fec_ids:
    , \
    $for fec_id in pol.fec_ids: $fec_id \
    (FEC)\
</p>