<commit_before>from django.db import models
from django.conf import settings

from django_extensions.db.fields import PostgreSQLUUIDField

from .podcast import Episode
from .state import DocumentState, TextDocumentState


class Podcaster(models.Model):
    id = PostgreSQLUUIDField(primary_key=True, auto=True)
    uri = models.URLField(unique=True, db_index=True)
    name = models.CharField(max_length=30)


class PubBase(models.Model):
    id = PostgreSQLUUIDField(primary_key=True, auto=True)
    create_date = models.DateTimeField()
    comment = models.CharField(max_length=250,  blank=True, null=True)

    class Meta:
        abstract = True


class Publication(PubBase):
    creator = models.ForeignKey(settings.AUTH_USER_MODEL, related_name="created_publications")
    episode = models.ForeignKey(Episode, related_name="publications")
    shownoters = models.ManyToManyField(settings.AUTH_USER_MODEL, blank=True, related_name='contributed_publications')
    podcasters = models.ManyToManyField(Podcaster, blank=True, related_name='contributed_publications')
    preliminary = models.BooleanField(default=False)
    state = models.ForeignKey(DocumentState, related_name="+")
    raw_state = models.ForeignKey(TextDocumentState, related_name="+")


class PublicationRequest(PubBase):
    requester = models.ForeignKey(settings.AUTH_USER_MODEL, related_name='requested_publicationrequests')
    episode = models.ForeignKey(Episode, related_name="publicationrequests")<commit_msg>publication: switch state and raw_state from n:1 to 1:1 for more sanity<commit_after>from django.db import models
from django.conf import settings

from django_extensions.db.fields import PostgreSQLUUIDField

from .podcast import Episode
from .state import DocumentState, TextDocumentState


class Podcaster(models.Model):
    id = PostgreSQLUUIDField(primary_key=True, auto=True)
    uri = models.URLField(unique=True, db_index=True)
    name = models.CharField(max_length=30)


class PubBase(models.Model):
    id = PostgreSQLUUIDField(primary_key=True, auto=True)
    create_date = models.DateTimeField()
    comment = models.CharField(max_length=250,  blank=True, null=True)

    class Meta:
        abstract = True


class Publication(PubBase):
    creator = models.ForeignKey(settings.AUTH_USER_MODEL, related_name="created_publications")
    episode = models.ForeignKey(Episode, related_name="publications")
    shownoters = models.ManyToManyField(settings.AUTH_USER_MODEL, blank=True, related_name='contributed_publications')
    podcasters = models.ManyToManyField(Podcaster, blank=True, related_name='contributed_publications')
    preliminary = models.BooleanField(default=False)
    state = models.OneToOneField(DocumentState, related_name="publication")
    raw_state = models.OneToOneField(TextDocumentState, related_name="publication_raw")


class PublicationRequest(PubBase):
    requester = models.ForeignKey(settings.AUTH_USER_MODEL, related_name='requested_publicationrequests')
    episode = models.ForeignKey(Episode, related_name="publicationrequests")
{'fraction_non_alphanumeric': 0.09248366013071896, 'fraction_numerical': 0.004248366013071895, 'mean_word_length': 6.393719806763285, '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': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '220377', 'n_tokens_mistral': 910, 'n_tokens_neox': 891, 'n_words': 166}