Skip to content

Fix cross-language inconsistencies in gmd()#8

Open
Yicheng-Zhao1999 wants to merge 1 commit into
KMueller-Lab:mainfrom
Yicheng-Zhao1999:20260628/GMD_test_Python
Open

Fix cross-language inconsistencies in gmd()#8
Yicheng-Zhao1999 wants to merge 1 commit into
KMueller-Lab:mainfrom
Yicheng-Zhao1999:20260628/GMD_test_Python

Conversation

@Yicheng-Zhao1999

Copy link
Copy Markdown

Cross-language consistency fixes (Python)

Aligns global_macro_data/gmd.py with the R/Stata packages while reading the same
S3 dataset. Verified against live version 2026_03.

Coverage (this package = Python)

# Finding Needed in Python? Changed in this PR?
1 All-missing rows not dropped as documented Yes (drops only leading rows) No — needs a product decision
2 Variable names case-sensitive Yes Yes — case-insensitive + canonical casing
3 list/current/load keywords case-sensitive Yes Yes — case-insensitive
4 Whitespace not trimmed Yes (version) Yes — version trimmed
5 raw with a non-boolean value Yes (truthiness footgun) No — pending decision (see below)
6 sources + a variable that source lacks Yes (returned None) Yes — now raises an error
7 Error precedence (version vs cite) No (Python already validates version first) No
print / network / fast No (Python already has them) No

What changed

Not changed

Pending decision

  • Wrap raw TypeError/RuntimeError in GMDCommandError #5 raw with a non-boolean value. Python uses plain truthiness, so any non-empty
    string enables raw — including raw="0" / raw="false" (a footgun). Target needs a
    decision: strict (only real booleans) vs lenient coercion ("true"/"1"/"yes" on,
    "false"/"0"/"no" off).

- Variable names matched case-insensitively and normalized to the dataset's
  canonical casing, e.g. "rgdp" -> "rGDP" (KMueller-Lab#2)
- list/current/load keywords accepted case-insensitively (KMueller-Lab#3)
- Trim whitespace-padded version, e.g. " 2026_03 " (KMueller-Lab#4)
- sources + a variable the source lacks now raises an error instead of
  printing a message and returning None (KMueller-Lab#6)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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