<commit_before>from django.db import models


class Sample(models.Model):
    value = models.IntegerField()<commit_msg>initial work on general dashboard models<commit_after>from django.db import models
from bitpile.utils import sample_to_shard_mapper


class Project(models.Model):
    title = models.CharField(max_length=255)
    dashboards = models.ManyToManyField(
        'bitpile.Dashboard',
        blank=True,
        null=True
    )

    def __unicode__(self):
        return self.title


class Dashboard(models.Model):
    title = models.CharField(max_length=255)
    widgets = models.ManyToManyField(
        'bitpile.Widget',
        blank=True,
        null=True
    )
    
    def __unicode__(self):
        return self.title


class Widget(models.Model):
    title = models.CharField(max_length=255)


class LineChartWidget(Widget):
    metrics = models.ManyToManyField(
        'bitpile.Metric',
        blank=True,
        null=True
    )


class Metric(models.Model):
    title = models.CharField(max_length=255)
    sample_interval = models.IntegerField(
        choices=((1, "Every Minute"),)
    )


class GoogleAnalyticsUniqueUserMetric(Metric):
    access_token = models.CharField(max_length=64)


class Sample(models.Model):
    metric_id = models.IntegerField(max_length=64)
    integer = models.IntegerField()
    string = models.CharField(max_length=64)

    def save(self, *args, **kwargs):
        self.full_clean()
        kwargs.update({'using': 'shard_%s' % sample_to_shard_mapper(self)})
        super(Sample, self).save(*args, **kwargs)
{'fraction_non_alphanumeric': 0.1089866156787763, 'fraction_numerical': 0.012109623964308477, 'mean_word_length': 3.361111111111111, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5153672', 'n_tokens_mistral': 507, 'n_tokens_neox': 479, 'n_words': 89}