Skip to content

Get SCANFI species layers without Google authentication#191

Open
eliotmcintire wants to merge 2 commits into
developmentfrom
feat-scanfi-no-gauth
Open

Get SCANFI species layers without Google authentication#191
eliotmcintire wants to merge 2 commits into
developmentfrom
feat-scanfi-no-gauth

Conversation

@eliotmcintire

Copy link
Copy Markdown
Contributor

What

loadSCANFISpeciesLayers() now lists the SCANFI species-layer folder via reproducible::listGoogleDriveFolder() instead of calling googledrive::drive_ls() directly.

When a directory-remap manifest is set:

options(reproducible.urlRemap = "arbutus_manifest_SCANFI_v2_clean.csv")
# manifest built with buckethost::makeMirrorManifest(directories = TRUE)

the SCANFI files are enumerated from a public mirror (Arbutus object store) with no Google authentication — no Google account, no drive_auth(). The immediate use case is training/workshops, where participants can pull SCANFI layers anonymously.

Why this is safe / backwards compatible

  • No manifest setlistGoogleDriveFolder() falls back to googledrive::drive_ls() and authenticates exactly as before. Identical behaviour.
  • The per-file downloads already went through prepInputs(), so only the folder listing needed changing.
  • The listing's url column is used directly (mirror URL when remapped, else the Drive file URL) instead of building https://drive.google.com/file/d/<id> — because the mirror listing carries no Drive id.

The change

Two lines in R/maps.R (loadSCANFISpeciesLayers):

- driveFiles <- as.data.table(googledrive::with_drive_quiet(googledrive::drive_ls(url)))
+ driveFiles <- reproducible::listGoogleDriveFolder(url)
...
- fileURLs <- paste0("https://drive.google.com/file/d/", driveFiles$id)
+ fileURLs <- driveFiles$url

Dependency note

⚠️ Requires the companion reproducible change that adds listGoogleDriveFolder() and directory-remap support (the type="dir" manifest column + byDir). That must be merged to reproducible@development before LandR CI here will pass. Once it lands, the existing Remotes: PredictiveEcology/reproducible@development picks it up; a reproducible (>= version floor bump in DESCRIPTION can follow when reproducible releases.

Scope

Only the loadSCANFISpeciesLayers site (maps.R:1520). The other drive_ls sites are intentionally left as-is (the kNN twin would also need shared_drive passthrough; the prepSpeciesLayers sites navigate Drive subfolder structure, not file listings).

🤖 Generated with Claude Code

Use reproducible::listGoogleDriveFolder() in place of a direct
googledrive::drive_ls() call. When a directory-remap manifest is set via
options(reproducible.urlRemap = ...) (e.g. from
buckethost::makeMirrorManifest(directories = TRUE)), the SCANFI species
layers are enumerated from a public mirror with no Google authentication --
the immediate use case is training/workshops. With no manifest set it falls
back to drive_ls() and authenticates exactly as before. The folder listing's
`url` column (mirror URL when remapped, else the Drive file URL) is used
directly, since the mirror listing carries no Drive id.

Requires the companion reproducible change adding listGoogleDriveFolder()
and directory remaps.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The folder-listing swap in loadSCANFISpeciesLayers depends on
reproducible::listGoogleDriveFolder() and directory-remap support, added in
reproducible 3.1.1.9058 (PR PredictiveEcology/reproducible#520).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@eliotmcintire

Copy link
Copy Markdown
Contributor Author

Dependency is now concrete: requires reproducible (>= 3.1.1.9058), added in PredictiveEcology/reproducible#520 (listGoogleDriveFolder() + directory remaps). Floor pinned in DESCRIPTION. #520 should merge to reproducible@development first for CI here to pass.

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.

1 participant