admin
2025-01-22 7e31442f0e9b07764e9c6a9680d3d4aeba5fe1de
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
Quintiq file version 2.0
#parent: #root
Method GetSeverityScaleForLowerThresholdViolation () as owning LibOpt_StatisticSeverityScale
{
  Description: 'Return the `LibOpt_StatisticSeverityScale` which holds `LibOpt_StatisticSeverityScaleEntrys` of (`LibOpt_StatisticSeverityScaleEntry.Threshold`, `LibOpt_StatisticSeverityScaleEntry.Severity`) values, which determines what `Severity` to set for a `LibOpt_Issue` that violates the `LowerThreshold` of this `LibOpt_Statistic`.'
  TextBody:
  [*
    // To be overridden in subclasses which:
    // - `LibOpt_Issues` are created based on the `LowerThreshold` of this statistic, and
    // - `Severity` for `LibOpt_Issues` are to be derived from a certain scale, rather than using a fixed value.
    
    /*
    If the criteria above is applicable for your statistic, then refer to the example below as to how to construct your *severity scale*.
        
    EXAMPLE OF *LOWER THRESHOLD* VIOLATION SCALE [Ref. 1]
    
          ----------------------------
          |  THRESHOLD  |  SEVERITY  |
          ----------------------------
    (i)   |      15     |      1     |
          ----------------------------
    (ii)  |       5     |      3     |
          ----------------------------
    (iii) |       1     |      5     |
          ----------------------------
    
    - The *lower* the `Threshold` violated by the value of a `LibOpt_Issue` of this statistic, the *higher* the `Severity` to set for the issue.
      Using the the scale in [Ref. 1], the expected `Severity` for some examples are shown below:
      - Value of issue =  15   -->   Severity = 1
      - Value of issue =  10   -->   Severity = 2    // 1 + ( 3 - 1 ) * ( ( 10 - 15 ) / ( 5 - 15 ) )
      - Value of issue =   1   -->   Severity = 5
      - Value of issue =   0   -->   Severity = 5
    
    - The logic that uses the "severity scale" defined here relies on the following ASSUMPTIONS:
      (** If any of the ASSUMPTIONS is violated, then the scale might not work as expected. **)
      - The `Severity` values should be within the inclusive range of [ `LibOpt_Issue::Severity_1_Min()`, `LibOpt_Issue::Severity_5_Max()` ].
      - No duplicate entries of `Threshold` or `Severities`.
      - The trend of `Threshold` of entries should be *descending* while the trend of `Severity` of entries should be *ascending*.
    
    -----------------------------------------------------------------------------------------------------------------------------------------------------
    
    CODE EXAMPLE:
    
    >>>>
    severityscale := construct( LibOpt_StatisticSeverityScale );
    
    severityscale.Entry( relnew,
                         Threshold := this.LowerThreshold(),
                         Severity := LibOpt_Issue::Severity_1_Min()
                       );
    
    severityscale.Entry( relnew,
                         Threshold := <Lower Threshold Corresponding With Max Severity>,
                         Severity := LibOpt_Issue::Severity_5_Max()
                       );
    
    return &severityscale;
    <<<<
    
    NOTE:
      For the <Lower Threshold Corresponding With Max Severity> part, check out the
      `LibOpt_StatisticSummary::GetLowerThresholdCorrespondingWithMaxSeverityBasedOnOutlierThreshold` helper method to see if it suits your statistic.
      If so, you can use `this.Summary().GetLowerThresholdCorrespondingWithMaxSeverityBasedOnOutlierThreshold()` for that part.
    */
    
    return null( LibOpt_StatisticSeverityScale, owning );
  *]
}