From 1032dc563b591c98a0e33a9a0fde6ec4ebf57f5a Mon Sep 17 00:00:00 2001 From: Jack Greenlee Date: Fri, 17 May 2024 15:00:01 -0400 Subject: [PATCH] in generate_summaries, flatten trips if not already flat --- src/emcommon/metrics/metrics_summaries.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/emcommon/metrics/metrics_summaries.py b/src/emcommon/metrics/metrics_summaries.py index e7d50b0..8a15724 100644 --- a/src/emcommon/metrics/metrics_summaries.py +++ b/src/emcommon/metrics/metrics_summaries.py @@ -1,7 +1,7 @@ from __future__ import annotations # __: skip # from util import memoize import emcommon.logger as Logger - +import emcommon.util as util # @memoize def label_for_trip(composite_trip: dict, label_key: str, trip_labels_map: dict[str, any] = None) -> str: @@ -41,7 +41,8 @@ def labeled_purpose_for_trip(composite_trip: dict, trip_labels_map: dict[str, an # @memoize -def generate_summaries(metrics: list[str], composite_trips: list, trip_labels_map: dict[str, any]): +def generate_summaries(metrics: list[str], composite_trips: list, trip_labels_map: dict[str, any] = None): + composite_trips = [util.flatten_db_entry(trip) for trip in composite_trips if 'data' in trip] return {metric: get_summary_for_metric(metric, composite_trips, trip_labels_map) for metric in metrics}