Skip to contents

Calculates the risk of introduction for each epidemiological unit based on the risk of emission of neighbouring countries. The score is weighted based on the length of shared borders.

Usage

calc_border_risk(epi_units, shared_borders, emission_risk)

Arguments

epi_units

epidemiological units dataset

shared_borders

shared borders dataset as outputted by calc_border_lengths()

emission_risk

emission risk dataset,

Value

An sf object containing the border risk score associated with each epidemiological unit. The table is containing the following columns:

  • eu_id: ID of the epidemiological unit. This will be used as a join key to the epi_units table and risk_table.

  • eu_name: Name of the epidemiological unit. This comes from the epi_units table.

  • borders: Total length of shared borders with neighbouring countries in km.

  • border_risk: The risk of introduction based on the emission risk of neighbouring countries, its values are in the range [0, 12].

  • geometry: The geometry column containing the shared border, a MULTIPOLYGON.

This dataset also has a number of attributes, the first is a dataset, the other 3 are used in other functions from riskintroanalysis to make passing dataset metadata between functions more user-friendly.

  1. borders: an sf object containing shared borders between EUs and bordering countries. The table is containing the following columns:

    • eu_id: ID of the epidemiological unit.

    • bc_id: ISO3 of the bordering country.

    • border_length: Length of the shared border, use units::units to get the units. It is expected in km.

    • geometry: The geometry column containing the shared border, a MULTILINESTRING or a LINESTRING.

  2. table_name = "border_risk": the name of the table in the riskintroanalysis data model. This is used by other functions in riskintroanalysis, such as plot_risk.

  3. risk_col = "border_risk": the name of the risk score column in the dataset. This is used by other functions in riskintroanalysis, such as plot_risk.

  4. scale = c(0,12): the scale of risk_col used for other functions such as rescale_risk_score and plot_risk.

Examples



# \donttest{

library(sf)
library(dplyr)

tunisia_raw <- sf::read_sf(system.file(
  package = "riskintrodata",
  "samples", "tunisia", "epi_units", "tunisia_adm2_raw.gpkg"
))

# Apply mapping to prepare colnames and validate dataset
tunisia <- apply_mapping(
  tunisia_raw,
  mapping = mapping_epi_units(
    eu_name = "NAME_2",
    geometry = "geom"
  ),
  validate = TRUE
)
#>  All data in "epi_units" valided.

# Run function to get shared borders
shared_borders <- calc_border_lengths(
  epi_units = tunisia
)

wahis_factors <- riskintrodata::get_wahis_erf(
  disease = "Anthrax",
  species = "Cattle",
  animal_category = "Domestic"
)
#>  All data in "emission_risk_factors" valided.
#>  WAHIS emission risk factors dataset has 65 entries for `disease = Anthrax`, `species = Cattle`, and `animal_category = Domestic`.

emission_risk_table <- calc_emission_risk(wahis_factors)

ri_border <- calc_border_risk(
  epi_units = tunisia,
  shared_borders = shared_borders,
  emission_risk = emission_risk_table
)
ri_border
#> Simple feature collection with 268 features and 4 fields
#> Geometry type: GEOMETRY
#> Dimension:     XY
#> Bounding box:  xmin: 7.530076 ymin: 30.23681 xmax: 11.59826 ymax: 37.55986
#> Geodetic CRS:  WGS 84
#> # A tibble: 268 × 5
#>    eu_id    eu_name            borders border_risk                      geometry
#>    <chr>    <chr>                <dbl>       <dbl>                <GEOMETRY [°]>
#>  1 eu-00001 Ariana Médina           NA           0 POLYGON ((10.13862 36.89432,…
#>  2 eu-00002 Ettadhamen              NA           0 POLYGON ((10.05623 36.84281,…
#>  3 eu-00003 Kalaat El Andalous      NA           0 MULTIPOLYGON (((10.13862 36.…
#>  4 eu-00004 Mnihla                  NA           0 POLYGON ((10.13109 36.88332,…
#>  5 eu-00005 Raoued                  NA           0 POLYGON ((10.17025 36.88844,…
#>  6 eu-00006 Sebkhet Ariana          NA           0 POLYGON ((10.27149 36.88916,…
#>  7 eu-00007 Sidi Thabet             NA           0 POLYGON ((10.00166 36.99815,…
#>  8 eu-00008 Soukra                  NA           0 POLYGON ((10.20232 36.85612,…
#>  9 eu-00009 Amdoun                  NA           0 POLYGON ((9.136977 36.87276,…
#> 10 eu-00010 Béja Nord               NA           0 POLYGON ((9.091034 36.70194,…
#> # ℹ 258 more rows

border_lines <- extract_border(ri_border)
border_lines
#> Simple feature collection with 17 features and 9 fields
#> Geometry type: GEOMETRY
#> Dimension:     XY
#> Bounding box:  xmin: 7.530076 ymin: 30.23681 xmax: 11.59826 ymax: 36.91043
#> Geodetic CRS:  WGS 84
#> # A tibble: 17 × 10
#>    eu_id    bc_id border_length                          geometry weight country
#>    <chr>    <chr>         <dbl>                    <GEOMETRY [°]>  <dbl> <chr>  
#>  1 eu-00061 DZA            45.7 LINESTRING (8.130428 34.52643, 8…  1     NA     
#>  2 eu-00065 DZA            51.1 MULTILINESTRING ((8.486515 36.69…  1     NA     
#>  3 eu-00068 DZA            10.4 LINESTRING (8.448809 36.62249, 8…  1     NA     
#>  4 eu-00069 DZA            73.6 MULTILINESTRING ((8.309212 36.43…  1     NA     
#>  5 eu-00087 DZA            42.4 MULTILINESTRING ((8.272714 34.86…  1     NA     
#>  6 eu-00088 DZA            48.9 MULTILINESTRING ((8.314248 35.31…  1     NA     
#>  7 eu-00090 DZA            17.5 LINESTRING (8.388037 35.48045, 8…  1     NA     
#>  8 eu-00094 DZA            13.5 LINESTRING (8.296709 34.74977, 8…  1     NA     
#>  9 eu-00099 DZA           126.  LINESTRING (8.354745 32.52821, 8…  1     NA     
#> 10 eu-00107 DZA            44.2 LINESTRING (8.360878 35.63451, 8…  1     NA     
#> 11 eu-00112 DZA            53.2 LINESTRING (8.291536 35.95223, 8…  1     NA     
#> 12 eu-00133 LBY           130.  LINESTRING (11.56026 33.15514, 1…  1     NA     
#> 13 eu-00229 LBY           143.  MULTILINESTRING ((10.61585 31.84…  1     NA     
#> 14 eu-00231 DZA           293.  LINESTRING (9.557298 30.23681, 9…  0.625 NA     
#> 15 eu-00231 LBY           176.  LINESTRING (10.13751 31.47516, 1…  0.375 NA     
#> 16 eu-00236 DZA            85.0 LINESTRING (7.753589 33.42955, 7…  1     NA     
#> 17 eu-00238 DZA            86.5 LINESTRING (7.587045 34.09025, 7…  1     NA     
#> # ℹ 4 more variables: data_source <chr>, emission_risk <dbl>,
#> #   border_risk <dbl>, border_label <list>
# }