From a4c0d00ea79ef286636fbf0707520115c911dd67 Mon Sep 17 00:00:00 2001 From: Kai Waldrant Date: Tue, 19 Nov 2024 10:55:01 +0100 Subject: [PATCH] flatten references --- src/reporting/get_method_info/script.R | 12 +++++++++++- src/reporting/get_metric_info/script.R | 11 ++++++++++- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/src/reporting/get_method_info/script.R b/src/reporting/get_method_info/script.R index 876c6633d..b5414c26f 100644 --- a/src/reporting/get_method_info/script.R +++ b/src/reporting/get_method_info/script.R @@ -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 @@ -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_, diff --git a/src/reporting/get_metric_info/script.R b/src/reporting/get_metric_info/script.R index 3b62765cc..7efa9a49d 100644 --- a/src/reporting/get_metric_info/script.R +++ b/src/reporting/get_metric_info/script.R @@ -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 @@ -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_,