Open
fix: sync user annotation file with database on Reset Annotations#80
Conversation
When 'Update Database' is used before 'Reset Annotations', the user annotation file could be out of sync with the database (rows removed from the DB still appearing in the file, or new DB rows missing from the file). In reset_user_annotations() (R/admin_utils.R): - Query the current database entries before performing the reset - Remove from the user file any rows whose coordinates|REF|ALT no longer exist in the database - Append to the reset file any new database rows that are not yet in the user file Vote-count decrement logic is unaffected: it operates on the already- filtered set of rows (only those that still exist in the DB). New tests in test-admin-reset-annotations.R cover all three scenarios: rows removed from DB, rows added to DB, and already-congruent state. Agent-Logs-Url: https://github.com/biomedicalGenomicsCNAG/ShinyImageVoteR/sessions/ff46e7d5-457a-4d42-95a6-7f5592fec459 Co-authored-by: IvoLeist <28399610+IvoLeist@users.noreply.github.com>
Agent-Logs-Url: https://github.com/biomedicalGenomicsCNAG/ShinyImageVoteR/sessions/ff46e7d5-457a-4d42-95a6-7f5592fec459 Co-authored-by: IvoLeist <28399610+IvoLeist@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix incongruency of annotations in user data files
fix: sync user annotation file with database on Reset Annotations
Apr 8, 2026
IvoLeist
requested changes
Apr 8, 2026
IvoLeist
left a comment
Contributor
There was a problem hiding this comment.
After appending the new rows the row order should be randomised again
Do not forget to update the images_randomisation_seed in _info.json
IvoLeist
marked this pull request as ready for review
April 8, 2026 12:40
…eset Annotations After all sync operations (remove stale rows, append new DB rows), shuffle the full reset_df with a fresh digest-based seed so the user gets a new voting sequence that includes new rows at random positions. The new seed is written to images_randomisation_seed in the user's _info.json alongside the existing vote_input_methods reset. Updated test: images_randomisation_seed is now verified to change (not remain 12345) on every reset. Agent-Logs-Url: https://github.com/biomedicalGenomicsCNAG/ShinyImageVoteR/sessions/453b93ef-2b26-4a3b-97b1-a21790234708 Co-authored-by: IvoLeist <28399610+IvoLeist@users.noreply.github.com>
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.
After "Update Database" replaces variants in the database, "Reset Annotations" would leave the user's annotation file incongruent — stale rows (removed from DB) persisted in the file, and new DB rows were never added.
Changes
R/admin_utils.R—reset_user_annotations()Before clearing annotation columns, sync the user file's rows against the current database state:
coordinates|REF|ALTcomposite key no longer exists in the DB is dropped from the user filedigest-based seed (same algorithm as the initial login flow), so the user gets a new voting sequence that places new rows at random positionsimages_randomisation_seed: the new seed is written toimages_randomisation_seedin the user's_info.jsonalongside the existingvote_input_methodsresettests/testthat/test-admin-reset-annotations.RThree new test cases:
Updated existing test:
images_randomisation_seedis now verified to be updated to a new numeric value on every reset (not preserved).