Skip to content

Translate CS source aliases with any slot number - #3

Merged
RickyJ99 merged 2 commits into
mainfrom
fix/cs-alias-any-slot
Oct 2, 2026
Merged

RickyJ99 merged 2 commits into
mainfrom
fix/cs-alias-any-slot

Conversation

@karstenm1987

Copy link
Copy Markdown
Contributor

Country sources are listed as CS<n>_<ISO3> (CS1_ARG, CS10_ITA) but stored as <ISO3>_<n>.dta (ARG_1.dta, ITA_10.dta), and their columns keep the CS<n>_ prefix. The package translated the name only when it was exactly 7 characters, so CS10_ITA failed.

normalizeSourceName now matches ^CS(\d+)_([A-Za-z]{3})$ case-insensitively and also returns the CS<n> column prefix; loadSourceData uses both. Other names are unchanged.

Tests: new offline tests in tests/tGmdOffline.m with an ITA_10.dta fixture, covering a two-digit slot, lower case, surrounding spaces and a near-miss name. MATLAB is not installed where this was written, so CI on this PR is the first run.

🤖 Generated with Claude Code

karstenm1987 and others added 2 commits September 30, 2026 22:41
normalizeSourceName translated CS<n>_<ISO3> to the file name <ISO3>_<n>
only when the name had 7 characters, so two-digit slots such as CS10_ITA
requested CS10_ITA.dta, which does not exist. It now matches
^CS(\d+)_([A-Za-z]{3})$ case-insensitively and also returns the CS<n>
column prefix, which loadSourceData uses to select and list variables.
Other source names are unchanged.

Adds a trimmed ITA_10 fixture and offline tests for CS10_ITA, cs10_ita,
ITA_10 and the variable error message.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The help line read as if CS10_ITA mapped to ARG_1; it now gives both
examples with their own file names. Adds offline tests that " CS10_ITA "
is trimmed and translated, and that CS1_ARGX is not a CS alias and does
not resolve to ARG_1.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@RickyJ99

RickyJ99 commented Oct 2, 2026

Copy link
Copy Markdown
Collaborator

CS fixed ready to be merged

@RickyJ99
RickyJ99 self-requested a review October 2, 2026 09:58
@RickyJ99
RickyJ99 merged commit 6ebbb09 into main Oct 2, 2026
1 check passed
@RickyJ99
RickyJ99 deleted the fix/cs-alias-any-slot branch October 2, 2026 09:59
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.

2 participants