-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathMakefile
252 lines (189 loc) · 8.21 KB
/
Makefile
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
NO_DATASET=true
RENDER_COMMAND=python3 ./bin/render.py
second-pass:: specification
include makerules/makerules.mk
include makerules/specification.mk
include makerules/render.mk
SPECIFICATION_CSV=\
specification/attribution.csv\
specification/award.csv\
specification/licence.csv\
specification/collection.csv\
specification/datapackage.csv\
specification/datapackage-dataset.csv\
specification/dataset.csv\
specification/dataset-field.csv\
specification/dataset-schema.csv\
specification/schema.csv\
specification/schema-field.csv\
specification/field.csv\
specification/fund.csv\
specification/datatype.csv\
specification/typology.csv\
specification/issue-type.csv\
specification/include-exclude.csv\
specification/severity.csv\
specification/prefix.csv\
specification/cohort.csv\
specification/intervention.csv\
specification/project.csv\
specification/project-organisation.csv\
specification/project-status.csv\
specification/specification.csv\
specification/specification-status.csv\
specification/organisation-dataset.csv\
specification/provision.csv\
specification/provision-reason.csv\
specification/provision-rule.csv\
specification/pipeline.csv\
specification/realm.csv\
specification/role.csv\
specification/theme.csv
# these are scraped from other sites ..
PROJECT_MD_GENERATED=\
content/project/local-land-charges.md\
content/project/localgov-drupal.md
specification:: $(SPECIFICATION_CSV)
# made from dataset content ..
DATASET_MD=$(sort $(wildcard content/dataset/*.md))
specification/dataset.csv: $(DATASET_MD) bin/load-markdown.py
@mkdir -p specification/
python3 bin/load-markdown.py $@ $(DATASET_MD)
ATTRIBUTION_MD=$(sort $(wildcard content/attribution/*.md))
specification/attribution.csv: $(ATTRIBUTION_MD) bin/load-markdown.py
@mkdir -p specification/
python3 bin/load-markdown.py $@ $(ATTRIBUTION_MD)
LICENCE_MD=$(sort $(wildcard content/licence/*.md))
specification/licence.csv: $(LICENCE_MD) bin/load-markdown.py
@mkdir -p specification/
python3 bin/load-markdown.py $@ $(LICENCE_MD)
DATATYPE_MD=$(sort $(wildcard content/datatype/*.md))
specification/datatype.csv: $(DATATYPE_MD) bin/load-markdown.py
python3 bin/load-markdown.py $@ $(DATATYPE_MD)
FIELD_MD=$(sort $(wildcard content/field/*.md))
specification/field.csv: $(FIELD_MD) bin/load-markdown.py
python3 bin/load-markdown.py $@ $(FIELD_MD)
PROJECT_MD=$(sort $(wildcard content/project/*.md)) $(PROJECT_MD_GENERATED)
specification/project.csv: $(PROJECT_MD) bin/load-markdown.py
python3 bin/load-markdown.py $@ $(PROJECT_MD)
PROJECT_STATUS_MD=$(sort $(wildcard content/project-status/*.md))
specification/project-status.csv: $(PROJECT_STATUS_MD) bin/load-markdown.py
python3 bin/load-markdown.py $@ $(PROJECT_STATUS_MD)
TYPOLOGY_MD=$(sort $(wildcard content/typology/*.md))
specification/typology.csv: $(TYPOLOGY_MD) bin/load-markdown.py
python3 bin/load-markdown.py $@ $(TYPOLOGY_MD)
THEME_MD=$(sort $(wildcard content/theme/*.md))
specification/theme.csv: $(THEME_MD) bin/load-markdown.py
python3 bin/load-markdown.py $@ $(THEME_MD)
DATAPACKAGE_MD=$(sort $(wildcard content/datapackage/*.md))
specification/datapackage.csv: $(DATAPACKAGE_MD) bin/load-markdown.py
python3 bin/load-markdown.py $@ $(DATAPACKAGE_MD)
SPECIFICATION_MD=$(sort $(wildcard content/specification/*.md))
specification/specification.csv: $(SPECIFICATION_MD) bin/load-markdown.py
@mkdir -p specification/
python3 bin/load-markdown.py $@ $(SPECIFICATION_MD)
# made from the dataset.csv ..
DATASET_CSV=specification/dataset.csv
specification/collection.csv: $(DATASET_CSV) bin/collection.py
python3 bin/collection.py $@
specification/dataset-field.csv: $(DATASET_MD) $(DATASET_CSV) bin/dataset-field.py
python3 bin/dataset-field.py $@
specification/dataset-schema.csv: $(DATASET_CSV) bin/dataset-schema.py
python3 bin/dataset-schema.py $@
specification/schema.csv: $(DATASET_CSV) bin/schema.py
python3 bin/schema.py $@
specification/schema-field.csv: $(DATASET_CSV) bin/schema-field.py
python3 bin/schema-field.py $@
specification/pipeline.csv: $(DATASET_CSV) bin/pipeline.py
python3 bin/pipeline.py $@
specification/prefix.csv: content/prefix.csv
cp content/prefix.csv $@
specification/issue-type.csv: content/issue-type.csv
cp content/issue-type.csv $@
specification/severity.csv: content/severity.csv
cp content/severity.csv $@
specification/specification-status.csv: content/specification-status.csv
cp content/specification-status.csv $@
specification/provision-reason.csv: content/provision-reason.csv
cp content/provision-reason.csv $@
specification/provision-rule.csv: content/provision-rule.csv
cp content/provision-rule.csv $@
specification/include-exclude.csv: content/include-exclude.csv
cp content/include-exclude.csv $@
specification/role-organisation-rule.csv: content/role-organisation-rule.csv
cp content/role-organisation-rule.csv $@
specification/intervention.csv: content/intervention.csv
cp content/intervention.csv $@
specification/fund.csv: content/fund.csv
cp content/fund.csv $@
specification/award.csv: content/award.csv
cp content/award.csv $@
specification/cohort.csv: content/cohort.csv
cp content/cohort.csv $@
specification/realm.csv: content/realm.csv
cp content/realm.csv $@
specification/role.csv: content/role.csv
cp content/role.csv $@
# build organisations in a project
PROJECT_CSV=specification/project.csv
COHORT_CSV=specification/cohort.csv
specification/project-organisation.csv: $(PROJECT_MD) $(PROJECT_CSV) $(COHORT_CSV) bin/project-organisation.py
python3 bin/project-organisation.py $@
specification/role-organisation.csv: bin/role-organisation.py specification/role-organisation-rule.csv $(CACHE_DIR)organisation.csv
python3 bin/role-organisation.py $@
specification/provision.csv: bin/provision.py specification/provision-rule.csv specification/project.csv specification/role-organisation.csv specification/project-organisation.csv
python3 bin/provision.py $@
# LLC project from GOV.UK list
content/project/local-land-charges.md: var/llc.csv bin/llc-project.py
python3 bin/llc-project.py var/llc.csv > $@
var/llc.csv: var/cache/llc.html var/cache/organisation.csv bin/llc-parse.py
python3 bin/llc-parse.py var/cache/llc.html $@
var/cache/llc.html:
@mkdir -p var/cache/
curl -L 'https://www.gov.uk/government/publications/hm-land-registry-local-land-charges-programme/local-land-charges-programme' > $@
# localgov-drupal project from website list
content/project/localgov-drupal.md: var/lgd.csv bin/lgd-project.py
@mkdir -p var/cache/
python3 bin/lgd-project.py var/lgd.csv > $@
var/lgd.csv: var/cache/lgd.html var/cache/organisation.csv bin/lgd-parse.py
python3 bin/lgd-parse.py var/cache/lgd.html $@
var/cache/lgd.html:
@mkdir -p var/cache/
curl -L 'https://localgovdrupal.org/community/our-councils' > $@
# deprecated
specification/organisation-dataset.csv: specification/provision.csv
cp specification/provision.csv $@
DATAPACKAGE_CSV=specification/datapackage.csv
specification/datapackage-dataset.csv: $(DATAPACKAGE_CSV) bin/datapackage-dataset.py
python3 bin/datapackage-dataset.py $@
commit-specification::
git add specification
git add data
git diff --quiet && git diff --staged --quiet || (git commit -m "Rebuilt specification $(shell date +%F)"; git push origin $(BRANCH))
clean clobber::
rm -f specification/*.csv
rm -f $(PROJECT_MD_GENERATED)
# generate mermaid diagrams
MERMAID_MD=$(subst content/specification/,docs/mermaid/,$(SPECIFICATION_MD))
render:: $(MERMAID_MD)
docs/mermaid/%.md: content/specification/%.md bin/specification-mermaid.py
@mkdir -p docs/mermaid/
python3 bin/specification-mermaid.py $< > $@
clobber::
rm -rf docs/mermaid/
init:: $(CACHE_DIR)organisation.csv
# generate SVG diagrams
SPECIFICATION_SVG=$(subst .md,/diagram.svg,$(subst content/,docs/,$(SPECIFICATION_MD)))
render:: $(SPECIFICATION_SVG)
docs/specification/%/diagram.svg: content/specification/%.md bin/specification-svg.py
@mkdir -p $(dir $@)
python3 bin/specification-svg.py $< > $@
render:: docs/dataset/diagram.svg docs/model.svg
docs/dataset/diagram.svg: specification/dataset-field.csv bin/datasets-svg.py
python3 bin/datasets-svg.py > $@
docs/model.svg: specification/dataset-field.csv bin/model-svg.py
python3 bin/model-svg.py > $@
fields.json:
python3 bin/dump-fields.py
extract-entity-ranges:
python3 bin/extract-entity-ranges.py