Skip to content

Commit

Permalink
Merge branch 'master' into dbex/94144_trigger_email_on_polled_4142_fa…
Browse files Browse the repository at this point in the history
…ilure
  • Loading branch information
kylesoskin committed Oct 25, 2024
2 parents 643e726 + ab82629 commit 244f851
Show file tree
Hide file tree
Showing 50 changed files with 981 additions and 98 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/code_checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
env:
BUNDLE_ENTERPRISE__CONTRIBSYS__COM: ${{ secrets.BUNDLE_ENTERPRISE__CONTRIBSYS__COM }}
permissions: write-all
runs-on: ubuntu-16-cores-latest
runs-on: ubuntu-32-cores-latest
steps:
- uses: actions/checkout@v4

Expand Down Expand Up @@ -63,7 +63,7 @@ jobs:
DOCKER_BUILDKIT: 1
COMPOSE_DOCKER_CLI_BUILD: 1
permissions: write-all
runs-on: ubuntu-16-cores-latest
runs-on: ubuntu-32-cores-latest
steps:
- uses: actions/checkout@v4

Expand Down Expand Up @@ -131,13 +131,13 @@ jobs:
max_attempts: 3
command: |
docker compose -f docker-compose.test.yml run web bash \
-c "CI=true RAILS_ENV=test DISABLE_BOOTSNAP=true bundle exec parallel_test -n 13 -e 'bin/rails db:reset'"
-c "CI=true RAILS_ENV=test DISABLE_BOOTSNAP=true bundle exec parallel_test -n 24 -e 'bin/rails db:reset'"
- name: Run Specs
timeout-minutes: 20
run: |
docker compose -f docker-compose.test.yml run web bash \
-c "CI=true DISABLE_BOOTSNAP=true bundle exec parallel_rspec spec/ modules/ -n 13 -o '--color --tty'"
-c "CI=true DISABLE_BOOTSNAP=true bundle exec parallel_rspec spec/ modules/ -n 24 -o '--color --tty'"
- name: Upload Coverage Report
uses: actions/upload-artifact@v4
Expand Down
24 changes: 21 additions & 3 deletions app/controllers/concerns/form_attachment_create.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,21 +41,39 @@ def validate_file_upload_class!
raise Common::Exceptions::InvalidFieldValue.new('file_data', filtered_params[:file_data].class.name)
end
rescue => e
log_exception_to_sentry(e, { context: 'FAC_validate', class: filtered_params[:file_data].class.name })
log_message_to_sentry(
'form attachment error 1',
:info,
phase: 'FAC_validate',
klass: filtered_params[:file_data].class.name,
exception: e.message
)
raise e
end

def save_attachment_to_cloud!
form_attachment.set_file_data!(filtered_params[:file_data], filtered_params[:password])
rescue => e
log_exception_to_sentry(e, { context: 'FAC_cloud' })
log_message_to_sentry(
'form attachment error 2',
:info,
phase: 'FAC_cloud',
exception: e.message
)
raise e
end

def save_attachment_to_db!
form_attachment.save!
rescue => e
log_exception_to_sentry(e, { context: 'FAC_db', errors: form_attachment.errors })
log_message_to_sentry(
'form attachment error 3',
:info,
phase: 'FAC_db',
errors: form_attachment.errors,
exception: e.message
)

raise e
end

Expand Down
2 changes: 1 addition & 1 deletion app/controllers/concerns/vet360/writeable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def invalidate_cache
def build_record(type, params)
# This needs to be refactored after V2 upgrade is complete
model = if type == 'address' && Flipper.enabled?(:va_v3_contact_information_service, @current_user)
'VAProfile::Models::V2::Address'
'VAProfile::Models::V3::Address'
else
"VAProfile::Models::#{type.capitalize}"
end
Expand Down
6 changes: 3 additions & 3 deletions app/models/va_profile_redis/v2/contact_information.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

require 'va_profile/v2/contact_information/person_response'
require 'va_profile/v2/contact_information/service'
require 'va_profile/models/v2/address'
require 'va_profile/models/v3/address'
require 'va_profile/models/telephone'
require 'common/models/redis_store'
require 'common/models/concerns/cache_aside'
Expand Down Expand Up @@ -53,7 +53,7 @@ def email
def residential_address
return unless @user.loa3?

dig_out('addresses', 'address_pou', VAProfile::Models::V2::Address::RESIDENCE)
dig_out('addresses', 'address_pou', VAProfile::Models::V3::Address::RESIDENCE)
end

# Returns the user's mailing address. In VA Profile, a user can only have one
Expand All @@ -64,7 +64,7 @@ def residential_address
def mailing_address
return unless @user.loa3?

dig_out('addresses', 'address_pou', VAProfile::Models::V2::Address::CORRESPONDENCE)
dig_out('addresses', 'address_pou', VAProfile::Models::V3::Address::CORRESPONDENCE)
end

# Returns the user's home phone. In VA Profile, a user can only have one
Expand Down
2 changes: 1 addition & 1 deletion app/swagger/swagger/schemas/vet360/contact_information.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
require 'va_profile/contact_information/service'
require 'va_profile/v2/contact_information/service'
require 'va_profile/models/address'
require 'va_profile/models/v2/address'
require 'va_profile/models/v3/address'
require 'va_profile/models/telephone'
require 'va_profile/models/permission'
require 'common/models/redis_store'
Expand Down
30 changes: 30 additions & 0 deletions lib/medical_records/bb_internal/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,36 @@ def get_dicom(study_id, header_callback, yielder)
streaming_get(uri, token_headers, header_callback, yielder)
end

##
# @param icn - user icn
# @param last_name - user last name
# @return JSON [{ dateGenerated, status, patientId }]
#
def get_generate_ccd(icn, last_name)
response = perform(:get, "bluebutton/healthsummary/#{icn}/#{last_name}/xml", nil, token_headers)
response.body
end

##
# @param date - receieved from get_generate_ccd call property dateGenerated (e.g. 2024-10-18T09:55:58.000-0400)
# @return - Continuity of Care Document in XML format
#
def get_download_ccd(date)
token_headers['Accept'] = 'application/xml'

response = perform(:get, "bluebutton/healthsummary/#{date}/fileFormat/XML/ccdType/XML", nil, token_headers)
response.body
end

# check the status of a study job
# @return [Array] - [{ status: "COMPLETE", studyIdUrn: "111-1234567" percentComplete: 100, fileSize: "1.01 MB",
# startDate: 1729777818853, endDate}]
#
def get_study_status
response = perform(:get, "bluebutton/studyjob/#{session.patient_id}", nil, token_headers)
response.body
end

private

##
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@

module VAProfile
module Models
module V2
class Address < V2::BaseAddress
module V3
class Address < V3::BaseAddress
attribute :bad_address, Boolean

validates(:source_date, presence: true)

# Converts a decoded JSON response from VAProfile to an instance of the Address model
# @param body [Hash] the decoded response body from VAProfile
# @return [VAProfile::Models::V2::Address] the model built from the response body
# @return [VAProfile::Models::V3::Address] the model built from the response body
# rubocop:disable Metrics/MethodLength
def in_json
address_attributes = {
Expand Down Expand Up @@ -58,10 +58,10 @@ def in_json

# Converts a decoded JSON response from VAProfile to an instance of the Address model
# @param body [Hash] the decoded response body from VAProfile
# @return [VAProfile::Models::V2::Address] the model built from the response body
# @return [VAProfile::Models::V3::Address] the model built from the response body
# rubocop:disable Metrics/MethodLength
def self.build_from(body)
VAProfile::Models::V2::Address.new(
VAProfile::Models::V3::Address.new(
address_line1: body['address_line1'],
address_line2: body['address_line2'],
address_line3: body['address_line3'],
Expand Down Expand Up @@ -96,7 +96,7 @@ def self.build_from(body)
# rubocop:enable Metrics/MethodLength

def correspondence?
@address_pou == VAProfile::Models::V2::Address::CORRESPONDENCE
@address_pou == VAProfile::Models::V3::Address::CORRESPONDENCE
end
end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

module VAProfile
module Models
module V2
module V3
class BaseAddress < Base
include VAProfile::Concerns::Defaultable
include VAProfile::Concerns::Expirable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

module VAProfile
module Models
module V2
module V3
class Person < Base
attribute :addresses, Array[Address]
attribute :created_at, Common::ISO8601Time
Expand All @@ -24,12 +24,12 @@ class Person < Base
# @return [VAProfile::Models::Person] the model built from the response body
def self.build_from(body)
body ||= {}
addresses = body['addresses']&.map { |a| VAProfile::Models::V2::Address.build_from(a) }
addresses = body['addresses']&.map { |a| VAProfile::Models::V3::Address.build_from(a) }
emails = body['emails']&.map { |e| VAProfile::Models::Email.build_from(e) }
telephones = body['telephones']&.map { |t| VAProfile::Models::Telephone.build_from(t) }
body['permissions']&.map { |t| VAProfile::Models::Permission.build_from(t) }

VAProfile::Models::V2::Person.new(
VAProfile::Models::V3::Person.new(
created_at: body['create_date'],
source_date: body['source_date'],
updated_at: body['update_date'],
Expand Down
6 changes: 3 additions & 3 deletions lib/va_profile/v2/contact_information/person_response.rb
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# frozen_string_literal: true

require 'va_profile/response'
require 'va_profile/models/v2/person'
require 'va_profile/models/v3/person'

module VAProfile
module V2
module ContactInformation
class PersonResponse < VAProfile::Response
attribute :person, VAProfile::Models::V2::Person
attribute :person, VAProfile::Models::V3::Person

attr_reader :response_body

Expand All @@ -16,7 +16,7 @@ def self.from(raw_response = nil)

new(
raw_response&.status,
person: VAProfile::Models::V2::Person.build_from(response_body&.dig('bio'))
person: VAProfile::Models::V3::Person.build_from(response_body&.dig('bio'))
)
end

Expand Down
2 changes: 1 addition & 1 deletion lib/va_profile/v2/contact_information/service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def self.get_person(vet360_id)

def update_address(address)
address_type =
if address.address_pou == VAProfile::Models::V2::BaseAddress::RESIDENCE
if address.address_pou == VAProfile::Models::V3::BaseAddress::RESIDENCE
'residential'
else
'mailing'
Expand Down
4 changes: 2 additions & 2 deletions lib/va_profile/v2/contact_information/transaction_response.rb
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@ def changed_field
address_pou = response_body['tx_output'][0]['address_pou']

case address_pou
when VAProfile::Models::V2::BaseAddress::RESIDENCE
when VAProfile::Models::V3::BaseAddress::RESIDENCE
:residence_address
when VAProfile::Models::V2::BaseAddress::CORRESPONDENCE
when VAProfile::Models::V3::BaseAddress::CORRESPONDENCE
:correspondence_address
else
:address
Expand Down
2 changes: 1 addition & 1 deletion modules/check_in/app/services/travel_claim/service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def token

resp = client.token

Oj.load(resp.body)&.fetch('access_token').tap do |access_token|
Oj.safe_load(resp.body)&.fetch('access_token').tap do |access_token|
redis_client.save_token(token: access_token)
end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def get_totals_data
def get_installment_or_other_debt_data_for(item)
data = {
'purpose' => item['purpose'],
'creditorName' => item['creditor_name'],
'creditorName' => item['creditor_name'] || '',
'originalAmount' => format_installment_debt_number(item['original_amount']),
'unpaidBalance' => format_installment_debt_number(item['unpaid_balance']),
'amountDueMonthly' => item['amount_due_monthly'],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def spouse_full_name
{
'first' => @personal_data['spouse_full_name']['first'],
'middle' => @personal_data['spouse_full_name']['middle'] || '',
'last' => @personal_data['spouse_full_name']['last']
'last' => @personal_data['spouse_full_name']['last'] || ''
}
else
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@
get_fixture_absolute('modules/debts_api/spec/fixtures/pre_submission_fsr/post_transform')
end

let(:transformer_data) do
transformer = described_class.new(pre_form_data)
transformer.get_data
transformer.get_totals_data
end

def get_data
transformer = described_class.new(pre_form_data)
@data = transformer.get_data
Expand All @@ -32,6 +38,15 @@ def get_data
expected_installment_contracts_other_debts_data = post_form_data['totalOfInstallmentContractsAndOtherDebts']
expect(expected_installment_contracts_other_debts_data).to eq(@total_data)
end

it 'returns empty string for creditorName' do
pre_form_data['installment_contracts'].first['creditor_name'] = nil
calculator = described_class.new(pre_form_data)
calculator_data = calculator.get_data

creditor_names = calculator_data.pluck('creditorName')
expect(creditor_names).to eq(['', ''])
end
end
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,14 @@
expect(expected_personal_data).to eq(transformer_data)
end

it 'returns empty string for spouseFullName/last' do
pre_transform_fsr_form_data['personal_data']['spouse_full_name']['last'] = nil
calculator = described_class.new(pre_transform_fsr_form_data)
calculator_data = calculator.get_personal_data

expect(calculator_data['spouseFullName']['last']).to eq('')
end

it 'returns empty string for addressLine2 and addressLine3' do
pre_transform_fsr_form_data['personal_data']['veteran_contact_information']['address']['address_line2'] = nil
calculator = described_class.new(pre_transform_fsr_form_data)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ def determine_response_and_serializer(claim_status_response, claimant_response)
if claim_status_response.status == 200
[claim_status_response, ClaimStatusSerializer]
else
[claimant_response, ClaimantSerializer]
[claimant_response, ToeClaimantInfoSerializer]
end
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def save!(http_method, resource_type, params)

def build_record(type, params)
if type == :address && Flipper.enabled?(:va_v3_contact_information_service, @user)
'VAProfile::Models::V2::Address'
'VAProfile::Models::V3::Address'
.constantize
.new(params)
.set_defaults(@user)
Expand Down
2 changes: 1 addition & 1 deletion modules/mobile/spec/services/sync_update_service_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@

# let(:user) { create(:user, :api_auth_v2) }

# let(:params) { build(:va_profile_address_v2, :override, validation_key: nil) }
# let(:params) { build(:va_profile_v3_address, :override, validation_key: nil) }

# context 'when it succeeds' do
# let(:transaction) do
Expand Down
Loading

0 comments on commit 244f851

Please sign in to comment.