Exemplo n.º 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)
Exemplo n.º 2
0
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
Exemplo n.º 3
0
    def moving_std_dev(self, year=None, month=None, day=None, weeks=4):
        """
        The moving cycle time standard deviation for every day in the last N weeks.
        """

        end_date = make_end_date(year, month, day)
        start_date = end_date - relativedelta(weeks=weeks)
        start_date = make_start_date(date=start_date)

        qs = self.done().filter(done_date__lte=end_date, done_date__gte=start_date).scalar("_cycle_time")

        cycle_times = [t for t in qs if t is not None]
        stdev = standard_deviation(cycle_times)
        if stdev is not None:
            stdev = int(round(stdev))
        else:
            stdev = 0

        return stdev
Exemplo n.º 4
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
Exemplo n.º 5
0
    def moving_std_dev(self, year=None, month=None, day=None, weeks=4):
        """
        The moving cycle time standard deviation for every day in the last N weeks.
        """

        end_date = make_end_date(year, month, day)
        start_date = end_date - relativedelta(weeks=weeks)
        start_date = make_start_date(date=start_date)

        qs = self.done().filter(
            done_date__lte=end_date,
            done_date__gte=start_date,
        ).scalar('_cycle_time')

        cycle_times = [t for t in qs if t is not None]
        stdev = standard_deviation(cycle_times)
        if stdev is not None:
            stdev = int(round(stdev))
        else:
            stdev = 0

        return stdev
Exemplo n.º 6
0
    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,
        'features': len(features),
Exemplo n.º 7
0
 def standard_deviation(self, weeks=4):
     stdev = standard_deviation(self.cycle_times(weeks))
     if stdev is not None:
         stdev = int(round(stdev))
     return stdev
Exemplo n.º 8
0
def card_state_stdevs(card_state_time):
    stdevs = {}
    for state, day_data in card_state_time.items():
        stdevs[state] = standard_deviation(day_data)
    return stdevs
Exemplo n.º 9
0
def card_state_stdevs(card_state_time):
    stdevs = {}
    for state, day_data in card_state_time.items():
        stdevs[state] = standard_deviation(day_data)
    return stdevs
Exemplo n.º 10
0
 def standard_deviation(self, weeks=4):
     stdev = standard_deviation(self.cycle_times(weeks))
     if stdev is not None:
         stdev = int(round(stdev))
     return stdev
Exemplo n.º 11
0
def team(team_slug=None):
    date = datetime.datetime.now()
    date = make_end_date(date=date)
    teams = app.config.get("CARD_TEAMS", [])
    states = States()

    team_mapping = {}
    for team in teams:
        team_mapping[slugify(team)] = team

    target_team = None
    if team_slug:
        target_team = team_mapping.get(team_slug, None)
        if not team:
            abort(404)

    board = DisplayBoard(teams=[target_team])

    wip_cards = [k for k in board.cards if k.state in states.in_progress]
    done_this_week = [k for k in board.cards if k.state == states.done]

    three_months_ago = date - relativedelta.relativedelta(months=3)
    done_past_three_months = Kard.objects.filter(
        team=target_team, done_date__exists=True, done_date__gte=three_months_ago
    )
    std_dev = standard_deviation([k.cycle_time for k in done_past_three_months])
    ave_cycle_time = Kard.objects.filter(team=target_team).moving_cycle_time(
        year=date.year, month=date.month, day=date.day
    )
    confidence_cycle = round(ave_cycle_time + std_dev + std_dev)
    try:
        confidence_cycle = int(confidence_cycle)
    except ValueError:
        pass

    metrics = [
        {"WIP": len(wip_cards)},
        {"Ave. Cycle Time": ave_cycle_time},
        {"95% confidence level": confidence_cycle},
        {"Done this week": len(done_this_week)},
    ]

    title = "%s cards" % target_team

    report_config = (
        {"slug": "assignee", "name": "Assignee breakdown"},
        {"slug": "cycle/distribution", "name": "Cycle time"},
        {"slug": "throughput", "name": "Throughput"},
        {"slug": "leaderboard", "name": "Leaderboard"},
        {"slug": "done", "name": "Done"},
    )

    context = {
        "title": title,
        "team_slug": team_slug,
        "target_team": target_team,
        "metrics": metrics,
        "report_config": report_config,
        "board": board,
        "date": date,
        "updated_at": datetime.datetime.now(),
        "version": VERSION,
    }

    return render_template("team.html", **context)
Exemplo n.º 12
0
def team(team_slug=None):
    date = datetime.datetime.now()
    date = make_end_date(date=date)
    teams = app.config.get('CARD_TEAMS', [])
    states = States()

    team_mapping = {}
    for team in teams:
        team_mapping[slugify(team)] = team

    target_team = None
    if team_slug:
        target_team = team_mapping.get(team_slug, None)
        if not team:
            abort(404)

    board = DisplayBoard(teams=[
        target_team,
    ])

    wip_cards = [k for k in board.cards if k.state in states.in_progress]
    done_this_week = [k for k in board.cards if k.state == states.done]

    three_months_ago = date - relativedelta.relativedelta(months=3)
    done_past_three_months = Kard.objects.filter(
        team=target_team,
        done_date__exists=True,
        done_date__gte=three_months_ago)
    std_dev = standard_deviation(
        [k.cycle_time for k in done_past_three_months])
    ave_cycle_time = Kard.objects.filter(team=target_team).moving_cycle_time(
        year=date.year, month=date.month, day=date.day)
    confidence_cycle = round(ave_cycle_time + std_dev + std_dev)
    try:
        confidence_cycle = int(confidence_cycle)
    except ValueError:
        pass

    metrics = [
        {
            'WIP': len(wip_cards)
        },
        {
            'Ave. Cycle Time': ave_cycle_time
        },
        {
            '95% confidence level': confidence_cycle
        },
        {
            'Done this week': len(done_this_week)
        },
    ]

    title = "%s cards" % target_team

    report_config = ({
        'slug': 'assignee',
        'name': 'Assignee breakdown'
    }, {
        'slug': 'cycle/distribution',
        'name': 'Cycle time'
    }, {
        'slug': 'throughput',
        'name': 'Throughput'
    }, {
        'slug': 'leaderboard',
        'name': 'Leaderboard'
    }, {
        'slug': 'done',
        'name': 'Done'
    })

    context = {
        'title': title,
        'team_slug': team_slug,
        'target_team': target_team,
        'metrics': metrics,
        'report_config': report_config,
        'board': board,
        'date': date,
        'updated_at': datetime.datetime.now(),
        'version': VERSION,
    }

    return render_template('team.html', **context)