-
Notifications
You must be signed in to change notification settings - Fork 98
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4899 from kgudel/allow2025
Set up 2025 in the HMDA-Platform
- Loading branch information
Showing
11 changed files
with
803 additions
and
6 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
315 changes: 315 additions & 0 deletions
315
common/src/main/resources/2025QuarterlyEditsDescriptions.txt
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
hmda/src/main/scala/hmda/validation/rules/ts/quality/Q303.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package hmda.validation.rules.ts.quality | ||
|
||
import hmda.model.filing.ts.TransmittalSheet | ||
import hmda.model.institution.Institution | ||
import hmda.validation.context.ValidationContext | ||
import hmda.validation.dsl.ValidationResult | ||
import hmda.validation.rules.{ EditCheck, IfInstitutionPresentIn } | ||
import hmda.validation.dsl.PredicateCommon._ | ||
import hmda.validation.dsl.PredicateSyntax._ | ||
|
||
object Q303 { | ||
def withContext(ctx: ValidationContext): EditCheck[TransmittalSheet] = | ||
IfInstitutionPresentIn(ctx) { new Q303(_) } | ||
|
||
} | ||
|
||
class Q303 private (institution: Institution) extends EditCheck[TransmittalSheet] { | ||
override def name: String = "Q303" | ||
|
||
override def apply(ts: TransmittalSheet): ValidationResult = | ||
(ts.LEI.toLowerCase is equalTo(institution.LEI.toLowerCase)) and | ||
(ts.agency.code is equalTo(institution.agency.code)) and | ||
(ts.taxId is equalTo(institution.taxId.getOrElse(""))) | ||
} |
74 changes: 74 additions & 0 deletions
74
hmda/src/test/scala/hmda/validation/rules/ts/quality/Q303Spec.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
package hmda.validation.rules.ts.quality | ||
|
||
import hmda.model.filing.ts.TransmittalSheet | ||
import hmda.model.institution._ | ||
import hmda.validation.rules.EditCheck | ||
import hmda.validation.rules.ts.TsEditCheckSpec | ||
import hmda.model.filing.ts.TsGenerators._ | ||
import hmda.validation.context.ValidationContext | ||
|
||
class Q303Spec extends TsEditCheckSpec { | ||
|
||
private var institution: Institution = _ | ||
|
||
override def check: EditCheck[TransmittalSheet] = | ||
Q303.withContext(ValidationContext(Some(institution))) | ||
|
||
property("Pass when LEI, Agency and Tax ID are reported correctly") { | ||
forAll(tsGen) { ts => | ||
whenInstitution(ts.LEI, ts.agency, ts.taxId) | ||
ts.mustPass | ||
} | ||
} | ||
|
||
property("Pass when LEI is a different case") { | ||
forAll(tsGen) { ts => | ||
whenInstitution(ts.LEI.toLowerCase, ts.agency, ts.taxId) | ||
ts.mustPass | ||
val upperCaseTs = ts.copy(LEI = ts.LEI.toUpperCase) | ||
upperCaseTs.mustPass | ||
} | ||
} | ||
|
||
property("Fail when LEI is reported incorrectly") { | ||
forAll(tsGen) { ts => | ||
whenInstitution(ts.LEI + "x", ts.agency, ts.taxId) | ||
ts.mustFail | ||
} | ||
} | ||
|
||
property("Fail when Agency is reported incorrectly") { | ||
forAll(tsGen) { ts => | ||
whenever(ts.agency != CFPB) { | ||
whenInstitution(ts.LEI, CFPB, ts.taxId) | ||
ts.mustFail | ||
} | ||
} | ||
} | ||
|
||
property("Fail when Tax ID is reported incorrectly") { | ||
forAll(tsGen) { ts => | ||
whenInstitution(ts.LEI, ts.agency, ts.taxId + "x") | ||
ts.mustFail | ||
} | ||
} | ||
|
||
property("Fail when LEI, Agency and Tax ID are reported incorrectly") { | ||
forAll(tsGen) { ts => | ||
whenever(ts.agency != CFPB) { | ||
whenInstitution(ts.LEI + "x", CFPB, ts.taxId + "x") | ||
ts.mustFail | ||
} | ||
} | ||
} | ||
private def whenInstitution(lei: String, | ||
agency: Agency, | ||
taxId: String): Unit = { | ||
institution = Institution.empty.copy( | ||
LEI = lei, | ||
agency = agency, | ||
taxId = Some(taxId) | ||
) | ||
} | ||
|
||
} |