<commit_before>import collections
import itertools
import mongoengine
from abjad.tools import datastructuretools
from abjad.tools import systemtools
from discograph.models.Model import Model


class Relation(Model, mongoengine.Document):

    ### CLASS VARIABLES ###

    Reference = collections.namedtuple(
        'Reference',
        ['class_', 'discogs_id', 'name'],
        )

    class EntityType(datastructuretools.Enumeration):
        ARTIST = 1
        LABEL = 2

    ### MONGOENGINE FIELDS ###

    entity_one_id = mongoengine.IntField()
    entity_one_name = mongoengine.StringField()
    entity_one_type = mongoengine.IntField()
    entity_two_id = mongoengine.IntField()
    entity_two_name = mongoengine.StringField()
    entity_two_type = mongoengine.IntField()
    role_name = mongoengine.StringField()
    category = mongoengine.IntField()
    subcategory = mongoengine.IntField(null=True)
    is_trivial = mongoengine.BooleanField()
    release_id = mongoengine.IntField(null=True)
    year = mongoengine.IntField(null=True)

    ### MONOGENGINE META ###

    meta = {
        'indexes': [
            '#entity_one_name',
            '#entity_two_name',
            '#role_name',
            'category',
            'entity_one_id',
            'entity_one_type',
            'entity_two_id',
            'entity_two_type',
            'release_id',<commit_msg>Adjusted Relation model.<commit_after>import collections
import itertools
import mongoengine
from abjad.tools import datastructuretools
from abjad.tools import systemtools
from discograph.models.Model import Model
from discograph.models.Artist import Artist
from discograph.models.Label import Label


class Relation(Model, mongoengine.Document):

    ### CLASS VARIABLES ###

    Reference = collections.namedtuple(
        'Reference',
        ['class_', 'discogs_id', 'name'],
        )

    class EntityType(datastructuretools.Enumeration):
        ARTIST = 1
        LABEL = 2

    _model_to_entity_type = {
        Artist: EntityType.ARTIST,
        Label: EntityType.LABEL,
        }

    ### MONGOENGINE FIELDS ###

    entity_one_id = mongoengine.IntField()
    entity_one_name = mongoengine.StringField()
    entity_one_type = mongoengine.IntField()
    entity_two_id = mongoengine.IntField()
    entity_two_name = mongoengine.StringField()
    entity_two_type = mongoengine.IntField()
    role_name = mongoengine.StringField()
    category = mongoengine.IntField()
    subcategory = mongoengine.IntField(null=True)
    is_trivial = mongoengine.BooleanField()
    release_id = mongoengine.IntField(null=True)
    year = mongoengine.IntField(null=True)

    ### MONOGENGINE META ###

    meta = {
        'indexes': [
            '#entity_one_name',
            '#entity_two_name',
            '#role_name',
            'role_name',
            'category',
            'entity_one_id',
            'entity_one_type',
            'entity_two_id',
            'entity_two_type',
            'release_id',
{'fraction_non_alphanumeric': 0.09996656636576395, 'fraction_numerical': 0.0013373453694416582, 'mean_word_length': 2.8556701030927836, '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': '6861178', 'n_tokens_mistral': 933, 'n_tokens_neox': 908, 'n_words': 163}