<commit_before>var superagent  = require('superagent');
var superagentQ = require('superagent-promises');

class NationalPlanMapper {

    //============================================================
    //
    //
    //============================================================
    async query () {
        
    	var url = "https://chm.cbd.int/api/v2013/index/select?fl=id,title_t,government_s,createdDate_dt,updatedDate_dt,url_ss,reportType_s,documentLinks_s&q=NOT+version_s:*+AND+realm_ss:chm+AND+schema_s:*+AND+(+schema_s:nationalReport+)+AND+(+reportType_s:B0EBAE91-9581-4BB2-9C02-52FCF9D82721+)&rows=9999&start=0&wt=json"

    	var res = await superagent.get(url).use(superagentQ).end();

    	return res.body.response.docs.map(document => new NationalPlan({
			protocolVersion: 1,
			id: document.id,
			treaty: 'cbd',
			country: document.government_s,
			type: 'nbsap',
			title: [{ language: 'en', value: document.title_t }],
			url: document.url_ss[0],
            files: JSON.parse(document.documentLinks_s||'[]').map(link => new File({
                filename: link.name,
                url: link.url
            })),
			submission: document.createdDate_dt,
			updated: document.updatedDate_dt
		
        }));
	}
}

export default new NationalPlanMapper();


///<commit_msg>housekeeping<commit_after>var superagent  = require('superagent');
var superagentQ = require('superagent-promises');

class NationalPlanMapper {

    //============================================================
    //
    //
    //============================================================
    async query () {
        
    	var url = "https://chm.cbd.int/api/v2013/index/select?fl=id,title_t,government_s,createdDate_dt,updatedDate_dt,url_ss,reportType_s,documentLinks_s&q=NOT+version_s:*+AND+realm_ss:chm+AND+schema_s:*+AND+(+schema_s:nationalReport+)+AND+(+reportType_s:B0EBAE91-9581-4BB2-9C02-52FCF9D82721+)&rows=9999&start=0&wt=json"

    	var res = await superagent.get(url).use(superagentQ).end();

    	return res.body.response.docs.map(document => new NationalPlan({
			protocolVersion: 1,
			id: document.id,
			treaty: 'cbd',
			country: document.government_s,
			type: 'nbsap',
			title: [{ language: 'en', value: document.title_t }],
			url: document.url_ss[0],
            files: JSON.parse(document.documentLinks_s||'[]').map(link => new File({
                filename: link.name,
                url: link.url
            })),
			submission: document.createdDate_dt,
			updated: document.updatedDate_dt
		
        }));
	}
}

export default new NationalPlanMapper();
{'fraction_non_alphanumeric': 0.23226056611089568, 'fraction_numerical': 0.02404032570763862, 'mean_word_length': 3.9710982658959537, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 2, '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': '6505627', 'n_tokens_mistral': 920, 'n_tokens_neox': 826, 'n_words': 108}