|
1 | | -# test locally with: docker compose run --rm airflow-cli dags test dts_csr_report_publishing |
| 1 | +# test locally with: docker compose run --rm airflow-cli dags test dts_311_report_publishing |
2 | 2 |
|
3 | 3 | from os import getenv |
4 | 4 |
|
|
49 | 49 | "opitem": "Executive Dashboard", |
50 | 50 | "opfield": "datasets.Revenue", |
51 | 51 | }, |
52 | | - "CSR_DATASET": { |
| 52 | + "REQUESTS_DATASET": { |
53 | 53 | "opitem": "Executive Dashboard", |
54 | 54 | "opfield": "datasets.CSR", |
55 | 55 | }, |
|
92 | 92 | } |
93 | 93 |
|
94 | 94 | CUR_YEAR_SECRETS = { |
95 | | - "CSR_ENDPOINT": { |
| 95 | + "REQUESTS_ENDPOINT": { |
96 | 96 | "opitem": "Executive Dashboard", |
97 | 97 | "opfield": "csr.Current FY Endpoint", |
98 | 98 | }, |
|
107 | 107 | } |
108 | 108 |
|
109 | 109 | PREV_YEAR_SECRETS = { |
110 | | - "CSR_ENDPOINT": { |
| 110 | + "REQUESTS_ENDPOINT": { |
111 | 111 | "opitem": "Executive Dashboard", |
112 | 112 | "opfield": "csr.Previous FY Endpoint", |
113 | 113 | }, |
|
122 | 122 | } |
123 | 123 |
|
124 | 124 | TWO_YEARS_AGO_SECRETS = { |
125 | | - "CSR_ENDPOINT": { |
| 125 | + "REQUESTS_ENDPOINT": { |
126 | 126 | "opitem": "Executive Dashboard", |
127 | 127 | "opfield": "csr.Two Years Ago FY Endpoint", |
128 | 128 | }, |
|
142 | 142 | TWO_YEARS_AGO_SECRETS.update(OTHER_SECRETS) |
143 | 143 |
|
144 | 144 | with DAG( |
145 | | - dag_id="dts_csr_report_publishing", |
| 145 | + dag_id="dts_311_report_publishing", |
146 | 146 | description="Downloads reports of 311 service requests for TPW and publishes it in a Socrata dataset.", |
147 | 147 | default_args=default_args, |
148 | 148 | schedule_interval=( |
149 | 149 | "36 2,13 * * *" if DEPLOYMENT_ENVIRONMENT == "production" else None |
150 | 150 | ), |
151 | 151 | dagrun_timeout=timedelta(minutes=60), |
152 | | - tags=["repo:dts-311-reporting", "socrata", "csr"], |
| 152 | + tags=["repo:dts-311-reporting", "socrata", "311"], |
153 | 153 | catchup=False, |
154 | 154 | ) as dag: |
155 | 155 | docker_image = "atddocker/dts-311-reporting:production" |
|
159 | 159 | two_years_env = get_env_vars_task(TWO_YEARS_AGO_SECRETS) |
160 | 160 |
|
161 | 161 | t1 = DockerOperator( |
162 | | - task_id="cur_year_csr_report_to_socrata", |
| 162 | + task_id="cur_year_requests_report_to_socrata", |
163 | 163 | image=docker_image, |
164 | 164 | docker_conn_id="docker_default", |
165 | 165 | api_version="auto", |
166 | 166 | auto_remove="force", |
167 | | - command=f"python etl/csr_to_socrata.py", |
| 167 | + command="python -m etl.csv_reporting.requests_to_socrata", |
168 | 168 | environment=cur_year_env, |
169 | 169 | tty=True, |
170 | 170 | force_pull=True, |
|
176 | 176 | docker_conn_id="docker_default", |
177 | 177 | api_version="auto", |
178 | 178 | auto_remove="force", |
179 | | - command=f"python etl/flex_notes_to_socrata.py", |
| 179 | + command="python -m etl.csv_reporting.flex_notes_to_socrata", |
180 | 180 | environment=cur_year_env, |
181 | 181 | tty=True, |
182 | 182 | ) |
|
187 | 187 | docker_conn_id="docker_default", |
188 | 188 | api_version="auto", |
189 | 189 | auto_remove="force", |
190 | | - command=f"python etl/activities_to_socrata.py", |
| 190 | + command="python -m etl.csv_reporting.activities_to_socrata", |
191 | 191 | environment=cur_year_env, |
192 | 192 | tty=True, |
193 | 193 | ) |
194 | 194 |
|
195 | 195 | t4 = DockerOperator( |
196 | | - task_id="prev_year_csr_report_to_socrata", |
| 196 | + task_id="prev_year_requests_report_to_socrata", |
197 | 197 | image=docker_image, |
198 | 198 | docker_conn_id="docker_default", |
199 | 199 | api_version="auto", |
200 | 200 | auto_remove="force", |
201 | | - command=f"python etl/csr_to_socrata.py", |
| 201 | + command="python -m etl.csv_reporting.requests_to_socrata", |
202 | 202 | environment=prev_year_env, |
203 | 203 | tty=True, |
204 | 204 | ) |
|
209 | 209 | docker_conn_id="docker_default", |
210 | 210 | api_version="auto", |
211 | 211 | auto_remove="force", |
212 | | - command=f"python etl/flex_notes_to_socrata.py", |
| 212 | + command="python -m etl.csv_reporting.flex_notes_to_socrata", |
213 | 213 | environment=prev_year_env, |
214 | 214 | tty=True, |
215 | 215 | ) |
|
220 | 220 | docker_conn_id="docker_default", |
221 | 221 | api_version="auto", |
222 | 222 | auto_remove="force", |
223 | | - command=f"python etl/activities_to_socrata.py", |
| 223 | + command="python -m etl.csv_reporting.activities_to_socrata", |
224 | 224 | environment=prev_year_env, |
225 | 225 | tty=True, |
226 | 226 | ) |
227 | 227 |
|
228 | 228 | t7 = DockerOperator( |
229 | | - task_id="two_years_ago_csr_report_to_socrata", |
| 229 | + task_id="two_years_ago_requests_report_to_socrata", |
230 | 230 | image=docker_image, |
231 | 231 | docker_conn_id="docker_default", |
232 | 232 | api_version="auto", |
233 | 233 | auto_remove="force", |
234 | | - command=f"python etl/csr_to_socrata.py", |
| 234 | + command="python -m etl.csv_reporting.requests_to_socrata", |
235 | 235 | environment=two_years_env, |
236 | 236 | tty=True, |
237 | 237 | ) |
|
242 | 242 | docker_conn_id="docker_default", |
243 | 243 | api_version="auto", |
244 | 244 | auto_remove="force", |
245 | | - command=f"python etl/flex_notes_to_socrata.py", |
| 245 | + command="python -m etl.csv_reporting.flex_notes_to_socrata", |
246 | 246 | environment=two_years_env, |
247 | 247 | tty=True, |
248 | 248 | ) |
|
253 | 253 | docker_conn_id="docker_default", |
254 | 254 | api_version="auto", |
255 | 255 | auto_remove="force", |
256 | | - command=f"python etl/activities_to_socrata.py", |
| 256 | + command="python -m etl.csv_reporting.activities_to_socrata", |
257 | 257 | environment=two_years_env, |
258 | 258 | tty=True, |
259 | 259 | ) |
|
0 commit comments