1
1
package hmda .publication .reports .disclosure
2
2
3
- import hmda .publication .reports ._
4
- import hmda .model .publication .reports .{ ApplicantIncome , Disposition , MSAReport , ReportTypeEnum }
3
+ import hmda .model .publication .reports .{ MSAReport , ReportTypeEnum }
5
4
import hmda .model .publication .reports .ReportTypeEnum .Disclosure
6
- import hmda .publication .reports .util .ReportsMetaDataLookup
7
- import hmda .publication .reports .util .ReportUtil ._
8
- import akka .NotUsed
9
- import akka .stream .scaladsl .Source
10
- import hmda .query .model .filing .LoanApplicationRegisterQuery
11
-
12
- import scala .concurrent .Future
13
5
14
6
trait DisclosureReport {
15
7
@@ -24,66 +16,3 @@ trait DisclosureReport {
24
16
val reportType : ReportTypeEnum = Disclosure
25
17
26
18
}
27
-
28
- case class D5X (
29
- respondentId : String ,
30
- institutionName : String ,
31
- year : Int ,
32
- msa : MSAReport ,
33
- applicantIncomes : List [ApplicantIncome ],
34
- total : List [Disposition ],
35
- table : String ,
36
- description : String ,
37
- reportDate : String = formattedCurrentDate
38
- ) extends DisclosureReport
39
-
40
- object D5X {
41
- def generate [ec : EC , mat : MAT , as : AS ](
42
- reportId : String ,
43
- filters : LoanApplicationRegisterQuery => Boolean ,
44
- larSource : Source [LoanApplicationRegisterQuery , NotUsed ],
45
- fipsCode : Int ,
46
- respondentId : String ,
47
- institutionNameF : Future [String ]
48
- ): Future [D5X ] = {
49
-
50
- val metaData = ReportsMetaDataLookup .values(reportId)
51
- val dispositions = metaData.dispositions
52
-
53
- val lars = larSource
54
- .filter(lar => lar.respondentId == respondentId)
55
- .filter(lar => lar.msa != " NA" )
56
- .filter(lar => lar.msa.toInt == fipsCode)
57
- .filter(filters)
58
-
59
- val larsWithIncome = lars.filter(lar => lar.income != " NA" )
60
-
61
- val msa = msaReport(fipsCode.toString)
62
-
63
- val incomeIntervals = calculateMedianIncomeIntervals(fipsCode)
64
- val applicantIncomesF = applicantIncomesWithBorrowerCharacteristics(larsWithIncome, incomeIntervals, dispositions)
65
-
66
- val yearF = calculateYear(larSource)
67
- val totalF = calculateDispositions(lars, dispositions)
68
-
69
- for {
70
- institutionName <- institutionNameF
71
- year <- yearF
72
- applicantIncomes <- applicantIncomesF
73
- total <- totalF
74
- } yield {
75
-
76
- D5X (
77
- respondentId,
78
- institutionName,
79
- year,
80
- msa,
81
- applicantIncomes,
82
- total,
83
- metaData.reportTable,
84
- metaData.description
85
- )
86
- }
87
-
88
- }
89
- }
0 commit comments