Repository navigation
OpenConceptLab/ocl_online#249 | Expansion re-evaluation to clear stale ES tags, and view permission - #932
Merged
Conversation
…e ES tags, and view permission
Contributor
Author
|
Review result: no blocking issues found. I reviewed the expansion re-evaluation changes, permission adjustment, and latest-released filtering. The forced re-evaluation path now rebuilds membership in place and reindexes resources that leave the expansion, and the permission behavior is covered by the new non-member test. Verification run:
Note: I attempted to submit this as an approving review, but GitHub does not allow approving your own PR. CI Pylint was still in progress when I checked the PR status. (snyaggarwal • GPT 5.5) |
Contributor
Author
|
CodeX review without any finding - #932 (comment) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Linked Issue
Closes OpenConceptLab/ocl_online#249
Summary
Part of #249. Re-evaluating an expansion now gives the from-scratch result, and ES tags for rows that leave the expansion are removed.
Changes
Re-evaluate is from scratch (
Expansion.add_references,core/collections/models.py)force_reevaluateandis_adding_all), the expansion's concepts, mappings and version links are cleared first. The expansion id is kept.ES mirrors the expansion
Expansion.full_index_resources. This rebuilds all six collection fields, not onlyexpansion_url.APPEND_COLLECTION_FIELDS_SCRIPTis unchanged.Retired versions (
core/common/models.py)get_latest_released_versionskips retired versions.is_latest_releasedreturns False instead of raising when no released version exists.Permission (
core/collections/views.py)permission_classes = (CanViewConceptDictionary,)line fromCollectionVersionExpansionReEvaluateView. It had no effect, because the base view'sget_permissionsalready requires staff, the owner or an org member for POST.Tests
full_index_resources.core.collections,core.commonandcore.sourcesin the API container: 642 tests passed.Performance
Re-evaluating the PEPFAR
MER_FY22andMER_FY24expansions took 52–58s, about the same as without the change. Evaluation dominates. ES writes were mocked, so the ES-side cost wasn't measured. On both, no stored row matches a re-evaluated row, so the old rows are fully re-indexed on top of the new ones. That roughly doubles ES writes for a re-evaluate, and it is what clears the stale tags.Not in this PR
seed_references, ocl_issues#2549).expansion_tag_fix.py.Not covered by tests
The second non-versioned reference locking to the first's version, and re-evaluate matching a fresh expansion exactly, are not tested.