<commit_before>from ..contentbase import (
    location
)
from ..schema_utils import (
    load_schema,
)
from .base import (
    ACCESSION_KEYS,
    ALIAS_KEYS,
    Collection,
    paths_filtered_by_status,
)
from .download import ItemWithAttachment


def includeme(config):
    config.scan()


@location('labs')
class Lab(Collection):
    item_type = 'lab'
    schema = load_schema('lab.json')
    properties = {
        'title': 'Labs',
        'description': 'Listing of ENCODE DCC labs',
    }
    item_name_key = 'name'
    unique_key = 'lab:name'
    item_keys = [
        {'name': '{item_type}:name', 'value': '{name}', '$templated': True},
        {'name': '{item_type}:name', 'value': '{title}', '$templated': True},
    ]


@location('awards')
class Award(Collection):
    item_type = 'award'
    schema = load_schema('award.json')
    properties = {
        'title': 'Awards (Grants)',
        'description': 'Listing of awards (aka grants)',
    }
    item_name_key = 'name'
    unique_key = 'award:name'
    item_keys = ['name']


@location('organisms')
class Organism(Collection):
    item_type = 'organism'
    schema = load_schema('organism.json')
    properties = {
        'title': 'Organisms',
        'description': 'Listing of all registered organisms',
    }
    item_name_key = 'name'
    unique_key = 'organism:name'
    item_keys = ['name']


@location('sources')
class Source(Collection):
    item_type = 'source'
    schema = load_schema('source.json')
    properties = {
        'title': 'Sources',
        'description': 'Listing of sources and vendors for ENCODE material',
    }
    item_name_key = 'name'
    unique_key = 'source:name'
    item_keys = ALIAS_KEYS + ['name']


@location('treatments')
class Treatment(Collection):
    item_type = 'treatment'
    schema = load_schema('treatment.json')
    properties = {
        'title': 'Treatments',
        'description': 'Listing Biosample Treatments',
    }
    item_keys = ALIAS_KEYS  # ['treatment_name']


@location('constructs')
class Construct(Collection):
    item_type = 'construct'
    schema = load_schema('construct.json')
    properties = {
        'title': 'Constructs',
        'description': 'Listing of Biosample Constructs',
    }
    item_keys = ALIAS_KEYS  # ['vector_name']
    item_rev = {
        'characterizations': ('construct_characterization', 'characterizes'),
    }
    item_template = {
        'characterizations': (
            lambda root, characterizations: paths_filtered_by_status(root, characterizations)
        ),
    }
    item_embedded = ['target']

@location('talens')
class Talen(Collection):
    item_type = 'talen'
    schema = load_schema('talen.json')
    properties = {
        'title': 'TALENs',
        'description': 'Listing of TALEN Constructs',
    }
    item_keys = ALIAS_KEYS + ['name']
    item_rev = {
        'characterizations': ('construct_characterization', 'characterizes'),
    }
    item_template = {
        'characterizations': (
            lambda root, characterizations: paths_filtered_by_status(root, characterizations)
        ),
    }
    item_embedded = ['lab', 'submitted_by']

@location('documents')
class Document(Collection):
    item_type = 'document'
    schema = load_schema('document.json')
    properties = {
        'title': 'Documents',
        'description': 'Listing of Biosample Documents',<commit_msg>Support name as a item identifier<commit_after>from ..contentbase import (
    location
)
from ..schema_utils import (
    load_schema,
)
from .base import (
    ACCESSION_KEYS,
    ALIAS_KEYS,
    Collection,
    paths_filtered_by_status,
)
from .download import ItemWithAttachment


def includeme(config):
    config.scan()


@location('labs')
class Lab(Collection):
    item_type = 'lab'
    schema = load_schema('lab.json')
    properties = {
        'title': 'Labs',
        'description': 'Listing of ENCODE DCC labs',
    }
    item_name_key = 'name'
    unique_key = 'lab:name'
    item_keys = [
        {'name': '{item_type}:name', 'value': '{name}', '$templated': True},
        {'name': '{item_type}:name', 'value': '{title}', '$templated': True},
    ]


@location('awards')
class Award(Collection):
    item_type = 'award'
    schema = load_schema('award.json')
    properties = {
        'title': 'Awards (Grants)',
        'description': 'Listing of awards (aka grants)',
    }
    item_name_key = 'name'
    unique_key = 'award:name'
    item_keys = ['name']


@location('organisms')
class Organism(Collection):
    item_type = 'organism'
    schema = load_schema('organism.json')
    properties = {
        'title': 'Organisms',
        'description': 'Listing of all registered organisms',
    }
    item_name_key = 'name'
    unique_key = 'organism:name'
    item_keys = ['name']


@location('sources')
class Source(Collection):
    item_type = 'source'
    schema = load_schema('source.json')
    properties = {
        'title': 'Sources',
        'description': 'Listing of sources and vendors for ENCODE material',
    }
    item_name_key = 'name'
    unique_key = 'source:name'
    item_keys = ALIAS_KEYS + ['name']


@location('treatments')
class Treatment(Collection):
    item_type = 'treatment'
    schema = load_schema('treatment.json')
    properties = {
        'title': 'Treatments',
        'description': 'Listing Biosample Treatments',
    }
    item_keys = ALIAS_KEYS  # ['treatment_name']


@location('constructs')
class Construct(Collection):
    item_type = 'construct'
    schema = load_schema('construct.json')
    properties = {
        'title': 'Constructs',
        'description': 'Listing of Biosample Constructs',
    }
    item_keys = ALIAS_KEYS  # ['vector_name']
    item_rev = {
        'characterizations': ('construct_characterization', 'characterizes'),
    }
    item_template = {
        'characterizations': (
            lambda root, characterizations: paths_filtered_by_status(root, characterizations)
        ),
    }
    item_embedded = ['target']

@location('talens')
class Talen(Collection):
    item_type = 'talen'
    schema = load_schema('talen.json')
    properties = {
        'title': 'TALENs',
        'description': 'Listing of TALEN Constructs',
    }
    item_keys = ALIAS_KEYS + ['name']
    unique_key = 'talen:name'
    item_name_key = 'name'
    item_rev = {
        'characterizations': ('construct_characterization', 'characterizes'),
    }
    item_template = {
        'characterizations': (
            lambda root, characterizations: paths_filtered_by_status(root, characterizations)
        ),
    }
    item_embedded = ['lab', 'submitted_by']

@location('documents')
class Document(Collection):
    item_type = 'document'
    schema = load_schema('document.json')
    properties = {
        'title': 'Documents',
        'description': 'Listing of Biosample Documents',
{'fraction_non_alphanumeric': 0.13783506664713638, 'fraction_numerical': 0.0, 'mean_word_length': 3.1684981684981683, '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': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6861892', 'n_tokens_mistral': 2145, 'n_tokens_neox': 2102, 'n_words': 450}