#!/usr/bin/env node

/*
 * Simple Patient insert - will make other test inserts (allergies etc) check
 * that this has run first (or even invoke it if need be)
 *
 * NOTE: may have to make bullet proof and insert Users (file 200) as well.
 *
 * (c) 2016 VISTA Data Project
 */

'use strict';

/*
 * Check OSEHRA setup with adt menu invocation - osehraSetup.py and
 * https://github.com/vistadataproject/VDM/issues/138#issuecomment-255183687
 * ie/ does the menu do more than DPT insert?
 */

/*
 * Basic setup
 */
const _ = require('lodash');
const nodem = require('nodem');
const VDM = require('../../vdm');
const vdmModel = require('../vdmPatientModel').vdmModel;

const testPatients = require('../vdmTestPatients.js');

process.env.gtmroutines = `${process.env.gtmroutines} ..`; // make VDP MUMPS available

const db = new nodem.Gtm();
db.open();
VDM.setDBAndModel(db, vdmModel);

try {
    // REM: will insert in next place ie/ all new

    const res = VDM.create(testPatients.one);
    console.log(res);
} catch (e) {
    console.log(e);
}

db.close();

