Skip to content

Commit

Permalink
convert end of month calculations to PT
Browse files Browse the repository at this point in the history
  • Loading branch information
charlie-costanzo committed Jan 4, 2024
1 parent 75e952a commit fc11652
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
13 changes: 12 additions & 1 deletion warehouse/models/mart/payments/_payments.yml
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,14 @@ models:
The mapping of organization records to payments entities is manually maintained in a seed file.
- name: end_of_month_date
description: |
The last day of the month of the aggregation_datetime.
The last day of the month of the aggregation_datetime in Pacific Time (involves conversion of aggregation_datetime to Pacific Time).
This column is primarily for use in BI tooling to support consistent dates across activity types.
Aggregation activity happens throughout the month.
tests:
- not_null
- name: end_of_month_date_utc
description: |
The last day of the month of the aggregation_datetime in UTC.
This column is primarily for use in BI tooling to support consistent dates across activity types.
Aggregation activity happens throughout the month.
tests:
Expand Down Expand Up @@ -270,6 +277,10 @@ models:
- *organization_name
- *organization_source_record_id
- name: end_of_month_date
description: |
The last day of the month in Pacific Time (involves conversion of record_updated_timestamp_utc to Pacific Time).
This column is primarily for use in BI tooling to support consistent dates across activity types.
- name: end_of_month_date_utc
description: |
The last day of the month of the record_updated_timestamp_utc.
This column is primarily for use in BI tooling to support consistent dates across activity types.
Expand Down
3 changes: 2 additions & 1 deletion warehouse/models/mart/payments/fct_payments_aggregations.sql
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@ fct_payments_aggregations AS (
participant_id,
organization_name,
organization_source_record_id,
LAST_DAY(EXTRACT(DATE FROM aggregation_datetime), MONTH) AS end_of_month_date,
LAST_DAY(EXTRACT(DATE FROM aggregation_datetime AT TIME ZONE "America/Los_Angeles"), MONTH) AS end_of_month_date,
LAST_DAY(EXTRACT(DATE FROM aggregation_datetime), MONTH) AS end_of_month_date_utc,
aggregation_id,
has_micropayment,
has_authorisation,
Expand Down
3 changes: 2 additions & 1 deletion warehouse/models/mart/payments/fct_payments_settlements.sql
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@ fct_payments_settlements AS (
WHEN settlement_type = "CREDIT" THEN -1*(transaction_amount)
WHEN settlement_type = "DEBIT" THEN transaction_amount
END AS transaction_amount,
LAST_DAY(EXTRACT(DATE FROM record_updated_timestamp_utc), MONTH) AS end_of_month_date,
LAST_DAY(EXTRACT(DATE FROM record_updated_timestamp_utc AT TIME ZONE "America/Los_Angeles"), MONTH) AS end_of_month_date,
LAST_DAY(EXTRACT(DATE FROM record_updated_timestamp_utc), MONTH) AS end_of_month_date_utc,
imputed_type,
acquirer,
_line_number,
Expand Down

0 comments on commit fc11652

Please sign in to comment.