Metrics

Below is an example configuration of a panel using the Metrics module:

{
    "width": 12,
    "height": 180,
    "full_row": True,
    "url_name": "frame_empty_frame",
    "url_action_name": "metrics_survey",
    "content": {
        "view": custom_views.MonitorMetrics,
        "view_params": {
            "model": custom_models.Monitor,
            "group_by": ["survey", "surveygroup__name"],
            "aggregations": [
                {
                    "function": "Count",
                    "value": "id",
                },  # annotation
            ],
        },
    },
},

The view_params are:

  • model the model this table is based on

  • group_by and order_by determine how the data is organized.

  • aggregations specify how to summarize the data (e.g., counting records).

The custom_views can be defined as followed:

This custom_views can generate the card with the surveys and survey group.

Formatting You can use formatting functions from str_utils for nicer visuals.

Last updated