Skip to content

Commit 03ebe37

Browse files
Analytical Model Updates
Added tables + columns in Gramin and GDGS (loksahbhag, gp) Added test cases for all projects Added applicable approval filters
1 parent d134972 commit 03ebe37

122 files changed

Lines changed: 2369 additions & 224 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 205 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,205 @@
1+
version: 2
2+
3+
models:
4+
- name: farmer_endline_analytics_gdgs_25
5+
description: "Encounter records filtered to 'Farmer Endline'"
6+
columns:
7+
- name: eid
8+
description: "Unique encounter/event identifier."
9+
tests:
10+
- not_null
11+
- name: endline_farmer_sub_id
12+
description: "Subject identifier for the farmer associated with this endline encounter."
13+
tests:
14+
- not_null
15+
- name: encounter_type
16+
description: "Encounter type label (should be 'Farmer Endline')."
17+
- name: encounter_date_time
18+
description: "Timestamp when the encounter occurred."
19+
tests:
20+
- not_null
21+
- name: voided
22+
description: "Whether the encounter record is voided."
23+
tests:
24+
- not_null
25+
- accepted_values:
26+
values: [true, false]
27+
- name: land_holding
28+
description: "Land holding in acres captured in the endline observations."
29+
tests:
30+
- dbt_expectations.expect_column_values_to_be_of_type:
31+
column_type: numeric
32+
- name: total_silt_excavated
33+
description: "Total silt excavated (numeric) captured in the endline observations."
34+
tests:
35+
- dbt_expectations.expect_column_values_to_be_of_type:
36+
column_type: numeric
37+
- name: area_silt_spread
38+
description: "Total farm area on which silt is spread (numeric)."
39+
tests:
40+
- dbt_expectations.expect_column_values_to_be_of_type:
41+
column_type: numeric
42+
- name: total_carting_cost
43+
description: "Total cost borne by the farmer for carting silt (INR, numeric)."
44+
tests:
45+
- dbt_expectations.expect_column_values_to_be_of_type:
46+
column_type: numeric
47+
- name: total_spreading_cost
48+
description: "Total cost borne by the farmer for spreading/levelling silt (INR, numeric)."
49+
tests:
50+
- dbt_expectations.expect_column_values_to_be_of_type:
51+
column_type: numeric
52+
53+
- name: machine_endline_analytics_gdgs_25
54+
description: "Encounter records filtered to 'Excavating Machine Endline'"
55+
columns:
56+
- name: eid
57+
description: "Unique encounter/event identifier."
58+
tests:
59+
- not_null
60+
- name: endline_machine_sub_id
61+
description: "Subject identifier for the excavating machine associated with this endline encounter."
62+
tests:
63+
- not_null
64+
- name: encounter_type
65+
description: "Encounter type label (should be 'Excavating Machine Endline')."
66+
tests:
67+
- not_null
68+
- accepted_values:
69+
values: ['Excavating Machine Endline']
70+
- name: encounter_date_time
71+
description: "Timestamp when the encounter occurred."
72+
tests:
73+
- not_null
74+
- name: voided
75+
description: "Whether the encounter record is voided."
76+
tests:
77+
- not_null
78+
- accepted_values:
79+
values: [true, false]
80+
- name: total_machine_working_hours
81+
description: "Total working hours of the machine captured in the endline observations (numeric)."
82+
tests:
83+
- dbt_expectations.expect_column_values_to_be_of_type:
84+
column_type: numeric
85+
86+
- name: work_order_endline_gdgs_25
87+
description: "Encounter records filtered to 'Work order endline'"
88+
columns:
89+
- name: eid
90+
description: "Unique encounter/event identifier."
91+
tests:
92+
- not_null
93+
- name: endline_work_order_sub_id
94+
description: "Subject identifier for the work order associated with this endline encounter."
95+
tests:
96+
- not_null
97+
- name: encounter_type
98+
description: "Encounter type label (should be 'Work order endline')."
99+
tests:
100+
- not_null
101+
- accepted_values:
102+
values: ['Work order endline']
103+
- name: encounter_date_time
104+
description: "Timestamp when the encounter occurred."
105+
tests:
106+
- not_null
107+
- name: voided
108+
description: "Whether the encounter record is voided."
109+
tests:
110+
- not_null
111+
- accepted_values:
112+
values: [true, false]
113+
- name: total_silt_excavated
114+
description: "Total silt excavated captured in the endline observations (numeric)."
115+
tests:
116+
- dbt_expectations.expect_column_values_to_be_of_type:
117+
column_type: numeric
118+
- name: silt_excavated_as_per_mb
119+
description: "Silt excavated as per MB recording captured in the endline observations (numeric)."
120+
tests:
121+
- dbt_expectations.expect_column_values_to_be_of_type:
122+
column_type: numeric
123+
124+
- name: work_order_farmer_gdgs_25
125+
description: "Encounter records filtered to 'Work order daily Recording - Farmer'"
126+
columns:
127+
- name: eid
128+
description: "Unique encounter/event identifier."
129+
tests:
130+
- not_null
131+
- name: farmer_work_order_sub_id
132+
description: "Subject identifier for the work order associated with this farmer daily recording encounter."
133+
tests:
134+
- not_null
135+
- name: encounter_type
136+
description: "Encounter type label (should be 'Work order daily Recording - Farmer')."
137+
- name: encounter_date_time
138+
description: "Timestamp when the encounter occurred."
139+
tests:
140+
- not_null
141+
- name: voided
142+
description: "Whether the encounter record is voided."
143+
tests:
144+
- not_null
145+
- accepted_values:
146+
values: [true, false]
147+
- name: silt_carted
148+
description: "Total silt carted in this encounter (numeric)."
149+
tests:
150+
- dbt_expectations.expect_column_values_to_be_of_type:
151+
column_type: numeric
152+
- name: trolleys_carted
153+
description: "Number of trolleys carted in this encounter (numeric)."
154+
tests:
155+
- dbt_expectations.expect_column_values_to_be_of_type:
156+
column_type: numeric
157+
- name: capacity_trolleys
158+
description: "Capacity of trolleys in cubic meters (numeric)."
159+
tests:
160+
- dbt_expectations.expect_column_values_to_be_of_type:
161+
column_type: numeric
162+
- name: hyvas_carted
163+
description: "Number of hyvas/dumpers carted in this encounter (numeric)."
164+
tests:
165+
- dbt_expectations.expect_column_values_to_be_of_type:
166+
column_type: numeric
167+
- name: amt_silt_used_non_farm_purpose
168+
description: "Amount of silt used for non-farm purposes captured in this encounter (numeric)."
169+
tests:
170+
- dbt_expectations.expect_column_values_to_be_of_type:
171+
column_type: numeric
172+
173+
- name: work_order_machine_gdgs_25
174+
description: "Encounter records filtered to 'Work order daily Recording - Machine'"
175+
columns:
176+
- name: eid
177+
description: "Unique encounter/event identifier."
178+
tests:
179+
- not_null
180+
- name: machine_work_order_sub_id
181+
description: "Subject identifier for the work order associated with this machine daily recording encounter."
182+
tests:
183+
- not_null
184+
- name: encounter_type
185+
description: "Encounter type label (should be 'Work order daily Recording - Machine')."
186+
- name: encounter_date_time
187+
description: "Timestamp when the encounter occurred."
188+
tests:
189+
- not_null
190+
- name: voided
191+
description: "Whether the encounter record is voided."
192+
tests:
193+
- not_null
194+
- accepted_values:
195+
values: [true, false]
196+
- name: total_working_hours
197+
description: "Total working hours captured in this encounter (numeric)."
198+
tests:
199+
- dbt_expectations.expect_column_values_to_be_of_type:
200+
column_type: numeric
201+
- name: working_hours
202+
description: "Working hours as per time captured in this encounter (numeric)."
203+
tests:
204+
- dbt_expectations.expect_column_values_to_be_of_type:
205+
column_type: numeric

models/analytics/gdgs_2025/encounters/farmer_endline_analytics_gdgs_25.sql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
e.observations ->> 'Major crops to be grown on the land where silt is spread' AS major_to_be_grown,
2323
e.observations ->> 'Is the land-holding information correct? - Farmer Endline' AS land_holding_info_correct,
2424
CAST(e.observations ->> 'Total cost borne by the farmer for spreading/levelling silt on farm (INR)' AS NUMERIC) AS total_spreading_cost,
25+
e.observations ->> 'Has the farmer applied for subsidy' AS farmer_subsidy,
2526
e.voided
2627

2728
FROM {{ ref('encounter_type_gdgs_25') }} e
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
-- Loksahbhag registration table with cleaned identifiers, location, and approval metadata for gdgs 2025.
2+
{{ config(
3+
materialized='table',
4+
tags=["analytics","analytics_gdgs_2025", "registrations_gdgs_2025"]
5+
) }}
6+
7+
SELECT
8+
m.subject_id,
9+
m.registration_date,
10+
m.subject_type,
11+
m.location_id,
12+
m.state_ls,
13+
m.district_ls,
14+
m.taluka_ls,
15+
m.village_ls,
16+
-- m.ngo_name as stakeholder_responsible,
17+
m.waterbody_name,
18+
m.site_start_date,
19+
m.site_end_date,
20+
m.village_code,
21+
m.silt_excavated_ls::NUMERIC AS silt_excavated_ls,
22+
m.voided
23+
24+
-- Note: Location details are contained within the subjects table itself, so no need to join with a separate location table
25+
-- There is no approval status details.
26+
27+
FROM
28+
{{ ref('dim_subjects_loksahbhag_gdgs_25') }} AS m
29+
WHERE m.voided != TRUE

0 commit comments

Comments
 (0)