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

Ndbex 70721 map form fields #15838

Merged
merged 44 commits into from
Mar 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
34ceed3
initial commit, add 530ez to repo
evansmith Feb 12, 2024
00e9f84
replace with new version
evansmith Feb 12, 2024
53e2b99
setup copies of 530 to prep for 530ez
evansmith Feb 12, 2024
3a6a3ff
setup tentative keys for veteran info
evansmith Feb 13, 2024
c6d5e06
wip: updated fields for pages 1 and 2
evansmith Feb 23, 2024
7fb9d85
small changes, swapped forms
evansmith Feb 26, 2024
c1ea933
slight changes
evansmith Feb 29, 2024
2c9fc9d
Merge branch 'master' into ndbex-70721-map-form-fields
evansmith Mar 1, 2024
13cc805
renaming
evansmith Mar 1, 2024
8f0cac5
prepare to toggle on form id
evansmith Mar 1, 2024
6159990
temporarily point at other branch
evansmith Mar 1, 2024
e30b7f7
version 2 toggle
evansmith Mar 1, 2024
612e938
change to formV2
evansmith Mar 1, 2024
ab882f3
update schema ref
evansmith Mar 1, 2024
5ec65e2
experiment to get formV2
evansmith Mar 1, 2024
0ba5de6
update api to receive 21p-530v2, maintain form_id throughout process …
evansmith Mar 6, 2024
8331d8a
updated hash for temp branch
evansmith Mar 6, 2024
093f727
temporary update to schema ref
evansmith Mar 8, 2024
ab223b0
mapped a new pdf, small field updates
evansmith Mar 11, 2024
dcf04c5
fix pdf telephone field. begin mapping values
evansmith Mar 12, 2024
c8e9862
relationship to veteran and final resting place
evansmith Mar 12, 2024
6ddee44
updates to pdf and methods filling in values
evansmith Mar 15, 2024
b655a50
update schema ref
evansmith Mar 15, 2024
29c175f
combine previous names and service
evansmith Mar 15, 2024
6ed7d07
more pdf fill work
evansmith Mar 19, 2024
c1e47c6
flipper for controller and model
evansmith Mar 20, 2024
69589cb
fix lettering
evansmith Mar 20, 2024
8ce8776
update schema ref
evansmith Mar 20, 2024
cbfa3de
small updates
evansmith Mar 20, 2024
a578906
fix merge conflict
evansmith Mar 20, 2024
b41300d
Merge branch 'master' into ndbex-70721-map-form-fields
tblackwe Mar 21, 2024
9cbbb94
fix overflow for both suffix fields and international phone number. a…
evansmith Mar 21, 2024
22e199c
Merge branch 'ndbex-70721-map-form-fields' of github.com:department-o…
evansmith Mar 21, 2024
e77bb14
unit tests
evansmith Mar 22, 2024
26062ab
process option
evansmith Mar 22, 2024
5b18f0c
update gemfile lock
evansmith Mar 22, 2024
8e548cc
merge conflict
evansmith Mar 22, 2024
7c3e45a
rubocop
evansmith Mar 25, 2024
7234283
remove flipper check that interferes with other claim types
evansmith Mar 25, 2024
377da6b
update with process option
evansmith Mar 25, 2024
f2a3a98
better error handling for parse
evansmith Mar 25, 2024
f9ec159
Merge branch 'master' into ndbex-70721-map-form-fields
evansmith Mar 25, 2024
c7b0e9e
Merge branch 'master' into ndbex-70721-map-form-fields
evansmith Mar 25, 2024
0e89d34
Merge branch 'master' into ndbex-70721-map-form-fields
evansmith Mar 25, 2024
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
12 changes: 9 additions & 3 deletions app/controllers/v0/burial_claims_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,24 @@ class BurialClaimsController < ClaimsBaseController

def create
PensionBurial::TagSentry.tag_sentry
claim = claim_class.new(form: filtered_params[:form])

claim = if Flipper.enabled?(:va_burial_v2)
# cannot parse a nil form, to pass unit tests do a check for form presence
form = filtered_params[:form]
claim_class.new(form:, formV2: form.present? ? JSON.parse(form)['formV2'] : nil)
else
claim_class.new(form: filtered_params[:form])
end

unless claim.save
StatsD.increment("#{stats_key}.failure")
Sentry.set_tags(team: 'benefits-memorial-1') # tag sentry logs with team name
raise Common::Exceptions::ValidationErrors, claim
end

# this method also calls claim.process_attachments!
claim.submit_to_structured_data_services!

Rails.logger.info "ClaimID=#{claim.confirmation_number} Form=#{claim.class::FORM}"
Rails.logger.info "ClaimID=#{claim.confirmation_number} Form=#{claim.form_id}"
clear_saved_form(claim.form_id)
render(json: claim)
end
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/v0/claim_documents_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def create

def klass
case form_id
when '21P-527EZ', '21P-530'
when '21P-527EZ', '21P-530', '21P-530V2'
PensionBurial::TagSentry.tag_sentry
PersistentAttachments::PensionBurial
when '21-686C', '686C-674'
Expand Down
3 changes: 2 additions & 1 deletion app/models/form_profile.rb
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ class FormProfile
22-5495 22-0993 22-0994 FEEDBACK-TOOL 22-10203 22-1990S 22-1990EZ],
evss: ['21-526EZ'],
hca: %w[1010ez 10-10EZR],
pension_burial: %w[21P-530 21P-527EZ],
pension_burial: %w[21P-530 21P-527EZ 21P-530V2],
dependents: ['686C-674'],
decision_review: %w[20-0995 20-0996 10182],
mdot: ['MDOT'],
Expand Down Expand Up @@ -121,6 +121,7 @@ class FormProfile
'22-5490E' => ::FormProfiles::VA5490e,
'22-5495' => ::FormProfiles::VA5495,
'21P-530' => ::FormProfiles::VA21p530,
'21P-530V2' => ::FormProfiles::VA21p530v2,
'21-686C' => ::FormProfiles::VA21686c,
'686C-674' => ::FormProfiles::VA686c674,
'40-10007' => ::FormProfiles::VA4010007,
Expand Down
33 changes: 33 additions & 0 deletions app/models/form_profiles/va_21p530v2.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# frozen_string_literal: true

require 'iso_country_codes'

class FormProfiles::VA21p530v2 < FormProfile
def metadata
{
version: 0,
prefill: true,
returnUrl: '/claimant-information'
}
end

def prefill
@identity_information = initialize_identity_information
@contact_information = initialize_contact_information
if @contact_information&.address&.country.present?
@contact_information.address.country = convert_to_iso2(@contact_information.address.country)
end
mappings = self.class.mappings_for_form(form_id)

form_data = generate_prefill(mappings) if FormProfile.prefill_enabled_forms.include?(form_id)

{ form_data:, metadata: }
end

private

def convert_to_iso2(country_code)
code = IsoCountryCodes.find(country_code)
code.alpha2
end
end
4 changes: 2 additions & 2 deletions app/models/saved_claim.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class SavedClaim < ApplicationRecord
# create a uuid for this second (used in the confirmation number) and store
# the form type based on the constant found in the subclass.
after_initialize do
self.form_id = self.class::FORM.upcase
self.form_id = self.class::FORM.upcase unless instance_of?(SavedClaim::Burial)
end

def self.add_form_and_validation(form_id)
Expand All @@ -51,7 +51,7 @@ def process_attachments!

def submit_to_structured_data_services!
# Only 21P-530 burial forms are supported at this time
if form_id != '21P-530'
unless %w[21P-530 21P-530V2].include?(form_id)
err_message = "Unsupported form id: #{form_id}"
raise Common::Exceptions::UnprocessableEntity.new(detail: err_message), err_message
end
Expand Down
19 changes: 19 additions & 0 deletions app/models/saved_claim/burial.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,17 @@
class SavedClaim::Burial < CentralMailClaim
FORM = '21P-530'

# attribute name is passed from the FE as a flag, maintaining camel case
attr_accessor :formV2 # rubocop:disable Naming/MethodName

after_initialize do
self.form_id = if Flipper.enabled?(:va_burial_v2)
formV2 || form_id == '21P-530V2' ? '21P-530V2' : self.class::FORM.upcase
else
self.class::FORM.upcase
end
end

def process_attachments!
refs = attachment_keys.map { |key| Array(open_struct_form.send(key)) }.flatten
files = PersistentAttachment.where(guid: refs.map(&:confirmationCode))
Expand All @@ -25,6 +36,14 @@ def email
parsed_form['claimantEmail']
end

def form_matches_schema
return unless form_is_string

JSON::Validator.fully_validate(VetsJsonSchema::SCHEMAS[form_id], parsed_form).each do |v|
errors.add(:form, v.to_s)
end
end

def business_line
'NCA'
end
Expand Down
3 changes: 1 addition & 2 deletions app/sidekiq/structured_data/process_data_job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@ def perform(saved_claim_id)
ensure
@claim.process_attachments! # upload claim and attachments to Central Mail

send_confirmation_email if @claim.form_id == '21P-530'

send_confirmation_email if %w[21P-530 21P-530V2].include?(@claim.form_id)
# veteran lookup for hit/miss metrics in support of Automation work
StatsD.increment("#{stats_key}.success",
tags: %W[relationship:#{relationship_type} veteranInMVI:#{veteran&.participant_id}])
Expand Down
3 changes: 3 additions & 0 deletions config/features.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1139,6 +1139,9 @@ features:
va_view_dependents_access:
actor_type: user
description: Allows us to gate the View/ Modify dependents content in a progressive rollout
va_burial_v2:
actor_type: user
description: Allows us to toggle between 21-P530 and 21-P530V2
show_edu_benefits_1990EZ_Wizard:
actor_type: user
description: Navigates user to 1990EZ or 1990 depending on form questions.
Expand Down
2 changes: 1 addition & 1 deletion lib/bip_claims/service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class Service < Common::Client::Base

def veteran_attributes(claim)
case claim.form_id
when '21P-530'
when '21P-530', '21P-530V2'
ssn, full_name, bday = claim.parsed_form.values_at(
'veteranSocialSecurityNumber',
'veteranFullName',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

require 'pdf_fill/forms/va21p527ez'
require 'pdf_fill/forms/va21p530'
require 'pdf_fill/forms/va21p530v2'
require 'pdf_fill/forms/va214142'
require 'pdf_fill/forms/va210781a'
require 'pdf_fill/forms/va210781'
Expand Down
2 changes: 2 additions & 0 deletions lib/pdf_fill/filler.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

require 'pdf_fill/forms/va21p527ez'
require 'pdf_fill/forms/va21p530'
require 'pdf_fill/forms/va21p530v2'
require 'pdf_fill/forms/va214142'
require 'pdf_fill/forms/va210781a'
require 'pdf_fill/forms/va210781'
Expand All @@ -25,6 +26,7 @@ module Filler
FORM_CLASSES = {
'21P-527EZ' => PdfFill::Forms::Va21p527ez,
'21P-530' => PdfFill::Forms::Va21p530,
'21P-530V2' => PdfFill::Forms::Va21p530v2,
'21-4142' => PdfFill::Forms::Va214142,
'21-0781a' => PdfFill::Forms::Va210781a,
'21-0781' => PdfFill::Forms::Va210781,
Expand Down
Binary file added lib/pdf_fill/forms/pdfs/21P-530V2.pdf
Binary file not shown.
Loading
Loading