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 bill_text template #399

Merged
merged 6 commits into from
Jan 16, 2024
Merged

fix bill_text template #399

merged 6 commits into from
Jan 16, 2024

Conversation

fgregg
Copy link
Member

@fgregg fgregg commented Jan 13, 2024

This had some out of date references which was causing the full text search to miss bills like in #388.

closes #388

I also added a management command to preview the content that will be search to the search enginge.

python manage.py preview_search_text R2023-0004166

Before the changes this is what would have been sent:

{   'abstract': '',
    'actions': [   'R2023-0004166 action on 2023-09-14',
                   'R2023-0004166 action on 2023-09-14',
                   'R2023-0004166 action on 2023-11-01',
                   'R2023-0004166 action on 2023-11-01',
                   'R2023-0004166 action on 2023-11-07'],
    'bill_type': 'resolution',
    'bill_type_exact': None,
    'boost': 1.095890410958904,
    'controlling_body': ['Chicago City Council'],
    'controlling_body_exact': None,
    'description': 'Submission of public question by referendum to Chicago '
                   'voters for increase in Chicago real estate transfer tax '
                   'rates',
    'django_ct': 'chicago.chicagobill',
    'django_id': 'ocd-bill/722e9d40-9499-4a49-bb5d-8dd123866555',
    'friendly_name': 'Resolution R2023-0004166',
    'full_text': 'None',
    'id': 'ocd-bill/722e9d40-9499-4a49-bb5d-8dd123866555',
    'identifier': 'R2023-0004166',
    'inferred_status': 'Approved',
    'inferred_status_exact': None,
    'last_action_date': datetime.date(2023, 11, 7),
    'legislative_session': '2023',
    'legislative_session_exact': None,
    'ocr_full_text': 'None',
    'slug': 'r2023-0004166',
    'sort_name': 'ResolutionR2023-0004166',
    'sort_name_exact': None,
    'source_note': "['elms_api', 'web']",
    'source_url': "['https://api.chicityclerkelms.chicago.gov/matter/4C434D15-6452-EE11-BE6E-001DD8097692', "
                  "'https://chicityclerkelms.chicago.gov/Matter/?matterId=4C434D15-6452-EE11-BE6E-001DD8097692']",
    'sponsorships': ['Johnson, Brandon'],
    'sponsorships_exact': None,
    'text': '\n'
            'R2023-0004166\n'
            'Resolution R2023-0004166\n'
            '['resolution']\n'
            '\n'
            '\n'
            '\n'
            '  \n'
            '    Johnson, Brandon\n'
            '  \n'
            '\n'
            '\n'
            '    Chicago City Council\n'
            '    Introduced\n'
            '\n'
            '    Chicago City Council\n'
            '    Referred\n'
            '\n'
            '    Committee on Committees and Rules\n'
            '    Recommended to Pass\n'
            '\n'
            '    Chicago City Council\n'
            '    Deferred and Published\n'
            '\n'
            '    Chicago City Council\n'
            '    Passed\n'
            '\n'
            '\n'
            '\tNon-Routine\n'
            '\n'
            '\tCity Matters\n'
            '\n'
            '\tElections\n'
            '\n'
            'None\n',
    'topics': ['Non-Routine', 'City Matters', 'Elections'],
    'topics_exact': None}

and with the fixes, this what will be sent now:

{   'actions': [   'R2023-0004166 action on 2023-09-14',
                   'R2023-0004166 action on 2023-09-14',
                   'R2023-0004166 action on 2023-11-01',
                   'R2023-0004166 action on 2023-11-01',
                   'R2023-0004166 action on 2023-11-07'],
    'bill_type': 'resolution',
    'bill_type_exact': None,
    'boost': 1.095890410958904,
    'controlling_body': ['Chicago City Council'],
    'controlling_body_exact': None,
    'django_ct': 'chicago.chicagobill',
    'django_id': 'ocd-bill/722e9d40-9499-4a49-bb5d-8dd123866555',
    'friendly_name': 'Resolution R2023-0004166',
    'full_text': 'None',
    'id': 'ocd-bill/722e9d40-9499-4a49-bb5d-8dd123866555',
    'identifier': 'R2023-0004166',
    'inferred_status': 'Approved',
    'inferred_status_exact': None,
    'last_action_date': datetime.date(2023, 11, 7),
    'legislative_session': '2023',
    'legislative_session_exact': None,
    'ocr_full_text': 'None',
    'slug': 'r2023-0004166',
    'sort_name': 'ResolutionR2023-0004166',
    'sort_name_exact': None,
    'source_note': "['elms_api', 'web']",
    'source_url': "['https://api.chicityclerkelms.chicago.gov/matter/4C434D15-6452-EE11-BE6E-001DD8097692', "
                  "'https://chicityclerkelms.chicago.gov/Matter/?matterId=4C434D15-6452-EE11-BE6E-001DD8097692']",
    'sponsorships': ['Johnson, Brandon'],
    'sponsorships_exact': None,
    'text': '\n'
            'Resolution R2023-0004166\n'
            '\n'
            '    R2023-0004166\n'
            '\n'
            '\n'
            'resolution\n'
            '\n'
            'Submission of public question by referendum to Chicago voters for '
            'increase in Chicago real estate transfer tax rates\n'
            '\n'
            '  \n'
            '    Johnson, Brandon\n'
            '  \n'
            '\n'
            '\n'
            '    Chicago City Council\n'
            '    Introduced\n'
            '\n'
            '    Chicago City Council\n'
            '    Referred\n'
            '\n'
            '    Committee on Committees and Rules\n'
            '    Recommended to Pass\n'
            '\n'
            '    Chicago City Council\n'
            '    Deferred and Published\n'
            '\n'
            '    Chicago City Council\n'
            '    Passed\n'
            '\n'
            '\n'
            '\tNon-Routine\n'
            '\n'
            '\tCity Matters\n'
            '\n'
            '\tElections\n'
            '\n'
            'None\n',
    'title': 'Submission of public question by referendum to Chicago voters '
             'for increase in Chicago real estate transfer tax rates',
    'topics': ['Non-Routine', 'City Matters', 'Elections'],
    'topics_exact': None}

This had some out of date references which was causing the full text search
to miss bills like in #388.

closes #388
@fgregg fgregg temporarily deployed to chi-councilm-fix-bill-t-f74qk4 January 13, 2024 01:45 Inactive
@@ -96,15 +96,6 @@ def clean_html(text):
return re.sub(r"&(?:\w+|#\d+);", "", value)


@register.filter
Copy link
Member Author

Choose a reason for hiding this comment

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

this filter was only used in bill_text.txt and we aren't using it anymore.

@@ -60,9 +57,6 @@ def prepare(self, obj):

return data

def prepare_topics(self, obj):
Copy link
Member Author

Choose a reason for hiding this comment

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

can get it more directly with model_attr

source_url = indexes.CharField(model_attr="sources__url", indexed=False)
source_note = indexes.CharField(model_attr="sources__note")
abstract = indexes.CharField(
Copy link
Member Author

Choose a reason for hiding this comment

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

this is always empty for chicago.

@fgregg fgregg temporarily deployed to chi-councilm-fix-bill-t-f74qk4 January 13, 2024 01:47 Inactive
@fgregg fgregg requested a review from derekeder January 13, 2024 01:48
@fgregg fgregg temporarily deployed to chi-councilm-fix-bill-t-f74qk4 January 13, 2024 01:48 Inactive
@fgregg fgregg temporarily deployed to chi-councilm-fix-bill-t-f74qk4 January 13, 2024 02:39 Inactive
@fgregg fgregg temporarily deployed to chi-councilm-fix-bill-t-f74qk4 January 13, 2024 02:47 Inactive
Copy link
Member

@derekeder derekeder left a comment

Choose a reason for hiding this comment

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

nice catch!

@fgregg fgregg merged commit 68752ef into main Jan 16, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

"transfer tax" search does not return this bill
2 participants