{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  
  "title" : "Clinical data template for visualization of summarized data",
  
  "description" : "This report summarizes the data of interest (with the \\code{inTextSummaryTable} package) and visualize it with any clinical data review plot function.",
  
  "type": "object",
  
  "properties": {
  
    "template": {
      "const": "summaryPlotTemplate.Rmd",
      "doc": "name of the template report"
    },
    "templatePackage": {
      "const": "clinDataReview",
      "doc": "package from which the template should be extracted"
     },
    
    "reportTitle": {
      "type": "string",
      "doc": "header title"
    },
    "reportTitleLevel": {
      "type": "integer",
      "doc": "header level, 1 by default (1: 'chapter', '2': 'section', '3': subsection, ...)"
    },
    "parallel": {
      "type": "boolean",
      "doc": "does this chapter use parallel execution? If the entire report is run in parallel, this ensures that this specific chapter is created outside of the report parallelization."
    },
    "split_by": {
      "oneOf": [
        {"type": "integer", "minimum": 0, "maximum": 7},
        {"type": "string", "enum": ["none", "chapter", "section"]}
      ],
      "doc": "split the chapter at the specified level: 1 (for 'chapter'), 2 (for 'section') until 7. This overwrites the 'split_by' parameter defined in the output format of the report."
    },
    
    "dataFileName" : {
      "type": ["string", "array"],
      "doc": "name of the data file(s) of interest. If multiple files are specified, the data are combined by rows ('row bind'), with a column: 'DATASET' containing the name of the file (in upper case and without extension) the data originate from."
    },
    "dataProcessing": {
      "type": "array",
      "doc": "data processing parameters, passed to \\link[clinDataReview]{processData}"
    },
    "dataTotalFileName": {
      "type": "string",
      "doc": "filename of the total dataset"
    },
    "dataTotalProcessing": {
      "type": "array",
      "doc": "data processing parameters for 'dataTotalFileName', passed to \\link[clinDataReview]{processData}"
    },
    
    "tableParams": {
      "type": "object",
      "doc": "parameters to summarize the data in a table, passed to \\link[inTextSummaryTable]{computeSummaryStatisticsTable}"
    },
    "tableProcessing": {
      "type": "array",
      "doc": "data processing parameters for the summary table, passed to \\link[clinDataReview]{processData}"
    },
    
    "plotFunction": {
      "type": "string",
      "enum": ["timeProfileIntervalPlot", "scatterplotClinData", "sunburstClinData", "treemapClinData", "barplotClinData", "errorbarClinData"],
      "doc": "plotting function to visualize summary data"
    },
    "plotParams": {
      "type": "object",
      "doc": "parameters for the plotting function. Parameters depending on the dataset of interest can be specified as:\\cr \\code{[parameterName]: !r-lazy [summaryTableI]}"
    },
    "loopingVar": {
      "type": ["array", "string"],
      "doc": "data variable(s) to loop over. Each group of the variable(s) is displayed in a separated section of the report."
    },
    "loopingNMax": {
      "type": "integer",
      "doc": "maximum number of elements of \\code{loopingVar} to include in the report"
    },
    "loopingTotal": {
      "type": "boolean",
      "doc": "should the total also be computed by \\code{loopingVar} (TRUE by default)?"
    },
    
    "startup": {
      "type": ["array", "string"],
      "doc": "R commands that should be run at the start of the report"
    }
    
  },
  
  "required": ["template", "templatePackage", "reportTitle", "dataFileName", "tableParams", "plotFunction", "plotParams"],
  
  /*   doesn't allow extra parameters in the config files */
  "additionalProperties": false
  
}
