Skip to content
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

Merged
merged 17 commits into from
Jul 10, 2024

Conversation

jaredb96
Copy link
Contributor

@jaredb96 jaredb96 commented Jun 21, 2024

@@ -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) {
Copy link
Contributor Author

@jaredb96 jaredb96 Jun 27, 2024

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.

Copy link
Contributor

@PatrickGoRaft PatrickGoRaft left a 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.

@jaredb96
Copy link
Contributor Author

@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

@kgudel
Copy link
Contributor

kgudel commented Jul 1, 2024

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
Copy link
Contributor

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)
Copy link
Contributor

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))
Copy link
Contributor

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))
Copy link
Contributor

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))
Copy link
Contributor

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

@kgudel kgudel merged commit f5b21f4 into cfpb:master Jul 10, 2024
1 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants