Skip to content

[BE] Customisable stages in cycle analytics

Problem to solve

Currently the stages (default stages) in cycle analytics are expressed as code and customization of these stages by the user is not possible. Each stage has its own class and logic for calculating median and loading relevant records.

In 12196 backend should be able to persist custom stages. A stage consists of mainly 3 things:

  • Name of the event
  • Start event
  • End event

Note: In some cases an event can take an additional label record.

Cycle analytics is also elevated to the group level which means we should be able to load data for a specific group or project.

Requirements

Database

  • Tables for persisting stage configuration (for a group, for a project so we won't use polymorphic tables)

Application

  • Implement a query that can take a start event and end event pair to load:
    • Median
    • List of records
    • Data for the scatterplot chart
  • Express all supported events as code
  • Migrate default stages to follow the start event and end event structure
  • Stages should be positionable, use the RelativePositiong module

API

  • Update the API endpoints to use data from the DB tables
  • Implement new API endpoints for creating, updating, deleting a stage