Caseflow: CM: Extend the organizations_user with judge & attorney roles

Created on 17 Oct 2019  路  5Comments  路  Source: department-of-veterans-affairs/caseflow

In order to allow others to act on behalf of Judges, add clear roles to members of Judge Teams.

Acceptance Criteria

  • [ ] organizations_users table has a column judge_team_role, valid values of nil, judge, and attorney
  • [ ] Judge teams can only have only have one judge

This ticket _does not_ include updating the code base to do anything with these fields, nor updating the existing teams.

Part of #11801

Echo 馃惉

Most helpful comment

@lomky Love this idea! Super pumped to stop overloading the admin column for JudgeTeams!

How do you feel about moving the new judge_team_role column into a different table since it will only apply to judge teams? That field will only have values for OrganzationUsers associated with JudgeTeams and right now less than a third of the rows in that table are associated with JudgeTeams. That proportion will likely decrease over time since we will add more teams and organizations, and judges and attorneys are already well populated in that table.

rails c> OrganizationsUser.count
# 3144
rails c> OrganizationsUser.where(organization_id: JudgeTeam.pluck(:id)).count
# 954

What do you think of a table definition that looks like the following:

judge_team_users (
  organziations_users_id    int -- could instead use organization and user IDs
  role                      enum(judge, attorney)
)

Some advantages to this approach include:

  1. Avoiding null roles. If a user is in a judge team they will have a role.
  2. All column in OrganizationsUser are relevant to all rows. Currently there are only three columns in this table that are not used for linking the user and the organization. created_at and updated_at provide timestamps and admin is a boolean which describes whether someone is has administrative privileges or not. All organizations make use of administrative privileges in some way (user management), so this applies to all rows in the table.

All 5 comments

Estimating at 1.

@lomky Love this idea! Super pumped to stop overloading the admin column for JudgeTeams!

How do you feel about moving the new judge_team_role column into a different table since it will only apply to judge teams? That field will only have values for OrganzationUsers associated with JudgeTeams and right now less than a third of the rows in that table are associated with JudgeTeams. That proportion will likely decrease over time since we will add more teams and organizations, and judges and attorneys are already well populated in that table.

rails c> OrganizationsUser.count
# 3144
rails c> OrganizationsUser.where(organization_id: JudgeTeam.pluck(:id)).count
# 954

What do you think of a table definition that looks like the following:

judge_team_users (
  organziations_users_id    int -- could instead use organization and user IDs
  role                      enum(judge, attorney)
)

Some advantages to this approach include:

  1. Avoiding null roles. If a user is in a judge team they will have a role.
  2. All column in OrganizationsUser are relevant to all rows. Currently there are only three columns in this table that are not used for linking the user and the organization. created_at and updated_at provide timestamps and admin is a boolean which describes whether someone is has administrative privileges or not. All organizations make use of administrative privileges in some way (user management), so this applies to all rows in the table.

We're going to proceed as follows:

  1. [x] Create new JudgeTeamRole single-table inheritance models (slightly modified approach described above) (#12449).
  2. [x] Add comments to new judge_team_roles table.
  3. [x] Start creating these objects in the application code (#12481).

    • Ensure JudgeTeams have only one User with the JudgeTeamLead role.

    • Ensure JudgeTeamLeads are always identified as admins in the associated OrganizationsUser model.

  4. [ ] Backfill data where JudgeTeamRoles should exist. (#12421)
  5. [ ] Cut over to identifying judges and attorneys using JudgeTeamRoles (#12422)

@lowellrex number 3 is a follow-on ticket, as well. #12421

Closing this ticket since all remaining work will happen in #12481, #12421, and #12422.

Was this page helpful?
0 / 5 - 0 ratings