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

APPEALS-45199: Update Quality Review selection probabilities #21518

Merged
merged 2 commits into from
May 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/models/judge_case_review.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class JudgeCaseReview < CaseflowRecord
# As of Dec 2019, we want AMA and Legacy to use the same cap. The percentages may differ. The
# goal is to get to the cap as steadily across the month as possible
MONTHLY_LIMIT_OF_QUALITY_REVIEWS = 137
QUALITY_REVIEW_SELECTION_PROBABILITY = 0.032
QUALITY_REVIEW_SELECTION_PROBABILITY = 0.100

def update_in_vacols!
MetricsService.record("VACOLS: judge_case_review #{task_id}",
Expand Down
2 changes: 1 addition & 1 deletion app/models/quality_review_case_selector.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ class QualityReviewCaseSelector
# AMA Limit and Probability. See Legacy numbers at app/models/judge_case_review.rb:28
# This probability was selected by Derek Brown, QR Director at BVA
MONTHLY_LIMIT_OF_QUALITY_REVIEWS = 164
QUALITY_REVIEW_SELECTION_PROBABILITY = 0.188
QUALITY_REVIEW_SELECTION_PROBABILITY = 0.057

class << self
def select_case_for_quality_review?
Expand Down
19 changes: 12 additions & 7 deletions spec/models/quality_review_case_selector_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,27 @@
describe ".reached_monthly_limit_in_quality_reviews?" do
subject { QualityReviewCaseSelector.reached_monthly_limit_in_quality_reviews? }
context "when a realistic number of cases are completed" do
# Pulled from prod with:
# Originally pulled from prod with:
# Task.where(
# appeal_type: Appeal.name,
# assigned_to_type: Organization.name,
# type: [QualityReviewTask.name, BvaDispatchTask.name],
# created_at: 2.month.ago.beginning_of_month..2.month.ago.end_of_month
# ).count
let(:complete_cases_count) { 1600 }
let!(:qr_tasks) do
complete_cases_count.times do
create(:qr_task) if QualityReviewCaseSelector.select_case_for_quality_review?
end
# Updated to use the constants provided in the file with margin to not be a seemingly arbitrary number.
# As of 4/2024, there were over 4000 cases being completed each month.
let(:complete_cases_count) do
limit = QualityReviewCaseSelector::MONTHLY_LIMIT_OF_QUALITY_REVIEWS
probability = QualityReviewCaseSelector::QUALITY_REVIEW_SELECTION_PROBABILITY

((limit / probability) * 1.2).to_i
end

it "should hit at least the monthly minimum of QR tasks" do
expect(QualityReviewTask.count).to be >= 164
count = 0
complete_cases_count.times { count += 1 if QualityReviewCaseSelector.select_case_for_quality_review? }

expect(count).to be >= QualityReviewCaseSelector::MONTHLY_LIMIT_OF_QUALITY_REVIEWS
end
end

Expand Down
Loading