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

Fix sched-a by-employer,by-occupation and schedule_b/by_recipient fulltext and n/a search issue #5809

Merged
merged 2 commits into from
May 1, 2024

Conversation

fec-jli
Copy link
Contributor

@fec-jli fec-jli commented Apr 24, 2024

Summary

This PR will fix fulltext search and N/A search issue in these three endpoints
ScheduleAByEmployerView
ScheduleAByOccupationView
ScheduleBByRecipientView

Required reviewers

1-2 devs

Impacted three endpoints

"/schedules/schedule_a/by_employer/"
"/schedules/schedule_a/by_occupation/"
"/schedules/schedule_b/by_recipient/"

How to test

  • Check out branch
  • pytest
  • test urls for three endpoints

—[1]ScheduleAByEmployerView
Test 1-1) when employer=amazon.com, return two rows:
employer=amazon.com
employer=amazon com
http://127.0.0.1:5000/v1/schedules/schedule_a/by_employer/?cycle=2020&employer=amazon.com&committee_id=C00003418

When employer=-amazon.com (exclude amazon.com), return 127487 rows
http://127.0.0.1:5000/v1/schedules/schedule_a/by_employer/?cycle=2020&employer=-amazon.com&committee_id=C00003418

Without employer parameter pass, return 2+ 127487= 127489 rows
http://127.0.0.1:5000/v1/schedules/schedule_a/by_employer/?cycle=2020&committee_id=C00003418

Compare with Prod: return 1 (only employer=amazon com, no return for employer=amazon.com)
https://api.open.fec.gov/v1/schedules/schedule_a/by_employer/?cycle=2020&committee_id=C00003418&api_key=DEMO_KEY&employer=amazon.com

Test 1-2)
when employer=N/A, return 1 rows
http://127.0.0.1:5000/v1/schedules/schedule_a/by_employer/?cycle=2020&employer=N/A&committee_id=C00003418

when employer=-N/A, return 127488 rows
http://127.0.0.1:5000/v1/schedules/schedule_a/by_employer/?cycle=2020&employer=-N/A&committee_id=C00003418

Without employer parameter pass, return 1+ 127488= 127489 rows
http://127.0.0.1:5000/v1/schedules/schedule_a/by_employer/?cycle=2020&committee_id=C00003418

Compare with Prod: return 962 rows (contain: n, a…)
https://api.open.fec.gov/v1/schedules/schedule_a/by_employer/?cycle=2020&committee_id=C00003418&api_key=DEMO_KEY&employer=N/A

—[2]ScheduleAByOccupationView
Test 2-1)
when occupation=C.E.O, return 46 rows
http://127.0.0.1:5000/v1/schedules/schedule_a/by_occupation/?cycle=2022&committee_id=C00003418&occupation=C.E.O

when occupation=-C.E.O, return 19665 rows
http://127.0.0.1:5000/v1/schedules/schedule_a/by_occupation/?cycle=2022&committee_id=C00003418&occupation=-C.E.O

Without occupation parameter pass, return 46+ 19665 =19711 rows
http://127.0.0.1:5000/v1/schedules/schedule_a/by_occupation/?cycle=2022&committee_id=C00003418

Compare with Prod: return 29 (occupation=c…e…o)
https://api.open.fec.gov/v1/schedules/schedule_a/by_occupation/?cycle=2022&committee_id=C00003418&occupation=C.E.O&api_key=DEMO_KEY

Test 2-2)
when occupation=N/A, return 1 rows
http://127.0.0.1:5000/v1/schedules/schedule_a/by_occupation/?cycle=2020&committee_id=C00003418&occupation=N/A

when occupation=-N/A, return 39455 rows
http://127.0.0.1:5000/v1/schedules/schedule_a/by_occupation/?cycle=2020&committee_id=C00003418&occupation=-N/A

Without occupation parameter pass, return 1+ 39455 = 39456 rows
http://127.0.0.1:5000/v1/schedules/schedule_a/by_occupation/?cycle=2020&committee_id=C00003418

Compare with Prod: return 193 rows (contain: n, a…)
https://api.open.fec.gov/v1/schedules/schedule_a/by_occupation/?cycle=2020&committee_id=C00003418&occupation=N/A&api_key=DEMO_KEY

—[3]ScheduleBByRecipientView
Test 3-1)
When recipient_name=zoom.com, return 1 row
http://127.0.0.1:5000/v1/schedules/schedule_b/by_recipient/?cycle=2022&committee_id=C00160937&recipient_name=zoom.com

When recipient_name=-zoom.com, return 126 rows
http://127.0.0.1:5000/v1/schedules/schedule_b/by_recipient/?cycle=2022&committee_id=C00160937&recipient_name=-zoom.com

Without recipient_name parameter pass, return 1+126=127 rows
http://127.0.0.1:5000/v1/schedules/schedule_b/by_recipient/?cycle=2022&committee_id=C00160937

Compare prod, return 0 (cannot find recipient_name=zoom.com)
https://api.open.fec.gov/v1/schedules/schedule_b/by_recipient/?cycle=2022&committee_id=C00160937&recipient_name=zoom.com&api_key=DEMO_KEY

Test 3-2)
when recipient_name=N/A, return 1 rows
http://127.0.0.1:5000/v1/schedules/schedule_b/by_recipient/?cycle=2018&committee_id=C00586768&recipient_name=N/A

when recipient_name=-N/A, return 17 rows
http://127.0.0.1:5000/v1/schedules/schedule_b/by_recipient/?cycle=2018&committee_id=C00586768&recipient_name=-N/A

Without recipient_name parameter pass, return 1+17=18 rows
http://127.0.0.1:5000/v1/schedules/schedule_b/by_recipient/?cycle=2018&committee_id=C00586768

Compare prod, return 0 (cannot find recipient_name=N/A)
https://api.open.fec.gov/v1/schedules/schedule_b/by_recipient/?cycle=2018&committee_id=C00586768&recipient_name=N/A&api_key=DEMO_KEY

Replace PR: #5773

@fec-jli fec-jli force-pushed the feature/fix_fulltext_N/A_issue branch from ce6eddd to f5cd046 Compare April 29, 2024 17:03
Copy link

codecov bot commented Apr 29, 2024

Codecov Report

Attention: Patch coverage is 78.37838% with 8 lines in your changes are missing coverage. Please review.

Project coverage is 85.77%. Comparing base (49e8553) to head (f5cd046).
Report is 4 commits behind head on develop.

Files Patch % Lines
webservices/filters.py 63.63% 8 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #5809      +/-   ##
===========================================
- Coverage    85.81%   85.77%   -0.05%     
===========================================
  Files           81       81              
  Lines         8594     8624      +30     
===========================================
+ Hits          7375     7397      +22     
- Misses        1219     1227       +8     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@pkfec pkfec left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@fec-jli Thanks for addressing the longstanding text search bug. Nice work.

Copy link
Member

@cnlucas cnlucas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@fec-jli great job on this ticket!
Could we either add testing for the new filter or create a follow-up ticket to add an automated test for the new filter?

Copy link
Contributor

@hcaofec hcaofec left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work!
A follow-up ticket to add an automated test for the new filter will be created by @fec-jli

@hcaofec hcaofec merged commit 3e9f5b8 into develop May 1, 2024
3 checks passed
@fec-jli fec-jli deleted the feature/fix_fulltext_N/A_issue branch July 22, 2024 15:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: ✅ Done
Development

Successfully merging this pull request may close these issues.

determine if dsc_sched_a_aggregate_employer aggregates as intended
4 participants