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 committee id to tsvector column in five materialized views #5231

Merged
merged 1 commit into from
Sep 1, 2022

Conversation

hcaofec
Copy link
Contributor

@hcaofec hcaofec commented Aug 30, 2022

Summary (required)

Add committee id to newly created tsvector column to make id a searchable item.

API:
/reports/presidential/
/reports/house-senate/
/reports/pac-party/

/schedules/schedule_e/
/filings/

Required reviewers

1-2 developers

How to test

  • Download feature branch
  • Run pytest to test all test cases
  • Run flyway migrate to test migration
  • Switch data models to mv_tmp to test api locally on text search.
    models/filings.py:
class Filings(FecFileNumberMixin, CsvMixin, db.Model):
    __tablename__ = 'ofec_filings_all_mv_tmp_hc'

models/reports.py

class CommitteeReportsHouseSenate(CommitteeReports):
    __tablename__ = 'ofec_reports_house_senate_mv_tmp_hc'

class CommitteeReportsPacParty(CommitteeReports):
    __tablename__ = 'ofec_reports_pac_party_mv_tmp_hc'

class CommitteeReportsPresidential(CommitteeReports):
    __tablename__ = 'ofec_reports_presidential_mv_tmp_hc'

models.py/itemized.py

class ScheduleE(PdfMixin, BaseItemized):
    __tablename__ = 'ofec_sched_e_mv_tmp_hc'
  • /filings/

http://127.0.0.1:5000/v1/filings/?per_page=20&sort_null_only=false&sort_hide_null=false&filer_name_text=C0008&sort_nulls_last=false&page=1&sort=-receipt_date

http://127.0.0.1:5000/v1/filings/?per_page=20&sort_null_only=false&sort_hide_null=false&filer_name_text=amer&sort_nulls_last=false&page=1&sort=-receipt_date

  • /schedules/schedule_e/

http://127.0.0.1:5000/v1/schedules/schedule_e/?sort_nulls_last=false&per_page=20&spender_name_text=san&sort=-expenditure_date&sort_null_only=false&sort_hide_null=false

http://127.0.0.1:5000/v1/schedules/schedule_e/?sort_nulls_last=false&per_page=20&spender_name_text=s&sort=-expenditure_date&sort_null_only=false&sort_hide_null=false

http://127.0.0.1:5000/v1/schedules/schedule_e/?sort_nulls_last=false&per_page=20&spender_name_text=C900&sort=-expenditure_date&sort_null_only=false&sort_hide_null=false

  • /reports/presidential/

http://127.0.0.1:5000/v1/reports/presidential/?filer_name_text=C006&sort=-coverage_end_date&sort_hide_null=false&page=1&sort_nulls_last=false&sort_null_only=false&per_page=20

http://127.0.0.1:5000/v1/reports/presidential/?filer_name_text=amer&sort=-coverage_end_date&sort_hide_null=false&page=1&sort_nulls_last=false&sort_null_only=false&per_page=20

http://127.0.0.1:5000/v1/reports/presidential/?filer_name_text=am&sort=-coverage_end_date&sort_hide_null=false&page=1&sort_nulls_last=false&sort_null_only=false&per_page=20

  • /reports/house-senate/

http://127.0.0.1:5000/v1/reports/house-senate/?filer_name_text=C006&sort=-coverage_end_date&sort_hide_null=false&page=1&sort_nulls_last=false&sort_null_only=false&per_page=20

http://127.0.0.1:5000/v1/reports/house-senate/?filer_name_text=Amer&sort=-coverage_end_date&sort_hide_null=false&page=1&sort_nulls_last=false&sort_null_only=false&per_page=20

http://127.0.0.1:5000/v1/reports/house-senate/?filer_name_text=Am&sort=-coverage_end_date&sort_hide_null=false&page=1&sort_nulls_last=false&sort_null_only=false&per_page=20

  • /reports/pac-party/

http://127.0.0.1:5000/v1/reports/pac-party/?filer_name_text=C006&sort=-coverage_end_date&sort_hide_null=false&page=1&sort_nulls_last=false&sort_null_only=false&per_page=20

http://127.0.0.1:5000/v1/reports/pac-party/?filer_name_text=C0&sort=-coverage_end_date&sort_hide_null=false&page=1&sort_nulls_last=false&sort_null_only=false&per_page=20

http://127.0.0.1:5000/v1/reports/pac-party/?filer_name_text=can&sort=-coverage_end_date&sort_hide_null=false&page=1&sort_nulls_last=false&sort_null_only=false&per_page=20

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.

Works for me as expected!

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.

Thanks @hcaofec for taking care of this change. Its a huge one and not an easy one!

@pkfec pkfec merged commit 78adc4c into develop Sep 1, 2022
@hcaofec hcaofec deleted the feature/add-id-to-text-search-database-change branch February 27, 2023 21:14
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.

Include committee ID in filer_text (ts_vector search)
3 participants