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

quarterly graphs decimals update #4623

Merged
merged 2 commits into from
Feb 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion hmda-quarterly-data-service/src/main/resources/verbiage.conf
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@ graph {
summary: The following graphs present data for the 19 financial institutions reporting HMDA quarterly data throughout 2020 and displays data for each of those institutions for 2019 and 2018 as well.
summary: ${?GRAPH_SUMMARY}
decimal_precision: 2
decimal_precision: ${?DECIMAIL_PRECISION}
decimal_precision: ${?DECIMAL_PRECISION}
interest_decimal_precision: 3
interest_decimal_precision: ${?INTEREST_DECIMAL_PRECISION}
count_decimal_precision: 0
count_decimal_precision: ${?COUNT_DECIMAL_PRECISION}
race {
asian: "Asian"
asian: ${?RACE_ASIAN}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import akka.http.scaladsl.server.Route
import hmda.quarterly.data.api.dao.repo.QuarterlyGraphRepo
import hmda.quarterly.data.api.dto.QuarterGraphData.{ GraphRoute, GraphSeriesInfo, GraphSeriesSummary }
import Loans._
import hmda.quarterly.data.api.route.lib.Verbiage.COUNT_DECIMAL_PRECISION
import hmda.quarterly.data.api.serde.JsonSupport
import monix.execution.CancelableFuture
import monix.execution.Scheduler.Implicits.global
Expand All @@ -28,7 +29,8 @@ object AllApplicationsVolume extends GraphRoute(
ALL_APPS_VOLUME_TITLE,
ALL_APPS_VOLUME_SUBTITLE,
Seq(quarterlyFilers, allFilers),
yLabel = APP_LABEL
yLabel = APP_LABEL,
decimalPrecision = COUNT_DECIMAL_PRECISION
)
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import hmda.model.filing.lar.enums._
import hmda.quarterly.data.api.dao.repo.QuarterlyGraphRepo
import hmda.quarterly.data.api.dto.QuarterGraphData.{ GraphRoute, GraphSeriesInfo, GraphSeriesSummary }
import Loans._
import hmda.quarterly.data.api.route.lib.Verbiage.COUNT_DECIMAL_PRECISION
import hmda.quarterly.data.api.route.lib.Verbiage.LoanType._
import hmda.quarterly.data.api.serde.JsonSupport
import monix.execution.CancelableFuture
Expand Down Expand Up @@ -34,7 +35,8 @@ object ApplicationsVolume extends GraphRoute(
APP_VOLUME_TITLE,
APP_VOLUME_SUBTITLE,
Seq(conventionalConforming, conventionalNonConforming, fha, heloc, rhsfsa, va),
yLabel = APP_LABEL
yLabel = APP_LABEL,
decimalPrecision = COUNT_DECIMAL_PRECISION
)
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import hmda.model.filing.lar.enums._
import hmda.quarterly.data.api.dao.repo.QuarterlyGraphRepo
import hmda.quarterly.data.api.dto.QuarterGraphData.{ GraphRoute, GraphSeriesInfo, GraphSeriesSummary }
import hmda.quarterly.data.api.route.counts.loans.Loans.{ CATEGORY, LOAN_LABEL, LOAN_VOLUME_SUBTITLE, LOAN_VOLUME_TITLE }
import hmda.quarterly.data.api.route.lib.Verbiage.COUNT_DECIMAL_PRECISION
import hmda.quarterly.data.api.route.lib.Verbiage.LoanType._
import hmda.quarterly.data.api.serde.JsonSupport
import monix.execution.CancelableFuture
Expand Down Expand Up @@ -35,7 +36,8 @@ object LoansVolume extends GraphRoute(
LOAN_VOLUME_TITLE,
LOAN_VOLUME_SUBTITLE,
Seq(conventionalConforming, conventionalNonConforming, fha, heloc, rhsfsa, va),
yLabel = LOAN_LABEL
yLabel = LOAN_LABEL,
decimalPrecision = COUNT_DECIMAL_PRECISION
)
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ object Verbiage {
final val SUMMARY = config.getString("summary")
final val DEFAULT_DECIMAL_PRECISION = config.getInt("decimal_precision")
final val INTEREST_DECIMAL_PRECISION = config.getInt("interest_decimal_precision")
final val COUNT_DECIMAL_PRECISION = config.getInt("count_decimal_precision")
final object Race {
final val ASIAN = config.getString("race.asian")
final val BLACK = config.getString("race.black")
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package hmda.quarterly.data.api.route.rates

import hmda.quarterly.data.api.route.lib.Verbiage.COUNT_DECIMAL_PRECISION
import hmda.quarterly.data.api.route.rates.RatesGraph.Category

abstract class CountRatesGraph(
config: String,
endpoint: String,
titleKey: String,
subtitleKey: String,
category: Category) extends RatesGraph(config, endpoint, titleKey, subtitleKey, category) {
override protected def decimalPlaces: Int = COUNT_DECIMAL_PRECISION
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package hmda.quarterly.data.api.route.rates

import hmda.quarterly.data.api.route.lib.Verbiage.INTEREST_DECIMAL_PRECISION
import hmda.quarterly.data.api.route.rates.RatesGraph.Category

abstract class InterestRatesGraph(
config: String,
endpoint: String,
titleKey: String,
subtitleKey: String,
category: Category) extends RatesGraph(config, endpoint, titleKey, subtitleKey, category) {
override protected def decimalPlaces: Int = INTEREST_DECIMAL_PRECISION
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import akka.http.scaladsl.server.Route
import hmda.model.filing.lar.enums._
import hmda.quarterly.data.api.dto.QuarterGraphData.{ GraphRoute, GraphSeriesInfo, GraphSeriesSummary }
import hmda.quarterly.data.api.route.lib.Verbiage
import hmda.quarterly.data.api.route.lib.Verbiage.DEFAULT_DECIMAL_PRECISION
import hmda.quarterly.data.api.route.lib.Verbiage.LoanType._
import hmda.quarterly.data.api.route.lib.Verbiage.Race._
import hmda.quarterly.data.api.route.rates.RatesGraph.Category
Expand Down Expand Up @@ -45,7 +46,7 @@ abstract class RatesGraph(

protected def getSummaryByType(loanType: LoanTypeEnum, title: String, heloc: Boolean = false, conforming: Boolean = false): CancelableFuture[GraphSeriesSummary] = ???
protected def getSummaryByRace(title: String, race: String): CancelableFuture[GraphSeriesSummary] = ???

protected def decimalPlaces: Int = DEFAULT_DECIMAL_PRECISION
def getRoute: GraphRoute = new GraphRoute(title, categoryVerbiage, endpoint) {
override def route: Route = pathPrefix(endpoint) {
path("") {
Expand Down Expand Up @@ -85,5 +86,5 @@ abstract class RatesGraph(
}

private def getGraphSeriesInfo(title: String, subtitle: String, series: Seq[GraphSeriesSummary]): GraphSeriesInfo =
GraphSeriesInfo(title, subtitle, series, yLabel = label)
GraphSeriesInfo(title, subtitle, series, yLabel = label, decimalPrecision = decimalPlaces)
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ package hmda.quarterly.data.api.route.rates.credits
import hmda.model.filing.lar.enums._
import hmda.quarterly.data.api.dao.repo.QuarterlyGraphRepo
import hmda.quarterly.data.api.dto.QuarterGraphData.GraphSeriesSummary
import hmda.quarterly.data.api.route.rates.RatesGraph
import hmda.quarterly.data.api.route.rates.CountRatesGraph
import hmda.quarterly.data.api.route.rates.RatesGraph._
import monix.execution.CancelableFuture
import monix.execution.Scheduler.Implicits.global

object MedianCreditScores extends RatesGraph(
object MedianCreditScores extends CountRatesGraph(
"credit",
"credit-scores",
BY_TYPE_TITLE,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ package hmda.quarterly.data.api.route.rates.credits
import hmda.model.filing.lar.enums.Conventional
import hmda.quarterly.data.api.dao.repo.QuarterlyGraphRepo
import hmda.quarterly.data.api.dto.QuarterGraphData.GraphSeriesSummary
import hmda.quarterly.data.api.route.rates.RatesGraph
import hmda.quarterly.data.api.route.rates.CountRatesGraph
import hmda.quarterly.data.api.route.rates.RatesGraph._
import monix.execution.CancelableFuture
import monix.execution.Scheduler.Implicits.global

object MedianCreditScoresCCByRace extends RatesGraph(
object MedianCreditScoresCCByRace extends CountRatesGraph(
"credit",
"credit-scores-cc-re",
CC_BY_RACE_TITLE,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ package hmda.quarterly.data.api.route.rates.credits
import hmda.model.filing.lar.enums.FHAInsured
import hmda.quarterly.data.api.dao.repo.QuarterlyGraphRepo
import hmda.quarterly.data.api.dto.QuarterGraphData.GraphSeriesSummary
import hmda.quarterly.data.api.route.rates.RatesGraph
import hmda.quarterly.data.api.route.rates.CountRatesGraph
import hmda.quarterly.data.api.route.rates.RatesGraph._
import monix.execution.CancelableFuture
import monix.execution.Scheduler.Implicits.global

object MedianCreditScoresFHAByRace extends RatesGraph(
object MedianCreditScoresFHAByRace extends CountRatesGraph(
"credit",
"credit-scores-fha-re",
FHA_BY_RACE_TITLE,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ package hmda.quarterly.data.api.route.rates.interests
import hmda.model.filing.lar.enums._
import hmda.quarterly.data.api.dao.repo.QuarterlyGraphRepo
import hmda.quarterly.data.api.dto.QuarterGraphData.GraphSeriesSummary
import hmda.quarterly.data.api.route.rates.RatesGraph
import hmda.quarterly.data.api.route.rates.InterestRatesGraph
import hmda.quarterly.data.api.route.rates.RatesGraph._
import monix.execution.CancelableFuture
import monix.execution.Scheduler.Implicits.global

object MedianInterestRates extends RatesGraph(
object MedianInterestRates extends InterestRatesGraph(
"interest",
"interest-rates",
BY_TYPE_TITLE,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ package hmda.quarterly.data.api.route.rates.interests
import hmda.model.filing.lar.enums.Conventional
import hmda.quarterly.data.api.dao.repo.QuarterlyGraphRepo
import hmda.quarterly.data.api.dto.QuarterGraphData.GraphSeriesSummary
import hmda.quarterly.data.api.route.rates.RatesGraph
import hmda.quarterly.data.api.route.rates.InterestRatesGraph
import hmda.quarterly.data.api.route.rates.RatesGraph._
import monix.execution.CancelableFuture
import monix.execution.Scheduler.Implicits.global

object MedianInterestRatesCCByRace extends RatesGraph(
object MedianInterestRatesCCByRace extends InterestRatesGraph(
"interest",
"interest-rates-cc-re",
CC_BY_RACE_TITLE,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ package hmda.quarterly.data.api.route.rates.interests
import hmda.model.filing.lar.enums.FHAInsured
import hmda.quarterly.data.api.dao.repo.QuarterlyGraphRepo
import hmda.quarterly.data.api.dto.QuarterGraphData.GraphSeriesSummary
import hmda.quarterly.data.api.route.rates.RatesGraph
import hmda.quarterly.data.api.route.rates.InterestRatesGraph
import hmda.quarterly.data.api.route.rates.RatesGraph._
import monix.execution.CancelableFuture
import monix.execution.Scheduler.Implicits.global

object MedianInterestRatesFHAByRace extends RatesGraph(
object MedianInterestRatesFHAByRace extends InterestRatesGraph(
"interest",
"interest-rates-fha-re",
FHA_BY_RACE_TITLE,
Expand Down