Skip to content

Commit b2da068

Browse files
author
Nick Grippin
committed
update report with metadata util
1 parent 6afd350 commit b2da068

File tree

2 files changed

+20
-45
lines changed

2 files changed

+20
-45
lines changed
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
ReportId,Type,ReportNumber,Dispositions,Description
2-
D51,Disclosure,5-1,Received;Originated;ApprovedButNotAccepted;Denied;Withdrawn;Closed,"Disposition of applications for FHA, FSA/RHS, and VA home-purchase loans, 1- to 4-family and manufactured home dwellings, by income, race and ethnicity of applicant"
2+
A52,Aggregate,5-2,Received;Originated;ApprovedButNotAccepted;Denied;Withdrawn;Closed,"Disposition of Applications for Conventional Home-Purchase Loans, 1-to-4 Family and Manufactured Home Dwellings, by Income, Race, and Ethnicity of Applicant"
3+
D51,Disclosure,5-1,Received;Originated;ApprovedButNotAccepted;Denied;Withdrawn;Closed,"Disposition of applications for FHA, FSA/RHS, and VA home-purchase loans, 1- to 4-family and manufactured home dwellings, by income, race and ethnicity of applicant"

publication/src/main/scala/hmda/publication/reports/aggregate/A52.scala

Lines changed: 18 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -8,53 +8,25 @@ import hmda.model.publication.reports.ApplicantIncomeEnum._
88
import hmda.model.publication.reports.{ ApplicantIncome, Disposition, MSAReport }
99
import hmda.publication.reports._
1010
import hmda.publication.reports.util.DateUtil._
11-
import hmda.publication.reports.util.DispositionType.{ ClosedDisp, WithdrawnDisp, _ }
1211
import hmda.publication.reports.util.ReportUtil._
12+
import hmda.publication.reports.util.ReportsMetaDataLookup
1313
import hmda.query.model.filing.LoanApplicationRegisterQuery
1414

1515
import scala.concurrent.Future
1616

1717
case class A52(
18-
table: String,
19-
description: String,
2018
year: Int,
2119
reportDate: String,
2220
msa: MSAReport,
2321
applicantIncomes: List[ApplicantIncome],
24-
total: List[Disposition]
22+
total: List[Disposition],
23+
table: String = A52.metaData.reportTable,
24+
description: String = A52.metaData.description
2525
) extends AggregateReport
2626

2727
object A52 {
28-
def apply(
29-
year: Int,
30-
reportDate: String,
31-
msa: MSAReport,
32-
applicantIncomes: List[ApplicantIncome],
33-
total: List[Disposition]
34-
): A52 = {
35-
36-
val description = "Disposition of Applications for Conventional Home-Purchase Loans, 1-to-4 Family and Manufactured Home Dwellings, by Income, Race, and Ethnicity of Applicant"
37-
38-
A52(
39-
"5-2",
40-
description,
41-
year,
42-
reportDate,
43-
msa,
44-
applicantIncomes,
45-
total
46-
)
47-
}
48-
49-
val dispositions: List[DispositionType] =
50-
List(
51-
ReceivedDisp,
52-
OriginatedDisp,
53-
ApprovedButNotAcceptedDisp,
54-
DeniedDisp,
55-
WithdrawnDisp,
56-
ClosedDisp
57-
)
28+
val metaData = ReportsMetaDataLookup.values("A52")
29+
val dispositions = metaData.dispositions
5830

5931
// Table filters:
6032
// Loan Type 1
@@ -82,7 +54,7 @@ object A52 {
8254
val larsByIncome = larsByIncomeInterval(larsWithIncome, incomeIntervals)
8355
val borrowerCharacteristicsByIncomeF = borrowerCharacteristicsByIncomeInterval(larsByIncome, dispositions)
8456

85-
val dateF = calculateYear(larSource)
57+
val yearF = calculateYear(larSource)
8658
val totalF = calculateDispositions(lars, dispositions)
8759

8860
for {
@@ -92,7 +64,7 @@ object A52 {
9264
lars100To120BorrowerCharacteristics <- borrowerCharacteristicsByIncomeF(Between100And119PercentOfMSAMedian)
9365
lars120BorrowerCharacteristics <- borrowerCharacteristicsByIncomeF(GreaterThan120PercentOfMSAMedian)
9466

95-
date <- dateF
67+
year <- yearF
9668
total <- totalF
9769
} yield {
9870
val income50 = ApplicantIncome(
@@ -116,17 +88,19 @@ object A52 {
11688
lars120BorrowerCharacteristics
11789
)
11890

91+
val applicantIncomes = List(
92+
income50,
93+
income50To79,
94+
income80To99,
95+
income100To120,
96+
income120
97+
)
98+
11999
A52(
120-
date,
100+
year,
121101
formatDate(Calendar.getInstance().toInstant),
122102
msa,
123-
List(
124-
income50,
125-
income50To79,
126-
income80To99,
127-
income100To120,
128-
income120
129-
),
103+
applicantIncomes,
130104
total
131105
)
132106
}

0 commit comments

Comments
 (0)