onix.reporting.reports module

Methods for generating various reports

onix.reporting.reports.generate_usage_stats(reporting_dao, species_lookup, month, metagame, baseline=1630.0, min_turns=3, unknown_species_handling='raise')[source]

Generate a usage stats report

Parameters:
  • reporting_dao (dao.ReportingDAO) – access object used to grab usage data
  • species_lookup (dict) – mapping of species names or forme-concatenations to their display names. This is what handles things like determing whether megas are tiered together or separately or what counts as an “appearance-only” forme.
  • month (str) – the month to analyze in the format ‘YYYY-MM’
  • metagame (str) – the sanitized name of the metagame
  • baseline (float, optional) –

    the baseline to use for weighting. Defaults to 1630.

    Note

    a baseline of zero corresponds to unweighted stats

  • min_turns (int, optional) – don’t count any battles fewer than this many turns in length. Defaults value is 3.
  • unknown_species_handling (str, optional) –

    The strategy for handling unknown species/formes. Options are:

    • “raise” : raise a KeyError
    • “guess” : ‘guess’ at an appropriate name by title-casing it

    Defaults to “raise”

Returns:

the usage stats report, ready for printing to stdout or saving to file

Return type:

str

Raises:
  • KeyError – if an unknown species is encountered and the strategy is set to “raise”
  • ValueError – if an unknown species is encountered and the strategy is not recognized