<commit_before>'use strict';

const request = require('requestretry').defaults({timeout: 10000, maxAttempts: 3, retryDelay: 500})
const sprintf = require('sprintf')
const utils = require('./utils')
const moment = require('moment-timezone')
const zone = "Europe/Lisbon"

const URL = 'http://www.adicional.pt/contact/tracking.php?reference=%s&cp=%s'

const adicional = {}

/**
 * Get Adicional info
 * Async
 *
 * @param id
 * @param postcode
 * @param callback(Error, AdicionalInfo)
 */
adicional.getInfo = function (id, postcode, callback) {
    request(sprintf(URL, id, postcode),
        function (error, response, body) {
            if (error || response.statusCode != 200) {
                callback(utils.getError('DOWN'))
                return
            }

            if(body.length == 0) {
                return callback(utils.getError('DOWN'))
            }

            const json = JSON.parse(body)

            // Not found
            if (json.length == 0) {
                callback(utils.getError('NO_DATA'))
                return
            }

            let entity = null
            try {
                entity = new AdicionalInfo(json[0])
                entity.retries = response.attempts
<commit_msg>Replaced Adicional no data info to EMPTY<commit_after>'use strict';

const request = require('requestretry').defaults({timeout: 10000, maxAttempts: 3, retryDelay: 500})
const sprintf = require('sprintf')
const utils = require('./utils')
const moment = require('moment-timezone')
const zone = "Europe/Lisbon"

const URL = 'http://www.adicional.pt/contact/tracking.php?reference=%s&cp=%s'

const adicional = {}

/**
 * Get Adicional info
 * Async
 *
 * @param id
 * @param postcode
 * @param callback(Error, AdicionalInfo)
 */
adicional.getInfo = function (id, postcode, callback) {
    request(sprintf(URL, id, postcode),
        function (error, response, body) {
            if (error || response.statusCode != 200) {
                callback(utils.getError('DOWN'))
                return
            }

            if(body.length == 0) {
                return callback(utils.getError('EMPTY'))
            }

            const json = JSON.parse(body)

            // Not found
            if (json.length == 0) {
                callback(utils.getError('NO_DATA'))
                return
            }

            let entity = null
            try {
                entity = new AdicionalInfo(json[0])
                entity.retries = response.attempts

{'fraction_non_alphanumeric': 0.1270096463022508, 'fraction_numerical': 0.012057877813504822, 'mean_word_length': 2.0919254658385094, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '5595291', 'n_tokens_mistral': 728, 'n_tokens_neox': 690, 'n_words': 164}