Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -76,3 +76,19 @@ resource "null_resource" "request_item_plan_status_templateid_column" {

depends_on = [null_resource.request_item_plan_status_recipientcontactid_column]
}

resource "null_resource" "request_item_plan_status_failedreasoncode_column" {
triggers = {
always_run = timestamp()
}
provisioner "local-exec" {
command = <<EOT
${path.module}/scripts/add_column.sh \
${aws_athena_workgroup.setup.name} \
${aws_glue_catalog_database.reporting.name} \
request_item_plan_status failedreasoncode string
EOT
}

depends_on = [null_resource.request_item_plan_status_templateid_column]
}
Original file line number Diff line number Diff line change
Expand Up @@ -108,3 +108,19 @@ resource "null_resource" "request_item_status_billingref_column" {

depends_on = [null_resource.request_item_status_sendinggroupcreatedtime_column]
}

resource "null_resource" "request_item_status_failedreasoncode_column" {
triggers = {
always_run = timestamp()
}
provisioner "local-exec" {
command = <<EOT
${path.module}/scripts/add_column.sh \
${aws_athena_workgroup.setup.name} \
${aws_glue_catalog_database.reporting.name} \
request_item_status failedreasoncode string
EOT
}

depends_on = [null_resource.request_item_status_billingref_column]
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ USING (
ordernumber,
recipientcontactid,
CAST(CAST(templates.suppliers AS json) AS map<varchar, varchar>)[LOWER(supplier)] AS templateid,
failedreasoncode,
CAST("$classification".timestamp AS BIGINT) AS timestamp
FROM ${source_table}
WHERE (sk LIKE 'REQUEST_ITEM_PLAN#%') AND
Expand Down Expand Up @@ -65,6 +66,7 @@ WHEN MATCHED AND (source.timestamp > target.timestamp) THEN UPDATE SET
ordernumber = source.ordernumber,
recipientcontactid = source.recipientcontactid,
templateid = source.templateid,
failedreasoncode = source.failedreasoncode,
timestamp = source.timestamp
WHEN NOT MATCHED THEN INSERT (
clientid,
Expand All @@ -88,6 +90,7 @@ WHEN NOT MATCHED THEN INSERT (
ordernumber,
recipientcontactid,
templateid,
failedreasoncode,
timestamp
)
VALUES (
Expand All @@ -112,5 +115,6 @@ VALUES (
source.ordernumber,
source.recipientcontactid,
source.templateid,
source.failedreasoncode,
source.timestamp
)
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ USING (
failedreason,
patientodscode,
billingref,
failedreasoncode,
CAST("$classification".timestamp AS BIGINT) AS timestamp
FROM ${source_table}
WHERE (sk LIKE 'REQUEST_ITEM#%') AND
Expand Down Expand Up @@ -61,6 +62,7 @@ WHEN MATCHED AND (source.timestamp > target.timestamp) THEN UPDATE SET
failedreason = source.failedreason,
patientodscode = source.patientodscode,
billingref = source.billingref,
failedreasoncode = source.failedreasoncode,
timestamp = source.timestamp
WHEN NOT MATCHED THEN INSERT (
clientid,
Expand All @@ -82,6 +84,7 @@ WHEN NOT MATCHED THEN INSERT (
failedreason,
patientodscode,
billingref,
failedreasoncode,
timestamp
)
VALUES (
Expand All @@ -104,5 +107,6 @@ VALUES (
source.failedreason,
source.patientodscode,
source.billingref,
source.failedreasoncode,
source.timestamp
)
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ SELECT
communicationtype,
channeltype,
requestitemplanfailedreason,
templateid
templateid,
requestitemplanfailedreasoncode,
requestitemfailedreasoncode
FROM completed_comms
WHERE clientid = ? AND requestid = ?
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ SELECT
communicationtype,
channeltype,
requestitemplanfailedreason,
templateid
templateid,
requestitemplanfailedreasoncode,
requestitemfailedreasoncode
FROM completed_comms
WHERE
clientid = ? AND
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ SELECT
rip.communicationtype as communicationtype,
rip.channeltype as channeltype,
rip.failedreason as requestitemplanfailedreason,
rip.templateid as templateid
rip.templateid as templateid,
rip.failedreasoncode as requestitemplanfailedreasoncode,
ri.failedreasoncode as requestitemfailedreasoncode
FROM request_item_status ri
LEFT OUTER JOIN request_item_plan_status rip ON
ri.requestitemid = rip.requestitemid AND
Expand Down
Loading