Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make endpoints for aggregates (by_state, by_size) #4177

Closed
4 tasks
lbeaufort opened this issue Feb 3, 2020 · 0 comments · Fixed by #4190
Closed
4 tasks

Make endpoints for aggregates (by_state, by_size) #4177

lbeaufort opened this issue Feb 3, 2020 · 0 comments · Fixed by #4190
Assignees
Milestone

Comments

@lbeaufort
Copy link
Member

lbeaufort commented Feb 3, 2020

Summary

Design ticket: #4175
Copy of Endpoints for presidential bubble map-Presidential bubble map

3) /presidential/contributions/by_size/

(national map right side contribution size)
(DISCLOSURE.PRES_CA_CM_SCHED_LINK_SUM_20D / _16)
Filter: candidate_id, election_year

TODO: Consider using "size" filter like /schedules/schedule_a/by_size/ instead (in addition to? ) contribution_range_id

The total all contributions in the following ranges:

-0 $200 and under
-200 $200.01 - $499.99
-500 $500 - $999.99
-1000 $1000 - $1999.99
-2000 $2000 +

SELECT contb_range_id AS contribution_range_id, 
-- TODO: Add size? more readable for devs
ROUND(contb_receipt_amt) AS contribution_receipt_amount 
FROM DISCLOSURE.PRES_CA_CM_SCHED_LINK_SUM_20D
order by contb_range_id

===========================================================

4) /presidential/contributions/by_state/

(national map circle per candidate):
(view on DISCLOSURE.PRES_CA_CM_SCHED_A_JOIN_20D / _16
Filter: candidate_id, election_year

SELECT 
cand_id AS candidate_id, 
contbr_st as contributor_state,
contb_receipt_amt as contribution_receipt_amount,
election_yr as election_year
FROM
DISCLOSURE.PRES_CA_CM_SCHED_A_JOIN_20D
WHERE CONTBR_ST IN ('CA', 'NY', 'TX', 'FL', 'IL', 'VA', 'MA', 'DC', 'NJ', 'MD', 'PA', 'WA', 'CT', 'GA', 'CO', 'OH', 'AZ', 'NC', 'MI', 'TN', 'NM', 'MO', 'MN', 'OR', 'UT', 'WI', 'NV', 'SC', 'IN', 'OK', 'LA', 'AL', 'KY', 'AR', 'NH', 'IA', 'KS', 'HI', 'ME', 'MS', 'RI', 'DE', 'VT', 'ID', 'NE', 'MT', 'WV',  'AK', 'WY', 'SD', 'ND') 
AND ZIP_3 ='NA'
ORDER BY cand_id desc nulls first limit 100

Completion criteria

  • Make views in database with migration (pair w/DB team)
  • Make endpoints based on design
  • Use a feature flag
  • Add test coverage for new endpoints
@lbeaufort lbeaufort added this to the Sprint 11.4 milestone Feb 3, 2020
@lbeaufort lbeaufort changed the title [presidential map] Make endpoint for aggregates (by_state, by_size) Make endpoints for aggregates (by_state, by_size) Feb 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants