Package 'srppphist'

Title: Historical Data from the Swiss Register of Plant Protection Products as an R Package
Description: Data objects extracted from historical XML versions of the Swiss Register of Plant Protection Products 'SRPPP'. Starting from 2011, one such data object is contained for each year. Note that the information contained in this project is outdated. An online version of the current register can be accessed via <https://www.psm.admin.ch/de/produkte>. An XML dump of the current register can be read in using the 'srppp' package. There is no guarantee of correspondence of the data contained in or read in using this package with any online version, or with the original registration documents. Also, the Federal Food Safety and Veterinary Office, coordinating the authorisation of plant protection products in Switzerland, does not answer requests regarding this package.
Authors: Johannes Ranke [aut, cre] , Daniel Baumgartner [ctb], Romualdus Kasteel [rev], Marcel Mathis [rev], Agroscope [cph]
Maintainer: Johannes Ranke <[email protected]>
License: GPL (>= 3)
Version: 1.0.0
Built: 2024-11-13 07:23:04 UTC
Source: https://github.com/agroscope-ch/srppphist

Help Index


Get product categories for a pNbr

Description

Get product categories for a pNbr

Usage

product_categories(
  pNbr,
  year = format(Sys.Date(), "%Y"),
  lang = c("de", "fr", "it")
)

Arguments

pNbr

The P-Number of the product

year

The year, defaults to current year

lang

The language to be used for the return value

Value

A character string with the product categories in the SRPPP pasted together, separated by a comma.

Examples

product_categories(7811)
product_categories(7811, lang = "it")

Table of active substance names extracted from all years starting 2011

Description

Please note that products whose authorisation has expired remain in the files until the end of the period during which use by the end user is still permitted. Therefore, the latest year given in this dataset means the latest year where a use up period ('expirationDeadline') of at least one product containing the substance had not expired in the beginning of the respective year.

Usage

srppp_active_substances

Format

tibble A table, resolving the primary keys ('pk') of the active substances to the latest entry in any of the 'substances' tables in srppp_list. Also, the earliest and the latest year of occurrence are given in the columns 'earliest' and 'latest'.

See Also

srppp_products

Examples

print(srppp_active_substances, n = Inf)

Table of product ingredients extracted from all years starting 2011

Description

Table of product ingredients extracted from all years starting 2011

Usage

srppp_ingredients

Format

tibble A table of all unique combinations of P-Number, substance primary key 'pk', and product composition columns 'percent', 'g_per_L', 'ingredient_de', 'ingredient_fr' and 'ingredient_it', and the column 'latest', indicating the latest entry of that combination.

See Also

srppp_products

Examples

print(srppp_ingredients, n = Inf)

List of 'srppp_dm' objects for all years starting 2011

Description

For each year, the first XML dump published by the registration authority is used, with few exceptions, where a corrected dump was published shortly after the first one. Please note the use conditions set out by the registration authority for the XML dumps currently published at their website.

Usage

srppp_list

Format

list A named list of srppp::srppp_dm objects created with the companion package 'srppp'. The list elements are named with the years from 2011 to the current year as a character vector

Use conditions set out by the registration authority

Please consult the use conditions of the XML data files currently published by the Federal Food Safety and Veterinary Office (FSVO). For the the historical data contained in this package, the following points are of particular importance:

  • In cases of doubt, the definitive source of information are always the original registration documents, for present as well as past authorisations.

  • Commercial use of the data provided as XML files is not permitted without the written consent of the FSVO.

Additional notes regarding proper use of the data

As we include only historical, not current authorisation data in this package, please note the following:

  • The descriptions of products and their authorised uses contained in this package refer to past authorisations. Regarding current authorisation, please refer to the Swiss Register of Plant Protection Products, or use the srppp package which facilitates reading in the current registration data into R.

  • Products whose authorisation has expired or which have been withdrawn from the parallel import list are present in the historical data until the end of the period during which use by the end user is still permitted ('exhaustionDeadline'). This date and the sell-out period ('soldoutDeadline') are indicated in the products table of each srppp_dm object.

  • If you use the historical registration data in the form provided by this package, please cite the package as described by the output of citation("srppphist").

Examples

names(srppp_list)

# In case you are interested in the registered uses of products containing
# a certain active substance, here is some example code
library(dplyr, warn.conflicts = FALSE)
# Step 1: Get the pk number of a certain active substance
pk_active <- srppp_active_substances |>
  filter(substance_de == "Cyproconazole") |>
  pull(pk)

# Step 2: Get the products (pNbrs) containing that substance in 2018
products_2018 <- srppp_list[["2018"]]$ingredients |>
  filter(pk == pk_active)

# Step 3: Get the associated uses
uses_2018 <- products_2018 |>
  left_join(srppp_list[["2018"]]$uses, by = "pNbr")

# Step 4: Add additional information, e.g. the cultures
uses_x_cultures_2018 <- uses_2018 |>
  left_join(srppp_list[["2018"]]$cultures, by = c("pNbr", "use_nr"))

# Step 5: Application rate in g/ha
uses_x_cultures_2018_rate <- uses_x_cultures_2018 |>
  srppp::application_rate_g_per_ha() |>
  select(pNbr, use_nr, application_area_de, culture_de, rate_g_per_ha)

# If this should be repeated for all available years, it is convenient
# to define a function that extracts the desired information, apply it
# to the list of yearly product registers, and combine the results in a
# table.
uses_cultures_rates <- function(sr, pk_active) {
  sr$ingredients |>
    filter(pk == pk_active) |>
    left_join(sr$uses, by = "pNbr") |>
    left_join(sr$cultures, by = c("pNbr", "use_nr")) |>
    srppp::application_rate_g_per_ha() |>
    select(pNbr, use_nr, application_area_de,
      culture_de, rate_g_per_ha)
}

# Test the function
uses_cultures_rates(srppp_list[["2018"]], 116L)

# Create a list of tables
uses_cultures_rates_list <- lapply(srppp_list, uses_cultures_rates, 116L)

# Combine the tables for all years
uses_cultures_rates_all_years <- bind_rows(uses_cultures_rates_list,
  .id = "year")
print(uses_cultures_rates_all_years)

# Find names of original products and sales permissions (W-Numbers with dash)
uses_cultures_rates_all_years |>
  select(year, pNbr) |>
  unique() |>
  left_join(srppp_products[c("pNbr", "wNbr", "name")], by = "pNbr",
    relationship = "many-to-many")

Table of all SPe 3 obligations and corresponding mitigation measures

Description

The quantitative mitigation measures extracted from the text as explained in the documentation to srppp::srppp_dm.

Usage

srppp_obligations_spe3

Format

A table with the relevant obligation texts in German, and its corresponding mitigation measures

Examples

print(srppp_obligations_spe3, n = Inf)

Table of products extracted from all years starting 2011

Description

Please note that products whose authorisation has expired remain in the files until the end of the period during which use by the end user is still permitted. The end of the sell-out period ('soldoutDeadline') and the end of the use period ('expirationDeadline') are given in the respective columns of the products table.

Usage

srppp_products

Format

tibble A table of all unique combinations of P-Number, W-Number and product name over all years, and the columns 'earliest' and 'latest', indicating the earliest and latest year of occurrence of that combination. Finally, the columns 'categories_de', 'categories_fr', and 'categories_it' contain concatenations of the product categories in the respective language, with the product categories separated by a comma and a space.

Examples

print(srppp_products[1:6], n = Inf)

Table of substance names extracted from all years starting 2011

Description

Table of substance names extracted from all years starting 2011

Usage

srppp_substances

Format

tibble A table, resolving the primary keys ('pk') of the active substances to the latest entry in any of the 'substances' tables in srppp_list. Also, the earliest and the latest year of occurrence are given in the columns 'earliest' and 'latest'.

See Also

srppp_products

Examples

print(srppp_substances, n = Inf)

Publication dates of the available zip files

Description

Publication dates of the available zip files

Usage

srppp_xml_dates

Format

character vector of publication dates in the format YYYY-MM-DD

Examples

print(srppp_xml_dates)

Additional methods to read an XML version of the Swiss Register of Plant Protection Products

Description

Additional methods to read an XML version of the Swiss Register of Plant Protection Products

Usage

## S3 method for class 'numeric'
srppp_xml_get(from, ...)

## S3 method for class 'Date'
srppp_xml_get(from, ...)

Arguments

from

A number giving a year starting from 2011 up to the current year, or one of the dates in srppp_xml_dates.

...

Currently not used

Value

An object inheriting from 'srppp_xml', 'xml_document', 'xml_node'

Examples

## Not run: 
# The following only works if you have a collection of zipped XML dumps in a directory
# specified in the environment variable R_srppphist_idir
srppp_2015 <- srppp_xml_get(2015)
print(srppp_2015)
class(srppp_2015)

# This is the method for dates used behind the scenes
srppp_2017 <- srppp_xml_get(as.Date("2017-01-13"))
print(srppp_2017)

## End(Not run)

Relative paths of the available zip files

Description

Relative paths of the available zip files

Usage

srppp_xml_zip_files

Format

character vector of paths relative to 'srppp_xml_idir', named with their publication dates in the format YYYY-MM-DD

Examples

print(srppp_xml_zip_files)