<commit_before>#
# CDR-Stats License
# http://www.cdr-stats.org
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at http://mozilla.org/MPL/2.0/.
#
# Copyright (C) 2011-2012 Star2Billing S.L.
#
# The Initial Developer of the Original Code is
# <NAME> <<EMAIL>>
#

def pipeline_cdr_view_daily_report(query_var):
    """
    To get the day vise analytic of cdr

    Attributes:

        * ``query_var`` - filter variable for collection
    """
    pipeline = [
        {'$match': query_var},
        {'$group': {
            '_id': {'$substr': ["$_id", 0, 8]},
            'call_per_day': {'$sum': '$call_daily'},
            'duration_per_day': {'$sum': '$duration_daily'}
            }
        },
        {'$project': {
            'call_per_day': 1,
            'duration_per_day': 1,
            'avg_duration_per_day': {'$divide': ["$duration_per_day", "$call_per_day"]}
            }
        },
        {'$sort': {
            '_id': 1
            }<commit_msg>updated cdr daily report view with latest entry<commit_after>#
# CDR-Stats License
# http://www.cdr-stats.org
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at http://mozilla.org/MPL/2.0/.
#
# Copyright (C) 2011-2012 Star2Billing S.L.
#
# The Initial Developer of the Original Code is
# <NAME> <<EMAIL>>
#

def pipeline_cdr_view_daily_report(query_var):
    """
    To get the day vise analytic of cdr

    Attributes:

        * ``query_var`` - filter variable for collection
    """
    pipeline = [
        {'$match': query_var},
        {'$group': {
            '_id': {'$substr': ["$_id", 0, 8]},
            'call_per_day': {'$sum': '$call_daily'},
            'duration_per_day': {'$sum': '$duration_daily'}
            }
        },
        {'$project': {
            'call_per_day': 1,
            'duration_per_day': 1,
            'avg_duration_per_day': {'$divide': ["$duration_per_day", "$call_per_day"]}
            }
        },
        {'$sort': {
            '_id': -1
            }
{'fraction_non_alphanumeric': 0.15388107126645484, 'fraction_numerical': 0.016341352700862462, 'mean_word_length': 2.1895803183791607, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '6313220', 'n_tokens_mistral': 753, 'n_tokens_neox': 706, 'n_words': 199}