Skip to content

Filters for report data, similar to time range #3781

@sleidig

Description

@sleidig

As a user I want to select a category/location from a dropdown filter, similar to the list filters, in order to narrow down the range of a report in addition to a time range.

Objective
Sometimes users need a report on a subset of data, e.g. just for one of their programs / locations / risk categories. It would be useful to have flexible filters for the data going into one report, similar to how users can filter the lists already. Filtering of data is already supported with a time range. Extend this to support any kind of field.

Proposed Solutions & Alternatives
The time range placeholders are already configurable in the transformations property of the ReportConfig entity:

/**
* (sql v2 only) transformations that are applied to input variables (e.g. startDate, endDate)
* example: {startDate: ["SQL_FROM_DATE"], endDate: ["SQL_TO_DATE"]}
*/
@DatabaseField() transformations: {
[key: string]: string[];
};

This is slightly confusing (maybe we can simplify the config structures?). But it works well in making the $startDate placeholders available to use within the SQL string. Similarly, we should allow additional params here.

The filter params need to link to a schema field, so that we can show a user-friendly filter dropdown, e.g. with the given enum-options for that field.

This will need changes to Frontend and Backend.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Status: Ideato be considered and discussed - don't start work yet

    Projects

    Status

    Postponed / On Hold

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions