Closed lbeaufort closed 5 years ago
It should include Sanders' old presidential committee since it is still active (both authorized committees should be included). Because of this, the candidate profile page most likely has the correct numbers: /candidate/[candidate_id]/totals
. The /elections/
and /candidate/totals
endpoints will need to be refactored to include all authorized committees. We should be consistent with how we are calculating totals with all 3 endpoints. Refer to @PaulClark2 @lbeaufort for additional information.
The number for Sanders in election_year 2020 is actually correct in Candidate datatables and election profile page. Both committees (C00577130 and C00696948) are included in his 2020 calculation. The "missing" $117245 in receipts and $828686.1 in disbursement is for election_year 2016 and hence should not be included in the 2020 calculation.
The number in Candidate Profile page is incorrect and need to be refactored.
The calculation does include BOTH committees (C00577130 and C00696948) for his 2020 election in Candidate datatables and election profile page. So P and A is not the source of the problem.
However, in cand_cmte_linkage and cand_valid_fec_yr tables (which is the source of the cand_election_yr, directly or indirectly) in a lot of places, his 2018 activity has the cand_election_yr set to 2016 for the 2018 cycle. So his 2018 financial activity will be calculated as part of 2016 election_cycle. According to Paul and Jeff, we would include candidates' financial activity reported after the previous election into their next election cycle, if he/she run for the next election. So this is a more fundamental issue. Need to figure out a way to find the correct election_cycle for a final cycle data to be included.
After talking to @PaulClark2 and @jwchumley, this is what the updated code need to do: This is what we currently has on our datatable_url for Clinton: This is what we want it to be:
Her 2008 4-year totals should include 2005, 2006, 2007 and 2008 financial data. Her 2016 4-year totals should include 2013, 2014, 2015 and 2016 financial data. Financial data for other two-year periods should not be included with her candidate profile totals. If the user is on the committee profile page they should be able to select any two-year period that the committee disclosed financial activity.
*****Checking: P60007168, SANDERS, BERNARD ****
datatable_url https://api.open.fec.gov/v1/candidates/totals/?candidate_id=P60007168&election_year=2020&election_full=true&api_key=DEMO_KEY&sort=-receipts
candidate_profile_url https://api.open.fec.gov/v1/candidate/P60007168/totals/?cycle=2020&api_key=DEMO_KEY&full_election=True
election_profile_url https://api.open.fec.gov/v1/elections/?candidate_id=P60007168&cycle=2020&election_full=true&api_key=DEMO_KEY&office=president&sort_nulls_last=true&sort=-total_receipts&per_page=100
!!! ERROR - receipts don't match!!! Candidate datatable: $20,700,446.12 Candidate profile page: $20,817,691.10 Election profile page: $20,700,446.12
!!! ERROR - disbursements don't match!!! Candidate datatable: $7,593,817.33 Candidate profile page: $8,422,503.45 Election profile page: $7,593,817.33\
It looks like the candidate's 2016 committee's 2017 activity is being included in the candidate totals.