@@ -4,85 +4,215 @@ API Reference
44conflation
55----------
66
7+ openpois.conflation.match
8+ ~~~~~~~~~~~~~~~~~~~~~~~~~
9+
10+ Spatial candidate matching and composite scoring for POI conflation. Provides
11+ a BallTree-based radius search to find nearby OSM–Overture candidate pairs
12+ within category-specific thresholds, a multi-component scorer (distance, name
13+ similarity, taxonomy agreement, shared identifiers), and a greedy one-to-one
14+ assignment step that filters below a minimum composite score.
15+
716.. automodule :: openpois.conflation.match
817 :members:
918 :undoc-members:
1019 :show-inheritance:
1120
21+ openpois.conflation.merge
22+ ~~~~~~~~~~~~~~~~~~~~~~~~~
23+
24+ Merge matched and unmatched POIs into a unified conflated GeoDataFrame.
25+ Produces a superset containing matched OSM–Overture pairs with blended
26+ confidence scores, unmatched OSM POIs at their original confidence, and
27+ unmatched Overture POIs at downweighted confidence. Uses a disk-backed
28+ split-then-concat pattern to avoid peak memory issues at CONUS scale.
29+
1230.. automodule :: openpois.conflation.merge
1331 :members:
1432 :undoc-members:
1533 :show-inheritance:
1634
35+ openpois.conflation.taxonomy
36+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
37+
38+ Taxonomy crosswalk between OSM tags and the Overture Maps category hierarchy.
39+ Loads four CSV reference files (OSM crosswalk, Overture crosswalk, match radii,
40+ and top-level key-to-L0 mappings) and provides functions to assign each POI a
41+ ``shared_label `` string, a per-category spatial match radius, and an L0 bitmask
42+ used for type-agreement scoring.
43+
1744.. automodule :: openpois.conflation.taxonomy
1845 :members:
1946 :undoc-members:
2047 :show-inheritance:
2148
49+ ----
50+
2251io
2352--
2453
25- .. automodule :: openpois.io.osm_snapshot
54+ openpois.io.osm_history
55+ ~~~~~~~~~~~~~~~~~~~~~~~
56+
57+ Download OpenStreetMap element change histories via the Overpass and OSM APIs.
58+ Builds Overpass queries across a configured date range to collect element IDs,
59+ then fetches the full version history of each element, producing per-version
60+ and per-change tables suitable for the change-rate model.
61+
62+ .. automodule :: openpois.io.osm_history
2663 :members:
2764 :undoc-members:
2865 :show-inheritance:
2966
30- .. automodule :: openpois.io.osm_history
67+ openpois.io.osm_snapshot
68+ ~~~~~~~~~~~~~~~~~~~~~~~~
69+
70+ Download a current US-wide OSM POI snapshot from a Geofabrik PBF extract.
71+ Streams the PBF (~11 GB), runs ``osmium tags-filter `` to reduce it to
72+ matching tag keys, then parses nodes and way centroids with pyosmium into
73+ a GeoParquet file. The osmium binary is resolved from the conda environment
74+ rather than the system PATH.
75+
76+ .. automodule :: openpois.io.osm_snapshot
3177 :members:
3278 :undoc-members:
3379 :show-inheritance:
3480
81+ openpois.io.overture
82+ ~~~~~~~~~~~~~~~~~~~~
83+
84+ Download a current US-wide Overture Maps Places snapshot. Uses DuckDB's
85+ ``httpfs `` and ``spatial `` extensions to query Overture GeoParquet files
86+ directly from public S3, filtering by bounding box and L0 taxonomy category.
87+ No authentication is required. Auto-detects the latest Overture release date
88+ from S3 if a specific date is not pinned.
89+
3590.. automodule :: openpois.io.overture
3691 :members:
3792 :undoc-members:
3893 :show-inheritance:
3994
95+ openpois.io.foursquare
96+ ~~~~~~~~~~~~~~~~~~~~~~
97+
98+ Download a current US-wide Foursquare OS Places snapshot via the Foursquare
99+ Places Portal Apache Iceberg REST catalog. Authenticates with a portal token,
100+ loads US open venues filtered by L1 category, and resolves category names from
101+ the categories table. Requires the ``FSQ_PORTAL_TOKEN `` environment variable.
102+
40103.. automodule :: openpois.io.foursquare
41104 :members:
42105 :undoc-members:
43106 :show-inheritance:
44107
45- .. automodule :: openpois.io.s3
108+ openpois.io.geohash_partition
109+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
110+
111+ Utilities for spatially partitioning GeoDataFrames by geohash for efficient
112+ web-map viewport queries. Computes geohash columns from geometry centroids,
113+ writes Hive-style partitioned Parquet datasets (``geohash_prefix=XX/ ``), and
114+ sorts rows within each partition by a finer geohash for spatial locality.
115+
116+ .. automodule :: openpois.io.geohash_partition
46117 :members:
47118 :undoc-members:
48119 :show-inheritance:
49120
50- .. automodule :: openpois.io.geohash_partition
121+ openpois.io.s3
122+ ~~~~~~~~~~~~~~
123+
124+ Upload a locally partitioned dataset to a public S3 bucket. Walks the Hive
125+ partition directory, uploads each Parquet file under a versioned S3 prefix
126+ with public-read ACL, and reports the public base URL on completion. Requires
127+ AWS credentials via environment variables or ``~/.aws/credentials ``.
128+
129+ .. automodule :: openpois.io.s3
51130 :members:
52131 :undoc-members:
53132 :show-inheritance:
54133
134+ ----
135+
55136models
56137------
57138
139+ openpois.models.event_rate
140+ ~~~~~~~~~~~~~~~~~~~~~~~~~~
141+
142+ Representation of a Poisson event rate (λ) used by the change-rate model.
143+ Wraps a constant or time-varying λ tensor and computes the probability that
144+ at least one change event occurs within a given time interval via numerical
145+ or closed-form integration.
146+
58147.. automodule :: openpois.models.event_rate
59148 :members:
60149 :undoc-members:
61150 :show-inheritance:
62151
152+ openpois.models.model_fitter
153+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
154+
155+ L-BFGS optimizer wrapper for POI change-rate models. Fits model parameters
156+ using PyTorch and the ``torchmin `` optimizer, generates posterior parameter
157+ draws for uncertainty quantification, and produces prediction tables of
158+ change probability versus time.
159+
63160.. automodule :: openpois.models.model_fitter
64161 :members:
65162 :undoc-members:
66163 :show-inheritance:
67164
165+ openpois.models.setup
166+ ~~~~~~~~~~~~~~~~~~~~~
167+
168+ Environment setup utilities for PyTorch model runs. Selects GPU or CPU
169+ device, configures ``torch_continuum `` optimisation level, and prepares
170+ filtered and grouped observation data for model fitting.
171+
68172.. automodule :: openpois.models.setup
69173 :members:
70174 :undoc-members:
71175 :show-inheritance:
72176
177+ openpois.models.apply
178+ ~~~~~~~~~~~~~~~~~~~~~
179+
180+ Apply saved change-rate model predictions to a POI snapshot. Loads
181+ ``predictions.csv `` from a versioned model output directory and builds
182+ fast numpy lookup arrays (indexed by group and time step) for both constant
183+ and random-effects model variants.
184+
73185.. automodule :: openpois.models.apply
74186 :members:
75187 :undoc-members:
76188 :show-inheritance:
77189
190+ ----
191+
78192osm
79193---
80194
195+ openpois.osm.format_observations
196+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
197+
198+ Convert raw OSM version histories into modelling-ready observation records.
199+ Joins version and change tables to produce one row per element version,
200+ with timestamps for the previous and current tag values and a flag indicating
201+ whether the configured tag changed at this version.
202+
81203.. automodule :: openpois.osm.format_observations
82204 :members:
83205 :undoc-members:
84206 :show-inheritance:
85207
208+ openpois.osm.change_plots
209+ ~~~~~~~~~~~~~~~~~~~~~~~~~
210+
211+ Kaplan-Meier-style tag stability plots using plotnine. Computes the
212+ proportion of tag assignments that remain unchanged over time from
213+ observation records, and renders single-panel and faceted multi-panel
214+ figures saved as PNG files.
215+
86216.. automodule :: openpois.osm.change_plots
87217 :members:
88218 :undoc-members:
0 commit comments