# Path: data_catalog/metadata_entry.py
# CERBERUS_SCHEMA = {
#     CATEGORY_FIELD: {'required': True, 'type': 'string'},
#     CREATION_TIME_FIELD: {'required': False, 'type': 'string'},
#     'dataSample': {'required': True, 'type': 'string'},
#     'format': {'required': True, 'type': 'string'},
#     IS_PUBLIC_FIELD: {'required': True, 'type': 'boolean'},
#     ORG_UUID_FIELD: {'required': True, 'type': 'string'},
#     'recordCount': {'required': True, 'type': 'integer'},
#     'size': {'required': True, 'type': 'integer'},
#     'sourceUri': {'required': True, 'type': 'string'},
#     TARGET_URI_FIELD: {'required': True, 'type': 'string'},
#     TITLE_FIELD: {'required': True, 'type': 'string'}}
# 
# ORG_UUID_FIELD = 'orgUUID'
# 
# CREATION_TIME_FIELD = 'creationTime'
# 
# IS_PUBLIC_FIELD = 'isPublic'


import json
import logging
from data_catalog.metadata_entry import (CERBERUS_SCHEMA, ORG_UUID_FIELD, CREATION_TIME_FIELD,
                                         IS_PUBLIC_FIELD)
            query_filters_dict = {'and': query_filters}
        else:
            query_filters_dict = {}

        if post_filters:
            return query_filters_dict, {'and': post_filters}
        else:
            return query_filters_dict, {}

    def _filters_segregation(self, filters, dataset_filtering):
        query_filters = []
        post_filters = []
        or_filters = []
        # filters should be in form NAME: [VALUE, VALUE, ...]
        for data_set_filter in filters:
            filter_type, filter_values = self._get_filter_properties(data_set_filter)
            es_filter = self._translate_filter(filter_type, filter_values)
            if not es_filter:
                continue
            if dataset_filtering is DataSetFiltering.PRIVATE_AND_PUBLIC:
                if filter_type in [ORG_UUID_FIELD, IS_PUBLIC_FIELD]:
                    # filters that are applied with 'or' parameter
                    or_filters.append(es_filter)
                elif filter_type in [CREATION_TIME_FIELD]:
                    # filters that are applied with the query (result are filtered)
                    query_filters.append(es_filter)
                else:
                    # filters that are applied AFTER the query (results are unfiltered)
                    post_filters.append(es_filter)
            else:

# Path: data_catalog/metadata_entry.py
# CERBERUS_SCHEMA = {
#     CATEGORY_FIELD: {'required': True, 'type': 'string'},
#     CREATION_TIME_FIELD: {'required': False, 'type': 'string'},
#     'dataSample': {'required': True, 'type': 'string'},
#     'format': {'required': True, 'type': 'string'},
#     IS_PUBLIC_FIELD: {'required': True, 'type': 'boolean'},
#     ORG_UUID_FIELD: {'required': True, 'type': 'string'},
#     'recordCount': {'required': True, 'type': 'integer'},
#     'size': {'required': True, 'type': 'integer'},
#     'sourceUri': {'required': True, 'type': 'string'},
#     TARGET_URI_FIELD: {'required': True, 'type': 'string'},
#     TITLE_FIELD: {'required': True, 'type': 'string'}}
# 
# ORG_UUID_FIELD = 'orgUUID'
# 
# CREATION_TIME_FIELD = 'creationTime'
# 
# IS_PUBLIC_FIELD = 'isPublic'


# Path: data_catalog/query_translation.py
import json
import logging
from data_catalog.metadata_entry import (CERBERUS_SCHEMA, ORG_UUID_FIELD, CREATION_TIME_FIELD,
                                         IS_PUBLIC_FIELD)

            query_filters_dict = {'and': query_filters}
        else:
            query_filters_dict = {}

        if post_filters:
            return query_filters_dict, {'and': post_filters}
        else:
            return query_filters_dict, {}

    def _filters_segregation(self, filters, dataset_filtering):
        query_filters = []
        post_filters = []
        or_filters = []
        # filters should be in form NAME: [VALUE, VALUE, ...]
        for data_set_filter in filters:
            filter_type, filter_values = self._get_filter_properties(data_set_filter)
            es_filter = self._translate_filter(filter_type, filter_values)
            if not es_filter:
                continue
            if dataset_filtering is DataSetFiltering.PRIVATE_AND_PUBLIC:
                if filter_type in [ORG_UUID_FIELD, IS_PUBLIC_FIELD]:
                    # filters that are applied with 'or' parameter
                    or_filters.append(es_filter)
                elif filter_type in [CREATION_TIME_FIELD]:
                    # filters that are applied with the query (result are filtered)
                    query_filters.append(es_filter)
                else:
                    # filters that are applied AFTER the query (results are unfiltered)
                    post_filters.append(es_filter)
            else:

                if filter_type in [ORG_UUID_FIELD, CREATION_TIME_FIELD, IS_PUBLIC_FIELD]: