Skip to content
Merged

Staging #1276

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
bb6885b
deps: bump cycjimmy/semantic-release-action in the all-actions group
dependabot[bot] Jul 7, 2025
765b93e
fix: automatically switch from filter to detail view when property se…
Jul 7, 2025
4d05471
change wording of docstrings and update metadata collection decorator
cfreedman Jul 8, 2025
6e51784
attach metadata decorators to respective data services
cfreedman Jul 8, 2025
7ecbeb5
feat(FilterView): added input validators, including row count checks
gabecano4308 Jul 8, 2025
03aa351
feat(FilterView): removed print statement
gabecano4308 Jul 8, 2025
382da65
feat(InputVal): changed opa_id vals to string
gabecano4308 Jul 8, 2025
2139bf7
feat(InputVal): added check_stats param to custom_validation fcn
gabecano4308 Jul 8, 2025
fe7db9a
feat(InputVal): removed opa_id for rco
gabecano4308 Jul 8, 2025
0e0f424
feat(InputVal): removed opa_id
gabecano4308 Jul 8, 2025
95d7e4a
get metadata to save correctly in csv in temp directory
cfreedman Jul 8, 2025
f55309d
get tests running and checking formatting
cfreedman Jul 8, 2025
6b1f496
Merge pull request #1270 from the-sniper/the-sniper/1130-fix-filter-v…
nlebovits Jul 9, 2025
50f337d
chore: update disclaimer to reflect shutdown
nlebovits Jul 9, 2025
47af5a6
Merge pull request #1272 from cfreedman/metadata-update
nlebovits Jul 9, 2025
2dd58bc
Merge pull request #1268 from CodeForPhilly/dependabot/github_actions…
nlebovits Jul 9, 2025
7ac25ed
Merge pull request #1273 from CodeForPhilly/lebovits/update-disclaimer
nlebovits Jul 9, 2025
7025b97
chore: add FAQ, tweak disclaimer
nlebovits Jul 9, 2025
ae7acb2
chore: update faq, disclaimer
nlebovits Jul 9, 2025
af94616
Merge pull request #1271 from gabecano4308/input-validation
nlebovits Jul 9, 2025
9852c16
chore: add pmtiles and parquet to backup data with LFS tracking
nlebovits Jul 9, 2025
0155395
fix: refactor pmtiles generation to allow local writing
nlebovits Jul 9, 2025
f0543d9
style: eslint
nlebovits Jul 9, 2025
390805e
Merge pull request #1274 from CodeForPhilly/lebovits/finalize-site-about
nlebovits Jul 9, 2025
34939eb
Merge pull request #1275 from CodeForPhilly/lebovits/add-final-data
nlebovits Jul 9, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
run: npm ci

- name: Create Tag
uses: cycjimmy/[email protected].1
uses: cycjimmy/[email protected].2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Expand Down
2 changes: 2 additions & 0 deletions data/.gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
backup_data/*.parquet filter=lfs diff=lfs merge=lfs -text
backup_data/*.pmtiles filter=lfs diff=lfs merge=lfs -text
1 change: 1 addition & 0 deletions data/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ RUN apt-get update && apt-get install -y \
&& rm -rf /var/lib/apt/lists/*

COPY --from=tippecanoe /usr/local/bin/tippecanoe /usr/local/bin/tippecanoe
COPY --from=tippecanoe /usr/local/bin/tile-join /usr/local/bin/tile-join
COPY --from=dependencies /app /app

ENV GDAL_VERSION=3.6.2 \
Expand Down
3 changes: 3 additions & 0 deletions data/backup_data/all_properties_2025_07_09.parquet
Git LFS file not shown
3 changes: 3 additions & 0 deletions data/backup_data/vacant_properties_2025_07_09.pmtiles
Git LFS file not shown
107 changes: 4 additions & 103 deletions data/src/classes/featurelayer.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import logging as log
import os
import subprocess
import traceback
from concurrent.futures import ThreadPoolExecutor, as_completed

Expand All @@ -11,15 +10,14 @@
from shapely import wkb
from tqdm import tqdm

from src.classes.bucket_manager import GCSBucketManager
from src.classes.file_manager import FileManager, FileType, LoadType
from src.classes.loaders import generate_pmtiles
from src.config.config import (
FORCE_RELOAD,
USE_CRS,
log_level,
min_tiles_file_size_in_bytes,
write_production_tiles_file,
)
from src.classes.bucket_manager import GCSBucketManager
from src.classes.file_manager import FileManager, FileType, LoadType
from src.loaders import load_carto_data, load_esri_data

log.basicConfig(level=log_level)
Expand Down Expand Up @@ -281,101 +279,4 @@ def build_and_publish(self, tiles_file_id_prefix: str) -> None:
Raises:
ValueError: Raised if the generated PMTiles file is smaller than the minimum allowed size, indicating a potential corruption or incomplete file.
"""
zoom_threshold: int = 13

# Export the GeoDataFrame to a temporary GeoJSON file
temp_geojson_points: str = (
f"storage/temp/temp_{tiles_file_id_prefix}_points.geojson"
)
temp_geojson_polygons: str = (
f"storage/temp/temp_{tiles_file_id_prefix}_polygons.geojson"
)
temp_pmtiles_points: str = (
f"storage/temp/temp_{tiles_file_id_prefix}_points.pmtiles"
)
temp_pmtiles_polygons: str = (
f"storage/temp/temp_{tiles_file_id_prefix}_polygons.pmtiles"
)
temp_merged_pmtiles: str = (
f"storage/temp/temp_{tiles_file_id_prefix}_merged.pmtiles"
)

# Reproject
gdf_wm = self.gdf.to_crs(epsg=4326)
gdf_wm.to_file(temp_geojson_polygons, driver="GeoJSON")

# Create points dataset
self.centroid_gdf = self.gdf.copy()
self.centroid_gdf["geometry"] = self.centroid_gdf["geometry"].centroid
self.centroid_gdf = self.centroid_gdf.to_crs(epsg=4326)
self.centroid_gdf.to_file(temp_geojson_points, driver="GeoJSON")

# Command for generating PMTiles for points up to zoom level zoom_threshold
points_command: list[str] = [
"tippecanoe",
f"--output={temp_pmtiles_points}",
f"--maximum-zoom={zoom_threshold}",
"--minimum-zoom=10",
"-zg",
"-aC",
"-r0",
temp_geojson_points,
"-l",
"vacant_properties_tiles_points",
"--force",
]

# Command for generating PMTiles for polygons from zoom level zoom_threshold
polygons_command: list[str] = [
"tippecanoe",
f"--output={temp_pmtiles_polygons}",
f"--minimum-zoom={zoom_threshold}",
"--maximum-zoom=16",
"-zg",
"--no-tile-size-limit",
temp_geojson_polygons,
"-l",
"vacant_properties_tiles_polygons",
"--force",
]

# Command for merging the two PMTiles files into a single output file
merge_command: list[str] = [
"tile-join",
f"--output={temp_merged_pmtiles}",
"--no-tile-size-limit",
temp_pmtiles_polygons,
temp_pmtiles_points,
"--force",
]

# Run the commands
for command in [points_command, polygons_command, merge_command]:
subprocess.run(command)

write_files: list[str] = [f"{tiles_file_id_prefix}_staging.pmtiles"]

if write_production_tiles_file:
write_files.append(f"{tiles_file_id_prefix}.pmtiles")

# Check whether the temp saved tiles files is big enough.
file_size: int = os.stat(temp_merged_pmtiles).st_size
if file_size < min_tiles_file_size_in_bytes:
raise ValueError(
f"{temp_merged_pmtiles} is {file_size} bytes in size but should be at least {min_tiles_file_size_in_bytes}. Therefore, we are not uploading any files to the GCP bucket. The file may be corrupt or incomplete."
)

bucket = google_cloud_bucket(require_write_access=True)
if bucket is None:
print("Skipping PMTiles upload due to read-only bucket access.")
return

# Upload PMTiles to Google Cloud Storage
bucket = google_cloud_bucket()
for file in write_files:
blob = bucket.blob(file)
try:
blob.upload_from_filename(temp_merged_pmtiles)
print(f"PMTiles upload successful for {file}!")
except Exception as e:
print(f"PMTiles upload failed for {file}: {e}")
generate_pmtiles(self.gdf, tiles_file_id_prefix)
Loading
Loading