Skip to content

working on local version - #2

Merged
bmaitner merged 1 commit into
mainfrom
local-implementation
Sep 22, 2026
Merged

bmaitner merged 1 commit into
mainfrom
local-implementation

Conversation

@bmaitner

Copy link
Copy Markdown
Contributor

No description provided.

Copilot AI lite review requested due to automatic review settings September 22, 2026 15:22

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Code review skipped — your organization has no extra usage available to pay for this review.

If your organization's extra usage balance is empty, an organization admin can add extra usage credits at claude.ai/admin-settings/usage. If its monthly spend limit was reached, an admin can raise it on the same page. If neither applies, contact Anthropic support.

Once extra usage is available, comment @claude review on this pull request, or push a new commit, to trigger a review.

@bmaitner
bmaitner merged commit 2ac2266 into main Sep 22, 2026
1 check passed
@bmaitner
bmaitner deleted the local-implementation branch September 22, 2026 15:23

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

Critical export, indexing, compatibility, and cache-build issues remain unresolved.

Get a fresh assessment by requesting another Copilot review.

Review effort: Lite
Findings: 6 High severity · 1 Medium severity

Open (7)
What changed in this PR

Adds an offline GVS workflow using cached GADM data, centroid calculations, raster indexing, and historical validation.

Changes:

  • Adds local cache, build, status, and removal utilities.
  • Implements offline coordinate validation and centroid lookups.
  • Adds tests and supporting spatial dependencies.
File Summary and findings
tests/​testthat/​test-local-gvs.R Adds tests for local validation and historical behavior.
R/​GVS_local.R Adds offline validation helpers. Critical (3 votes): exports are missing from NAMESPACE. Moderate (1 vote each): historical cache artifacts are not built; antipodal distances can produce invalid centroid results.
R/​local_build.R Builds GADM and centroid data. Critical (3 votes): does not build or verify the required index. Moderate (1 vote): historical data artifacts are missing from the build lifecycle.
R/​local_cache.R Adds cache management APIs. Critical (3 votes): R_user_dir() is incompatible with the declared R versions. Moderate (3 votes): sources = NULL does not select the documented default. Moderate (1 vote): index artifacts are not removed during cleanup.
R/​local_index.R Adds raster index construction. Critical (3 votes): raster extraction selects the ID column instead of the cell value. Critical (1 vote each): SQLite window SQL is not explicitly selected; terra streaming return values are discarded.
DESCRIPTION Adds supporting spatial and local-validation dependencies.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread R/GVS_local.R
#' @param tolerance_years Tolerance either side of a historical version's dates
#' when \code{date} is given.
#' @return A data.frame, one row per input row.
#' @export
Comment thread R/local_build.R
Comment on lines +89 to +90
if (needs_geometry) {
gvs_build_centroids(gpkg, gadm_layer, dir = dir, quiet = quiet)
Comment thread R/local_cache.R
gvs_cache_dir <- function(create = FALSE) {
dir <- getOption(
"GVS.cache_dir",
getOption("GNRS.cache_dir", tools::R_user_dir("GNRS", which = "cache"))
Comment thread R/local_index.R
blank <- function(col) sprintf("(%s IS NULL OR %s IN ('', 'NA'))", col, col)
key_sql <- sprintf("CASE WHEN NOT %s THEN GID_2 WHEN NOT %s THEN GID_1 ELSE GID_0 END",
blank("GID_2"), blank("GID_1"))
unit_sql <- sprintf("DENSE_RANK() OVER (ORDER BY %s)", key_sql)
Comment thread R/local_index.R
Comment on lines +131 to +133
b <- terra::writeStart(tmpl, edges_tif, overwrite = TRUE,
wopt = list(datatype = "INT1U", names = "edge",
gdal = c("COMPRESS=DEFLATE", "TILED=YES", "BIGTIFF=YES")))
Comment thread R/local_index.R
Comment on lines +178 to +180
unit[ok] <- as.integer(terra::extract(ru, xy)[, 1])
unit[ok & unit %in% 0L] <- NA_integer_
edge[ok] <- as.integer(terra::extract(re, xy)[, 1]) %in% 1L
Comment thread R/local_cache.R
Comment on lines +242 to +243
GVS_local_remove <- function(dir = gvs_cache_dir(), sources = "centroids",
shared = FALSE, ask = interactive()) {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants