Description("Ville's slides for the presentation at Nokia in Decemeber 2012")

HASHES = ['205e460b479e2e5b48aec07710c08d50',
          '25c7c18223fb42a4c6ae1c8db6f50f9b',
          'x',
          'f0a7bfdc9c509e8ea02b3ad25ba768b6',
          'b42c651650ec8d3d95829c75e318af2d',
          'd0ae789ef12347de8ec30b3765dd5d89',
          'x',
          '476d8afffbfa06fa852e677848c2388d']

for profile in bitdeli.profiles():
    pass

random.seed(1)
set_theme('playground')

# slide 1

Text(head='',
     size=(12, 1))
Text(head='Bitdeli',
     size=(12, 3))
Text(head='Ville Tuulos | Co-Founder | CEO',
     size=(12, 4),
     color=2)

# slide 2

Text(head='',
     size=(12, 1))
Exemple #2
0
import bitdeli
from bitdeli.widgets import Title, Description, Line, Text, set_theme
from datetime import datetime, timedelta
import random

set_theme('bluered')

random.seed(1)

def month():
    first = datetime.today()
    for i in range(30):
        yield (first + timedelta(days=i)).isoformat()

def data_exp():
    for i, date in enumerate(month()):
         yield date, (2**(i * 0.2) + random.gauss(10, 2)) * 1000

def data_lin():
    for i, date in enumerate(month()):
        yield date, (i + random.gauss(10, 2)) * 1000

for profile in bitdeli.profiles():
    pass

Line(size=(10, 7),
     data=[{'label': 'Android users', 'data': list(data_exp())},
           {'label': 'IPhone users', 'data': list(data_exp())},
           {'label': 'Web users', 'data': list(data_lin())}])

Text(head="98%", size=(2, 2))
Exemple #3
0
import bitdeli
from bitdeli.widgets import Title, Description, Users, Text, set_theme, get_themes

print '\n'.join(get_themes())

set_theme('safari')

HASHES = [
    '205e460b479e2e5b48aec07710c08d50', '25c7c18223fb42a4c6ae1c8db6f50f9b',
    'x', 'f0a7bfdc9c509e8ea02b3ad25ba768b6',
    'b42c651650ec8d3d95829c75e318af2d', 'd0ae789ef12347de8ec30b3765dd5d89',
    'x', '476d8afffbfa06fa852e677848c2388d'
]

for profile in bitdeli.profiles():
    pass

Text(size=(8, 2), head='All systems:', color=2)
Text(size=(3, 2), head="UP!", color=3)
Text(size=(12, 1))

Text(size=(4, 2), head='8 new users:', color=1)
Users(size=(8, 2), large=True, data=[{'gravatar_hash': h} for h in HASHES])

Text(label='Conversions', size=(4, 2), head='8.13%', color=1)
Text(label='Revenue', size=(4, 2), head='$6,412', color=3)
Text(label='Avg. Latency', size=(4, 2), head='320ms', color=2)

Title("Uptime is 99.5%")
Description("The predicted churn rate is 8.13%")
from bitdeli.widgets import set_theme, Description, Title
from bitdeli.chain import Profiles
from collections import Counter, defaultdict
from datetime import datetime, timedelta
import GeoIP

set_theme('eighties')

TIMELINE_DAYS = 30 
TFORMAT = '%Y-%m-%d'
               
text = {'window': TIMELINE_DAYS}

def growth(profiles):
    repos = {}
    for profile in profiles:
        for repo, events in profile['repos'].iteritems():
            first = min(e['tstamp'] for e in events)
            repos[repo.split('?')[0]] = first.split('T')[0]
    c = Counter(repos.itervalues())
    yield sorted(c.items())

def weekly(daily):
    w = {}
    for day, count in daily.next():
        d = datetime.strptime(day, TFORMAT)
        _year, week, _dnum = d.isocalendar()
        if week in w:
            w[week][1] += count
        else:
            w[week] = [d.strftime('%m/%d'), count]
Exemple #5
0
import bitdeli
import random
from bitdeli.widgets import Title, Description, Bar, Table, set_theme
from bitdeli.textutil import COUNTRIES

set_theme('builder')

ITEMS = ['Memento Mori', 'Funky Stars', 'Knuckle Busters', 'Mosaic Days',
         'Sidology Episode 1', 'Desert Dream', 'Starshine', 'Marmelade',
         'Turrican Medley', 'Electric City']


random.seed(1)

def bar_data():
    for i, month in enumerate(['%.2d/11' % m for m in range(1, 13)] +
                              ['%.2d/12' % m for m in range(1, 7)]):
        yield month, 100 + abs(i - 6) * 25 + random.randint(1, 50)

def table_data():
    for i, item in enumerate(ITEMS):
        x= 1.0 - (i * 0.05 + random.random() * 0.1)
        yield {'Entry': item,
               'Score ': int(x * 1000),
               'Rank': i + 1,
               'Weight': x}
        
for profile in bitdeli.profiles():
    pass

Bar(label='Voting Activity',
Exemple #6
0
import bitdeli
import operator
from bitdeli.textutil import Percent, country_name
from bitdeli.widgets import Map, Title, Description, set_theme

set_theme('eighties')

for profile in bitdeli.profiles():
    pass

countries = {
    'IN': 0.3,
    'PK': 0.18,
    'LK': 0.15,
    'NP': 0.12,
    'BD': 0.08,
    'MM': 0.06
}

Map(size=(12, 7), data=countries)

topcountry = max(countries.iteritems(), key=operator.itemgetter(1))[0]

Title(u'Top trending country: {top} \u21E7{value}', {
    'top': country_name(topcountry),
    'value': Percent(countries[topcountry], 0)
})

Description('Active users in {count} countries today',
            {'count': len(countries)})
import bitdeli
from bitdeli.widgets import Users, Text, set_theme, get_themes

print '\n'.join(get_themes())

set_theme('safari')

HASHES = ['205e460b479e2e5b48aec07710c08d50',
          '25c7c18223fb42a4c6ae1c8db6f50f9b',
          'x',
          'f0a7bfdc9c509e8ea02b3ad25ba768b6',
          'b42c651650ec8d3d95829c75e318af2d',
          'd0ae789ef12347de8ec30b3765dd5d89',
          'x',
          '476d8afffbfa06fa852e677848c2388d']

for profile in bitdeli.profiles():
    pass

Text(size=(12, 2),
     head='All systems UP!')
Text(label='Conversions',
     size=(4, 2),
     head='8.13%',
     color=3)
Text(label='Revenue',
     size=(4, 2),
     head='$6,412',
     color=2)
Text(label='Avg. Latency',
     size=(4, 2),
Exemple #8
0
from bitdeli.widgets import set_theme, Description, Title
from bitdeli.chain import Profiles
from collections import Counter, defaultdict
from datetime import datetime, timedelta
from urlparse import urlsplit, urlunsplit

set_theme('bank')

TIMELINE_DAYS = 30
TFORMAT = '%Y-%m-%d'

text = {'window': TIMELINE_DAYS}
limit = datetime.now() - timedelta(days=TIMELINE_DAYS)
limit_str = limit.strftime(TFORMAT)

def recent_views(pageviews):
    for pageview in pageviews:
        day = pageview[0].split('T')[0]
        if day >= limit_str:
            yield pageview

            
def referrers(profiles):
    def domains(pageviews):
        referrers = defaultdict(Counter)
        for pageview in pageviews:
            page_info = pageview[3].get("$page_info")
            if not page_info or "referrer" not in page_info:
                continue
            url = urlsplit(page_info["referrer"])
            clean = urlunsplit(("", url.netloc, url.path,
Exemple #9
0
from collections import Counter
from itertools import groupby
from bisect import bisect
from datetime import datetime

from bitdeli.textutil import Percent
from bitdeli.chain import Profiles
from bitdeli.widgets import Title, Description, set_theme

BADGE = 'trending_badge%d.png'
TFORMAT = '%Y-%m-%dT%H:%M:%SZ'
BASELINE_THRESHOLDS = (1e2, 1e3, 1e4)
GROWTH_THRESHOLDS = (0.05, 0.2, 0.3)
NOW = datetime.utcnow()

set_theme('valentine')

text = {}


def weekly_uniques(profiles):
    def weekly_visits(visits):
        for visit in sorted(visits, reverse=True):
            t = datetime.strptime(visit['tstamp'], TFORMAT)
            days = (NOW - t).days
            if days < 14:
                yield days / 7
            else:
                break

    num_profiles = 0
Exemple #10
0
from bitdeli.widgets import Title, Description, set_theme
from bitdeli.chain import Profiles
from collections import Counter

set_theme('playground')

text = {}


def volume(it):
    hours = Counter()
    for profile in it:
        for tstamp, group, ip, event in profile['events']:
            hour = group.split(':')[-1] + ':00:00'
            hours[hour] += 1

    latest = max(hours)
    text['latest-hour'] = latest.replace('T', ' ')
    text['latest-num'] = hours[latest]
    text['first-hour'] = min(hours).replace('T', ' ')
    text['total'] = sum(hours.itervalues())

    yield {
        'type': 'line',
        'label': 'Number of events by hour',
        'size': (12, 3),
        'data': list(sorted(hours.iteritems()))
    }
    yield {
        'type': 'text',
        'size': (5, 2),
from bitdeli.widgets import Title, Description, set_theme
from bitdeli.chain import Profiles
from collections import Counter

set_theme('sail')

text = {}

def stats(profiles):
    stats = Counter()
    apps = Counter()
    for profile in profiles:
        for session in profile['sessions']:
            apps[session['$app']] += 1
            for event in session['l']:
                stats[event['e']] += 1
                
    top_apps = apps.most_common()
    top_events = stats.most_common()
    text['applist'] = '\n'.join(' - **%s**: %d sessions' % app
                                for app in top_apps)
    text['total'] = total = float(sum(stats.itervalues()))
    text['top'] = top_events[0][0]
    
    yield {'type': 'text',
           'size': (12, 2),
           'label': 'Top Application',
           'color': 2,
           'head': top_apps[0][0]}
    
    yield {'type': 'text',
Exemple #12
0
from bitdeli.widgets import set_theme, Description, Title
from bitdeli.chain import Profiles
from collections import Counter, defaultdict
from datetime import datetime, timedelta
import GeoIP

set_theme('dream')

TIMELINE_DAYS = 10 
TFORMAT = '%Y-%m-%d'
               
geoip = GeoIP.open('/usr/share/geoip/GeoLiteCity.dat', GeoIP.GEOIP_STANDARD)

text = {'window': TIMELINE_DAYS}

def countries(profiles):
    stats = Counter()
    for profile in profiles:
        country = geoip.record_by_addr(profile.uid)
        if country:
            stats[country['country_code']] += 1
    yield stats

def activity(profiles):
    limit = datetime.now() - timedelta(days=TIMELINE_DAYS)
    limit_str = limit.strftime(TFORMAT)
        
    def recent_days(visits):
        for visit in visits:
            day = visit['tstamp'].split('T')[0]
            if day >= limit_str:
from collections import Counter
from itertools import groupby
from bisect import bisect
from datetime import datetime

from bitdeli.textutil import Percent
from bitdeli.chain import Profiles
from bitdeli.widgets import Title, Description, set_theme

BADGE = 'trending_badge%d.png'
TFORMAT = '%Y-%m-%dT%H:%M:%SZ'
BASELINE_THRESHOLDS = (1e2, 1e3, 1e4)
GROWTH_THRESHOLDS = (0.05, 0.2, 0.3)
NOW = datetime.utcnow()

set_theme('valentine')

text = {}

def weekly_uniques(profiles):
    def weekly_visits(visits):
        for visit in sorted(visits, reverse=True):
            t = datetime.strptime(visit['tstamp'], TFORMAT)
            days = (NOW - t).days
            if days < 14:
                yield days / 7
            else:
                break
    num_profiles = 0
    for profile in profiles:
        num_profiles += 1
from bitdeli.widgets import set_theme, Description, Title
from bitdeli.chain import Profiles
from collections import Counter, defaultdict
from datetime import datetime, timedelta
import GeoIP

set_theme('arctic')

TIMELINE_DAYS = 30 
TFORMAT = '%Y-%m-%d'
               
geoip = GeoIP.open('/usr/share/geoip/GeoLiteCity.dat', GeoIP.GEOIP_STANDARD)

text = {'window': TIMELINE_DAYS}

def countries(profiles):
    stats = Counter()
    for profile in profiles:
        country = geoip.record_by_addr(profile.uid)
        if country:
            stats[country['country_code']] += 1
    yield stats

def activity(profiles):
    limit = datetime.now() - timedelta(days=TIMELINE_DAYS)
    limit_str = limit.strftime(TFORMAT)
        
    def recent_days(visits):
        for visit in visits:
            day = visit['tstamp'].split('T')[0]
            if day >= limit_str: