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

Feature/json nullwrite #23

Merged
merged 4 commits into from
Jun 25, 2024
Merged

Feature/json nullwrite #23

merged 4 commits into from
Jun 25, 2024

Conversation

bengalengel
Copy link
Collaborator

na="null" passed to write_json for the export of model metadata.

R/utility.R Outdated Show resolved Hide resolved
@bengalengel bengalengel reopened this Jun 24, 2024
@bengalengel
Copy link
Collaborator Author

@jdblischak if you're good with this I'd like to squash and merge this one.

Copy link
Contributor

@jdblischak jdblischak left a comment

Choose a reason for hiding this comment

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

I'm fine if you squash and merge this PR. However, I left some comments and suggestions for applying na = "null" globally for all JSON output if that would be desired

NEWS.md Outdated Show resolved Hide resolved
@@ -70,7 +70,7 @@ createTextFiles <- function(study, directoryname, calcOverlaps = FALSE) {
dir.create(directoryname, showWarnings = FALSE, recursive = TRUE)
exportSamples(study, directoryname)
exportFeatures(study, directoryname)
exportModels(study, directoryname)
exportModels(study, directoryname, na="null")
Copy link
Contributor

Choose a reason for hiding this comment

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

What is the motivation for only wanting to apply this to the "models" output and not other JSON output like "tests" and "annotations"?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Companion tools that need to be updated in sequence. This gives us flexibility with output types, which I need (for now) internally. This change won't impact any external users of OmicNavigator. I anticipate na=null to become the default argument for write_json in time.

@@ -65,7 +65,7 @@ readJson <- function(x, simplifyVector = TRUE, ...) {
}

writeJson <- function(x, file, auto_unbox = TRUE, pretty = TRUE, ...) {
Copy link
Contributor

Choose a reason for hiding this comment

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

If you wanted to apply na = "null" to all JSON output files, you could treat it the same as other default arguments like auto_unbox and pretty. Add na = "null" to writeJson() and na = na to jsonlite::write_json()

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

yes

@bengalengel bengalengel merged commit 3458943 into main Jun 25, 2024
3 of 4 checks passed
@bengalengel bengalengel deleted the feature/json_nullwrite branch June 26, 2024 15:15
@bengalengel bengalengel restored the feature/json_nullwrite branch June 26, 2024 15:15
@bengalengel bengalengel deleted the feature/json_nullwrite branch June 26, 2024 15:29
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