jirametrics 2.0 → 2.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (68) hide show
  1. checksums.yaml +4 -4
  2. data/lib/jirametrics/aggregate_config.rb +19 -26
  3. data/lib/jirametrics/aging_work_bar_chart.rb +79 -54
  4. data/lib/jirametrics/aging_work_in_progress_chart.rb +106 -40
  5. data/lib/jirametrics/aging_work_table.rb +78 -43
  6. data/lib/jirametrics/anonymizer.rb +6 -5
  7. data/lib/jirametrics/blocked_stalled_change.rb +24 -4
  8. data/lib/jirametrics/board.rb +44 -15
  9. data/lib/jirametrics/board_config.rb +8 -4
  10. data/lib/jirametrics/board_movement_calculator.rb +147 -0
  11. data/lib/jirametrics/change_item.rb +31 -10
  12. data/lib/jirametrics/chart_base.rb +102 -61
  13. data/lib/jirametrics/columns_config.rb +4 -0
  14. data/lib/jirametrics/css_variable.rb +33 -0
  15. data/lib/jirametrics/cycletime_config.rb +59 -8
  16. data/lib/jirametrics/cycletime_histogram.rb +69 -4
  17. data/lib/jirametrics/cycletime_scatterplot.rb +11 -15
  18. data/lib/jirametrics/daily_wip_by_age_chart.rb +44 -20
  19. data/lib/jirametrics/daily_wip_by_blocked_stalled_chart.rb +37 -35
  20. data/lib/jirametrics/daily_wip_by_parent_chart.rb +38 -0
  21. data/lib/jirametrics/daily_wip_chart.rb +61 -14
  22. data/lib/jirametrics/data_quality_report.rb +222 -41
  23. data/lib/jirametrics/dependency_chart.rb +54 -23
  24. data/lib/jirametrics/download_config.rb +12 -0
  25. data/lib/jirametrics/downloader.rb +76 -57
  26. data/lib/jirametrics/{story_point_accuracy_chart.rb → estimate_accuracy_chart.rb} +48 -33
  27. data/lib/jirametrics/examples/aggregated_project.rb +22 -39
  28. data/lib/jirametrics/examples/standard_project.rb +25 -49
  29. data/lib/jirametrics/expedited_chart.rb +28 -25
  30. data/lib/jirametrics/exporter.rb +59 -32
  31. data/lib/jirametrics/file_config.rb +34 -13
  32. data/lib/jirametrics/file_system.rb +48 -3
  33. data/lib/jirametrics/flow_efficiency_scatterplot.rb +111 -0
  34. data/lib/jirametrics/groupable_issue_chart.rb +2 -6
  35. data/lib/jirametrics/grouping_rules.rb +7 -1
  36. data/lib/jirametrics/hierarchy_table.rb +4 -4
  37. data/lib/jirametrics/html/aging_work_bar_chart.erb +13 -16
  38. data/lib/jirametrics/html/aging_work_in_progress_chart.erb +28 -5
  39. data/lib/jirametrics/html/aging_work_table.erb +19 -25
  40. data/lib/jirametrics/html/cycletime_histogram.erb +83 -3
  41. data/lib/jirametrics/html/cycletime_scatterplot.erb +9 -12
  42. data/lib/jirametrics/html/daily_wip_chart.erb +17 -13
  43. data/lib/jirametrics/html/{story_point_accuracy_chart.erb → estimate_accuracy_chart.erb} +9 -4
  44. data/lib/jirametrics/html/expedited_chart.erb +10 -13
  45. data/lib/jirametrics/html/flow_efficiency_scatterplot.erb +85 -0
  46. data/lib/jirametrics/html/hierarchy_table.erb +2 -2
  47. data/lib/jirametrics/html/index.css +209 -0
  48. data/lib/jirametrics/html/index.erb +16 -39
  49. data/lib/jirametrics/html/sprint_burndown.erb +10 -14
  50. data/lib/jirametrics/html/throughput_chart.erb +10 -13
  51. data/lib/jirametrics/html_report_config.rb +108 -86
  52. data/lib/jirametrics/issue.rb +357 -96
  53. data/lib/jirametrics/jira_gateway.rb +29 -11
  54. data/lib/jirametrics/project_config.rb +256 -144
  55. data/lib/jirametrics/rules.rb +2 -2
  56. data/lib/jirametrics/self_or_issue_dispatcher.rb +2 -0
  57. data/lib/jirametrics/settings.json +10 -0
  58. data/lib/jirametrics/sprint_burndown.rb +24 -7
  59. data/lib/jirametrics/status.rb +84 -19
  60. data/lib/jirametrics/status_collection.rb +80 -39
  61. data/lib/jirametrics/throughput_chart.rb +12 -4
  62. data/lib/jirametrics/value_equality.rb +2 -2
  63. data/lib/jirametrics.rb +25 -7
  64. metadata +16 -17
  65. data/lib/jirametrics/discard_changes_before.rb +0 -37
  66. data/lib/jirametrics/experimental/generator.rb +0 -210
  67. data/lib/jirametrics/experimental/info.rb +0 -77
  68. data/lib/jirametrics/html/data_quality_report.erb +0 -126
@@ -3,34 +3,58 @@
3
3
  require 'jirametrics/daily_wip_chart'
4
4
 
5
5
  class DailyWipByAgeChart < DailyWipChart
6
+ def initialize block
7
+ super
8
+
9
+ add_trend_line line_color: '--aging-work-in-progress-by-age-trend-line-color', group_labels: [
10
+ 'Less than a day',
11
+ 'A week or less',
12
+ 'Two weeks or less',
13
+ 'Four weeks or less',
14
+ 'More than four weeks'
15
+ ]
16
+ end
17
+
6
18
  def default_header_text
7
19
  'Daily WIP grouped by Age'
8
20
  end
9
21
 
10
22
  def default_description_text
11
23
  <<-HTML
12
- <p>
24
+ <div class="p">
13
25
  This chart shows the highest WIP on each given day. The WIP is color coded so you can see
14
26
  how old it is and hovering over the bar will show you exactly which work items it relates
15
- to. The green bar underneath, shows how many items completed on that day.
16
- </p>
17
- <p>
18
- "Completed without being started" reflects the fact that while we know that it completed
19
- that day, we were unable to determine when it had started. These items will show up in
20
- white at the top. Note that the white is approximate because we don't know exactly when
21
- it started so we're guessing.
22
- </p>
27
+ to. The #{color_block '--wip-chart-completed-color'}
28
+ #{color_block '--wip-chart-completed-but-not-started-color'}
29
+ bars underneath, show how many items completed on that day.
30
+ </div>
31
+ <% if @has_completed_but_not_started %>
32
+ <div class="p">
33
+ #{color_block '--wip-chart-completed-but-not-started-color'} "Completed but not started"
34
+ reflects the fact that while we know that it completed that day, we were unable to determine when
35
+ it had started; it had moved directly from a To Do status to a Done status.
36
+ The #{color_block '--body-background'} shading at the top shows when they might
37
+ have been active. Note that the this grouping is approximate as we just don't know for sure.
38
+ </div>
39
+ <% end %>
40
+ #{describe_non_working_days}
41
+ <div class="p">
42
+ The #{color_block '--aging-work-in-progress-by-age-trend-line-color'} dashed line is a general trend line.
43
+ <% if @has_completed_but_not_started %>
44
+ Note that this trend line only includes items where we know both the start and end times of
45
+ the work so it may not be as accurate as we hope.
46
+ <% end %>
47
+ </div>
23
48
  HTML
24
49
  end
25
50
 
26
51
  def default_grouping_rules issue:, rules:
27
- cycletime = issue.board.cycletime
28
- started = cycletime.started_time(issue)&.to_date
29
- stopped = cycletime.stopped_time(issue)&.to_date
52
+ started, stopped = issue.board.cycletime.started_stopped_dates(issue)
30
53
 
31
54
  rules.issue_hint = "(age: #{label_days (rules.current_date - started + 1).to_i})" if started
32
55
 
33
56
  if stopped && started.nil? # We can't tell when it started
57
+ @has_completed_but_not_started = true
34
58
  not_started stopped: stopped, rules: rules, created: issue.created.to_date
35
59
  elsif stopped == rules.current_date
36
60
  stopped_today rules: rules
@@ -42,11 +66,11 @@ class DailyWipByAgeChart < DailyWipChart
42
66
  def not_started stopped:, rules:, created:
43
67
  if stopped == rules.current_date
44
68
  rules.label = 'Completed but not started'
45
- rules.color = '#66FF66'
69
+ rules.color = '--wip-chart-completed-but-not-started-color'
46
70
  rules.group_priority = -1
47
71
  else
48
72
  rules.label = 'Start date unknown'
49
- rules.color = 'white'
73
+ rules.color = '--body-background'
50
74
  rules.group_priority = 11
51
75
  created_days = rules.current_date - created + 1
52
76
  rules.issue_hint = "(created: #{label_days created_days.to_i} earlier, stopped on #{stopped})"
@@ -55,7 +79,7 @@ class DailyWipByAgeChart < DailyWipChart
55
79
 
56
80
  def stopped_today rules:
57
81
  rules.label = 'Completed'
58
- rules.color = '#009900'
82
+ rules.color = '--wip-chart-completed-color'
59
83
  rules.group_priority = -2
60
84
  end
61
85
 
@@ -65,23 +89,23 @@ class DailyWipByAgeChart < DailyWipChart
65
89
  case age
66
90
  when 1
67
91
  rules.label = 'Less than a day'
68
- rules.color = '#aaaaaa'
92
+ rules.color = '--wip-chart-duration-less-than-day-color'
69
93
  rules.group_priority = 10 # Highest is top
70
94
  when 2..7
71
95
  rules.label = 'A week or less'
72
- rules.color = '#80bfff'
96
+ rules.color = '--wip-chart-duration-week-or-less-color'
73
97
  rules.group_priority = 9
74
98
  when 8..14
75
99
  rules.label = 'Two weeks or less'
76
- rules.color = '#ffd700'
100
+ rules.color = '--wip-chart-duration-two-weeks-or-less-color'
77
101
  rules.group_priority = 8
78
102
  when 15..28
79
103
  rules.label = 'Four weeks or less'
80
- rules.color = '#ce6300'
104
+ rules.color = '--wip-chart-duration-four-weeks-or-less-color'
81
105
  rules.group_priority = 7
82
106
  else
83
107
  rules.label = 'More than four weeks'
84
- rules.color = '#990000'
108
+ rules.color = '--wip-chart-duration-more-than-four-weeks-color'
85
109
  rules.group_priority = 6
86
110
  end
87
111
  end
@@ -9,68 +9,70 @@ class DailyWipByBlockedStalledChart < DailyWipChart
9
9
 
10
10
  def default_description_text
11
11
  <<-HTML
12
- <p>
13
- This chart highlights work that is blocked or stalled on each given day. In Jira terms, blocked
14
- means that the issue has been "flagged". Stalled indicates that the item hasn't had any updates in 5 days.
15
- </p>
16
- <p>
17
- Note that if an item tracks as both blocked and stalled, it will only show up in the flagged totals.
12
+ <div class="p">
13
+ This chart highlights work that is #{color_block '--blocked-color'} blocked,
14
+ #{color_block '--stalled-color'} stalled, or
15
+ #{color_block '--wip-chart-active-color'} active on each given day.
16
+ <ul>
17
+ <li>#{color_block '--blocked-color'} Blocked could mean that the item has been flagged or it's
18
+ in a status that is configured as blocked, or it could have a link showing that it is blocked
19
+ by another item. It all depends how the report has been configured.</li>
20
+ <li>#{color_block '--stalled-color'} Stalled indicates that there has been no activity on this
21
+ item in five days.</li>
22
+ </ul>
23
+ </div>
24
+ <div class="p">
25
+ Note that if an item tracks as both blocked and stalled, it will only show up in the blocked totals.
18
26
  It will not be double counted.
19
- </p>
20
- <p>
21
- The white section reflects items that have stopped but for which we can't identify the start date. As
22
- a result, we are unable to properly show the WIP for these items.
23
- </p>
27
+ </div>
28
+ <% if @has_completed_but_not_started %>
29
+ <div class="p">
30
+ #{color_block '--wip-chart-completed-but-not-started-color'} "Completed but not started"
31
+ reflects the fact that while we know that it completed that day, we were unable to determine when
32
+ it had started; it had moved directly from a To Do status to a Done status.
33
+ The #{color_block '--body-background'} shading at the top shows when they might
34
+ have been active. Note that the this grouping is approximate as we just don't know for sure.
35
+ </div>
36
+ <% end %>
37
+ #{describe_non_working_days}
24
38
  HTML
25
39
  end
26
40
 
27
- def key_blocked_stalled_change issue:, date:, end_time:
28
- stalled_change = nil
29
- blocked_change = nil
30
-
31
- issue.blocked_stalled_changes_on_date(date: date, end_time: end_time) do |change|
32
- blocked_change = change if change.blocked?
33
- stalled_change = change if change.stalled?
34
- end
35
-
36
- return blocked_change if blocked_change
37
- return stalled_change if stalled_change
38
-
39
- nil
40
- end
41
-
42
41
  def default_grouping_rules issue:, rules:
43
- started = issue.board.cycletime.started_time(issue)
44
- stopped_date = issue.board.cycletime.stopped_time(issue)&.to_date
45
- change = key_blocked_stalled_change issue: issue, date: rules.current_date, end_time: time_range.end
42
+ started, stopped = issue.board.cycletime.started_stopped_times(issue)
43
+ stopped_date = stopped&.to_date
44
+
45
+ date = rules.current_date
46
+ change = issue.blocked_stalled_by_date(date_range: date..date, chart_end_time: time_range.end)[date]
46
47
 
47
48
  stopped_today = stopped_date == rules.current_date
48
49
 
49
50
  if stopped_today && started.nil?
51
+ @has_completed_but_not_started = true
50
52
  rules.label = 'Completed but not started'
51
- rules.color = '#66FF66'
53
+ rules.color = '--wip-chart-completed-but-not-started-color'
52
54
  rules.group_priority = -1
53
55
  elsif stopped_today
54
56
  rules.label = 'Completed'
55
- rules.color = '#009900'
57
+ rules.color = '--wip-chart-completed-color'
56
58
  rules.group_priority = -2
57
59
  elsif started.nil?
58
60
  rules.label = 'Start date unknown'
59
- rules.color = 'white'
61
+ rules.color = '--body-background'
60
62
  rules.group_priority = 4
61
63
  elsif change&.blocked?
62
64
  rules.label = 'Blocked'
63
- rules.color = 'red'
65
+ rules.color = '--blocked-color'
64
66
  rules.group_priority = 1
65
67
  rules.issue_hint = "(#{change.reasons})"
66
68
  elsif change&.stalled?
67
69
  rules.label = 'Stalled'
68
- rules.color = 'orange'
70
+ rules.color = '--stalled-color'
69
71
  rules.group_priority = 2
70
72
  rules.issue_hint = "(#{change.reasons})"
71
73
  else
72
74
  rules.label = 'Active'
73
- rules.color = 'lightgray'
75
+ rules.color = '--wip-chart-active-color'
74
76
  rules.group_priority = 3
75
77
  end
76
78
  end
@@ -0,0 +1,38 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'jirametrics/daily_wip_chart'
4
+
5
+ class DailyWipByParentChart < DailyWipChart
6
+ def default_header_text
7
+ 'Daily WIP, grouped by the parent ticket (Epic, Feature, etc)'
8
+ end
9
+
10
+ def default_description_text
11
+ <<-HTML
12
+ <div class="p">
13
+ How much work is in progress, grouped by the parent of the issue. This will give us an
14
+ indication of how focused we are on higher level objectives. If there are many parent
15
+ tickets in progress at the same time, either this team has their focus scattered or we
16
+ aren't doing a good job of
17
+ <a href="https://improvingflow.com/2024/02/21/slicing-epics.html">splitting those parent
18
+ tickets</a>. Neither of those is desirable.
19
+ </div>
20
+ <div class="p">
21
+ The #{color_block '--body-background'} shading at the top shows items that don't have a parent
22
+ at all.
23
+ </div>
24
+ #{describe_non_working_days}
25
+ HTML
26
+ end
27
+
28
+ def default_grouping_rules issue:, rules:
29
+ parent = issue.parent&.key
30
+ if parent
31
+ rules.label = parent
32
+ else
33
+ rules.label = 'No parent'
34
+ rules.group_priority = 1000
35
+ rules.color = '--body-background'
36
+ end
37
+ end
38
+ end
@@ -6,7 +6,7 @@ class DailyGroupingRules < GroupingRules
6
6
  attr_accessor :current_date, :group_priority, :issue_hint
7
7
 
8
8
  def initialize
9
- super()
9
+ super
10
10
  @group_priority = 0
11
11
  end
12
12
  end
@@ -14,18 +14,18 @@ end
14
14
  class DailyWipChart < ChartBase
15
15
  attr_accessor :possible_statuses
16
16
 
17
- def initialize block = nil
17
+ def initialize block
18
18
  super()
19
19
 
20
20
  header_text default_header_text
21
21
  description_text default_description_text
22
22
 
23
- if block
24
- instance_eval(&block)
25
- else
26
- grouping_rules do |issue, rules|
27
- default_grouping_rules issue: issue, rules: rules
28
- end
23
+ instance_eval(&block) if block
24
+
25
+ return if @group_by_block
26
+
27
+ grouping_rules do |issue, rules|
28
+ default_grouping_rules issue: issue, rules: rules
29
29
  end
30
30
  end
31
31
 
@@ -36,6 +36,11 @@ class DailyWipChart < ChartBase
36
36
  data_sets = possible_rules.collect do |grouping_rule|
37
37
  make_data_set grouping_rule: grouping_rule, issue_rules_by_active_date: issue_rules_by_active_date
38
38
  end
39
+ if @trend_lines
40
+ data_sets = @trend_lines.filter_map do |group_labels, line_color|
41
+ trend_line_data_set(data: data_sets, group_labels: group_labels, color: line_color)
42
+ end + data_sets
43
+ end
39
44
 
40
45
  wrap_and_render(binding, __FILE__)
41
46
  end
@@ -61,9 +66,7 @@ class DailyWipChart < ChartBase
61
66
  hash = {}
62
67
 
63
68
  @issues.each do |issue|
64
- cycletime = issue.board.cycletime
65
- start = cycletime.started_time(issue)&.to_date
66
- stop = cycletime.stopped_time(issue)&.to_date
69
+ start, stop = issue.board.cycletime.started_stopped_dates(issue)
67
70
  next if start.nil? && stop.nil?
68
71
 
69
72
  # If it stopped but never started then assume it started at creation so the data points
@@ -102,14 +105,14 @@ class DailyWipChart < ChartBase
102
105
  label: grouping_rule.label,
103
106
  data: data,
104
107
  backgroundColor: grouping_rule.color || random_color,
105
- borderColor: 'gray',
106
- borderWidth: grouping_rule.color == 'white' ? 1 : 0,
108
+ borderColor: CssVariable['--wip-chart-border-color'],
109
+ borderWidth: grouping_rule.color.to_s == 'var(--body-background)' ? 1 : 0,
107
110
  borderRadius: positive ? 0 : 5
108
111
  }
109
112
  end
110
113
 
111
114
  def configure_rule issue:, date:
112
- raise 'grouping_rules must be set' if @group_by_block.nil?
115
+ raise "#{self.class}: grouping_rules must be set" if @group_by_block.nil?
113
116
 
114
117
  rules = DailyGroupingRules.new
115
118
  rules.current_date = date
@@ -120,4 +123,48 @@ class DailyWipChart < ChartBase
120
123
  def grouping_rules &block
121
124
  @group_by_block = block
122
125
  end
126
+
127
+ def add_trend_line group_labels:, line_color:
128
+ (@trend_lines ||= []) << [group_labels, line_color]
129
+ end
130
+
131
+ def trend_line_data_set data:, group_labels:, color:
132
+ day_wip_hash = {}
133
+ data.each do |top_level|
134
+ next unless group_labels.include? top_level[:label]
135
+
136
+ top_level[:data].each do |datapoint|
137
+ date = datapoint[:x]
138
+ day_wip_hash[date] = (day_wip_hash[date] || 0) + datapoint[:y]
139
+ end
140
+ end
141
+
142
+ points = day_wip_hash
143
+ .collect { |date, wip| [date.jd, wip] }
144
+ .sort_by(&:first)
145
+
146
+ calculator = TrendLineCalculator.new(points)
147
+ return nil unless calculator.valid?
148
+
149
+ data_points = calculator.chart_datapoints(
150
+ range: date_range.begin.jd..date_range.end.jd,
151
+ max_y: points.collect { |_date, wip| wip }.max
152
+ )
153
+ data_points.each do |point_hash|
154
+ point_hash[:x] = chart_format Date.jd(point_hash[:x])
155
+ end
156
+
157
+ {
158
+ type: 'line',
159
+ label: 'Trendline',
160
+ data: data_points,
161
+ fill: false,
162
+ borderWidth: 1,
163
+ markerType: 'none',
164
+ borderColor: CssVariable[color],
165
+ borderDash: [6, 3],
166
+ pointStyle: 'dash',
167
+ hidden: false
168
+ }
169
+ end
123
170
  end