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

Data browser 2022 Data Publication Updates #4676

Merged
merged 3 commits into from
Jul 17, 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
2 changes: 1 addition & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ lazy val slickDeps = Seq(slick, slickHikariCP, postgres, h2)

lazy val dockerSettings = Seq(
Docker / maintainer := "Hmda-Ops",
dockerBaseImage := "eclipse-temurin:19-jdk-alpine",
dockerBaseImage := "openjdk:19-jdk-alpine3.16",
dockerRepository := Some("hmda"),
dockerCommands := dockerCommands.value.flatMap {
case cmd@Cmd("FROM",_) => List(cmd, Cmd("RUN", "apk update"),
Expand Down
13 changes: 7 additions & 6 deletions data-browser/src/main/resources/application.conf
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,18 @@ server {

s3 {
environment = "dev"
environment = ${?AWS_ENVIRONMENT}
public-bucket = "cfpb-hmda-public"
public-bucket = ${?S3_PUBLIC_BUCKET}
url = "https://"${server.s3.public-bucket}".s3.amazonaws.com"
url = ${?S3_URL}
routes {
filtered-queries {
2017 = "data-browser/2017/filtered-queries"
2018 = "data-browser/2018/filtered-queries/three-year"
2019 = "data-browser/2019/filtered-queries/one-year"
2019 = "data-browser/2019/filtered-queries/three-year"
2020 = "data-browser/2020/filtered-queries/one-year"
2021 = "data-browser/2021/filtered-queries/snapshot"
2021 = "data-browser/2021/filtered-queries/one-year"
2022 = "data-browser/2022/filtered-queries/snapshot"

}
// this is where s3 files with unique md5 hash strings are saved
}
Expand All @@ -51,9 +51,10 @@ dbconfig {
database = ${?PG_DATABASE}

table {
2021 = "modifiedlar2021_snapshot_04302022"
2022 = "modifiedlar2022_snapshot_05012023"
2021 = "modifiedlar2021_one_year_05012023"
2020 = "modifiedlar2020_one_year_04302022"
2019 = "modifiedlar2019_one_year_04052022"
2019 = "modifiedlar2019_three_year_04012023"
2018 = "modifiedlar2018_three_year_04052022"
2017 = "modifiedlar2017_ultimate"
}
Expand Down
10 changes: 7 additions & 3 deletions data-browser/src/main/scala/hmda/dataBrowser/Settings.scala
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ trait Settings {
}

object database {
val tableName2022: String = config.getString("dbconfig.table.2022")
val tableName2021: String = config.getString("dbconfig.table.2021")
val tableName2020: String = config.getString("dbconfig.table.2020")
val tableName2019: String = config.getString("dbconfig.table.2019")
Expand All @@ -43,7 +44,8 @@ trait Settings {
case 2019 => tableName2019
case 2020 => tableName2020
case 2021 => tableName2021
case _ => tableName2021
case 2022 => tableName2022
case _ => tableName2022
}
ModifiedLarTable(selected)
}
Expand All @@ -54,7 +56,8 @@ trait Settings {
case 2019 => tableName2019
case 2020 => tableName2020
case 2021 => tableName2021
case _ => tableName2021
case 2022 => tableName2022
case _ => tableName2022
}

selected
Expand Down Expand Up @@ -89,7 +92,8 @@ trait Settings {
case 2019 => config.getString("server.s3.routes.filtered-queries.2019")
case 2020 => config.getString("server.s3.routes.filtered-queries.2020")
case 2021 => config.getString("server.s3.routes.filtered-queries.2021")
case _ => config.getString("server.s3.routes.filtered-queries.2021")
case 2022 => config.getString("server.s3.routes.filtered-queries.2022")
case _ => config.getString("server.s3.routes.filtered-queries.2022")
}
selected
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,9 +173,9 @@ trait DataBrowserDirectives extends Settings {
import de.heikoseeberger.akkahttpcirce.FailFastCirceSupport._
complete((BadRequest, "must provide years value parameter"))

case xs if xs.exists(year => (year < 2018) || (year > 2021)) => // TODO: Change this to 2017 when 2017 is released
case xs if xs.exists(year => (year < 2018) || (year > 2022)) => // TODO: Change this to 2017 when 2017 is released
import de.heikoseeberger.akkahttpcirce.FailFastCirceSupport._
complete((BadRequest, s"must provide years in the range of 2018-2020, you have provided (${xs.mkString(", ")})"))
complete((BadRequest, s"must provide years in the range of 2018-2022, you have provided (${xs.mkString(", ")})"))

case xs => provide(Option(QueryField(name = "year", xs.map(_.toString), dbName = "filing_year", isAllSelected = false)))
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,10 +171,11 @@ class PostgresModifiedLarRepository(config: DatabaseConfig[JdbcProfile], tableSe
override def findFilers(filerFields: List[QueryField], year: Int): Task[Seq[FilerInformationLatest]] = {
val institutionsTableName = year match { //will be needed when data browser has to support multiple years
case 2018 => "institutions2018_three_year_04052022"
case 2019 => "institutions2019_one_year_04052022"
case 2019 => "institutions2019_three_year_04122023"
case 2020 => "institutions2020_one_year_04302022"
case 2021 => "institutions2021_snapshot_04302022"
case _ => "institutions2021_snapshot_04302022"
case 2021 => "institutions2021_one_year_05012023"
case 2022 => "institutions2022_snapshot_05012023"
case _ => "institutions2022_snapshot_05012023"
}

//do not include year in the WHERE clause because all entries in the table (modifiedlar2018_snapshot) have filing_year = 2018
Expand Down
Loading