Skip to content

Support GeoLocator-DP v1.1 - #39

Merged
Rafnuss merged 11 commits into
devfrom
gldp-v1.1
Sep 18, 2026
Merged

Rafnuss merged 11 commits into
devfrom
gldp-v1.1

Conversation

@Rafnuss

@Rafnuss Rafnuss commented Sep 17, 2026 •

Copy link
Copy Markdown
Collaborator

Supports GeoLocator-DP v1.1 and makes it the default for create_gldp().

v1.1 moves the table schema from resource.$schema to resource.schema and requires $schema and type. Validating real GeoLocatoR output against the published profile:

v1.0 profile v1.1 profile
frictionless 1.3.0 8/8 resources fail 0 errors
frictionless 1.3.0.9000 8/8 resources fail 0 errors

First time the output conforms to its own profile.

Changes

  • inst/schemas/v1.1/ — the profile and 8 table schemas, synced from the tag.
  • "v1.1" added to .gldp_supported_versions, making it the default.
  • upgrade_gldp_v1_0_to_v1_1() only bumps the profile URL; normalize_upgraded_resources() already rebuilds resources against the target schemas.
  • Profile resource names are read from both shapes, v1.1 using if/then where v1.0 used oneOf.
  • add_gldp_resource() sets $schema and type: "table" itself, since frictionless only writes them from version 2.0. profile stays: frictionless 1.3.0 won't read a resource without it.
  • Allowed values are read from categories as well as enum, v1.1 declaring both.

Two bugs found along the way

read_resource() maps schema fields to columns by position, fieldsMatch being unimplemented (frictionless-r#216). A tags.csv holding only tag_id and ring_number read the ring number as datapackage_id, silently — and validate_gldp() passed it, since it only sees the names frictionless assigned. Every table allows omitted columns, so this is a file we tell people they may write. Reads now match the schema to the CSV header by name.

fieldsMatch says nothing about which columns are required, so a tags table with no tag_id validated clean. The standard can't yet express this (datapackage#1126), so validate_gldp() checks it directly.

tags.csv: tag_id,ring_number / a,r1

before   tag_id | datapackage_id     ✔ Table tags is consistent with the schema.
after    tag_id | ring_number        ✗ tags is missing 3 required columns:
                                        scientific_name, manufacturer, and model.

Verification

387 tests pass on both frictionless 1.3.0 and 1.3.0.9000 (the 49 warnings are pre-existing — same count with these changes stashed). Emitted packages validate against the published v1.1 profile with 0 errors and report version(resource) as 2.0. That covers #38 for this repo: both versions work, so users need change nothing.

Release-time work not included here: DESCRIPTION / CITATION.cff versions and the NEWS.md block. Gated on frictionless 2.0 reaching CRAN: dropping profile, removing the version-warning muffle in read_gldp(), and raising the DESCRIPTION floor.

🤖 Generated with Claude Code

Rafnuss and others added 2 commits September 17, 2026 20:46
Copied from the GeoPressure/GeoLocator-DP v1.1-resource-schema branch.
Re-sync with data-raw/sync_schemas.R once v1.1 is tagged.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
v1.1 moves the table schema from `resource$$schema` to `resource$schema`
and requires `type`. Resources are rebuilt against the v1.1 schemas by
normalize_upgraded_resources(), so the step function only bumps the
profile URL.

Validating real output against the v1.1 profile gives 0 errors on both
frictionless 1.3.0 and 2.0, where v1.0 gave 8 failing resources.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@Rafnuss Rafnuss mentioned this pull request Sep 17, 2026
@codecov

codecov Bot commented Sep 17, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 97.58065% with 3 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
R/zzz.R 97.33% 2 Missing ⚠️
R/validate_gldp_schema.R 94.11% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

Rafnuss and others added 4 commits September 17, 2026 21:35
GeoLocator-DP v1.1 selects the resource schema with `if`/`then` on the resource
name instead of `oneOf`, so the four places that read the resource names off
the profile stopped finding them. `upgrade_gldp()` walks packages written
against any earlier version, so both shapes have to be read, not just the
current one.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Picks up the string `fieldsMatch`, the array primary and foreign keys, and the
restructured profile. Copied from the GeoLocator-DP `v1.1-resource-schema`
branch; to be re-synced with `sync_gldp_schemas()` once v1.1 is tagged.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
GeoLocator-DP v1.1 declares `categories` next to the `enum` constraint. Both
restrict a field to a fixed set of values, so read whichever the schema gives:
a schema that drops `enum` later is then still validated.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Picks up `categories` and the two corrected examples.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Rafnuss and others added 5 commits September 17, 2026 22:36
GeoLocator-DP v1.1 requires `$schema` on its tabular resources, and
frictionless only sets it from version 2.0. Set it here, alongside `type`, so
packages are correct on both.

`profile: "tabular-data-resource"` stays for now even though `$schema` and
`type` replace it: frictionless 1.3.0 aborts with `Resource "tags" must have a
profile property with value` when it is absent, and that is the release on
CRAN. It can go once the dependency moves to frictionless 2.0.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
GeoLocator-DP moved `tags` from `fieldsMatch: superset` to `partial`, so a
package may carry extra attributes on a tag. `add_gldp_resource()` already
handles both modes and now keeps those columns instead of dropping them
with a warning.

The test covering the dropping path moves to `staps`, which still declares
`superset`, and `tags` gains one covering the keeping path.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
`frictionless::read_resource()` maps schema fields to columns by position,
because `fieldsMatch` is not implemented (frictionlessdata/frictionless-r#216).
A file that leaves out a column its schema declares is therefore read with
every later column under the wrong name, silently: a `tags.csv` holding only
`tag_id` and `ring_number` came back with the ring number labelled
`datapackage_id`, the second field the schema declares.

Nothing caught it. `validate_gldp()` only ever sees the names frictionless
assigned, and `{tag_id, datapackage_id}` is a legal subset of the declared
fields, so it reported the table as consistent with its schema.

Every GeoLocator-DP table declares `superset` or `partial`, both of which let
a file leave columns out, so this is a file we tell people they may write.
The schema is now reconciled with the header before reading: declared fields
absent from the file are dropped, the rest are put in file order, and columns
the schema does not describe are either described as `any`, where
`fieldsMatch` allows them, or reported by name rather than through
frictionless's "Invalid input type, expected 'list' actual 'NULL'".

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
`fieldsMatch` is a rule over the whole set of fields and carries no notion of
which ones are required, so both modes GeoLocator-DP uses let a table leave
out a column declaring `required: true`. A `tags` table with no `tag_id` at
all validated clean, because `required` was only ever checked for columns
that were present.

The standard cannot yet express "the required columns must be present, the
optional ones may be absent" (frictionlessdata/datapackage#1126), so the
presence of required columns is checked here instead.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@Rafnuss
Rafnuss marked this pull request as ready for review September 18, 2026 09:14
@Rafnuss
Rafnuss merged commit 5d4a0ac into dev Sep 18, 2026
6 checks passed
@Rafnuss
Rafnuss deleted the gldp-v1.1 branch October 7, 2026 13:05
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