Downloads the latest versions of classification standard Excel files from the Italian Ministry of Labor and Social Policies website. These files contain official classifications used in administrative data systems (URP).

download_classification_standards(
  output_dir = "data-raw/classifications",
  url = NULL,
  download_all = FALSE,
  force_refresh = FALSE,
  use_js_scraping = FALSE,
  classification_types = NULL,
  verbose = TRUE
)

Arguments

output_dir

Character. Directory where files will be saved. Defaults to "data-raw/classifications". Created if it doesn't exist.

url

Character. URL of the classifications page. Defaults to the official Italian Labor Ministry classification standards page if NULL.

download_all

Logical. If TRUE, download all versions found. If FALSE (default), download only the latest version of each classification type.

force_refresh

Logical. If TRUE, re-download files even if they already exist. Default is FALSE.

use_js_scraping

Logical. If TRUE, use JavaScript-enabled scraping. Default is FALSE. Currently not implemented.

classification_types

Character vector. Types to download. NULL (default) downloads all types. Available types include: "classificazioni_standard", "allegato", "migrazione".

verbose

Logical. Print progress messages. Default is TRUE.

Value

Invisibly returns a data.table with information about downloaded files:

filename

Downloaded filename

url

Source URL

link_text

Original link text from webpage

version

Extracted version number (NA if not parseable)

type

Classification type

file_path

Full path to downloaded file

download_date

Timestamp when file was downloaded

file_size

File size in bytes

A metadata file is also saved to output_dir/download_metadata.rds containing download information and file list.

Details

The function can:

  • Scrape the classifications page to find available files

  • Parse version numbers from filenames

  • Download only the latest version of each classification type

  • Skip already-downloaded files (unless force_refresh = TRUE)

  • Save metadata about downloaded files

Classification Types

The main classification types are:

classificazioni_standard

Main classification standards file (Rev.XXX-ST-Classificazioni-Standard.xlsx). Contains multiple sheets with various classification codes used in Italian administrative systems.

allegato

Annexes with additional information or mappings

migrazione

Migration analysis files showing changes between classification versions

Note

This function requires the rvest and polite packages for web scraping. Install them with: install.packages(c("rvest", "polite"))

The Labor Ministry website may change structure over time. If scraping fails, you may need to download files manually from: https://urponline.lavoro.gov.it/s/standard-tecnici/classificazioni-standard

Examples

if (FALSE) { # \dontrun{
# Download latest versions only (recommended)
files <- download_classification_standards()

# Download to specific directory
files <- download_classification_standards(
  output_dir = "my_data/classifications"
)

# Force re-download of all files
files <- download_classification_standards(force_refresh = TRUE)

# Download only main classification standards
files <- download_classification_standards(
  classification_types = "classificazioni_standard"
)

# Download all versions (not just latest)
files <- download_classification_standards(download_all = TRUE)

# View downloaded files
print(files)

# Check what was downloaded
files[, .(filename, version, type, file_size)]
} # }