Skip to content

Commit

Permalink
Merge branch 'master' into pamatya/APPEALS-29283
Browse files Browse the repository at this point in the history
  • Loading branch information
craigrva authored Oct 3, 2023
2 parents 09eb0c9 + d19bc9b commit 5041c31
Show file tree
Hide file tree
Showing 37 changed files with 478 additions and 385 deletions.
16 changes: 16 additions & 0 deletions Makefile.example
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,22 @@ remove-vbms-ext-claim-seeds: ## Drops audit tables, removes all PriorityEndProdu

reseed-vbms-ext-claim: remove-vbms-ext-claim-seeds seed-vbms-ext-claim ## Re-seeds database with records created from seed-vbms-ext-claim

# Add trigger to vbms_ext_claim to populate pepsq table
add-populate-pepsq-trigger:
bundle exec rails r db/scripts/add_pepsq_populate_trigger_to_vbms_ext_claim.rb

# Add trigger to vbms_ext_claim to populate pepsq table
add-populate-pepsq-trigger-test:
bundle exec rails r -e test db/scripts/add_pepsq_populate_trigger_to_vbms_ext_claim.rb

# Remove populate pepsq trigger from vbms_ext_claim table
drop-populate-pepsq-trigger:
bundle exec rails r db/scripts/drop_pepsq_populate_trigger_from_vbms_ext_claim.rb

# Remove populate pepsq trigger from vbms_ext_claim table
drop-populate-pepsq-trigger-test:
bundle exec rails r -e test db/scripts/drop_pepsq_populate_trigger_from_vbms_ext_claim.rb

c: ## Start rails console
bundle exec rails console

Expand Down
2 changes: 1 addition & 1 deletion app/controllers/unrecognized_appellants_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def unrecognized_appellant_params
def unrecognized_party_details
[
:party_type, :name, :middle_name, :last_name, :suffix, :address_line_1, :address_line_2, :date_of_birth,
:address_line_3, :city, :state, :zip, :country, :phone_number, :email_address
:address_line_3, :city, :state, :zip, :country, :phone_number, :email_address, :ein, :ssn
]
end
end
102 changes: 0 additions & 102 deletions app/jobs/populate_end_product_sync_queue_job.rb

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ def assign_batch_to_queued_records!(records)
private

# Purpose: Destroys "SYNCED" PEPSQ records to limit the growing number of table records.
# This functionality is needed for the PopulateEndProductSyncQueueJob query to be performant.
#
# Params: None
#
Expand Down
2 changes: 1 addition & 1 deletion app/models/concerns/has_unrecognized_party_detail.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ module HasUnrecognizedPartyDetail
extend ActiveSupport::Concern

included do
delegate :name, :first_name, :middle_name, :last_name, :suffix, :ssn,
delegate :name, :first_name, :middle_name, :last_name, :suffix, :ein, :ssn,
:address, :address_line_1, :address_line_2, :address_line_3,
:city, :state, :zip, :country, :date_of_birth,
:phone_number, :email_address, :party_type,
Expand Down
2 changes: 1 addition & 1 deletion app/models/other_claimant.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# Currently used for attorney fee cases when the attorney isn't found in the BGS attorney database.

class OtherClaimant < Claimant
delegate :name, :first_name, :middle_name, :last_name, :suffix, :ssn,
delegate :name, :first_name, :middle_name, :last_name, :suffix, :ein, :ssn,
:address, :address_line_1, :address_line_2, :address_line_3,
:city, :state, :zip, :country, :date_of_birth,
:email_address, :phone_number,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

# Model for Priority End Product Sync Queue table.
# This table consists of records of End Product Establishment IDs that need to be synced with VBMS.

# These are populated via the trigger that is created on creation of the vbms_ext_claim table
# The trigger is located in:
# db/scripts/external/create_vbms_ext_claim_table.rb
# db/scripts/
class PriorityEndProductSyncQueue < CaseflowRecord
self.table_name = "priority_end_product_sync_queue"

Expand Down Expand Up @@ -52,7 +57,6 @@ def declare_record_stuck!
end

# Purpose: Destroys "SYNCED" PEPSQ records to limit the growing number of table records.
# This functionality is needed for the PopulateEndProductSyncQueueJob query to be performant.
#
# Params: The batch process the synced records belong to
#
Expand Down
4 changes: 3 additions & 1 deletion client/COPY.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
"AGE_MAX_ERR": "Appellant cannot be older than 118 years of age."
},
"SSN_INVALID_ERR": "Please enter a valid social security number that follows the format: 123-45-6789 or 123456789",
"EIN_INVALID_ERR": "Please enter a valid employer identification number that follows the format: 12-3456789 or 123456789",
"NULL_FILTER_LABEL": "<<blank>>",
"OTHER_REVIEWS_TABLE_TITLE": "Higher Level Reviews & Supplemental Claims",
"OTHER_REVIEWS_TABLE_EP_CODE_COLUMN_TITLE": "EP Codes",
Expand Down Expand Up @@ -1394,5 +1395,6 @@
"NO_DATE_ENTERED": "No date entered",
"REFRESH_POA": "Refresh POA",
"POA_SUCCESSFULLY_REFRESH_MESSAGE": "Successfully refreshed. No power of attorney information was found at this time.",
"POA_UPDATED_SUCCESSFULLY": "POA Updated Successfully"
"POA_UPDATED_SUCCESSFULLY": "POA Updated Successfully",
"EMPLOYER_IDENTIFICATION_NUMBER": "Employer Identification Number"
}
15 changes: 14 additions & 1 deletion client/app/intake/addClaimant/ClaimantForm.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import styled from 'styled-components';

import * as Constants from '../constants';
import { fetchAttorneys, formatAddress } from './utils';
import { ADD_CLAIMANT_PAGE_DESCRIPTION, ERROR_EMAIL_INVALID_FORMAT } from 'app/../COPY';
import { ADD_CLAIMANT_PAGE_DESCRIPTION, ERROR_EMAIL_INVALID_FORMAT, EMPLOYER_IDENTIFICATION_NUMBER } from 'app/../COPY';

import Address from 'app/queue/components/Address';
import AddressForm from 'app/components/AddressForm';
Expand Down Expand Up @@ -61,6 +61,7 @@ export const ClaimantForm = ({
const emailValidationError = errors?.emailAddress && ERROR_EMAIL_INVALID_FORMAT;
const dobValidationError = errors?.dateOfBirth && errors.dateOfBirth.message;
const ssnValidationError = errors?.ssn && errors.ssn.message;
const einValidationError = errors?.ein && errors.ein.message;

const watchRelationship = watch('relationship');
const dependentRelationship = ['spouse', 'child'].includes(watchRelationship);
Expand Down Expand Up @@ -253,6 +254,18 @@ export const ClaimantForm = ({
/>
</FieldDiv>
)}
{isOrgPartyType && isHLROrSCForm && (
<FieldDiv>
<TextField
validationError={einValidationError}
name="ein"
label={EMPLOYER_IDENTIFICATION_NUMBER}
inputRef={register}
strongLabel
optional
/>
</FieldDiv>
)}
{partyType && (
<>
<AddressForm
Expand Down
12 changes: 11 additions & 1 deletion client/app/intake/addClaimant/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { camelCase, reduce, startCase } from 'lodash';
import { FORM_TYPES } from '../constants';

import ApiUtil from 'app/util/ApiUtil';
import { DOB_INVALID_ERRS, SSN_INVALID_ERR } from 'app/../COPY';
import { DOB_INVALID_ERRS, SSN_INVALID_ERR, EIN_INVALID_ERR } from 'app/../COPY';

const { AGE_MIN_ERR, AGE_MAX_ERR } = DOB_INVALID_ERRS;

Expand All @@ -21,6 +21,7 @@ const yearsFromToday = (years) => {
};

const ssnRegex = /^(?!000|666)[0-9]{3}([ -]?)(?!00)[0-9]{2}\1(?!0000)[0-9]{4}$/gm;
const einRegex = /^(?!00)[0-9]{2}([ -]?)(?!0000000)[0-9]{7}$/gm;

const sharedValidation = {
relationship: yup.string().when(['$hideListedAttorney'], {
Expand Down Expand Up @@ -117,6 +118,14 @@ export const schemaHLR = yup.object().shape({
message: SSN_INVALID_ERR,
excludeEmptyString: true
}
),
ein: yup.string().
matches(
einRegex,
{
message: EIN_INVALID_ERR,
excludeEmptyString: true
}
),
...sharedValidation,
});
Expand All @@ -125,6 +134,7 @@ export const defaultFormValues = {
relationship: null,
partyType: null,
name: '',
ein: '',
firstName: '',
middleName: '',
lastName: '',
Expand Down
6 changes: 3 additions & 3 deletions client/constants/REGIONAL_OFFICE_FACILITY_ADDRESS.json
Original file line number Diff line number Diff line change
Expand Up @@ -578,12 +578,12 @@
"timezone" : "America/Denver"
},
"vba_452" : {
"address_1" : "5500 E Kellogg",
"address_2" : "Bldg. 61",
"address_1" : "9111 E. Douglas Ave.",
"address_2" : "Suite 200",
"address_3" : null,
"city" : "Wichita",
"state" : "KS",
"zip" : "67218",
"zip" : "67207",
"timezone" : "America/Chicago"
},
"vba_459" : {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,20 @@ describe('HlrScClaimantForm', () => {
});
};

const validatePresenceOfEin = async (optionNum) => {
await selectRelationship(optionNum);

await userEvent.click(
screen.getByRole('radio', { name: /organization/i })
);

await waitFor(() => {
expect(
screen.getByRole('textbox', { name: /Employer Identification Number/i })
).toBeInTheDocument();
});
}

it('renders default state correctly', () => {
const { container } = setup();

Expand Down Expand Up @@ -201,6 +215,7 @@ describe('HlrScClaimantForm', () => {
screen.getByRole('radio', { name: /organization/i })
);

screen.debug(undefined, Infinity);
expect(container).toMatchSnapshot();

// Set type to individual
Expand Down Expand Up @@ -232,4 +247,10 @@ describe('HlrScClaimantForm', () => {
expect(container).toMatchSnapshot();
});

it('validate the presence of Employer Identification number for Organizations', async () => {
setup();
validatePresenceOfEin(relationshipOptsHlrSc.map((r) => r.value).indexOf('healthcare_provider'));
validatePresenceOfEin(relationshipOptsHlrSc.map((r) => r.value).indexOf('other'));
}, 15000);

});
9 changes: 8 additions & 1 deletion client/test/app/intake/components/addClaimants/testUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,21 @@ const street1 = '1000 Monticello';
const city = 'Washington';
const zip = '20000';
const country = 'USA';
const ein = '123456789'

export const fillForm = async () => {
export const fillForm = async (isHLROrSCForm = false) => {
// Enter organization
await userEvent.type(
screen.getByRole('textbox', { name: /Organization name/i }),
organization
);

if (isHLROrSCForm) {
await userEvent.type(
screen.getByRole('textbox', { name: /employer identification number/i }),
ein
);
}
// Enter Street1
await userEvent.type(
screen.getByRole('textbox', { name: /Street address 1/i }),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ exports[`EditPOAInformation renders default state correctly 1`] = `
"city": "",
"country": "",
"dateOfBirth": null,
"ein": "",
"emailAddress": "",
"firstName": "",
"lastName": "",
Expand Down Expand Up @@ -198,6 +199,7 @@ exports[`EditPOAInformation renders default state correctly 1`] = `
"city": "",
"country": "",
"dateOfBirth": null,
"ein": "",
"emailAddress": "",
"firstName": "",
"lastName": "",
Expand Down
5 changes: 0 additions & 5 deletions config/environments/demo.rb
Original file line number Diff line number Diff line change
Expand Up @@ -93,11 +93,6 @@
ENV["BATCH_PROCESS_ERROR_DELAY"] ||= "12" # In number of hours
ENV["BATCH_PROCESS_MAX_ERRORS_BEFORE_STUCK"] ||= "3" # When record errors for X time, it's declared stuck

# Populate End Product Sync Queue ENVs
ENV["END_PRODUCT_QUEUE_JOB_DURATION"] ||= "1" # Number of hours the job will run for
ENV["END_PRODUCT_QUEUE_SLEEP_DURATION"] ||= "5" # Number of seconds between loop iterations
ENV["END_PRODUCT_QUEUE_BATCH_LIMIT"] ||= "500" # Max number of records in a batch

# Setup S3
config.s3_enabled = ENV["AWS_BUCKET_NAME"].present?
config.s3_bucket_name = ENV["AWS_BUCKET_NAME"]
Expand Down
5 changes: 0 additions & 5 deletions config/environments/development.rb
Original file line number Diff line number Diff line change
Expand Up @@ -100,11 +100,6 @@
# Quarterly Notifications Batch Sizes
ENV["QUARTERLY_NOTIFICATIONS_JOB_BATCH_SIZE"] ||= "1000"

# Populate End Product Sync Queue ENVs
ENV["END_PRODUCT_QUEUE_JOB_DURATION"] ||= "50" # Number of minutes the job will run for
ENV["END_PRODUCT_QUEUE_SLEEP_DURATION"] ||= "5" # Number of seconds between loop iterations
ENV["END_PRODUCT_QUEUE_BATCH_LIMIT"] ||= "500" # Max number of records in a batch

# Travel Board Sync Batch Size
ENV["TRAVEL_BOARD_HEARING_SYNC_BATCH_LIMIT"] ||= "250"

Expand Down
Loading

0 comments on commit 5041c31

Please sign in to comment.