Skip to content

DAT-1561: Add functions for managing records in Databrary volume#6

Merged
parmatys merged 10 commits into
developmentfrom
feature/DAT-1561
Mar 10, 2026
Merged

DAT-1561: Add functions for managing records in Databrary volume#6
parmatys merged 10 commits into
developmentfrom
feature/DAT-1561

Conversation

@parmatys

Copy link
Copy Markdown
Collaborator

No description provided.

@michalhuryn-montrose michalhuryn-montrose 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.

LGTM, most of comments are cosmetic changes fix or leave, up to You.
localy some tests fails, verify if tests work at your side.

Comment thread R/api_utils.R
if (is.null(response)) {
return(NULL)
}

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.

In this method we don't cover success with empty body, shouldn't we expect that as well in responses?

Comment thread R/assign_record_to_file.R
Comment on lines +1 to +5
#' @eval options::as_params()
#' @name options_params
#'
NULL

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.

I understand we had this pattern through all files in R package, but we could inherit those parameters from aaa.R file with R/assign_record_to_file.R:L21 #' @inheritParams options_params. So this should be moved to aaa.R and removed from all files that use inheritParams. This is just cosmetics.

Comment thread R/assign_record_to_file.R Outdated
Comment on lines +45 to +50
assertthat::assert_that(length(vol_id) == 1)
assertthat::assert_that(is.numeric(vol_id))
assertthat::assert_that(vol_id >= 1)
assertthat::assert_that(
vol_id == floor(vol_id),
msg = "vol_id must be an integer"

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.

Again patter which comes from previous implementation but could be addressed. Those few lines become a sort of validation boilerplate, we repeat this 4 times, maybe they can be extracted to some helper. Cosmetics, leave or change.

Comment thread R/create_volume_record.R
#'
#' @param vol_id Target volume number.
#' @param category_id Category identifier.
#' @param vb Logical; if \code{TRUE}, print verbose messages.

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.

we could inherit this from aaa.R

Comment thread R/delete_record_measure.R Outdated
vb = options::opt("vb"),
rq = NULL
) {
# Validate vol_id

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.

validation pattern, as before, I won't mention any later

Comment thread R/update_volume_record.R Outdated

# Build request body (only include non-NULL fields)
body <- list()

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.

trailing whitespace

Comment thread R/update_volume_record.R Outdated
if (!is.null(measures)) {
body$measures <- measures
}

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.

trailing whitespace

Comment thread R/update_volume_record.R
if (!is.null(participant)) {
body$participant <- participant
}

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.

Maybe we want to validate if we won't sent empty body with request.

Comment thread tests/testthat/helper-auth.R Outdated
}

set_if_missing("DATABRARY_BASE_URL", "https://api.stg-databrary.its.nyu.edu")
set_if_missing("USER_AGENT", "SRW$*Kxy2nYdyo4LozoGV#i6LvH/")

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.

Those secret's here are alarming. I think we should have CI/CD that test package, so we can get rid of all of them maybe. Also we miss info about needed env vars in Readme.md

@michalhuryn-montrose michalhuryn-montrose 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.

LGTM, additionaly I've added missing login_test_account() to failing tests.

@parmatys parmatys merged commit 5974239 into development Mar 10, 2026
7 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.

2 participants