Commit a54ea05d authored by Jérome Perrin's avatar Jérome Perrin

new plugin to postprocess demand planning bottleneck analysis by week

parent c86ca019
...@@ -62,3 +62,60 @@ class DemandPlanningLine(plugin.OutputPreparationPlugin, TimeSupportMixin): ...@@ -62,3 +62,60 @@ class DemandPlanningLine(plugin.OutputPreparationPlugin, TimeSupportMixin):
}) })
return data return data
class BottleNeckByWeek(plugin.OutputPreparationPlugin, TimeSupportMixin):
""" Output the queue statistics in a format compatible with Output_viewGraph, for the second widget by week.
"""
def postprocess(self, data):
from dream.simulation.applications.DemandPlanning.Globals import G
result = data['result']['result_list'][-1]
bottleNeckUtilizationDict = result['bottleneck_utilization_by_week'] = {}
by_week = {}
# change {bottleneck: {week: data }} in {week: {bottleneck: data}}
for bottleneck, bottleNeckUtilization in G.Utilisation.iteritems():
for record_id, record in bottleNeckUtilization.iteritems():
by_week.setdefault(record_id, {})[bottleneck] = record
for week, bottleneckData in by_week.items():
series = []
ticks = [list(enumerate(bottleneckData.keys()))]
options = {
"xaxis": {
"minTickSize": 1,
"ticks": ticks
},
"series": {
"bars": {
"show": True,
"barWidth": 0.10,
"order": 1,
"align": "center"
},
"stack": False
}
}
weekLabel = "%s %s" % (str(week)[:4], str(week)[4:])
bottleNeckUtilizationDict[weekLabel] = {
"series": series,
"options": options
}
# create the 3 bars
for (utilizationType, utilizationLabel) in [
( 'averageUtilization', 'Average Utilization' ),
( 'minUtilization', 'Min Utilization' ),
( 'maxUtilization', 'Max Utilization' ) ]:
series.append({
"label": utilizationLabel,
"data": list(enumerate([x[utilizationType] for x in bottleneckData.values()])),
})
return data
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment