Skip to content

2025 Permit Ratification

Geospatial + fiscal-compliance analysis in support of a G500 fuel-station permit ratification. Two threads of work live side by side in this project:

  • SAT CFDI v4.0 modeling — src/2025_permit_ratification/models/cfdv40.py and cat_cfdi.py model Mexican SAT invoicing (Comprobante Fiscal Digital por Internet) catalogs/schemas using xsdata-pydantic, generating typed Pydantic classes from the CFDI v4.0 XSD.
  • Geospatial influence-zone analysis — the notebooks/ (map.ipynb, mexico_contour.ipynb, tesselation.ipynb) parse a gas-stations XML dataset (via lxml), build Mexico’s national contour, and compute Voronoi tessellation areas of influence around G500 stations to estimate market/geographic coverage.
Notebook Purpose
map.ipynb Loads and visualizes Mexico GeoJSON boundaries
mexico_contour.ipynb Builds the national contour polygon (geopandas + dask_geopandas)
tesselation.ipynb Parses gas_stations.xml and computes Voronoi tessellation for influence zones

DVC-tracked under data/{raw,preprocessed,out}. Notable out/ artifacts (.dvc pointers): g500_gas_stations.parquet, g500_areas_coverage.geojson, g500_stations_with_areas.geojson, gas_stations_areas_of_influence.parquet, gas_stations_voronoi_tessellation.parquet, mexico_contour.parquet, plus rendered PNG maps. Raw assets (assets.dvc) total ~8GB / 55 files.

geopandas, dask-geopandas, dask-cudf-cu13 / cuda-python (GPU-accelerated geo processing), datashader, holoviews/geoviews/hvplot for large-scale rendering, shapely, lxml, xsdata-pydantic[cli,lxml] for CFDI modeling, plotly. Excluded from the root uv workspace (see pyproject.toml [tool.uv.workspace] exclude); has its own requirements.txt and uv.lock.

Notebook-driven exploratory analysis with a fair amount of production-shaped output (parquet/geojson artifacts), but no dvc.yaml pipeline — stages are run manually from the notebooks rather than orchestrated.