ChemPal Documentation - v1.6.0
    Preparing search index...

    Module helpers/supplierStats

    Types - Helpers

    StatsRange

    Selectable window for the stats views.

    STATS_RANGES

    Ordered range options for the dropdown, each with its i18n label key. Ordered widest-to-narrowest so the default (all) sits first.

    SupplierHealthStatus

    Health verdict for one supplier over the selected range.

    SupplierTotals

    The per-supplier counters the classifier reads.

    Functions - Helpers

    toDateKey

    Formats a date as the YYYY-MM-DD key used by the stats store, in the viewer's local time. These buckets are user-facing — "today" and the daily chart's axis have to mean the user's day, not UTC's — so the store keys off this too, keeping recording and filtering on the same calendar.

    filterStatsByRange

    Narrows recorded stats to the days falling inside a range. Because the store keys days as zero-padded YYYY-MM-DD, lexicographic comparison is equivalent to chronological comparison, so no date parsing is needed per key.

    statusLabelKey

    Returns the i18n key for a health status label.

    classifySupplierHealth

    Classifies a supplier's connection and parsing health from its totals.

    Stats - Constants

    EXCESSIVE_RATIO

    Failure share at or above which a category counts as "excessive". Below this a supplier is treated as healthy — occasional failures are normal. Total failure (a ratio of 1) escalates to the critical status for that category.