-
Notifications
You must be signed in to change notification settings - Fork 66
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
Api 26640 establish 526 claim #12907
Merged
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
d8f5ee6
Add evss container mapper
acovrig 4aac01e
Update mapper a little
acovrig b68efbc
Small refactor and add specs
acovrig e522c59
Update EVSS URL
acovrig af3db66
Temporarily disable submit
acovrig 596c7c9
Make specialIssues an array
acovrig 123ef31
Remove extra fields and temporarily disable PACT
acovrig eca177c
Merge branch 'master' into API-26640-establish-526-claim
acovrig 279b5f1
Fix classificationCode test
acovrig 327994c
Update spec
acovrig 9ff0833
Merge branch 'master' into API-26640-establish-526-claim
acovrig 7f44284
Remove extra mapping (and enable serviceInfo)
acovrig 5075d65
Remove extra comments (for other ticket)
acovrig 3c50019
Merge branch 'master' into API-26640-establish-526-claim
acovrig File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
101 changes: 101 additions & 0 deletions
101
modules/claims_api/lib/claims_api/v2/disability_compensation_evss_mapper.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
# frozen_string_literal: true | ||
|
||
module ClaimsApi | ||
module V2 | ||
class DisabilityCompensationEvssMapper | ||
def initialize(auto_claim) | ||
@auto_claim = auto_claim | ||
@data = auto_claim&.form_data&.deep_symbolize_keys | ||
@evss_claim = {} | ||
end | ||
|
||
def map_claim | ||
claim_attributes | ||
claim_meta | ||
|
||
{ form526: @evss_claim } | ||
end | ||
|
||
private | ||
|
||
def claim_attributes | ||
service_information | ||
current_mailing_address | ||
direct_deposit | ||
disabilities | ||
standard_claim | ||
veteran_meta | ||
end | ||
|
||
def current_mailing_address | ||
addr = @data.dig(:veteranIdentification, :mailingAddress) || {} | ||
@evss_claim[:veteran] ||= {} | ||
@evss_claim[:veteran][:currentMailingAddress] = addr | ||
@evss_claim[:veteran][:currentMailingAddress].merge!({ | ||
addressLine1: addr[:numberAndStreet], | ||
addressLines2: addr[:apartmentOrUnitNumber], | ||
type: 'DOMESTIC' | ||
stiehlrod marked this conversation as resolved.
Show resolved
Hide resolved
|
||
}) | ||
@evss_claim[:veteran][:currentMailingAddress].except!(:numberAndStreet, :apartmentOrUnitNumber) | ||
end | ||
|
||
def direct_deposit | ||
return if @data[:directDeposit].empty? | ||
|
||
@evss_claim[:directDeposit] = @data[:directDeposit] | ||
@evss_claim[:directDeposit][:bankName] = @data[:directDeposit][:financialInstitutionName] | ||
@evss_claim[:directDeposit].except!(:financialInstitutionName, :noAccount) | ||
end | ||
|
||
def disabilities | ||
@evss_claim[:disabilities] = @data[:disabilities].map do |disability| | ||
disability[:approximateBeginDate] = map_date_to_obj disability[:approximateDate] | ||
disability[:secondaryDisabilities] = disability[:secondaryDisabilities].map do |secondary| | ||
secondary[:approximateBeginDate] = map_date_to_obj secondary[:approximateDate] | ||
secondary.except(:exposureOrEventOrInjury, :approximateDate) | ||
end | ||
|
||
disability.except(:approximateDate, :isRelatedToToxicExposure) | ||
end | ||
end | ||
|
||
def service_information | ||
stiehlrod marked this conversation as resolved.
Show resolved
Hide resolved
|
||
info = @data[:serviceInformation] | ||
@evss_claim[:serviceInformation] = { | ||
servicePeriods: info[:servicePeriods], | ||
reservesNationalGuardService: { | ||
obligationTermOfServiceFromDate: info[:reservesNationalGuardService][:obligationTermsOfService][:startDate], | ||
obligationTermOfServiceToDate: info[:reservesNationalGuardService][:obligationTermsOfService][:endDate], | ||
unitName: info[:reservesNationalGuardService][:unitName] | ||
} | ||
} | ||
end | ||
|
||
def standard_claim | ||
@evss_claim[:standardClaim] = @data[:claimProcessType] == 'STANDARD_CLAIM_PROCESS' | ||
end | ||
|
||
def claim_meta | ||
@evss_claim[:applicationExpirationDate] = Time.zone.today + 1.year | ||
@evss_claim[:claimantCertification] = @data[:claimantCertification] | ||
@evss_claim[:submtrApplcnTypeCd] = 'LH-B' | ||
end | ||
|
||
def veteran_meta | ||
@evss_claim[:veteran] ||= {} | ||
@evss_claim[:veteran][:currentlyVAEmployee] = @data.dig(:veteranIdentification, :currentlyVaEmployee) | ||
@evss_claim[:veteran][:emailAddress] = @data.dig(:veteranIdentification, :emailAddress, :email) | ||
@evss_claim[:veteran][:fileNumber] = @data.dig(:veteranIdentification, :vaFileNumber) | ||
end | ||
|
||
def map_date_to_obj(date) | ||
date = if date.is_a? Date | ||
date | ||
else | ||
DateTime.parse(date) | ||
end | ||
{ year: date.year, month: date.month, day: date.day } | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
72 changes: 72 additions & 0 deletions
72
modules/claims_api/spec/lib/claims_api/v2/disability_compensation_evss_mapper_spec.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'rails_helper' | ||
require 'claims_api/v2/disability_compensation_evss_mapper' | ||
|
||
describe ClaimsApi::V2::DisabilityCompensationEvssMapper do | ||
describe '526 claim maps to the evss container' do | ||
let(:form_data) do | ||
JSON.parse( | ||
Rails.root.join( | ||
'modules', | ||
'claims_api', | ||
'spec', | ||
'fixtures', | ||
'v2', | ||
'veterans', | ||
'disability_compensation', | ||
'form_526_json_api.json' | ||
).read | ||
) | ||
end | ||
let(:auto_claim) do | ||
create(:auto_established_claim, form_data: form_data['data']['attributes']) | ||
end | ||
let(:evss_data) { ClaimsApi::V2::DisabilityCompensationEvssMapper.new(auto_claim).map_claim[:form526] } | ||
|
||
context '526 section 0' do | ||
it 'maps the cert correctly' do | ||
expect(evss_data[:claimantCertification]).to be true | ||
end | ||
end | ||
|
||
context '526 section 1' do | ||
it 'maps the mailing address' do | ||
addr = evss_data[:veteran][:currentMailingAddress] | ||
expect(addr[:addressLine1]).to eq('1234 Couch Street') | ||
expect(addr[:city]).to eq('Portland') | ||
expect(addr[:country]).to eq('USA') | ||
expect(addr[:zipFirstFive]).to eq('41726') | ||
expect(addr[:state]).to eq('OR') | ||
end | ||
|
||
it 'maps the other veteran info' do | ||
expect(evss_data[:veteran][:fileNumber]).to eq('AB123CDEF') | ||
expect(evss_data[:veteran][:currentlyVAEmployee]).to eq(false) | ||
expect(evss_data[:veteran][:emailAddress]).to eq('valid@somedomain.com') | ||
end | ||
end | ||
|
||
context '526 section 5, claim info: disabilities' do | ||
it 'maps the attributes correctly' do | ||
disability = evss_data[:disabilities][0] | ||
secondary = disability[:secondaryDisabilities][0] | ||
|
||
expect(disability[:disabilityActionType]).to eq('REOPEN') | ||
expect(disability[:name]).to eq('PTSD (post traumatic stress disorder)') | ||
expect(disability[:classificationCode]).to eq('5420') | ||
expect(disability[:serviceRelevance]).to eq('ABCDEFG') | ||
expect(disability[:ratedDisabilityId]).to eq('ABCDEFGHIJKLMNOPQRSTUVWX') | ||
expect(disability[:diagnosticCode]).to eq(9999) | ||
expect(disability[:exposureOrEventOrInjury]).to eq('EXPOSURE') | ||
expect(disability[:approximateBeginDate]).to eq({ year: 2018, month: 11, day: 3 }) | ||
|
||
expect(secondary[:name]).to eq('Cancer - Musculoskeletal - Elbow') | ||
expect(secondary[:disabilityActionType]).to eq('SECONDARY') | ||
expect(secondary[:serviceRelevance]).to eq('ABCDEFGHIJKLMNOPQ') | ||
expect(secondary[:classificationCode]).to eq('249470') | ||
expect(secondary[:approximateBeginDate]).to eq({ year: 2018, month: 12, day: 3 }) | ||
end | ||
end | ||
end | ||
end |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm leaving these commented out for now since the container itself seems flaky, I don't want another dev to get stuck trying to figure out why this endpoint doesn't work sometimes.