Skip to content

Commit

Permalink
Merge branch 'master' into 97006-update-email-template-map
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelclement authored Nov 29, 2024
2 parents fa9b850 + 323159a commit ab9796d
Show file tree
Hide file tree
Showing 34 changed files with 1,118 additions and 83 deletions.
6 changes: 3 additions & 3 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -603,7 +603,7 @@ GEM
jruby-openssl (0.15.1-java)
json (2.7.5)
json (2.7.5-java)
json-schema (5.0.1)
json-schema (5.1.0)
addressable (~> 2.8)
json_schema (0.21.0)
json_schemer (2.3.0)
Expand Down Expand Up @@ -729,7 +729,7 @@ GEM
openssl (3.2.0-java)
jruby-openssl (~> 0.14)
operating_hours (0.1.0)
optimist (3.1.0)
optimist (3.2.0)
os (1.1.4)
ostruct (0.6.1)
ox (2.14.18)
Expand Down Expand Up @@ -1041,7 +1041,7 @@ GEM
stringio (3.1.2)
strong_migrations (2.0.2)
activerecord (>= 6.1)
super_diff (0.13.0)
super_diff (0.14.0)
attr_extras (>= 6.2.4)
diff-lcs
patience_diff
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,8 @@ def missing_disabilities?(submission)
# while SavedClaim (vets-json-schema) is expecting a string
def temp_separation_location_fix
if form_content.is_a?(Hash) && form_content['form526'].is_a?(Hash)
separation_location_code = form_content.dig('form526', 'serviceInformation', 'separationLocation')
separation_location_code = form_content.dig('form526', 'serviceInformation', 'separationLocation',
'separationLocationCode')
unless separation_location_code.nil?
form_content['form526']['serviceInformation']['separationLocation']['separationLocationCode'] =
separation_location_code.to_s
Expand Down
4 changes: 4 additions & 0 deletions config/features.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1050,6 +1050,10 @@ features:
actor_type: user
description: Enables/disables filter feature for medications list
enable_in_development: true
mhv_medications_display_grouping:
actor_type: user
description: Enables/disables grouping medications related work
enable_in_development: true
mobile_allergy_intolerance_model:
actor_type: user
description: For mobile app, enalbes use of strict models for parsing allergy intolerance
Expand Down
3 changes: 2 additions & 1 deletion config/settings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1850,6 +1850,7 @@ vaos:
client_assertion_type: "urn:ietf:params:oauth:client-assertion-type:jwt-bearer"
audience_claim_url: "https://login.wellhive.com/oauth2/default/v1/token"
access_token_url: "https://login.wellhive.com/oauth2/default/v1/token"
api_url: "https://api.wellhive.com/care-navigation/v1"
api_url: "https://api.wellhive.com"
base_path: "care-navigation/v1"
scopes: "care-nav"

105 changes: 91 additions & 14 deletions lib/medical_records/bb_internal/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,35 @@ class Client < Common::Client::Base
configuration BBInternal::Configuration
client_session BBInternal::ClientSession

################################################################################
# User Management APIs
################################################################################

# Retrieves the patient information by user ID.
# @return [Hash] A hash containing the patient's details
#
def get_patient
response = perform(:get, "usermgmt/patient/uid/#{@session.user_id}", nil, token_headers)
patient = response.body

raise Common::Exceptions::ServiceError.new(detail: 'Patient not found') if patient.blank?

patient
end

# Retrieves the BBMI notification setting for the user.
# @return [Hash] containing:
# - flag [Boolean]: Indicates whether the BBMI notification setting is enabled (true) or disabled (false)
#
def get_bbmi_notification_setting
response = perform(:get, 'usermgmt/notification/bbmi', nil, token_headers)
response.body
end

################################################################################
# Blue Button Medical Imaging (BBMI) APIs
################################################################################

##
# Get a list of MHV radiology reports from VIA for the current user. These results do not
# include CVIX reports.
Expand Down Expand Up @@ -127,25 +156,73 @@ def get_study_status
response.body
end

# Retrieves the BBMI notification setting for the user.
# @return [Hash] containing:
# - flag [Boolean]: Indicates whether the BBMI notification setting is enabled (true) or disabled (false)
#
def get_bbmi_notification_setting
response = perform(:get, 'usermgmt/notification/bbmi', nil, token_headers)
################################################################################
# Self-Entered Information (SEI) APIs
################################################################################

def get_sei_vital_signs_summary
response = perform(:get, "vitals/summary/#{@session.user_id}", nil, token_headers)
response.body
end

# Retrieves the patient information by user ID.
# @return [Hash] A hash containing the patient's details
#
def get_patient
response = perform(:get, "usermgmt/patient/uid/#{@session.user_id}", nil, token_headers)
patient = response.body
def get_sei_allergies
response = perform(:get, "healthhistory/allergy/#{@session.user_id}", nil, token_headers)
response.body
end

raise Common::Exceptions::ServiceError.new(detail: 'Patient not found') if patient.blank?
def get_sei_family_health_history
response = perform(:get, "healthhistory/healthHistory/#{@session.user_id}", nil, token_headers)
response.body
end

patient
def get_sei_immunizations
response = perform(:get, "healthhistory/immunization/#{@session.user_id}", nil, token_headers)
response.body
end

def get_sei_test_entries
response = perform(:get, "healthhistory/testEntry/#{@session.user_id}", nil, token_headers)
response.body
end

def get_sei_medical_events
response = perform(:get, "healthhistory/medicalEvent/#{@session.user_id}", nil, token_headers)
response.body
end

def get_sei_military_history
response = perform(:get, "healthhistory/militaryHistory/#{@session.user_id}", nil, token_headers)
response.body
end

def get_sei_healthcare_providers
response = perform(:get, "getcare/healthCareProvider/#{@session.user_id}", nil, token_headers)
response.body
end

def get_sei_health_insurance
response = perform(:get, "getcare/healthInsurance/#{@session.user_id}", nil, token_headers)
response.body
end

def get_sei_treatment_facilities
response = perform(:get, "getcare/treatmentFacility/#{@session.user_id}", nil, token_headers)
response.body
end

def get_sei_food_journal
response = perform(:get, "journal/journals/#{@session.user_id}", nil, token_headers)
response.body
end

def get_sei_activity_journal
response = perform(:get, "journal/activityjournals/#{@session.user_id}", nil, token_headers)
response.body
end

def get_sei_medications
response = perform(:get, "pharmacy/medications/#{@session.user_id}", nil, token_headers)
response.body
end

# Retrieves the patient demographic information
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ def full_transform_form
:'view:streamlined_waiver',
:'view:streamlined_waiver_asset_update',
:'view:review_page_navigation_toggle',
:'view:show_updated_expense_pages',
questions: %i[
has_repayments has_credit_card_bills has_recreational_vehicle
has_vehicle has_real_estate spouse_has_benefits is_married
Expand Down Expand Up @@ -317,11 +318,12 @@ def full_transform_form
]
],
expenses: [
expense_records: %i[name amount],
credit_card_bills: %i[
purpose creditor_name original_amount unpaid_balance
amount_due_monthly date_started amount_past_due
]
:monthly_housing_expenses,
{ expense_records: %i[name amount],
credit_card_bills: %i[
purpose creditor_name original_amount unpaid_balance
amount_due_monthly date_started amount_past_due
] }
],
utility_records: %i[name amount],
other_expenses: %i[name amount],
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# frozen_string_literal: true

module MyHealth
module V1
module MedicalRecords
class SelfEnteredController < MrController
def vitals
render json: bb_client.get_sei_vital_signs_summary.to_json
end

def allergies
render json: bb_client.get_sei_allergies.to_json
end

def family_history
render json: bb_client.get_sei_family_health_history.to_json
end

def vaccines
render json: bb_client.get_sei_immunizations.to_json
end

def test_entries
render json: bb_client.get_sei_test_entries.to_json
end

def medical_events
render json: bb_client.get_sei_medical_events.to_json
end

def military_history
render json: bb_client.get_sei_military_history.to_json
end

def providers
render json: bb_client.get_sei_healthcare_providers.to_json
end

def health_insurance
render json: bb_client.get_sei_health_insurance.to_json
end

def treatment_facilities
render json: bb_client.get_sei_treatment_facilities.to_json
end

def food_journal
render json: bb_client.get_sei_food_journal.to_json
end

def activity_journal
render json: bb_client.get_sei_activity_journal.to_json
end

def medications
render json: bb_client.get_sei_medications.to_json
end
end
end
end
end
15 changes: 15 additions & 0 deletions modules/my_health/config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,21 @@
get :status, on: :collection
end
resources :military_service, only: %i[index]
resources :self_entered, only: [], defaults: { format: :json } do
get :vitals, on: :collection
get :allergies, on: :collection
get :family_history, on: :collection
get :vaccines, on: :collection
get :test_entries, on: :collection
get :medical_events, on: :collection
get :military_history, on: :collection
get :providers, on: :collection
get :health_insurance, on: :collection
get :treatment_facilities, on: :collection
get :food_journal, on: :collection
get :activity_journal, on: :collection
get :medications, on: :collection
end
resources :patient, only: %i[index] do
get :demographic, on: :collection
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ def init(saved_claim_id, user_account_uuid)
@claim = Pensions::SavedClaim.find(saved_claim_id)
raise PensionBenefitIntakeError, "Unable to find SavedClaim::Pension #{saved_claim_id}" unless @claim

set_signature_date

@intake_service = BenefitsIntake::Service.new
end

Expand Down Expand Up @@ -221,5 +223,19 @@ def cleanup_file_paths
rescue => e
@pension_monitor.track_file_cleanup_error(@claim, @intake_service, @user_account_uuid, e)
end

##
# Sets the signature date to the claim.created_at,
# so that retried claims will be considered signed on the date of submission.
# Signature date will be set to current date if not provided.
#
def set_signature_date
form_data = JSON.parse(@claim.form)
form_data['signatureDate'] = @claim.created_at&.strftime('%Y-%m-%d')
@claim.form = form_data.to_json
@claim.save
rescue => e
@pension_monitor.track_claim_signature_error(@claim, @intake_service, @user_account_uuid, e)
end
end
end
5 changes: 3 additions & 2 deletions modules/pensions/lib/pdf_fill/va21p527ez.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1707,8 +1707,9 @@ def expand_direct_deposit_information
# SECTION XII: CLAIM CERTIFICATION AND SIGNATURE
def expand_claim_certification_and_signature
@form_data['noRapidProcessing'] = to_checkbox_on_off(@form_data['noRapidProcessing'])
# form was signed today
@form_data['signatureDate'] = split_date(Time.zone.now.strftime('%Y-%m-%d'))
# signed on provided date (generally SavedClaim.created_at) or default to today
signature_date = @form_data['signatureDate'] || Time.zone.now.strftime('%Y-%m-%d')
@form_data['signatureDate'] = split_date(signature_date)
end

# Convert a date to a string
Expand Down
24 changes: 24 additions & 0 deletions modules/pensions/lib/pensions/monitor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -321,5 +321,29 @@ def track_file_cleanup_error(claim, lighthouse_service, user_account_uuid, e)
"#{SUBMISSION_STATS_KEY}.cleanup_failed",
call_location: caller_locations.first, **additional_context)
end

##
# log error occurred when setting signature date to claim.created_at
# Error doesn't prevent successful claim submission (defaults to current date)
# @see PensionBenefitIntakeJob
#
# @param claim [Pension::SavedClaim]
# @param lighthouse_service [BenefitsIntake::Service]
# @param user_account_uuid [UUID]
# @param e [Error]
#
def track_claim_signature_error(claim, lighthouse_service, user_account_uuid, e)
additional_context = {
confirmation_number: claim&.confirmation_number,
user_account_uuid:,
claim_id: claim&.id,
benefits_intake_uuid: lighthouse_service&.uuid,
error: e&.message,
tags:
}
track_request('error', 'Lighthouse::PensionBenefitIntakeJob custom date failed',
"#{SUBMISSION_STATS_KEY}.custom_date_failed",
call_location: caller_locations.first, **additional_context)
end
end
end
22 changes: 22 additions & 0 deletions modules/pensions/spec/lib/pdf_fill/va21p527ez_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,28 @@ def basic_class
end
end

describe '#expand_claim_certification_and_signature' do
it 'defaults to today' do
date = Time.new(2024, 11, 25, 2, 2, 2, 'UTC')
zone = double('zone')
allow(zone).to receive(:now).and_return(date)
allow(Time).to receive(:zone).and_return(zone)
form_data = {}
form = described_class.new(form_data)
form.expand_claim_certification_and_signature
expect(form.instance_variable_get('@form_data')['signatureDate']).to eq({ 'month' => '11', 'day' => '25',
'year' => '2024' })
end

it 'applies date if provided' do
form_data = { 'signatureDate' => '2024-10-31' }
form = described_class.new(form_data)
form.expand_claim_certification_and_signature
expect(form.instance_variable_get('@form_data')['signatureDate']).to eq({ 'month' => '10', 'day' => '31',
'year' => '2024' })
end
end

describe '#expand_veteran_service_information' do
it 'puts overflow on line one' do
long_place_of_separation = 'A very long place name that exceeds thirty-six characters'
Expand Down
Loading

0 comments on commit ab9796d

Please sign in to comment.