Skip to content

[MDS-6493] Auto index Major Mine conditions#3577

Merged
sggerard merged 5 commits intodevelopfrom
mds-6493-auto-index-permit-conditions
Jun 25, 2025
Merged

[MDS-6493] Auto index Major Mine conditions#3577
sggerard merged 5 commits intodevelopfrom
mds-6493-auto-index-permit-conditions

Conversation

@sggerard
Copy link
Contributor

Objective

MDS-6493

  • Auto indexes permit conditions for a Major mine permit amendment on initial extraction as well as whenever all conditions are verified.
  • The file name uploaded to Azure is now friendly and human readable instead of the random name of the tempfile.
  • Added verification_status filter to show whether a condition has been verified by a human or not. When a condition is not verified a little warning symbol shows:
image

@sggerard sggerard changed the title Auto index conditions, add verification_status [MDS-6493] Auto index Major Mine conditions Jun 19, 2025
matbusby-fw
matbusby-fw previously approved these changes Jun 20, 2025
Copy link
Collaborator

@matbusby-fw matbusby-fw left a comment

Choose a reason for hiding this comment

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

Nice! Looks great!

@sggerard sggerard added the 👍 Ready for review Pull request has been double checked by the author and is ready for comments and feedback. label Jun 24, 2025
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR enables automatic indexing of Major Mine permit conditions (initial extraction and post-verification), uses human-readable filenames in Azure Blob Storage, and exposes a verification_status field throughout the export, search index, and UI (with a warning icon for unverified conditions).

  • Pass the original file.filename through the indexing pipeline and Azure upload component for friendly blob names.
  • Add verification_status to export CSV, Azure Search fields, retrieval pipeline, and the frontend interface/UI.
  • Introduce and trigger the export_and_index_single_permit_amendment Celery task after extraction and upon condition verification.

Reviewed Changes

Copilot reviewed 15 out of 15 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
services/permits/app/pipelines/permit_condition_search/resources/permit_condition_search_resource.py Pass file_name to indexing pipeline run
services/permits/app/pipelines/permit_condition_search/permit_condition_search_pipeline.py Add verification_status to pipeline schema and retrieval
services/permits/app/pipelines/permit_condition_search/create_search_index.py Define Azure Search field for verification_status
services/permits/app/pipelines/permit_condition_search/components/azure_blob_upload.py Use provided file_name when constructing blob path
services/core-web/src/components/mine/Permit/Search/tests/snapshots/ResultItem.spec.tsx.snap Update snapshot HTML to include new wrapper
services/core-web/src/components/mine/Permit/Search/components/ResultItem.tsx Render warning icon for unverified conditions
services/core-web/src/components/mine/Permit/Search/snapshots/PermitConditionSearch.integration.spec.tsx.snap Update integration snapshot for UI layout change
services/core-api/tests/permits/permit_extraction/test_tasks.py Add fixture to mock export_and_index_single_permit_amendment
services/core-api/tests/permits/permit_conditions/test_condition_tasks.py Add tests for export_and_index_single_permit_amendment
services/core-api/app/cli_commands/export_permit_conditions.py Include verification_status in CSV headers and rows
services/core-api/app/api/search/search/permit_search_service.py Implement index method to post CSV to search service
services/core-api/app/api/mines/permits/permit_extraction/tasks.py Import and trigger indexing task after extraction success
services/core-api/app/api/mines/permits/permit_conditions/tasks.py Add export_and_index_single_permit_amendment Celery task
services/core-api/app/api/mines/permits/permit_conditions/resources/permit_conditions_resource.py Trigger indexing task on condition verification
services/common/src/interfaces/search/facet-search.interface.ts Update HaystackDocumentMeta to include verification_status and change tenure to string
Comments suppressed due to low confidence (1)

services/core-api/tests/permits/permit_extraction/test_tasks.py:43

  • This test patches export_and_index_single_permit_amendment but does not assert that it was called. Add an assertion, e.g., export_and_index_single_permit_amendment_mock.delay.assert_called_once_with(task.guid) to cover the new behavior.
def test_poll_update_permit_extraction_status_success(permit_search_service_mock, celery_app, test_client, create_permit_conditions_mock, db_session, export_and_index_single_permit_amendment_mock):

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@sonarqubecloud
Copy link

@sonarqubecloud
Copy link

Quality Gate Passed Quality Gate passed for 'bcgov-sonarcloud_mds_minespace-web'

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
0.0% Coverage on New Code
0.0% Duplication on New Code

See analysis details on SonarQube Cloud

@sonarqubecloud
Copy link

Quality Gate Failed Quality Gate failed for 'bcgov-sonarcloud_mds_common'

Failed conditions
5.0% Coverage on New Code (required ≥ 80%)

See analysis details on SonarQube Cloud

@sonarqubecloud
Copy link

@sonarqubecloud
Copy link

Quality Gate Failed Quality Gate failed for 'bcgov-sonarcloud_mds_core-api'

Failed conditions
76.3% Coverage on New Code (required ≥ 80%)

See analysis details on SonarQube Cloud

@sggerard sggerard merged commit d1fda1b into develop Jun 25, 2025
21 of 25 checks passed
@sggerard sggerard deleted the mds-6493-auto-index-permit-conditions branch June 25, 2025 17:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

👍 Ready for review Pull request has been double checked by the author and is ready for comments and feedback.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants