-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create Validations table and associations
** Why are these changes being introduced: We need a Validations model that will be attached to the actions taken by TACOS (the Detections and Categorizations that are created during normal operation). Validation records will allow library staff to review and give feedback about the actions taken by the application. This feedback will be used to improve the operation of the tool, as well as to guide future development. ** Relevant ticket(s): * https://mitlibraries.atlassian.net/browse/tco-8 ** How does this address that need: This defines the migration to create the Validations table, and updates the references to it from related classes. It also runs `make annotate` to keep some minimal documentation going. The model itself has no methods, and I'm not sure yet how it will be flushed out. The most notable aspect is that it has a polymorphic association with _both_ the Detections and Categorizations models, via the :validatable construct, because all of those records will need to be given feedback. The (probably poorly named) "judgement" field is meant to store the postive / negative feedback about the action that TACOS took. ** Document any side effects to this change: Because TACOS only records positive actions (detections that were made, and categorization scores that were calculated), this model currently can only provide negative feedback (this detection should not have fired, or this categorization should not have been performed). There is not yet a way to say "this detector should have fired" or "this category should have been assigned." Further, there is a slight awkwardness approaching because the UI is going to focus on the Term, but that term is potentially subject to many Detections and Categorizations - so the form in the next commit is going to need to take one input and spawn multiple Validation records.
- Loading branch information
1 parent
b604aa4
commit 0467d40
Showing
11 changed files
with
92 additions
and
1 deletion.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# frozen_string_literal: true | ||
|
||
# == Schema Information | ||
# | ||
# Table name: validations | ||
# | ||
# id :integer not null, primary key | ||
# validatable_type :string | ||
# validatable_id :integer | ||
# user_id :integer not null | ||
# detector_version :string | ||
# judgement :integer | ||
# created_at :datetime not null | ||
# updated_at :datetime not null | ||
# | ||
class Validation < ApplicationRecord | ||
belongs_to :validatable, polymorphic: true | ||
end |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
class CreateValidations < ActiveRecord::Migration[7.1] | ||
def change | ||
create_table :validations do |t| | ||
t.references :validatable, polymorphic: true | ||
t.belongs_to :user, null: false, foreign_key: true | ||
t.string :detector_version | ||
t.integer :judgement | ||
|
||
t.timestamps | ||
end | ||
|
||
add_index :validations, [:validatable_id, :validatable_type, :user_id, :detector_version], unique: true | ||
|
||
add_reference :detections, :validatable, polymorphic: true | ||
add_reference :categorizations, :validatable, polymorphic: true | ||
end | ||
end |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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