data-raw/DATASET.R

library(ready4)
library(ready4fun)
library(ready4show)
library(ready4use)
library(youthvars)
fns_env_ls <- ready4fun::read_fns(c("data-raw/fns/","data-raw/mthds/"),
                                  fns_env = new.env(parent = globalenv()))
x <- ready4fun::make_pkg_desc_ls(pkg_title_1L_chr = "Score Multi-Attribute Utility Instruments" %>% tools::toTitleCase(),
                                 pkg_desc_1L_chr = "Modules from the readyforwhatsnext youth mental health economic model (https://readyforwhatsnext.org/) that can be used to summarise multiple questionnaire responses in a single index measure.
                            This package uses publicly available scoring algorithms to calculate health utility from multi-attribute utility instruments and has been developed with the ready4 framework (https://www.ready4-dev.com/).
  This development version of the scorz package has been made available as part of the process of testing and documenting the package.
                            If you have any questions, please contact the authors (matthew.hamilton1@monash.edu).",
                                 authors_prsn = c(utils::person(given = "Matthew",family = "Hamilton",email = "matthew.hamilton1@monash.edu", role = c("aut", "cre", "cph"),comment = c(ORCID = "0000-0001-7407-9194")),
                                                  utils::person(given = "Caroline",family = "Gao",email = "caroline.gao@orygen.org.au", role = c("aut"),comment = c(ORCID = "0000-0002-0987-2759")),
                                                  utils::person("Orygen", role = c("cph", "fnd")),
                                                  utils::person("Headspace", role = c( "fnd")),
                                                  utils::person("National Health and Medical Research Council", role = c( "fnd"))),
                                 urls_chr = c("https://ready4-dev.github.io/scorz/",
                                              "https://github.com/ready4-dev/scorz",
                                              "https://www.ready4-dev.com/")) %>%
  ready4fun::make_manifest(addl_pkgs_ls = ready4fun::make_addl_pkgs_ls(depends_chr = "ready4",
                                                                       suggests_chr = "rmarkdown",
                                                                       imports_chr = "knitrBootstrap"),
                           build_ignore_ls = ready4fun::make_build_ignore_ls(file_nms_chr = c("initial_setup.R")),
                           check_type_1L_chr = "ready4",
                           copyright_holders_chr = "Matthew Hamilton and Orygen",
                           custom_dmt_ls = ready4fun::make_custom_dmt_ls(#user_manual_fns_chr = c()
                           ),##
                           dev_pkgs_chr = c(#"ready4",
                                            "ready4use","ready4show",
                                            "youthvars"),
                           lifecycle_stage_1L_chr = "experimental",
                           path_to_pkg_logo_1L_chr = "../../../../../Documentation/Images/scorz-logo/default.png",
                           piggyback_to_1L_chr = "ready4-dev/ready4",
                           ready4_type_1L_chr = "description",
                           zenodo_badge_1L_chr = "[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.5722708.svg)](https://doi.org/10.5281/zenodo.5722708)"
  )
y <- dplyr::bind_rows(ready4class::make_pt_ready4class_constructor(make_s3_lgl = FALSE,
                                                                   name_stub_chr = "Profile",
                                                                   slots_ls = list("a_YouthvarsProfile",
                                                                                   "country_1L_chr",
                                                                                   "domain_unwtd_var_nms_chr",
                                                                                   "domain_wtd_var_nms_chr",
                                                                                   "instrument_dict_r3",
                                                                                   "instrument_nm_1L_chr",
                                                                                   "instrument_short_nm_1L_chr",
                                                                                   "instrument_version_1L_chr",
                                                                                   "itm_labels_chr",
                                                                                   "itm_prefix_1L_chr",
                                                                                   "scrg_dss_ls",
                                                                                   "total_wtd_var_nm_1L_chr",
                                                                                   "total_unwtd_var_nm_1L_chr"
                                                                   ) %>% list(),
                                                                   pt_ls = list("YouthvarsProfile",
                                                                                "character",
                                                                                "character",
                                                                                "character",
                                                                                "ready4use_dictionary",
                                                                                "character",
                                                                                "character",
                                                                                "character",
                                                                                "character",
                                                                                "character",
                                                                                "list",
                                                                                "character",
                                                                                "character") %>% list(),
                                                                   class_desc_chr= "A dataset to be scored, its associated metadata and details of the scoring instrument.",
                                                                   parent_class_chr = "Ready4Module"),
                      ready4class::make_pt_ready4class_constructor(make_s3_lgl = FALSE,
                                                                   name_stub_chr = "Aqol6",
                                                                   slots_ls = list("a_YouthvarsProfile",
                                                                                   "country_1L_chr",
                                                                                   "domain_unwtd_var_nms_chr",
                                                                                   "domain_wtd_var_nms_chr",
                                                                                   "instrument_dict_r3",
                                                                                   "instrument_nm_1L_chr",
                                                                                   "instrument_short_nm_1L_chr",
                                                                                   "instrument_version_1L_chr",
                                                                                   "itm_labels_chr",
                                                                                   "itm_prefix_1L_chr",
                                                                                   "scrg_dss_ls",
                                                                                   "total_wtd_var_nm_1L_chr",
                                                                                   "total_unwtd_var_nm_1L_chr"
                                                                   ) %>% list(),
                                                                   pt_ls = list("YouthvarsProfile",
                                                                                "character",
                                                                                "character",
                                                                                "character",
                                                                                "ready4use_dictionary",
                                                                                "character",
                                                                                "character",
                                                                                "character",
                                                                                "character",
                                                                                "character",
                                                                                "list",
                                                                                "character",
                                                                                "character") %>% list(),
                                                                   vals_ls = list(list(domain_wtd_var_nms_chr = "paste0(\"vD\",1:6)",
                                                                                       instrument_dict_r3 = " make_aqol6d_scrg_dict()",
                                                                                       instrument_nm_1L_chr = "'Assessment of Quality of Life (6 Dimension)'",
                                                                                       instrument_short_nm_1L_chr = "'AQoL-6D'",
                                                                                       #instrument_version_1L_chr = NA_character_,
                                                                                       itm_labels_chr = "make_aqol6d_item_nms()",
                                                                                       itm_prefix_1L_chr =  "'aqol6d_q'",
                                                                                       scrg_dss_ls = "make_aqol6d_scrg_dss()",
                                                                                       total_wtd_var_nm_1L_chr = "'aqol6d_total_w'",
                                                                                       total_unwtd_var_nm_1L_chr = "'aqol6d_total_c'"
                                                                                       )),
                                                                   class_desc_chr = "A dataset and metadata to support implementation of an AQoL-6D scoring algorithm.",
                                                                   parent_class_chr = "ScorzProfile"),
                      ready4class::make_pt_ready4class_constructor(make_s3_lgl = FALSE,
                                                                   name_stub_chr = "Aqol6Adol",
                                                                   slots_ls = list("instrument_version_1L_chr") %>% list(),
                                                                   pt_ls = list("character") %>% list(),
                                                                   vals_ls = list(list(instrument_version_1L_chr = "'Adolescent'")),
                                                                   class_desc_chr = "A dataset and metadata to support implementation of a scoring algorithm for the adolescent version of AQoL-6D.",
                                                                   parent_class_chr = "ScorzAqol6"),
                      ready4class::make_pt_ready4class_constructor(make_s3_lgl = FALSE,
                                                                   name_stub_chr = "Aqol6Adult",
                                                                   slots_ls = list("instrument_version_1L_chr") %>% list(),
                                                                   pt_ls = list("character") %>% list(),
                                                                   vals_ls = list(list(instrument_version_1L_chr = "'Adult'")),
                                                                   class_desc_chr = "A dataset and metadata to support implementation of a scoring algorithm for the adult version of AQoL-6D.",
                                                                   parent_class_chr = "ScorzAqol6"),
                      ready4class::make_pt_ready4class_constructor(make_s3_lgl = FALSE,
                                                                   name_stub_chr = "EuroQol5",
                                                                   slots_ls = list("a_YouthvarsProfile",
                                                                                   "country_1L_chr",
                                                                                   "domain_unwtd_var_nms_chr",
                                                                                   "domain_wtd_var_nms_chr",
                                                                                   "instrument_dict_r3",
                                                                                   "instrument_nm_1L_chr",
                                                                                   "instrument_short_nm_1L_chr",
                                                                                   "instrument_version_1L_chr",
                                                                                   "itm_labels_chr",
                                                                                   "itm_prefix_1L_chr",
                                                                                   "itm_var_nms_chr",
                                                                                   "scrg_dss_ls",
                                                                                   "total_wtd_var_nm_1L_chr",
                                                                                   "total_unwtd_var_nm_1L_chr",
                                                                                   "type_1L_chr"
                                                                   ) %>% list(),
                                                                   pt_ls = list("YouthvarsProfile",
                                                                                "character",
                                                                                "character",
                                                                                "character",
                                                                                "ready4use_dictionary",
                                                                                "character",
                                                                                "character",
                                                                                "character",
                                                                                "character",
                                                                                "character",
                                                                                "character",
                                                                                "list",
                                                                                "character",
                                                                                "character",
                                                                                "character") %>% list(),
                                                                   vals_ls = list(list(domain_wtd_var_nms_chr = "c(\"eq5dq_MO\", \"eq5dq_SC\", \"eq5dq_UA\", \"eq5dq_PD\", \"eq5dq_AD\")",
                                                                                       instrument_dict_r3 = "make_eq5d_dict()",
                                                                                       instrument_nm_1L_chr = "'EuroQol EQ-5D'",
                                                                                       #instrument_version_1L_chr = NA_character_,
                                                                                       itm_labels_chr = "c(\"Mobility\", \"Self-care\", \"Usual Activities\",\"Pain-Discomfort\",\"Anxiety-Depression\")",
                                                                                       itm_prefix_1L_chr =  "'eq5dq_'",
                                                                                       itm_var_nms_chr = "c(\"eq5dq_MO\", \"eq5dq_SC\", \"eq5dq_UA\", \"eq5dq_PD\", \"eq5dq_AD\")",
                                                                                       #scrg_dss_ls = "make_aqol6d_scrg_dss()",
                                                                                       total_wtd_var_nm_1L_chr = "'eq5d_total_w'",
                                                                                       total_unwtd_var_nm_1L_chr = "'eq5d_total_c'",
                                                                                       type_1L_chr = "'CW'"
                                                                   )),
                                                                   class_desc_chr = "A dataset and metadata to support implementation of an EQ-5D scoring algorithm.",
                                                                   parent_class_chr = "ScorzProfile")) %>%
  ready4class::ready4class_constructor()
aqol6d_scrg_dss_ls <- fns_env_ls$fns_env$get_aqol6d_scrg_dss()
datasets_ls <- list(
  aqol6d_scrg_dss_ls$aqol6d_adult_vldn_pop_with_STATA_scores_tb %>%
    ready4fun::make_pkg_ds_ls(db_1L_chr = "aqol6d_adult_vldn_pop_with_STATA_scores_tb",
                              title_1L_chr = "STATA comparison validation synthetic population",
                              desc_1L_chr = "Synthetic population following application of STATA adult scoring algorithm.",
                              url_1L_chr = "https://www.aqol.com.au/index.php/scoring-algorithms"),
  aqol6d_scrg_dss_ls$adol_dim_sclg_eqs_lup %>%
    ready4fun::make_pkg_ds_ls(db_1L_chr = "adol_dim_sclg_eqs_lup",
                              title_1L_chr = "AQoL6D (adolescent) item worst weightings equations lookup table",
                              desc_1L_chr = "Dimension scaling equations for adolescent version of AQoL6D scoring algorithm.",
                              url_1L_chr = "https://www.aqol.com.au/index.php/scoring-algorithms"))
z <- ready4pack::make_pt_ready4pack_manifest(x,
                                             constructor_r3 = y,
                                             pkg_ds_ls_ls = datasets_ls) %>%
  ready4pack::ready4pack_manifest()
z <- ready4::author(z)
write_to_edit_workflow("pkgdown.yaml", consent_1L_chr = "Y") # In other packages, run for "test-coverage.yaml" as well.
write_to_tidy_pkg(z$x_ready4fun_manifest, build_vignettes_1L_lgl = TRUE,
                  clean_license_1L_lgl = TRUE, consent_1L_chr = "Y",
                  examples_chr = character(0),
                  suggest_chr = "pkgload")
paste0(".github/workflows/", c("pkgdown.yaml", "R-CMD-check.yaml")) %>%
  purrr::walk(~{
    path_1L_chr <- .x
    matches_int <- which(readLines(path_1L_chr) %>% startsWith("    # Addresses issue with incompatibility between libcurl4-gnutls-dev and libcurl4-openssl-dev") | readLines(path_1L_chr) %>% startsWith("        # Addresses issue with incompatibility between libcurl4-gnutls-dev and libcurl4-openssl-dev"))
    if(!identical(matches_int,integer(0))){
      readLines(path_1L_chr)[- (matches_int%>%
                                  purrr::map(~.x:(.x+6)) %>% purrr::flatten_int())] %>%
        writeLines(path_1L_chr)
    }
  })
ready4-dev/scorz documentation built on June 1, 2025, 2:07 p.m.