This function updates the DiAna dictionary based on changes specified in an Excel file. It imports necessary data, identifies records to be fixed, and updates the dictionary accordingly.
Details
The function performs the following steps:
Reads the changes from the specified Excel file.
Imports the necessary data tables (
DRUG_NAME
andDRUG
) if they do not already exist.Identifies the records in
Drug_name
that need to be fixed based on the changes.Joins the changes with the identified records and updates the
Drug
table.Removes the old records and adds the updated records to the
Drug
table.
Examples
# This example needs that DiAna dictionary is downloaded (using setup_DiAna),
# and that an excel file with intended changes is available
if (file.exists("changes.xlsx") & file.exists("external_source/DiAna_dictionary.csv")) {
Drug <- Fix_DiAna_dictionary_locally("changes.xlsx")
}