Skip to content

Closes #108 error message update for spec_to_metacore() - #141

Merged
LiamHobby merged 4 commits into
mainfrom
108-error-messages-for-spec_to_metacore
Feb 13, 2026
Merged

Closes #108 error message update for spec_to_metacore()#141
LiamHobby merged 4 commits into
mainfrom
108-error-messages-for-spec_to_metacore

Conversation

@jeffreyad

@jeffreyad jeffreyad commented Jan 26, 2026

Copy link
Copy Markdown
Collaborator

This may have been a typo from recent fixes for error messaging @LiamHobby @bms63
Update from:


Error in `sheets_to_error %>% map2_chr(names(sheets_to_error), function(vars, sheet_name) {
    paste0("Sheet '", sheet_name, "' is the closest match, but unable to match the following column(s)\n",
      paste(names(vars), collapse = "\n"))
  }) %>% paste0(collapse = "\n") %>% paste0("Unable to identify a sheet with all columns.\n", .) %>%
    (call. = FALSE)`:
! attempt to apply non-function

to this:

Error:
! Unable to identify a sheet with all columns. Sheet 'Variables' is the closest match, but unable to match the following column(s)
  id where2 Sheet 'ValueLevel' is the closest match, but unable to match the following column(s) id where2 Sheet 'Codelists' is the closest
  match, but unable to match the following column(s) where1 where2 Sheet 'Analysis Results' is the closest match, but unable to match the
  following column(s) where2 where3

when loading the spec from {pharmaverseadam}:
mc <- spec_to_metacore("../pharmaverseadam/inst/extdata/adams-specs.xlsx", quiet = TRUE)

@jeffreyad jeffreyad linked an issue Jan 26, 2026 that may be closed by this pull request
@jeffreyad
jeffreyad requested review from LiamHobby and bms63 January 26, 2026 19:16
@jeffreyad jeffreyad changed the title #108 error message update Closes #108 error message update for spec_to_metacore() Jan 26, 2026
@codecov

codecov Bot commented Jan 26, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 89.66%. Comparing base (f34cc5f) to head (ac6f2c9).
⚠️ Report is 5 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #141      +/-   ##
==========================================
+ Coverage   87.98%   89.66%   +1.67%     
==========================================
  Files           9        9              
  Lines        1406     1412       +6     
==========================================
+ Hits         1237     1266      +29     
+ Misses        169      146      -23     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@bms63

bms63 commented Jan 26, 2026

Copy link
Copy Markdown
Collaborator

Can we make a code suggestion to the user on possible way to fix the issue?

@jeffreyad

Copy link
Copy Markdown
Collaborator Author

Can we make a code suggestion to the user on possible way to fix the issue?

Getting closer:


Error in `create_tbl()`:
! Sheet 'Variables' is the closest match, but missing: id, where2 Sheet 'ValueLevel' is the closest match, but missing: id, where2
  Sheet 'Codelists' is the closest match, but missing: where1, where2 Sheet 'Analysis Results' is the closest match, but missing: where2,
  where3

Tip: A 'where' column was detected; check if 'where_sep_sheet' is set correctly.

@jeffreyad

Copy link
Copy Markdown
Collaborator Author
Error:
✖ Unable to identify a sheet with all columns.
ℹ Closest matches identified:
Sheet 'Variables' is missing: id, where2
Sheet 'ValueLevel' is missing: id, where2
Sheet 'Codelists' is missing: where1, where2
Sheet 'Analysis Results' is missing: where2, where3
! Tip: A 'where' column was detected. Check if `where_sep_sheet` is set correctly.

@bms63

bms63 commented Jan 26, 2026

Copy link
Copy Markdown
Collaborator

I love it!!

@LiamHobby LiamHobby left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Looks really great to me. Can we add a test covering this? The "spec_no_val.xlsx" file under tests/testthat produces the same error so we can use that in the test case? Thanks

@jeffreyad

Copy link
Copy Markdown
Collaborator Author

Looks really great to me. Can we add a test covering this? The "spec_no_val.xlsx" file under tests/testthat produces the same error so we can use that in the test case? Thanks

Added a test @LiamHobby and @bms63

@jeffreyad
jeffreyad requested a review from LiamHobby February 4, 2026 17:34

@LiamHobby LiamHobby left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Really informative messaging and great test coverage. Thanks a lot!

@LiamHobby
LiamHobby merged commit 62ee202 into main Feb 13, 2026
12 checks passed
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.

Error Messages for spec_to_metacore()

3 participants