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

CAVC Remand: Create New Appeal Stream #14792

Closed
6 tasks
araposo-tistatech opened this issue Jul 29, 2020 · 5 comments · Fixed by #15469
Closed
6 tasks

CAVC Remand: Create New Appeal Stream #14792

araposo-tistatech opened this issue Jul 29, 2020 · 5 comments · Fixed by #15469
Assignees
Labels
Priority: Medium Blocking issue w/workaround, or "second in" priority for new work. Product: caseflow-queue Stakeholder: BVA Functionality associated with the Board of Veterans' Appeals workflows/feature requests Team: Echo 🐬 Type: New Development New feature development

Comments

@araposo-tistatech
Copy link

araposo-tistatech commented Jul 29, 2020

User or job story

Job story: When a JMR/JMPR CAVC Remand is initiated via the court order form a new appeal stream should be created and linked to the Boards previous decision docket number so that a new decision can be issued.

Acceptance criteria

  • If anything would show to users before CAVC Remands enter the system, lock that behind FeatureToggle: cavc_remand
  • New appeal stream is created when Litigation Support team chooses a JMR or JMPR and clicks submit on the court order form
  • New appeal stream is linked to the existing docket number at the Board
  • Create Root Case, Distribution Task and CavcTask
  • Add instances of new appeal stream to seed data
  • Verify the original and new appeal appears when searching for original Docket #

Background/context

Technical notes

Motions to Vacate currently links to the docket number so this is something we should be able to reuse.

Other notes

Resources/other links

#10991 (comment)

@araposo-tistatech araposo-tistatech added Product: caseflow-queue Stakeholder: BVA Functionality associated with the Board of Veterans' Appeals workflows/feature requests Team: Echo 🐬 Priority: Medium Blocking issue w/workaround, or "second in" priority for new work. Type: New Development New feature development labels Jul 29, 2020
@araposo-tistatech araposo-tistatech changed the title CAVC Remand: Create New Appeal Stream CAVC Remand: Create New Appeal Stream (Backend) Jul 29, 2020
@araposo-tistatech araposo-tistatech changed the title CAVC Remand: Create New Appeal Stream (Backend) CAVC Remand: Create New Appeal Stream Sep 28, 2020
@yoomlam
Copy link
Contributor

yoomlam commented Oct 1, 2020

what is this chart?

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

Refer to MTV's way of creating a new appeal stream.

A new Appeal record with tasks should be created.

  • Update CAVC Remand to create appeal
  • Create appeal of CAVC type with tasks
  • Create tasks on the appeal

Why 3?

Why 5?

  • New feature test
  • Unfamiliarity with creating a new appeal stream
  • New appeal stream, non-trivial
  • we've never done new appeal flows

@lomky
Copy link
Contributor

lomky commented Oct 1, 2020

Existing new stream behavior on appeal

def create_stream(stream_type)
ActiveRecord::Base.transaction do
Appeal.create!(slice(
:receipt_date,
:veteran_file_number,
:legacy_opt_in_approved,
:veteran_is_not_claimant,
:docket_type
).merge(
stream_type: stream_type,
stream_docket_number: docket_number,
established_at: Time.zone.now
)).tap do |stream|
stream.create_claimant!(
participant_id: claimant.participant_id,
payee_code: claimant.payee_code,
type: claimant.type
)
end
end
end

@yoomlam
Copy link
Contributor

yoomlam commented Oct 1, 2020

@araposo-tistatech Consider breaking up into a 2-point documentation + 3-point implementation tickets.

@lomky
Copy link
Contributor

lomky commented Oct 15, 2020

what is this chart?

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

Existing code, used in multiple places to create the new appeal stream.

  • We can use this preexisting method to create the appeal
  • We'll need to add handling into the InitialTasksFactory:create_subtasks to specify the CAVC tree
  • don't have to rearchitect anything major to the CAVC appeal to go!

@ajspotts to post notes from spike!

Why 3?

  • Uses existing functionality
  • New tests for this new workflow

Why 5?

  • Still a little wary!

@ajspotts
Copy link
Contributor

Findings from spike ticket located here

@lomky lomky added Eng: Beginner Friendly Good tickets for new team members and removed Eng: Beginner Friendly Good tickets for new team members labels Oct 16, 2020
@lomky lomky self-assigned this Oct 19, 2020
@lomky lomky added this to the PI5-S6: XXX Sprint milestone Oct 19, 2020
va-bot pushed a commit that referenced this issue Oct 20, 2020
Connects #14792 

### Description
Fixes the CavcRemand updated_by field to not be required

### Acceptance Criteria
- [x] Tests pass
- [ ] on the console you can create a valid CavcRemand with or without an updated_by


### Testing Plan
```
## No User Set - Valid

cavc_remand = CavcRemand.new(appeal: Appeal.find(346), cavc_decision_type: Constants.CAVC_DECISION_TYPES.remand, cavc_docket_number: 5, cavc_judge_full_name: "Joseph L. Toth", created_by: User.first, decision_date: 5.days.ago, decision_issue_ids: Appeal.find(346).decision_issues.pluck(:id), instructions: "foo", judgement_date: 3.days.ago, mandate_date: 3.days.ago, remand_subtype: Constants.CAVC_REMAND_SUBTYPES.jmr, represented_by_attorney: true)

cavc_remand.validate!
=> true

cavc_remand.save!
=> true

cavc_remand.reload
=> # should not have updated_by set

# lets set us a user!
RequestStore.store[:current_user] = User.second

## Updates with user sets it
cavc_remand.update!(instructions: "bar")
cavc_remand.reload
=> # should  have updated_by set

## create another with the user set
cavc_remand2 = CavcRemand.new(appeal: Appeal.find(346), cavc_decision_type: Constants.CAVC_DECISION_TYPES.remand, cavc_docket_number: 5, cavc_judge_full_name: "Joseph L. Toth", created_by: User.first, decision_date: 5.days.ago, decision_issue_ids: Appeal.find(346).decision_issues.pluck(:id), instructions: "foo", judgement_date: 3.days.ago, mandate_date: 3.days.ago, remand_subtype: Constants.CAVC_REMAND_SUBTYPES.jmr, represented_by_attorney: true)

cavc_remand2.validate!
=> true

cavc_remand2.save!
=> true

cavc_remand2.reload
=> # should have updated_by set
```

### Database Changes
*Only for Schema Changes*

* [x] Timestamps (created_at, updated_at) for new tables
* [x] Column comments updated
* [x] Have your migration classes inherit from `Caseflow::Migration`, especially when adding indexes (use `add_safe_index`)
* [x] Verify that `migrate:rollback` works as desired ([`change` supported functions](https://edgeguides.rubyonrails.org/active_record_migrations.html#using-the-change-method))
* [x] Query profiling performed (eyeball Rails log, check bullet and fasterer output)
* [x] Appropriate indexes added (especially for foreign keys, polymorphic columns, unique constraints, and Rails scopes)
* [x] DB schema docs updated with `make docs` (after running `make migrate`)
* [x] #appeals-schema notified with summary and link to this PR
va-bot pushed a commit that referenced this issue Oct 26, 2020
…#15469)

Resolves #14792 

### Description
Please explain the changes you made here.

### Acceptance Criteria
- [ ] Code compiles correctly
- [ ] (Nothing shows) ~If anything would show to users before CAVC Remands enter the system, lock that behind FeatureToggle: cavc_remand~
- [ ] New appeal stream is created when Litigation Support team chooses a JMR or JMPR and clicks submit on the court order form
- [ ] New appeal stream is linked to the existing docket number at the Board
- [ ] Create Root Case, Distribution Task and CavcTask
- [ ] Add instances of new appeal stream to seed data
- [ ] Verify the original and new appeal appears when searching for original Docket #

### Testing Plan
All via console for now - see reference code below
1. Create dispatched appeal and create a JMR CavcRemands
   - [x] No Errors
   - [x] There is now a CAVC appeal stream with the same issues
1. Create dispatched appeal and create a JMPR CavcRemands
   - [x] No Errors
   - [x] There is now a CAVC appeal stream with the subset of issues
1. Create a CavcRemand factory object, default
   - [x] No Errors
   - [x] There is a dispatched original appeal stream associated with the CavcRemand
   - [x] There is now a CAVC appeal stream
1. Create a CavcRemand factory object, pass in an Appeal
   - [x] No Errors
   - [x] The provided appeal stream associated with the CavcRemand
   - [x] There is now a CAVC appeal stream with request issues matching the provided Appeal's decision issues
1. Confirm the Search AC in the GUI
1. Confirm the db seeding works, and Disptached & CAVC cases are created

### Reference code!
Create a ready for CAVC appeal
```ruby
original_appeal = FactoryBot.create(:appeal, 
                           :dispatched, 
                           associated_judge: JudgeTeam.first.judge, 
                           associated_attorney: JudgeTeam.first.attorneys.first)
FactoryBot.create_list(:request_issue, 2,                                                                                  
            :rating,                                                                                            
            :with_rating_decision_issue,                                                                           
            decision_review: original_appeal,                                                                               
            veteran_participant_id: Veteran.first.participant_id,                                                        
            contested_issue_description: "issue_description",                                                              
            notes: "issue_notes")
```
Create JMR/JMPR CavcRemand
```ruby
params = {
  created_by: User.first,
  appeal: original_appeal,
  cavc_docket_number: 1234,
  represented_by_attorney: true,
  cavc_judge_full_name: Constants::CAVC_JUDGE_FULL_NAMES.first,
  cavc_decision_type: Constants::CAVC_DECISION_TYPES.keys.first,
  decision_date: 2.days.ago,
  judgement_date: 2.days.ago,
  mandate_date: 2.days.ago,
  instructions: "cavc instructions"}

jmr_params = params.merge({remand_subtype: Constants::CAVC_REMAND_SUBTYPES.keys.first,
                           decision_issue_ids: original_appeal.decision_issues.pluck(:id)})
jmr_cavc_remand = CavcRemand.create!(jmr_params)

jmpr_params = params.merge({remand_subtype: Constants::CAVC_REMAND_SUBTYPES.keys.second,
                           decision_issue_ids: [original_appeal.decision_issues.first.id]})
jmpr_cavc_remand = CavcRemand.create!(jmr_params)
```
Find CAVC/Court Remand Stream Appeals
```ruby
Appeal.court_remand.where(stream_docket_number: original_appeal.docket_number)
```

Create a CavcRemand factory:
```ruby
cavc_remand = FactoryBot.create(:cavc_remand)
```
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 Stakeholder: BVA Functionality associated with the Board of Veterans' Appeals workflows/feature requests Team: Echo 🐬 Type: New Development New feature development
Projects
None yet
4 participants