Misc

Overview Structs

Overview Functions

AGS

Constructors

GEMS.AGSType
AGS

Struct to represent Germany's Community Identification Number (Amtlicher Gemeindeschlüssel).

Taken from Wikipedia (https://en.wikipedia.org/wiki/Community_Identification_Number):

The municipality key consists of eight digits, which are generated as follows: The first two digits designate the individual German state. The third digit designates the government district (in areas without government districts a zero is used instead). The fourth and fifth digits designate the number of the urban area (in a district-free city) or the district (in a city with districts). In GEMS they are called 'counties'. The sixth, seventh, and eighth digits indicate the municipality or the number of the unincorporated area.

Example

münster = AGS("05515000")

The above code generates the community identification number for the city of Münster.

  • The first two digits identify the state of North Rhine-Westphalia (05)
  • The third digit identifies the government district Münster (5)
  • The fourth and fifth digit identify the district-free city of Münster (15)

Being a district-free city, Münster does not have a municipality code. Examples for municipalities are: Emsdetten (05566008), Warendorf (05570052), or Steinfurt (05566084).

There are multiple helper functions to navigate through the hierarchical AGS structure such as: state, district, county, or municiaplity which each return the AGS of the respective geographic level. The is_state, is_district, and is_county return true, if the provided AGS is on the respective geographic level. Moreover, in_state, in_district, and in_county verify whether a provided AGS is contained in a parent region.

AGS are directly comparable (==) and broadcastable (.==).

Note:

There is no is_municiaplity function as this could be confused as a check wether the AGS is on the lowest geographic level. However, as there are district-free cities which are technically municipalities but without the last three digits given, this check could only be done with context information on the actual region. Based purely on the number, we do not know which county has contains municipalites and which conty is a district-free city.

Functions

GEMS.countyMethod
county(ags::AGS)

Returns the parent county's Community Identification Number (AGS) of the provided AGS.

GEMS.districtMethod
district(ags::AGS)

Returns the parent district's Community Identification Number (AGS) of the provided AGS.

GEMS.idMethod
id(ags::AGS)

Retuns the AGSs internal number (int).

GEMS.in_countyMethod
in_county(ags::AGS, parent::AGS)

Returns true if the county-section of both Community Identification Numbers (AGS) match. Both AGSs are in the same county.

GEMS.in_districtMethod
in_district(ags::AGS, parent::AGS)

Returns true if the district-section of both Community Identification Numbers (AGS) match. Both AGSs are in the same district.

GEMS.in_stateMethod
in_state(ags::AGS, parent::AGS)

Returns true if the state-section of both Community Identification Numbers (AGS) match. Both AGSs are in the same state.

GEMS.is_countyMethod
is_district(ags::AGS)

Returns true if the Community Identification Number (AGS) belongs to a conty. First five digits given, last three being 0s.

GEMS.is_districtMethod
is_district(ags::AGS)

Returns true if the Community Identification Number (AGS) belongs to a governmental district. First three digits given, everything else being 0s.

GEMS.is_stateMethod
is_state(ags::AGS)

Returns true if the Community Identification Number (AGS) belongs to a state. First two digits given, everything else being 0s.

GEMS.isunsetMethod
isunset(ags::AGS)

Returns true if the AGS is the "empty" default and does not actually belongs to a any geographic region.

GEMS.municipalityMethod
municipality(ags::AGS)

Returns the Community Identification Number (AGS) regardless of its geographic level.

GEMS.stateMethod
state(ags::AGS)

Returns the parent state's Community Identification Number (AGS) of the provided AGS.

Age Group

Constructors

GEMS.AgeGroupType
AgeGroup

A struct representing an age group with minimum and maximum ages. At least one of minage or maxage must be provided. If minage is nothing, there is no lower bound. If maxage is nothing, there is no upper bound.

Examples

julia> AgeGroup(0, 10)  # Represents ages 0 to 10 inclusive
AgeGroup(0-10)
julia> AgeGroup(nothing, 18)  # Represents ages up to 18 inclusive
AgeGroup(0-18)
julia> AgeGroup(65, nothing)  # Represents ages 65 and above
AgeGroup(65-Inf)
julia> AgeGroup("-10")  # Represents ages 0 to 10 inclusive
AgeGroup(0-10)
julia> AgeGroup("10-20")  # Represents ages 10 to 20 inclusive
AgeGroup(10-20)
julia> AgeGroup("65-")  # Represents ages 65 and above
AgeGroup(65-Inf)

Functions

GEMS.in_groupFunction
in_group(age::Real, group::AgeGroup)

Returns true if age is in the specified age group. The minimum and maximum ages are inclusive.

Examples

julia> group = AgeGroup(0, 10)
julia> in_group(5, group)
true
julia> in_group(0, group)
true
julia> in_group(10, group)
true
julia> in_group(-1, group)
false
GEMS.check_continuityFunction
check_continuity(age_groups::Vector{AgeGroup}, min_age::Int64, max_age::Int64)

Checks if the provided age groups cover all ages between minage and maxage without gaps or overlaps. Throws an ArgumentError if the age groups are not continuous. Returns true if the age groups are continuous.

Examples

julia> groups = [AgeGroup(0, 10), AgeGroup(11, 20), AgeGroup(21, nothing)]
julia> check_continuity(groups, 0, 100)
true
julia> groups = [AgeGroup(0, 10), AgeGroup(10, 20), AgeGroup(21, nothing)]
julia> check_continuity(groups, 0, 100)
ERROR: ArgumentError: Age groups must not overlap! Age 10 is in 2 groups.
julia> groups = [AgeGroup(0, 10), AgeGroup(12, 20), AgeGroup(21, nothing)]
julia> check_continuity(groups, 0, 100)
ERROR: ArgumentError: Age groups must cover all ages between 0 and 100 without gaps! Age 11 is not covered.

Random Number Generation

GEMS.gems_randFunction
gems_rand(rng::Xoshiro, args...)
gems_rand(sim::Simulation, args...)

Reproducibility-safe version of Random.rand. Always pass a seeded Xoshiro from the simulation object to ensure deterministic results. If the global ENFORCE_SIM_RNGS is set to true, an error is thrown when the global RNG is used. Mainly used for debugging purposes.

GEMS.gems_sampleFunction
gems_sample(rng::Xoshiro, args...; kwargs...)
gems_sample(sim::Simulation, args...; kwargs...)

Reproducibility-safe version of StatsBase.sample. Always pass a seeded Xoshiro from the simulation object to ensure deterministic results. If the global ENFORCE_SIM_RNGS is set to true, an error is thrown when the global RNG is used. Mainly used for debugging purposes.

GEMS.gems_sample!Function
gems_sample!(rng::Xoshiro, args...; kwargs...)
gems_sample!(sim::Simulation, args...; kwargs...)

Reproducibility-safe version of StatsBase.sample!. Always pass a seeded Xoshiro from the simulation object to ensure deterministic results. If the global ENFORCE_SIM_RNGS is set to true, an error is thrown when the global RNG is used. Mainly used for debugging purposes.

GEMS.gems_shuffleFunction
gems_shuffle(rng::Xoshiro, args...)
gems_shuffle(sim::Simulation, args...)

Reproducibility-safe version of Random.shuffle. Always pass a seeded Xoshiro from the simulation object to ensure deterministic results. If the global ENFORCE_SIM_RNGS is set to true, an error is thrown when the global RNG is used. Mainly used for debugging purposes.

GEMS.gems_shuffle!Function
gems_shuffle!(rng::Xoshiro, args...)
gems_shuffle!(sim::Simulation, args...)

Reproducibility-safe version of Random.shuffle!. Always pass a seeded Xoshiro from the simulation object to ensure deterministic results. If the global ENFORCE_SIM_RNGS is set to true, an error is thrown when the global RNG is used. Mainly used for debugging purposes.

GEMS.gems_randnFunction
gems_randn(rng::Xoshiro, args...)
gems_randn(sim::Simulation, args...)

Reproducibility-safe version of Random.randn. Always pass a seeded Xoshiro from the simulation object to ensure deterministic results. If the global ENFORCE_SIM_RNGS is set to true, an error is thrown when the global RNG is used. Mainly used for debugging purposes.

Exceptions

Missing docstring.

Missing docstring for ConfigfileError. Check Documenter's build log for details.

Utils

Missing docstring.

Missing docstring for _int. Check Documenter's build log for details.

GEMS.aggregate_dfFunction
aggregate_df(df::DataFrame, key::Symbol)

Groups dataframes (with numerical values) on the provided key column and applies the aggregate_values function to each of them. The resulting dataframe has all initial columns supplemented with the suffixes min, max, mean, lower_95, upper_95, and std

GEMS.aggregate_dfsFunction
aggregate_dfs(dfs::Vector{DataFrame}, key::Symbol)

Joins the input vector of dataframes on the key and aggregates the residual data. Requires all dataframes to provide the exact same columns and column names.

aggregate_dfs(dfs::Vector{DataFrame}, keys::Vector{Symbol})

Joins the input vector of dataframes on the compound keys and aggregates the residual data. Requires all dataframes to provide the exact same columns and column names.

GEMS.aggregate_dfs_multcolFunction
aggregate_dfs_multcol(dfs::Vector{DataFrame}, key::Symbol)

Aggregates data on the columns of the dataframes contained in the provided vector for each value in the key column. All dataframes must have identical columnnames. Returns a dictionary with the columnnames as keys and a dataframe as the value.

aggregate_dfs_multcol(dfs::Vector{DataFrame}, keys::Vector{Symbol})

Aggregates data on the columns of the dataframes contained in the provided vector for each combination of values in the compound keys columns. All dataframes must have identical columnnames. Returns a dictionary with the columnnames as keys and a dataframe as the value.

Missing docstring.

Missing docstring for foldercount(::AbstractString). Check Documenter's build log for details.

Missing docstring.

Missing docstring for group_by_age(::DataFrame). Check Documenter's build log for details.

Missing docstring.

Missing docstring for prepare_kw_args. Check Documenter's build log for details.

GEMS.print_aggregatesFunction
print_aggregates(agg::Dict{<:Integer, <:Dict}; unit, multiplier, digits)

Pretty-prints per-pathogen aggregate statistics returned by attack_rate or r0 on a BatchProcessor. Each entry in agg maps a pathogen id to a Dict{String, Real} with keys "mean", "std", "min", "max", "lower_95", "upper_95". Pathogens are printed in ascending id order, separated by "; ".

print_aggregates(agg::Dict; unit, multiplier, digits)

Pretty-prints the outcomes of an aggregate_values() function call. agg must have keys "mean", "std", "min", "max", "lower_95", "upper_95".

Missing docstring.

Missing docstring for printinfo(::String). Check Documenter's build log for details.

Missing docstring.

Missing docstring for remove_kw. Check Documenter's build log for details.

Missing docstring.

Missing docstring for subinfo(::String). Check Documenter's build log for details.