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

Add coalesce to committee_name in ts_vector column #5420

Merged

Conversation

hcaofec
Copy link
Contributor

@hcaofec hcaofec commented Apr 20, 2023

Summary (required)

When committee name is null, the concatenation that includes committee name will return null. Coalesce function is added to handle this scenario.

Required reviewers

1 developer

How to test

  1. Download feature branch
  2. Run pytest
  3. Run flyway migrate
  4. Test filings endpoint on local by switching model to tmp mv
    In common/models/filings.py, set

class Filings(FecFileNumberMixin, CsvMixin, db.Model):
tablename = 'ofec_filings_all_mv_tmp_hc'

Before change, no rows returned
https://api.open.fec.gov/v1/filings/?sort=-receipt_date&sort_hide_null=false&sort_nulls_last=false&per_page=20&page=1&sort_null_only=false&q_filer=C00780197&api_key=DEMO_KEY
After change, 9 rows returned
http://127.0.0.1:5000/v1/filings/?page=1&sort_nulls_last=false&q_filer=C00780197&sort=-receipt_date&sort_hide_null=false&per_page=20&sort_null_only=false

  1. Test reports endpoints on local by switching models to tmp mv
    In common/models/reports.py, set:

__tablename__ = 'ofec_reports_house_senate_mv_tmp_hc'

Before change, 107 rows returned
https://api.open.fec.gov/v1/reports/house-senate/?per_page=20&q_filer=C00281840&page=1&sort_hide_null=false&sort=cycle&sort_null_only=false&sort_nulls_last=false&api_key=DEMO_KEY
After change, 108 rows returned including 1992 YE
http://127.0.0.1:5000/v1/reports/house-senate/?page=1&sort_nulls_last=false&q_filer=C00281840&sort=cycle&sort_hide_null=false&per_page=20&sort_null_only=false

__tablename__ = 'ofec_reports_pac_party_mv_tmp_hc'

Before change, 31 rows returned
https://api.open.fec.gov/v1/reports/pac-party/?per_page=20&q_filer=C00288647&page=1&sort_hide_null=false&sort=cycle&sort_null_only=false&sort_nulls_last=false&api_key=DEMO_KEY
After change, 32 rows returned including 1992 YE
http://127.0.0.1:5000/v1/reports/pac-party/?page=1&sort_nulls_last=false&q_filer=C00288647&sort=cycle&sort_hide_null=false&per_page=20&sort_null_only=false

__tablename__ = 'ofec_reports_presidential_mv_tmp_hc'

Before change, 0 row returned
https://api.open.fec.gov/v1/reports/presidential/?per_page=20&q_filer=C00219170&page=1&sort_hide_null=false&sort=-coverage_end_date&sort_null_only=false&sort_nulls_last=false&api_key=DEMO_KEY
**After change, 1 row returned **
http://127.0.0.1:5000/v1/reports/presidential/?page=1&sort_nulls_last=false&q_filer=C00219170&sort=-coverage_end_date&sort_hide_null=false&per_page=20&sort_null_only=false

Before change, 4 row returned
https://www.fec.gov/data/reports/presidential/?is_amended=false&data_type=processed&q_filer=C00184572
After change, 5 row returned including TERMINATION REPORT 1985
http://127.0.0.1:5000/v1/reports/presidential/?page=1&sort_nulls_last=false&q_filer=C00184572&sort=-coverage_end_date&sort_hide_null=false&per_page=20&sort_null_only=false

@hcaofec hcaofec requested a review from fec-jli April 21, 2023 13:36
@hcaofec hcaofec changed the title [WIP] Add coalesce to committee_name in ts_vector column Add coalesce to committee_name in ts_vector column Apr 21, 2023
Copy link
Contributor

@fec-jli fec-jli left a comment

Choose a reason for hiding this comment

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

Looks good. Thanks

@fec-jli fec-jli merged commit e697283 into develop Apr 21, 2023
@hcaofec hcaofec deleted the feature/5416-add-coalesce-to-committeename-in-filings-reports branch April 15, 2024 15:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fix null committee_name in ts_vector column used by q_filer
2 participants