Skip to content

Commit

Permalink
flatten references
Browse files Browse the repository at this point in the history
  • Loading branch information
KaiWaldrant committed Nov 19, 2024
1 parent 797e681 commit a4c0d00
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
12 changes: 11 additions & 1 deletion src/reporting/get_method_info/script.R
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,15 @@ outputs <- map(configs, function(config) {
)
info$type_info <- NULL

# Flatten references
if (!is.null(info$reference) && info$reference != "") {
imap(info$reference, function(value, key) {
info[[paste0("reference_", key)]] <- value
})
}
info$reference <- NULL


# ↑ this could be used as the new format

# construct v1 format
Expand All @@ -76,7 +85,8 @@ outputs <- map(configs, function(config) {
method_summary = info$summary,
method_description = info$description,
is_baseline = grepl("control", info$type),
paper_reference = info$reference %||% NA_character_,
reference_doi = info$reference_doi %||% NA_character_,
reference_bibtex = info$reference_bibtex %||% NA_character_,
code_url = info$code_url %||% NA_character_,
documentation_url = info$documentation_url %||% NA_character_,
image = info$image %||% NA_character_,
Expand Down
11 changes: 10 additions & 1 deletion src/reporting/get_metric_info/script.R
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,14 @@ outputs <- map(configs, function(config) {
info$comp_path
)

# Flatten references
if (!is.null(info$reference) && info$reference != "") {
imap(info$reference, function(value, key) {
info[[paste0("reference_", key)]] <- value
})
}
info$reference <- NULL

# ↑ this could be used as the new format

# construct v1 format
Expand All @@ -60,7 +68,8 @@ outputs <- map(configs, function(config) {
metric_name = info$label,
metric_summary = info$summary,
metric_description = info$description,
paper_reference = info$reference %||% NA_character_,
reference_doi = info$reference_doi %||% NA_character_,
reference_bibtex = info$reference_bibtex %||% NA_character_,
implementation_url = info$implementation_url %||% NA_character_,
image = info$image_url %||% NA_character_,
code_version = info$code_version %||% NA_character_,
Expand Down

0 comments on commit a4c0d00

Please sign in to comment.