department-of-veterans-affairs / va.gov-team

Public resources for building on and in support of VA.gov. Visit complete Knowledge Hub:
https://depo-platform-documentation.scrollhelp.site/index.html
283 stars 204 forks source link

526ez Failed Claim Documentation #62593

Closed kylesoskin closed 1 year ago

kylesoskin commented 1 year ago

Details

It has been decided that the 526ez historical claim remediation effort be transferred to the new 526 team(s).

This work has been on-going for around 1 year. The summary is, over the past 5+ years, there have been many cases of claims submitted that went into a blackhole. The VA is now remediating and reprocessing.

Terms

Submission IDs - The VA.gov internal database ID. Claim ID / VBMS ID - The internal ID in the system of record (VBMS). Participant ID - An identifier to Identify a Veteran. CMP / Central Mail Portal - A digital intake center at the VA for digital form submissions MAS / Mail Automation System - A team/system inside CMP that tries to automate processing of the form before they get into the CMP queue (where a human needs to look at them) Batches - Discrete subsets of claims, grouped by submission IDs.

Solutions

Backup Submission Path

The "band-aide" to "stop the bleeding". When submissions fail going directly to VBMS (via eVSS), they get slapped on a PDF and sent into Central Mail. Currently there are about 100-200 of these per week (that without the backup solution would otherwise have gone into the void). There are still some instances of these that fail too, that still go into the void, about 0-7 submissions per week.

Historical Remediation

All the historically failed claims (up to a point in time) were handed over to the VBA and evaluated. Of around 150k total failed submissions, they were deduplicated by the VBA into ~40k unique submissions (dedupped by veteran and contentions). These were originally being chunked up by which errors they had and which would be able to be loaded and when, however since so much time has passed the "batches" to be reprocessed have more or less become arbitrary. They have not yet actually loaded/turned any of them into claims yet. Also, all ones that are still failing, and all ones after the point in time of the original dedup that failed, will also need reproccessed somehow. Either manually through the backup submission process, or this historical process. They do not want to run all of them through the backup pdf process as manual human processing is expensive and it would overwhelm them to get 40k all at once. So they want to auto-establish the claims via a script, and are doing so in batches of claims.

They need the following for each "batch" to be able to create a claim systematically. This is the stuff we need to provide them.

PDF representations of the claims

batch = Sidekiq::Batch.new
throttle = Sidekiq::Limiter.concurrent("Form526BackupSubmission-#{Time.now.to_i}", 8, wait_timeout: 259_200,
                                                                                       lock_timeout: 120)
ids.each do |id|
  throttle.within_limit do
    batch.jobs do
      Sidekiq::Form526BackupSubmissionProcess::NonBreakeredForm526BackgroundLoader.perform_async(id)
    end
  end
end

This, for all IDs in ids queues a job to load each submission, generate all forms and ancillary forms, zip them as "#{id}.zip and upload them to S3. Then, you can provide ids to the VA people to pull them down via presigned S3 urls. I used a script like

concurency=24
count=0

function getaws {
  echo -n "."
  URL=$(aws s3 presign s3://$S3_BUCKET/$1.zip --expires-in 86400)
  echo "$1,\"${URL}\"" >> out.txt
}

for ID in $(cat ids_to_pull.txt); do 
  count=$((count+1))
  getaws $ID &
  if [ $count -eq $concurency ]; then
    wait
    count=0
  fi  
done

CSV For all claims in batch

Va Notify (they want to notify the Veterans, via email, after batch establishment)

# I have all the creds/keys and can provide if/when needed
class RemediationEmailer
  SECRET_KEY = ENV['SECRET_KEY']
  SERVICE_ID = ENV['SERVICE_ID']
  API_KEY    = "historical-526-emails-#{SERVICE_ID}-#{SECRET_KEY}"
  TEMPLATE_ID= ENV['TEMPLATE_ID'] 
  attr_accessor :returned_id
  def initialize(fname: nil, email: nil)
    @fname = fname
    @email = email
    @notify_client = VaNotify::Service.new(API_KEY)
  end
  def send_email!(form526_submission_id)
    begin
      if (@email.nil? || @fname.nil?)
        db_fname, db_email = get_email_and_first_name_from_submission_id(form526_submission_id) 
        @fname = db_fname if @fname.nil?
        @email = db_email if @email.nil? 
      end
      email_result = send_p
      @returned_id = email_result.id
      Rails.logger.info(
        "526 Historical Failure Email - success!",
        submission_id: form526_submission_id, 
        va_notify_id: @returned_id
      )
    rescue => e
      Rails.logger.error(
        "526 Historical Failure Email - FAILURE! #{e.message}.",
        backtrace: e.backtrace, 
        submission_id: form526_submission_id
      )
    end
  end
  private
  def send_p
    @notify_client.send_email(
      email_address: @email,
      template_id: TEMPLATE_ID,
      personalisation: {
        'first_name' => @fname
      }
    )
  end
  def get_email_and_first_name_from_submission_id(id)
    sub = Form526Submission.find(id)
    return [sub.auth_headers["va_eauth_firstName"], sub.form['form526']['form526']['veteran']['emailAddress']]
  end
end

# Emailer, but send all emails sent from it to provided email address (useful for testing)
# emailer = RemediationEmailer.new(email: "test@example.org")
ids = []
ids.each do |id|
  emailer = RemediationEmailer.new()
  emailer.send_email!(id)
end

Outstanding items

saderagsdale commented 1 year ago

@kylesoskin @tblackwe @austinjprice Hey all - when is a good time to huddle on this work?

austinjprice commented 1 year ago

Monday or Tuesday is best as Thomas and will be out tomorrow

++ @SamStuckey

saderagsdale commented 1 year ago

Action items fro my chat with @austinjprice: