Skip to content

Probability

Shared vocabulary for probability gates.

A probability gate thins a priority-allocation group by a per-geo-unit rate read from one or more CSV files. The distributor loads the files and the filtering manager reads the result, so the cache identity and the error type live here rather than in either of them.

ProbabilityConfigError

Bases: Exception

A probability_config block is unusable: bad keys, files or columns.

Source code in may/venue_distributor/probability.py
22
23
class ProbabilityConfigError(Exception):
    """A probability_config block is unusable: bad keys, files or columns."""

probability_cache_key(prob_config)

Cache identity of a probability lookup: its files plus the column read.

Built from the raw config values so the distributor (which loads) and the filtering manager (which reads) cannot drift apart.

Source code in may/venue_distributor/probability.py
26
27
28
29
30
31
32
33
34
def probability_cache_key(prob_config):
    """
    Cache identity of a probability lookup: its files plus the column read.

    Built from the raw config values so the distributor (which loads) and the
    filtering manager (which reads) cannot drift apart.
    """
    paths = as_path_list(prob_config.get('file_path'), "probability_config.file_path")
    return (tuple(paths), prob_config.get('probability_column'))