MCPcopy Create free account
hub / github.com/Flagsmith/flagsmith / compute_results_summary

Function compute_results_summary

api/experimentation/services.py:315–334  ·  view source on GitHub ↗

Gather an experiment's metric statistics from the warehouse and reduce them to the stored results payload.

(
    experiment: "Experiment",
    *,
    window_start: "datetime",
    window_end: "datetime",
)

Source from the content-addressed store, hash-verified

313
314
315def compute_results_summary(
316 experiment: "Experiment",
317 *,
318 window_start: "datetime",
319 window_end: "datetime",
320) -> ResultsSummary:
321 """Gather an experiment's metric statistics from the warehouse and reduce
322 them to the stored results payload."""
323 specs = _experiment_metric_specs(experiment)
324 aggregates = get_metric_variant_stats(
325 environment_key=experiment.environment.api_key,
326 feature_name=experiment.feature.name,
327 window_start=window_start,
328 window_end=window_end,
329 specs=specs,
330 )
331 return build_results_summary(
332 aggregates,
333 expected_shares=_expected_variant_shares(experiment),
334 )
335
336
337def _experiment_metric_specs(experiment: "Experiment") -> list[MetricSpec]:

Callers 1

Calls 4

_experiment_metric_specsFunction · 0.85
get_metric_variant_statsFunction · 0.85
build_results_summaryFunction · 0.85
_expected_variant_sharesFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…