bcgov / bcgov/bcmaps

Use modification date in record to know when to update cache layers.

Open
#102 0 comments 1 reaction 0 assignees View on GitHub
help wanted
Dominant language
R
Stars
74
Forks
17
PR merge metrics
No merged PRs in 30d

Description

All the pieces are here just to stitch them together.

``` r
library(bcdata)
#>
#> Attaching package: 'bcdata'
#> The following object is masked from 'package:stats':
#>
#> filter
library(bcmaps)
#> Loading required package: sf
#> Linking to GEOS 3.9.1, GDAL 3.2.1, PROJ 7.2.1; sf_use_s2() is TRUE

lyr <- bcmaps:::available_layers()
nd <- lyr[lyr$layer_name == "nr_districts", ]

rec <- bcdc_get_record(nd$record)
#> Authorizing with your stored API key
rec$record_last_modified
#> [1] "2022-01-07"

attributes(nr_districts())$time_downloaded
#> nr_districts was updated on 2021-01-22
#> [1] "2021-01-22 06:32:22 PST"
```

Contributor guide

Open the contributing guide

Research direction

Start by tracing how nr_districts() records attributes$time_downloaded, then compare that value with bcdc_get_record(nd$record)$record_last_modified for the layer returned by available_layers(). Confirm the intended cache-refresh behavior and add coverage showing that a modified record causes the cached layer to update.

Written by the indexing model from the issue text.

Assessment

Tech stack
r
Domain
data
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.