Skip to content

Commit

Permalink
Add proxy voting table to covid-19 page
Browse files Browse the repository at this point in the history
  • Loading branch information
JoshData committed May 27, 2020
1 parent f511721 commit 80fc388
Show file tree
Hide file tree
Showing 3 changed files with 136 additions and 7 deletions.
56 changes: 56 additions & 0 deletions person/views.py
Expand Up @@ -1008,4 +1008,60 @@ def person_cosponsors(request, pk):
"date_range": date_range,
}

def load_proxy_vote_info():
import csv
from collections import defaultdict

# Map legislators to their history of proxy assignments and
# proxies to a list of their proxy assignments.
proxy_pairs = [ ]
proxy_map = defaultdict(lambda : [])
by_proxy = defaultdict(lambda : [])

with open("data/legislator-proxies/Remote-Proxy - Sheet1.csv") as f:
for rec in csv.DictReader(f):
remote_legislator_id = int(rec["Remote ID"])
proxy_id = int(rec["Proxy ID"])
date_assigned = datetime.strptime(rec["Date Assigned"], "%m/%d/%Y").date()
rec = {
"remote_legislator": remote_legislator_id,
"proxy": proxy_id,
"from": date_assigned,
"until": None
}
proxy_pairs.append(rec)
proxy_map[remote_legislator_id].append(rec)
by_proxy[proxy_id].append(rec)

# Replace IDs with Person instances.
people = Person.objects.in_bulk(set(proxy_map.keys()) | set(by_proxy.keys()))
proxy_map = {
people[k]: sorted(v, key = lambda rec : rec["from"])
for k, v in proxy_map.items()
}
by_proxy = {
people[k]: sorted(v, key = lambda rec : rec["from"])
for k, v in by_proxy.items()
}
for rec in proxy_pairs:
rec["remote_legislator"] = people[rec["remote_legislator"]]
rec["proxy"] = people[rec["proxy"]]

proxy_pairs.sort(key = lambda rec : (rec["from"], rec["remote_legislator"].sortname))
current_proxy_pairs = [rec for rec in proxy_pairs if not rec["until"]]
by_proxy_sorted = sorted(
by_proxy.items(),
key = lambda kv : (-len(kv[1]), kv[1][-1]["from"], kv[0].sortname)
)
current_by_proxy_sorted = [
(k, [rec for rec in v if not rec["until"]])
for k, v in by_proxy_sorted
if len([rec for rec in v if not rec["until"]])
]

return {
"current_proxy_pairs": current_proxy_pairs,
"proxy_map": proxy_map,
"by_proxy": by_proxy,
"current_by_proxy_sorted": current_by_proxy_sorted,
}
84 changes: 77 additions & 7 deletions templates/website/covid19.html
Expand Up @@ -218,26 +218,96 @@
{% block body %}
<h1>COVID-19 in Congress</h1>

<p>We&rsquo;re tracking Congress&rsquo;s response to COVID-19, the disease caused by the SARS-CoV-2 coronavirus.
Below you&rsquo;ll find information on legislative actions and <span class="affected-legislators-count"> </span> Members of Congress who are or have been quarantined, tested positive for COVID-19, or came in contact with someone with COVID-19.</p>
<p>We&rsquo;re tracking Congress&rsquo;s response to COVID-19, the disease caused by the SARS-CoV-2 coronavirus. Below you&rsquo;ll find information on:</p>
<ul>
<li><a href="#legislation">Legislative actions and policy</a></li>
<li><a href="#proxyvotes">Proxy votes in the House</a></li>
<li><span class="affected-legislators-count"> </span> Members of Congress who are or have been <a href="#legislators">quarantined, tested positive for COVID-19, or came in contact</a> with someone with COVID-19</li>
</ul>

<h2><span>Legislative Actions</span></h2>
<a name="legislation"></a>
<h2><span>Legislative Actions and Policy</span></h2>

<p><a href="https://www.govtrack.us/congress/bills/116/hr6074">H.R. 6074: Coronavirus Preparedness and Response Supplemental Appropriations Act, 2020</a> &mdash; Enacted March 4, 2020. Provided $8.3 billion in emergency funding for federal agencies to respond to the coronavirus outbreak related to developing a vaccine, medical supplies, grants for public health agencies, small business loans, and assistance for health systems in other countries. Allowed for temporarily waiving Medicare restrictions and requirements regarding telehealth services.</p>
<p><a href="https://www.govtrack.us/congress/bills/116/hr6201">H.R. 6201: Families First Coronavirus Response Act</a> &mdash; Enacted March 18, 2020. Guaranteed free coronavirus testing, established paid leave, enhanced unemployment insurance, expanded food security initiatives, and increased federal Medicaid funding.</p>
<p><a href="https://www.govtrack.us/congress/bills/116/hr748">H.R. 748: Coronavirus Aid, Relief, and Economic Security Act</a> &mdash; Enacted March 27, 2020. A $2 trillion coronavirus relief bill, which will send $1,200 to each American making $75,000 a year or less, add $600/week to unemployment benefits for four months, give $100 billion to hospitals and health providers, make $500 billion of loans or investments to businesses, states and municipalities, and $32 billion in grants to the airline industry, and more.</p>
<p><a href="https://www.govtrack.us/congress/bills/116/hr266">H.R. 266: Paycheck Protection Program and Health Care Enhancement Act</a> &mdash; Enacted April 24, 2020. A $484 billion relief bill that went to replenish the Paycheck Protection Program (PPP) for small businesses and to public health measures such as virus testing and hospital funding.</p>
<p><a href="https://coronavirus.skoposlabs.com">coronavirus.skoposlabs.com</a> &mdash; Other legislative activities and federal regulations tracked by Skopos Labs</p>

<h2><span>Analysis</span></h2>
<h3>Policy Analysis</h3>

<p><a href="https://medium.com/p/what-did-congress-do-during-the-1918-flu-pandemic-c0bd96ad2287?source=email-51cfa67992b0--writer.postDistributed&sk=a3ce115fc93bcb3bd552de1fc4c4f9bd">What did Congress do during the 1918 flu pandemic?</a> [GovTrack.us]</p>
<p><a href="https://www.everycrsreport.com/search.html?q=COVID-19">CRS reports related to COVID-19</a> [everycrsreport.com], <a href="https://www.pogo.org/training/covid-19-resources/">COVID-19 Oversight & Policy Resources</a> [POGO]</p>

<h2><span>Affected Legislators</span></h2>
<a name="proxyvotes"></a>
<h2><span>Proxy Voting in the House of Representatives</span></h2>

<p>In all, <span class="affected-legislators-count"> </span> representatives and senators are or have self-quarantined or took other action, or no action, after coming in contact with someone with COVID-19 or testing positive for COVID-19 themselves.</p>
<p>At the peak of the virus&rsquo;s spread in March 2020 before Congress went on recess, 22 representatives, and slightly earlier 6 senators, were simultaneously self-quarantining. Both the House and Senate have adapted their procedures to keep legislators and support staff safe while also keeping Congress operational.</p>

<p>In the Senate, <span class="party-totals-senate">...</span>. In the House, <span class="party-totals-house">...</span>.</p>
<p>On May 15, the House <a href="https://www.govtrack.us/congress/votes/116-2020/h107">passed a rules change</a> to allow proxy voting for floor votes and remote committee committee meetings during this pandemic (<a href="https://docs.house.gov/meetings/RU/RU00/20200514/110750/HRPT-116-420.pdf">see the committee report for further background</a>). Then, pursuant to the new rules, on May 19 the House&rsquo;s Office of Attending Physician and Sergeant at Arms determined the existence of a &ldquo;public health emergency due to a novel coronavirus,&rdquo; which triggered the beginning of proxy voting rules. Under the rules for proxy voting, representatives may designate another representative as their proxy in advance of votes in <a href="https://clerkpreview.house.gov/ProxyLetter#ActiveProxies">a letter to the Clerk of the House of Representatives</a> and must give their proxy exact instructions on how to vote.</p>

<p>In the Senate, although no proxy voting is allowed for floor votes, some Senate committees have begun holding some meetings with senators participating remotely. And while not yet used, <a href="https://www.everycrsreport.com/reports/RS22952.html">existing Senate rules permit voting by proxy in committee</a>.</p>

<h3>Legislators voting by proxy</h3>

{% with LEGISLATOR_PROXIES as proxies %}

<p>The following {{proxies.current_proxy_pairs|length}} legislators are currently voting by proxy:</p>

<table class="table">
<thead>
<tr>
<th>Remote Legislator</th>
<th>Proxy Legislator</th>
<th>Since</th>
</tr>
</thead>
<tbody>
{% for row in proxies.current_proxy_pairs %}
<tr>
<td><a href="{{row.remote_legislator.get_absolute_url}}">{{row.remote_legislator}}</a></td>
<td><a href="{{row.proxy.get_absolute_url}}">{{row.proxy}}</a></td>
<td>{{row.from|date}}</td>
</tr>
{% endfor %}
</tbody>
</table>

<h3>Proxies</h3>

<p>The following list is the same information as above but grouped by proxy legislator. A legislator may be a proxy for up to ten legislators.</p>

<table class="table">
<thead>
<tr>
<th>Proxy Legislator</th>
<th>Remote Legislators</th>
</tr>
</thead>
<tbody>
{% for proxy, remote_legislators in proxies.current_by_proxy_sorted %}
<tr>
<td><a href="{{proxy.get_absolute_url}}">{{proxy}}</a></td>
<td>
{% for row in remote_legislators %}
<a href="{{row.remote_legislator.get_absolute_url}}">{{row.remote_legislator}}</a>
({{row.from|date}}-{{row.until|date}}){% if not forloop.last %}, {% endif %}
{% endfor %}
</td>
</tr>
{% endfor %}
</tbody>
</table>

{% endwith %}


<a name="legislators"></a>
<h2><span>Quarantined and Sick Legislators</span></h2>

<p>In all, <span class="affected-legislators-count"> </span> representatives and senators self-quarantined or took other action, or no action, after coming in contact with someone with COVID-19 or testing positive for COVID-19 themselves.</p>

<p class="hidden">In the Senate, <span class="party-totals-senate">...</span>. In the House, <span class="party-totals-house">...</span>.</p>

<p>In the charts below, the duration of each self-quarantine is indicated.</p>

Expand Down
3 changes: 3 additions & 0 deletions website/middleware.py
Expand Up @@ -6,6 +6,8 @@

from emailverification.models import BouncedEmail

from person.views import load_proxy_vote_info

import us

# http://whois.arin.net/rest/org/ISUHR/nets
Expand Down Expand Up @@ -45,6 +47,7 @@ def is_ip_in_any_range(ip, blocks):
"GOOGLE_ANALYTICS_KEY": getattr(settings, 'GOOGLE_ANALYTICS_KEY', ''),
"FACEBOOK_APP_ID": getattr(settings, 'FACEBOOK_APP_ID', ''),
"ELECTION_JUST_HAPPENED_YEAR": datetime.datetime.now().year if datetime.datetime.now().month >= 11 and (datetime.datetime.now().year % 2) == 0 else None,
"LEGISLATOR_PROXIES": load_proxy_vote_info,
}

def template_context_processor(request):
Expand Down

0 comments on commit 80fc388

Please sign in to comment.