Skip to content

Commit

Permalink
make ANC module incremental
Browse files Browse the repository at this point in the history
  • Loading branch information
njogz committed Jan 24, 2024
1 parent 00a1b28 commit f8508e3
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 6 deletions.
3 changes: 0 additions & 3 deletions dbt_project.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,6 @@ clean-targets: # directories to be removed by `dbt clean`
- 'target'
- 'dbt_modules'

vars:
end_date: "2020-12-12"

models:
type_partitions:
root:
Expand Down
8 changes: 7 additions & 1 deletion models/brac/impact/ANC/impact_ancview_danger_sign.sql
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{ config(
materialized='view',
materialized='incremental',
description='ANC Danger Signs view for Brac Uganda'
) }}

Expand Down Expand Up @@ -44,3 +44,9 @@ SELECT
reported
FROM
danger_sign_CTE

{% if is_incremental() %}

where reported > (select max(reported) from {{ this }})

{% endif %}
8 changes: 7 additions & 1 deletion models/brac/impact/ANC/impact_ancview_delivery.sql
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{ config(
materialized='view',
materialized='incremental',
description='ANC Delivery view for Brac Uganda'
) }}

Expand Down Expand Up @@ -37,3 +37,9 @@ WHERE
pnc.follow_up_count = '1'
AND (pnc.pregnancy_outcome IN (VALUES ('healthy'), ('still_birth')))
AND pnc.patient_id IS NOT NULL AND pnc.patient_id <> ''

{% if is_incremental() %}

where reported > (select max(reported) from {{ this }})

{% endif %}
8 changes: 7 additions & 1 deletion models/brac/impact/ANC/impact_ancview_pregnancy_visit.sql
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{ config(
materialized='view',
materialized='incremental',
description='ANC Pregnancy Visit view for Brac Uganda'
) }}

Expand All @@ -16,3 +16,9 @@ FROM
{{ ref('useview_visit') }}
WHERE
visit_type = 'anc'

{% if is_incremental() %}

where reported > (select max(reported) from {{ this }})

{% endif %}

0 comments on commit f8508e3

Please sign in to comment.