# banffIT-vignette

This package is designed to assign standardized diagnoses using the Banff Classification (Category 1 to 6 diagnoses, including Acute and Chronic active T-cell mediated rejection as well as Active, Chronic active, and Chronic antibody mediated rejection).

The following steps will guide you in this process of diagnosis assignment with the package. To get your dataset ready and in a correct format, you must refer to the data dictionary provided with the package here (or using the function `get_banff_dictionary()` in R). This data dictionary contains metadata specifying how your input dataset should be formatted and what information it must contain.

# 1. Having your dataset ready

A template (available here or `get_banff_template()` in R) as well as an example dataset (available here or `get_banff_example()` in R) are also available with the package to help you construct and prepare your dataset.

# 2. Run the process with the main function

The main function `banff_launcher()` will go through 3 steps. It will:

1. Evaluate your input dataset (using `banff_dataset_evaluate()` internally). If your input dataset is not in the correct format or is missing information, a report will be saved in your output folder and will flag variables and rows that are not formatted properly. The next step will not run if the input dataset is not in the correct format.

2. Assign diagnosis to each observation (using `calculate_adequacy()` and `add_diagnoses()` internally).

3. Save the output dataset containing diagnoses,a summary report with descriptive statistics of your output dataset, and the data dictionary.

# 3. Use the example file

This command example runs the diagnosis assignment process on the dataset specified in the input_file path. The output files will be saved in path_folder/example. The diagnoses will be displayed in English and only observation with adequacy == 1 will be taken into consideration due to the option_filter argument. Finally, the output dataset will contain variables generated in the process due to the argument “detail” set to TRUE.

    # To install banffIT
    install.packages('banffIT')

    library(banffIT)
    # If you need help with the package, please use:
    banffIT_website()

    # use example
    version <- 2022
    input_file <- system.file("extdata", paste0(version,"/banff_example.xlsx"),
                              package = "banffIT")
    banff_launcher(
      input_file = input_file,
      output_folder = tempdir(), # 'folder_path/example'
      version = version,
      language = 'label:en',
      option_filter = adequacy == 1,
      detail = TRUE)