コード例 #1
0
def std_dev(start, stop):
    start = make_start_date(date=start)
    stop = make_end_date(date=stop)

    rg = ReportGroup('dev', Kard.objects.filter(done_date__gte=start, done_date__lte=stop))

    cards = [c for c in rg.queryset if c.is_card]
    cycle_times = [c.cycle_time for c in cards]

    over_21 = [c for c in cycle_times if c > 21]
    over_21_pct = float(len(over_21)) / len(cycle_times)

    print "%s -- %s" % (start, stop)
    print "\t Sample: %s" % len(cards)
    print "\t Over 21: %s / %s" % (len(over_21), over_21_pct * 100)
    print "\t Ave: %s" % average(cycle_times)
    print "\t Stdev: %s" % standard_deviation(cycle_times)
    ct, pct = percentile(.8, cycle_times)
    print "\t 80pct: %s / %s" % (ct, pct * 100)

    cards_by_class = {}
    for c in cards:
        cards_by_class.setdefault(c.service_class['name'], [])
        cards_by_class[c.service_class['name']].append(c)

    for sclass, cards in cards_by_class.items():
        cycle_times = [c.cycle_time for c in cards]

        print "\t ## %s" % (sclass)
        print "\t\t Sample: %s" % len(cards)
        print "\t\t Ave: %s" % average(cycle_times)
        print "\t\t Stdev: %s" % standard_deviation(cycle_times)
コード例 #2
0
def report_on_cards(rg):
    data = {}
    for k in rg.queryset():
        class_cards = data.get(k.service_class.get('name'), [])
        class_cards.append(k)
        data[k.service_class.get('name')] = class_cards

    total = sum([len(v) for k, v in data.items()])

    report = {}
    for classname, cards in data.items():
        sclass = cards[0].service_class
        cycle_time_average = int(round(average(
            [c.current_cycle_time() for c in cards])))
        cards_hit_goal = len([c.key for c in cards
            if c.current_cycle_time() <= sclass.get('upper')])

        report[classname] = {
            'service_class': sclass.get('name'),
            'wip': len(cards),
            'wip_percent': len(cards) / float(total),
            'cycle_time_average': cycle_time_average,
            'cards_hit_goal': cards_hit_goal,
            'cards_hit_goal_percent': cards_hit_goal / float(len(cards)),
        }

    return report
コード例 #3
0
def report_on_cards(cards):
    data = {}
    for k in cards:
        class_cards = data.get(k.service_class.get('name'), [])
        class_cards.append(k)
        data[k.service_class.get('name')] = class_cards

    total = sum([len(v) for k, v in data.items()])

    report = {}
    for classname, cards in data.items():
        sclass = cards[0].service_class
        cycle_time_average = int(round(average(
            [c.current_cycle_time() for c in cards])))
        cards_hit_goal = len([c.key for c in cards
            if c.current_cycle_time() <= sclass.get('upper')])

        report[classname] = {
            'service_class': sclass.get('name'),
            'wip': len(cards),
            'wip_percent': len(cards) / float(total),
            'cycle_time_average': cycle_time_average,
            'cards_hit_goal': cards_hit_goal,
            'cards_hit_goal_percent': cards_hit_goal / float(len(cards)),
        }

    return report
コード例 #4
0
def report_on_cards(cards):
    data = {}
    for k in cards:
        class_cards = data.get(k.service_class.get("name"), [])
        class_cards.append(k)
        data[k.service_class.get("name")] = class_cards

    total = sum([len(v) for k, v in data.items()])

    report = {}
    for classname, cards in data.items():
        sclass = cards[0].service_class
        cycle_time_average = int(round(average([c.current_cycle_time() for c in cards])))
        cards_hit_goal = len([c.key for c in cards if c.current_cycle_time() <= sclass.get("upper")])

        report[classname] = {
            "service_class": sclass.get("name"),
            "wip": len(cards),
            "wip_percent": len(cards) / float(total),
            "cycle_time_average": cycle_time_average,
            "cards_hit_goal": cards_hit_goal,
            "cards_hit_goal_percent": cards_hit_goal / float(len(cards)),
        }

    return report
コード例 #5
0
def state_transition_counts(state, months, count_type="exit", raw=False):
    end = make_end_date(date=datetime.datetime.now())

    start = end - relativedelta(months=months)
    start = make_start_date(date=start)

    counts = []
    data = []

    current_date = start
    while current_date <= end:
        if current_date.weekday() == 5:  # Saturday
            current_date += relativedelta(days=2)
        elif current_date.weekday() == 6:  # Sunday
            current_date += relativedelta(days=1)

        range_start = make_start_date(date=current_date)
        range_end = make_end_date(date=current_date)

        if count_type == "exit":
            kwargs = dict(
                exited__gte=range_start,
                exited__lte=range_end,
            )
        elif count_type == "enter":
            kwargs = dict(
                entered__gte=range_start,
                entered__lte=range_end,
            )

        count = StateLog.objects.filter(
            state=state,
            **kwargs
        ).count()

        data.append((current_date, count))
        counts.append(count)
        current_date = current_date + relativedelta(days=1)

    counts.sort()

    print "%s\t%s" % (start, end)
    print "Median\t%s" % median(counts)
    print "Average\t%s" % average(counts)
    print "Min\t%s" % counts[0]
    print "Max\t%s" % counts[-1]

    hist = histogram(counts)
    keys = hist.keys()
    keys.sort()
    for k in keys:
        print "%s\t%s" % (k, hist[k])

    if raw is True:
        for date, count in data:
            print "%s\t%s" % (date, count)
コード例 #6
0
def state_transition_counts(state, months, count_type="exit", raw=False):
    end = make_end_date(date=datetime.datetime.now())

    start = end - relativedelta(months=months)
    start = make_start_date(date=start)

    counts = []
    data = []

    current_date = start
    while current_date <= end:
        if current_date.weekday() == 5:  # Saturday
            current_date += relativedelta(days=2)
        elif current_date.weekday() == 6:  # Sunday
            current_date += relativedelta(days=1)

        range_start = make_start_date(date=current_date)
        range_end = make_end_date(date=current_date)

        if count_type == "exit":
            kwargs = dict(
                exited__gte=range_start,
                exited__lte=range_end,
            )
        elif count_type == "enter":
            kwargs = dict(
                entered__gte=range_start,
                entered__lte=range_end,
            )

        count = StateLog.objects.filter(state=state, **kwargs).count()

        data.append((current_date, count))
        counts.append(count)
        current_date = current_date + relativedelta(days=1)

    counts.sort()

    print "%s\t%s" % (start, end)
    print "Median\t%s" % median(counts)
    print "Average\t%s" % average(counts)
    print "Min\t%s" % counts[0]
    print "Max\t%s" % counts[-1]

    hist = histogram(counts)
    keys = hist.keys()
    keys.sort()
    for k in keys:
        print "%s\t%s" % (k, hist[k])

    if raw is True:
        for date, count in data:
            print "%s\t%s" % (date, count)
コード例 #7
0
ファイル: stddev.py プロジェクト: josephjo/kardboard
def year_std_dev(year):
    year_start = make_start_date(date=datetime(year, 1, 1))
    year_end = make_end_date(date=datetime(year, 12, 31))

    rg = ReportGroup('dev', Kard.objects.filter(start_date__gte=year_start, done_date__lte=year_end))

    cards = [c for c in rg.queryset if c.is_card]
    cycle_times = [c.cycle_time for c in cards]

    data = {}
    data['n'] = len(cards)
    data['ave'] = average(cycle_times)
    data['std'] = standard_deviation(cycle_times)
    return data
コード例 #8
0
def moving_data(report_group_slug, start, stop):
    query = Kard.objects.filter(
        done_date__gte=start,
        done_date__lte=stop,
    )

    kards = list(ReportGroup(report_group_slug, query).queryset)

    bad_kards = [k for k in kards if k.cycle_time is None]
    print "Bad cards"
    print "*" * 10
    print[k.key for k in bad_kards]

    features = [k for k in kards if k.is_card]
    defects = [k for k in kards if not k.is_card]
    over_sla = [k for k in kards if k.cycle_time > k.service_class['upper']]
    card_cycle_ave = average([k.cycle_time for k in kards]) or 0
    card_stddev = standard_deviation([k.cycle_time for k in kards]) or 0

    wip = find_wip(report_group_slug, stop)
    tpa = daily_throughput_average(report_group_slug, stop)

    try:
        little_law = int(round(wip / float(tpa)))
    except:
        little_law = ""

    cycle_time_ave = find_cycle_time_ave(report_group_slug, stop)

    data = {
        'start': start,
        'stop': stop,
        'features': len(features),
        'bugfixes': len(defects),
        'little_law': little_law,
        'cycle_time_ave': int(round(cycle_time_ave)),
        'wip': wip,
        'cycle_average': int(round(card_cycle_ave)),
        'stddev': int(round(card_stddev)),
        'over_sla': len(over_sla),
    }
    return data
コード例 #9
0
def report_suite(name, start, end):
    start, end = _get_time_range(None, start, end)
    try:
        team = _get_team(name)
        done, wip = _get_cards(team, start, end)
    except ValueError:
        rg_slug = _verify_rg(name)
        done, wip = _get_cards_by_report_group(rg_slug, start, end)

    done = [k for k in done if k.is_card]
    wip = [k for k in done if k.is_card]

    for k in done:
        print "%s - %s - %s" % (k.key, k.cycle_time, k._service_class)

    cycle_times = [c.cycle_time for c in done]

    hist = histogram(cycle_times)

    print "Sample size: %s" % len(cycle_times)
    print "Average: %s" % average(cycle_times)
    for k, v in hist.items():
        print "%s\t%s" % (k, v)
コード例 #10
0
def card_state_averages(card_state_time):
    averages = {}
    for state, day_data in card_state_time.items():
        averages[state] = average(day_data)
    return averages
コード例 #11
0
def card_state_averages(card_state_time):
    averages = {}
    for state, day_data in card_state_time.items():
        averages[state] = average(day_data)
    return averages
コード例 #12
0
ファイル: teams.py プロジェクト: memeticlabs/kardboard
 def average(self, weeks=4):
     ave = average(self.cycle_times(weeks))
     if ave is not None:
         ave = int(round(ave))
     return ave
コード例 #13
0
ファイル: kard.py プロジェクト: josephjo/kardboard
 def average(self, field_str):
     values = [getattr(k, field_str) for k in self.filter().only(field_str)]
     if len(values) == 0:
         return 0
     return average(values)
コード例 #14
0
 def average(self, field_str):
     values = [getattr(k, field_str) for k in self.filter().only(field_str)]
     values = [value for value in values if value is not None]
     if len(values) == 0:
         return 0
     return average(values)
コード例 #15
0
ファイル: teams.py プロジェクト: thepeopleseason/kardboard
 def average(self, weeks=4):
     ave = average(self.cycle_times(weeks))
     if ave is not None:
         ave = int(round(ave))
     return ave
コード例 #16
0
ファイル: moving_data.py プロジェクト: mgravesCMG/kardboard
def moving_data(report_group_slug, start, stop):
    query = Kard.objects.filter(
        done_date__gte=start,
        done_date__lte=stop,)

    kards = list(ReportGroup(report_group_slug, query).queryset)

    bad_kards = [k for k in kards if k.cycle_time is None]
    print "Bad cards"
    print "*"*10
    print [k.key for k in bad_kards]

    features = [k for k in kards if k.is_card]
    defects = [k for k in kards if not k.is_card]
    over_sla = [k for k in kards if k.cycle_time > k.service_class['upper']]
    card_cycle_ave = average([k.cycle_time for k in kards]) or 0
    card_stddev = standard_deviation([k.cycle_time for k in kards]) or 0

    wip = find_wip(report_group_slug, stop)
    tpa = daily_throughput_average(report_group_slug, stop)

    try:
        little_law = wip / float(tpa)
    except:
        little_law = 0

    cycle_time_ave = find_cycle_time_ave(report_group_slug, stop)

    data = {
        'start': start,
        'stop': stop,
コード例 #17
0
ファイル: kard.py プロジェクト: mgravesCMG/kardboard
 def average(self, field_str):
     values = [getattr(k, field_str) for k in self.filter().only(field_str)]
     values = [value for value in values if value is not None]
     if len(values) == 0:
         return 0
     return average(values)