-
Notifications
You must be signed in to change notification settings - Fork 21
/
basic_pipeline.py
61 lines (46 loc) · 1.17 KB
/
basic_pipeline.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
import luigi
import requests
import pandas as pd
import geocoder
class DownloadTask(luigi.ExternalTask):
"""
Downloads Permit Data from the Portal
"""
def run(self):
url = "https://data.cityofchicago.org/api/views/ydr8-5enu/rows.csv?accessType=DOWNLOAD"
response = requests.get(url)
with self.output().open('w') as out_file:
out_file.write(response.text)
def output(self):
return luigi.LocalTarget("data/permits.csv")
class cleanCSV(luigi.Task):
"""This is our cleaning step"""
def requires(self):
return DownloadTask
## TODO ##
class ReverseGeocode(luigi.Task):
"Pandas integration because we real cool"
def requires(self):
return DownloadTask()
def run(self):
df = pd.read_csv(self.input().open('r'))
def reverse
def output(self):
pass
## TODO ##
class MakeWards(luigi.Task):
pass
## TODO ##
class MakeMaps(luigi.Task):
pass
## TODO ##
class MakePredictions(luigi.Task):
pass
## TODO ##
class UploadPredictions(luigi.Task):
pass
## TODO ##
class LoadCensus(luigi.Task):
pass
if __name__ == '__main__':
luigi.run()