Skip to content

Commit

Permalink
Merge branch 'master' into dependabot/bundler/aws-sdk-kms-1.89.0
Browse files Browse the repository at this point in the history
  • Loading branch information
rjohnson2011 authored Sep 5, 2024
2 parents ae6c36e + 4d2ca74 commit 5eecad2
Show file tree
Hide file tree
Showing 36 changed files with 331 additions and 634 deletions.
53 changes: 0 additions & 53 deletions .github/workflows/code_health_report.yml

This file was deleted.

10 changes: 1 addition & 9 deletions app/models/concerns/form526_claim_fast_tracking_concern.rb
Original file line number Diff line number Diff line change
Expand Up @@ -120,14 +120,6 @@ def diagnostic_codes
disabilities.pluck('diagnosticCode')
end

def eligible_for_ep_merge?
user = User.find(user_uuid)
return true if Flipper.enabled?(:disability_526_ep_merge_multi_contention, user)
return false unless disabilities.count == 1

Flipper.enabled?(:disability_526_ep_merge_new_claims, user) ? increase_or_new? : increase_only?
end

def prepare_for_evss!
begin
is_claim_fully_classified = update_classification!
Expand All @@ -136,7 +128,7 @@ def prepare_for_evss!
Rails.logger.error e.backtrace.join('\n')
end

prepare_for_ep_merge! if eligible_for_ep_merge? && is_claim_fully_classified
prepare_for_ep_merge! if is_claim_fully_classified

return if pending_eps? || disabilities_not_service_connected?

Expand Down
30 changes: 10 additions & 20 deletions app/models/saved_claim/coe_claim.rb
Original file line number Diff line number Diff line change
@@ -1,34 +1,24 @@
# frozen_string_literal: true

require 'sentry_logging'

class SavedClaim::CoeClaim < SavedClaim
include SentryLogging

FORM = '26-1880'

def send_to_lgy(edipi:, icn:)
@edipi = edipi
@icn = icn

# If the EDIPI is blank, throw an error
if @edipi.blank?
log_message_to_sentry(
'COE application cannot be submitted without an edipi!',
:error,
{},
{ team: 'vfs-ebenefits' }
)
Rails.logger.error('COE application cannot be submitted without an edipi!')
# Otherwise, submit the claim to the LGY API
else
Rails.logger.info('Begin COE claim submission to LGY API', guid:)
response = lgy_service.put_application(payload: prepare_form_data)
Rails.logger.info('COE claim submitted to LGY API', guid:)

process_attachments!
response['reference_number']
end

response = lgy_service.put_application(payload: prepare_form_data)
log_message_to_sentry(
"COE claim submitted to LGY: #{guid}",
:warn,
{ attachment_id: guid },
{ team: 'vfs-ebenefits' }
)
process_attachments!
response['reference_number']
end

def regional_office
Expand Down
47 changes: 36 additions & 11 deletions app/sidekiq/form526_state_logging_job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,16 @@ class Form526StateLoggingJob

END_DATE = Time.zone.today.beginning_of_day
START_DATE = END_DATE - 1.week
STATSD_PREFIX = 'form526.state'

def initialize(start_date: START_DATE, end_date: END_DATE)
@start_date = start_date
@end_date = end_date
end

def perform
Rails.logger.info('Form 526 State Data',
state_log: abbreviated_state_log,
start_date:,
end_date:)
write_as_gauges
write_as_log
rescue => e
Rails.logger.error('Error logging 526 state data',
class: self.class.name,
Expand All @@ -28,20 +27,46 @@ def perform
end_date:)
end

def state_log
timeboxed_state.merge(all_time_state)
def write_as_log
Rails.logger.info('Form 526 State Data',
state_log: counts_with_failures,
start_date:,
end_date:)
end

def counts_with_failures
counts = state_as_counts
counts[:total_failure_type_ids] = total_failure_type
counts
end

def base_state
@base_state ||= timeboxed_state.merge(all_time_state)
end

def abbreviated_state_log
{}.tap do |abbreviation|
state_log.each do |dp, ids|
def state_as_counts
@state_as_counts ||= {}.tap do |abbreviation|
base_state.each do |dp, ids|
abbreviation[:"#{dp}_count"] = ids.count
end
abbreviation[:total_failure_type_ids] = total_failure_type
end
end

def write_as_gauges
state_as_counts.each do |description, count|
StatsD.gauge("#{STATSD_PREFIX}.#{description}", count)
end
end

def timeboxed_state
@timeboxed_state ||= load_timeboxed_state
end

def all_time_state
@all_time_state ||= load_all_time_state
end

def load_timeboxed_state
{
timeboxed: timeboxed_submissions.pluck(:id).sort,
timeboxed_primary_successes: timeboxed_submissions.accepted_to_primary_path.pluck(:id).sort,
Expand All @@ -51,7 +76,7 @@ def timeboxed_state
}
end

def all_time_state
def load_all_time_state
{
total_awaiting_backup_status: Form526Submission.pending_backup.pluck(:id).sort,
total_incomplete_type: Form526Submission.incomplete_type.pluck(:id).sort,
Expand Down
6 changes: 0 additions & 6 deletions config/features.yml
Original file line number Diff line number Diff line change
Expand Up @@ -431,12 +431,6 @@ features:
disability_526_ep_merge_api:
actor_type: user
description: enables sending 526 claims with a pending EP to VRO EP Merge API for automated merging.
disability_526_ep_merge_new_claims:
actor_type: user
description: enables EP Merge for single-contention 526 claims for a new condition
disability_526_ep_merge_multi_contention:
actor_type: user
description: enables EP Merge for multi-contention 526 claims
disability_526_toxic_exposure:
actor_type: user
description: enables new pages, processing, and submission of toxic exposure claims
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
class AddCiphertextFieldsToFormSubmissionAttempts < ActiveRecord::Migration[7.1]
def change
add_column :form_submission_attempts, :error_message_ciphertext, :text
add_column :form_submission_attempts, :response_ciphertext, :jsonb
end
end
4 changes: 3 additions & 1 deletion db/schema.rb

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion db/seeds/development.rb
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,10 @@
SignIn::ServiceAccountConfig.find_or_initialize_by(service_account_id: vaid_service_account_id)
identity_dashboard_service_account_config.update!(service_account_id: vaid_service_account_id,
description: 'VA Identity Dashboard API',
scopes: ['http://localhost:3000/sign_in/client_configs'],
scopes: [
'http://localhost:3000/sign_in/client_configs',
'http://localhost:3000/sign_in/service_account_configs'
],
access_token_audience: 'http://localhost:4000',
access_token_duration: vaid_access_token_duration,
certificates: [vaid_certificate],
Expand Down
9 changes: 1 addition & 8 deletions lib/bgs/service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -207,14 +207,7 @@ def create_note(claim_id, note_text)
txt: note_text
}.merge!(bgs_auth).except!(:jrn_status_type_cd)

response = service.notes.create_note(option_hash)
message = if response[:note]
response[:note].slice(:clm_id, :txt)
else
response
end
log_message_to_sentry(message, :info, {}, { team: 'vfs-ebenefits' })
response
service.notes.create_note(option_hash)
rescue => e
notify_of_service_exception(e, __method__, 1, :warn)
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def upload
@power_of_attorney.reload

# If upload is successful, then the PoaUpater job is also called to update the code in BGS.
ClaimsApi::PoaVBMSUploadJob.perform_async(@power_of_attorney.id)
ClaimsApi::PoaVBMSUploadJob.perform_async(@power_of_attorney.id, action: 'put')

render json: ClaimsApi::PowerOfAttorneySerializer.new(@power_of_attorney)
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ def validate_form_526_change_of_address_country

collect_error_messages(
source: '/changeOfAddress/country',
detail: 'The country provided is not a valid.'
detail: 'The country provided is not valid.'
)
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ class PoaVBMSUploadJob < ClaimsApi::ServiceBase
# If successfully uploaded, it queues a job to update the POA code in BGS, as well.
#
# @param power_of_attorney_id [String] Unique identifier of the submitted POA
def perform(power_of_attorney_id)
def perform(power_of_attorney_id, action: 'post')
power_of_attorney = ClaimsApi::PowerOfAttorney.find(power_of_attorney_id)
uploader = ClaimsApi::PowerOfAttorneyUploader.new(power_of_attorney_id)
uploader.retrieve_from_store!(power_of_attorney.file_data['filename'])
file_path = fetch_file_path(uploader)

if Flipper.enabled?(:lighthouse_claims_api_poa_use_bd)
benefits_doc_api.upload(claim: power_of_attorney, pdf_path: file_path, doc_type: 'L075')
benefits_doc_api.upload(claim: power_of_attorney, pdf_path: file_path, action:, doc_type: 'L075')
else
upload_to_vbms(power_of_attorney, file_path)
end
Expand Down
29 changes: 17 additions & 12 deletions modules/claims_api/lib/bd/bd.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def search(claim_id, file_number)
# Upload document of mapped claim
#
# @return success or failure
def upload(claim:, pdf_path:, doc_type: 'L122', file_number: nil, original_filename: nil, # rubocop:disable Metrics/ParameterLists
def upload(claim:, pdf_path:, doc_type: 'L122', action: 'post', file_number: nil, original_filename: nil, # rubocop:disable Metrics/ParameterLists
pctpnt_vet_id: nil)
unless File.exist? pdf_path
ClaimsApi::Logger.log('benefits_documents', detail: "Error uploading doc to BD: #{pdf_path} doesn't exist,
Expand All @@ -46,7 +46,7 @@ def upload(claim:, pdf_path:, doc_type: 'L122', file_number: nil, original_filen
end

@multipart = true
body = generate_upload_body(claim:, doc_type:, pdf_path:, file_number:, original_filename:,
body = generate_upload_body(claim:, doc_type:, pdf_path:, action:, file_number:, original_filename:,
pctpnt_vet_id:)
res = client.post('documents', body)&.body

Expand Down Expand Up @@ -100,18 +100,17 @@ def get_claim_id(doc_type, claim)
#
# @return {parameters, file}
# rubocop:disable Metrics/ParameterLists
def generate_upload_body(claim:, doc_type:, pdf_path:, file_number: nil, original_filename: nil,
def generate_upload_body(claim:, doc_type:, pdf_path:, action:, file_number: nil, original_filename: nil,
pctpnt_vet_id: nil)
payload = {}
auth_headers = claim.auth_headers
veteran_name = compact_veteran_name(auth_headers['va_eauth_firstName'], auth_headers['va_eauth_lastName'])
birls_file_num = auth_headers['va_eauth_birlsfilenumber'] || file_number if doc_type != 'L705'
claim_id = get_claim_id(doc_type, claim)
file_name = generate_file_name(doc_type:, veteran_name:, claim_id:, original_filename:)
file_name = generate_file_name(doc_type:, veteran_name:, claim_id:, original_filename:, action:)
participant_id = pctpnt_vet_id if %w[L075 L190 L705].include?(doc_type)
system_name = 'Lighthouse' if %w[L075 L190].include?(doc_type)
tracked_item_ids = claim.tracked_items&.map(&:to_i) if claim&.has_attribute?(:tracked_items)

data = build_body(doc_type:, file_name:, participant_id:, claim_id:,
file_number: birls_file_num, system_name:, tracked_item_ids:)

Expand All @@ -123,16 +122,22 @@ def generate_upload_body(claim:, doc_type:, pdf_path:, file_number: nil, origina
end
# rubocop:enable Metrics/ParameterLists

def generate_file_name(doc_type:, veteran_name:, claim_id:, original_filename:)
def generate_file_name(doc_type:, veteran_name:, claim_id:, original_filename:, action:)
# https://confluence.devops.va.gov/display/VAExternal/Document+Types
doc_type_to_form_name = {
'L075' => '21-22a',
'L122' => '526EZ',
'L190' => '21-22',
'L705' => '5103'
doc_type_names = {
'put' => {
'L075' => 'representative',
'L190' => 'representative'
},
'post' => {
'L075' => '21-22a',
'L122' => '526EZ',
'L190' => '21-22',
'L705' => '5103'
}
}

form_name = doc_type_to_form_name[doc_type]
form_name = doc_type_names[action][doc_type]

if form_name
"#{[veteran_name, claim_id, form_name].compact_blank.join('_')}.pdf"
Expand Down
Loading

0 comments on commit 5eecad2

Please sign in to comment.