Automatic Task Distribution - department-of-veterans-affairs/caseflow GitHub Wiki

Goal

Some organizations at the Board support a standard assignment process to assign tasks to their team. Automatic Task Distribution solves this need.

NB: This is not how cases are assigned to VLJs. See Automatic case distribution for how cases move from Case Storage to a Judge's assign queue.

Concepts

Organizations

Automatic Task Distribution is active on specific Caseflow Organizations as requested by the corresponding Board organization.

Caseflow Organizations that use this feature are, as of 2020-April:

Round Robin Assignment

Round robin assignment rotates assignments evenly through an entire team by distributing a task to each user on a team before starting back at the beginning.

Caseflow Task Distribution Algorithms

Pure Round Robin

The entire set of users for a team is pulled, in order, along with the last assigned user-visible task. The next task will be assigned to whomever is after this last visible assigned task's assignee.

Implemented in Caseflow in the RoundRobinTaskDistributor Model

BVA Dispatch Round Robin

The BVA Dispatch team uses pure Round Robin without any overrides.

Implemented in Caseflow in the BvaDispatchTaskDistributor

VLJ Support Round Robin

The VLJ Support team uses a modified Round Robin.

If the appeal for this new task already has an open task assigned to any member of the VLJ team, the next task will always be assigned to that team member. The intent is to have the one member, who is already working on the appeal, handle any additional tasks on that same appeal.

Implemented in Caseflow in the ColocatedTaskDistributor Model

Pulac Cerullo Automatic Assignment

The Pulac Cerullo team is a single person. The task is automatically assigned to the first member of the team

Detailed Caseflow Architecture

Task/Org logic

Written 2020-April. Code will drift

When a Task is created that is assigned to an Organization we ask the organization if the user task should be automatically created.

after_create :create_and_auto_assign_child_task, if: :automatically_assign_org_task?

ref

def automatically_assign_org_task?
  assigned_to.is_a?(Organization) && assigned_to.automatically_assign_to_member?
end

ref

That function checks if this Organization overrides the method to find the next assignee to return any non-nil value

def automatically_assign_to_member?
  !!next_assignee
end

ref

If true, create_and_auto_assign_child_task creates the user task by invoking that next_assignee method

def create_and_auto_assign_child_task(options = {})
  dup.tap do |child_task|
    child_task.assigned_to = assigned_to.next_assignee(**options)
    child_task.parent = self
    child_task.save!
  end
end

ref

ColocatedTask overrides create_and_auto_assign_child_task to pass in the appeal

def create_and_auto_assign_child_task(_options = {})
  super(appeal: appeal)
end

ref

Bugs

Bugfix: in 2020-May we addressed a bug where RoundRobin distributions type considered any task of their specified Type, even tasks invisible to users. When analyzing assignment history across this point, you may need to factor that in.