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

Fix priority logic for appeals with aod motions for appeal attribute caching #15353

Closed
8 tasks
hschallhorn opened this issue Sep 30, 2020 · 2 comments · Fixed by #15396
Closed
8 tasks

Fix priority logic for appeals with aod motions for appeal attribute caching #15353

hschallhorn opened this issue Sep 30, 2020 · 2 comments · Fixed by #15396
Labels
Feature: generic-queue 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: Bug

Comments

@hschallhorn
Copy link
Contributor

Description

Now that AOD motions should be associated with an actual appeal (#14085), we need to adjust the logic for what we consider priority for cached appeal. This is still looking for motions associated with the claimant that were created after the appeal was established.

def aod_status_for_appeals(appeals)
Appeal.where(id: appeals).joins(
"left join claimants on appeals.id = claimants.decision_review_id and claimants.decision_review_type = 'Appeal' "\
"left join people on people.participant_id = claimants.participant_id "\
"left join advance_on_docket_motions on advance_on_docket_motions.person_id = people.id "
).where(
"(advance_on_docket_motions.granted = true and advance_on_docket_motions.created_at > appeals.receipt_date) "\
"or people.date_of_birth < (current_date - interval '75 years')"
).pluck(:id)
end

Acceptance criteria

  • Cached appeals are marked as AOD ONLY if one of the following is true
    • aod_based_on_age is true on the appeal
    • The claimant's dob is over 75 years ago
    • The claimant has a granted age base aod motion
    • The appeal has a granted aod motion associated with the appeal
    • The appeal is a cavc remand (not yet implemented)
  • Query is written so no N+1 queries (should only produce one db call if possible for alllllllll appeals)
  • Job is benchmarked before and after changes to ensure we have not blown up an already long job runtime

Notes

The first 3 AC have a lot of overlap. What should we consider as our source of truth as I assume we don't want to check all 3?

Background/context/resources

Related: #15352

Technical notes

@hschallhorn hschallhorn added Product: caseflow-queue Type: Bug Feature: generic-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. labels Sep 30, 2020
@yoomlam
Copy link
Contributor

yoomlam commented Oct 1, 2020

what is this chart?

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

Performant caching involves writing efficient SQL.

Why 3?

  • This job is known to fail (see #appeals-job-alerts) due to other problems.

Why 5?

  • Non-trivial SQL queries
  • Ensure we're not introducing unnecessary additional querying

@lomky lomky added this to the PI5-S5: XXX Sprint milestone Oct 5, 2020
@yoomlam yoomlam self-assigned this Oct 6, 2020
@yoomlam yoomlam removed this from the PI5-S5: Eleanor Roosevelt Sprint milestone Oct 29, 2020
@yoomlam yoomlam removed their assignment Oct 29, 2020
@yoomlam
Copy link
Contributor

yoomlam commented Oct 29, 2020

Blocked and deprioritized -- see #13175 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature: generic-queue 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: Bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants