Skip to content

[sdmx] add explicit node existence check for variableMeasured - #2037

Open
clincoln8 wants to merge 2 commits into
datacommonsorg:masterfrom
clincoln8:sdmx-variable-existence-check
Open

clincoln8 wants to merge 2 commits into
datacommonsorg:masterfrom
clincoln8:sdmx-variable-existence-check

Conversation

@clincoln8

@clincoln8 clincoln8 commented Jul 23, 2026 •

Copy link
Copy Markdown
Contributor

Summary

This PR adds an explicit node existence check for variableMeasured in SDMX Data and Availability queries.

Previously, when an SDMX query requested a non-existent or misspelled variableMeasured, prepareSdmxShape() received 0 observationProperties edges and silently defaulted the shape to [observationAbout]. Subsequent entity filters (like c[sex]=Female or c[country]=country/ARE) evaluated against [observationAbout] failed with a misleading error: unsupported SDMX component filter "sex"; filterable components are [observationAbout, ...] when it should just say that the variable didn't exist.

Changes

  • Uses typeOf property check as an existence check for variableMeasured
  • Updates observationPropertiesPageSize multiplier to account for typeOf edges

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request updates SDMX query preparation to fetch both observationProperties and typeOf predicates in a single database call, adds validation to ensure requested variables exist (returning a NotFound error if they do not), and refactors hardcoded predicate strings to use constants. The review feedback highlights that fetching both predicates increases the number of expected edges per variable. The current page size multiplier of 4 (maxObservationPropertyEntitySlots + 1) might cause silent truncation of edges during large batch queries, potentially missing properties or failing to detect unsupported metadata. It is recommended to update the observationPropertiesPageSize helper function to use a multiplier of 5 (maxObservationPropertyEntitySlots + 2) to safely accommodate the additional typeOf edge.

@clincoln8

Copy link
Copy Markdown
Contributor Author

/gemini review

@clincoln8
clincoln8 force-pushed the sdmx-variable-existence-check branch from a715dd6 to 5cff76f Compare July 23, 2026 01:19

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request updates the SDMX shape preparation to fetch both observationProperties and typeOf predicates, and introduces a check to return a NotFound error if a requested variableMeasured does not exist. It also updates the page size calculation and corresponding unit tests to reflect these changes. I have no feedback to provide.

@clincoln8 clincoln8 changed the title fix(sdmx): add explicit node existence check for variableMeasured [sdmx] add explicit node existence check for variableMeasured Jul 23, 2026
@clincoln8
clincoln8 force-pushed the sdmx-variable-existence-check branch from 5cff76f to a63aee2 Compare July 23, 2026 16:36

This branch has not been deployed

No deployments
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