-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathMakefile
More file actions
119 lines (102 loc) · 4.46 KB
/
Makefile
File metadata and controls
119 lines (102 loc) · 4.46 KB
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
# Export the environment to a yml file
export_env:
@conda env export > environment.yml;
# Build conda environment from the yml file
build_env:
@conda env create -f environment.yml;
# Install the package to pip
install_package:
@pip install -e .;
# Run the unit test suite (no network calls, runs in seconds)
test:
@python -m pytest tests/ -v;
# Lint source code, exploratory scripts, and tests
# Uses the openpois conda env's binaries regardless of whether it is activated
CONDA_PYTHON := $(shell conda run -n openpois which python 2>/dev/null || echo python)
CONDA_BIN := $(dir $(CONDA_PYTHON))
lint:
@$(CONDA_BIN)flake8 src/ scripts/ tests/
@$(CONDA_BIN)pylint src/openpois/
# Build the site for production
site_build:
@cd site && npm run build;
# Serve the site locally with hot reload
# Note: does not build Sphinx docs; use site_preview for a full build
site_dev:
@cd site && npm run dev;
# Generate site/public/taxonomy.html from the conflation data CSVs
# Requires the openpois conda env to be active (for pandas)
build_taxonomy:
@python scripts/build_taxonomy.py;
# Full build + local preview: Sphinx docs, Vite production build, then serve
# Mirrors the GitHub Actions workflow; serves at http://localhost:4173
# Requires the openpois conda env to be active (for sphinx-build)
# Uses Python's HTTP server instead of vite preview so /docs/ is served
# correctly (vite preview uses SPA fallback which swallows directory requests)
site_preview:
@python scripts/build_taxonomy.py
@sphinx-build -b html docs docs/_build/html -q
@cd site && npm run build
@cp -r docs/_build/html site/dist/docs
@python -m http.server 4173 --directory site/dist;
# -----------------------------------------------------------------------------
# Conflation pipeline (canonical entry point for all national runs)
#
# `make conflate` runs the three steps that produce the published
# conflated.parquet:
#
# 1. build_ghosts.py - reconstruct "ghost" POI dataset
# from OSM history (deletions,
# primary-tag removals, lifecycle
# prefixes, substantial renames).
# 2. conflate.py - OSM x Overture matching as before,
# written to conflated_baseline.parquet
# so the pre-CD result is archived.
# 3. apply_change_detection.py - penalize Overture POIs that shadow-
# match a ghost; emits the canonical
# conflated.parquet that downstream
# summarize / format_for_upload /
# prepare_pmtiles / publish steps
# consume.
#
# Each sub-step tees a per-run log under ~/data/openpois/logs/.
#
# Pass TEST=1 to scope to the Seattle bbox:
# make conflate # full CONUS
# make conflate TEST=1 # Seattle bbox dry run
#
# Sub-targets (build_ghosts / conflate_baseline / apply_cd) are exposed
# for partial re-runs when one stage is being iterated on.
TEST ?=
TEST_FLAG := $(if $(TEST),--test,)
LOG_DIR := $(HOME)/data/openpois/logs
LOG_TS := $(shell date +%Y%m%d_%H%M%S)
.PHONY: conflate build_ghosts conflate_baseline apply_cd
build_ghosts:
@mkdir -p $(LOG_DIR)
@$(CONDA_PYTHON) -u scripts/conflation/build_ghosts.py \
2>&1 | tee $(LOG_DIR)/build_ghosts_$(LOG_TS).log
conflate_baseline:
@mkdir -p $(LOG_DIR)
@$(CONDA_PYTHON) -u scripts/conflation/conflate.py \
--output-suffix=baseline $(TEST_FLAG) \
2>&1 | tee $(LOG_DIR)/conflate_baseline_$(LOG_TS).log
apply_cd:
@mkdir -p $(LOG_DIR)
@$(CONDA_PYTHON) -u scripts/conflation/apply_change_detection.py \
--baseline-suffix=baseline --output-suffix="" $(TEST_FLAG) \
2>&1 | tee $(LOG_DIR)/apply_cd_$(LOG_TS).log
conflate: build_ghosts conflate_baseline apply_cd
@echo
@echo "Conflation pipeline complete."
@echo " Canonical output: ~/data/openpois/conflation/<version>/conflated.parquet"
@echo " (no-CD archive: conflated_baseline.parquet)"
@echo " Logs under: $(LOG_DIR)/{build_ghosts,conflate_baseline,apply_cd}_$(LOG_TS).log"
# Convenience target to print all of the available targets in this file
# From https://stackoverflow.com/questions/4219255
.PHONY: list
list:
@LC_ALL=C $(MAKE) -pRrq -f $(lastword $(MAKEFILE_LIST)) : 2>/dev/null | \
awk -v RS= -F: '/^# File/,/^# Finished Make data base/ \
{if ($$1 !~ "^[#.]") {print $$1}}' | \
sort | egrep -v -e '^[^[:alnum:]]' -e '^$@$$'