-
Notifications
You must be signed in to change notification settings - Fork 93
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
Fix V631 Validation for Invalid Value in Co-Applicant Ethnicity #4832
Conversation
@@ -25,7 +25,7 @@ object V631_1 extends EditCheck[LoanApplicationRegister] { | |||
) | |||
|
|||
override def apply(lar: LoanApplicationRegister): ValidationResult = | |||
if(lar.coApplicant.ethnicity.otherHispanicOrLatino == "") { | |||
if(lar.coApplicant.ethnicity.otherHispanicOrLatino.isEmpty) { |
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.
This is replicating the when
block in the previous logic using a the ethnicity string. This if implements the rules listed here.
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.
@jaredb96 please check the unit test that checks this particular edit. I want to verify that's being tested correctly.
Good point, I'll revise the unit test to correctly reflect the rule |
Could you also please make the same update to V628_1, which is the same edit but for applicant ethnicity, rather than co-applicant ethinicty. |
@@ -1,5 +1,7 @@ | |||
package hmda.validation.dsl | |||
|
|||
import hmda.model.filing.lar.enums.EthnicityEnum |
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.
Let's remove this import so it's no longer needed
@@ -19,10 +19,14 @@ object V628_1 extends EditCheck[LoanApplicationRegister] { | |||
OtherHispanicOrLatino, | |||
NotHispanicOrLatino, | |||
InformationNotProvided, | |||
EthnicityNotApplicable) | |||
EthnicityNotApplicable, | |||
EthnicityNoCoApplicant) |
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.
EthnicityNoCoApplicant is not a valid ethnicity for the applicant
when(lar.applicant.ethnicity.otherHispanicOrLatino is empty) { | ||
lar.applicant.ethnicity.ethnicity1 is containedIn(validEthnicities) | ||
if(lar.applicant.ethnicity.otherHispanicOrLatino.isEmpty) { | ||
lar.applicant.ethnicity.ethnicity1 is containedIn(validEthnicities) and (lar.applicant.ethnicity.ethnicity1.code not equalTo(0)) |
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.
Simply to match how we write the other edits and because it reads a bit better could you please change this to lar.applicant.ethnicity.ethnicity1 not equalTo(EmptyEthnicityValue)
when(lar.applicant.ethnicity.otherHispanicOrLatino is empty) { | ||
lar.applicant.ethnicity.ethnicity1 is containedIn(validEthnicities) | ||
if(lar.applicant.ethnicity.otherHispanicOrLatino.isEmpty) { | ||
lar.applicant.ethnicity.ethnicity1 is containedIn(validEthnicities) and (lar.applicant.ethnicity.ethnicity1 not equalTo(EmptyEthnicityValue)) |
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.
You can remove and (lar.applicant.ethnicity.ethnicity1 not equalTo(EmptyEthnicityValue)
since it's redundant
when(lar.coApplicant.ethnicity.otherHispanicOrLatino is empty) { | ||
lar.coApplicant.ethnicity.ethnicity1 is containedIn(validEthnicities) | ||
if(lar.coApplicant.ethnicity.otherHispanicOrLatino.isEmpty) { | ||
lar.coApplicant.ethnicity.ethnicity1 is containedIn(validEthnicities) and (lar.coApplicant.ethnicity.ethnicity1 is equalTo(EmptyEthnicityValue)) |
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.
the and should be and not though you can remove the whole and (lar.applicant.ethnicity.ethnicity1 is equalTo(EmptyEthnicityValue)
clause since it's redundant anyway
Closes https://github.cfpb.gov/HMDA-Operations/hmda-devops/issues/4352