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

Simple confirmation workflow #133

Merged
merged 5 commits into from
Nov 13, 2024
Merged

Simple confirmation workflow #133

merged 5 commits into from
Nov 13, 2024

Conversation

matt-bernhardt
Copy link
Member

@matt-bernhardt matt-bernhardt commented Oct 30, 2024

This implements most of the confirmation workflow, wherein users of the application review search terms and provide some ground truth feedback about how they should ideally be categorized by the automated processes.

This PR does not fully implement this workflow, because the UI does not include a working form (and the Term controller has no method to receive that input). However, it gets close enough that the next PR should be able to do so easily. This PR is already verging on too big, so I'd like to ask for review now.

The biggest thing to note here is that this adds a fourth category to the application, for "Undefined". The intent is not for the application to make use of this option during the Categorization workflow, but humans should be given this option in order for the confirmation form to make sense.

Developer

Ticket(s)

https://mitlibraries.atlassian.net/browse/TCO-8 (overall confirmation epic)
https://mitlibraries.atlassian.net/browse/TCO-99 (UI design ticket)
https://mitlibraries.atlassian.net/browse/TCO-100 (confirm UI requirements)

Accessibility

  • ANDI or Wave has been run in accordance to our guide and
    all issues introduced by these changes have been resolved or opened
    as new issues (link to those issues in the Pull Request details above)
  • There are no accessibility implications to this change

Please note while I've looked at Wave with this change, the UI is largely unconsidered. We should involve our UX colleagues in more thoughtfully considering this interface before putting it into production.

Documentation

  • Project documentation has been updated, and yard output previewed
  • No documentation changes are needed

ENV

  • All new ENV is documented in README.
  • All new ENV has been added to Heroku Pipeline, Staging and Prod.
  • ENV has not changed.

Stakeholders

  • Stakeholder approval has been confirmed
  • Stakeholder approval is not needed

Dependencies and migrations

YES dependencies are updated

YES migrations are included

Reviewer

Code

  • I have confirmed that the code works as intended.
  • Any CodeClimate issues have been fixed or confirmed as
    added technical debt.

Documentation

  • The commit message is clear and follows our guidelines
    (not just this pull request message).
  • The documentation has been updated or is unnecessary.
  • New dependencies are appropriate or there were no changes.

Testing

  • There are appropriate tests covering any new functionality.
  • No additional test coverage is required.

@mitlib mitlib temporarily deployed to tacos-api-pipeline-pr-133 October 30, 2024 18:25 Inactive
@mitlib mitlib temporarily deployed to tacos-api-pipeline-pr-133 October 31, 2024 21:25 Inactive
@matt-bernhardt matt-bernhardt changed the title Simple user categorization workflow Simple confirmation workflow Nov 1, 2024
** Why are these changes being introduced:

We are adding a Confirmation class for users to provide ground truth for
how different Terms should be categorized. The first step is to update
our documentation to work out how this is going to work.

** Relevant ticket(s):

* https://mitlibraries.atlassian.net/browse/tco-8

** How does this address that need:

This updates the class diagram and workflow documentation to include the
Confirmation class.

* User and Confirmation are now grouped in the class diagram, with a
common visual language.

* The categorization workflow document is updated to use the new
vocabulary "confirmation" rather than our earlier "validation".

** Document any side effects to this change:

As this commit only changes documentation, there are no side effects
yet.
** Why are these changes being introduced:

With the documentation updated, we need to actually change the models.

** Relevant ticket(s):

* https://mitlibraries.atlassian.net/browse/tco-8

** How does this address that need:

* Adds the Confirmation model, with relationships to User, Term, and
Category (optionally). The category relationship is optional because
there is also the option for a user to flag the term for removal. This
flag is stored on the Confirmation model so that we have a record of who
flagged it, in case we want to follow up with them. The implication is
that we will review these flags, not perform the removal immediately.

There is a uniqueness constraint on the Confirmation model, to limit
users from confirming the same term twice.

* Two scopes are added to the Term model which filter records that have
(and have not) been confirmed by a user.

* A fourth category is added to the database seeds - "Undefined". The
automated categorization does not interact with this category, but users
have the option to place a term there in their workflow. The UI which is
coming in the next commit then will provide five options for manual
confirmation: one for each category, and then a "flag" option.

* Tests and fixtures are added to support and confirm all of the above.

** Document any side effects to this change:

There are a few side effects here:

* While adding the 'flagged' field makes sense to me on the Confirmation
model, it may also need to be added to the Term model (or at least add
a scope to grab flagged records)

* The existing scopes on the Term model do not pay attention to which
user has confirmed the term - so at the moment getting multiple
confirmations from multiple users may not be possible without further
work.

* Because we are changing the database seeds, we will need to take care
when promoting this change ito production.
** Why are these changes being introduced:

* With the models updated, we now turn to the controller and view layer.

** Relevant ticket(s):

* https://mitlibraries.atlassian.net/browse/tco-8

** How does this address that need:

* Defines two new routes for the confirmation workflow - an index and
a form.

* We add the Pagy gem to the application, for use on the confirmation
index.

* Adds a Term controller, with two methods for an index and form view.
The controller has tests for its use of the ability model.

* The ability model adds the ability to manage confirmations for any
authenticated user.

* View templates are added for these two displays, and a link to the
index is added to the navigation. The form is a stub, with no actual
controls (and no controller method to process their submission).

** Document any side effects to this change:

* I'm not sure whether the controller needs more tests.

* Our theme gem appears to anticipate the use of Kaminari, not Pagy -
not sure what the lift will be to polish the pagination into something
more presentable.

* As noted above, the form is faked - there is no actual input fields,
nor a controller method to receive them.
@mitlib mitlib temporarily deployed to tacos-api-pipeline-pr-133 November 1, 2024 15:59 Inactive
@mitlib mitlib temporarily deployed to tacos-api-pipeline-pr-133 November 1, 2024 16:13 Inactive
@matt-bernhardt matt-bernhardt marked this pull request as ready for review November 1, 2024 16:17
@matt-bernhardt matt-bernhardt mentioned this pull request Nov 1, 2024
16 tasks
@jazairi jazairi self-assigned this Nov 1, 2024
Copy link
Contributor

@jazairi jazairi left a comment

Choose a reason for hiding this comment

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

Thanks for your patience on this review. I think I grabbed this right before getting sick. 🙃

For a variety of reasons, it's difficult this week for me to process this with the level of care I'd normally like to have. However, I don't see any issues in the code, and the approach makes sense. The only thing I should note is that, having never used pagy, I can't really confirm whether it's set up or not. I trust you on that, though.

As I mentioned on Slack, something weird is happening with text color in the updated diagram. If you can set the text color explicitly so it looks right in light and dark mode, I think this is :shipit:.

@matt-bernhardt
Copy link
Member Author

I've pushed a commit to better specify the text color in the classes diagram - thanks for catching this!

Copy link
Contributor

@jazairi jazairi left a comment

Choose a reason for hiding this comment

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

Diagram looks good. Thanks!

@matt-bernhardt matt-bernhardt merged commit 55ddb39 into main Nov 13, 2024
3 checks passed
@matt-bernhardt matt-bernhardt deleted the user-categorization branch November 13, 2024 14:52
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