src.testing.testing_models

PCR testing model for sid.

Module Contents

Functions

demand_test(states, params, seed, share_of_tests_for_symptomatics_series)

Test demand function.

_calculate_test_demand_from_share_known_cases(states, share_known_cases, share_of_tests_for_symptomatics)

Calculate test demand governed by share known cases.

_calculate_test_demand_from_rapid_tests(states, share_requesting_confirmation)

Calculate test demand for the confirmation of rapid tests.

allocate_tests(n_allocated_tests, demands_test, states, params, seed)

Allocate tests to individuals who demand a test.

process_tests(n_to_be_processed_tests, states, params, seed)

Process tests.

demand_test(states, params, seed, share_of_tests_for_symptomatics_series)[source]

Test demand function.

Contrary to the name this function combines test demand and test allocation.

Parameters
  • states (pandas.DataFrame) – The states of the individuals.

  • params (pandas.DataFrame) – A DataFrame with parameters. It needs to contain the entry (“test_demand”, “symptoms”, “share_symptomatic_requesting_test”).

  • seed (int) – Seed for reproducibility.

  • share_of_tests_for_symptomatics_series (pandas.Series) – Series with date index that indicates the share of positive tests that discovered a symptomatic case.

Returns

An array or a series

which contains the probability for each individual demanding a test.

Return type

demand_probability (numpy.ndarray, pandas.Series)

_calculate_test_demand_from_share_known_cases(states, share_known_cases, share_of_tests_for_symptomatics)[source]

Calculate test demand governed by share known cases.

The share_known_cases together with the number of newly infected individuals determines how many positive tests are needed.

The share_of_tests_for_symptomatics determines how many of those are requested by symptomatic individuals. The remainder is requested by non-symptomatic infected individuals.

Parameters
  • states (pandas.DataFrame) – sid states DataFrame.

  • share_known_cases (float) – The share of cases that is detected via PCR tests.

  • share_of_tests_for_symptomatics (float) – The share of positive tests that discovered a symptomatic case.

Returns

Boolean Series that is True for people who demand a test.

Return type

pd.Series

_calculate_test_demand_from_rapid_tests(states, share_requesting_confirmation)[source]

Calculate test demand for the confirmation of rapid tests.

People demand a pcr confirmation of a rapid test on the first day after receiving it or not at all.

Parameters
  • states (pandas.DataFrame) – sid states DataFrame.

  • share_requesting_confirmation (float) – The share of people that requests a PCR test after a positive rapid test.

Returns

Boolean Series that is True for people who demand a test.

Return type

pd.Series

allocate_tests(n_allocated_tests, demands_test, states, params, seed)[source]

Allocate tests to individuals who demand a test.

Excess and insufficient demand are handled in the demand function, so this is the identity function.

Parameters
  • n_allocated_tests (int) – The number of individuals who already received a test in this period from previous allocation models.

  • demands_test (pandas.Series) – A series with boolean entries where True indicates individuals asking for a test.

  • states (pandas.DataFrame) – The states of the individuals.

  • params (pandas.DataFrame) – A DataFrame with parameters.

Returns

An array or a

series which indicates which individuals received a test.

Return type

allocated_tests (numpy.ndarray, pandas.Series)

process_tests(n_to_be_processed_tests, states, params, seed)[source]

Process tests.

For simplicity, we assume that all tests are processed immediately, without further delay and without a capacity constraint.

When tests are processed, sid starts the test countdowns which we take from the RKI data (see https://tinyurl.com/2urakgwa for details) which reports the data from taking the test sample to notifying the subject of his/her result. This aligns well with our test demand function assigning test demand to symptomatic individuals and currently infectious individuals (starting with sid commit d9185a8).

Parameters
  • n_to_be_processed_tests (int) – Number of individuals whose test is already set to be processed.

  • states (pandas.DataFrame) – The states of the individuals.

  • params (pandas.DataFrame) – A DataFrame with parameters.

Returns

An array or series

with boolean entries indicating which tests started to be processed.

Return type

started_processing (numpy.ndarray, pandas.Series)