<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.expertiza.ncsu.edu/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Vagarwa3</id>
	<title>Expertiza_Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.expertiza.ncsu.edu/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Vagarwa3"/>
	<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=Special:Contributions/Vagarwa3"/>
	<updated>2026-05-21T21:31:29Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.41.0</generator>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2026_-_E2605._Specialized_Rubrics_for_Different_Topic_Types&amp;diff=168200</id>
		<title>CSC/ECE 517 Spring 2026 - E2605. Specialized Rubrics for Different Topic Types</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2026_-_E2605._Specialized_Rubrics_for_Different_Topic_Types&amp;diff=168200"/>
		<updated>2026-05-03T01:40:01Z</updated>

		<summary type="html">&lt;p&gt;Vagarwa3: /* Links */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__TOC__&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
&lt;br /&gt;
This wiki page describes the design and implementation for Expertiza project '''E2605: Specialized Rubrics for Different Topic Types'''.&lt;br /&gt;
&lt;br /&gt;
The goal of this project is to let an instructor use different '''review rubrics''' for different '''project topics''' in the same assignment.&lt;br /&gt;
&lt;br /&gt;
Before this project, Expertiza could use:&lt;br /&gt;
&lt;br /&gt;
* one review rubric for the whole assignment, or&lt;br /&gt;
* different review rubrics for different review rounds.&lt;br /&gt;
&lt;br /&gt;
But it could not use different review rubrics for different topics in the same assignment.&lt;br /&gt;
&lt;br /&gt;
This project fixes that problem.&lt;br /&gt;
&lt;br /&gt;
== Project Overview ==&lt;br /&gt;
&lt;br /&gt;
Some assignments have topics that are very different from each other.&lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
&lt;br /&gt;
* one topic may be about security&lt;br /&gt;
* one topic may be about user interface design&lt;br /&gt;
* one topic may be about machine learning&lt;br /&gt;
&lt;br /&gt;
These topics should not always be reviewed with the same rubric.&lt;br /&gt;
&lt;br /&gt;
A security topic may need questions about:&lt;br /&gt;
&lt;br /&gt;
* threat modeling&lt;br /&gt;
* risk analysis&lt;br /&gt;
* vulnerability handling&lt;br /&gt;
&lt;br /&gt;
A user interface topic may need questions about:&lt;br /&gt;
&lt;br /&gt;
* usability&lt;br /&gt;
* layout&lt;br /&gt;
* design quality&lt;br /&gt;
&lt;br /&gt;
This project lets the system choose the right review rubric based on the topic of the team being reviewed.&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
&lt;br /&gt;
Expertiza already knows:&lt;br /&gt;
&lt;br /&gt;
* which team is being reviewed&lt;br /&gt;
* which topic that team signed up for&lt;br /&gt;
* which questionnaires are attached to the assignment&lt;br /&gt;
&lt;br /&gt;
But before this project, Expertiza did not store which review rubric should be used for each topic.&lt;br /&gt;
&lt;br /&gt;
Because of that:&lt;br /&gt;
&lt;br /&gt;
* reviewers could receive a rubric that did not match the topic&lt;br /&gt;
* instructors could not configure topic-based review rubrics in the assignment editor&lt;br /&gt;
* changing rubric mappings after reviews started could leave old reviews inconsistent with the new rubric&lt;br /&gt;
&lt;br /&gt;
== Design Goals ==&lt;br /&gt;
&lt;br /&gt;
The design goals for this project are:&lt;br /&gt;
&lt;br /&gt;
* let instructors assign different review rubrics to different topics&lt;br /&gt;
* keep the current review workflow the same for reviewers&lt;br /&gt;
* keep old assignments working the same way unless topic variation is enabled&lt;br /&gt;
* work correctly with round-based rubric variation&lt;br /&gt;
* use the existing database structure as much as possible&lt;br /&gt;
* keep rubric selection clear and predictable&lt;br /&gt;
* safely handle rubric changes after reviews have already started&lt;br /&gt;
&lt;br /&gt;
== Non-Goals ==&lt;br /&gt;
&lt;br /&gt;
This project does not:&lt;br /&gt;
&lt;br /&gt;
* redesign topic signup&lt;br /&gt;
* redesign waitlist behavior&lt;br /&gt;
* redesign team formation&lt;br /&gt;
* redesign review mapping&lt;br /&gt;
* redesign questionnaire authoring from scratch&lt;br /&gt;
&lt;br /&gt;
It only changes how the system stores and finds the correct review rubric.&lt;br /&gt;
&lt;br /&gt;
== Main Idea ==&lt;br /&gt;
&lt;br /&gt;
The main idea of the project is:&lt;br /&gt;
&lt;br /&gt;
# Start from the review response map.&lt;br /&gt;
# Find the team being reviewed.&lt;br /&gt;
# Find that team’s confirmed topic signup.&lt;br /&gt;
# Find the correct review rubric for that assignment, topic, and round.&lt;br /&gt;
&lt;br /&gt;
In simple form, the lookup path is:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;ReviewResponseMap -&amp;gt; reviewee team -&amp;gt; signed_up_teams -&amp;gt; topic -&amp;gt; assignment_questionnaires -&amp;gt; questionnaire&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Important Models ==&lt;br /&gt;
&lt;br /&gt;
The models used in this feature are:&lt;br /&gt;
&lt;br /&gt;
* '''Assignment'''&lt;br /&gt;
** stores assignment settings&lt;br /&gt;
** now stores whether rubric varies by topic&lt;br /&gt;
* '''ProjectTopic'''&lt;br /&gt;
** stores topics for an assignment&lt;br /&gt;
* '''SignedUpTeam'''&lt;br /&gt;
** stores which topic a team selected&lt;br /&gt;
* '''AssignmentQuestionnaire'''&lt;br /&gt;
** stores which questionnaire is used for an assignment&lt;br /&gt;
** now can also store which topic that mapping belongs to&lt;br /&gt;
* '''ReviewResponseMap'''&lt;br /&gt;
** stores who reviews whom&lt;br /&gt;
* '''Response'''&lt;br /&gt;
** stores the actual review response&lt;br /&gt;
* '''ReviewResetArchive'''&lt;br /&gt;
** stores old reviews when rubric changes make them invalid&lt;br /&gt;
&lt;br /&gt;
== UML Diagram ==&lt;br /&gt;
&lt;br /&gt;
The diagram below shows the main models and relationships used in topic-based rubric selection.&lt;br /&gt;
&lt;br /&gt;
[[File:E2605_class_diagram.png|800px|center|Class diagram for topic-based rubric selection]]&lt;br /&gt;
&lt;br /&gt;
== Sequence Diagram ==&lt;br /&gt;
&lt;br /&gt;
The diagram below shows how Expertiza finds the correct review rubric when a reviewer opens a review.&lt;br /&gt;
&lt;br /&gt;
[[File:E2605_rubric_lookup_sequence.png|800px|center|Sequence diagram for topic-based rubric lookup]]&lt;br /&gt;
&lt;br /&gt;
== Sequence Diagram for Rubric Change Handling ==&lt;br /&gt;
&lt;br /&gt;
The diagram below shows what happens when an instructor changes a rubric or a topic-rubric mapping after reviews have already started.&lt;br /&gt;
&lt;br /&gt;
[[File:E2605_rubric_reset_sequence.png|800px|center|Sequence diagram for archive, notify, and reset flow]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Original Design ==&lt;br /&gt;
&lt;br /&gt;
The original design was based on a small change to the current rubric system.&lt;br /&gt;
&lt;br /&gt;
=== Original Schema Design ===&lt;br /&gt;
&lt;br /&gt;
The original plan was to add:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;assignments.vary_by_topic&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;assignment_questionnaires.project_topic_id&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The meaning was:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;project_topic_id = NULL&amp;lt;/code&amp;gt; means the mapping is the default rubric for the assignment&lt;br /&gt;
* &amp;lt;code&amp;gt;project_topic_id = some topic id&amp;lt;/code&amp;gt; means the mapping is for that topic&lt;br /&gt;
&lt;br /&gt;
=== Original Lookup Design ===&lt;br /&gt;
&lt;br /&gt;
The original lookup order was:&lt;br /&gt;
&lt;br /&gt;
# topic + current round&lt;br /&gt;
# topic + default round&lt;br /&gt;
# default topic + current round&lt;br /&gt;
# default topic + default round&lt;br /&gt;
&lt;br /&gt;
Here:&lt;br /&gt;
&lt;br /&gt;
* '''default topic''' means &amp;lt;code&amp;gt;project_topic_id IS NULL&amp;lt;/code&amp;gt;&lt;br /&gt;
* '''default round''' means &amp;lt;code&amp;gt;used_in_round IS NULL&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This keeps lookup clear when both topic variation and round variation are enabled.&lt;br /&gt;
&lt;br /&gt;
=== Original UI Design ===&lt;br /&gt;
&lt;br /&gt;
The original UI plan was:&lt;br /&gt;
&lt;br /&gt;
* instructor enables topic-based review rubric variation&lt;br /&gt;
* instructor chooses topic-specific review rubrics in the assignment editor&lt;br /&gt;
* if round variation is enabled, the instructor can also choose rubrics by topic and round&lt;br /&gt;
&lt;br /&gt;
== What We Implemented ==&lt;br /&gt;
&lt;br /&gt;
The final implementation follows the original design, but also adds some extra support that was needed to make the feature work in the real system.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;width:100%;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Area&lt;br /&gt;
! Original Design&lt;br /&gt;
! What We Implemented&lt;br /&gt;
|-&lt;br /&gt;
| Assignment setting&lt;br /&gt;
| Add topic variation flag&lt;br /&gt;
| Added &amp;lt;code&amp;gt;vary_by_topic&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;assignments&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Rubric mapping&lt;br /&gt;
| Add topic id to assignment-questionnaire mapping&lt;br /&gt;
| Added &amp;lt;code&amp;gt;project_topic_id&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;assignment_questionnaires&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Rubric lookup&lt;br /&gt;
| Find rubric from topic and round&lt;br /&gt;
| Added shared lookup logic in &amp;lt;code&amp;gt;TopicBasedRubricLookup&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Instructor UI&lt;br /&gt;
| Configure topic rubrics in assignment editor&lt;br /&gt;
| Added topic rubric controls in the React assignment editor&lt;br /&gt;
|-&lt;br /&gt;
| Reload existing data&lt;br /&gt;
| Not described in detail&lt;br /&gt;
| Added serializer and frontend transformation logic so saved mappings reload correctly&lt;br /&gt;
|-&lt;br /&gt;
| Reviewer flow&lt;br /&gt;
| Reviewer gets correct rubric automatically&lt;br /&gt;
| Backend resolves rubric and frontend shows the resolved rubric information&lt;br /&gt;
|-&lt;br /&gt;
| Rubric changes after reviews start&lt;br /&gt;
| Mentioned as a concern&lt;br /&gt;
| Implemented archive, email notification, and review reset logic&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Schema Changes ==&lt;br /&gt;
&lt;br /&gt;
=== 1. &amp;lt;code&amp;gt;assignments.vary_by_topic&amp;lt;/code&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
A new boolean field was added to the assignments table.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot;&amp;gt;&lt;br /&gt;
add_column :assignments, :vary_by_topic, :boolean, default: false, null: false&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This means:&lt;br /&gt;
&lt;br /&gt;
* old assignments still work the same way&lt;br /&gt;
* topic-based rubric selection happens only when the instructor enables it&lt;br /&gt;
&lt;br /&gt;
=== 2. &amp;lt;code&amp;gt;assignment_questionnaires.project_topic_id&amp;lt;/code&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
A new nullable topic reference was added to &amp;lt;code&amp;gt;assignment_questionnaires&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot;&amp;gt;&lt;br /&gt;
add_reference :assignment_questionnaires, :project_topic, foreign_key: true, null: true&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This lets the same table store:&lt;br /&gt;
&lt;br /&gt;
* default assignment review rubric&lt;br /&gt;
* topic-specific review rubric&lt;br /&gt;
* round-based review rubric&lt;br /&gt;
* topic-and-round-specific review rubric&lt;br /&gt;
&lt;br /&gt;
=== 3. Indexes ===&lt;br /&gt;
&lt;br /&gt;
Indexes were added so the system can quickly find the correct rubric.&lt;br /&gt;
&lt;br /&gt;
The most important lookup index is on:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;assignment_id&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;project_topic_id&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;used_in_round&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== 4. Review Archive Table ===&lt;br /&gt;
&lt;br /&gt;
A new table was added:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;review_reset_archives&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This table stores old reviews when a rubric change makes those reviews no longer valid.&lt;br /&gt;
&lt;br /&gt;
It stores:&lt;br /&gt;
&lt;br /&gt;
* response id&lt;br /&gt;
* response map id&lt;br /&gt;
* assignment id&lt;br /&gt;
* questionnaire id&lt;br /&gt;
* topic id&lt;br /&gt;
* round&lt;br /&gt;
* reviewer id&lt;br /&gt;
* reviewee id&lt;br /&gt;
* reset reason&lt;br /&gt;
* snapshot data&lt;br /&gt;
&lt;br /&gt;
== Rubric Lookup Design ==&lt;br /&gt;
&lt;br /&gt;
The final lookup logic is placed in a shared concern:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;app/models/concerns/topic_based_rubric_lookup.rb&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This concern is included in the &amp;lt;code&amp;gt;Assignment&amp;lt;/code&amp;gt; model.&lt;br /&gt;
&lt;br /&gt;
=== Main Lookup Method ===&lt;br /&gt;
&lt;br /&gt;
The main method is:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;assignment_questionnaire_for_response_map(response_map, round:)&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This method is used to find the correct rubric for a review.&lt;br /&gt;
&lt;br /&gt;
=== Reviewee Topic Lookup ===&lt;br /&gt;
&lt;br /&gt;
When the response map is a &amp;lt;code&amp;gt;ReviewResponseMap&amp;lt;/code&amp;gt;, the system does this:&lt;br /&gt;
&lt;br /&gt;
# finds the reviewee team&lt;br /&gt;
# finds that team’s confirmed topic signup&lt;br /&gt;
# ignores waitlisted signups&lt;br /&gt;
# uses that topic id in rubric lookup&lt;br /&gt;
&lt;br /&gt;
The method used is:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;confirmed_topic_id_for(reviewee)&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Lookup Order ===&lt;br /&gt;
&lt;br /&gt;
The final lookup order is still:&lt;br /&gt;
&lt;br /&gt;
# topic + current round&lt;br /&gt;
# topic + default round&lt;br /&gt;
# assignment default topic + current round&lt;br /&gt;
# assignment default topic + default round&lt;br /&gt;
&lt;br /&gt;
This keeps rubric selection simple and predictable.&lt;br /&gt;
&lt;br /&gt;
== Original vs Final Lookup Code ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;width:100%;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Before&lt;br /&gt;
! After&lt;br /&gt;
|-&lt;br /&gt;
| Topic-based lookup did not exist.&lt;br /&gt;
| &amp;lt;code&amp;gt;Assignment&amp;lt;/code&amp;gt; now includes &amp;lt;code&amp;gt;TopicBasedRubricLookup&amp;lt;/code&amp;gt; and uses topic-aware rubric resolution.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Final Lookup Code ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot;&amp;gt;&lt;br /&gt;
def assignment_questionnaire_for_response_map(response_map, round:)&lt;br /&gt;
  return assignment_questionnaires.find_by(used_in_round: round) unless response_map.is_a?(ReviewResponseMap)&lt;br /&gt;
&lt;br /&gt;
  review_assignment_questionnaire(response_map, round) || assignment_questionnaires.find_by(used_in_round: round)&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Model Validation ==&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;AssignmentQuestionnaire&amp;lt;/code&amp;gt; model now validates two important things.&lt;br /&gt;
&lt;br /&gt;
=== 1. Topic Must Belong to the Same Assignment ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot;&amp;gt;&lt;br /&gt;
def project_topic_belongs_to_assignment&lt;br /&gt;
  return if project_topic_id.blank? || assignment_id.blank?&lt;br /&gt;
  return if project_topic&amp;amp;.assignment_id == assignment_id&lt;br /&gt;
&lt;br /&gt;
  errors.add(:project_topic, 'must belong to the same assignment')&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This prevents a topic from one assignment from being used in another assignment’s rubric mapping.&lt;br /&gt;
&lt;br /&gt;
=== 2. No Duplicate Review Mapping for the Same Assignment, Topic, and Round ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot;&amp;gt;&lt;br /&gt;
def unique_review_rubric_for_assignment_topic_round&lt;br /&gt;
  return unless review_questionnaire?&lt;br /&gt;
&lt;br /&gt;
  duplicate = AssignmentQuestionnaire&lt;br /&gt;
              .joins(:questionnaire)&lt;br /&gt;
              .where(&lt;br /&gt;
                assignment_id: assignment_id,&lt;br /&gt;
                project_topic_id: project_topic_id,&lt;br /&gt;
                used_in_round: used_in_round,&lt;br /&gt;
                questionnaires: { questionnaire_type: 'ReviewQuestionnaire' }&lt;br /&gt;
              )&lt;br /&gt;
  duplicate = duplicate.where.not(id: id) if persisted?&lt;br /&gt;
&lt;br /&gt;
  errors.add(:base, 'review rubric already exists for this assignment, topic, and round') if duplicate.exists?&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This makes sure lookup returns one correct rubric.&lt;br /&gt;
&lt;br /&gt;
== Backend Controller and API Changes ==&lt;br /&gt;
&lt;br /&gt;
=== Assignment Save and Reload ===&lt;br /&gt;
&lt;br /&gt;
To support this feature, the assignment edit flow had to save and reload more data.&lt;br /&gt;
&lt;br /&gt;
The backend now permits:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;vary_by_topic&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;vary_by_round&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;rounds_of_reviews&amp;lt;/code&amp;gt;&lt;br /&gt;
* nested &amp;lt;code&amp;gt;assignment_questionnaires_attributes&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;Assignment&amp;lt;/code&amp;gt; model also now accepts nested questionnaire mappings:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot;&amp;gt;&lt;br /&gt;
accepts_nested_attributes_for :assignment_questionnaires, allow_destroy: true&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Assignment Serializer ===&lt;br /&gt;
&lt;br /&gt;
The assignment serializer now returns:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;vary_by_topic&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;assignment_questionnaires&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;due_dates&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;num_review_rounds&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is needed so the frontend can reopen an assignment and show the saved topic and round rubric settings.&lt;br /&gt;
&lt;br /&gt;
=== Topic Rubric Mapping API ===&lt;br /&gt;
&lt;br /&gt;
The final implementation adds a dedicated controller for topic-rubric mappings:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;AssignmentQuestionnairesController#index&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;AssignmentQuestionnairesController#create&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;AssignmentQuestionnairesController#update&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;AssignmentQuestionnairesController#destroy&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This API is used by the React assignment editor.&lt;br /&gt;
&lt;br /&gt;
=== Reviewer Rubric Lookup API ===&lt;br /&gt;
&lt;br /&gt;
The backend also adds:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;StudentTasksController#rubric_for&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This endpoint returns:&lt;br /&gt;
&lt;br /&gt;
* assignment questionnaire id&lt;br /&gt;
* questionnaire id&lt;br /&gt;
* questionnaire name&lt;br /&gt;
* topic id&lt;br /&gt;
* round&lt;br /&gt;
&lt;br /&gt;
This gives the frontend a way to ask: “Which rubric did the backend choose for this review?”&lt;br /&gt;
&lt;br /&gt;
== Original vs Final API Design ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;width:100%;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Before&lt;br /&gt;
! After&lt;br /&gt;
|-&lt;br /&gt;
| No API for topic-rubric mappings.&lt;br /&gt;
| Added CRUD API in &amp;lt;code&amp;gt;AssignmentQuestionnairesController&amp;lt;/code&amp;gt;.&lt;br /&gt;
|-&lt;br /&gt;
| No endpoint to ask which rubric was resolved for a review.&lt;br /&gt;
| Added &amp;lt;code&amp;gt;/student_tasks/rubric_for&amp;lt;/code&amp;gt;.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Frontend Design ==&lt;br /&gt;
&lt;br /&gt;
The topic-based rubric feature is configured in the React assignment editor.&lt;br /&gt;
&lt;br /&gt;
Main frontend files are:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;src/pages/Assignments/AssignmentUtil.ts&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;src/pages/Assignments/AssignmentEditor.tsx&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;src/pages/Assignments/tabs/TopicsTab.tsx&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Instructor Workflow ===&lt;br /&gt;
&lt;br /&gt;
The instructor workflow is:&lt;br /&gt;
&lt;br /&gt;
# open assignment editor&lt;br /&gt;
# enable topic-based rubric variation&lt;br /&gt;
# optionally enable round-based rubric variation&lt;br /&gt;
# go to Topics tab&lt;br /&gt;
# choose the review rubric for each topic&lt;br /&gt;
# save the assignment&lt;br /&gt;
&lt;br /&gt;
If round variation is also enabled, the instructor can choose a rubric for each topic and round.&lt;br /&gt;
&lt;br /&gt;
=== Request Transformation ===&lt;br /&gt;
&lt;br /&gt;
The frontend now maps the form fields back to backend assignment fields.&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;typescript&amp;quot;&amp;gt;&lt;br /&gt;
vary_by_round: values.review_rubric_varies_by_round,&lt;br /&gt;
vary_by_topic: values.review_rubric_varies_by_topic,&lt;br /&gt;
rounds_of_reviews: values.number_of_review_rounds,&lt;br /&gt;
assignment_questionnaires_attributes: assignmentQuestionnaires,&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Response Transformation ===&lt;br /&gt;
&lt;br /&gt;
When loading an assignment, the frontend now restores:&lt;br /&gt;
&lt;br /&gt;
* whether rubric varies by topic&lt;br /&gt;
* whether rubric varies by round&lt;br /&gt;
* number of review rounds&lt;br /&gt;
* saved assignment-questionnaire mappings&lt;br /&gt;
* due dates&lt;br /&gt;
&lt;br /&gt;
This allows saved rubric settings to appear again when editing the assignment later.&lt;br /&gt;
&lt;br /&gt;
== Original vs Final Frontend Design ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;width:100%;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Before&lt;br /&gt;
! After&lt;br /&gt;
|-&lt;br /&gt;
| No topic-rubric controls in assignment editor.&lt;br /&gt;
| Added topic-rubric controls in the Topics tab.&lt;br /&gt;
|-&lt;br /&gt;
| Assignment editor did not save topic rubric settings.&lt;br /&gt;
| Assignment editor now saves &amp;lt;code&amp;gt;vary_by_topic&amp;lt;/code&amp;gt; and topic-based mappings.&lt;br /&gt;
|-&lt;br /&gt;
| Assignment editor did not reload topic rubric settings cleanly.&lt;br /&gt;
| Serializer and frontend transformation now reload saved mappings.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Questionnaire UI Support ==&lt;br /&gt;
&lt;br /&gt;
The original design assumed instructors could already create the review rubrics they needed.&lt;br /&gt;
&lt;br /&gt;
In practice, the React questionnaire UI needed some fixes.&lt;br /&gt;
&lt;br /&gt;
The final implementation adds:&lt;br /&gt;
&lt;br /&gt;
* correct mapping for the Review questionnaire type&lt;br /&gt;
* working edit navigation path for questionnaires&lt;br /&gt;
* item type loading from &amp;lt;code&amp;gt;/questions/types&amp;lt;/code&amp;gt;&lt;br /&gt;
* fallback item type list when needed&lt;br /&gt;
&lt;br /&gt;
This was important because the feature is only useful if instructors can create review rubrics in the frontend.&lt;br /&gt;
&lt;br /&gt;
== Review Reset and Archive Design ==&lt;br /&gt;
&lt;br /&gt;
== Why This Was Needed ==&lt;br /&gt;
&lt;br /&gt;
If an instructor changes a rubric after reviews have already started, the old reviews may no longer match the new rubric.&lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
&lt;br /&gt;
* a topic is mapped to a different review rubric&lt;br /&gt;
* a review questionnaire is edited&lt;br /&gt;
* a question inside a review questionnaire is added, updated, or deleted&lt;br /&gt;
&lt;br /&gt;
In these cases, the old completed reviews should not stay active as if nothing changed.&lt;br /&gt;
&lt;br /&gt;
But at the same time, the old student work should not be lost.&lt;br /&gt;
&lt;br /&gt;
== Final Reset Design ==&lt;br /&gt;
&lt;br /&gt;
The final implementation adds a shared concern:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;app/controllers/concerns/review_reset_handler.rb&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This concern does four things:&lt;br /&gt;
&lt;br /&gt;
# find the affected reviews&lt;br /&gt;
# archive the old review data&lt;br /&gt;
# notify reviewers that they must redo the review&lt;br /&gt;
# delete the old live responses&lt;br /&gt;
&lt;br /&gt;
== Review Archive ==&lt;br /&gt;
&lt;br /&gt;
The archived review stores:&lt;br /&gt;
&lt;br /&gt;
* response details&lt;br /&gt;
* questionnaire details&lt;br /&gt;
* reviewer and reviewee ids&lt;br /&gt;
* topic id&lt;br /&gt;
* round&lt;br /&gt;
* comments&lt;br /&gt;
* answers&lt;br /&gt;
* item text&lt;br /&gt;
* item type&lt;br /&gt;
* scores&lt;br /&gt;
* reset reason&lt;br /&gt;
&lt;br /&gt;
This means the system keeps the student’s old completed work in the database.&lt;br /&gt;
&lt;br /&gt;
== Reset Cases Implemented ==&lt;br /&gt;
&lt;br /&gt;
The following changes now trigger archive + reset:&lt;br /&gt;
&lt;br /&gt;
* topic-rubric mapping created&lt;br /&gt;
* topic-rubric mapping updated&lt;br /&gt;
* topic-rubric mapping deleted&lt;br /&gt;
* review questionnaire updated&lt;br /&gt;
* question created in a review questionnaire&lt;br /&gt;
* question updated in a review questionnaire&lt;br /&gt;
* question deleted from a review questionnaire&lt;br /&gt;
* all questions deleted from a review questionnaire&lt;br /&gt;
&lt;br /&gt;
== Original vs Final Review-Reset Design ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;width:100%;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Original Design&lt;br /&gt;
! Final Implementation&lt;br /&gt;
|-&lt;br /&gt;
| Mentioned that old reviews should not stay valid after rubric changes.&lt;br /&gt;
| Fully implemented archive + email + reset behavior.&lt;br /&gt;
|-&lt;br /&gt;
| Did not say where old reviews would be stored.&lt;br /&gt;
| Added &amp;lt;code&amp;gt;review_reset_archives&amp;lt;/code&amp;gt; table with full snapshot data.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Reviewer View ==&lt;br /&gt;
&lt;br /&gt;
The reviewer does not pick a rubric manually.&lt;br /&gt;
&lt;br /&gt;
Instead:&lt;br /&gt;
&lt;br /&gt;
# reviewer opens a review&lt;br /&gt;
# frontend sends &amp;lt;code&amp;gt;response_map_id&amp;lt;/code&amp;gt; and optional round&lt;br /&gt;
# backend finds the correct rubric&lt;br /&gt;
# frontend receives the resolved rubric details&lt;br /&gt;
&lt;br /&gt;
The React review page now shows:&lt;br /&gt;
&lt;br /&gt;
* resolved questionnaire name&lt;br /&gt;
* topic id, if topic-specific&lt;br /&gt;
* round, if round-specific&lt;br /&gt;
&lt;br /&gt;
This gives clear proof that the backend selected a rubric.&lt;br /&gt;
&lt;br /&gt;
== Known Limitation ==&lt;br /&gt;
&lt;br /&gt;
The current review page does '''not yet''' fully render the actual questionnaire items from the resolved rubric.&lt;br /&gt;
&lt;br /&gt;
So:&lt;br /&gt;
&lt;br /&gt;
* the backend does resolve the correct rubric&lt;br /&gt;
* the frontend does show which rubric was resolved&lt;br /&gt;
* but the review page still uses mostly static review content&lt;br /&gt;
&lt;br /&gt;
This is a known limit of the current implementation.&lt;br /&gt;
&lt;br /&gt;
== Testing ==&lt;br /&gt;
&lt;br /&gt;
=== Backend Tests ===&lt;br /&gt;
&lt;br /&gt;
Backend tests were added for:&lt;br /&gt;
&lt;br /&gt;
* topic-rubric mapping API&lt;br /&gt;
* topic-aware rubric lookup&lt;br /&gt;
* archive and reset behavior after rubric changes&lt;br /&gt;
&lt;br /&gt;
Main backend test files include:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;spec/controllers/assignment_questionnaires_controller_spec.rb&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;spec/controllers/questionnaires_controller_spec.rb&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;spec/controllers/student_tasks_controller_spec.rb&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;spec/models/assignment_spec.rb&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Frontend Tests ===&lt;br /&gt;
&lt;br /&gt;
Frontend tests were added for:&lt;br /&gt;
&lt;br /&gt;
* assignment request mapping for &amp;lt;code&amp;gt;vary_by_topic&amp;lt;/code&amp;gt;&lt;br /&gt;
* assignment response mapping for &amp;lt;code&amp;gt;vary_by_topic&amp;lt;/code&amp;gt;&lt;br /&gt;
* topic tab rubric behavior&lt;br /&gt;
* questionnaire type mapping&lt;br /&gt;
&lt;br /&gt;
Main frontend test files include:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;src/pages/Assignments/AssignmentEditor.test.tsx&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;src/pages/Assignments/tabs/TopicsTab.test.tsx&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;src/pages/Questionnaires/QuestionnaireUtils.test.ts&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Manual Testing ===&lt;br /&gt;
&lt;br /&gt;
The following manual cases were also checked:&lt;br /&gt;
&lt;br /&gt;
* topic-based rubric selection can be saved&lt;br /&gt;
* saved topic-rubric mappings reload correctly&lt;br /&gt;
* topic and round fallback order works&lt;br /&gt;
* waitlisted signups do not affect rubric lookup&lt;br /&gt;
* old completed reviews are archived when the rubric changes&lt;br /&gt;
* reviewers are notified and old live reviews are reset&lt;br /&gt;
&lt;br /&gt;
== Risks ==&lt;br /&gt;
&lt;br /&gt;
The main risks in this project were:&lt;br /&gt;
&lt;br /&gt;
* unclear rubric precedence&lt;br /&gt;
* incomplete topic-rubric setup&lt;br /&gt;
* mixing topic-based and round-based rules&lt;br /&gt;
* losing student work when rubrics change&lt;br /&gt;
&lt;br /&gt;
These were handled by:&lt;br /&gt;
&lt;br /&gt;
* a strict lookup order&lt;br /&gt;
* validation in the mapping model&lt;br /&gt;
* safe fallback behavior&lt;br /&gt;
* review archiving before reset&lt;br /&gt;
&lt;br /&gt;
== Known Limits ==&lt;br /&gt;
&lt;br /&gt;
The current implementation still has some limits:&lt;br /&gt;
&lt;br /&gt;
* the review page does not yet fully render the real questionnaire items dynamically&lt;br /&gt;
* archived reviews are stored in the database, but there is no frontend page to view them&lt;br /&gt;
* the current main-branch implementation allows one review rubric per topic per round&lt;br /&gt;
&lt;br /&gt;
== Design Principles Used ==&lt;br /&gt;
&lt;br /&gt;
The project uses these design ideas:&lt;br /&gt;
&lt;br /&gt;
* '''Single Responsibility Principle'''&lt;br /&gt;
** rubric lookup is placed in &amp;lt;code&amp;gt;TopicBasedRubricLookup&amp;lt;/code&amp;gt;&lt;br /&gt;
** review reset logic is placed in &amp;lt;code&amp;gt;ReviewResetHandler&amp;lt;/code&amp;gt;&lt;br /&gt;
** assignment request/response conversion is placed in frontend utility code&lt;br /&gt;
&lt;br /&gt;
* '''Separation of Concerns'''&lt;br /&gt;
** backend decides which rubric to use&lt;br /&gt;
** frontend lets the instructor configure topic mappings&lt;br /&gt;
** model validation keeps data safe&lt;br /&gt;
&lt;br /&gt;
* '''Backward Compatibility'''&lt;br /&gt;
** assignments that do not enable topic variation still work the old way&lt;br /&gt;
&lt;br /&gt;
* '''Deterministic Behavior'''&lt;br /&gt;
** the same topic and round always follow the same lookup order&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
&lt;br /&gt;
* Ed Gehringer&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
&lt;br /&gt;
* Vanaja Agarwal&lt;br /&gt;
* Himashu Agarwal&lt;br /&gt;
* Bhargavi Jadhav&lt;br /&gt;
&lt;br /&gt;
== Links ==&lt;br /&gt;
&lt;br /&gt;
Pull Requests:&lt;br /&gt;
* https://github.com/expertiza/reimplementation-back-end/pull/325&lt;br /&gt;
* https://github.com/expertiza/reimplementation-front-end/pull/166&lt;br /&gt;
&lt;br /&gt;
Demo Video:&lt;br /&gt;
* https://youtu.be/TRxBHXo7GQQ&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
* [https://wiki.expertiza.ncsu.edu Expertiza Wiki]&lt;br /&gt;
* [https://github.com/expertiza/reimplementation-back-end Reimplementation Backend Repository]&lt;br /&gt;
* [https://github.com/expertiza/reimplementation-front-end Reimplementation Frontend Repository]&lt;/div&gt;</summary>
		<author><name>Vagarwa3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:E2605_rubric_reset_sequence.png&amp;diff=168178</id>
		<title>File:E2605 rubric reset sequence.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:E2605_rubric_reset_sequence.png&amp;diff=168178"/>
		<updated>2026-04-29T02:00:06Z</updated>

		<summary type="html">&lt;p&gt;Vagarwa3: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Vagarwa3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:E2605_rubric_lookup_sequence.png&amp;diff=168177</id>
		<title>File:E2605 rubric lookup sequence.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:E2605_rubric_lookup_sequence.png&amp;diff=168177"/>
		<updated>2026-04-29T01:59:42Z</updated>

		<summary type="html">&lt;p&gt;Vagarwa3: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Vagarwa3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:E2605_class_diagram.png&amp;diff=168175</id>
		<title>File:E2605 class diagram.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:E2605_class_diagram.png&amp;diff=168175"/>
		<updated>2026-04-29T01:57:41Z</updated>

		<summary type="html">&lt;p&gt;Vagarwa3: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Vagarwa3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2026_-_E2605._Specialized_Rubrics_for_Different_Topic_Types&amp;diff=168173</id>
		<title>CSC/ECE 517 Spring 2026 - E2605. Specialized Rubrics for Different Topic Types</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2026_-_E2605._Specialized_Rubrics_for_Different_Topic_Types&amp;diff=168173"/>
		<updated>2026-04-29T01:56:08Z</updated>

		<summary type="html">&lt;p&gt;Vagarwa3: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__TOC__&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
&lt;br /&gt;
This wiki page describes the design and implementation for Expertiza project '''E2605: Specialized Rubrics for Different Topic Types'''.&lt;br /&gt;
&lt;br /&gt;
The goal of this project is to let an instructor use different '''review rubrics''' for different '''project topics''' in the same assignment.&lt;br /&gt;
&lt;br /&gt;
Before this project, Expertiza could use:&lt;br /&gt;
&lt;br /&gt;
* one review rubric for the whole assignment, or&lt;br /&gt;
* different review rubrics for different review rounds.&lt;br /&gt;
&lt;br /&gt;
But it could not use different review rubrics for different topics in the same assignment.&lt;br /&gt;
&lt;br /&gt;
This project fixes that problem.&lt;br /&gt;
&lt;br /&gt;
== Project Overview ==&lt;br /&gt;
&lt;br /&gt;
Some assignments have topics that are very different from each other.&lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
&lt;br /&gt;
* one topic may be about security&lt;br /&gt;
* one topic may be about user interface design&lt;br /&gt;
* one topic may be about machine learning&lt;br /&gt;
&lt;br /&gt;
These topics should not always be reviewed with the same rubric.&lt;br /&gt;
&lt;br /&gt;
A security topic may need questions about:&lt;br /&gt;
&lt;br /&gt;
* threat modeling&lt;br /&gt;
* risk analysis&lt;br /&gt;
* vulnerability handling&lt;br /&gt;
&lt;br /&gt;
A user interface topic may need questions about:&lt;br /&gt;
&lt;br /&gt;
* usability&lt;br /&gt;
* layout&lt;br /&gt;
* design quality&lt;br /&gt;
&lt;br /&gt;
This project lets the system choose the right review rubric based on the topic of the team being reviewed.&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
&lt;br /&gt;
Expertiza already knows:&lt;br /&gt;
&lt;br /&gt;
* which team is being reviewed&lt;br /&gt;
* which topic that team signed up for&lt;br /&gt;
* which questionnaires are attached to the assignment&lt;br /&gt;
&lt;br /&gt;
But before this project, Expertiza did not store which review rubric should be used for each topic.&lt;br /&gt;
&lt;br /&gt;
Because of that:&lt;br /&gt;
&lt;br /&gt;
* reviewers could receive a rubric that did not match the topic&lt;br /&gt;
* instructors could not configure topic-based review rubrics in the assignment editor&lt;br /&gt;
* changing rubric mappings after reviews started could leave old reviews inconsistent with the new rubric&lt;br /&gt;
&lt;br /&gt;
== Design Goals ==&lt;br /&gt;
&lt;br /&gt;
The design goals for this project are:&lt;br /&gt;
&lt;br /&gt;
* let instructors assign different review rubrics to different topics&lt;br /&gt;
* keep the current review workflow the same for reviewers&lt;br /&gt;
* keep old assignments working the same way unless topic variation is enabled&lt;br /&gt;
* work correctly with round-based rubric variation&lt;br /&gt;
* use the existing database structure as much as possible&lt;br /&gt;
* keep rubric selection clear and predictable&lt;br /&gt;
* safely handle rubric changes after reviews have already started&lt;br /&gt;
&lt;br /&gt;
== Non-Goals ==&lt;br /&gt;
&lt;br /&gt;
This project does not:&lt;br /&gt;
&lt;br /&gt;
* redesign topic signup&lt;br /&gt;
* redesign waitlist behavior&lt;br /&gt;
* redesign team formation&lt;br /&gt;
* redesign review mapping&lt;br /&gt;
* redesign questionnaire authoring from scratch&lt;br /&gt;
&lt;br /&gt;
It only changes how the system stores and finds the correct review rubric.&lt;br /&gt;
&lt;br /&gt;
== Main Idea ==&lt;br /&gt;
&lt;br /&gt;
The main idea of the project is:&lt;br /&gt;
&lt;br /&gt;
# Start from the review response map.&lt;br /&gt;
# Find the team being reviewed.&lt;br /&gt;
# Find that team’s confirmed topic signup.&lt;br /&gt;
# Find the correct review rubric for that assignment, topic, and round.&lt;br /&gt;
&lt;br /&gt;
In simple form, the lookup path is:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;ReviewResponseMap -&amp;gt; reviewee team -&amp;gt; signed_up_teams -&amp;gt; topic -&amp;gt; assignment_questionnaires -&amp;gt; questionnaire&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Important Models ==&lt;br /&gt;
&lt;br /&gt;
The models used in this feature are:&lt;br /&gt;
&lt;br /&gt;
* '''Assignment'''&lt;br /&gt;
** stores assignment settings&lt;br /&gt;
** now stores whether rubric varies by topic&lt;br /&gt;
* '''ProjectTopic'''&lt;br /&gt;
** stores topics for an assignment&lt;br /&gt;
* '''SignedUpTeam'''&lt;br /&gt;
** stores which topic a team selected&lt;br /&gt;
* '''AssignmentQuestionnaire'''&lt;br /&gt;
** stores which questionnaire is used for an assignment&lt;br /&gt;
** now can also store which topic that mapping belongs to&lt;br /&gt;
* '''ReviewResponseMap'''&lt;br /&gt;
** stores who reviews whom&lt;br /&gt;
* '''Response'''&lt;br /&gt;
** stores the actual review response&lt;br /&gt;
* '''ReviewResetArchive'''&lt;br /&gt;
** stores old reviews when rubric changes make them invalid&lt;br /&gt;
&lt;br /&gt;
== UML Diagram ==&lt;br /&gt;
&lt;br /&gt;
The diagram below shows the main models and relationships used in topic-based rubric selection.&lt;br /&gt;
&lt;br /&gt;
[[File:E2605_class_diagram.png|800px|center|Class diagram for topic-based rubric selection]]&lt;br /&gt;
&lt;br /&gt;
== Sequence Diagram ==&lt;br /&gt;
&lt;br /&gt;
The diagram below shows how Expertiza finds the correct review rubric when a reviewer opens a review.&lt;br /&gt;
&lt;br /&gt;
[[File:E2605_rubric_lookup_sequence.png|800px|center|Sequence diagram for topic-based rubric lookup]]&lt;br /&gt;
&lt;br /&gt;
== Sequence Diagram for Rubric Change Handling ==&lt;br /&gt;
&lt;br /&gt;
The diagram below shows what happens when an instructor changes a rubric or a topic-rubric mapping after reviews have already started.&lt;br /&gt;
&lt;br /&gt;
[[File:E2605_rubric_reset_sequence.png|800px|center|Sequence diagram for archive, notify, and reset flow]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Original Design ==&lt;br /&gt;
&lt;br /&gt;
The original design was based on a small change to the current rubric system.&lt;br /&gt;
&lt;br /&gt;
=== Original Schema Design ===&lt;br /&gt;
&lt;br /&gt;
The original plan was to add:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;assignments.vary_by_topic&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;assignment_questionnaires.project_topic_id&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The meaning was:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;project_topic_id = NULL&amp;lt;/code&amp;gt; means the mapping is the default rubric for the assignment&lt;br /&gt;
* &amp;lt;code&amp;gt;project_topic_id = some topic id&amp;lt;/code&amp;gt; means the mapping is for that topic&lt;br /&gt;
&lt;br /&gt;
=== Original Lookup Design ===&lt;br /&gt;
&lt;br /&gt;
The original lookup order was:&lt;br /&gt;
&lt;br /&gt;
# topic + current round&lt;br /&gt;
# topic + default round&lt;br /&gt;
# default topic + current round&lt;br /&gt;
# default topic + default round&lt;br /&gt;
&lt;br /&gt;
Here:&lt;br /&gt;
&lt;br /&gt;
* '''default topic''' means &amp;lt;code&amp;gt;project_topic_id IS NULL&amp;lt;/code&amp;gt;&lt;br /&gt;
* '''default round''' means &amp;lt;code&amp;gt;used_in_round IS NULL&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This keeps lookup clear when both topic variation and round variation are enabled.&lt;br /&gt;
&lt;br /&gt;
=== Original UI Design ===&lt;br /&gt;
&lt;br /&gt;
The original UI plan was:&lt;br /&gt;
&lt;br /&gt;
* instructor enables topic-based review rubric variation&lt;br /&gt;
* instructor chooses topic-specific review rubrics in the assignment editor&lt;br /&gt;
* if round variation is enabled, the instructor can also choose rubrics by topic and round&lt;br /&gt;
&lt;br /&gt;
== What We Implemented ==&lt;br /&gt;
&lt;br /&gt;
The final implementation follows the original design, but also adds some extra support that was needed to make the feature work in the real system.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;width:100%;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Area&lt;br /&gt;
! Original Design&lt;br /&gt;
! What We Implemented&lt;br /&gt;
|-&lt;br /&gt;
| Assignment setting&lt;br /&gt;
| Add topic variation flag&lt;br /&gt;
| Added &amp;lt;code&amp;gt;vary_by_topic&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;assignments&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Rubric mapping&lt;br /&gt;
| Add topic id to assignment-questionnaire mapping&lt;br /&gt;
| Added &amp;lt;code&amp;gt;project_topic_id&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;assignment_questionnaires&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Rubric lookup&lt;br /&gt;
| Find rubric from topic and round&lt;br /&gt;
| Added shared lookup logic in &amp;lt;code&amp;gt;TopicBasedRubricLookup&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Instructor UI&lt;br /&gt;
| Configure topic rubrics in assignment editor&lt;br /&gt;
| Added topic rubric controls in the React assignment editor&lt;br /&gt;
|-&lt;br /&gt;
| Reload existing data&lt;br /&gt;
| Not described in detail&lt;br /&gt;
| Added serializer and frontend transformation logic so saved mappings reload correctly&lt;br /&gt;
|-&lt;br /&gt;
| Reviewer flow&lt;br /&gt;
| Reviewer gets correct rubric automatically&lt;br /&gt;
| Backend resolves rubric and frontend shows the resolved rubric information&lt;br /&gt;
|-&lt;br /&gt;
| Rubric changes after reviews start&lt;br /&gt;
| Mentioned as a concern&lt;br /&gt;
| Implemented archive, email notification, and review reset logic&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Schema Changes ==&lt;br /&gt;
&lt;br /&gt;
=== 1. &amp;lt;code&amp;gt;assignments.vary_by_topic&amp;lt;/code&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
A new boolean field was added to the assignments table.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot;&amp;gt;&lt;br /&gt;
add_column :assignments, :vary_by_topic, :boolean, default: false, null: false&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This means:&lt;br /&gt;
&lt;br /&gt;
* old assignments still work the same way&lt;br /&gt;
* topic-based rubric selection happens only when the instructor enables it&lt;br /&gt;
&lt;br /&gt;
=== 2. &amp;lt;code&amp;gt;assignment_questionnaires.project_topic_id&amp;lt;/code&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
A new nullable topic reference was added to &amp;lt;code&amp;gt;assignment_questionnaires&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot;&amp;gt;&lt;br /&gt;
add_reference :assignment_questionnaires, :project_topic, foreign_key: true, null: true&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This lets the same table store:&lt;br /&gt;
&lt;br /&gt;
* default assignment review rubric&lt;br /&gt;
* topic-specific review rubric&lt;br /&gt;
* round-based review rubric&lt;br /&gt;
* topic-and-round-specific review rubric&lt;br /&gt;
&lt;br /&gt;
=== 3. Indexes ===&lt;br /&gt;
&lt;br /&gt;
Indexes were added so the system can quickly find the correct rubric.&lt;br /&gt;
&lt;br /&gt;
The most important lookup index is on:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;assignment_id&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;project_topic_id&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;used_in_round&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== 4. Review Archive Table ===&lt;br /&gt;
&lt;br /&gt;
A new table was added:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;review_reset_archives&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This table stores old reviews when a rubric change makes those reviews no longer valid.&lt;br /&gt;
&lt;br /&gt;
It stores:&lt;br /&gt;
&lt;br /&gt;
* response id&lt;br /&gt;
* response map id&lt;br /&gt;
* assignment id&lt;br /&gt;
* questionnaire id&lt;br /&gt;
* topic id&lt;br /&gt;
* round&lt;br /&gt;
* reviewer id&lt;br /&gt;
* reviewee id&lt;br /&gt;
* reset reason&lt;br /&gt;
* snapshot data&lt;br /&gt;
&lt;br /&gt;
== Rubric Lookup Design ==&lt;br /&gt;
&lt;br /&gt;
The final lookup logic is placed in a shared concern:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;app/models/concerns/topic_based_rubric_lookup.rb&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This concern is included in the &amp;lt;code&amp;gt;Assignment&amp;lt;/code&amp;gt; model.&lt;br /&gt;
&lt;br /&gt;
=== Main Lookup Method ===&lt;br /&gt;
&lt;br /&gt;
The main method is:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;assignment_questionnaire_for_response_map(response_map, round:)&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This method is used to find the correct rubric for a review.&lt;br /&gt;
&lt;br /&gt;
=== Reviewee Topic Lookup ===&lt;br /&gt;
&lt;br /&gt;
When the response map is a &amp;lt;code&amp;gt;ReviewResponseMap&amp;lt;/code&amp;gt;, the system does this:&lt;br /&gt;
&lt;br /&gt;
# finds the reviewee team&lt;br /&gt;
# finds that team’s confirmed topic signup&lt;br /&gt;
# ignores waitlisted signups&lt;br /&gt;
# uses that topic id in rubric lookup&lt;br /&gt;
&lt;br /&gt;
The method used is:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;confirmed_topic_id_for(reviewee)&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Lookup Order ===&lt;br /&gt;
&lt;br /&gt;
The final lookup order is still:&lt;br /&gt;
&lt;br /&gt;
# topic + current round&lt;br /&gt;
# topic + default round&lt;br /&gt;
# assignment default topic + current round&lt;br /&gt;
# assignment default topic + default round&lt;br /&gt;
&lt;br /&gt;
This keeps rubric selection simple and predictable.&lt;br /&gt;
&lt;br /&gt;
== Original vs Final Lookup Code ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;width:100%;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Before&lt;br /&gt;
! After&lt;br /&gt;
|-&lt;br /&gt;
| Topic-based lookup did not exist.&lt;br /&gt;
| &amp;lt;code&amp;gt;Assignment&amp;lt;/code&amp;gt; now includes &amp;lt;code&amp;gt;TopicBasedRubricLookup&amp;lt;/code&amp;gt; and uses topic-aware rubric resolution.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Final Lookup Code ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot;&amp;gt;&lt;br /&gt;
def assignment_questionnaire_for_response_map(response_map, round:)&lt;br /&gt;
  return assignment_questionnaires.find_by(used_in_round: round) unless response_map.is_a?(ReviewResponseMap)&lt;br /&gt;
&lt;br /&gt;
  review_assignment_questionnaire(response_map, round) || assignment_questionnaires.find_by(used_in_round: round)&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Model Validation ==&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;AssignmentQuestionnaire&amp;lt;/code&amp;gt; model now validates two important things.&lt;br /&gt;
&lt;br /&gt;
=== 1. Topic Must Belong to the Same Assignment ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot;&amp;gt;&lt;br /&gt;
def project_topic_belongs_to_assignment&lt;br /&gt;
  return if project_topic_id.blank? || assignment_id.blank?&lt;br /&gt;
  return if project_topic&amp;amp;.assignment_id == assignment_id&lt;br /&gt;
&lt;br /&gt;
  errors.add(:project_topic, 'must belong to the same assignment')&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This prevents a topic from one assignment from being used in another assignment’s rubric mapping.&lt;br /&gt;
&lt;br /&gt;
=== 2. No Duplicate Review Mapping for the Same Assignment, Topic, and Round ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot;&amp;gt;&lt;br /&gt;
def unique_review_rubric_for_assignment_topic_round&lt;br /&gt;
  return unless review_questionnaire?&lt;br /&gt;
&lt;br /&gt;
  duplicate = AssignmentQuestionnaire&lt;br /&gt;
              .joins(:questionnaire)&lt;br /&gt;
              .where(&lt;br /&gt;
                assignment_id: assignment_id,&lt;br /&gt;
                project_topic_id: project_topic_id,&lt;br /&gt;
                used_in_round: used_in_round,&lt;br /&gt;
                questionnaires: { questionnaire_type: 'ReviewQuestionnaire' }&lt;br /&gt;
              )&lt;br /&gt;
  duplicate = duplicate.where.not(id: id) if persisted?&lt;br /&gt;
&lt;br /&gt;
  errors.add(:base, 'review rubric already exists for this assignment, topic, and round') if duplicate.exists?&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This makes sure lookup returns one correct rubric.&lt;br /&gt;
&lt;br /&gt;
== Backend Controller and API Changes ==&lt;br /&gt;
&lt;br /&gt;
=== Assignment Save and Reload ===&lt;br /&gt;
&lt;br /&gt;
To support this feature, the assignment edit flow had to save and reload more data.&lt;br /&gt;
&lt;br /&gt;
The backend now permits:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;vary_by_topic&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;vary_by_round&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;rounds_of_reviews&amp;lt;/code&amp;gt;&lt;br /&gt;
* nested &amp;lt;code&amp;gt;assignment_questionnaires_attributes&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;Assignment&amp;lt;/code&amp;gt; model also now accepts nested questionnaire mappings:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot;&amp;gt;&lt;br /&gt;
accepts_nested_attributes_for :assignment_questionnaires, allow_destroy: true&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Assignment Serializer ===&lt;br /&gt;
&lt;br /&gt;
The assignment serializer now returns:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;vary_by_topic&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;assignment_questionnaires&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;due_dates&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;num_review_rounds&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is needed so the frontend can reopen an assignment and show the saved topic and round rubric settings.&lt;br /&gt;
&lt;br /&gt;
=== Topic Rubric Mapping API ===&lt;br /&gt;
&lt;br /&gt;
The final implementation adds a dedicated controller for topic-rubric mappings:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;AssignmentQuestionnairesController#index&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;AssignmentQuestionnairesController#create&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;AssignmentQuestionnairesController#update&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;AssignmentQuestionnairesController#destroy&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This API is used by the React assignment editor.&lt;br /&gt;
&lt;br /&gt;
=== Reviewer Rubric Lookup API ===&lt;br /&gt;
&lt;br /&gt;
The backend also adds:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;StudentTasksController#rubric_for&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This endpoint returns:&lt;br /&gt;
&lt;br /&gt;
* assignment questionnaire id&lt;br /&gt;
* questionnaire id&lt;br /&gt;
* questionnaire name&lt;br /&gt;
* topic id&lt;br /&gt;
* round&lt;br /&gt;
&lt;br /&gt;
This gives the frontend a way to ask: “Which rubric did the backend choose for this review?”&lt;br /&gt;
&lt;br /&gt;
== Original vs Final API Design ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;width:100%;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Before&lt;br /&gt;
! After&lt;br /&gt;
|-&lt;br /&gt;
| No API for topic-rubric mappings.&lt;br /&gt;
| Added CRUD API in &amp;lt;code&amp;gt;AssignmentQuestionnairesController&amp;lt;/code&amp;gt;.&lt;br /&gt;
|-&lt;br /&gt;
| No endpoint to ask which rubric was resolved for a review.&lt;br /&gt;
| Added &amp;lt;code&amp;gt;/student_tasks/rubric_for&amp;lt;/code&amp;gt;.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Frontend Design ==&lt;br /&gt;
&lt;br /&gt;
The topic-based rubric feature is configured in the React assignment editor.&lt;br /&gt;
&lt;br /&gt;
Main frontend files are:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;src/pages/Assignments/AssignmentUtil.ts&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;src/pages/Assignments/AssignmentEditor.tsx&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;src/pages/Assignments/tabs/TopicsTab.tsx&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Instructor Workflow ===&lt;br /&gt;
&lt;br /&gt;
The instructor workflow is:&lt;br /&gt;
&lt;br /&gt;
# open assignment editor&lt;br /&gt;
# enable topic-based rubric variation&lt;br /&gt;
# optionally enable round-based rubric variation&lt;br /&gt;
# go to Topics tab&lt;br /&gt;
# choose the review rubric for each topic&lt;br /&gt;
# save the assignment&lt;br /&gt;
&lt;br /&gt;
If round variation is also enabled, the instructor can choose a rubric for each topic and round.&lt;br /&gt;
&lt;br /&gt;
=== Request Transformation ===&lt;br /&gt;
&lt;br /&gt;
The frontend now maps the form fields back to backend assignment fields.&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;typescript&amp;quot;&amp;gt;&lt;br /&gt;
vary_by_round: values.review_rubric_varies_by_round,&lt;br /&gt;
vary_by_topic: values.review_rubric_varies_by_topic,&lt;br /&gt;
rounds_of_reviews: values.number_of_review_rounds,&lt;br /&gt;
assignment_questionnaires_attributes: assignmentQuestionnaires,&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Response Transformation ===&lt;br /&gt;
&lt;br /&gt;
When loading an assignment, the frontend now restores:&lt;br /&gt;
&lt;br /&gt;
* whether rubric varies by topic&lt;br /&gt;
* whether rubric varies by round&lt;br /&gt;
* number of review rounds&lt;br /&gt;
* saved assignment-questionnaire mappings&lt;br /&gt;
* due dates&lt;br /&gt;
&lt;br /&gt;
This allows saved rubric settings to appear again when editing the assignment later.&lt;br /&gt;
&lt;br /&gt;
== Original vs Final Frontend Design ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;width:100%;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Before&lt;br /&gt;
! After&lt;br /&gt;
|-&lt;br /&gt;
| No topic-rubric controls in assignment editor.&lt;br /&gt;
| Added topic-rubric controls in the Topics tab.&lt;br /&gt;
|-&lt;br /&gt;
| Assignment editor did not save topic rubric settings.&lt;br /&gt;
| Assignment editor now saves &amp;lt;code&amp;gt;vary_by_topic&amp;lt;/code&amp;gt; and topic-based mappings.&lt;br /&gt;
|-&lt;br /&gt;
| Assignment editor did not reload topic rubric settings cleanly.&lt;br /&gt;
| Serializer and frontend transformation now reload saved mappings.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Questionnaire UI Support ==&lt;br /&gt;
&lt;br /&gt;
The original design assumed instructors could already create the review rubrics they needed.&lt;br /&gt;
&lt;br /&gt;
In practice, the React questionnaire UI needed some fixes.&lt;br /&gt;
&lt;br /&gt;
The final implementation adds:&lt;br /&gt;
&lt;br /&gt;
* correct mapping for the Review questionnaire type&lt;br /&gt;
* working edit navigation path for questionnaires&lt;br /&gt;
* item type loading from &amp;lt;code&amp;gt;/questions/types&amp;lt;/code&amp;gt;&lt;br /&gt;
* fallback item type list when needed&lt;br /&gt;
&lt;br /&gt;
This was important because the feature is only useful if instructors can create review rubrics in the frontend.&lt;br /&gt;
&lt;br /&gt;
== Review Reset and Archive Design ==&lt;br /&gt;
&lt;br /&gt;
== Why This Was Needed ==&lt;br /&gt;
&lt;br /&gt;
If an instructor changes a rubric after reviews have already started, the old reviews may no longer match the new rubric.&lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
&lt;br /&gt;
* a topic is mapped to a different review rubric&lt;br /&gt;
* a review questionnaire is edited&lt;br /&gt;
* a question inside a review questionnaire is added, updated, or deleted&lt;br /&gt;
&lt;br /&gt;
In these cases, the old completed reviews should not stay active as if nothing changed.&lt;br /&gt;
&lt;br /&gt;
But at the same time, the old student work should not be lost.&lt;br /&gt;
&lt;br /&gt;
== Final Reset Design ==&lt;br /&gt;
&lt;br /&gt;
The final implementation adds a shared concern:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;app/controllers/concerns/review_reset_handler.rb&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This concern does four things:&lt;br /&gt;
&lt;br /&gt;
# find the affected reviews&lt;br /&gt;
# archive the old review data&lt;br /&gt;
# notify reviewers that they must redo the review&lt;br /&gt;
# delete the old live responses&lt;br /&gt;
&lt;br /&gt;
== Review Archive ==&lt;br /&gt;
&lt;br /&gt;
The archived review stores:&lt;br /&gt;
&lt;br /&gt;
* response details&lt;br /&gt;
* questionnaire details&lt;br /&gt;
* reviewer and reviewee ids&lt;br /&gt;
* topic id&lt;br /&gt;
* round&lt;br /&gt;
* comments&lt;br /&gt;
* answers&lt;br /&gt;
* item text&lt;br /&gt;
* item type&lt;br /&gt;
* scores&lt;br /&gt;
* reset reason&lt;br /&gt;
&lt;br /&gt;
This means the system keeps the student’s old completed work in the database.&lt;br /&gt;
&lt;br /&gt;
== Reset Cases Implemented ==&lt;br /&gt;
&lt;br /&gt;
The following changes now trigger archive + reset:&lt;br /&gt;
&lt;br /&gt;
* topic-rubric mapping created&lt;br /&gt;
* topic-rubric mapping updated&lt;br /&gt;
* topic-rubric mapping deleted&lt;br /&gt;
* review questionnaire updated&lt;br /&gt;
* question created in a review questionnaire&lt;br /&gt;
* question updated in a review questionnaire&lt;br /&gt;
* question deleted from a review questionnaire&lt;br /&gt;
* all questions deleted from a review questionnaire&lt;br /&gt;
&lt;br /&gt;
== Original vs Final Review-Reset Design ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;width:100%;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Original Design&lt;br /&gt;
! Final Implementation&lt;br /&gt;
|-&lt;br /&gt;
| Mentioned that old reviews should not stay valid after rubric changes.&lt;br /&gt;
| Fully implemented archive + email + reset behavior.&lt;br /&gt;
|-&lt;br /&gt;
| Did not say where old reviews would be stored.&lt;br /&gt;
| Added &amp;lt;code&amp;gt;review_reset_archives&amp;lt;/code&amp;gt; table with full snapshot data.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Reviewer View ==&lt;br /&gt;
&lt;br /&gt;
The reviewer does not pick a rubric manually.&lt;br /&gt;
&lt;br /&gt;
Instead:&lt;br /&gt;
&lt;br /&gt;
# reviewer opens a review&lt;br /&gt;
# frontend sends &amp;lt;code&amp;gt;response_map_id&amp;lt;/code&amp;gt; and optional round&lt;br /&gt;
# backend finds the correct rubric&lt;br /&gt;
# frontend receives the resolved rubric details&lt;br /&gt;
&lt;br /&gt;
The React review page now shows:&lt;br /&gt;
&lt;br /&gt;
* resolved questionnaire name&lt;br /&gt;
* topic id, if topic-specific&lt;br /&gt;
* round, if round-specific&lt;br /&gt;
&lt;br /&gt;
This gives clear proof that the backend selected a rubric.&lt;br /&gt;
&lt;br /&gt;
== Known Limitation ==&lt;br /&gt;
&lt;br /&gt;
The current review page does '''not yet''' fully render the actual questionnaire items from the resolved rubric.&lt;br /&gt;
&lt;br /&gt;
So:&lt;br /&gt;
&lt;br /&gt;
* the backend does resolve the correct rubric&lt;br /&gt;
* the frontend does show which rubric was resolved&lt;br /&gt;
* but the review page still uses mostly static review content&lt;br /&gt;
&lt;br /&gt;
This is a known limit of the current implementation.&lt;br /&gt;
&lt;br /&gt;
== Testing ==&lt;br /&gt;
&lt;br /&gt;
=== Backend Tests ===&lt;br /&gt;
&lt;br /&gt;
Backend tests were added for:&lt;br /&gt;
&lt;br /&gt;
* topic-rubric mapping API&lt;br /&gt;
* topic-aware rubric lookup&lt;br /&gt;
* archive and reset behavior after rubric changes&lt;br /&gt;
&lt;br /&gt;
Main backend test files include:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;spec/controllers/assignment_questionnaires_controller_spec.rb&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;spec/controllers/questionnaires_controller_spec.rb&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;spec/controllers/student_tasks_controller_spec.rb&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;spec/models/assignment_spec.rb&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Frontend Tests ===&lt;br /&gt;
&lt;br /&gt;
Frontend tests were added for:&lt;br /&gt;
&lt;br /&gt;
* assignment request mapping for &amp;lt;code&amp;gt;vary_by_topic&amp;lt;/code&amp;gt;&lt;br /&gt;
* assignment response mapping for &amp;lt;code&amp;gt;vary_by_topic&amp;lt;/code&amp;gt;&lt;br /&gt;
* topic tab rubric behavior&lt;br /&gt;
* questionnaire type mapping&lt;br /&gt;
&lt;br /&gt;
Main frontend test files include:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;src/pages/Assignments/AssignmentEditor.test.tsx&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;src/pages/Assignments/tabs/TopicsTab.test.tsx&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;src/pages/Questionnaires/QuestionnaireUtils.test.ts&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Manual Testing ===&lt;br /&gt;
&lt;br /&gt;
The following manual cases were also checked:&lt;br /&gt;
&lt;br /&gt;
* topic-based rubric selection can be saved&lt;br /&gt;
* saved topic-rubric mappings reload correctly&lt;br /&gt;
* topic and round fallback order works&lt;br /&gt;
* waitlisted signups do not affect rubric lookup&lt;br /&gt;
* old completed reviews are archived when the rubric changes&lt;br /&gt;
* reviewers are notified and old live reviews are reset&lt;br /&gt;
&lt;br /&gt;
== Risks ==&lt;br /&gt;
&lt;br /&gt;
The main risks in this project were:&lt;br /&gt;
&lt;br /&gt;
* unclear rubric precedence&lt;br /&gt;
* incomplete topic-rubric setup&lt;br /&gt;
* mixing topic-based and round-based rules&lt;br /&gt;
* losing student work when rubrics change&lt;br /&gt;
&lt;br /&gt;
These were handled by:&lt;br /&gt;
&lt;br /&gt;
* a strict lookup order&lt;br /&gt;
* validation in the mapping model&lt;br /&gt;
* safe fallback behavior&lt;br /&gt;
* review archiving before reset&lt;br /&gt;
&lt;br /&gt;
== Known Limits ==&lt;br /&gt;
&lt;br /&gt;
The current implementation still has some limits:&lt;br /&gt;
&lt;br /&gt;
* the review page does not yet fully render the real questionnaire items dynamically&lt;br /&gt;
* archived reviews are stored in the database, but there is no frontend page to view them&lt;br /&gt;
* the current main-branch implementation allows one review rubric per topic per round&lt;br /&gt;
&lt;br /&gt;
== Design Principles Used ==&lt;br /&gt;
&lt;br /&gt;
The project uses these design ideas:&lt;br /&gt;
&lt;br /&gt;
* '''Single Responsibility Principle'''&lt;br /&gt;
** rubric lookup is placed in &amp;lt;code&amp;gt;TopicBasedRubricLookup&amp;lt;/code&amp;gt;&lt;br /&gt;
** review reset logic is placed in &amp;lt;code&amp;gt;ReviewResetHandler&amp;lt;/code&amp;gt;&lt;br /&gt;
** assignment request/response conversion is placed in frontend utility code&lt;br /&gt;
&lt;br /&gt;
* '''Separation of Concerns'''&lt;br /&gt;
** backend decides which rubric to use&lt;br /&gt;
** frontend lets the instructor configure topic mappings&lt;br /&gt;
** model validation keeps data safe&lt;br /&gt;
&lt;br /&gt;
* '''Backward Compatibility'''&lt;br /&gt;
** assignments that do not enable topic variation still work the old way&lt;br /&gt;
&lt;br /&gt;
* '''Deterministic Behavior'''&lt;br /&gt;
** the same topic and round always follow the same lookup order&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
&lt;br /&gt;
* Ed Gehringer&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
&lt;br /&gt;
* Vanaja Agarwal&lt;br /&gt;
* Himashu Agarwal&lt;br /&gt;
* Bhargavi Jadhav&lt;br /&gt;
&lt;br /&gt;
== Links ==&lt;br /&gt;
&lt;br /&gt;
Pull Requests:&lt;br /&gt;
* https://github.com/expertiza/reimplementation-back-end/pull/325&lt;br /&gt;
* https://github.com/expertiza/reimplementation-front-end/pull/166&lt;br /&gt;
&lt;br /&gt;
Demo Video:&lt;br /&gt;
* Add demo video link here&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
* [https://wiki.expertiza.ncsu.edu Expertiza Wiki]&lt;br /&gt;
* [https://github.com/expertiza/reimplementation-back-end Reimplementation Backend Repository]&lt;br /&gt;
* [https://github.com/expertiza/reimplementation-front-end Reimplementation Frontend Repository]&lt;/div&gt;</summary>
		<author><name>Vagarwa3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2026_-_E2605._Specialized_Rubrics_for_Different_Topic_Types&amp;diff=168172</id>
		<title>CSC/ECE 517 Spring 2026 - E2605. Specialized Rubrics for Different Topic Types</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2026_-_E2605._Specialized_Rubrics_for_Different_Topic_Types&amp;diff=168172"/>
		<updated>2026-04-29T01:44:19Z</updated>

		<summary type="html">&lt;p&gt;Vagarwa3: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__TOC__&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
&lt;br /&gt;
This wiki page describes the design and implementation for Expertiza project '''E2605: Specialized Rubrics for Different Topic Types'''.&lt;br /&gt;
&lt;br /&gt;
The goal of this project is to let an instructor use different '''review rubrics''' for different '''project topics''' in the same assignment.&lt;br /&gt;
&lt;br /&gt;
Before this project, Expertiza could use:&lt;br /&gt;
&lt;br /&gt;
* one review rubric for the whole assignment, or&lt;br /&gt;
* different review rubrics for different review rounds.&lt;br /&gt;
&lt;br /&gt;
But it could not use different review rubrics for different topics in the same assignment.&lt;br /&gt;
&lt;br /&gt;
This project fixes that problem.&lt;br /&gt;
&lt;br /&gt;
== Project Overview ==&lt;br /&gt;
&lt;br /&gt;
Some assignments have topics that are very different from each other.&lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
&lt;br /&gt;
* one topic may be about security&lt;br /&gt;
* one topic may be about user interface design&lt;br /&gt;
* one topic may be about machine learning&lt;br /&gt;
&lt;br /&gt;
These topics should not always be reviewed with the same rubric.&lt;br /&gt;
&lt;br /&gt;
A security topic may need questions about:&lt;br /&gt;
&lt;br /&gt;
* threat modeling&lt;br /&gt;
* risk analysis&lt;br /&gt;
* vulnerability handling&lt;br /&gt;
&lt;br /&gt;
A user interface topic may need questions about:&lt;br /&gt;
&lt;br /&gt;
* usability&lt;br /&gt;
* layout&lt;br /&gt;
* design quality&lt;br /&gt;
&lt;br /&gt;
This project lets the system choose the right review rubric based on the topic of the team being reviewed.&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
&lt;br /&gt;
Expertiza already knows:&lt;br /&gt;
&lt;br /&gt;
* which team is being reviewed&lt;br /&gt;
* which topic that team signed up for&lt;br /&gt;
* which questionnaires are attached to the assignment&lt;br /&gt;
&lt;br /&gt;
But before this project, Expertiza did not store which review rubric should be used for each topic.&lt;br /&gt;
&lt;br /&gt;
Because of that:&lt;br /&gt;
&lt;br /&gt;
* reviewers could receive a rubric that did not match the topic&lt;br /&gt;
* instructors could not configure topic-based review rubrics in the assignment editor&lt;br /&gt;
* changing rubric mappings after reviews started could leave old reviews inconsistent with the new rubric&lt;br /&gt;
&lt;br /&gt;
== Design Goals ==&lt;br /&gt;
&lt;br /&gt;
The design goals for this project are:&lt;br /&gt;
&lt;br /&gt;
* let instructors assign different review rubrics to different topics&lt;br /&gt;
* keep the current review workflow the same for reviewers&lt;br /&gt;
* keep old assignments working the same way unless topic variation is enabled&lt;br /&gt;
* work correctly with round-based rubric variation&lt;br /&gt;
* use the existing database structure as much as possible&lt;br /&gt;
* keep rubric selection clear and predictable&lt;br /&gt;
* safely handle rubric changes after reviews have already started&lt;br /&gt;
&lt;br /&gt;
== Non-Goals ==&lt;br /&gt;
&lt;br /&gt;
This project does not:&lt;br /&gt;
&lt;br /&gt;
* redesign topic signup&lt;br /&gt;
* redesign waitlist behavior&lt;br /&gt;
* redesign team formation&lt;br /&gt;
* redesign review mapping&lt;br /&gt;
* redesign questionnaire authoring from scratch&lt;br /&gt;
&lt;br /&gt;
It only changes how the system stores and finds the correct review rubric.&lt;br /&gt;
&lt;br /&gt;
== Main Idea ==&lt;br /&gt;
&lt;br /&gt;
The main idea of the project is:&lt;br /&gt;
&lt;br /&gt;
# Start from the review response map.&lt;br /&gt;
# Find the team being reviewed.&lt;br /&gt;
# Find that team’s confirmed topic signup.&lt;br /&gt;
# Find the correct review rubric for that assignment, topic, and round.&lt;br /&gt;
&lt;br /&gt;
In simple form, the lookup path is:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;ReviewResponseMap -&amp;gt; reviewee team -&amp;gt; signed_up_teams -&amp;gt; topic -&amp;gt; assignment_questionnaires -&amp;gt; questionnaire&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Important Models ==&lt;br /&gt;
&lt;br /&gt;
The models used in this feature are:&lt;br /&gt;
&lt;br /&gt;
* '''Assignment'''&lt;br /&gt;
** stores assignment settings&lt;br /&gt;
** now stores whether rubric varies by topic&lt;br /&gt;
* '''ProjectTopic'''&lt;br /&gt;
** stores topics for an assignment&lt;br /&gt;
* '''SignedUpTeam'''&lt;br /&gt;
** stores which topic a team selected&lt;br /&gt;
* '''AssignmentQuestionnaire'''&lt;br /&gt;
** stores which questionnaire is used for an assignment&lt;br /&gt;
** now can also store which topic that mapping belongs to&lt;br /&gt;
* '''ReviewResponseMap'''&lt;br /&gt;
** stores who reviews whom&lt;br /&gt;
* '''Response'''&lt;br /&gt;
** stores the actual review response&lt;br /&gt;
* '''ReviewResetArchive'''&lt;br /&gt;
** stores old reviews when rubric changes make them invalid&lt;br /&gt;
&lt;br /&gt;
== UML Diagram ==&lt;br /&gt;
&lt;br /&gt;
Add the final class diagram here.&lt;br /&gt;
&lt;br /&gt;
[[File:E2605_class_diagram.png|800px|center|Class diagram for topic-based rubric selection]]&lt;br /&gt;
&lt;br /&gt;
== Sequence Diagram ==&lt;br /&gt;
&lt;br /&gt;
Add the final sequence diagram here.&lt;br /&gt;
&lt;br /&gt;
Suggested sequence:&lt;br /&gt;
&lt;br /&gt;
* reviewer opens a review&lt;br /&gt;
* frontend sends &amp;lt;code&amp;gt;response_map_id&amp;lt;/code&amp;gt; and round to backend&lt;br /&gt;
* backend finds the reviewee team&lt;br /&gt;
* backend finds the team’s confirmed topic&lt;br /&gt;
* backend finds the correct assignment questionnaire&lt;br /&gt;
* backend returns the resolved rubric&lt;br /&gt;
&lt;br /&gt;
[[File:E2605_sequence_diagram.png|800px|center|Sequence diagram for rubric lookup]]&lt;br /&gt;
&lt;br /&gt;
== Original Design ==&lt;br /&gt;
&lt;br /&gt;
The original design was based on a small change to the current rubric system.&lt;br /&gt;
&lt;br /&gt;
=== Original Schema Design ===&lt;br /&gt;
&lt;br /&gt;
The original plan was to add:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;assignments.vary_by_topic&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;assignment_questionnaires.project_topic_id&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The meaning was:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;project_topic_id = NULL&amp;lt;/code&amp;gt; means the mapping is the default rubric for the assignment&lt;br /&gt;
* &amp;lt;code&amp;gt;project_topic_id = some topic id&amp;lt;/code&amp;gt; means the mapping is for that topic&lt;br /&gt;
&lt;br /&gt;
=== Original Lookup Design ===&lt;br /&gt;
&lt;br /&gt;
The original lookup order was:&lt;br /&gt;
&lt;br /&gt;
# topic + current round&lt;br /&gt;
# topic + default round&lt;br /&gt;
# default topic + current round&lt;br /&gt;
# default topic + default round&lt;br /&gt;
&lt;br /&gt;
Here:&lt;br /&gt;
&lt;br /&gt;
* '''default topic''' means &amp;lt;code&amp;gt;project_topic_id IS NULL&amp;lt;/code&amp;gt;&lt;br /&gt;
* '''default round''' means &amp;lt;code&amp;gt;used_in_round IS NULL&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This keeps lookup clear when both topic variation and round variation are enabled.&lt;br /&gt;
&lt;br /&gt;
=== Original UI Design ===&lt;br /&gt;
&lt;br /&gt;
The original UI plan was:&lt;br /&gt;
&lt;br /&gt;
* instructor enables topic-based review rubric variation&lt;br /&gt;
* instructor chooses topic-specific review rubrics in the assignment editor&lt;br /&gt;
* if round variation is enabled, the instructor can also choose rubrics by topic and round&lt;br /&gt;
&lt;br /&gt;
== What We Implemented ==&lt;br /&gt;
&lt;br /&gt;
The final implementation follows the original design, but also adds some extra support that was needed to make the feature work in the real system.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;width:100%;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Area&lt;br /&gt;
! Original Design&lt;br /&gt;
! What We Implemented&lt;br /&gt;
|-&lt;br /&gt;
| Assignment setting&lt;br /&gt;
| Add topic variation flag&lt;br /&gt;
| Added &amp;lt;code&amp;gt;vary_by_topic&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;assignments&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Rubric mapping&lt;br /&gt;
| Add topic id to assignment-questionnaire mapping&lt;br /&gt;
| Added &amp;lt;code&amp;gt;project_topic_id&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;assignment_questionnaires&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Rubric lookup&lt;br /&gt;
| Find rubric from topic and round&lt;br /&gt;
| Added shared lookup logic in &amp;lt;code&amp;gt;TopicBasedRubricLookup&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Instructor UI&lt;br /&gt;
| Configure topic rubrics in assignment editor&lt;br /&gt;
| Added topic rubric controls in the React assignment editor&lt;br /&gt;
|-&lt;br /&gt;
| Reload existing data&lt;br /&gt;
| Not described in detail&lt;br /&gt;
| Added serializer and frontend transformation logic so saved mappings reload correctly&lt;br /&gt;
|-&lt;br /&gt;
| Reviewer flow&lt;br /&gt;
| Reviewer gets correct rubric automatically&lt;br /&gt;
| Backend resolves rubric and frontend shows the resolved rubric information&lt;br /&gt;
|-&lt;br /&gt;
| Rubric changes after reviews start&lt;br /&gt;
| Mentioned as a concern&lt;br /&gt;
| Implemented archive, email notification, and review reset logic&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Schema Changes ==&lt;br /&gt;
&lt;br /&gt;
=== 1. &amp;lt;code&amp;gt;assignments.vary_by_topic&amp;lt;/code&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
A new boolean field was added to the assignments table.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot;&amp;gt;&lt;br /&gt;
add_column :assignments, :vary_by_topic, :boolean, default: false, null: false&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This means:&lt;br /&gt;
&lt;br /&gt;
* old assignments still work the same way&lt;br /&gt;
* topic-based rubric selection happens only when the instructor enables it&lt;br /&gt;
&lt;br /&gt;
=== 2. &amp;lt;code&amp;gt;assignment_questionnaires.project_topic_id&amp;lt;/code&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
A new nullable topic reference was added to &amp;lt;code&amp;gt;assignment_questionnaires&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot;&amp;gt;&lt;br /&gt;
add_reference :assignment_questionnaires, :project_topic, foreign_key: true, null: true&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This lets the same table store:&lt;br /&gt;
&lt;br /&gt;
* default assignment review rubric&lt;br /&gt;
* topic-specific review rubric&lt;br /&gt;
* round-based review rubric&lt;br /&gt;
* topic-and-round-specific review rubric&lt;br /&gt;
&lt;br /&gt;
=== 3. Indexes ===&lt;br /&gt;
&lt;br /&gt;
Indexes were added so the system can quickly find the correct rubric.&lt;br /&gt;
&lt;br /&gt;
The most important lookup index is on:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;assignment_id&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;project_topic_id&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;used_in_round&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== 4. Review Archive Table ===&lt;br /&gt;
&lt;br /&gt;
A new table was added:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;review_reset_archives&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This table stores old reviews when a rubric change makes those reviews no longer valid.&lt;br /&gt;
&lt;br /&gt;
It stores:&lt;br /&gt;
&lt;br /&gt;
* response id&lt;br /&gt;
* response map id&lt;br /&gt;
* assignment id&lt;br /&gt;
* questionnaire id&lt;br /&gt;
* topic id&lt;br /&gt;
* round&lt;br /&gt;
* reviewer id&lt;br /&gt;
* reviewee id&lt;br /&gt;
* reset reason&lt;br /&gt;
* snapshot data&lt;br /&gt;
&lt;br /&gt;
== Rubric Lookup Design ==&lt;br /&gt;
&lt;br /&gt;
The final lookup logic is placed in a shared concern:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;app/models/concerns/topic_based_rubric_lookup.rb&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This concern is included in the &amp;lt;code&amp;gt;Assignment&amp;lt;/code&amp;gt; model.&lt;br /&gt;
&lt;br /&gt;
=== Main Lookup Method ===&lt;br /&gt;
&lt;br /&gt;
The main method is:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;assignment_questionnaire_for_response_map(response_map, round:)&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This method is used to find the correct rubric for a review.&lt;br /&gt;
&lt;br /&gt;
=== Reviewee Topic Lookup ===&lt;br /&gt;
&lt;br /&gt;
When the response map is a &amp;lt;code&amp;gt;ReviewResponseMap&amp;lt;/code&amp;gt;, the system does this:&lt;br /&gt;
&lt;br /&gt;
# finds the reviewee team&lt;br /&gt;
# finds that team’s confirmed topic signup&lt;br /&gt;
# ignores waitlisted signups&lt;br /&gt;
# uses that topic id in rubric lookup&lt;br /&gt;
&lt;br /&gt;
The method used is:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;confirmed_topic_id_for(reviewee)&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Lookup Order ===&lt;br /&gt;
&lt;br /&gt;
The final lookup order is still:&lt;br /&gt;
&lt;br /&gt;
# topic + current round&lt;br /&gt;
# topic + default round&lt;br /&gt;
# assignment default topic + current round&lt;br /&gt;
# assignment default topic + default round&lt;br /&gt;
&lt;br /&gt;
This keeps rubric selection simple and predictable.&lt;br /&gt;
&lt;br /&gt;
== Original vs Final Lookup Code ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;width:100%;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Before&lt;br /&gt;
! After&lt;br /&gt;
|-&lt;br /&gt;
| Topic-based lookup did not exist.&lt;br /&gt;
| &amp;lt;code&amp;gt;Assignment&amp;lt;/code&amp;gt; now includes &amp;lt;code&amp;gt;TopicBasedRubricLookup&amp;lt;/code&amp;gt; and uses topic-aware rubric resolution.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Final Lookup Code ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot;&amp;gt;&lt;br /&gt;
def assignment_questionnaire_for_response_map(response_map, round:)&lt;br /&gt;
  return assignment_questionnaires.find_by(used_in_round: round) unless response_map.is_a?(ReviewResponseMap)&lt;br /&gt;
&lt;br /&gt;
  review_assignment_questionnaire(response_map, round) || assignment_questionnaires.find_by(used_in_round: round)&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Model Validation ==&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;AssignmentQuestionnaire&amp;lt;/code&amp;gt; model now validates two important things.&lt;br /&gt;
&lt;br /&gt;
=== 1. Topic Must Belong to the Same Assignment ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot;&amp;gt;&lt;br /&gt;
def project_topic_belongs_to_assignment&lt;br /&gt;
  return if project_topic_id.blank? || assignment_id.blank?&lt;br /&gt;
  return if project_topic&amp;amp;.assignment_id == assignment_id&lt;br /&gt;
&lt;br /&gt;
  errors.add(:project_topic, 'must belong to the same assignment')&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This prevents a topic from one assignment from being used in another assignment’s rubric mapping.&lt;br /&gt;
&lt;br /&gt;
=== 2. No Duplicate Review Mapping for the Same Assignment, Topic, and Round ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot;&amp;gt;&lt;br /&gt;
def unique_review_rubric_for_assignment_topic_round&lt;br /&gt;
  return unless review_questionnaire?&lt;br /&gt;
&lt;br /&gt;
  duplicate = AssignmentQuestionnaire&lt;br /&gt;
              .joins(:questionnaire)&lt;br /&gt;
              .where(&lt;br /&gt;
                assignment_id: assignment_id,&lt;br /&gt;
                project_topic_id: project_topic_id,&lt;br /&gt;
                used_in_round: used_in_round,&lt;br /&gt;
                questionnaires: { questionnaire_type: 'ReviewQuestionnaire' }&lt;br /&gt;
              )&lt;br /&gt;
  duplicate = duplicate.where.not(id: id) if persisted?&lt;br /&gt;
&lt;br /&gt;
  errors.add(:base, 'review rubric already exists for this assignment, topic, and round') if duplicate.exists?&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This makes sure lookup returns one correct rubric.&lt;br /&gt;
&lt;br /&gt;
== Backend Controller and API Changes ==&lt;br /&gt;
&lt;br /&gt;
=== Assignment Save and Reload ===&lt;br /&gt;
&lt;br /&gt;
To support this feature, the assignment edit flow had to save and reload more data.&lt;br /&gt;
&lt;br /&gt;
The backend now permits:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;vary_by_topic&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;vary_by_round&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;rounds_of_reviews&amp;lt;/code&amp;gt;&lt;br /&gt;
* nested &amp;lt;code&amp;gt;assignment_questionnaires_attributes&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;Assignment&amp;lt;/code&amp;gt; model also now accepts nested questionnaire mappings:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;ruby&amp;quot;&amp;gt;&lt;br /&gt;
accepts_nested_attributes_for :assignment_questionnaires, allow_destroy: true&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Assignment Serializer ===&lt;br /&gt;
&lt;br /&gt;
The assignment serializer now returns:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;vary_by_topic&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;assignment_questionnaires&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;due_dates&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;num_review_rounds&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is needed so the frontend can reopen an assignment and show the saved topic and round rubric settings.&lt;br /&gt;
&lt;br /&gt;
=== Topic Rubric Mapping API ===&lt;br /&gt;
&lt;br /&gt;
The final implementation adds a dedicated controller for topic-rubric mappings:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;AssignmentQuestionnairesController#index&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;AssignmentQuestionnairesController#create&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;AssignmentQuestionnairesController#update&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;AssignmentQuestionnairesController#destroy&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This API is used by the React assignment editor.&lt;br /&gt;
&lt;br /&gt;
=== Reviewer Rubric Lookup API ===&lt;br /&gt;
&lt;br /&gt;
The backend also adds:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;StudentTasksController#rubric_for&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This endpoint returns:&lt;br /&gt;
&lt;br /&gt;
* assignment questionnaire id&lt;br /&gt;
* questionnaire id&lt;br /&gt;
* questionnaire name&lt;br /&gt;
* topic id&lt;br /&gt;
* round&lt;br /&gt;
&lt;br /&gt;
This gives the frontend a way to ask: “Which rubric did the backend choose for this review?”&lt;br /&gt;
&lt;br /&gt;
== Original vs Final API Design ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;width:100%;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Before&lt;br /&gt;
! After&lt;br /&gt;
|-&lt;br /&gt;
| No API for topic-rubric mappings.&lt;br /&gt;
| Added CRUD API in &amp;lt;code&amp;gt;AssignmentQuestionnairesController&amp;lt;/code&amp;gt;.&lt;br /&gt;
|-&lt;br /&gt;
| No endpoint to ask which rubric was resolved for a review.&lt;br /&gt;
| Added &amp;lt;code&amp;gt;/student_tasks/rubric_for&amp;lt;/code&amp;gt;.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Frontend Design ==&lt;br /&gt;
&lt;br /&gt;
The topic-based rubric feature is configured in the React assignment editor.&lt;br /&gt;
&lt;br /&gt;
Main frontend files are:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;src/pages/Assignments/AssignmentUtil.ts&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;src/pages/Assignments/AssignmentEditor.tsx&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;src/pages/Assignments/tabs/TopicsTab.tsx&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Instructor Workflow ===&lt;br /&gt;
&lt;br /&gt;
The instructor workflow is:&lt;br /&gt;
&lt;br /&gt;
# open assignment editor&lt;br /&gt;
# enable topic-based rubric variation&lt;br /&gt;
# optionally enable round-based rubric variation&lt;br /&gt;
# go to Topics tab&lt;br /&gt;
# choose the review rubric for each topic&lt;br /&gt;
# save the assignment&lt;br /&gt;
&lt;br /&gt;
If round variation is also enabled, the instructor can choose a rubric for each topic and round.&lt;br /&gt;
&lt;br /&gt;
=== Request Transformation ===&lt;br /&gt;
&lt;br /&gt;
The frontend now maps the form fields back to backend assignment fields.&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;typescript&amp;quot;&amp;gt;&lt;br /&gt;
vary_by_round: values.review_rubric_varies_by_round,&lt;br /&gt;
vary_by_topic: values.review_rubric_varies_by_topic,&lt;br /&gt;
rounds_of_reviews: values.number_of_review_rounds,&lt;br /&gt;
assignment_questionnaires_attributes: assignmentQuestionnaires,&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Response Transformation ===&lt;br /&gt;
&lt;br /&gt;
When loading an assignment, the frontend now restores:&lt;br /&gt;
&lt;br /&gt;
* whether rubric varies by topic&lt;br /&gt;
* whether rubric varies by round&lt;br /&gt;
* number of review rounds&lt;br /&gt;
* saved assignment-questionnaire mappings&lt;br /&gt;
* due dates&lt;br /&gt;
&lt;br /&gt;
This allows saved rubric settings to appear again when editing the assignment later.&lt;br /&gt;
&lt;br /&gt;
== Original vs Final Frontend Design ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;width:100%;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Before&lt;br /&gt;
! After&lt;br /&gt;
|-&lt;br /&gt;
| No topic-rubric controls in assignment editor.&lt;br /&gt;
| Added topic-rubric controls in the Topics tab.&lt;br /&gt;
|-&lt;br /&gt;
| Assignment editor did not save topic rubric settings.&lt;br /&gt;
| Assignment editor now saves &amp;lt;code&amp;gt;vary_by_topic&amp;lt;/code&amp;gt; and topic-based mappings.&lt;br /&gt;
|-&lt;br /&gt;
| Assignment editor did not reload topic rubric settings cleanly.&lt;br /&gt;
| Serializer and frontend transformation now reload saved mappings.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Questionnaire UI Support ==&lt;br /&gt;
&lt;br /&gt;
The original design assumed instructors could already create the review rubrics they needed.&lt;br /&gt;
&lt;br /&gt;
In practice, the React questionnaire UI needed some fixes.&lt;br /&gt;
&lt;br /&gt;
The final implementation adds:&lt;br /&gt;
&lt;br /&gt;
* correct mapping for the Review questionnaire type&lt;br /&gt;
* working edit navigation path for questionnaires&lt;br /&gt;
* item type loading from &amp;lt;code&amp;gt;/questions/types&amp;lt;/code&amp;gt;&lt;br /&gt;
* fallback item type list when needed&lt;br /&gt;
&lt;br /&gt;
This was important because the feature is only useful if instructors can create review rubrics in the frontend.&lt;br /&gt;
&lt;br /&gt;
== Review Reset and Archive Design ==&lt;br /&gt;
&lt;br /&gt;
== Why This Was Needed ==&lt;br /&gt;
&lt;br /&gt;
If an instructor changes a rubric after reviews have already started, the old reviews may no longer match the new rubric.&lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
&lt;br /&gt;
* a topic is mapped to a different review rubric&lt;br /&gt;
* a review questionnaire is edited&lt;br /&gt;
* a question inside a review questionnaire is added, updated, or deleted&lt;br /&gt;
&lt;br /&gt;
In these cases, the old completed reviews should not stay active as if nothing changed.&lt;br /&gt;
&lt;br /&gt;
But at the same time, the old student work should not be lost.&lt;br /&gt;
&lt;br /&gt;
== Final Reset Design ==&lt;br /&gt;
&lt;br /&gt;
The final implementation adds a shared concern:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;app/controllers/concerns/review_reset_handler.rb&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This concern does four things:&lt;br /&gt;
&lt;br /&gt;
# find the affected reviews&lt;br /&gt;
# archive the old review data&lt;br /&gt;
# notify reviewers that they must redo the review&lt;br /&gt;
# delete the old live responses&lt;br /&gt;
&lt;br /&gt;
== Review Archive ==&lt;br /&gt;
&lt;br /&gt;
The archived review stores:&lt;br /&gt;
&lt;br /&gt;
* response details&lt;br /&gt;
* questionnaire details&lt;br /&gt;
* reviewer and reviewee ids&lt;br /&gt;
* topic id&lt;br /&gt;
* round&lt;br /&gt;
* comments&lt;br /&gt;
* answers&lt;br /&gt;
* item text&lt;br /&gt;
* item type&lt;br /&gt;
* scores&lt;br /&gt;
* reset reason&lt;br /&gt;
&lt;br /&gt;
This means the system keeps the student’s old completed work in the database.&lt;br /&gt;
&lt;br /&gt;
== Reset Cases Implemented ==&lt;br /&gt;
&lt;br /&gt;
The following changes now trigger archive + reset:&lt;br /&gt;
&lt;br /&gt;
* topic-rubric mapping created&lt;br /&gt;
* topic-rubric mapping updated&lt;br /&gt;
* topic-rubric mapping deleted&lt;br /&gt;
* review questionnaire updated&lt;br /&gt;
* question created in a review questionnaire&lt;br /&gt;
* question updated in a review questionnaire&lt;br /&gt;
* question deleted from a review questionnaire&lt;br /&gt;
* all questions deleted from a review questionnaire&lt;br /&gt;
&lt;br /&gt;
== Original vs Final Review-Reset Design ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;width:100%;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Original Design&lt;br /&gt;
! Final Implementation&lt;br /&gt;
|-&lt;br /&gt;
| Mentioned that old reviews should not stay valid after rubric changes.&lt;br /&gt;
| Fully implemented archive + email + reset behavior.&lt;br /&gt;
|-&lt;br /&gt;
| Did not say where old reviews would be stored.&lt;br /&gt;
| Added &amp;lt;code&amp;gt;review_reset_archives&amp;lt;/code&amp;gt; table with full snapshot data.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Reviewer View ==&lt;br /&gt;
&lt;br /&gt;
The reviewer does not pick a rubric manually.&lt;br /&gt;
&lt;br /&gt;
Instead:&lt;br /&gt;
&lt;br /&gt;
# reviewer opens a review&lt;br /&gt;
# frontend sends &amp;lt;code&amp;gt;response_map_id&amp;lt;/code&amp;gt; and optional round&lt;br /&gt;
# backend finds the correct rubric&lt;br /&gt;
# frontend receives the resolved rubric details&lt;br /&gt;
&lt;br /&gt;
The React review page now shows:&lt;br /&gt;
&lt;br /&gt;
* resolved questionnaire name&lt;br /&gt;
* topic id, if topic-specific&lt;br /&gt;
* round, if round-specific&lt;br /&gt;
&lt;br /&gt;
This gives clear proof that the backend selected a rubric.&lt;br /&gt;
&lt;br /&gt;
== Known Limitation ==&lt;br /&gt;
&lt;br /&gt;
The current review page does '''not yet''' fully render the actual questionnaire items from the resolved rubric.&lt;br /&gt;
&lt;br /&gt;
So:&lt;br /&gt;
&lt;br /&gt;
* the backend does resolve the correct rubric&lt;br /&gt;
* the frontend does show which rubric was resolved&lt;br /&gt;
* but the review page still uses mostly static review content&lt;br /&gt;
&lt;br /&gt;
This is a known limit of the current implementation.&lt;br /&gt;
&lt;br /&gt;
== Testing ==&lt;br /&gt;
&lt;br /&gt;
=== Backend Tests ===&lt;br /&gt;
&lt;br /&gt;
Backend tests were added for:&lt;br /&gt;
&lt;br /&gt;
* topic-rubric mapping API&lt;br /&gt;
* topic-aware rubric lookup&lt;br /&gt;
* archive and reset behavior after rubric changes&lt;br /&gt;
&lt;br /&gt;
Main backend test files include:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;spec/controllers/assignment_questionnaires_controller_spec.rb&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;spec/controllers/questionnaires_controller_spec.rb&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;spec/controllers/student_tasks_controller_spec.rb&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;spec/models/assignment_spec.rb&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Frontend Tests ===&lt;br /&gt;
&lt;br /&gt;
Frontend tests were added for:&lt;br /&gt;
&lt;br /&gt;
* assignment request mapping for &amp;lt;code&amp;gt;vary_by_topic&amp;lt;/code&amp;gt;&lt;br /&gt;
* assignment response mapping for &amp;lt;code&amp;gt;vary_by_topic&amp;lt;/code&amp;gt;&lt;br /&gt;
* topic tab rubric behavior&lt;br /&gt;
* questionnaire type mapping&lt;br /&gt;
&lt;br /&gt;
Main frontend test files include:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;src/pages/Assignments/AssignmentEditor.test.tsx&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;src/pages/Assignments/tabs/TopicsTab.test.tsx&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;src/pages/Questionnaires/QuestionnaireUtils.test.ts&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Manual Testing ===&lt;br /&gt;
&lt;br /&gt;
The following manual cases were also checked:&lt;br /&gt;
&lt;br /&gt;
* topic-based rubric selection can be saved&lt;br /&gt;
* saved topic-rubric mappings reload correctly&lt;br /&gt;
* topic and round fallback order works&lt;br /&gt;
* waitlisted signups do not affect rubric lookup&lt;br /&gt;
* old completed reviews are archived when the rubric changes&lt;br /&gt;
* reviewers are notified and old live reviews are reset&lt;br /&gt;
&lt;br /&gt;
== Risks ==&lt;br /&gt;
&lt;br /&gt;
The main risks in this project were:&lt;br /&gt;
&lt;br /&gt;
* unclear rubric precedence&lt;br /&gt;
* incomplete topic-rubric setup&lt;br /&gt;
* mixing topic-based and round-based rules&lt;br /&gt;
* losing student work when rubrics change&lt;br /&gt;
&lt;br /&gt;
These were handled by:&lt;br /&gt;
&lt;br /&gt;
* a strict lookup order&lt;br /&gt;
* validation in the mapping model&lt;br /&gt;
* safe fallback behavior&lt;br /&gt;
* review archiving before reset&lt;br /&gt;
&lt;br /&gt;
== Known Limits ==&lt;br /&gt;
&lt;br /&gt;
The current implementation still has some limits:&lt;br /&gt;
&lt;br /&gt;
* the review page does not yet fully render the real questionnaire items dynamically&lt;br /&gt;
* archived reviews are stored in the database, but there is no frontend page to view them&lt;br /&gt;
* the current main-branch implementation allows one review rubric per topic per round&lt;br /&gt;
&lt;br /&gt;
== Design Principles Used ==&lt;br /&gt;
&lt;br /&gt;
The project uses these design ideas:&lt;br /&gt;
&lt;br /&gt;
* '''Single Responsibility Principle'''&lt;br /&gt;
** rubric lookup is placed in &amp;lt;code&amp;gt;TopicBasedRubricLookup&amp;lt;/code&amp;gt;&lt;br /&gt;
** review reset logic is placed in &amp;lt;code&amp;gt;ReviewResetHandler&amp;lt;/code&amp;gt;&lt;br /&gt;
** assignment request/response conversion is placed in frontend utility code&lt;br /&gt;
&lt;br /&gt;
* '''Separation of Concerns'''&lt;br /&gt;
** backend decides which rubric to use&lt;br /&gt;
** frontend lets the instructor configure topic mappings&lt;br /&gt;
** model validation keeps data safe&lt;br /&gt;
&lt;br /&gt;
* '''Backward Compatibility'''&lt;br /&gt;
** assignments that do not enable topic variation still work the old way&lt;br /&gt;
&lt;br /&gt;
* '''Deterministic Behavior'''&lt;br /&gt;
** the same topic and round always follow the same lookup order&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
&lt;br /&gt;
* Ed Gehringer&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
&lt;br /&gt;
* Vanaja Agarwal&lt;br /&gt;
* Himashu Agarwal&lt;br /&gt;
* Bhargavi Jadhav&lt;br /&gt;
&lt;br /&gt;
== Links ==&lt;br /&gt;
&lt;br /&gt;
Pull Requests:&lt;br /&gt;
* https://github.com/expertiza/reimplementation-back-end/pull/325&lt;br /&gt;
* https://github.com/expertiza/reimplementation-front-end/pull/166&lt;br /&gt;
&lt;br /&gt;
Demo Video:&lt;br /&gt;
* Add demo video link here&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
* [https://wiki.expertiza.ncsu.edu Expertiza Wiki]&lt;br /&gt;
* [https://github.com/expertiza/reimplementation-back-end Reimplementation Backend Repository]&lt;br /&gt;
* [https://github.com/expertiza/reimplementation-front-end Reimplementation Frontend Repository]&lt;/div&gt;</summary>
		<author><name>Vagarwa3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2026_-_E2605._Specialized_Rubrics_for_Different_Topic_Types&amp;diff=167965</id>
		<title>CSC/ECE 517 Spring 2026 - E2605. Specialized Rubrics for Different Topic Types</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2026_-_E2605._Specialized_Rubrics_for_Different_Topic_Types&amp;diff=167965"/>
		<updated>2026-04-15T23:59:20Z</updated>

		<summary type="html">&lt;p&gt;Vagarwa3: /* API and Validation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__TOC__&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
&lt;br /&gt;
This wiki page presents the design for Expertiza project '''E2605: Specialized Rubrics for Different Topic Types''' for CSC/ECE 517 Object-Oriented Design and Development, Spring 2026.&lt;br /&gt;
&lt;br /&gt;
The goal of this project is to let instructors use different review rubrics for different project topics within the same assignment. Expertiza currently uses the same review rubric for all submissions in an assignment, unless the assignment is configured to use different rubrics in different review rounds. This works for assignments where every topic should be evaluated with the same criteria, but it does not work well when topics require different kinds of evaluation.&lt;br /&gt;
&lt;br /&gt;
For example, an assignment might include topics related to user-interface design, machine learning, and security. A security topic may need rubric questions about threat modeling or vulnerability analysis, while a user-interface topic may need rubric questions about usability and design quality. Topic-based rubric selection allows the rubric to match the topic of the submission being reviewed.&lt;br /&gt;
&lt;br /&gt;
This document describes the motivation for the change, the proposed data model, the instructor workflow, and how Expertiza will resolve the correct review rubric based on assignment, topic, and review-round information.&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
&lt;br /&gt;
This design adds topic-based review rubric selection while keeping existing behavior for assignments where topic-based rubric selection is not enabled. Instructors will associate review rubrics with topics directly from the Topics tab of Assignment creation, using dropdowns. If an assignment is configured to vary by topic, the review rubric is chosen based on the topic of the submission that is being reviewed. If topic variation is not enabled, rubric selection follows the current assignment and round logic.&lt;br /&gt;
&lt;br /&gt;
A [[Response maps|ReviewResponseMap]] identifies the team whose submission is being reviewed. The [[Signed up teams|signed_up_teams]] table identifies which topic that team selected. The [[Assignments questionnaires|assignments_questionnaires]] table will then identify which review rubric should be used for that assignment and topic.&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
&lt;br /&gt;
Different project topics can require different evaluation criteria, but currently all submissions for an assignment use the same review rubric unless round-based rubric variation is configured. The current tables do not yet store which review rubric should be used for each topic, and there is no assignment flag for topic-based rubric variation. Because of this, reviewers can receive rubrics that do not match the reviewed team's topic.&lt;br /&gt;
&lt;br /&gt;
== Design Goals ==&lt;br /&gt;
&lt;br /&gt;
The goal is to let instructors define topic-specific review rubrics without changing the overall review workflow. The design must preserve backward compatibility for existing assignments, continue to support round-based variation, and keep rubric resolution deterministic when both round and topic variation are enabled.&lt;br /&gt;
&lt;br /&gt;
== Non-Goals ==&lt;br /&gt;
&lt;br /&gt;
This change does not redesign topic signup or waitlist behavior, questionnaire authoring or import, or review mapping strategies. It only changes how the system stores and resolves rubric selection for reviews.&lt;br /&gt;
&lt;br /&gt;
== Current State ==&lt;br /&gt;
&lt;br /&gt;
The existing data model already includes the relationships needed to determine a reviewee team's topic. The [[Signed up teams|signed_up_teams]] table identifies which team has selected which topic, and review mappings already identify the reviewee team. Rubric resolution currently happens in several places, including response and scoring code paths, and is mainly driven by assignment and round context.&lt;br /&gt;
&lt;br /&gt;
The current tables do not yet store all the information needed for topic-based rubric selection. Assignments currently include &amp;lt;code&amp;gt;vary_by_round&amp;lt;/code&amp;gt; but no equivalent &amp;lt;code&amp;gt;vary_by_topic&amp;lt;/code&amp;gt; flag, and [[Assignments questionnaires|assignments_questionnaires]] records do not have a &amp;lt;code&amp;gt;project_topic_id&amp;lt;/code&amp;gt; foreign key.&lt;br /&gt;
&lt;br /&gt;
== Proposed Data Model ==&lt;br /&gt;
&lt;br /&gt;
This design introduces minimal extensions to the existing schema while reusing the current rubric infrastructure. A new &amp;lt;code&amp;gt;vary_by_topic&amp;lt;/code&amp;gt; boolean field is added to the assignments table with a default value of false. This ensures that existing assignments continue to function without any changes, and instructors can explicitly enable topic-based rubric variation only when needed.&lt;br /&gt;
&lt;br /&gt;
The [[Assignments questionnaires|assignments_questionnaires]] table indicates which rubrics are used for an assignment. Adding &amp;lt;code&amp;gt;project_topic_id&amp;lt;/code&amp;gt; allows one of those rubric records to apply to a specific topic instead of applying to the whole assignment. A project topic will normally have at most one review-rubric mapping, or one per round if round-based variation is enabled.&lt;br /&gt;
&lt;br /&gt;
In addition, an optional &amp;lt;code&amp;gt;project_topic_id&amp;lt;/code&amp;gt; foreign key is added to the [[Assignments questionnaires|assignments_questionnaires]] table. A null &amp;lt;code&amp;gt;project_topic_id&amp;lt;/code&amp;gt; represents the default review rubric for the assignment. This approach allows topic-specific mappings to coexist naturally with round-based mappings through &amp;lt;code&amp;gt;used_in_round&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Indexes should be added on the new topic field and on the fields used for rubric lookup so that Expertiza can efficiently find the correct rubric for an assignment, topic, and round.&lt;br /&gt;
&lt;br /&gt;
No new questionnaire type is introduced. The new &amp;lt;code&amp;gt;project_topic_id&amp;lt;/code&amp;gt; field only connects an existing assignment-rubric record to a topic, and the rubric itself remains the existing questionnaire referenced by &amp;lt;code&amp;gt;questionnaire_id&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Rubric Resolution Behavior ==&lt;br /&gt;
&lt;br /&gt;
Rubric selection remains within existing Expertiza code paths. The workflow proceeds by resolving the assignment from the response map, determining whether topic variation is enabled, and, if so, resolving the reviewee team's topic. The system then looks for the best matching assignment questionnaire for that assignment, topic, and round context.&lt;br /&gt;
&lt;br /&gt;
When both round and topic variation are active, matching is deterministic. The precedence is: assignment/topic/current round, then assignment/topic/default round, then assignment/default topic/current round, and finally assignment/default topic/default round. In this precedence rule, the default topic corresponds to &amp;lt;code&amp;gt;project_topic_id&amp;lt;/code&amp;gt; being null, and the default round corresponds to &amp;lt;code&amp;gt;used_in_round&amp;lt;/code&amp;gt; being null.&lt;br /&gt;
&lt;br /&gt;
If no topic-specific mapping is found, the system falls back according to the defined precedence, using default round-specific rubrics for the assignment when applicable, before using the default review rubric for the assignment.&lt;br /&gt;
&lt;br /&gt;
Only the reviewee team's confirmed topic signup for the current assignment is considered, and waitlisted topic signups do not determine rubric selection.&lt;br /&gt;
&lt;br /&gt;
== UI and Instructor Workflow ==&lt;br /&gt;
&lt;br /&gt;
[[File:E2605architecture.png|800px|center|Figure: Rubric resolution architecture]]&lt;br /&gt;
&lt;br /&gt;
Instructors configure topic-based rubrics directly in assignment setup on the Topics tab. For each topic, the UI exposes dropdowns for selecting the review rubric, and when &amp;lt;code&amp;gt;vary_by_round&amp;lt;/code&amp;gt; is enabled, round-specific rubric choices are also supported. This approach keeps all configuration within the standard assignment authoring flow and avoids introducing any external components.&lt;br /&gt;
&lt;br /&gt;
The existing default review rubric for the assignment remains available as the fallback when a topic-specific rubric is not configured. Reviewers do not choose the rubric themselves; instead, they receive the questionnaire resolved automatically for the team they are reviewing.&lt;br /&gt;
&lt;br /&gt;
== API and Validation ==&lt;br /&gt;
&lt;br /&gt;
Assignment create and update flows persist &amp;lt;code&amp;gt;vary_by_topic&amp;lt;/code&amp;gt;. Assignment questionnaire updates accept an optional &amp;lt;code&amp;gt;project_topic_id&amp;lt;/code&amp;gt; and validate that the topic belongs to the same assignment.&lt;br /&gt;
&lt;br /&gt;
Validation ensures that &amp;lt;code&amp;gt;project_topic_id&amp;lt;/code&amp;gt; references an existing topic and does not cross assignment boundaries. The system also prevents duplicate review-rubric mappings for the same assignment, topic, and round combination, ensuring that rubric resolution always produces a single correct result.&lt;br /&gt;
&lt;br /&gt;
Only instructors or administrators who can edit the assignment are allowed to enable topic-based rubric variation or modify topic-rubric mappings.&lt;br /&gt;
&lt;br /&gt;
== Testing Strategy ==&lt;br /&gt;
&lt;br /&gt;
Tests verify that assignments without topic variation remain unchanged, while topic-enabled assignments correctly select topic-specific rubrics when configured. They also ensure that fallback behavior functions properly when a team has no topic or no topic-specific rubric mapping.&lt;br /&gt;
&lt;br /&gt;
Additional tests confirm deterministic precedence when both topic and round variation are enabled and ensure that scoring behavior remains consistent with the selected questionnaire.&lt;br /&gt;
&lt;br /&gt;
== Risks ==&lt;br /&gt;
&lt;br /&gt;
The main risk is ambiguity in precedence when both topic and round variation are present. This is mitigated by defining a strict lookup order and enforcing it through testing. Another risk is partial configuration, where topic variation is enabled but mappings are incomplete; this is mitigated by safe fallback behavior and validation in configuration paths.&lt;br /&gt;
&lt;br /&gt;
== Rubric Changes After Reviews Begin ==&lt;br /&gt;
&lt;br /&gt;
If an instructor changes a topic-rubric mapping after reviews have already begun, existing reviews that used the previous rubric should not remain valid. Since the rubric determines the questions and scoring criteria for a review, changing the rubric can make previously submitted reviews inconsistent with the new configuration.&lt;br /&gt;
&lt;br /&gt;
When a topic-rubric mapping is changed after reviews have been performed, the affected reviews should be deleted, and the affected reviewers should be notified that they need to perform the reviews again using the updated rubric.&lt;br /&gt;
&lt;br /&gt;
== Implementation Notes ==&lt;br /&gt;
&lt;br /&gt;
Implementation focuses on schema changes, shared internal rubric lookup logic, integration at current rubric selection call sites, user interface support on the Topics tab, and regression coverage for response and scoring paths.&lt;br /&gt;
&lt;br /&gt;
Known integration points include response questionnaire lookup, scoring maximum-score calculation, and any review form initialization path that currently assumes assignment-level rubric selection.&lt;/div&gt;</summary>
		<author><name>Vagarwa3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2026_-_E2605._Specialized_Rubrics_for_Different_Topic_Types&amp;diff=167964</id>
		<title>CSC/ECE 517 Spring 2026 - E2605. Specialized Rubrics for Different Topic Types</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2026_-_E2605._Specialized_Rubrics_for_Different_Topic_Types&amp;diff=167964"/>
		<updated>2026-04-15T23:57:44Z</updated>

		<summary type="html">&lt;p&gt;Vagarwa3: /* Open Questions */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__TOC__&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
&lt;br /&gt;
This wiki page presents the design for Expertiza project '''E2605: Specialized Rubrics for Different Topic Types''' for CSC/ECE 517 Object-Oriented Design and Development, Spring 2026.&lt;br /&gt;
&lt;br /&gt;
The goal of this project is to let instructors use different review rubrics for different project topics within the same assignment. Expertiza currently uses the same review rubric for all submissions in an assignment, unless the assignment is configured to use different rubrics in different review rounds. This works for assignments where every topic should be evaluated with the same criteria, but it does not work well when topics require different kinds of evaluation.&lt;br /&gt;
&lt;br /&gt;
For example, an assignment might include topics related to user-interface design, machine learning, and security. A security topic may need rubric questions about threat modeling or vulnerability analysis, while a user-interface topic may need rubric questions about usability and design quality. Topic-based rubric selection allows the rubric to match the topic of the submission being reviewed.&lt;br /&gt;
&lt;br /&gt;
This document describes the motivation for the change, the proposed data model, the instructor workflow, and how Expertiza will resolve the correct review rubric based on assignment, topic, and review-round information.&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
&lt;br /&gt;
This design adds topic-based review rubric selection while keeping existing behavior for assignments where topic-based rubric selection is not enabled. Instructors will associate review rubrics with topics directly from the Topics tab of Assignment creation, using dropdowns. If an assignment is configured to vary by topic, the review rubric is chosen based on the topic of the submission that is being reviewed. If topic variation is not enabled, rubric selection follows the current assignment and round logic.&lt;br /&gt;
&lt;br /&gt;
A [[Response maps|ReviewResponseMap]] identifies the team whose submission is being reviewed. The [[Signed up teams|signed_up_teams]] table identifies which topic that team selected. The [[Assignments questionnaires|assignments_questionnaires]] table will then identify which review rubric should be used for that assignment and topic.&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
&lt;br /&gt;
Different project topics can require different evaluation criteria, but currently all submissions for an assignment use the same review rubric unless round-based rubric variation is configured. The current tables do not yet store which review rubric should be used for each topic, and there is no assignment flag for topic-based rubric variation. Because of this, reviewers can receive rubrics that do not match the reviewed team's topic.&lt;br /&gt;
&lt;br /&gt;
== Design Goals ==&lt;br /&gt;
&lt;br /&gt;
The goal is to let instructors define topic-specific review rubrics without changing the overall review workflow. The design must preserve backward compatibility for existing assignments, continue to support round-based variation, and keep rubric resolution deterministic when both round and topic variation are enabled.&lt;br /&gt;
&lt;br /&gt;
== Non-Goals ==&lt;br /&gt;
&lt;br /&gt;
This change does not redesign topic signup or waitlist behavior, questionnaire authoring or import, or review mapping strategies. It only changes how the system stores and resolves rubric selection for reviews.&lt;br /&gt;
&lt;br /&gt;
== Current State ==&lt;br /&gt;
&lt;br /&gt;
The existing data model already includes the relationships needed to determine a reviewee team's topic. The [[Signed up teams|signed_up_teams]] table identifies which team has selected which topic, and review mappings already identify the reviewee team. Rubric resolution currently happens in several places, including response and scoring code paths, and is mainly driven by assignment and round context.&lt;br /&gt;
&lt;br /&gt;
The current tables do not yet store all the information needed for topic-based rubric selection. Assignments currently include &amp;lt;code&amp;gt;vary_by_round&amp;lt;/code&amp;gt; but no equivalent &amp;lt;code&amp;gt;vary_by_topic&amp;lt;/code&amp;gt; flag, and [[Assignments questionnaires|assignments_questionnaires]] records do not have a &amp;lt;code&amp;gt;project_topic_id&amp;lt;/code&amp;gt; foreign key.&lt;br /&gt;
&lt;br /&gt;
== Proposed Data Model ==&lt;br /&gt;
&lt;br /&gt;
This design introduces minimal extensions to the existing schema while reusing the current rubric infrastructure. A new &amp;lt;code&amp;gt;vary_by_topic&amp;lt;/code&amp;gt; boolean field is added to the assignments table with a default value of false. This ensures that existing assignments continue to function without any changes, and instructors can explicitly enable topic-based rubric variation only when needed.&lt;br /&gt;
&lt;br /&gt;
The [[Assignments questionnaires|assignments_questionnaires]] table indicates which rubrics are used for an assignment. Adding &amp;lt;code&amp;gt;project_topic_id&amp;lt;/code&amp;gt; allows one of those rubric records to apply to a specific topic instead of applying to the whole assignment. A project topic will normally have at most one review-rubric mapping, or one per round if round-based variation is enabled.&lt;br /&gt;
&lt;br /&gt;
In addition, an optional &amp;lt;code&amp;gt;project_topic_id&amp;lt;/code&amp;gt; foreign key is added to the [[Assignments questionnaires|assignments_questionnaires]] table. A null &amp;lt;code&amp;gt;project_topic_id&amp;lt;/code&amp;gt; represents the default review rubric for the assignment. This approach allows topic-specific mappings to coexist naturally with round-based mappings through &amp;lt;code&amp;gt;used_in_round&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Indexes should be added on the new topic field and on the fields used for rubric lookup so that Expertiza can efficiently find the correct rubric for an assignment, topic, and round.&lt;br /&gt;
&lt;br /&gt;
No new questionnaire type is introduced. The new &amp;lt;code&amp;gt;project_topic_id&amp;lt;/code&amp;gt; field only connects an existing assignment-rubric record to a topic, and the rubric itself remains the existing questionnaire referenced by &amp;lt;code&amp;gt;questionnaire_id&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Rubric Resolution Behavior ==&lt;br /&gt;
&lt;br /&gt;
Rubric selection remains within existing Expertiza code paths. The workflow proceeds by resolving the assignment from the response map, determining whether topic variation is enabled, and, if so, resolving the reviewee team's topic. The system then looks for the best matching assignment questionnaire for that assignment, topic, and round context.&lt;br /&gt;
&lt;br /&gt;
When both round and topic variation are active, matching is deterministic. The precedence is: assignment/topic/current round, then assignment/topic/default round, then assignment/default topic/current round, and finally assignment/default topic/default round. In this precedence rule, the default topic corresponds to &amp;lt;code&amp;gt;project_topic_id&amp;lt;/code&amp;gt; being null, and the default round corresponds to &amp;lt;code&amp;gt;used_in_round&amp;lt;/code&amp;gt; being null.&lt;br /&gt;
&lt;br /&gt;
If no topic-specific mapping is found, the system falls back according to the defined precedence, using default round-specific rubrics for the assignment when applicable, before using the default review rubric for the assignment.&lt;br /&gt;
&lt;br /&gt;
Only the reviewee team's confirmed topic signup for the current assignment is considered, and waitlisted topic signups do not determine rubric selection.&lt;br /&gt;
&lt;br /&gt;
== UI and Instructor Workflow ==&lt;br /&gt;
&lt;br /&gt;
[[File:E2605architecture.png|800px|center|Figure: Rubric resolution architecture]]&lt;br /&gt;
&lt;br /&gt;
Instructors configure topic-based rubrics directly in assignment setup on the Topics tab. For each topic, the UI exposes dropdowns for selecting the review rubric, and when &amp;lt;code&amp;gt;vary_by_round&amp;lt;/code&amp;gt; is enabled, round-specific rubric choices are also supported. This approach keeps all configuration within the standard assignment authoring flow and avoids introducing any external components.&lt;br /&gt;
&lt;br /&gt;
The existing default review rubric for the assignment remains available as the fallback when a topic-specific rubric is not configured. Reviewers do not choose the rubric themselves; instead, they receive the questionnaire resolved automatically for the team they are reviewing.&lt;br /&gt;
&lt;br /&gt;
== API and Validation ==&lt;br /&gt;
&lt;br /&gt;
Assignment create and update flows persist &amp;lt;code&amp;gt;vary_by_topic&amp;lt;/code&amp;gt; cleanly, and parameter naming is normalized so that there is a single canonical internal field. Assignment questionnaire updates accept an optional &amp;lt;code&amp;gt;project_topic_id&amp;lt;/code&amp;gt; and validate that the topic belongs to the same assignment.&lt;br /&gt;
&lt;br /&gt;
Validation ensures that &amp;lt;code&amp;gt;project_topic_id&amp;lt;/code&amp;gt; references an existing topic and does not cross assignment boundaries. The system also prevents duplicate review-rubric mappings for the same assignment, topic, and round combination, ensuring that rubric resolution always produces a single correct result.&lt;br /&gt;
&lt;br /&gt;
Only instructors or administrators who can edit the assignment are allowed to enable topic-based rubric variation or modify topic-rubric mappings.&lt;br /&gt;
&lt;br /&gt;
== Testing Strategy ==&lt;br /&gt;
&lt;br /&gt;
Tests verify that assignments without topic variation remain unchanged, while topic-enabled assignments correctly select topic-specific rubrics when configured. They also ensure that fallback behavior functions properly when a team has no topic or no topic-specific rubric mapping.&lt;br /&gt;
&lt;br /&gt;
Additional tests confirm deterministic precedence when both topic and round variation are enabled and ensure that scoring behavior remains consistent with the selected questionnaire.&lt;br /&gt;
&lt;br /&gt;
== Risks ==&lt;br /&gt;
&lt;br /&gt;
The main risk is ambiguity in precedence when both topic and round variation are present. This is mitigated by defining a strict lookup order and enforcing it through testing. Another risk is partial configuration, where topic variation is enabled but mappings are incomplete; this is mitigated by safe fallback behavior and validation in configuration paths.&lt;br /&gt;
&lt;br /&gt;
== Rubric Changes After Reviews Begin ==&lt;br /&gt;
&lt;br /&gt;
If an instructor changes a topic-rubric mapping after reviews have already begun, existing reviews that used the previous rubric should not remain valid. Since the rubric determines the questions and scoring criteria for a review, changing the rubric can make previously submitted reviews inconsistent with the new configuration.&lt;br /&gt;
&lt;br /&gt;
When a topic-rubric mapping is changed after reviews have been performed, the affected reviews should be deleted, and the affected reviewers should be notified that they need to perform the reviews again using the updated rubric.&lt;br /&gt;
&lt;br /&gt;
== Implementation Notes ==&lt;br /&gt;
&lt;br /&gt;
Implementation focuses on schema changes, shared internal rubric lookup logic, integration at current rubric selection call sites, user interface support on the Topics tab, and regression coverage for response and scoring paths.&lt;br /&gt;
&lt;br /&gt;
Known integration points include response questionnaire lookup, scoring maximum-score calculation, and any review form initialization path that currently assumes assignment-level rubric selection.&lt;/div&gt;</summary>
		<author><name>Vagarwa3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2026_-_E2605._Specialized_Rubrics_for_Different_Topic_Types&amp;diff=167963</id>
		<title>CSC/ECE 517 Spring 2026 - E2605. Specialized Rubrics for Different Topic Types</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2026_-_E2605._Specialized_Rubrics_for_Different_Topic_Types&amp;diff=167963"/>
		<updated>2026-04-15T23:55:53Z</updated>

		<summary type="html">&lt;p&gt;Vagarwa3: /* Migration and Rollout */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__TOC__&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
&lt;br /&gt;
This wiki page presents the design for Expertiza project '''E2605: Specialized Rubrics for Different Topic Types''' for CSC/ECE 517 Object-Oriented Design and Development, Spring 2026.&lt;br /&gt;
&lt;br /&gt;
The goal of this project is to let instructors use different review rubrics for different project topics within the same assignment. Expertiza currently uses the same review rubric for all submissions in an assignment, unless the assignment is configured to use different rubrics in different review rounds. This works for assignments where every topic should be evaluated with the same criteria, but it does not work well when topics require different kinds of evaluation.&lt;br /&gt;
&lt;br /&gt;
For example, an assignment might include topics related to user-interface design, machine learning, and security. A security topic may need rubric questions about threat modeling or vulnerability analysis, while a user-interface topic may need rubric questions about usability and design quality. Topic-based rubric selection allows the rubric to match the topic of the submission being reviewed.&lt;br /&gt;
&lt;br /&gt;
This document describes the motivation for the change, the proposed data model, the instructor workflow, and how Expertiza will resolve the correct review rubric based on assignment, topic, and review-round information.&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
&lt;br /&gt;
This design adds topic-based review rubric selection while keeping existing behavior for assignments where topic-based rubric selection is not enabled. Instructors will associate review rubrics with topics directly from the Topics tab of Assignment creation, using dropdowns. If an assignment is configured to vary by topic, the review rubric is chosen based on the topic of the submission that is being reviewed. If topic variation is not enabled, rubric selection follows the current assignment and round logic.&lt;br /&gt;
&lt;br /&gt;
A [[Response maps|ReviewResponseMap]] identifies the team whose submission is being reviewed. The [[Signed up teams|signed_up_teams]] table identifies which topic that team selected. The [[Assignments questionnaires|assignments_questionnaires]] table will then identify which review rubric should be used for that assignment and topic.&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
&lt;br /&gt;
Different project topics can require different evaluation criteria, but currently all submissions for an assignment use the same review rubric unless round-based rubric variation is configured. The current tables do not yet store which review rubric should be used for each topic, and there is no assignment flag for topic-based rubric variation. Because of this, reviewers can receive rubrics that do not match the reviewed team's topic.&lt;br /&gt;
&lt;br /&gt;
== Design Goals ==&lt;br /&gt;
&lt;br /&gt;
The goal is to let instructors define topic-specific review rubrics without changing the overall review workflow. The design must preserve backward compatibility for existing assignments, continue to support round-based variation, and keep rubric resolution deterministic when both round and topic variation are enabled.&lt;br /&gt;
&lt;br /&gt;
== Non-Goals ==&lt;br /&gt;
&lt;br /&gt;
This change does not redesign topic signup or waitlist behavior, questionnaire authoring or import, or review mapping strategies. It only changes how the system stores and resolves rubric selection for reviews.&lt;br /&gt;
&lt;br /&gt;
== Current State ==&lt;br /&gt;
&lt;br /&gt;
The existing data model already includes the relationships needed to determine a reviewee team's topic. The [[Signed up teams|signed_up_teams]] table identifies which team has selected which topic, and review mappings already identify the reviewee team. Rubric resolution currently happens in several places, including response and scoring code paths, and is mainly driven by assignment and round context.&lt;br /&gt;
&lt;br /&gt;
The current tables do not yet store all the information needed for topic-based rubric selection. Assignments currently include &amp;lt;code&amp;gt;vary_by_round&amp;lt;/code&amp;gt; but no equivalent &amp;lt;code&amp;gt;vary_by_topic&amp;lt;/code&amp;gt; flag, and [[Assignments questionnaires|assignments_questionnaires]] records do not have a &amp;lt;code&amp;gt;project_topic_id&amp;lt;/code&amp;gt; foreign key.&lt;br /&gt;
&lt;br /&gt;
== Proposed Data Model ==&lt;br /&gt;
&lt;br /&gt;
This design introduces minimal extensions to the existing schema while reusing the current rubric infrastructure. A new &amp;lt;code&amp;gt;vary_by_topic&amp;lt;/code&amp;gt; boolean field is added to the assignments table with a default value of false. This ensures that existing assignments continue to function without any changes, and instructors can explicitly enable topic-based rubric variation only when needed.&lt;br /&gt;
&lt;br /&gt;
The [[Assignments questionnaires|assignments_questionnaires]] table indicates which rubrics are used for an assignment. Adding &amp;lt;code&amp;gt;project_topic_id&amp;lt;/code&amp;gt; allows one of those rubric records to apply to a specific topic instead of applying to the whole assignment. A project topic will normally have at most one review-rubric mapping, or one per round if round-based variation is enabled.&lt;br /&gt;
&lt;br /&gt;
In addition, an optional &amp;lt;code&amp;gt;project_topic_id&amp;lt;/code&amp;gt; foreign key is added to the [[Assignments questionnaires|assignments_questionnaires]] table. A null &amp;lt;code&amp;gt;project_topic_id&amp;lt;/code&amp;gt; represents the default review rubric for the assignment. This approach allows topic-specific mappings to coexist naturally with round-based mappings through &amp;lt;code&amp;gt;used_in_round&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Indexes should be added on the new topic field and on the fields used for rubric lookup so that Expertiza can efficiently find the correct rubric for an assignment, topic, and round.&lt;br /&gt;
&lt;br /&gt;
No new questionnaire type is introduced. The new &amp;lt;code&amp;gt;project_topic_id&amp;lt;/code&amp;gt; field only connects an existing assignment-rubric record to a topic, and the rubric itself remains the existing questionnaire referenced by &amp;lt;code&amp;gt;questionnaire_id&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Rubric Resolution Behavior ==&lt;br /&gt;
&lt;br /&gt;
Rubric selection remains within existing Expertiza code paths. The workflow proceeds by resolving the assignment from the response map, determining whether topic variation is enabled, and, if so, resolving the reviewee team's topic. The system then looks for the best matching assignment questionnaire for that assignment, topic, and round context.&lt;br /&gt;
&lt;br /&gt;
When both round and topic variation are active, matching is deterministic. The precedence is: assignment/topic/current round, then assignment/topic/default round, then assignment/default topic/current round, and finally assignment/default topic/default round. In this precedence rule, the default topic corresponds to &amp;lt;code&amp;gt;project_topic_id&amp;lt;/code&amp;gt; being null, and the default round corresponds to &amp;lt;code&amp;gt;used_in_round&amp;lt;/code&amp;gt; being null.&lt;br /&gt;
&lt;br /&gt;
If no topic-specific mapping is found, the system falls back according to the defined precedence, using default round-specific rubrics for the assignment when applicable, before using the default review rubric for the assignment.&lt;br /&gt;
&lt;br /&gt;
Only the reviewee team's confirmed topic signup for the current assignment is considered, and waitlisted topic signups do not determine rubric selection.&lt;br /&gt;
&lt;br /&gt;
== UI and Instructor Workflow ==&lt;br /&gt;
&lt;br /&gt;
[[File:E2605architecture.png|800px|center|Figure: Rubric resolution architecture]]&lt;br /&gt;
&lt;br /&gt;
Instructors configure topic-based rubrics directly in assignment setup on the Topics tab. For each topic, the UI exposes dropdowns for selecting the review rubric, and when &amp;lt;code&amp;gt;vary_by_round&amp;lt;/code&amp;gt; is enabled, round-specific rubric choices are also supported. This approach keeps all configuration within the standard assignment authoring flow and avoids introducing any external components.&lt;br /&gt;
&lt;br /&gt;
The existing default review rubric for the assignment remains available as the fallback when a topic-specific rubric is not configured. Reviewers do not choose the rubric themselves; instead, they receive the questionnaire resolved automatically for the team they are reviewing.&lt;br /&gt;
&lt;br /&gt;
== API and Validation ==&lt;br /&gt;
&lt;br /&gt;
Assignment create and update flows persist &amp;lt;code&amp;gt;vary_by_topic&amp;lt;/code&amp;gt; cleanly, and parameter naming is normalized so that there is a single canonical internal field. Assignment questionnaire updates accept an optional &amp;lt;code&amp;gt;project_topic_id&amp;lt;/code&amp;gt; and validate that the topic belongs to the same assignment.&lt;br /&gt;
&lt;br /&gt;
Validation ensures that &amp;lt;code&amp;gt;project_topic_id&amp;lt;/code&amp;gt; references an existing topic and does not cross assignment boundaries. The system also prevents duplicate review-rubric mappings for the same assignment, topic, and round combination, ensuring that rubric resolution always produces a single correct result.&lt;br /&gt;
&lt;br /&gt;
Only instructors or administrators who can edit the assignment are allowed to enable topic-based rubric variation or modify topic-rubric mappings.&lt;br /&gt;
&lt;br /&gt;
== Testing Strategy ==&lt;br /&gt;
&lt;br /&gt;
Tests verify that assignments without topic variation remain unchanged, while topic-enabled assignments correctly select topic-specific rubrics when configured. They also ensure that fallback behavior functions properly when a team has no topic or no topic-specific rubric mapping.&lt;br /&gt;
&lt;br /&gt;
Additional tests confirm deterministic precedence when both topic and round variation are enabled and ensure that scoring behavior remains consistent with the selected questionnaire.&lt;br /&gt;
&lt;br /&gt;
== Risks ==&lt;br /&gt;
&lt;br /&gt;
The main risk is ambiguity in precedence when both topic and round variation are present. This is mitigated by defining a strict lookup order and enforcing it through testing. Another risk is partial configuration, where topic variation is enabled but mappings are incomplete; this is mitigated by safe fallback behavior and validation in configuration paths.&lt;br /&gt;
&lt;br /&gt;
== Open Questions ==&lt;br /&gt;
&lt;br /&gt;
If an instructor changes a topic-rubric mapping after reviews have begun, existing responses could resolve to a different rubric unless the selected mapping is preserved. The implementation should either store the selected assignment questionnaire on the response or prevent mapping changes once reviews are underway.&lt;br /&gt;
&lt;br /&gt;
== Implementation Notes ==&lt;br /&gt;
&lt;br /&gt;
Implementation focuses on schema changes, shared internal rubric lookup logic, integration at current rubric selection call sites, user interface support on the Topics tab, and regression coverage for response and scoring paths.&lt;br /&gt;
&lt;br /&gt;
Known integration points include response questionnaire lookup, scoring maximum-score calculation, and any review form initialization path that currently assumes assignment-level rubric selection.&lt;/div&gt;</summary>
		<author><name>Vagarwa3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2026_-_E2605._Specialized_Rubrics_for_Different_Topic_Types&amp;diff=167962</id>
		<title>CSC/ECE 517 Spring 2026 - E2605. Specialized Rubrics for Different Topic Types</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2026_-_E2605._Specialized_Rubrics_for_Different_Topic_Types&amp;diff=167962"/>
		<updated>2026-04-15T23:55:17Z</updated>

		<summary type="html">&lt;p&gt;Vagarwa3: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__TOC__&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
&lt;br /&gt;
This wiki page presents the design for Expertiza project '''E2605: Specialized Rubrics for Different Topic Types''' for CSC/ECE 517 Object-Oriented Design and Development, Spring 2026.&lt;br /&gt;
&lt;br /&gt;
The goal of this project is to let instructors use different review rubrics for different project topics within the same assignment. Expertiza currently uses the same review rubric for all submissions in an assignment, unless the assignment is configured to use different rubrics in different review rounds. This works for assignments where every topic should be evaluated with the same criteria, but it does not work well when topics require different kinds of evaluation.&lt;br /&gt;
&lt;br /&gt;
For example, an assignment might include topics related to user-interface design, machine learning, and security. A security topic may need rubric questions about threat modeling or vulnerability analysis, while a user-interface topic may need rubric questions about usability and design quality. Topic-based rubric selection allows the rubric to match the topic of the submission being reviewed.&lt;br /&gt;
&lt;br /&gt;
This document describes the motivation for the change, the proposed data model, the instructor workflow, and how Expertiza will resolve the correct review rubric based on assignment, topic, and review-round information.&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
&lt;br /&gt;
This design adds topic-based review rubric selection while keeping existing behavior for assignments where topic-based rubric selection is not enabled. Instructors will associate review rubrics with topics directly from the Topics tab of Assignment creation, using dropdowns. If an assignment is configured to vary by topic, the review rubric is chosen based on the topic of the submission that is being reviewed. If topic variation is not enabled, rubric selection follows the current assignment and round logic.&lt;br /&gt;
&lt;br /&gt;
A [[Response maps|ReviewResponseMap]] identifies the team whose submission is being reviewed. The [[Signed up teams|signed_up_teams]] table identifies which topic that team selected. The [[Assignments questionnaires|assignments_questionnaires]] table will then identify which review rubric should be used for that assignment and topic.&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
&lt;br /&gt;
Different project topics can require different evaluation criteria, but currently all submissions for an assignment use the same review rubric unless round-based rubric variation is configured. The current tables do not yet store which review rubric should be used for each topic, and there is no assignment flag for topic-based rubric variation. Because of this, reviewers can receive rubrics that do not match the reviewed team's topic.&lt;br /&gt;
&lt;br /&gt;
== Design Goals ==&lt;br /&gt;
&lt;br /&gt;
The goal is to let instructors define topic-specific review rubrics without changing the overall review workflow. The design must preserve backward compatibility for existing assignments, continue to support round-based variation, and keep rubric resolution deterministic when both round and topic variation are enabled.&lt;br /&gt;
&lt;br /&gt;
== Non-Goals ==&lt;br /&gt;
&lt;br /&gt;
This change does not redesign topic signup or waitlist behavior, questionnaire authoring or import, or review mapping strategies. It only changes how the system stores and resolves rubric selection for reviews.&lt;br /&gt;
&lt;br /&gt;
== Current State ==&lt;br /&gt;
&lt;br /&gt;
The existing data model already includes the relationships needed to determine a reviewee team's topic. The [[Signed up teams|signed_up_teams]] table identifies which team has selected which topic, and review mappings already identify the reviewee team. Rubric resolution currently happens in several places, including response and scoring code paths, and is mainly driven by assignment and round context.&lt;br /&gt;
&lt;br /&gt;
The current tables do not yet store all the information needed for topic-based rubric selection. Assignments currently include &amp;lt;code&amp;gt;vary_by_round&amp;lt;/code&amp;gt; but no equivalent &amp;lt;code&amp;gt;vary_by_topic&amp;lt;/code&amp;gt; flag, and [[Assignments questionnaires|assignments_questionnaires]] records do not have a &amp;lt;code&amp;gt;project_topic_id&amp;lt;/code&amp;gt; foreign key.&lt;br /&gt;
&lt;br /&gt;
== Proposed Data Model ==&lt;br /&gt;
&lt;br /&gt;
This design introduces minimal extensions to the existing schema while reusing the current rubric infrastructure. A new &amp;lt;code&amp;gt;vary_by_topic&amp;lt;/code&amp;gt; boolean field is added to the assignments table with a default value of false. This ensures that existing assignments continue to function without any changes, and instructors can explicitly enable topic-based rubric variation only when needed.&lt;br /&gt;
&lt;br /&gt;
The [[Assignments questionnaires|assignments_questionnaires]] table indicates which rubrics are used for an assignment. Adding &amp;lt;code&amp;gt;project_topic_id&amp;lt;/code&amp;gt; allows one of those rubric records to apply to a specific topic instead of applying to the whole assignment. A project topic will normally have at most one review-rubric mapping, or one per round if round-based variation is enabled.&lt;br /&gt;
&lt;br /&gt;
In addition, an optional &amp;lt;code&amp;gt;project_topic_id&amp;lt;/code&amp;gt; foreign key is added to the [[Assignments questionnaires|assignments_questionnaires]] table. A null &amp;lt;code&amp;gt;project_topic_id&amp;lt;/code&amp;gt; represents the default review rubric for the assignment. This approach allows topic-specific mappings to coexist naturally with round-based mappings through &amp;lt;code&amp;gt;used_in_round&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Indexes should be added on the new topic field and on the fields used for rubric lookup so that Expertiza can efficiently find the correct rubric for an assignment, topic, and round.&lt;br /&gt;
&lt;br /&gt;
No new questionnaire type is introduced. The new &amp;lt;code&amp;gt;project_topic_id&amp;lt;/code&amp;gt; field only connects an existing assignment-rubric record to a topic, and the rubric itself remains the existing questionnaire referenced by &amp;lt;code&amp;gt;questionnaire_id&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Rubric Resolution Behavior ==&lt;br /&gt;
&lt;br /&gt;
Rubric selection remains within existing Expertiza code paths. The workflow proceeds by resolving the assignment from the response map, determining whether topic variation is enabled, and, if so, resolving the reviewee team's topic. The system then looks for the best matching assignment questionnaire for that assignment, topic, and round context.&lt;br /&gt;
&lt;br /&gt;
When both round and topic variation are active, matching is deterministic. The precedence is: assignment/topic/current round, then assignment/topic/default round, then assignment/default topic/current round, and finally assignment/default topic/default round. In this precedence rule, the default topic corresponds to &amp;lt;code&amp;gt;project_topic_id&amp;lt;/code&amp;gt; being null, and the default round corresponds to &amp;lt;code&amp;gt;used_in_round&amp;lt;/code&amp;gt; being null.&lt;br /&gt;
&lt;br /&gt;
If no topic-specific mapping is found, the system falls back according to the defined precedence, using default round-specific rubrics for the assignment when applicable, before using the default review rubric for the assignment.&lt;br /&gt;
&lt;br /&gt;
Only the reviewee team's confirmed topic signup for the current assignment is considered, and waitlisted topic signups do not determine rubric selection.&lt;br /&gt;
&lt;br /&gt;
== UI and Instructor Workflow ==&lt;br /&gt;
&lt;br /&gt;
[[File:E2605architecture.png|800px|center|Figure: Rubric resolution architecture]]&lt;br /&gt;
&lt;br /&gt;
Instructors configure topic-based rubrics directly in assignment setup on the Topics tab. For each topic, the UI exposes dropdowns for selecting the review rubric, and when &amp;lt;code&amp;gt;vary_by_round&amp;lt;/code&amp;gt; is enabled, round-specific rubric choices are also supported. This approach keeps all configuration within the standard assignment authoring flow and avoids introducing any external components.&lt;br /&gt;
&lt;br /&gt;
The existing default review rubric for the assignment remains available as the fallback when a topic-specific rubric is not configured. Reviewers do not choose the rubric themselves; instead, they receive the questionnaire resolved automatically for the team they are reviewing.&lt;br /&gt;
&lt;br /&gt;
== API and Validation ==&lt;br /&gt;
&lt;br /&gt;
Assignment create and update flows persist &amp;lt;code&amp;gt;vary_by_topic&amp;lt;/code&amp;gt; cleanly, and parameter naming is normalized so that there is a single canonical internal field. Assignment questionnaire updates accept an optional &amp;lt;code&amp;gt;project_topic_id&amp;lt;/code&amp;gt; and validate that the topic belongs to the same assignment.&lt;br /&gt;
&lt;br /&gt;
Validation ensures that &amp;lt;code&amp;gt;project_topic_id&amp;lt;/code&amp;gt; references an existing topic and does not cross assignment boundaries. The system also prevents duplicate review-rubric mappings for the same assignment, topic, and round combination, ensuring that rubric resolution always produces a single correct result.&lt;br /&gt;
&lt;br /&gt;
Only instructors or administrators who can edit the assignment are allowed to enable topic-based rubric variation or modify topic-rubric mappings.&lt;br /&gt;
&lt;br /&gt;
== Migration and Rollout ==&lt;br /&gt;
&lt;br /&gt;
Migration first adds &amp;lt;code&amp;gt;vary_by_topic&amp;lt;/code&amp;gt; to assignments, followed by adding a nullable &amp;lt;code&amp;gt;project_topic_id&amp;lt;/code&amp;gt; to the [[Assignments questionnaires|assignments_questionnaires]] table along with the necessary foreign key and indexes. Existing rows remain valid with a null topic id and continue to represent default review rubrics for assignments.&lt;br /&gt;
&lt;br /&gt;
After deployment, instructors can enable topic variation gradually on a per-assignment basis using the existing user interface.&lt;br /&gt;
&lt;br /&gt;
== Testing Strategy ==&lt;br /&gt;
&lt;br /&gt;
Tests verify that assignments without topic variation remain unchanged, while topic-enabled assignments correctly select topic-specific rubrics when configured. They also ensure that fallback behavior functions properly when a team has no topic or no topic-specific rubric mapping.&lt;br /&gt;
&lt;br /&gt;
Additional tests confirm deterministic precedence when both topic and round variation are enabled and ensure that scoring behavior remains consistent with the selected questionnaire.&lt;br /&gt;
&lt;br /&gt;
== Risks ==&lt;br /&gt;
&lt;br /&gt;
The main risk is ambiguity in precedence when both topic and round variation are present. This is mitigated by defining a strict lookup order and enforcing it through testing. Another risk is partial configuration, where topic variation is enabled but mappings are incomplete; this is mitigated by safe fallback behavior and validation in configuration paths.&lt;br /&gt;
&lt;br /&gt;
== Open Questions ==&lt;br /&gt;
&lt;br /&gt;
If an instructor changes a topic-rubric mapping after reviews have begun, existing responses could resolve to a different rubric unless the selected mapping is preserved. The implementation should either store the selected assignment questionnaire on the response or prevent mapping changes once reviews are underway.&lt;br /&gt;
&lt;br /&gt;
== Implementation Notes ==&lt;br /&gt;
&lt;br /&gt;
Implementation focuses on schema changes, shared internal rubric lookup logic, integration at current rubric selection call sites, user interface support on the Topics tab, and regression coverage for response and scoring paths.&lt;br /&gt;
&lt;br /&gt;
Known integration points include response questionnaire lookup, scoring maximum-score calculation, and any review form initialization path that currently assumes assignment-level rubric selection.&lt;/div&gt;</summary>
		<author><name>Vagarwa3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2026_-_E2605._Specialized_Rubrics_for_Different_Topic_Types&amp;diff=167939</id>
		<title>CSC/ECE 517 Spring 2026 - E2605. Specialized Rubrics for Different Topic Types</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2026_-_E2605._Specialized_Rubrics_for_Different_Topic_Types&amp;diff=167939"/>
		<updated>2026-04-14T01:40:27Z</updated>

		<summary type="html">&lt;p&gt;Vagarwa3: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__TOC__&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
&lt;br /&gt;
This wiki page presents the design for Expertiza project '''E2605: Specialized Rubrics for Different Topic Types''' for CSC/ECE 517 Object-Oriented Design and Development, Spring 2026.&lt;br /&gt;
&lt;br /&gt;
The goal of this project is to let instructors use different review rubrics for different project topics within the same assignment. Expertiza currently uses the same review rubric for all submissions in an assignment, unless the assignment is configured to use different rubrics in different review rounds. This works for assignments where every topic should be evaluated with the same criteria, but it does not work well when topics require different kinds of evaluation.&lt;br /&gt;
&lt;br /&gt;
For example, an assignment might include topics related to user-interface design, machine learning, and security. A security topic may need rubric questions about threat modeling or vulnerability analysis, while a user-interface topic may need rubric questions about usability and design quality. Topic-based rubric selection allows the rubric to match the topic of the submission being reviewed.&lt;br /&gt;
&lt;br /&gt;
This document describes the motivation for the change, the proposed data model, the instructor workflow, and how Expertiza will resolve the correct review rubric based on assignment, topic, and review-round information.&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
&lt;br /&gt;
This design adds topic-based review rubric selection while keeping existing behavior for assignments where topic-based rubric selection is not enabled. Instructors will associate review rubrics with topics directly from the Topics tab of Assignment creation, using dropdowns. If an assignment is configured to vary by topic, the review rubric is chosen based on the topic of the submission that is being reviewed. If topic variation is not enabled, rubric selection follows the current assignment and round logic.&lt;br /&gt;
&lt;br /&gt;
A [[Response maps|ReviewResponseMap]] identifies the team whose submission is being reviewed. The [[Signed up teams|signed_up_teams]] table identifies which topic that team selected. The [[Assignments questionnaires|assignments_questionnaires]] table will then identify which review rubric should be used for that assignment and topic.&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
&lt;br /&gt;
Different project topics can require different evaluation criteria, but currently all submissions for an assignment use the same review rubric unless round-based rubric variation is configured. The current tables do not yet store which review rubric should be used for each topic, and there is no assignment flag for topic-based rubric variation. Because of this, reviewers can receive rubrics that do not match the reviewed team's topic.&lt;br /&gt;
&lt;br /&gt;
== Design Goals ==&lt;br /&gt;
&lt;br /&gt;
The goal is to let instructors define topic-specific review rubrics without changing the overall review workflow. The design must preserve backward compatibility for existing assignments, continue to support round-based variation, and keep rubric resolution deterministic when both round and topic variation are enabled.&lt;br /&gt;
&lt;br /&gt;
== Non-Goals ==&lt;br /&gt;
&lt;br /&gt;
This change does not redesign topic signup or waitlist behavior, questionnaire authoring or import, or review mapping strategies. It only changes how the system stores and resolves rubric selection for reviews.&lt;br /&gt;
&lt;br /&gt;
== Current State ==&lt;br /&gt;
&lt;br /&gt;
The existing data model already includes the relationships needed to determine a reviewee team's topic. The [[Signed up teams|signed_up_teams]] table identifies which team has selected which topic, and review mappings already identify the reviewee team. Rubric resolution currently happens in several places, including response and scoring code paths, and is mainly driven by assignment and round context.&lt;br /&gt;
&lt;br /&gt;
The current tables do not yet store all the information needed for topic-based rubric selection. Assignments currently include &amp;lt;code&amp;gt;vary_by_round&amp;lt;/code&amp;gt; but no equivalent &amp;lt;code&amp;gt;vary_by_topic&amp;lt;/code&amp;gt; flag, and [[Assignments questionnaires|assignments_questionnaires]] records do not have a &amp;lt;code&amp;gt;project_topic_id&amp;lt;/code&amp;gt; foreign key.&lt;br /&gt;
&lt;br /&gt;
== Proposed Data Model ==&lt;br /&gt;
&lt;br /&gt;
This design introduces minimal extensions to the existing schema while reusing the current rubric infrastructure. A new &amp;lt;code&amp;gt;vary_by_topic&amp;lt;/code&amp;gt; boolean field is added to the assignments table with a default value of false. This ensures that existing assignments continue to function without any changes, and instructors can explicitly enable topic-based rubric variation only when needed.&lt;br /&gt;
&lt;br /&gt;
In addition, an optional &amp;lt;code&amp;gt;project_topic_id&amp;lt;/code&amp;gt; foreign key is added to the [[Assignments questionnaires|assignments_questionnaires]] table. A null &amp;lt;code&amp;gt;project_topic_id&amp;lt;/code&amp;gt; represents the default review rubric for the assignment. This approach allows topic-specific mappings to coexist naturally with round-based mappings through &amp;lt;code&amp;gt;used_in_round&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Indexes should be added on the new topic field and on the fields used for rubric lookup so that Expertiza can efficiently find the correct rubric for an assignment, topic, and round.&lt;br /&gt;
&lt;br /&gt;
The [[Assignments questionnaires|assignments_questionnaires]] table already indicates which rubrics are used for an assignment. Adding &amp;lt;code&amp;gt;project_topic_id&amp;lt;/code&amp;gt; allows one of those rubric records to apply to a specific topic instead of applying to the whole assignment. A project topic will normally have at most one review-rubric mapping, or one per round if round-based variation is enabled.&lt;br /&gt;
&lt;br /&gt;
No new questionnaire type is introduced. The new &amp;lt;code&amp;gt;project_topic_id&amp;lt;/code&amp;gt; field only connects an existing assignment-rubric record to a topic, and the rubric itself remains the existing questionnaire referenced by &amp;lt;code&amp;gt;questionnaire_id&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Rubric Resolution Behavior ==&lt;br /&gt;
&lt;br /&gt;
Rubric selection remains within existing Expertiza code paths. The workflow proceeds by resolving the assignment from the response map, determining whether topic variation is enabled, and, if so, resolving the reviewee team's topic. The system then looks for the best matching assignment questionnaire for that assignment, topic, and round context.&lt;br /&gt;
&lt;br /&gt;
When both round and topic variation are active, matching is deterministic. The precedence is: assignment/topic/current round, then assignment/topic/default round, then assignment/default topic/current round, and finally assignment/default topic/default round. In this precedence rule, the default topic corresponds to &amp;lt;code&amp;gt;project_topic_id&amp;lt;/code&amp;gt; being null, and the default round corresponds to &amp;lt;code&amp;gt;used_in_round&amp;lt;/code&amp;gt; being null.&lt;br /&gt;
&lt;br /&gt;
If no topic-specific mapping is found, the system falls back according to the defined precedence, including default round-specific rubrics for the assignment when applicable, before using the default review rubric for the assignment.&lt;br /&gt;
&lt;br /&gt;
Only the reviewee team's confirmed topic signup for the current assignment is considered, and waitlisted topic signups do not determine rubric selection.&lt;br /&gt;
&lt;br /&gt;
== UI and Instructor Workflow ==&lt;br /&gt;
&lt;br /&gt;
Instructors configure topic-based rubrics directly in assignment setup on the Topics tab. For each topic, the UI exposes dropdowns for selecting the review rubric, and when &amp;lt;code&amp;gt;vary_by_round&amp;lt;/code&amp;gt; is enabled, round-specific rubric choices are also supported. This approach keeps all configuration within the standard assignment authoring flow and avoids introducing any external components.&lt;br /&gt;
&lt;br /&gt;
The existing default review rubric for the assignment remains available as the fallback when a topic-specific rubric is not configured. Reviewers do not choose the rubric themselves; instead, they receive the questionnaire resolved automatically for the team they are reviewing.&lt;br /&gt;
&lt;br /&gt;
== API and Validation ==&lt;br /&gt;
&lt;br /&gt;
Assignment create and update flows persist &amp;lt;code&amp;gt;vary_by_topic&amp;lt;/code&amp;gt; cleanly, and parameter naming is normalized so that there is a single canonical internal field. Assignment questionnaire updates accept an optional &amp;lt;code&amp;gt;project_topic_id&amp;lt;/code&amp;gt; and validate that the topic belongs to the same assignment.&lt;br /&gt;
&lt;br /&gt;
Validation ensures that &amp;lt;code&amp;gt;project_topic_id&amp;lt;/code&amp;gt; references an existing topic and does not cross assignment boundaries. The system also prevents duplicate review-rubric mappings for the same assignment, topic, and round combination, ensuring that rubric resolution always produces a single correct result.&lt;br /&gt;
&lt;br /&gt;
Only instructors or administrators who can edit the assignment are allowed to enable topic-based rubric variation or modify topic-rubric mappings.&lt;br /&gt;
&lt;br /&gt;
== Migration and Rollout ==&lt;br /&gt;
&lt;br /&gt;
Migration first adds &amp;lt;code&amp;gt;vary_by_topic&amp;lt;/code&amp;gt; to assignments, followed by adding a nullable &amp;lt;code&amp;gt;project_topic_id&amp;lt;/code&amp;gt; to the [[Assignments questionnaires|assignments_questionnaires]] table along with the necessary foreign key and indexes. Existing rows remain valid with a null topic id and continue to represent default review rubrics for assignments.&lt;br /&gt;
&lt;br /&gt;
After deployment, instructors can enable topic variation gradually on a per-assignment basis using the existing user interface.&lt;br /&gt;
&lt;br /&gt;
== Testing Strategy ==&lt;br /&gt;
&lt;br /&gt;
Tests verify that assignments without topic variation remain unchanged, while topic-enabled assignments correctly select topic-specific rubrics when configured. They also ensure that fallback behavior functions properly when a team has no topic or no topic-specific rubric mapping.&lt;br /&gt;
&lt;br /&gt;
Additional tests confirm deterministic precedence when both topic and round variation are enabled and ensure that scoring behavior remains consistent with the selected questionnaire.&lt;br /&gt;
&lt;br /&gt;
== Risks ==&lt;br /&gt;
&lt;br /&gt;
The main risk is ambiguity in precedence when both topic and round variation are present. This is mitigated by defining a strict lookup order and enforcing it through testing. Another risk is partial configuration, where topic variation is enabled but mappings are incomplete; this is mitigated by safe fallback behavior and validation in configuration paths.&lt;br /&gt;
&lt;br /&gt;
== Open Questions ==&lt;br /&gt;
&lt;br /&gt;
If an instructor changes a topic-rubric mapping after reviews have begun, existing responses could resolve to a different rubric unless the selected mapping is preserved. The implementation should either store the selected assignment questionnaire on the response or prevent mapping changes once reviews are underway.&lt;br /&gt;
&lt;br /&gt;
== Implementation Notes ==&lt;br /&gt;
&lt;br /&gt;
Implementation focuses on schema changes, shared internal rubric lookup logic, integration at current rubric selection call sites, user interface support on the Topics tab, and regression coverage for response and scoring paths.&lt;br /&gt;
&lt;br /&gt;
Known integration points include response questionnaire lookup, scoring maximum-score calculation, and any review form initialization path that currently assumes assignment-level rubric selection.&lt;/div&gt;</summary>
		<author><name>Vagarwa3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2026_-_E2605._Specialized_Rubrics_for_Different_Topic_Types&amp;diff=167938</id>
		<title>CSC/ECE 517 Spring 2026 - E2605. Specialized Rubrics for Different Topic Types</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2026_-_E2605._Specialized_Rubrics_for_Different_Topic_Types&amp;diff=167938"/>
		<updated>2026-04-14T01:37:34Z</updated>

		<summary type="html">&lt;p&gt;Vagarwa3: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__TOC__&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
&lt;br /&gt;
This wiki page presents the design for Expertiza project '''E2605: Specialized Rubrics for Different Topic Types''' for CSC/ECE 517 Object-Oriented Design and Development, Spring 2026.&lt;br /&gt;
&lt;br /&gt;
The goal of this project is to let instructors use different review rubrics for different project topics within the same assignment. Expertiza currently uses the same review rubric for all submissions in an assignment, unless the assignment is configured to use different rubrics in different review rounds. This works for assignments where every topic should be evaluated with the same criteria, but it does not work well when topics require different kinds of evaluation.&lt;br /&gt;
&lt;br /&gt;
For example, an assignment might include topics related to user-interface design, machine learning, and security. A security topic may need rubric questions about threat modeling or vulnerability analysis, while a user-interface topic may need rubric questions about usability and design quality. Topic-based rubric selection allows the rubric to match the topic of the submission being reviewed.&lt;br /&gt;
&lt;br /&gt;
This document describes the motivation for the change, the proposed data model, the instructor workflow, and how Expertiza will resolve the correct review rubric based on assignment, topic, and review-round information.&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
&lt;br /&gt;
This design adds topic-based review rubric selection while keeping existing behavior for assignments where topic-based rubric selection is not enabled. Instructors will associate review rubrics with topics directly from the Topics tab of Assignment creation, using dropdowns. If an assignment is configured to vary by topic, the review rubric is chosen based on the topic of the submission that is being reviewed. If topic variation is not enabled, rubric selection follows the current assignment and round logic.&lt;br /&gt;
&lt;br /&gt;
A [[Response maps|ReviewResponseMap]] identifies the team whose submission is being reviewed. The [[Signed up teams|signed_up_teams]] table identifies which topic that team selected. The [[Assignments questionnaires|assignments_questionnaires]] table will then identify which review rubric should be used for that assignment and topic.&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
&lt;br /&gt;
Different project topics can require different evaluation criteria, but currently all submissions for an assignment use the same review rubric unless round-based rubric variation is configured. The current tables do not yet store which review rubric should be used for each topic, and there is no assignment flag for topic-based rubric variation. Because of this, reviewers can receive rubrics that do not match the reviewed team's topic.&lt;br /&gt;
&lt;br /&gt;
== Design Goals ==&lt;br /&gt;
&lt;br /&gt;
The goal is to let instructors define topic-specific review rubrics without changing the overall review workflow. The design must preserve backward compatibility for existing assignments, continue to support round-based variation, and keep rubric resolution deterministic when both round and topic variation are enabled.&lt;br /&gt;
&lt;br /&gt;
== Non-Goals ==&lt;br /&gt;
&lt;br /&gt;
This change does not redesign topic signup or waitlist behavior, questionnaire authoring or import, or review mapping strategies. It only changes how the system stores and resolves rubric selection for reviews.&lt;br /&gt;
&lt;br /&gt;
== Current State ==&lt;br /&gt;
&lt;br /&gt;
The existing data model already includes the relationships needed to determine a reviewee team's topic. The [[Signed up teams|signed_up_teams]] table identifies which team has selected which topic, and review mappings already identify the reviewee team. Rubric resolution currently happens in several places, including response and scoring code paths, and is mainly driven by assignment and round context.&lt;br /&gt;
&lt;br /&gt;
The current tables do not yet store all the information needed for topic-based rubric selection. Assignments currently include &amp;lt;code&amp;gt;vary_by_round&amp;lt;/code&amp;gt; but no equivalent &amp;lt;code&amp;gt;vary_by_topic&amp;lt;/code&amp;gt; flag, and [[Assignments questionnaires|assignments_questionnaires]] records do not have a &amp;lt;code&amp;gt;project_topic_id&amp;lt;/code&amp;gt; foreign key.&lt;br /&gt;
&lt;br /&gt;
== Proposed Data Model ==&lt;br /&gt;
&lt;br /&gt;
This design introduces minimal extensions to the existing schema while reusing the current rubric infrastructure. A new &amp;lt;code&amp;gt;vary_by_topic&amp;lt;/code&amp;gt; boolean field is added to the assignments table with a default value of false. This ensures that existing assignments continue to function without any changes, and instructors can explicitly enable topic-based rubric variation only when needed.&lt;br /&gt;
&lt;br /&gt;
In addition, an optional &amp;lt;code&amp;gt;project_topic_id&amp;lt;/code&amp;gt; foreign key is added to the [[Assignments questionnaires|assignments_questionnaires]] table. A null &amp;lt;code&amp;gt;project_topic_id&amp;lt;/code&amp;gt; represents the default review rubric for the assignment. This approach allows topic-specific mappings to coexist naturally with round-based mappings through &amp;lt;code&amp;gt;used_in_round&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Indexes should be added on the new topic field and on the fields used for rubric lookup so that Expertiza can efficiently find the correct rubric for an assignment, topic, and round.&lt;br /&gt;
&lt;br /&gt;
The [[Assignments questionnaires|assignments_questionnaires]] table already indicates which rubrics are used for an assignment. Adding &amp;lt;code&amp;gt;project_topic_id&amp;lt;/code&amp;gt; allows one of those rubric records to apply to a specific topic instead of applying to the whole assignment. A project topic will normally have at most one review-rubric mapping, or one per round if round-based variation is enabled.&lt;br /&gt;
&lt;br /&gt;
No new questionnaire type is introduced. The new &amp;lt;code&amp;gt;project_topic_id&amp;lt;/code&amp;gt; field only connects an existing assignment-rubric record to a topic, and the rubric itself remains the existing questionnaire referenced by &amp;lt;code&amp;gt;questionnaire_id&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Rubric Resolution Behavior ==&lt;br /&gt;
&lt;br /&gt;
Rubric selection remains within existing Expertiza code paths. The workflow proceeds by resolving the assignment from the map, determining whether topic variation is enabled, and, if so, resolving the reviewee team's topic. The system then looks for the best matching assignment questionnaire for that assignment, topic, and round context.&lt;br /&gt;
&lt;br /&gt;
When both round and topic variation are active, matching is deterministic. The precedence is: assignment/topic/current round, then assignment/topic/default round, then assignment/default topic/current round, and finally assignment/default topic/default round. In this precedence rule, the default topic corresponds to &amp;lt;code&amp;gt;project_topic_id&amp;lt;/code&amp;gt; being null, and the default round corresponds to &amp;lt;code&amp;gt;used_in_round&amp;lt;/code&amp;gt; being null.&lt;br /&gt;
&lt;br /&gt;
If no topic-specific mapping is found, the system falls back according to the defined precedence, including default round-specific rubrics for the assignment when applicable, before using the default review rubric for the assignment.&lt;br /&gt;
&lt;br /&gt;
Only the reviewee team's confirmed topic signup for the current assignment is considered, and waitlisted topic signups do not determine rubric selection.&lt;br /&gt;
&lt;br /&gt;
== UI and Instructor Workflow ==&lt;br /&gt;
&lt;br /&gt;
Instructors configure topic-based rubrics directly in assignment setup on the Topics tab. For each topic, the UI exposes dropdowns for selecting the review rubric, and when &amp;lt;code&amp;gt;vary_by_round&amp;lt;/code&amp;gt; is enabled, round-specific rubric choices are also supported. This approach keeps all configuration within the standard assignment authoring flow and avoids introducing any external components.&lt;br /&gt;
&lt;br /&gt;
The existing default review rubric for the assignment remains available as the fallback when a topic-specific rubric is not configured. Reviewers do not choose the rubric themselves; instead, they receive the questionnaire resolved automatically for the team they are reviewing.&lt;br /&gt;
&lt;br /&gt;
== API and Validation ==&lt;br /&gt;
&lt;br /&gt;
Assignment create and update flows persist &amp;lt;code&amp;gt;vary_by_topic&amp;lt;/code&amp;gt; cleanly, and parameter naming is normalized so that there is a single canonical internal field. Assignment questionnaire updates accept an optional &amp;lt;code&amp;gt;project_topic_id&amp;lt;/code&amp;gt; and validate that the topic belongs to the same assignment.&lt;br /&gt;
&lt;br /&gt;
Validation ensures that &amp;lt;code&amp;gt;project_topic_id&amp;lt;/code&amp;gt; references an existing topic and does not cross assignment boundaries. The system also prevents duplicate review-rubric mappings for the same assignment, topic, and round combination, ensuring that rubric resolution always produces a single correct result.&lt;br /&gt;
&lt;br /&gt;
Only instructors or administrators who can edit the assignment are allowed to enable topic-based rubric variation or modify topic-rubric mappings.&lt;br /&gt;
&lt;br /&gt;
== Migration and Rollout ==&lt;br /&gt;
&lt;br /&gt;
Migration first adds &amp;lt;code&amp;gt;vary_by_topic&amp;lt;/code&amp;gt; to assignments, followed by adding a nullable &amp;lt;code&amp;gt;project_topic_id&amp;lt;/code&amp;gt; to assignment questionnaires along with the necessary foreign key and indexes. Existing rows remain valid with a null topic id and continue to represent default review rubrics for assignments.&lt;br /&gt;
&lt;br /&gt;
After deployment, instructors can enable topic variation gradually on a per-assignment basis using the existing user interface.&lt;br /&gt;
&lt;br /&gt;
== Testing Strategy ==&lt;br /&gt;
&lt;br /&gt;
Tests verify that assignments without topic variation remain unchanged, while topic-enabled assignments correctly select topic-specific rubrics when configured. They also ensure that fallback behavior functions properly when a team has no topic or no topic-specific rubric mapping.&lt;br /&gt;
&lt;br /&gt;
Additional tests confirm deterministic precedence when both topic and round variation are enabled and ensure that scoring behavior remains consistent with the selected questionnaire.&lt;br /&gt;
&lt;br /&gt;
== Risks ==&lt;br /&gt;
&lt;br /&gt;
The main risk is ambiguity in precedence when both topic and round variation are present. This is mitigated by defining a strict lookup order and enforcing it through testing. Another risk is partial configuration, where topic variation is enabled but mappings are incomplete; this is mitigated by safe fallback behavior and validation in configuration paths.&lt;br /&gt;
&lt;br /&gt;
== Open Questions ==&lt;br /&gt;
&lt;br /&gt;
If an instructor changes a topic-rubric mapping after reviews have begun, existing responses could resolve to a different rubric unless the selected mapping is preserved. The implementation should either store the selected assignment questionnaire on the response or prevent mapping changes once reviews are underway.&lt;br /&gt;
&lt;br /&gt;
== Implementation Notes ==&lt;br /&gt;
&lt;br /&gt;
Implementation focuses on schema changes, shared internal rubric lookup logic, integration at current rubric selection call sites, user interface support on the Topics tab, and regression coverage for response and scoring paths.&lt;br /&gt;
&lt;br /&gt;
Known integration points include response questionnaire lookup, scoring maximum-score calculation, and any review form initialization path that currently assumes assignment-level rubric selection.&lt;/div&gt;</summary>
		<author><name>Vagarwa3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2026_-_E2605._Specialized_Rubrics_for_Different_Topic_Types&amp;diff=167935</id>
		<title>CSC/ECE 517 Spring 2026 - E2605. Specialized Rubrics for Different Topic Types</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2026_-_E2605._Specialized_Rubrics_for_Different_Topic_Types&amp;diff=167935"/>
		<updated>2026-04-14T01:24:00Z</updated>

		<summary type="html">&lt;p&gt;Vagarwa3: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__TOC__&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
&lt;br /&gt;
This wiki page presents the design for Expertiza project '''E2605: Specialized Rubrics for Different Topic Types''' for CSC/ECE 517 Object-Oriented Design and Development, Spring 2026.&lt;br /&gt;
&lt;br /&gt;
The goal of this project is to let instructors use different review rubrics for different project topics within the same assignment. Expertiza currently uses the same review rubric for all submissions in an assignment, unless the assignment is configured to use different rubrics in different review rounds. This works for assignments where every topic should be evaluated with the same criteria, but it does not work well when topics require different kinds of evaluation.&lt;br /&gt;
&lt;br /&gt;
For example, an assignment might include topics related to user-interface design, machine learning, and security. A security topic may need rubric questions about threat modeling or vulnerability analysis, while a user-interface topic may need rubric questions about usability and design quality. Topic-based rubric selection allows the rubric to match the topic of the submission being reviewed.&lt;br /&gt;
&lt;br /&gt;
This document describes the motivation for the change, the proposed data model, the instructor workflow, and how Expertiza will resolve the correct review rubric based on assignment, topic, and review-round information.&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
&lt;br /&gt;
This design adds topic-based review rubric selection while keeping existing behavior for assignments where topic-based rubric selection is not enabled. Instructors will associate review rubrics with topics directly from the Topics tab of Assignment creation, using dropdowns. If an assignment is configured to vary by topic, the review rubric is chosen based on the topic of the submission that is being reviewed. If topic variation is not enabled, rubric selection follows the current assignment and round logic.&lt;br /&gt;
&lt;br /&gt;
A ReviewResponseMap identifies the team whose submission is being reviewed. The &amp;lt;code&amp;gt;signed_up_teams&amp;lt;/code&amp;gt; table identifies which topic that team selected. The &amp;lt;code&amp;gt;assignments_questionnaires&amp;lt;/code&amp;gt; table will then identify which review rubric should be used for that assignment and topic.&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
&lt;br /&gt;
Different project topics can require different evaluation criteria, but currently all submissions for an assignment use the same review rubric unless round-based rubric variation is configured. The schema does not yet provide a first-class topic-to-rubric mapping, and there is no assignment flag for topic-based rubric variation. Because of this, reviewers can receive rubrics that do not match the reviewed team's topic.&lt;br /&gt;
&lt;br /&gt;
== Design Goals ==&lt;br /&gt;
&lt;br /&gt;
The goal is to let instructors define topic-specific review rubrics without changing the overall review workflow. The design must preserve backward compatibility for existing assignments, continue to support round-based variation, and keep rubric resolution deterministic when both round and topic variation are enabled.&lt;br /&gt;
&lt;br /&gt;
== Non-Goals ==&lt;br /&gt;
&lt;br /&gt;
This change does not redesign topic signup or waitlist behavior, questionnaire authoring or import, or review mapping strategies. It only changes how the system stores and resolves rubric selection for reviews.&lt;br /&gt;
&lt;br /&gt;
== Current State ==&lt;br /&gt;
&lt;br /&gt;
The existing data model already includes the relationships needed to determine a reviewee team's topic. The &amp;lt;code&amp;gt;signed_up_teams&amp;lt;/code&amp;gt; table identifies which team has selected which topic, and review mappings already identify the reviewee team. Rubric resolution currently happens in several places, including response and scoring code paths, and is mainly driven by assignment and round context.&lt;br /&gt;
&lt;br /&gt;
The current tables do not yet store all the information needed for topic-based rubric selection. Assignments currently include &amp;lt;code&amp;gt;vary_by_round&amp;lt;/code&amp;gt; but no equivalent &amp;lt;code&amp;gt;vary_by_topic&amp;lt;/code&amp;gt; flag, and assignment questionnaire records do not have a topic foreign key.&lt;br /&gt;
&lt;br /&gt;
== Proposed Data Model ==&lt;br /&gt;
&lt;br /&gt;
This design introduces minimal extensions to the existing schema while reusing the current rubric infrastructure. A new &amp;lt;code&amp;gt;vary_by_topic&amp;lt;/code&amp;gt; boolean field is added to the assignments table with a default value of false. This ensures that existing assignments continue to function without any changes, and instructors can explicitly enable topic-based rubric variation only when needed.&lt;br /&gt;
&lt;br /&gt;
In addition, an optional &amp;lt;code&amp;gt;project_topic_id&amp;lt;/code&amp;gt; foreign key is added to the &amp;lt;code&amp;gt;assignments_questionnaires&amp;lt;/code&amp;gt; table. A null &amp;lt;code&amp;gt;project_topic_id&amp;lt;/code&amp;gt; represents the default review rubric for the assignment. This approach allows topic-specific mappings to coexist naturally with round-based mappings through &amp;lt;code&amp;gt;used_in_round&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Indexes should be added on the new topic field and on the fields used for rubric lookup so that Expertiza can efficiently find the correct rubric for an assignment, topic, and round.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;assignments_questionnaires&amp;lt;/code&amp;gt; table already indicates which rubrics are used for an assignment. Adding &amp;lt;code&amp;gt;project_topic_id&amp;lt;/code&amp;gt; allows one of those rubric records to apply to a specific topic instead of applying to the whole assignment. A project topic will normally have at most one review-rubric mapping, or one per round if round-based variation is enabled.&lt;br /&gt;
&lt;br /&gt;
No new questionnaire type is introduced. The new &amp;lt;code&amp;gt;project_topic_id&amp;lt;/code&amp;gt; field only connects an existing assignment-rubric record to a topic, and the rubric itself remains the existing questionnaire referenced by &amp;lt;code&amp;gt;questionnaire_id&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Rubric Resolution Behavior ==&lt;br /&gt;
&lt;br /&gt;
No separate selection service is required, and rubric selection remains within existing Expertiza code paths. The workflow proceeds by resolving the assignment from the map, determining whether topic variation is enabled, and, if so, resolving the reviewee team's topic. The system then looks for the best matching assignment questionnaire for that assignment, topic, and round context.&lt;br /&gt;
&lt;br /&gt;
When both round and topic variation are active, matching is deterministic. The precedence is: assignment/topic/current round, then assignment/topic/default round, then assignment/default topic/current round, and finally assignment/default topic/default round. In this precedence rule, the default topic corresponds to &amp;lt;code&amp;gt;project_topic_id&amp;lt;/code&amp;gt; being null, and the default round corresponds to &amp;lt;code&amp;gt;used_in_round&amp;lt;/code&amp;gt; being null.&lt;br /&gt;
&lt;br /&gt;
If no topic-specific mapping is found, the system falls back according to the defined precedence, including assignment-level round-specific rubrics when applicable, before using the default review rubric for the assignment.&lt;br /&gt;
&lt;br /&gt;
Only the reviewee team's confirmed topic signup for the current assignment is considered, and waitlisted topic signups do not determine rubric selection.&lt;br /&gt;
&lt;br /&gt;
== UI and Instructor Workflow ==&lt;br /&gt;
&lt;br /&gt;
Instructors configure topic-based rubrics directly in assignment setup on the Topics tab. For each topic, the UI exposes dropdowns for selecting the review rubric, and when &amp;lt;code&amp;gt;vary_by_round&amp;lt;/code&amp;gt; is enabled, round-specific rubric choices are also supported. This approach keeps all configuration within the standard assignment authoring flow and avoids introducing any external components.&lt;br /&gt;
&lt;br /&gt;
The existing assignment-level review rubric remains available as the default fallback when a topic-specific rubric is not configured. Reviewers do not choose the rubric themselves; instead, they receive the questionnaire resolved automatically for the team they are reviewing.&lt;br /&gt;
&lt;br /&gt;
== API and Validation ==&lt;br /&gt;
&lt;br /&gt;
Assignment create and update flows persist &amp;lt;code&amp;gt;vary_by_topic&amp;lt;/code&amp;gt; cleanly, and parameter naming is normalized so that there is a single canonical internal field. Assignment questionnaire updates accept an optional &amp;lt;code&amp;gt;project_topic_id&amp;lt;/code&amp;gt; and validate that the topic belongs to the same assignment.&lt;br /&gt;
&lt;br /&gt;
Validation ensures that &amp;lt;code&amp;gt;project_topic_id&amp;lt;/code&amp;gt; references an existing topic and does not cross assignment boundaries. The system also prevents duplicate review-rubric mappings for the same assignment, topic, and round combination, ensuring that rubric resolution always produces a single correct result.&lt;br /&gt;
&lt;br /&gt;
Only instructors or administrators who can edit the assignment are allowed to enable topic-based rubric variation or modify topic-rubric mappings.&lt;br /&gt;
&lt;br /&gt;
== Migration and Rollout ==&lt;br /&gt;
&lt;br /&gt;
Migration first adds &amp;lt;code&amp;gt;vary_by_topic&amp;lt;/code&amp;gt; to assignments, followed by adding a nullable &amp;lt;code&amp;gt;project_topic_id&amp;lt;/code&amp;gt; to assignment questionnaires along with the necessary foreign key and indexes. Existing rows remain valid with a null topic id and continue to represent assignment-level defaults.&lt;br /&gt;
&lt;br /&gt;
After deployment, instructors can enable topic variation gradually on a per-assignment basis using the existing user interface.&lt;br /&gt;
&lt;br /&gt;
== Testing Strategy ==&lt;br /&gt;
&lt;br /&gt;
Tests verify that assignments without topic variation remain unchanged, while topic-enabled assignments correctly select topic-specific rubrics when configured. They also ensure that fallback behavior functions properly when a team has no topic or no topic-specific rubric mapping.&lt;br /&gt;
&lt;br /&gt;
Additional tests confirm deterministic precedence when both topic and round variation are enabled and ensure that scoring behavior remains consistent with the selected questionnaire.&lt;br /&gt;
&lt;br /&gt;
== Risks ==&lt;br /&gt;
&lt;br /&gt;
The main risk is ambiguity in precedence when both topic and round variation are present. This is mitigated by defining a strict lookup order and enforcing it through testing. Another risk is partial configuration, where topic variation is enabled but mappings are incomplete; this is mitigated by safe fallback behavior and validation in configuration paths.&lt;br /&gt;
&lt;br /&gt;
== Open Questions ==&lt;br /&gt;
&lt;br /&gt;
If an instructor changes a topic-rubric mapping after reviews have begun, existing responses could resolve to a different rubric unless the selected mapping is preserved. The implementation should either store the selected assignment questionnaire on the response or prevent mapping changes once reviews are underway.&lt;br /&gt;
&lt;br /&gt;
== Implementation Notes ==&lt;br /&gt;
&lt;br /&gt;
Implementation focuses on schema changes, shared internal rubric lookup logic, integration at current rubric selection call sites, user interface support on the Topics tab, and regression coverage for response and scoring paths.&lt;br /&gt;
&lt;br /&gt;
Known integration points include response questionnaire lookup, scoring maximum-score calculation, and any review form initialization path that currently assumes assignment-level rubric selection.&lt;/div&gt;</summary>
		<author><name>Vagarwa3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2026_-_E2605._Specialized_Rubrics_for_Different_Topic_Types&amp;diff=167934</id>
		<title>CSC/ECE 517 Spring 2026 - E2605. Specialized Rubrics for Different Topic Types</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2026_-_E2605._Specialized_Rubrics_for_Different_Topic_Types&amp;diff=167934"/>
		<updated>2026-04-14T01:21:44Z</updated>

		<summary type="html">&lt;p&gt;Vagarwa3: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= CSC/ECE 517 Spring 2026 - E2605: Specialized Rubrics for Different Topic Types =&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
&lt;br /&gt;
This wiki page presents the design for Expertiza project '''E2605: Specialized Rubrics for Different Topic Types''' for CSC/ECE 517 Object-Oriented Design and Development, Spring 2026.&lt;br /&gt;
&lt;br /&gt;
The goal of this project is to let instructors use different review rubrics for different project topics within the same assignment. Expertiza currently uses the same review rubric for all submissions in an assignment, unless the assignment is configured to use different rubrics in different review rounds. This works for assignments where every topic should be evaluated with the same criteria, but it does not work well when topics require different kinds of evaluation.&lt;br /&gt;
&lt;br /&gt;
For example, an assignment might include topics related to user-interface design, machine learning, and security. A security topic may need rubric questions about threat modeling or vulnerability analysis, while a user-interface topic may need rubric questions about usability and design quality. Topic-based rubric selection allows the rubric to match the topic of the submission being reviewed.&lt;br /&gt;
&lt;br /&gt;
This document describes the motivation for the change, the proposed data model, the instructor workflow, and how Expertiza will resolve the correct review rubric based on assignment, topic, and review-round information.&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
&lt;br /&gt;
This design adds topic-based review rubric selection while keeping existing behavior for assignments where topic-based rubric selection is not enabled. Instructors will associate review rubrics with topics directly from the Topics tab of Assignment creation, using dropdowns. If an assignment is configured to vary by topic, the review rubric is chosen based on the topic of the submission that is being reviewed. If topic variation is not enabled, rubric selection follows the current assignment and round logic.&lt;br /&gt;
&lt;br /&gt;
A ReviewResponseMap identifies the team whose submission is being reviewed. The &amp;lt;code&amp;gt;signed_up_teams&amp;lt;/code&amp;gt; table identifies which topic that team selected. The &amp;lt;code&amp;gt;assignments_questionnaires&amp;lt;/code&amp;gt; table will then identify which review rubric should be used for that assignment and topic.&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
&lt;br /&gt;
Different project topics can require different evaluation criteria, but currently all submissions for an assignment use the same review rubric unless round-based rubric variation is configured. The schema does not yet provide a first-class topic-to-rubric mapping, and there is no assignment flag for topic-based rubric variation. Because of this, reviewers can receive rubrics that do not match the reviewed team's topic.&lt;br /&gt;
&lt;br /&gt;
== Design Goals ==&lt;br /&gt;
&lt;br /&gt;
The goal is to let instructors define topic-specific review rubrics without changing the overall review workflow. The design must preserve backward compatibility for existing assignments, continue to support round-based variation, and keep rubric resolution deterministic when both round and topic variation are enabled.&lt;br /&gt;
&lt;br /&gt;
== Non-Goals ==&lt;br /&gt;
&lt;br /&gt;
This change does not redesign topic signup or waitlist behavior, questionnaire authoring or import, or review mapping strategies. It only changes how the system stores and resolves rubric selection for reviews.&lt;br /&gt;
&lt;br /&gt;
== Current State ==&lt;br /&gt;
&lt;br /&gt;
The existing data model already includes the relationships needed to determine a reviewee team's topic. The &amp;lt;code&amp;gt;signed_up_teams&amp;lt;/code&amp;gt; table identifies which team has selected which topic, and review mappings already identify the reviewee team. Rubric resolution currently happens in several places, including response and scoring code paths, and is mainly driven by assignment and round context.&lt;br /&gt;
&lt;br /&gt;
The current tables do not yet store all the information needed for topic-based rubric selection. Assignments currently include &amp;lt;code&amp;gt;vary_by_round&amp;lt;/code&amp;gt; but no equivalent &amp;lt;code&amp;gt;vary_by_topic&amp;lt;/code&amp;gt; flag, and assignment questionnaire records do not have a topic foreign key.&lt;br /&gt;
&lt;br /&gt;
== Proposed Data Model ==&lt;br /&gt;
&lt;br /&gt;
This design introduces minimal extensions to the existing schema while reusing the current rubric infrastructure. A new &amp;lt;code&amp;gt;vary_by_topic&amp;lt;/code&amp;gt; boolean field is added to the assignments table with a default value of false. This ensures that existing assignments continue to function without any changes, and instructors can explicitly enable topic-based rubric variation only when needed.&lt;br /&gt;
&lt;br /&gt;
In addition, an optional &amp;lt;code&amp;gt;project_topic_id&amp;lt;/code&amp;gt; foreign key is added to the &amp;lt;code&amp;gt;assignments_questionnaires&amp;lt;/code&amp;gt; table. A null &amp;lt;code&amp;gt;project_topic_id&amp;lt;/code&amp;gt; represents the default review rubric for the assignment. This approach allows topic-specific mappings to coexist naturally with round-based mappings through &amp;lt;code&amp;gt;used_in_round&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Indexes should be added on the new topic field and on the fields used for rubric lookup so that Expertiza can efficiently find the correct rubric for an assignment, topic, and round.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;assignments_questionnaires&amp;lt;/code&amp;gt; table already indicates which rubrics are used for an assignment. Adding &amp;lt;code&amp;gt;project_topic_id&amp;lt;/code&amp;gt; allows one of those rubric records to apply to a specific topic instead of applying to the whole assignment. A project topic will normally have at most one review-rubric mapping, or one per round if round-based variation is enabled.&lt;br /&gt;
&lt;br /&gt;
No new questionnaire type is introduced. The new &amp;lt;code&amp;gt;project_topic_id&amp;lt;/code&amp;gt; field only connects an existing assignment-rubric record to a topic, and the rubric itself remains the existing questionnaire referenced by &amp;lt;code&amp;gt;questionnaire_id&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Rubric Resolution Behavior ==&lt;br /&gt;
&lt;br /&gt;
No separate selection service is required, and rubric selection remains within existing Expertiza code paths. The workflow proceeds by resolving the assignment from the map, determining whether topic variation is enabled, and, if so, resolving the reviewee team's topic. The system then looks for the best matching assignment questionnaire for that assignment, topic, and round context.&lt;br /&gt;
&lt;br /&gt;
When both round and topic variation are active, matching is deterministic. The precedence is: assignment/topic/current round, then assignment/topic/default round, then assignment/default topic/current round, and finally assignment/default topic/default round. In this precedence rule, the default topic corresponds to &amp;lt;code&amp;gt;project_topic_id&amp;lt;/code&amp;gt; being null, and the default round corresponds to &amp;lt;code&amp;gt;used_in_round&amp;lt;/code&amp;gt; being null.&lt;br /&gt;
&lt;br /&gt;
If no topic-specific mapping is found, the system falls back according to the defined precedence, including assignment-level round-specific rubrics when applicable, before using the default review rubric for the assignment.&lt;br /&gt;
&lt;br /&gt;
Only the reviewee team's confirmed topic signup for the current assignment is considered, and waitlisted topic signups do not determine rubric selection.&lt;br /&gt;
&lt;br /&gt;
== UI and Instructor Workflow ==&lt;br /&gt;
&lt;br /&gt;
Instructors configure topic-based rubrics directly in assignment setup on the Topics tab. For each topic, the UI exposes dropdowns for selecting the review rubric, and when &amp;lt;code&amp;gt;vary_by_round&amp;lt;/code&amp;gt; is enabled, round-specific rubric choices are also supported. This approach keeps all configuration within the standard assignment authoring flow and avoids introducing any external components.&lt;br /&gt;
&lt;br /&gt;
The existing assignment-level review rubric remains available as the default fallback when a topic-specific rubric is not configured. Reviewers do not choose the rubric themselves; instead, they receive the questionnaire resolved automatically for the team they are reviewing.&lt;br /&gt;
&lt;br /&gt;
== API and Validation ==&lt;br /&gt;
&lt;br /&gt;
Assignment create and update flows persist &amp;lt;code&amp;gt;vary_by_topic&amp;lt;/code&amp;gt; cleanly, and parameter naming is normalized so that there is a single canonical internal field. Assignment questionnaire updates accept an optional &amp;lt;code&amp;gt;project_topic_id&amp;lt;/code&amp;gt; and validate that the topic belongs to the same assignment.&lt;br /&gt;
&lt;br /&gt;
Validation ensures that &amp;lt;code&amp;gt;project_topic_id&amp;lt;/code&amp;gt; references an existing topic and does not cross assignment boundaries. The system also prevents duplicate review-rubric mappings for the same assignment, topic, and round combination, ensuring that rubric resolution always produces a single correct result.&lt;br /&gt;
&lt;br /&gt;
Only instructors or administrators who can edit the assignment are allowed to enable topic-based rubric variation or modify topic-rubric mappings.&lt;br /&gt;
&lt;br /&gt;
== Migration and Rollout ==&lt;br /&gt;
&lt;br /&gt;
Migration first adds &amp;lt;code&amp;gt;vary_by_topic&amp;lt;/code&amp;gt; to assignments, followed by adding a nullable &amp;lt;code&amp;gt;project_topic_id&amp;lt;/code&amp;gt; to assignment questionnaires along with the necessary foreign key and indexes. Existing rows remain valid with a null topic id and continue to represent assignment-level defaults.&lt;br /&gt;
&lt;br /&gt;
After deployment, instructors can enable topic variation gradually on a per-assignment basis using the existing user interface.&lt;br /&gt;
&lt;br /&gt;
== Testing Strategy ==&lt;br /&gt;
&lt;br /&gt;
Tests verify that assignments without topic variation remain unchanged, while topic-enabled assignments correctly select topic-specific rubrics when configured. They also ensure that fallback behavior functions properly when a team has no topic or no topic-specific rubric mapping.&lt;br /&gt;
&lt;br /&gt;
Additional tests confirm deterministic precedence when both topic and round variation are enabled and ensure that scoring behavior remains consistent with the selected questionnaire.&lt;br /&gt;
&lt;br /&gt;
== Risks ==&lt;br /&gt;
&lt;br /&gt;
The main risk is ambiguity in precedence when both topic and round variation are present. This is mitigated by defining a strict lookup order and enforcing it through testing. Another risk is partial configuration, where topic variation is enabled but mappings are incomplete; this is mitigated by safe fallback behavior and validation in configuration paths.&lt;br /&gt;
&lt;br /&gt;
== Open Questions ==&lt;br /&gt;
&lt;br /&gt;
If an instructor changes a topic-rubric mapping after reviews have begun, existing responses could resolve to a different rubric unless the selected mapping is preserved. The implementation should either store the selected assignment questionnaire on the response or prevent mapping changes once reviews are underway.&lt;br /&gt;
&lt;br /&gt;
== Implementation Notes ==&lt;br /&gt;
&lt;br /&gt;
Implementation focuses on schema changes, shared internal rubric lookup logic, integration at current rubric selection call sites, user interface support on the Topics tab, and regression coverage for response and scoring paths.&lt;br /&gt;
&lt;br /&gt;
Known integration points include response questionnaire lookup, scoring maximum-score calculation, and any review form initialization path that currently assumes assignment-level rubric selection.&lt;/div&gt;</summary>
		<author><name>Vagarwa3</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2026_-_E2605._Specialized_Rubrics_for_Different_Topic_Types&amp;diff=167932</id>
		<title>CSC/ECE 517 Spring 2026 - E2605. Specialized Rubrics for Different Topic Types</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2026_-_E2605._Specialized_Rubrics_for_Different_Topic_Types&amp;diff=167932"/>
		<updated>2026-04-14T01:16:52Z</updated>

		<summary type="html">&lt;p&gt;Vagarwa3: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= CSC/ECE 517 Spring 2026 - E2605: Specialized Rubrics for Different Topic Types =&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
&lt;br /&gt;
This wiki page presents the design for Expertiza project '''E2605: Specialized Rubrics for Different Topic Types''' for CSC/ECE 517 Object-Oriented Design and Development (Spring 2026).&lt;br /&gt;
&lt;br /&gt;
The goal of this project is to extend the existing rubric selection mechanism in Expertiza to support topic-based variation. Currently, rubric selection is driven primarily by assignment and round context, which limits the ability to tailor evaluation criteria for different types of topics within the same assignment.&lt;br /&gt;
&lt;br /&gt;
This document describes the motivation for the change, the proposed data model and behavior, and how the system resolves the correct rubric based on assignment, topic, and round context. It also outlines implementation considerations, validation rules, and potential risks associated with the design.&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
&lt;br /&gt;
This design adds topic-based review rubric selection while keeping existing behavior for assignments that do not opt in. Instructors will associate review rubrics with topics directly from the Topics tab of Assignment creation, using dropdowns. If an assignment is configured to vary by topic, the review rubric is chosen based on the topic of the submission that is being reviewed. If topic variation is not enabled, rubric selection follows the current assignment and round logic.&lt;br /&gt;
&lt;br /&gt;
A ReviewResponseMap identifies the team whose submission is being reviewed. The &amp;lt;code&amp;gt;signed_up_teams&amp;lt;/code&amp;gt; table identifies which topic that team selected. The &amp;lt;code&amp;gt;assignments_questionnaires&amp;lt;/code&amp;gt; table will then identify which review rubric should be used for that assignment and topic.&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
&lt;br /&gt;
Different project topics can require different evaluation criteria, but currently all submissions for an assignment use the same review rubric unless round-based rubric variation is configured. The schema does not yet provide a first-class topic-to-rubric mapping, and there is no assignment flag for topic-based rubric variation. Because of this, reviewers can receive rubrics that do not match the reviewed team's topic.&lt;br /&gt;
&lt;br /&gt;
== Design Goals ==&lt;br /&gt;
&lt;br /&gt;
The goal is to let instructors define topic-specific review rubrics without changing the overall review workflow. The design must preserve backward compatibility for existing assignments, continue to support round-based variation, and keep rubric resolution deterministic when both round and topic variation are enabled.&lt;br /&gt;
&lt;br /&gt;
== Non-Goals ==&lt;br /&gt;
&lt;br /&gt;
This change does not redesign topic signup or waitlist behavior, questionnaire authoring or import, or review mapping strategies. It only changes how the system stores and resolves rubric selection for reviews.&lt;br /&gt;
&lt;br /&gt;
== Current State ==&lt;br /&gt;
&lt;br /&gt;
The existing data model already includes the relationships needed to determine a reviewee team's topic. The &amp;lt;code&amp;gt;signed_up_teams&amp;lt;/code&amp;gt; table identifies which team has selected which topic, and review mappings already identify the reviewee team. Rubric resolution currently happens in several places, including response and scoring code paths, and is mainly driven by assignment and round context.&lt;br /&gt;
&lt;br /&gt;
The current tables do not yet store all the information needed for topic-based rubric selection. Assignments currently include &amp;lt;code&amp;gt;vary_by_round&amp;lt;/code&amp;gt; but no equivalent &amp;lt;code&amp;gt;vary_by_topic&amp;lt;/code&amp;gt; flag, and assignment questionnaire records do not have a topic foreign key.&lt;br /&gt;
&lt;br /&gt;
== Proposed Data Model ==&lt;br /&gt;
&lt;br /&gt;
This design introduces minimal extensions to the existing schema while reusing the current rubric infrastructure. A new &amp;lt;code&amp;gt;vary_by_topic&amp;lt;/code&amp;gt; boolean field is added to the assignments table with a default value of false. This ensures that existing assignments continue to function without any changes, and instructors can explicitly enable topic-based rubric variation only when needed.&lt;br /&gt;
&lt;br /&gt;
In addition, an optional &amp;lt;code&amp;gt;project_topic_id&amp;lt;/code&amp;gt; foreign key is added to the &amp;lt;code&amp;gt;assignments_questionnaires&amp;lt;/code&amp;gt; table. A null &amp;lt;code&amp;gt;project_topic_id&amp;lt;/code&amp;gt; represents the default review rubric for the assignment. This approach allows topic-specific mappings to coexist naturally with round-based mappings through &amp;lt;code&amp;gt;used_in_round&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Indexes should be added on the new topic field and on the fields used for rubric lookup so that Expertiza can efficiently find the correct rubric for an assignment, topic, and round.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;assignments_questionnaires&amp;lt;/code&amp;gt; table already indicates which rubrics are used for an assignment. Adding &amp;lt;code&amp;gt;project_topic_id&amp;lt;/code&amp;gt; allows one of those rubric records to apply to a specific topic instead of applying to the whole assignment. A project topic will normally have at most one review-rubric mapping, or one per round if round-based variation is enabled.&lt;br /&gt;
&lt;br /&gt;
No new questionnaire type is introduced. The new &amp;lt;code&amp;gt;project_topic_id&amp;lt;/code&amp;gt; field only connects an existing assignment-rubric record to a topic, and the rubric itself remains the existing questionnaire referenced by &amp;lt;code&amp;gt;questionnaire_id&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Rubric Resolution Behavior ==&lt;br /&gt;
&lt;br /&gt;
No separate selection service is required, and rubric selection remains within existing Expertiza code paths. The workflow proceeds by resolving the assignment from the map, determining whether topic variation is enabled, and, if so, resolving the reviewee team's topic. The system then looks for the best matching assignment questionnaire for that assignment, topic, and round context.&lt;br /&gt;
&lt;br /&gt;
When both round and topic variation are active, matching is deterministic. The precedence follows assignment and topic with round first, then assignment and topic with default round, followed by assignment with default topic and round, and finally assignment with both default topic and default round. In this precedence rule, the default topic corresponds to &amp;lt;code&amp;gt;project_topic_id&amp;lt;/code&amp;gt; being null, and the default round corresponds to &amp;lt;code&amp;gt;used_in_round&amp;lt;/code&amp;gt; being null.&lt;br /&gt;
&lt;br /&gt;
If no topic-specific mapping is found, the system falls back according to the defined precedence, including assignment-level round-specific rubrics when applicable, before using the assignment-wide default rubric.&lt;br /&gt;
&lt;br /&gt;
Only the reviewee team's confirmed topic signup for the current assignment is considered, and waitlisted topic signups do not determine rubric selection.&lt;br /&gt;
&lt;br /&gt;
== UI and Instructor Workflow ==&lt;br /&gt;
&lt;br /&gt;
Instructors configure topic-based rubrics directly in assignment setup on the Topics tab. For each topic, the UI exposes dropdowns for selecting the review rubric, and when &amp;lt;code&amp;gt;vary_by_round&amp;lt;/code&amp;gt; is enabled, round-specific rubric choices are also supported. This approach keeps all configuration within the standard assignment authoring flow and avoids introducing any external components.&lt;br /&gt;
&lt;br /&gt;
The existing assignment-level review rubric remains available as the default fallback when a topic-specific rubric is not configured. Reviewers do not choose the rubric themselves; instead, they receive the questionnaire resolved automatically for the team they are reviewing.&lt;br /&gt;
&lt;br /&gt;
== API and Validation ==&lt;br /&gt;
&lt;br /&gt;
Assignment create and update flows persist &amp;lt;code&amp;gt;vary_by_topic&amp;lt;/code&amp;gt; cleanly, and parameter naming is normalized so that there is a single canonical internal field. Assignment questionnaire updates accept an optional &amp;lt;code&amp;gt;project_topic_id&amp;lt;/code&amp;gt; and validate that the topic belongs to the same assignment.&lt;br /&gt;
&lt;br /&gt;
Validation ensures that &amp;lt;code&amp;gt;project_topic_id&amp;lt;/code&amp;gt; references an existing topic and does not cross assignment boundaries. The system also prevents duplicate review-rubric mappings for the same assignment, topic, and round combination, ensuring that rubric resolution always produces a single correct result.&lt;br /&gt;
&lt;br /&gt;
Only instructors or administrators who can edit the assignment are allowed to enable topic-based rubric variation or modify topic-rubric mappings.&lt;br /&gt;
&lt;br /&gt;
== Migration and Rollout ==&lt;br /&gt;
&lt;br /&gt;
Migration first adds &amp;lt;code&amp;gt;vary_by_topic&amp;lt;/code&amp;gt; to assignments, followed by adding a nullable &amp;lt;code&amp;gt;project_topic_id&amp;lt;/code&amp;gt; to assignment questionnaires along with the necessary foreign key and indexes. Existing rows remain valid with a null topic id and continue to represent assignment-level defaults.&lt;br /&gt;
&lt;br /&gt;
After deployment, instructors can enable topic variation gradually on a per-assignment basis using the existing user interface.&lt;br /&gt;
&lt;br /&gt;
== Testing Strategy ==&lt;br /&gt;
&lt;br /&gt;
Tests verify that assignments without topic variation remain unchanged, while topic-enabled assignments correctly select topic-specific rubrics when configured. They also ensure that fallback behavior functions properly when a team has no topic or no topic-specific rubric mapping.&lt;br /&gt;
&lt;br /&gt;
Additional tests confirm deterministic precedence when both topic and round variation are enabled and ensure that scoring behavior remains consistent with the selected questionnaire.&lt;br /&gt;
&lt;br /&gt;
== Risks ==&lt;br /&gt;
&lt;br /&gt;
The main risk is ambiguity in precedence when both topic and round variation are present. This is mitigated by defining a strict lookup order and enforcing it through testing. Another risk is partial configuration, where topic variation is enabled but mappings are incomplete; this is mitigated by safe fallback behavior and validation in configuration paths.&lt;br /&gt;
&lt;br /&gt;
== Open Questions ==&lt;br /&gt;
&lt;br /&gt;
If an instructor changes a topic-rubric mapping after reviews have begun, existing responses could resolve to a different rubric unless the selected mapping is preserved. The implementation should either store the selected assignment questionnaire on the response or prevent mapping changes once reviews are underway.&lt;br /&gt;
&lt;br /&gt;
== Implementation Notes ==&lt;br /&gt;
&lt;br /&gt;
Implementation focuses on schema changes, shared internal rubric lookup logic, integration at current rubric selection call sites, user interface support on the Topics tab, and regression coverage for response and scoring paths.&lt;br /&gt;
&lt;br /&gt;
Known integration points include response questionnaire lookup, scoring maximum-score calculation, and any review form initialization path that currently assumes assignment-level rubric selection.&lt;/div&gt;</summary>
		<author><name>Vagarwa3</name></author>
	</entry>
</feed>