Reads a new or updated version of the SITUAS API reports Excel file and updates the internal package metadata. This function is useful when ISTAT adds new reports to the SITUAS API or when you have an updated version of the reports list.

update_reports_metadata(
  excel_path = NULL,
  save_to_package = TRUE,
  verbose = TRUE
)

Arguments

excel_path

Character string. Path to the Excel file containing the updated SITUAS reports list. If NULL (default), uses the file in the package's data-raw directory (data-raw/situas_api.xlsx).

save_to_package

Logical. If TRUE (default), saves the updated metadata to the package's internal data file (R/sysdata.rda). If FALSE, only returns the processed metadata without saving. Set to FALSE if you don't have write permissions to the package directory.

verbose

Logical. If TRUE (default), prints informative messages about the update process.

Value

A data.table containing the processed reports metadata with columns:

pfun

Integer. Report ID (function number)

title

Character. Full title of the report in Italian

date_range

Character. Validity period of the report

analysis_type

Character. Type of temporal analysis (DATA, PERIODO, or ATTUALIZZAZIONE)

info

Character. Additional information about the report

Details

The Excel file must have the following columns (in Italian):

  • Id report: Report ID number (integer)

  • Titolo report: Full title of the report

  • Inizio/fine validita' report: Date range in format DD/MM/YYYY - DD/MM/YYYY

  • Analisi temporale: Analysis type (DATA, PERIODO, or ATTUALIZZAZIONE)

  • Informazioni: Additional information (optional)

Note: Column names may appear with dots instead of spaces (e.g., "Id.report") due to R's data frame naming conventions.

Examples

if (FALSE) { # \dontrun{
# Update from the default package Excel file
new_metadata <- update_reports_metadata()

# Update from a custom Excel file (without saving to package)
custom_metadata <- update_reports_metadata(
  excel_path = "path/to/my_situas_reports.xlsx",
  save_to_package = FALSE
)

# Update silently
update_reports_metadata(verbose = FALSE)
} # }