Analysis nodes: mark a Classifications (or All Variants) node out of date when the data behind its snapshot changes, checked cheaply when the analysis is viewed
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 25/100
Research direction
Start with ClassificationQuerySet.variant_q() in classification/models/classification.py and trace NodeVersion, nodes_status, and PopulationNode._get_live_data_sources() to understand existing snapshot and status checks. The proposal spans node loading, polling, background rechecks, cache behavior, and reported analyses; define the cross-node design and measure recheck cost on a production-sized classification table. Done means changed result sets are labeled without reloading nodes, while unchanged sets only update their stamps.
Written by the indexing model from the issue text.
Description
🤖 Written by Claude
Raised from the #1789 review. Not scheduled.
Problem
A Classifications node's result is a snapshot. ClassificationQuerySet.variant_q() (classification/models/classification.py:235) turns the variant IDs into a list when the node loads. That list is kept in the node's stored pks (NodeVersion.variant_ids) or in its cached Q, so the grid and the count agree. When classifications change afterwards (new, reclassified, withdrawn), nothing on the canvas says the node is out of date:
ClassificationsNode.get_warnings()("N new or changed classifications since last save - press save to include them") only shows in the node editor. The card badge (#347) shows warnings stored inNodeVersion.load_datawhen the node loaded. A node loads straight after it's saved, when hardly anything is newer thannode.modified, so that stored copy is almost always empty.- The warning counts every
Classificationmodified since the save, whether or not this user can see it, and whatever its build or lab. On a busy server it is nearly always on. AllVariantsNode("N new variants in the database since last save") has the same problem.
⚡ (markLiveDataCount(), set from _get_live_data_sources()) is a different state: the count is worked out against live data and may differ from the grid. It doesn't fit a snapshot that has gone out of date.
Proposal
Add an out-of-date state alongside ⚡. Detect it cheaply when an analysis is viewed. Never reload anything automatically.
- Record a version at load. When a node that reads changing data loads, store a version for each source on its
NodeVersion, for example a number from the latestClassification.modified. This works like the stampPopulationNode._get_live_data_sources()stores. - Cheap test when polled.
nodes_statuscompares stored stamps with the current ones, with one query per source per poll rather than one per node. If nothing has moved, nothing more happens. - Re-check in the background when a stamp moves. Re-run only the node's own part (
_classifications_q()as the analysis owner), not its parents or children, and compare the variant set with the stored one.- Same set: update the stamp only. Leave the node version alone, so the cached results of the nodes below are kept.
update_analysis_tag_node_counts()already recounts tag counts without bumping the version in the same way. - Different set: mark the node as out of date with the change, e.g. "+2 / −1 since save". Nodes below it show "upstream out of date". Nothing reloads until the user saves.
- Same set: update the stamp only. Leave the node version alone, so the cached results of the nodes below are kept.
- Variants dropping out get the stronger warning. A variant leaving the result (withdrawn, or reclassified to a significance the node excludes) matters more than one coming in.
- Replace the editor-only warnings in
ClassificationsNodeandAllVariantsNodewith this. Comparing result sets also fixes the scope problem, because only changes that alter this node's output count.
Make it a general node hook (a stamp per source, plus a cheap recheck) rather than something only the Classifications node has.
Things to keep in mind
- Reported analyses: never change anything on an analysis that may have been reported from. Only label it.
- Redis cache evictions: if a large node's cached Q is evicted, it is rebuilt from live data, and the grid can then disagree with the stored count without anything showing. Running the version check when the Q is rebuilt would catch this too.
- Cost: the background recheck runs the classification part of the node as the analysis owner. It should be timed against a production-sized classification table before adding it to every view of an analysis.
- Dominant language
- Python
- Stars
- 31
- Forks
- 4
- Avg merge
- 4h 52m
- Merged PRs (30d)
- 183
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from SACGF/variantgrid
-
Difficulty 2/5 1-3 hours Newbie friendliness 69/100
SACGF/variantgrid#2964 · 1 comment ·
Maintainers usually reply within 1 day
-
Genome build now duplicated in "imported as" on allele pagePossibly taken @TheMadBug claimed this 3 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 67/100
SACGF/variantgrid#2950 · 1 comment · 1 assignee ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 64/100
SACGF/variantgrid#2865 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
SACGF/variantgrid#2647 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 79/100
SACGF/variantgrid#2341 · 3 comments ·
Maintainers usually reply within 1 day
All issues in SACGF/variantgrid
Similar issues
-
Test: to_hijri() accepts datetime.datetime and uses only the date partPossibly taken A pull request linked to this issue is open or already merged. Opengood first issue
Difficulty 1/5 Under an hour Newbie friendliness 95/100
omarelshamy25x/shamy-hijri#63 · 3 comments ·
Maintainers usually reply within 1 day
-
polish
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
521xueweihan/HelloGitHub#4729 ·
-
[Bug]: Score parser reads parts of scientific notation as valid scoresPossibly taken @AshutoshSingh840 claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
UKGovernmentBEIS/control-arena#992 ·
Maintainers usually reply within 3 days
-
Difficulty 1/5 Under an hour Newbie friendliness 92/100
mvalentsev/awesome-free-ai-coding#70 ·
Maintainers usually reply within 1 day