@@ -86,8 +86,8 @@ def filter_dummy_data():
86
86
return DF .filter_rows (lambda r : not any ([r .get ('id' ) == 'dummy' , r .get ('name' ) == 'dummy' ]))
87
87
88
88
89
- def filter_active_data (statName ):
90
- return get_stats ().filter_with_stat (statName , lambda r : r .get ('status' ) != 'INACTIVE' )
89
+ def filter_active_data (resource , statName ):
90
+ return get_stats ().filter_with_stat (statName , lambda r : r .get ('status' ) != 'INACTIVE' , resources = resource )
91
91
92
92
93
93
def set_staging_pkey (resource_name ):
@@ -122,7 +122,7 @@ def preprocess_responses(select_fields=None, validate=False):
122
122
return DF .Flow (
123
123
DF .update_resource (['Responses' ], name = 'responses' , path = 'responses.csv' ),
124
124
filter_dummy_data (),
125
- filter_active_data ('Processing: Responses: Inactive' ),
125
+ filter_active_data ('responses' , ' Processing: Responses: Inactive' ),
126
126
set_staging_pkey ('responses' ),
127
127
DF .set_type ('synonyms' , type = 'array' , transform = lambda v : tuple (v .strip ().split ('\n ' )) if v else tuple (), resources = ['responses' ]),
128
128
DF .select_fields (select_fields , resources = ['responses' ]) if select_fields else None ,
@@ -134,7 +134,7 @@ def preprocess_situations(select_fields=None, validate=False):
134
134
return DF .Flow (
135
135
DF .update_resource (['Situations' ], name = 'situations' , path = 'situations.csv' ),
136
136
filter_dummy_data (),
137
- filter_active_data ('Processing: Situations: Inactive' ),
137
+ filter_active_data ('situations' , ' Processing: Situations: Inactive' ),
138
138
set_staging_pkey ('situations' ),
139
139
DF .set_type ('synonyms' , type = 'array' , transform = lambda v : tuple (v .strip ().split ('\n ' )) if v else tuple (), resources = ['situations' ]),
140
140
DF .select_fields (select_fields , resources = ['situations' ]) if select_fields else None ,
@@ -146,7 +146,7 @@ def preprocess_services(select_fields=None, validate=False):
146
146
return DF .Flow (
147
147
DF .update_resource (['Services' ], name = 'services' , path = 'services.csv' ),
148
148
filter_dummy_data (),
149
- filter_active_data ('Processing: Services: Inactive' ),
149
+ filter_active_data ('services' , ' Processing: Services: Inactive' ),
150
150
set_staging_pkey ('services' ),
151
151
DF .set_type ('urls' , type = 'array' , transform = transform_urls , resources = ['services' ]),
152
152
DF .set_type ('name' , transform = lambda v , row : row ['name_manual' ] or v , resources = ['services' ]),
@@ -175,7 +175,7 @@ def preprocess_organizations(select_fields=None, validate=False):
175
175
return DF .Flow (
176
176
DF .update_resource (['Organizations' ], name = 'organizations' , path = 'organizations.csv' ),
177
177
filter_dummy_data (),
178
- filter_active_data ('Processing: Organizations: Inactive' ),
178
+ filter_active_data ('organizations' , ' Processing: Organizations: Inactive' ),
179
179
get_stats ().filter_with_stat ('Processing: Organizations: No Name' , lambda r : bool (r .get ('name' )), resources = ['organizations' ]),
180
180
set_staging_pkey ('organizations' ),
181
181
DF .set_type ('urls' , type = 'array' , transform = transform_urls , resources = ['organizations' ]),
@@ -201,7 +201,7 @@ def preprocess_branches(validate=False):
201
201
return DF .Flow (
202
202
DF .update_resource (['Branches' ], name = 'branches' , path = 'branches.csv' ),
203
203
filter_dummy_data (),
204
- filter_active_data ('Processing: Branches: Inactive' ),
204
+ filter_active_data ('branches' , ' Processing: Branches: Inactive' ),
205
205
set_staging_pkey ('branches' ),
206
206
DF .select_fields (select_fields , resources = ['branches' ]),
207
207
DF .set_type ('urls' , type = 'array' , transform = transform_urls , resources = ['branches' ]),
0 commit comments