Skip to content

feat: populate Rows for SS04 and SS10 validation errors#69

Merged
javihern98 merged 2 commits into
masterfrom
feature/populate-rows-ss04-ss10
May 25, 2026
Merged

feat: populate Rows for SS04 and SS10 validation errors#69
javihern98 merged 2 commits into
masterfrom
feature/populate-rows-ss04-ss10

Conversation

@javihern98
Copy link
Copy Markdown
Collaborator

@javihern98 javihern98 commented May 25, 2026

Summary

  • SS04 (codelist mismatch) and SS10 (cube constraint) errors now populate the Rows field with the dataframe records holding each offending value, matching the behaviour already provided by SS02/SS05/SS06/SS07/SS11.
  • create_error_SS10_SS04 gains a leading data (DataFrame) parameter; both call sites in process_errors_by_column are updated. Public API change — external callers passing positional args need to insert data before values.
  • Bumps version 2.6.82.6.9.

Motivation

Until now, when a CSV contained a wrong codelist value (e.g. INV_ADV_TY=TNLSCOD where TNLSCOD is not in the codelist), the resulting SS04 warning told you what the bad value was but not which rows contained it. Downstream consumers had to re-scan the dataframe themselves with brittle message parsing.

After this change, the warning carries the same shape as SS07:

{
  "Code": "SS04",
  "Component": "INV_ADV_TY",
  "Rows": [{ "FREQ": "M", "INV_ADV_TY": "TNLSCOD", "OBS_VALUE": "230", ... }, ...],
  "Message": "Wrong value TNLSCOD for dimension INV_ADV_TY"
}

Verified on a downstream consumer: one bad value (TNLSCOD) yields one SS04 warning whose Rows lists all 80 dataframe records where INV_ADV_TY == "TNLSCOD". Per-record dict shape is identical to what SS07 produces.

Files changed

  • sdmxthon/parsers/data_validations.py — function signature + body, two call sites
  • sdmxthon/__version__.py2.6.82.6.9
  • Changelog.rst — new entry under 2.6.9

Test plan

  • Existing unit tests pass (no in-repo callers besides the two updated ones)
  • Validate a CSV that triggers SS04 — confirm Rows is a list of dicts, one entry per matching dataframe row
  • Validate a CSV that triggers SS10 — same confirmation
  • Confirm SS02/SS05/SS06/SS07/SS11 still populate Rows correctly (no regression in the unmodified code paths)

The SS04 (codelist mismatch) and SS10 (cube constraint) error generators
previously hard-coded `'Rows': None`, leaving consumers without the per-row
context that SS02/SS05/SS06/SS07/SS11 already provide.

`create_error_SS10_SS04` now takes the dataframe and filters rows where the
offending value appears, populating `Rows` with the same record-dict shape as
the other row-level error codes. Both call sites in
`process_errors_by_column` are updated to pass `data`.

This is a public API change to the function signature. Bump 2.6.8 -> 2.6.9.
The errors_test_2.json reference now expects Rows to contain the offending
record dict, matching the new behaviour of create_error_SS10_SS04. This is
the test that flagged the API-shape change in CI.
@javihern98 javihern98 merged commit 407b523 into master May 25, 2026
5 of 6 checks passed
@javihern98 javihern98 deleted the feature/populate-rows-ss04-ss10 branch May 25, 2026 10:14
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