@@ -8,59 +8,27 @@ import hmda.model.publication.reports.ApplicantIncomeEnum._
8
8
import hmda .publication .reports ._
9
9
import hmda .model .publication .reports ._
10
10
import hmda .publication .reports .util .DateUtil ._
11
- import hmda .publication .reports .util .DispositionType ._
12
11
import hmda .publication .reports .util .ReportUtil ._
12
+ import hmda .publication .reports .util .ReportsMetaDataLookup
13
13
import hmda .query .model .filing .LoanApplicationRegisterQuery
14
14
15
15
import scala .concurrent .Future
16
16
17
17
case class D51 (
18
18
respondentId : String ,
19
19
institutionName : String ,
20
- table : String ,
21
- description : String ,
22
20
year : Int ,
23
21
reportDate : String ,
24
22
msa : MSAReport ,
25
23
applicantIncomes : List [ApplicantIncome ],
26
- total : List [Disposition ]
24
+ total : List [Disposition ],
25
+ table : String = D51 .metaData.reportTable,
26
+ description : String = D51 .metaData.description
27
27
) extends DisclosureReport
28
28
29
29
object D51 {
30
- def apply (
31
- respondentId : String ,
32
- institutionName : String ,
33
- year : Int ,
34
- reportDate : String ,
35
- msa : MSAReport ,
36
- applicantIncomes : List [ApplicantIncome ],
37
- total : List [Disposition ]
38
- ): D51 = {
39
-
40
- val description = " 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"
41
-
42
- D51 (
43
- respondentId,
44
- institutionName,
45
- " 5-1" ,
46
- description,
47
- year,
48
- reportDate,
49
- msa,
50
- applicantIncomes,
51
- total
52
- )
53
- }
54
-
55
- val dispositions : List [DispositionType ] =
56
- List (
57
- ReceivedDisp ,
58
- OriginatedDisp ,
59
- ApprovedButNotAcceptedDisp ,
60
- DeniedDisp ,
61
- WithdrawnDisp ,
62
- ClosedDisp
63
- )
30
+ val metaData = ReportsMetaDataLookup .values(" D51" )
31
+ val dispositions = metaData.dispositions
64
32
65
33
// Table filters:
66
34
// Loan Type 2,3,4
@@ -69,12 +37,12 @@ object D51 {
69
37
def generate [ec : EC , mat : MAT , as : AS ](
70
38
larSource : Source [LoanApplicationRegisterQuery , NotUsed ],
71
39
fipsCode : Int ,
72
- respId : String ,
40
+ respondentId : String ,
73
41
institutionNameF : Future [String ]
74
42
): Future [D51 ] = {
75
43
76
44
val lars = larSource
77
- .filter(lar => lar.respondentId == respId )
45
+ .filter(lar => lar.respondentId == respondentId )
78
46
.filter(lar => lar.msa != " NA" )
79
47
.filter(lar => lar.msa.toInt == fipsCode)
80
48
.filter { lar =>
@@ -91,7 +59,7 @@ object D51 {
91
59
val larsByIncome = larsByIncomeInterval(larsWithIncome, incomeIntervals)
92
60
val borrowerCharacteristicsByIncomeF = borrowerCharacteristicsByIncomeInterval(larsByIncome, dispositions)
93
61
94
- val dateF = calculateYear(larSource)
62
+ val yearF = calculateYear(larSource)
95
63
val totalF = calculateDispositions(lars, dispositions)
96
64
97
65
for {
@@ -102,7 +70,7 @@ object D51 {
102
70
lars120BorrowerCharacteristics <- borrowerCharacteristicsByIncomeF(GreaterThan120PercentOfMSAMedian )
103
71
104
72
institutionName <- institutionNameF
105
- date <- dateF
73
+ year <- yearF
106
74
total <- totalF
107
75
} yield {
108
76
val income50 = ApplicantIncome (
@@ -126,19 +94,21 @@ object D51 {
126
94
lars120BorrowerCharacteristics
127
95
)
128
96
97
+ val applicantIncomes = List (
98
+ income50,
99
+ income50To79,
100
+ income80To99,
101
+ income100To120,
102
+ income120
103
+ )
104
+
129
105
D51 (
130
- respId ,
106
+ respondentId ,
131
107
institutionName,
132
- date ,
108
+ year ,
133
109
formatDate(Calendar .getInstance().toInstant),
134
110
msa,
135
- List (
136
- income50,
137
- income50To79,
138
- income80To99,
139
- income100To120,
140
- income120
141
- ),
111
+ applicantIncomes,
142
112
total
143
113
)
144
114
}
0 commit comments