<commit_before>'use strict';

var glimpse = require('glimpse');

var create = (function() {
    var processMessageSummary = function(request, message) {
        if (message.indexes && message.indexes.length > 0) {
            for (var index in message.indexes) {
                request[index] = message.indexes[index];
            }
        }
    };
    var processMessageDetail = function(request, message) {
        request.messages.push(message);
    };
    var processMessage = function(messagesForRequest, processAction) {
        var request = {};

        for (var i = 0; i < messagesForRequest.length; i++) {
            var message = messagesForRequest[i];

            processAction(request, message);
        }

        return request;
    };
    var processMessageList = function(messagesByRequest, processAction) {
        var requests = {};

        for (var requestId in messagesByRequest) {
            var messagesForRequest = messagesByRequest[requestId].allMessages;

            requests[requestId] = processMessage(messagesForRequest, processAction);
        }

        return requests;
    };

    var processActionSummary = function(request, message) {
        processMessageSummary(request, message);
    };
    var processActionDetail = function(request, message) {
        processMessageSummary(request, message);
        processMessageDetail(request, message);
    };

    return {
            summary: function(messages) {
                var requests = processMessageList(messages.updatedMessagesByRequest, processActionSummary);

                return requests;
            },
            detail: function(messages) {
                var requests = processMessageList(messages.updatedMessagesByRequest, processActionDetail);

                return requests;
            }
        };
})();

// adapt Found Summary
(function () {
    function adaptMessageSummary(messages) {
        var payload = create.summary(messages);

        glimpse.emit('data.request.summary.found.message', payload);
    }

    glimpse.on('data.message.summary.found', adaptMessageSummary);
})();

// adapt Found Details
(function () {
    function adaptMessageDetail(messages) {
        var payload = create.detail(messages);

        glimpse.emit('data.request.detail.found.message', payload);
    }

    glimpse.on('data.message.detail.found', adaptMessageDetail);
})();
<commit_msg>Update message processing to pull out abstract<commit_after>'use strict';

var glimpse = require('glimpse');

var create = (function() {
    var processMessageSummary = function(request, message) {
        // process indexes (promoted to first class properties)
        if (message.indexes && message.indexes.length > 0) {
            for (var index in message.indexes) {
                request[index] = message.indexes[index];
            }
        }

        // process abstract (placed in abstract property)
        if (message.abstract) {
            var abstract = request.abstract || (request.abstract = {});
            for (var abstractKey in message.abstract) {
                abstract[abstractKey] = message.abstract[abstractKey];
            }
        }
    };
    var processMessageDetail = function(request, message) {
        request.messages.push(message);
    };
    var processMessage = function(messagesForRequest, processAction) {
        var request = {};

        for (var i = 0; i < messagesForRequest.length; i++) {
            var message = messagesForRequest[i];

            processAction(request, message);
        }

        return request;
    };
    var processMessageList = function(messagesByRequest, processAction) {
        var requests = {};

        for (var requestId in messagesByRequest) {
            var messagesForRequest = messagesByRequest[requestId].allMessages;

            requests[requestId] = processMessage(messagesForRequest, processAction);
        }

        return requests;
    };

    var processActionSummary = function(request, message) {
        processMessageSummary(request, message);
    };
    var processActionDetail = function(request, message) {
        processMessageSummary(request, message);
        processMessageDetail(request, message);
    };

    return {
            summary: function(messages) {
                var requests = processMessageList(messages.updatedMessagesByRequest, processActionSummary);

                return requests;
            },
            detail: function(messages) {
                var requests = processMessageList(messages.updatedMessagesByRequest, processActionDetail);

                return requests;
            }
        };
})();

// adapt Found Summary
(function () {
    function adaptMessageSummary(messages) {
        var payload = create.summary(messages);

        glimpse.emit('data.request.summary.found.message', payload);
    }

    glimpse.on('data.message.summary.found', adaptMessageSummary);
})();

// adapt Found Details
(function () {
    function adaptMessageDetail(messages) {
        var payload = create.detail(messages);

        glimpse.emit('data.request.detail.found.message', payload);
    }

    glimpse.on('data.message.detail.found', adaptMessageDetail);
})();

{'fraction_non_alphanumeric': 0.1062151241100635, 'fraction_numerical': 0.0007696748123917645, 'mean_word_length': 2.521680216802168, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '3103189', 'n_tokens_mistral': 1292, 'n_tokens_neox': 1273, 'n_words': 280}