Skip to content

Commit

Permalink
refactor: use dbt native dateadd macro
Browse files Browse the repository at this point in the history
  • Loading branch information
lawrenceadams committed Oct 6, 2024
1 parent 5c2cf10 commit 1cc37f0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions models/omop/drug_era.sql
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ WITH ctePreDrugTarget AS (
, COALESCE(
NULLIF(drug_exposure_end_date, NULL)
, NULLIF(
drug_exposure_start_date + days_supply * INTERVAL '1 day'
{{ dateadd("day", "days_supply", "drug_exposure_start_date") }}
, drug_exposure_start_date
)
, drug_exposure_start_date + INTERVAL '1 day'
, {{ dateadd("day", 1, "drug_exposure_start_date") }}
) AS drug_exposure_end_date
FROM {{ ref ('drug_exposure') }} AS d
INNER JOIN {{ ref ('stg_vocabulary__concept_ancestor') }} AS ca
Expand Down

0 comments on commit 1cc37f0

Please sign in to comment.