removed oscarhost and soap

This commit is contained in:
David Baldwynn 2016-11-08 14:53:10 -08:00
parent 9e4ed965a3
commit 71cd2ff1a3
9 changed files with 10 additions and 288 deletions

View file

@ -14,8 +14,7 @@ var mongoose = require('mongoose'),
mUtilities = require('mongoose-utilities'),
soap = require('soap'),
async = require('async'),
FieldSchema = require('./form_field.server.model.js'),
OscarSecurity = require('../../scripts/oscarhost/OscarSecurity');
FieldSchema = require('./form_field.server.model.js');
var FieldSchema = require('./form_field.server.model.js');

View file

@ -10,9 +10,7 @@ var should = require('should'),
Field = mongoose.model('Field'),
_ = require('lodash'),
async = require('async'),
soap = require('soap'),
config = require('../../config/config'),
OscarSecurity = require('../../scripts/oscarhost/OscarSecurity'),
FormSubmission = mongoose.model('FormSubmission');
var exampleDemo = {
@ -174,50 +172,6 @@ describe('FormSubmission Model Unit Tests:', function() {
done();
});
});
// it('should add Patient to OscarHost EMR after save', function(done){
// var url_login = myForm.plugins.oscarhost.baseUrl+'/LoginService?wsdl',
// url_demo = myForm.plugins.oscarhost.baseUrl+'/DemographicService?wsdl',
// args_login = {arg0: config.oscarhost.auth.user, arg1: config.oscarhost.auth.pass};
// var options = {
// ignoredNamespaces: {
// namespaces: ['targetNamespace', 'typedNamespace'],
// override: true
// }
// };
// async.waterfall([
// function (callback) {
// //Authenticate with API
// soap.createClient(url_login, options, function(err, client) {
// client.login(args_login, function (err, result) {
// if(err) callback(err);
// callback(null, result.return);
// });
// });
// },
// function (security_obj, callback) {
// soap.createClient(url_demo, options, function(err, client) {
// client.setSecurity(new OscarSecurity(security_obj.securityId, security_obj.securityTokenKey) );
// client.getDemographic({ arg0: oscar_demo_num }, function (err, result) {
// if(err) callback(err);
// callback(null, result);
// });
// });
// },
// ], function(err, result) {
// if(err) done(err);
// should.exist(result);
// console.log(result.return);
// done();
// });
// });
});
describe('Method Find', function(){

8
config/env/all.js vendored
View file

@ -7,6 +7,14 @@ module.exports = {
description: process.env.APP_DESC || 'Opensource form builder alternative to TypeForm',
keywords: process.env.APP_KEYWORDS || 'typeform, pdfs, forms, opensource, formbuilder, google forms, nodejs'
},
db: {
uri: 'mongodb://'+(process.env.DB_HOST || 'localhost')+'/mean',
options: {
user: '',
pass: ''
}
},
port: process.env.PORT || 3000,
socketPort: process.env.SOCKET_PORT || 20523,

View file

@ -87,7 +87,6 @@
"prerender-node": "^2.2.1",
"random-js": "^1.0.8",
"raven": "^0.9.0",
"soap": "^0.11.0",
"socket.io": "^1.4.6",
"socket.io-redis": "^1.0.0",
"swig": "~1.4.1",

View file

@ -1,23 +0,0 @@
"use strict";
var crypto = require('crypto'),
passwordDigest = require('soap/lib/utils').passwordDigest;
function WSSecurity(username, password) {
this._username = username;
this._password = password;
}
WSSecurity.prototype.toXML = function() {
var password = "<wsse:Password Type=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText\">" + this._password + "</wsse:Password>";
return "<wsse:Security xmlns:wsse=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd\" xmlns:wsu=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd\" soap:mustUnderstand=\"1\">" +
"<wsse:UsernameToken xmlns:wsu=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd\" wsu:Id=\"UsernameToken-1\">" +
"<wsse:Username>" + this._username + "</wsse:Username>" +
password +
"</wsse:UsernameToken>" +
"</wsse:Security>";
};
module.exports = WSSecurity;

View file

@ -1,114 +0,0 @@
var soap = require('soap'),
async = require('async'),
demo = require('./test_headless'),
OscarSecurity = require('./OscarSecurity');
var url_demo = 'https://secure2.oscarhost.ca/kensington/ws/DemographicService?wsdl',
url_login = 'https://secure2.oscarhost.ca/kensington/ws/LoginService?wsdl',
args_demo = {arg0: 0},
args_login = {arg0: 'username', arg1: 'password'},
my_hin = 1234123123;
var fakeDemo = {
"activeCount": 1,
"address": "880-9650 Velit. St.",
"alias": "",
"anonymous": "",
"chartNo": "",
"children":"",
"citizenship":"Canadian",
"city": "Lloydminster",
"dateJoined": new Date(),
"dateOfBirth": "10",
"demographicNo": 90348,
"email": "Sed.nunc@dis.co.uk",
"firstName": "Uriah F.",
"hin": 9146509343,
"lastName": "Little",
"lastUpdateDate": new Date(),
"monthOfBirth": "05",
"officialLanguage": "English",
"phone": "(306) 872-3210",
"phone2": "(306) 556-8264",
"providerNo": 4,
"province": "SK",
"sex": "F",
"spokenLanguage": "English",
"postal": "S4M 7T8",
"yearOfBirth": "2015"
};
var exampleDemo = {
activeCount: 1,
address: '880-9650 Velit. St.',
chartNo: '',
city: '',
dateJoined: Date.now(),
dateOfBirth: '10',
displayName: 'LITTLE, URIAH',
email: '',
familyDoctor: '<rdohip></rdohip><rd></rd>',
firstName: 'Uriah F.',
hcType: 'BC',
hin: '',
hsAlertCount: 0,
lastName: 'Little',
lastUpdateDate: Date.now(),
lastUpdateUser: '',
links: '',
monthOfBirth: '05',
officialLanguage: 'English',
patientStatus: 'AC',
patientStatusDate: Date.now(),
phone: '250-',
phone2: '',
postal: "S4M 7T8",
providerNo: '4',
province: 'BC',
rosterStatus: '',
sex: 'M',
sexDesc: 'Female',
sin: '',
spokenLanguage: 'English',
title: 'MS.',
yearOfBirth: '2015' }
var options = {
ignoredNamespaces: {
namespaces: ['targetNamespace', 'typedNamespace'],
override: true
}
}
async.waterfall([
function (callback) {
//Authenticate with API
soap.createClient(url_login, options, function(err, client) {
client.login(args_login, function (err, result) {
if(err) callback(err);
callback(null, result.return);
});
});
},
function (security_obj, callback) {
//Add demographic
soap.createClient(url_demo, options, function(err, client) {
client.setSecurity(new OscarSecurity(security_obj.securityId, security_obj.securityTokenKey) );
client.addDemographic({ arg0: exampleDemo }, function (err, result) {
if(err) callback(err);
console.log(client.describe());
callback(null, result);
});
});
},
], function(err, result) {
if(err) throw err;
console.log(result);
});

View file

@ -1,97 +0,0 @@
var soap = require('soap'),
async = require('async'),
demo = require('./test_headless'),
OscarSecurity = require('./OscarSecurity');
var url_demo = 'https://secure2.oscarhost.ca/kensington/ws/DemographicService?wsdl',
url_login = 'https://secure2.oscarhost.ca/kensington/ws/LoginService?wsdl',
args_demo = {arg0: 0},
args_login = {arg0: 'davieb', arg1: 'Temppass1'},
my_hin = 9146489321;
var fakeDemo = {
"activeCount": 1,
"address": "880-9650 Velit. St.",
"alias": "",
"anonymous": "",
"chartNo": 200000,
"children": "",
"hin": 9146509343,
"city": "Lloydminster",
"dateJoined": new Date(),
"dateOfBirth": "10",
"demographicNo": 90348,
"email": "Sed.nunc@dis.co.uk",
"familyDoctor": "<rdohip></rdohip><rd></rd>",
"firstName": "Uriah F.",
"lastName": "Little",
"monthOfBirth": "05",
"officialLanguage": "English",
"phone": "(306) 872-3210",
"phone2": "(306) 556-8264",
"providerNo": 4,
"province": "SK",
"sex": "F",
"spokenLanguage": "English",
"postal": "S4M 7T8",
"yearOfBirth": "2015"
};
var options = {
ignoredNamespaces: {
namespaces: ['targetNamespace', 'typedNamespace'],
override: true
}
}
async.waterfall([
function (callback) {
//Authenticate with API
soap.createClient(url_login, options, function(err, client) {
client.login(args_login, function (err, result) {
if(err) callback(err);
callback(null, result.return);
});
});
},
function (security_obj, callback){
//Search by HIN for demographic number
demo.getDemoByHIN(my_hin, function(demo_num){
args_demo.arg0 = demo_num;
callback(null, security_obj)
});
},
function (security_obj, callback) {
//Get demographic
soap.createClient(url_demo, options, function(err, client) {
client.setSecurity(new OscarSecurity(security_obj.securityId, security_obj.securityTokenKey) );
client.getDemographic(args_demo, function (err, result) {
if(err) callback(err);
console.log('My Demographic:')
console.log(result);
callback(null, security_obj);
});
});
},
function (security_obj, callback) {
//Add demographic
soap.createClient(url_demo, options, function(err, client) {
client.setSecurity(new OscarSecurity(security_obj.securityId, security_obj.securityTokenKey) );
client.addDemographic(fakeDemo, function (err, result) {
if(err) callback(err);
callback(null, result);
});
});
},
], function(err, result) {
if(err) throw err;
console.log(result);
});

View file

@ -13,10 +13,7 @@ var init = require('../config/init')(),
fs = require('fs-extra'),
chalk = require('chalk');
/**
* Main application entry file.
* Please note that the order of loading is important.
*/
console.log(config);
// Bootstrap db connection
var db = mongoose.connect(config.db.uri, config.db.options, function(err) {

View file

@ -13,7 +13,6 @@ var init = require('./config/init')(),
mongoose = require('mongoose'),
chalk = require('chalk');
/**
* Main application entry file.
* Please note that the order of loading is important.