Add % native plants to the biodiversity score box
avephill
f016b3b
Load plant_provenance.csv (iNaturalist establishment means per GBIF plant
species, from the HuggingFace dataset) in setup_unified.R and count
native/endemic vs introduced plant species per isochrone in
summarise_iso_metric_support(). The Plants tile shows "% native" among
species with a known status; species without a status are excluded from
the denominator. If the file is unavailable the counts stay NA and the
line is hidden.
Restore optimized setup_unified.R as the one the app sources
avephill
5905e95
code/setup_unified.R (the file app.R actually sources) had reverted to the
April version, undoing the June startup optimizations. The optimized copy
lived on unused in Rscripts/setup_unified.R. Move it into code/ and drop the
duplicate so there is one canonical setup file.
- Read precomputed cbg_greenspace_coverage.csv instead of running the
CBG x greenspace st_union + st_intersection at every startup (falls back
to inline computation if the CSV is missing). Max difference vs inline
is <0.09 percentage points of greenspace cover per CBG.
- Keep RColorBrewer / data.table unattached (still only used in if (FALSE)
blocks).
- Keep loading biodiversity hotspots/coldspots: the new app uses them for
map layers and DistToHotspot/Coldspot metrics.
- Point build_cbg_greenspace_coverage.R and the iso_metrics_AUDITED.R
fallback source() at code/ (the latter referenced a nonexistent
Rscripts/iso_metric_definitions.R).
Startup (source app.R): ~10.2 s -> ~8.4 s.