Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for PR 5754 #5913

Closed
wants to merge 4 commits into from
Closed

Fix for PR 5754 #5913

wants to merge 4 commits into from

Conversation

goplayoutside3
Copy link
Contributor

@goplayoutside3 goplayoutside3 commented Feb 14, 2024

See context for these changes in PR #5754's discussion, and particularly my comment here.

@kieftrav
Copy link
Contributor

@goplayoutside3 - just tested out your PR and the bug I outlined is still there. Please see the attached video about how previous marks on different frames don't get pulled in the way I assume they should.

PrevMarks.Bug.mp4

@goplayoutside3
Copy link
Contributor Author

goplayoutside3 commented Feb 15, 2024

Ah okay I see what's happening. The video is related to your question about previousInteractionTaskAnnotations() here. In the subject viewer, there are two different ways marks are grabbed from the store:

  1. InteractionLayerContainer

InteractionLayerContainer gets its marks from classifierStore.workflowSteps.active.tasks. "active" is a Step type in this case, and tasks is an array of type DrawingTask. get marks() is a "view" on the DrawingTask model that loops over self.tools and returns all tool.marks. For example, this is relevant for a drawing task that requires a volunteer to draw one circle and one point. tool.marks gets updated when createMark() from the Tool type is called in a UI component. Therefore, when a volunteer clicks on the InteractionLayer, that interaction calls activeTool.createMark() with all the necessary data to add a new mark to tool.marks in the store.

Because InteractionLayerContainer is observing the store, it re-renders whenever tool.marks updates. Also, its child component InteractionLayer handles filtering per frame and renders the marks in DrawingToolMarks.

  1. PreviousMarks

PreviousMarks gets its marks by calling previousInteractionTaskAnnotations() which grabs annotations from classifierStore.classification.annotations. That function also filters for annotations that do not match the active tasks's key (e.g T1). PreviousMarks observes the store too, so it should re-render whenever previousAnnotations updates, and handle filtering of those annotation marks by frame. There's a DrawingToolMarks component rendered in PreviousMarks for every annotation intentionally passing disabled as true.

You can inspect annotations by calling self.toSnapshot() inside previousInteractionTaskAnnotations(). While debugging, I found that annotations in PreviousMarks did contain expected data when going back and forth between workflow steps. So that narrows down the bug to PreviousMarks. I think that this line:


does not actually have access to frame on each Mark without more explicit handling of store snapshots. See the use of resolveIdentifier in DrawingAnnotation:
const actualTask = resolveIdentifier(DrawingTask, getRoot(self), self.task)

and my logging of the annotation snapshot in my latest commit.

To summarize, the reason InteractionLayerContainer and PreviousMarks grab annotation marks from the store in two different ways is because PreviousMarks is limited to only rendering marks created or edited by a volunteer and also needs to grab annotations from other steps. InteractionLayerContainer only cares about the active step.

I can't spend more time on this today, but will update if I think of a way to address this problem later this week.

Comment on lines +51 to +52
const annotationMarks = annotation.toSnapshot()[0].value
console.log(annotationMarks)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This shows correctly stored marks while jumping between workflow steps. The issue is that PreviousMarks isn't actually filtering per frame yet.

Copy link
Contributor

@eatyourgreens eatyourgreens Feb 16, 2024

Choose a reason for hiding this comment

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

Here, you should use getSnapshot(annotation) to debug the annotation. That's how I figured out that the annotation value didn't include all of the drawn marks.

annotation.toSnapshot() dereferences a drawing task's marks so that they can be saved to Panoptes. It doesn't give the same value as annotation.value (but #5923 should fix that by making sure that annotation.value always reflects the current value of task.marks.)

@goplayoutside3
Copy link
Contributor Author

@kieftrav noting here that the bug in your video exists on production too. It can be replicated in the How Did We Get Here project that has multi-frame transcription subjects and two steps in the workflow.

@goplayoutside3
Copy link
Contributor Author

I've asked Jim for input here, too.

eatyourgreens added a commit to eatyourgreens/front-end-monorepo that referenced this pull request Feb 15, 2024
After creating a new mark, add the new mark to the previous annotation value and store this as a new annotation. Should fix a bug raised in this comment: zooniverse#5913 (comment)
@kieftrav
Copy link
Contributor

@goplayoutside3 - I've incorporated Jim's one-liner into my PR. I don't think all of the other changes here make sense - they're focused on changing the frame on the container element instead of focusing on the mark itself having frame=0. Because modifying the frame is a data export issue decided in Issue #5493 and is confined to the mark itself, I think it's important to keep the comment about the GitHub issue next to the area that sets its value to 0 instead of creating a chain of assumptions about why we changed the frame itself to 0 for the whole InteractionLayer when all that matters is that the classification export registers the mark's frame as 0 upon creation. I think this is particularly poignant because allowing the frame number to be set to its real frame when multiImageCloneMarkers is true doesn't change behavior at all - it still works as expected cloning all marks across all frames.

Because we resolved the issue with losing track of marks in the PreviousMarks component (i.e. Jim's fix) the current PR works as expected as far as I can tell.

eatyourgreens added a commit to eatyourgreens/front-end-monorepo that referenced this pull request Feb 15, 2024
After creating a new mark, add the new mark to the previous annotation value and store this as a new annotation. Should fix a bug raised in this comment: zooniverse#5913 (comment)
eatyourgreens added a commit to eatyourgreens/front-end-monorepo that referenced this pull request Feb 16, 2024
After creating a new mark, add the new mark to the previous annotation value and store this as a new annotation. Should fix a bug raised in this comment: zooniverse#5913 (comment)
@kieftrav kieftrav force-pushed the flipbook-muliFrame-drawing-tools branch from 9f77c51 to c93f21f Compare February 20, 2024 18:07
Base automatically changed from flipbook-muliFrame-drawing-tools to master February 20, 2024 18:11
@kieftrav kieftrav closed this Feb 20, 2024
@goplayoutside3 goplayoutside3 deleted the multiframe-drawing-fixes branch April 25, 2024 16:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants