7. Presets

A preset defines a set of filters and projections that need to be applied to the datatable for a particular view. Presets can be predefined by the system administrator and shared with users. This approach allows users to quickly get at standard reports, and further explore them by adding additional filters and projections on top of the already defined ones in the view.

Presets are presented in a hierarchical menu. The preset configuration defines:

  • the human readable name of a preset and its description

  • what filters are active and with what values

  • what projections are active and using what sortorder

  • what type of view (flat, group or pivot) and additional attributes for that view

  • what preset category it belongs to

It is important to stress that programmatically defined views are installed to a users’ configuration in the database at account creation time. Changes to config/presets will only be seen by users after the new views have been pushed to the users’ in database configuration.

7.1. General structure

Presets are defined in the configuration directory under presets as yaml files. Consider the following directory structure:

Directory

Description

config/presets

Repository for all filter definitions.

config/presets/categories.yaml

Definition of the available categories.

config/presets/0001_name.yaml

A single preset definition.

config/presets/default.yaml

Definition of the default preset

7.2. Category definition

Presets are organized in the UI in categories. Categories are defined as a dictionary, where each dictionary key points to a category definition. The category definition can have these attributes:

  • name – presentation name as displayed to the end-user.

  • description – presentation description as displayed to the end-user.

  • level – integer, position in the hierarchy, starts at 0.

  • parent – when a category is a child, the parent of this child.

  • locked – boolean indicating that this view definition cannot be modified by the end-user. The locked nature is also to select views for updating when a system administrator refreshes system views for a particular user.

7.2.1. Category definition example

preset_categories:
  predefined:
    name: Predefined
    description: Predefined presets
    level: 0
    parent: null
    locked: true
  userdefined:
    name: Userdefined
    description: Userdefined presets
    level: 0
    parent: null
    locked: false
  dashboard:
    name: Dashboard presets
    description: Dashboard presets
    level: 1
    parent: predefined
    locked: true
  ineen:
    name: InEen Benchmark 2014
    description: InEen Benchmark over 2014
    level: 1
    parent: predefined
    locked: true
  ineendiab:
    name: Diabetes 2014
    description: Diabetes 2014
    level: 2
    parent: ineen
    locked: true

7.3. Preset definition

The following attributes may be used in a preset definition:

  • name – presentation name as displayed to the end-user.

  • description – presentation description as displayed to the end-user.

  • category – view category, a string referencing the category as defined in the previous section.

  • filters – a dictionary that states for all active filter id s their selected values. As a special case the string most_recent can be used to select the most recent value as returned by a distinctlist filter.

For the projection definitions one of three attributes must be used:

  • flattable – indicating that this view is a flat table without further aggregations. This is a dictionary with the following members:

    • order – an array defining the active projections.

    • sortorder – an array of tuples that defines the sortorder for a projection id. Note that only those projections that need a sort order need to be named here.

  • group – this view is a group by. The dictionary has the following members:

    • datafields – an array of tuples that defines the (projection, aggregation) to be used

    • fields – an array that defines the projections to be grouped by. These will end up as individual rows with the defined fields as first columns shown in the row.

    • sortorder – active sort order, as defined above.

    • groupfractions – a dictionary defining the active group fractions. When considering a population partitioned over a number of groups, this shows per group what percentage of the total is represented here considering an additional group filter. So for example when considering an arbitrary grouping of patients, group filters can be used to return the percentage of patients with gender Male in a particular group.

    • groupfractionorder – an array defining the order in which groupfractions are shown.

  • pivot – this view is a group by, further partitioned over a set of (column) values. This dictionary has the following members:

    • rows – an array defining the projections to group rows on.

    • columns – an array defining the projections to group columns on. Note that each projection here is evaluated per row.

    • datafields – an list of tuples defining the projections and aggregates to show in a row/column junction.

    • groupfractions, groupfractionorder – defined as for group.

7.3.1. Preset flattable example

preset:
  name: Patientenlijst diabetes
  ref: PATIENT_OVERVIEW_DIAB
  description: Overzicht van actieve eerstelijns diabetespatienten
  category: predefined
  public: true
  filters:
    pp_type_diabetes:
    - General Practitioner
    reference_date:
    - Meest recent
  filterorder:
  - reference_date
  - pp_type_diabetes
  flattable:
    groupfractionorder: []
    groupfractions: {}
    order:
    - preferencedate
    - ppatientnumber
    - ppatientname
    - ppatient_birthdate
    - pgender
    - ppp_name_diabetes
    sortorder:
    - - ppatientname
      - ASC

7.3.2. Preset group example

preset:
  name: '1-4: aantal patienten per keten'
  ref: DB_PPKETEN
  description: ''
  category: dashboard
  public: true
  filters:
    reference_date:
    - Meest recent
  filterorder:
  - reference_date
  group:
    datafields: []
    fields:
    - preferencedate
    groupfractionorder:
    - pp_type_diabetes
    - pp_type_copd
    - pp_type_cvrm
    - pp_type_elca
    groupfractions:
      pp_type_copd:
      - General Practitioner
      pp_type_cvrm:
      - General Practitioner
      pp_type_diabetes:
      - General Practitioner
      pp_type_elca:
      - General Practitioner
    sortorder: []

7.3.3. Preset pivot example

preset:
  name: '14, 16, 17, 18: verloop voetcontrole, hba1c, bloedd, ldl zorggroep vs praktijk'
  ref: DB_VERZP
  description: ''
  category: dashboard
  public: true
  filters:
    pp_type_diabetes:
    - General Practitioner
  filterorder:
  - pp_type_diabetes
  pivot:
    columns:
    - preferencedate
    datafields:
    - - phba1c
      - avg
    - - psystolic_bloodpressure
      - avg
    - - pldl_cholesterol
      - avg
    groupfractionorder:
    - date_last_foot_examination
    groupfractions:
      date_last_foot_examination:
      - <1 year
    rows:
    - ppp_orga_name_diabetes

7.4. Default definition

The default preset defines what preset should be displayed when the explorer is opened. This default uses the ref attribute to point to like so:

default_preset: PATIENT_OVERVIEW_DIAB