Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion R/create-Rmd-table.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
create_Rmd_table <- function(file_type, file_metadata, column_metadata, column_category_metadata) {
column_metadata_rows <- column_metadata[column_metadata$fileName == file_type, ]
column_metadata_rows <- column_metadata[.matches_file_type(column_metadata$fileName, file_type), ]
if(nrow(column_metadata_rows) == 0) {
stop(glue::glue("No column metadata rows found for file {file_type}"))
}
Expand Down
2 changes: 1 addition & 1 deletion R/create-reference-Rmd.R
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ create_reference_Rmd <- function(
)

column_metadata_for_file <- column_metadata[
column_metadata$fileName == file_name,
.matches_file_type(column_metadata$fileName, file_name),
]
if(nrow(column_metadata_for_file) == 0) {
stop(paste("No column metadata found for file", file_name))
Expand Down
12 changes: 12 additions & 0 deletions R/matches-file-type.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#' Tests the `fileName` column in the column metadata file for the existence of
#' a file
#'
#' @param files_names the fileName column
#' @param file_type the file name to check for
#'
#' @return a logical vector
#'
#' @keywords internal
.matches_file_type <- function(file_names, file_type) {
sapply(strsplit(file_names, ";"), function(names) file_type %in% names)
}
6 changes: 3 additions & 3 deletions R/validate-model-paramater-file.R
Original file line number Diff line number Diff line change
Expand Up @@ -123,12 +123,12 @@ validate_file <- function(file,
column_metadata,
column_category_metadata) {
current_file_metadata <- file_metadata[file_metadata$fileName == file_type,]

if (nrow(current_file_metadata) == 0) {
stop(glue::glue("No rows found in file metadata for file type {file_type}"))
}
file_column_metadata <- column_metadata[column_metadata$fileName == file_type,]

file_column_metadata <- column_metadata[.matches_file_type(column_metadata$fileName, file_type),]
if (nrow(file_column_metadata) == 0) {
stop(glue::glue("No rows found in columns metadata for file type {file_type}"))
}
Expand Down
1 change: 1 addition & 0 deletions docs/2-model-parameter-files.qmd
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
```{r echo=FALSE}
source("../R/matches-file-type.R")
source("../R/create-Rmd-table.R")
```

Expand Down
1 change: 1 addition & 0 deletions docs/5-reference.qmd
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
```{r, echo=FALSE, results='asis'}
source("../R/matches-file-type.R")
source("../R/create-reference-Rmd.R")

file_metadata <- read.csv(
Expand Down
2 changes: 2 additions & 0 deletions docs/_quarto.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ project:
output-dir: dist
post-render: ./generate_llms_script.R

quarto-required: ">=1.9.0"

website:
title: "Model Parameter Files"
sidebar:
Expand Down
9 changes: 3 additions & 6 deletions inst/metadata/column-metadata.csv
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@ validate,value,The value to use when applying the validation,string,FALSE,,,,
validate,error_handle,How to handle failed validations,category,FALSE,,,,
validate,error_replace,Value to replace variables that fail validations whose errorHandle value is warning,string,FALSE,,,,
validate,location,Which step in the scoring process the validation should be used,string,FALSE,,,,
beta-coefficients,variable,The name of the variable whose beta coefficient the row contains. If this is the coefficient for the intercept then use the name "Intercept",string,FALSE,,,,
beta-coefficients,coefficient,The beta coefficient,number,FALSE,,,,
beta-coefficients,type,The statistical type of the variable,category,FALSE,,,,
beta-coefficients;logistic-regression,variable,The name of the variable whose beta coefficient the row contains. If this is the coefficient for the intercept then use the name "Intercept",string,FALSE,,,,
beta-coefficients;logistic-regression,coefficient,The beta coefficient,number,FALSE,,,,
beta-coefficients;logistic-regression,type,The statistical type of the variable,category,FALSE,,,,
baseline-hazards,time,The time upto which the baseline hazard should be used,number,FALSE,,,,
baseline-hazards,baselineHazard,The baseline hazard value,number,FALSE,,,,
survival_bins,catValue,The bin number,number,FALSE,,,,
Expand All @@ -66,6 +66,3 @@ tables,tableName,The name of the table,string,FALSE,,,,
tables,tablePath,The path to the table relative to this file,string,FALSE,,,,
simple-model,name,The name of the metadata,category,FALSE,,,,
simple-model,value,The value of the metadata,string,FALSE,,,,
logistic-regression,variable,The name of the variable whose beta coefficient the row contains. If this is the coefficient for the intercept then use the name "Intercept",string,FALSE,,,,
logistic-regression,coefficient,The beta coefficient,number,FALSE,,,,
logistic-regression,type,The statistical type of the variable,category,FALSE,,,,
Loading