Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix 415 #441

Merged
merged 19 commits into from
May 12, 2022
Merged

Fix 415 #441

merged 19 commits into from
May 12, 2022

Conversation

samussiah
Copy link
Contributor

@samussiah samussiah commented May 9, 2022

Overview

  • Align documentation and consistency of domain functions (AE, PD, IE, Consent)
  • Add data-driven data specifications to documentation.
  • Extend associated unit testing.

Test Notes/Sample Code

  • Unit test coverage extended.

Notes:

  • I didn't write an action to build the .md files but there is a script in the (new) dev folder that builds all the data specifications.

@jwildfire jwildfire marked this pull request as draft May 10, 2022 14:34
@samussiah samussiah marked this pull request as ready for review May 10, 2022 14:54
Copy link
Contributor

@jwildfire jwildfire left a comment

Choose a reason for hiding this comment

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

Looks good to me in general! Will leave full review and approval to @mattroumaya.

Lets file an issue to set up the action to generate the content in man/md and assign to @kodesiba

@samussiah samussiah requested a review from jwildfire May 10, 2022 20:25
@samussiah
Copy link
Contributor Author

@mattroumaya, cleaned the header documentation up a bit to assuage R CMD. I've merged dev again so this branch should be good to go.

Spencer Childress and others added 2 commits May 10, 2022 16:30
@mattroumaya
Copy link
Contributor

@samussiah just looked at the failing CI check and it's pretty confusing, only learned about this last week because @kodesiba clued me in:

Just need to add the new functions you developed to _pkgdown.yaml

- generate_md_table
- parse_data_mapping
- parse_data_spec

It looks like we could also use @keywords internal in the roxygen to omit these functions from the pkgdown site if desired: thackl/gggenomes#25

@samussiah
Copy link
Contributor Author

Ayyy, it's working!

@@ -0,0 +1,52 @@
on:
pull_request:
branches: [dev, fix-415]
Copy link
Contributor

Choose a reason for hiding this comment

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

can you change this to just dev @samussiah, I put this in as a test so the fix-415 branch can get taken out

Copy link
Contributor

@mattroumaya mattroumaya left a comment

Choose a reason for hiding this comment

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

The documentation updates and attention to detail are super impressive, awesome work!

Most things are directly noted, and apologies if being too tedious.

The only question I have is about NA values in the mapping documentation (e.g., here). I'm wondering if this is intended, and if so, maybe we should note what NA means, or instead default to replacing NA with FALSE when there isn't a specified value for a data frame.

@@ -0,0 +1,9 @@
# Data specification

|domain |col_key |col_value |vRequired |
Copy link
Contributor

Choose a reason for hiding this comment

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

AE_Map_Adam is missing a vUniqueCols column

|dfSUBJ |strIDCol |SubjectID |TRUE |NA |TRUE |
|dfSUBJ |strSiteCol |SiteID |TRUE |NA |FALSE |
|dfSUBJ |strRandDateCol |RandDate |TRUE |NA |FALSE |
|dfCONSENT |strIDCol |SubjectID |TRUE |FALSE |NA |
Copy link
Contributor

Choose a reason for hiding this comment

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

Should vUniqueCols for dfCONSENT be NA here?

R/IE_Assess.R Outdated
Comment on lines 65 to 66
if (any(unname(map_dbl(lTags, ~ length(.))) > 1)) {
lTags <- map(lTags, ~ paste(.x, collapse = ", "))
Copy link
Contributor

Choose a reason for hiding this comment

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

This was almost certainly my oversight from before but just caught it

Suggested change
if (any(unname(map_dbl(lTags, ~ length(.))) > 1)) {
lTags <- map(lTags, ~ paste(.x, collapse = ", "))
if (any(unname(purrr::map_dbl(lTags, ~ length(.))) > 1)) {
lTags <- purrr:::map(lTags, ~ paste(.x, collapse = ", "))

R/IE_Map_Raw.R Outdated
#'
#' Convert from raw data format to needed input format for Inclusion/Exclusion Assessment.
#' @description
#' Convert raw inclusion/exclusion (IE) data, typically processed case report from data, to formatted
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
#' Convert raw inclusion/exclusion (IE) data, typically processed case report from data, to formatted
#' Convert raw inclusion/exclusion (IE) data, typically processed case report form data, to formatted

|:------|:--------------|:-----------|:---------|:-----------|
|dfSUBJ |strIDCol |SubjectID |TRUE |TRUE |
|dfSUBJ |strSiteCol |SiteID |TRUE |FALSE |
|dfIE |strIDCol |SubjectID |TRUE |NA |
Copy link
Contributor

Choose a reason for hiding this comment

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

Should there be NA cols?

R/IE_Assess.R Outdated
Comment on lines 26 to 27
#' - `dfFlagged`, returned by {gsm::dfFlagged()}
#' - `dfSummary`, returned by {gsm::dfSummary()}
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
#' - `dfFlagged`, returned by {gsm::dfFlagged()}
#' - `dfSummary`, returned by {gsm::dfSummary()}
#' - `dfFlagged`, returned by {gsm::Flag()}
#' - `dfSummary`, returned by {gsm::Summarize()}

|dfSUBJ |strIDCol |SubjectID |TRUE |TRUE |
|dfSUBJ |strSiteCol |SiteID |TRUE |FALSE |
|dfSUBJ |strTimeOnTreatmentCol |TimeOnTreatment |TRUE |FALSE |
|dfAE |strIDCol |SubjectID |TRUE |NA |
Copy link
Contributor

Choose a reason for hiding this comment

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

NA here too - I'll leave a top-level comment about addressing this but is likely an easy-ish solution or something that we don't need to worry about

|dfSUBJ |strIDCol |SubjectID |TRUE |TRUE |
|dfSUBJ |strSiteCol |SiteID |TRUE |FALSE |
|dfSUBJ |strTimeOnStudyCol |TimeOnStudy |TRUE |FALSE |
|dfPD |strIDCol |SubjectID |TRUE |NA |
Copy link
Contributor

Choose a reason for hiding this comment

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

Just noting NA here

@@ -54,7 +54,19 @@ test_that("incorrect lTags throw errors",{


# custom tests ------------------------------------------------------------
test_that('dfAnalyzed has appropriate model output regardless of statistical method', {
assessment <- Consent_Assess(consentInput)
expect_true(all(c('Estimate') %in% names(assessment$dfAnalyzed)))
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
expect_true(all(c('Estimate') %in% names(assessment$dfAnalyzed)))
expect_true('Estimate' %in% names(assessment$dfAnalyzed)))

Just being very tedious here. could also be:

expect_true(hasName(assessment$dfAnalyzed, 'Estimate'))

@@ -51,7 +51,19 @@ test_that("incorrect lTags throw errors",{
})

# custom tests ------------------------------------------------------------
test_that('dfAnalyzed has appropriate model output regardless of statistical method', {
assessment <- IE_Assess(ieInput)
expect_true(all(c('Estimate') %in% names(assessment$dfAnalyzed)))
Copy link
Contributor

Choose a reason for hiding this comment

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

Same here but feel free to ignore

@mattroumaya mattroumaya linked an issue May 11, 2022 that may be closed by this pull request
Copy link
Contributor

@mattroumaya mattroumaya left a comment

Choose a reason for hiding this comment

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

Looks great!

return(list(dfInput=dfInput, lChecks=checks))
}else{
if (bReturnChecks) {
return(list(df = dfInput, lChecks = checks))
Copy link
Contributor

Choose a reason for hiding this comment

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

good catch!

@mattroumaya mattroumaya merged commit 6257b85 into dev May 12, 2022
@mattroumaya mattroumaya deleted the fix-415 branch May 12, 2022 15:41
@mattroumaya mattroumaya linked an issue May 13, 2022 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants