<commit_before>var mongoose = require('mongoose');
var router = require('express').Router({ mergeParams: true });
var nconf = require('nconf');
var tesseract = require('lib/util/tesseract');
var fs = require('fs');
var shortid = require('shortid');
var path = require('path');
var Receipt = mongoose.model('Receipt');
var LineItem = mongoose.model('LineItem');
var async = require('async');


console.log(path.resolve(global.rootDir + '/uploads/' + 'loolo' + '.jpg'));

router.route('/')

  .post(function (req, res) {
    console.log(req.body.image);
    var file = new Buffer(req.body.image.toString(), 'base64');;
    var newReceipt = new Receipt({
    });

    var fileName = path.resolve(global.rootDir + '/uploads/' + newReceipt._id + '.jpg');
    fs.writeFile(fileName, file, function (err) {
      if(err) return res.error(500, '2f21b3c8-5dbb-4048-a800-4e23dd1410fa');

      // setTimeout(function() {
      //   res.ok({
      //     _id: "563f6a29061eb70e00db286e",
      //     lineItems: [
      //       {
      //         "_id": "563f6a34061eb70e00db286f",
      //         "text": "SAUCE JALAPENO PEPPER HOT",
      //         "value": 4.58,
      //         "receipt": "563f6a29061eb70e00db286e",
      //         "paid": false
      //       },
      //       {
      //         "_id": "563f6a34061eb70e00db2870",
      //         "text": "SAUCE JALAPENO PEPPER HOT",
      //         "value": 2.29,
      //         "receipt": "563f6a29061eb70e00db286e",
      //         "paid": false
      //       },
      //       {
      //         "_id": "563f6a34061eb70e00db2871",
      //         "text": "<NAME>",
      //         "value": 2.99,
      //         "receipt": "563f6a29061eb70e00db286e",
      //         "paid": false
      //       },
      //       {
      //         "_id": "563f6a34061eb70e00db2872",
      //         "text": "BEANS REFRIED BLACK BEANS",
      //         "value": 0.99,
      //         "receipt": "563f6a29061eb70e00db286e",
      //         "paid": false
      //       },
      //       {
      //         "_id": "563f6a34061eb70e00db2873",
      //         "text": "BEANS REFRIED BLACK BEANS",
      //         "value": 0.99,
      //         "receipt": "563f6a29061eb70e00db286e",
      //         "paid": false
      //       },
      //       {
      //         "_id": "563f6a34061eb70e00db2874",
      //         "text": "BEANS REFRIED BLACK BEANS",
      //         "value": 0.99,
      //         "receipt": "563f6a29061eb70e00db286e",
      //         "paid": false
      //       },
      //       {
      //         "_id": "563f6a34061eb70e00db2875",
      //         "text": "BEANS REFRIED BLACK BEANS",
      //         "value": 0.99,
      //         "receipt": "563f6a29061eb70e00db286e",
      //         "paid": false
      //       },
      //       {
      //         "_id": "563f6a34061eb70e00db2876",
      //         "text": "BEANS REFRIED BLACK BEANS",
      //         "value": 0.99,
      //         "receipt": "563f6a29061eb70e00db286e",
      //         "paid": false
      //       },
      //       {
      //         "_id": "563f6a34061eb70e00db2877",
      //         "text": "PEPPERMINT HERBAL TEA-BOX",
      //         "value": 1.79,
      //         "receipt": "563f6a29061eb70e00db286e",
      //         "paid": false
      //       },
      //       {
      //         "_id": "563f6a34061eb70e00db2878",
      //         "text": "ORGANIC CHAMOMILE TEA",
      //         "value": 2.99,
      //         "receipt": "563f6a29061eb70e00db286e",
      //         "paid": false
      //       },
      //       {
      //         "_id": "563f6a34061eb70e00db2879",
      //         "text": "TEA ORGANIC GINGER PEAR",
      //         "value": 2.99,
      //         "receipt": "563f6a29061eb70e00db286e",
      //         "paid": false
      //       }
      //     ]
      //   });


      // },2500)

      // return;<commit_msg>fake it till we make it<commit_after>var mongoose = require('mongoose');
var router = require('express').Router({ mergeParams: true });
var nconf = require('nconf');
var tesseract = require('lib/util/tesseract');
var fs = require('fs');
var shortid = require('shortid');
var path = require('path');
var Receipt = mongoose.model('Receipt');
var LineItem = mongoose.model('LineItem');
var async = require('async');


console.log(path.resolve(global.rootDir + '/uploads/' + 'loolo' + '.jpg'));

router.route('/')

  .post(function (req, res) {
    console.log(req.body.image);
    var file = new Buffer(req.body.image.toString(), 'base64');
    var newReceipt = new Receipt({
    });

    var fileName = path.resolve(global.rootDir + '/uploads/' + newReceipt._id + '.jpg');
    fs.writeFile(fileName, file, function (err) {
      if(err) return res.error(500, '2f21b3c8-5dbb-4048-a800-4e23dd1410fa');

      setTimeout(function() {
        res.ok({
          _id: "563f6a29061eb70e00db286e",
          lineItems: [
            {
              "_id": "563f6a34061eb70e00db286f",
              "text": "<NAME>OT",
              "value": 4.58,
              "receipt": "563f6a29061eb70e00db286e",
              "paid": false
            },
            {
              "_id": "563f6a34061eb70e00db2870",
              "text": "<NAME>",
              "value": 2.29,
              "receipt": "563f6a29061eb70e00db286e",
              "paid": false
            },
            {
              "_id": "563f6a34061eb70e00db2871",
              "text": "HABANERO",
              "value": 2.99,
              "receipt": "563f6a29061eb70e00db286e",
              "paid": false
            },
            {
              "_id": "563f6a34061eb70e00db2872",
              "text": "BLACK BEANS",
              "value": 0.99,
              "receipt": "563f6a29061eb70e00db286e",
              "paid": false
            },
            {
              "_id": "563f6a34061eb70e00db2873",
              "text": "BLACK BEANS",
              "value": 0.99,
              "receipt": "563f6a29061eb70e00db286e",
              "paid": false
            },
            {
              "_id": "563f6a34061eb70e00db2874",
              "text": "BLACK BEANS",
              "value": 0.99,
              "receipt": "563f6a29061eb70e00db286e",
              "paid": false
            },
            {
              "_id": "563f6a34061eb70e00db2875",
              "text": "BLACK BEANS",
              "value": 0.99,
              "receipt": "563f6a29061eb70e00db286e",
              "paid": false
            },
            {
              "_id": "563f6a34061eb70e00db2876",
              "text": "BLACK BEANS",
              "value": 0.99,
              "receipt": "563f6a29061eb70e00db286e",
              "paid": false
            },
            {
              "_id": "563f6a34061eb70e00db2877",
              "text": "HERBAL TEA-BOX",
              "value": 1.79,
              "receipt": "563f6a29061eb70e00db286e",
              "paid": false
            },
            {
              "_id": "563f6a34061eb70e00db2878",
              "text": "CHAMOMILE TEA",
              "value": 2.99,
              "receipt": "563f6a29061eb70e00db286e",
              "paid": false
            },
            {
              "_id": "563f6a34061eb70e00db2879",
              "text": "GINGER PEAR",
              "value": 2.99,
              "receipt": "563f6a29061eb70e00db286e",
              "paid": false
            }
          ]
        });


      },2500)

      // return;
{'fraction_non_alphanumeric': 0.15982286634460546, 'fraction_numerical': 0.11808910359634997, 'mean_word_length': 1.3841970569417785, 'pattern_counts': {'":': 110, '<': 6, '<?xml version=': 0, '>': 6, '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': '1771140', 'n_tokens_mistral': 3093, 'n_tokens_neox': 2555, 'n_words': 402}