<commit_before>var url = require('url');
var mongojs = require('mongojs');
var db = mongojs('YSFHcSINE', ['POST', 'session']);

function Log(time, loaction, data) {
    return {
        timestamp: time,
        url: url.parse(location),
        data: data
    };
}

function savePost(req, forwardURL) {
    var sine_id = null;

    db.session.findOne({session_id: req.cookies.session_id}, function (err, doc) {
        if (err) { console.error(err.stack); }
        if (!doc.sine_id) throw new Error('session_id: ' + req.cookies.session_id + 'に対するsine_idが見つかりません。');
        sine_id = doc.sine_id;
    });

    var rawData = '';
    req.on('data', function (data) {
        rawData += data;
    });
    req.on('end', function () {
        var postData = JSON.parse(rawData);
        var postLog = Log(new Date(), forwardURL, postData);
        waitOrPost(postLog);<commit_msg>POSTじゃないときは無視しなきゃ<commit_after>var url = require('url');
var mongojs = require('mongojs');
var db = mongojs('YSFHcSINE', ['POST', 'session']);

function Log(time, loaction, data) {
    return {
        timestamp: time,
        url: url.parse(location),
        data: data
    };
}

function savePost(req, forwardURL) {
    if (req.method != 'POST') return;
    
    var sine_id = null;

    db.session.findOne({session_id: req.cookies.session_id}, function (err, doc) {
        if (err) { console.error(err.stack); }
        if (!doc.sine_id) throw new Error('session_id: ' + req.cookies.session_id + 'に対するsine_idが見つかりません。');
        sine_id = doc.sine_id;
    });

    var rawData = '';
    req.on('data', function (data) {
        rawData += data;
    });
    req.on('end', function () {
        var postData = JSON.parse(rawData);
        var postLog = Log(new Date(), forwardURL, postData);
        waitOrPost(postLog);
{'fraction_non_alphanumeric': 0.15897720956086714, 'fraction_numerical': 0.0, 'mean_word_length': 2.896103896103896, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '4570637', 'n_tokens_mistral': 641, 'n_tokens_neox': 626, 'n_words': 131}