Skip to content

Commit

Permalink
change name and add application date to the edit detail
Browse files Browse the repository at this point in the history
  • Loading branch information
omnipresent07 committed Nov 18, 2020
1 parent f2ddb60 commit 1d9d000
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions common/src/main/resources/reference.conf
Original file line number Diff line number Diff line change
Expand Up @@ -163,8 +163,8 @@ hmda {
irsGroup = ${?KAFKA_IRS_GROUP}
institutionsGroup = "institutions-group"
institutionsGroup = ${?KAFKA_INSTITUTIONS_GROUP}
submissionErrorsGroup = "submission-errors-group"
submissionErrorsGroup = ${?KAFKA_SUBMISSION_ERRORS_GROUP}
submissionErrorsGroup = "triggered-quality-edits-group"
submissionErrorsGroup = ${?TRIGGERED_QUALITY_EDITS_GROUP}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
CREATE TABLE submission_errors(
CREATE TABLE triggered_quality_edits(
lei VARCHAR,
period VARCHAR,
sequence_number INT,
Expand All @@ -7,5 +7,5 @@ CREATE TABLE submission_errors(
loan_data TEXT ARRAY,
created_date TIMESTAMP,
updated_date TIMESTAMP,
CONSTRAINT submission_errors_pkey PRIMARY KEY (lei, period, sequence_number, edit_name)
CONSTRAINT triggered_quality_edits_pkey PRIMARY KEY (lei, period, sequence_number, edit_name)
);
2 changes: 1 addition & 1 deletion submission-errors/src/main/resources/application.conf
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ dbconfig {
database = "hmda"
database = ${?PG_DATABASE}

table = "submission_errors"
table = "triggered_quality_edits"
table = ${?PG_TABLE}

user = "postgres"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import scala.concurrent.Future
object ErrorLines {
type RawLine = String

final case class RowLoanData(uli: String, actionTaken: Int, actionTakenDate: Int) {
final case class RowLoanData(uli: String, actionTaken: Int, actionTakenDate: Int, applicationDate: String) {
override def toString: String = s"$uli:$actionTaken:$actionTakenDate``"
}

Expand Down Expand Up @@ -65,7 +65,7 @@ object ErrorLines {
case Some(editNames) =>
// only parse the line if we found that there was an error associated with it
val lar = LarCsvParser(rawData).getOrElse(LoanApplicationRegister())
val loanData = RowLoanData(lar.loan.ULI, lar.action.actionTakenType.code, lar.action.actionTakenDate)
val loanData = RowLoanData(lar.loan.ULI, lar.action.actionTakenType.code, lar.action.actionTakenDate, lar.loan.applicationDate)
editNames.foldLeft(acc) { (acc, nextEditName) =>
val updatedErrorListForEdit = acc.getOrElse(nextEditName, Vector.empty[RowLoanData]) :+ loanData
acc + (nextEditName -> updatedErrorListForEdit)
Expand Down
4 changes: 2 additions & 2 deletions submission-errors/src/test/resources/bootstrap.sql
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
CREATE TABLE submission_errors(
CREATE TABLE triggered_quality_edits(
lei VARCHAR,
period VARCHAR,
sequence_number INT,
Expand All @@ -7,5 +7,5 @@ CREATE TABLE submission_errors(
loan_data TEXT ARRAY,
created_date TIMESTAMP,
updated_date TIMESTAMP,
CONSTRAINT submission_errors_pkey PRIMARY KEY (lei, period, sequence_number, edit_name)
CONSTRAINT triggered_quality_edits_pkey PRIMARY KEY (lei, period, sequence_number, edit_name)
);
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class PostgresSubmissionErrorRepositorySpec
"PostgresSubmissionErrorRepository" should "persist error data into the repository" in {
// Note: dbConfig comes from EmbeddedPostgres
val dbConfig = PostgresSubmissionErrorRepository.config(dbHoconpath)
val repo = PostgresSubmissionErrorRepository.make(dbConfig, "submission_errors")
val repo = PostgresSubmissionErrorRepository.make(dbConfig, "triggered_quality_edits")
val submissionId = SubmissionId("EXAMPLE-LEI", Period(2018, None), sequenceNumber = 1)

repo.submissionPresent(submissionId).runSyncUnsafe() shouldBe false
Expand Down

0 comments on commit 1d9d000

Please sign in to comment.