Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move completed AttorneyTasks to new JudgeDecisionReviewTask on reassign #13279

Closed
2 tasks
hschallhorn opened this issue Jan 28, 2020 · 3 comments
Closed
2 tasks
Assignees
Labels
Priority: Medium Blocking issue w/workaround, or "second in" priority for new work. Product: caseflow-queue Team: Echo 🐬 Type: Metrics or Reporting

Comments

@hschallhorn
Copy link
Contributor

Tableau reporting and some places in our code assumes and active or completed JudgeDecisionReviewTask will have a child AttorneyTask. In many cases this is not true.

jdr_tasks = JudgeDecisionReviewTask.not_cancelled
jdr_tasks.count
=> 6478
atty_tasks = AttorneyTask.not_cancelled

jdr_tasks_without_atty_tasks = jdr_tasks.where.not(id: atty_tasks.pluck(:parent_id))
jdr_tasks_without_atty_tasks.count
=> 382

# Let's look at the task trees for these to see what happened
puts jdr_tasks_without_atty_tasks.take(5).map { |task| task.appeal.structure_render(:status) }
Appeal 9285 [status]
└── RootTask on_hold
    ├── TrackVeteranTask in_progress
    ├── DistributionTask completed
    ├── JudgeAssignTask completed
    ├── JudgeDecisionReviewTask cancelled
       └── AttorneyTask completed
    ├── JudgeDecisionReviewTask completed
    └── BvaDispatchTask on_hold
        └── BvaDispatchTask assigned
Appeal 8479 [status]
└── RootTask completed
    ├── TrackVeteranTask completed
    ├── DistributionTask completed
       └── InformalHearingPresentationTask completed
           └── InformalHearingPresentationTask completed
    ├── JudgeAssignTask cancelled
    ├── JudgeAssignTask completed
    ├── JudgeDecisionReviewTask cancelled
       └── AttorneyTask cancelled
    ├── JudgeAssignTask completed
    ├── JudgeDecisionReviewTask cancelled
       └── AttorneyTask completed
    ├── JudgeDecisionReviewTask cancelled
    ├── JudgeDecisionReviewTask completed
    └── BvaDispatchTask completed
        └── BvaDispatchTask completed
Appeal 10128 [status]
└── RootTask on_hold
    ├── TrackVeteranTask in_progress
    ├── DistributionTask completed
    ├── JudgeAssignTask completed
    ├── JudgeDecisionReviewTask cancelled
       └── AttorneyTask completed
    ├── JudgeDecisionReviewTask completed
    └── BvaDispatchTask on_hold
        └── BvaDispatchTask assigned
Appeal 10742 [status]
└── RootTask on_hold
    ├── DistributionTask completed
    ├── JudgeAssignTask completed
    ├── JudgeDecisionReviewTask cancelled
       └── AttorneyTask completed
    ├── JudgeDecisionReviewTask completed
    └── BvaDispatchTask on_hold
        └── BvaDispatchTask assigned
Appeal 46151 [status]
└── RootTask on_hold
    ├── TrackVeteranTask in_progress
    ├── DistributionTask completed
       └── InformalHearingPresentationTask completed
           └── InformalHearingPresentationTask completed
    ├── JudgeAssignTask completed
    ├── JudgeDecisionReviewTask cancelled
       └── AttorneyTask completed
           └── IhpColocatedTask completed
               └── IhpColocatedTask completed
                   └── TimedHoldTask completed
    ├── JudgeDecisionReviewTask cancelled
    └── JudgeDecisionReviewTask assigned

# Looks like these probably stemmed from a reassign, given the cancelled JudgeDecisionReviewTask. Let's double check they all have a cancelled task
reassigned_jdr_tasks = jdr_tasks_without_atty_tasks.select { |task| task.appeal.tasks.cancelled.where(type: JudgeDecisionReviewTask.name).exists? }
 reassigned_jdr_tasks.count
=> 382
# Yup!

It would appear that all of these cases have a cancelled JudgeDecisionReviewTask, implying that these JudgeDecisionReviewTasks were reassigned after the AttorneyTask was completed. Currently, we only move open children to the new parent when we reassign a task.

AC

  • Non cancelled AttorneyTasks should move to the new task when a JudgeDecisionReviewTask is reassigned
  • Appeals in this state in production are fixed

Notes

Could possibly look into simply moving all children to the new parent on task reassign, or just non cancelled children

@hschallhorn hschallhorn added Product: caseflow-queue Team: Echo 🐬 Priority: Medium Blocking issue w/workaround, or "second in" priority for new work. Type: Metrics or Reporting labels Jan 28, 2020
@ajspotts
Copy link
Contributor

What is this graph?

1 | 
2 | 
3 | ||||||||||||
5 | 
8 |  

Good team knowledge around this space. Quite a bit of work, folks with less familiarity may glean some good info here.

@pkarman
Copy link
Contributor

pkarman commented Feb 18, 2020

fyi researching this for the original ticket I wrote this AR query that may help identify existing data problem:

JudgeDecisionReviewTask.cancelled
  .joins(:children).where(children_tasks: { status: Constants.TASK_STATUSES.completed })
  .joins(:parent).where(parents_tasks: { status: Constants.TASK_STATUSES.completed})
  .count

see https://github.com/department-of-veterans-affairs/dsva-vacols/issues/99#issuecomment-587577959 et al

va-bot pushed a commit that referenced this issue Feb 18, 2020
…#13449)

References #13279

### Description
We always expect an open or complete `JudgeDecisionReviewTask` to have a child `AttorneyTask`. This ensures that the child `AttorneyTask` is reassigned with the `JudgeDecisionReviewTask`, even if it is complete

### Acceptance Criteria
- [ ] completed `AttorneyTask`s are adopted by new parent on reassign

### Testing Plan
1. Sign is as BVAAABSHIRE
2. Go to an AMA appeal that has an open `JudgeDecisionReviewTask` assigned to AAAAABSHIRE
3. Peep the task tree
```ruby
Appeal.find_by(uuid: "398eac67-c102-4865-94c1-4b5889efd4b1").treee
                                ┌───────────────────────────────────────────────────────────────────────┐
Appeal 50 (direct_review) ───── │ ID  │ STATUS    │ ASGN_BY     │ ASGN_TO     │ UPDATED_AT              │
└── RootTask                    │ 585 │ on_hold   │             │ Bva         │ 2020-02-03 16:48:34 UTC │
    └── JudgeDecisionReviewTask │ 586 │ assigned  │ CSS_ID103   │ BVAAABSHIRE │ 2020-02-03 16:48:34 UTC │
        └── AttorneyTask        │ 587 │ completed │ BVAAABSHIRE │ BVASCASPER1 │ 2020-02-03 16:48:34 UTC │
                                └───────────────────────────────────────────────────────────────────────┘
```
4. Reassign this task to another judge
5. Ensure the completed `AttorneyTask` is moved under the new `JudgeDecisionReviewTask`
```ruby
Appeal.find_by(uuid: "398eac67-c102-4865-94c1-4b5889efd4b1").treee
                                ┌────────────────────────────────────────────────────────────────────────┐
Appeal 50 (direct_review) ───── │ ID   │ STATUS    │ ASGN_BY     │ ASGN_TO     │ UPDATED_AT              │
└── RootTask                    │ 585  │ on_hold   │             │ Bva         │ 2020-02-03 16:48:34 UTC │
    ├── JudgeDecisionReviewTask │ 586  │ cancelled │ CSS_ID103   │ BVAAABSHIRE │ 2020-02-18 20:01:13 UTC │
    └── JudgeDecisionReviewTask │ 1213 │ assigned  │ BVAAABSHIRE │ BVAEBECKER  │ 2020-02-18 20:01:13 UTC │
        └── AttorneyTask        │ 587  │ completed │ BVAAABSHIRE │ BVASCASPER1 │ 2020-02-18 20:01:13 UTC │
                                └────────────────────────────────────────────────────────────────────────┘
```
@hschallhorn
Copy link
Contributor Author

Fixed here. Waiting for response here to ensure this is fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Priority: Medium Blocking issue w/workaround, or "second in" priority for new work. Product: caseflow-queue Team: Echo 🐬 Type: Metrics or Reporting
Projects
None yet
Development

No branches or pull requests

3 participants