SCKAN-450 fix: Set population index on invalid statements#531
Merged
afonsobspinto merged 7 commits intorelease/6.0.0from Nov 6, 2025
Merged
SCKAN-450 fix: Set population index on invalid statements#531afonsobspinto merged 7 commits intorelease/6.0.0from
afonsobspinto merged 7 commits intorelease/6.0.0from
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR addresses an issue where statements that were originally ingested into an invalid state never received a population_index. The fix ensures that all exported/invalid statements have consistent population indices based on their curie_id values.
Key Changes:
- Updates the
invalidstate transition to properly set thepopulation_indexby calling_perform_export_logic()instead of just setting thehas_statement_been_exportedflag - Adds a Django management command to synchronize existing population indices with expected values based on
curie_idpatterns - Includes comprehensive documentation for the new management command
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
applications/composer/backend/composer/models.py |
Updates the invalid transition method to use _perform_export_logic() to ensure population_index is set |
applications/composer/backend/composer/management/commands/reassign_population_indices.py |
Adds a new Django management command that synchronizes population indices for exported statements based on their curie_id patterns |
applications/composer/backend/composer/management/commands/README_reassign_population_indices.md |
Provides detailed documentation for the new management command including usage examples and expected behavior |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
applications/composer/backend/composer/management/commands/reassign_population_indices.py
Show resolved
Hide resolved
applications/composer/backend/composer/management/commands/reassign_population_indices.py
Outdated
Show resolved
Hide resolved
applications/composer/backend/composer/management/commands/reassign_population_indices.py
Outdated
Show resolved
Hide resolved
applications/composer/backend/composer/management/commands/reassign_population_indices.py
Outdated
Show resolved
Hide resolved
Member
Author
|
Note:
|
ddelpiano
approved these changes
Nov 6, 2025
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.
Closes https://metacell.atlassian.net/browse/SCKAN-450
I believe the problem was caused by the fact that statements that were originally ingested into invalid state never got a population_index.
To fix it, this PR:
When deployed run:
python manage.py reassign_population_indices --dry-runAnd if you are happy with the changes that would happen run without the --dry-run flag.
Example of log file when running the command locally:
population_index_reassignment_2025-11-05_12-23-17.log