Create a dm object from an XML version of the Swiss Register of Plant Protection Products
Source:R/srppp-xml.R
srppp_dm.Rd
While reading in the data, the information obtained from the XML file is
left unchanged, with the exceptions listed in the section 'Details'.
An overview of the contents of the most important tables in the resulting
data object is given in vignette("srppp")
.
Usage
srppp_dm(from = srppp_xml_url, remove_duplicates = TRUE)
# S3 method for class 'srppp_dm'
print(x, ...)
Value
A dm::dm object with tables linked by foreign keys pointing to primary keys, i.e. with referential integrity. Since version 1.1, the returned object has an attribute named 'culture_tree' of class data.tree::Node.
Details
Corrections made to the data
In the following case, the product composition is corrected while reading in the data: The active substance content of Dormex (W-3066) is not 667 g/L, but 520 g/L This was confirmed by a visit to the Wädenswil archive by Johannes Ranke and Daniel Baumgartner, 2024-03-27.
Removal of redundant information
Information on products that has been duplicated across several products sharing the same P-Number has been associated directly with this P-Number, in order to avoid duplications. While reading in the XML file, it is checked that the resulting deduplication does not remove any data.
In very few cases of historical XML files, there are two
<Product>
sections sharing the same W-Number. In these cases, one of these has apparently been included in error and an informed decision is taken while reading in the data which one of these sections is discarded. The details of this procedure can be found in the source code of the functionsrppp_xml_get_products
.
Amendments to the data
In the table of obligations, the following information on mitigation measures is extracted from the ones relevant for the environment (SPe 3).
"sw_drift_dist": Unsprayed buffer towards surface waters to mitigate spray drift in meters
"sw_runoff_dist": Vegetated buffer towards surface waters to mitigate runoff in meters
"sw_runoff_points": Required runoff mitigation points to mitigate runoff
"biotope_drift_dist": Unsprayed buffer towards biotopes (as defined in articles 18a and 18b of the Federal Act on the Protection of Nature and Cultural Heritage) to mitigate spray drift in meters
Examples
# Avoid NOTE on CRAN caused by checks >5s
library(dplyr, warn.conflicts = FALSE)
library(dm, warn.conflicts = FALSE)
sr <- srppp_dm()
dm_examine_constraints(sr)
#> ℹ All constraints satisfied.
dm_draw(sr)
# Show ingredients for products named 'Boxer'
sr$products |>
filter(name == "Boxer") |>
left_join(sr$ingredients, by = "pNbr") |>
left_join(sr$substances, by = "pk") |>
select(wNbr, name, pNbr, isSalePermission, substance_de, g_per_L)
#> # A tibble: 2 × 6
#> wNbr name pNbr isSalePermission substance_de g_per_L
#> <chr> <chr> <int> <lgl> <chr> <dbl>
#> 1 6168 Boxer 7105 FALSE Prosulfocarb 800
#> 2 6168-1 Boxer 7105 TRUE Prosulfocarb 800
# Show authorised uses of the original product
boxer_uses <- sr$products |>
filter(name == "Boxer", !isSalePermission) |>
left_join(sr$uses, by = "pNbr") |>
select(pNbr, use_nr,
min_dosage, max_dosage, min_rate, max_rate, units_de,
waiting_period, time_units_de, application_area_de)
print(boxer_uses)
#> # A tibble: 17 × 10
#> pNbr use_nr min_dosage max_dosage min_rate max_rate units_de waiting_period
#> <int> <int> <dbl> <dbl> <dbl> <dbl> <chr> <int>
#> 1 7105 1 NA NA 5 NA l/ha 100
#> 2 7105 2 NA NA 5 NA l/ha 60
#> 3 7105 3 NA NA 5 NA l/ha 90
#> 4 7105 4 NA NA 4 NA l/ha 80
#> 5 7105 5 NA NA 2.5 3 l/ha 75
#> 6 7105 6 NA NA 4 NA l/ha 80
#> 7 7105 7 NA NA 3 NA l/ha 80
#> 8 7105 8 NA NA 3 NA l/ha 80
#> 9 7105 9 NA NA 4 NA l/ha 80
#> 10 7105 10 NA NA 5 NA l/ha 0
#> 11 7105 11 NA NA 4 NA l/ha 0
#> 12 7105 12 NA NA 3 4.5 l/ha 0
#> 13 7105 13 NA NA 2.5 5 l/ha NA
#> 14 7105 14 NA NA 3 5 l/ha NA
#> 15 7105 15 NA NA 5 NA l/ha 0
#> 16 7105 16 NA NA 4 NA l/ha 60
#> 17 7105 17 NA NA 2.5 5 l/ha NA
#> # ℹ 2 more variables: time_units_de <chr>, application_area_de <chr>
# Show crop for use number 1
boxer_uses |>
filter(use_nr == 1) |>
left_join(sr$cultures, join_by(pNbr, use_nr)) |>
select(use_nr, culture_de)
#> # A tibble: 1 × 2
#> use_nr culture_de
#> <int> <chr>
#> 1 1 Knollensellerie
# Show target pests for use number 1
boxer_uses |>
filter(use_nr == 1) |>
left_join(sr$pests, join_by(pNbr, use_nr)) |>
select(use_nr, pest_de)
#> # A tibble: 2 × 2
#> use_nr pest_de
#> <int> <chr>
#> 1 1 Einjährige Dicotyledonen (Unkräuter)
#> 2 1 Einjährige Monocotyledonen (Ungräser)
# Show obligations for use number 1
boxer_uses |>
filter(use_nr == 1) |>
left_join(sr$obligations, join_by(pNbr, use_nr)) |>
select(use_nr, sw_runoff_points, obligation_de) |>
knitr::kable() |>
print()
#>
#>
#> | use_nr| sw_runoff_points|obligation_de |
#> |------:|----------------:|:-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
#> | 1| NA|Nachbau anderer Kulturen: 16 Wochen Wartefrist. |
#> | 1| NA|Nachfolgearbeiten in behandelten Kulturen: bis 48 Stunden nach Ausbringung des Mittels Schutzhandschuhe + Schutzanzug tragen. |
#> | 1| NA|Maximal 1 Behandlung pro Kultur. |
#> | 1| NA|Ansetzen der Spritzbrühe: Schutzhandschuhe tragen. Ausbringen der Spritzbrühe: Schutzhandschuhe + Schutzanzug + Visier + Kopfbedeckung tragen. Technische Schutzvorrichtungen während des Ausbringens (z.B. geschlossene Traktorkabine) können die vorgeschriebene persönliche Schutzausrüstung ersetzen, wenn gewährleistet ist, dass sie einen vergleichbaren oder höheren Schutz bieten. |
#> | 1| 1|SPe 3: Zum Schutz von Gewässerorganismen muss das Abschwemmungsrisiko gemäss den Weisungen der Zulassungsstelle um 1 Punkt reduziert werden. |
#> | 1| NA|Splitbehandlung gemäss den Angaben der Bewilligungsinhaberin (max. 3 l/ha je Split, angegebene Aufwandmenge entspricht total bewilligter Menge). |
#> | 1| NA|Phytotoxschäden bei empfindlichen Arten oder Sorten möglich; vor allgemeiner Anwendung Versuchspritzung durchführen. |
#> | 1| NA|Bewilligt als geringfügige Verwendung nach Art. 35 PSMV (minor use). |
# Show application comments for use number 1
boxer_uses |>
filter(use_nr == 1) |>
left_join(sr$application_comments, join_by(pNbr, use_nr)) |>
select(use_nr, application_comment_de)
#> # A tibble: 1 × 2
#> use_nr application_comment_de
#> <int> <chr>
#> 1 1 7 Tage nach dem Pflanzen.