<commit_before>import ckan.logic as logic
import ckan.lib.base as base
import logging
from ckanext.nhm.views.default import DefaultView
from pylons import config
import ckan.plugins as p
from collections import OrderedDict

log = logging.getLogger(__name__)

render = base.render
abort = base.abort
redirect = base.redirect

NotFound = logic.NotFound
NotAuthorized = logic.NotAuthorized
ValidationError = logic.ValidationError
get_action = logic.get_action


class IndexLotView(DefaultView):
    """
    Controller for displaying a specimen record
    """

    resource_id = config.get("ckanext.nhm.indexlot_resource_id")

    field_facets = [
        'family',
        'taxonRank',
        'imageCategory',
        'kindOfMaterial'
    ]

    # Additional search filter options
    filter_options = {
        '_has_image': {
            'label': 'Has images',
            'solr': "_has_multimedia:true"
        },
    }

    field_groups = OrderedDict([
        ("Classification", OrderedDict([
            ("currentScientificName", "Scientific name"),
            ("scientificNameAuthorship", "Author"),
            ("kingdom", "Kingdom"),
            ("phylum", "Phylum"),
            ("class", "Class"),
            ("order", "Order"),
            ("family", "Family"),
            ("genus", "Genus"),
            ("subgenus", "Subgenus"),
            ("specificEpithet", "Species"),<commit_msg>Add type facet<commit_after>import ckan.logic as logic
import ckan.lib.base as base
import logging
from ckanext.nhm.views.default import DefaultView
from pylons import config
import ckan.plugins as p
from collections import OrderedDict

log = logging.getLogger(__name__)

render = base.render
abort = base.abort
redirect = base.redirect

NotFound = logic.NotFound
NotAuthorized = logic.NotAuthorized
ValidationError = logic.ValidationError
get_action = logic.get_action


class IndexLotView(DefaultView):
    """
    Controller for displaying a specimen record
    """

    resource_id = config.get("ckanext.nhm.indexlot_resource_id")

    field_facets = [
        'family',
        'type',
        'taxonRank',
        'imageCategory',
        'kindOfMaterial'
    ]

    # Additional search filter options
    filter_options = {
        '_has_image': {
            'label': 'Has images',
            'solr': "_has_multimedia:true"
        },
    }

    field_groups = OrderedDict([
        ("Classification", OrderedDict([
            ("currentScientificName", "Scientific name"),
            ("scientificNameAuthorship", "Author"),
            ("kingdom", "Kingdom"),
            ("phylum", "Phylum"),
            ("class", "Class"),
            ("order", "Order"),
            ("family", "Family"),
            ("genus", "Genus"),
            ("subgenus", "Subgenus"),
            ("specificEpithet", "Species"),
{'fraction_non_alphanumeric': 0.12184724689165187, 'fraction_numerical': 0.0, 'mean_word_length': 2.6476683937823835, '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': '5603149', 'n_tokens_mistral': 813, 'n_tokens_neox': 785, 'n_words': 188}