Produced by Araxis Merge on 10/4/2017 8:04:35 AM Central Daylight Time. See www.araxis.com for information about Merge. This report uses XHTML and CSS2, and is best viewed with a modern standards-compliant browser. For optimum results when printing this report, use landscape orientation and enable printing of background images and colours in your browser.
| # | Location | File | Last Modified |
|---|---|---|---|
| 1 | rdk.zip\rdk\product\production\rdk\src\subsystems\clinical-objects | clinical-objects-subsystem-spec.js | Mon Aug 21 12:51:00 2017 UTC |
| 2 | rdk.zip\rdk\product\production\rdk\src\subsystems\clinical-objects | clinical-objects-subsystem-spec.js | Tue Oct 3 18:30:49 2017 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 20 | 728 |
| Changed | 19 | 64 |
| Inserted | 0 | 0 |
| Removed | 0 | 0 |
| Whitespace | |
|---|---|
| Character case | Differences in character case are significant |
| Line endings | Differences in line endings (CR and LF characters) are ignored |
| CR/LF characters | Not shown in the comparison detail |
No regular expressions were active.
| 1 | 'use stric t'; | |
| 2 | ||
| 3 | var _ = re quire('lod ash'); | |
| 4 | var clinic alObjects = require( './clinica l-objects- subsystem' ); | |
| 5 | var logger = sinon.s tub(requir e('bunyan' ).createLo gger({name : 'clinica l-objects- subsystem' })); | |
| 6 | var nock = require(' nock'); | |
| 7 | ||
| 8 | var sample 1 = { | |
| 9 | uid: 'urn: va:ehmp-or der: R E D A CTED :3:de305d5 4-75b4-431 b-adb2-eb6 b9e546014' , | |
| 10 | patientUid : 'urn:va: patient: R E D A CTED :3:3', | |
| 11 | model: { | |
| 12 | patientUid : 'urn:va: patient: R E D A CTED :3:3', | |
| 13 | authorUid: ' PL ', | |
| 14 | do main: 'ehm p-order', | |
| 15 | su bDomain: ' laboratory ', | |
| 16 | eh mpState: ' active', | |
| 17 | vi sit: { | |
| 18 | location : 'locatio n', | |
| 19 | serviceC ategory: ' serviceCat egory', | |
| 20 | dateTime : 'dateTim e' | |
| 21 | }, | |
| 22 | referenceI d: 'urn:va :order: R E D A CTED :3:15479', | |
| 23 | da ta: { | |
| 24 | labTestT ext: 'Lab Text', | |
| 25 | currentI temCount: 1, | |
| 26 | items: [ { | |
| 27 | fiel d1: 'field 2' | |
| 28 | }], | |
| 29 | totalIte ms: 1, | |
| 30 | updated: '20160101 0111' | |
| 31 | }, | |
| 32 | } | |
| 33 | }; | |
| 34 | ||
| 35 | var clinic alObject = { | |
| 36 | uid: ' ', | |
| 37 | patien tUid: '', | |
| 38 | authorUid: 'urn:va:u ser: R E D A CTED :123', | |
| 39 | domain : 'ehmp-or der', | |
| 40 | subDom ain: 'labo ratory', | |
| 41 | ehmpSt ate: 'acti ve', | |
| 42 | visit: { | |
| 43 | loc ation: '1' , | |
| 44 | ser viceCatego ry: 'PSB', | |
| 45 | dat eTime: '20 1601011200 00' | |
| 46 | }, | |
| 47 | referenceI d: 'urn:va :order: R E D A CTED :3:15479', | |
| 48 | data: {} | |
| 49 | }; | |
| 50 | ||
| 51 | var buildS ampleObjec t = functi on(sample) { | |
| 52 | return _.extend( clinicalOb ject, { | |
| 53 | ui d: sample. uid, | |
| 54 | pa tientUid: sample.pid , | |
| 55 | au thorUid: s ample.mode l.authorUi d, | |
| 56 | it ems: [{ | |
| 57 | addendum : 'my note ', | |
| 58 | authorUid: ' PL ', | |
| 59 | data: { | |
| 60 | labT estText: ' Lab Text', | |
| 61 | curr entItemCou nt: 1, | |
| 62 | item s: [{ | |
| 63 | field1: 'f ield2' | |
| 64 | }], | |
| 65 | tota lItems: 1, | |
| 66 | upda ted: '2016 01010111' | |
| 67 | }, | |
| 68 | domain: 'ehmp-orde r', | |
| 69 | ehmpStat e: 'active ', | |
| 70 | patientUid : 'urn:va: patient: R E D A CTED :3:3', | |
| 71 | referenceI d: 'urn:va :order: R E D A CTED :3:15479', | |
| 72 | subDomai n: 'labora tory', | |
| 73 | uid: 'urn: va:ehmp-or der: R E D A CTED :3:de305d5 4-75b4-431 b-adb2-eb6 b9e546014' , | |
| 74 | visit: { | |
| 75 | date Time: '01- 25-2018', | |
| 76 | loca tion: 'lab ', | |
| 77 | serv iceCategor y: 'Aloha from Hawai i from Tea m Neptune' | |
| 78 | } | |
| 79 | }] | |
| 80 | }); | |
| 81 | }; | |
| 82 | ||
| 83 | var buildO rderObject = functio n(ehmpStat e, referen ceId, doma in, subDom ain){ | |
| 84 | return { | |
| 85 | pid: ' R E D A CTED ;3', | |
| 86 | mo del: { | |
| 87 | patientUid : 'urn:va: patient: R E D A CTED :3:3', | |
| 88 | authorUid: ' PL ', | |
| 89 | domain: domain, | |
| 90 | subDomai n: subDoma in, | |
| 91 | ehmpStat e: ehmpSta te, | |
| 92 | visit: { | |
| 93 | loca tion: 'loc ation', | |
| 94 | serv iceCategor y: 'servic eCategory' , | |
| 95 | date Time: 'dat eTime' | |
| 96 | }, | |
| 97 | referenc eId: refer enceId, | |
| 98 | data: { | |
| 99 | labT estText: ' Lab Text', | |
| 100 | curr entItemCou nt: 1, | |
| 101 | item s: [{ | |
| 102 | field1: 'f ield2' | |
| 103 | }], | |
| 104 | tota lItems: 1, | |
| 105 | upda ted: '2016 01010111' | |
| 106 | }, | |
| 107 | } | |
| 108 | }; | |
| 109 | }; | |
| 110 | ||
| 111 | var update dClinincal Object = { | |
| 112 | uid: 'urn: va:ehmp-or der: R E D A CTED :3:de305d5 4-75b4-431 b-adb2-eb6 b9e546014' , | |
| 113 | patientUid : 'urn:va: patient: R E D A CTED :3:3', | |
| 114 | authorUid: ' PL ', | |
| 115 | domain : 'ehmp-or der', | |
| 116 | subDom ain: 'labo ratory', | |
| 117 | ehmpSt ate: 'acti ve', | |
| 118 | visit: { | |
| 119 | lo cation: 'l ocation', | |
| 120 | se rviceCateg ory: 'serv iceCategor y', | |
| 121 | da teTime: 'd ateTime' | |
| 122 | }, | |
| 123 | refere nceId: 're ferenceId' , | |
| 124 | data: { | |
| 125 | la bTestText: 'Lab Text ', | |
| 126 | cu rrentItemC ount: 1, | |
| 127 | it ems: [{ | |
| 128 | field1: 'field2' | |
| 129 | }] , | |
| 130 | to talItems: 1, | |
| 131 | up dated: '20 1601010111 ' | |
| 132 | }, | |
| 133 | }; | |
| 134 | ||
| 135 | var pJDSEn dpoint = ' clinicobj' ; | |
| 136 | var vxSync Endpoint = 'clinical Object'; | |
| 137 | var testEn dpoint = ' http:// IP '; | |
| 138 | var testVx syncEndpoi nt = 'http :// IP '; | |
| 139 | ||
| 140 | var appCon fig = { | |
| 141 | genera lPurposeJd sServer: { | |
| 142 | baseUrl: ' http:// IP ' | |
| 143 | }, | |
| 144 | vxSync Server: { | |
| 145 | baseUrl: ' http:// IP ' | |
| 146 | } | |
| 147 | }; | |
| 148 | ||
| 149 | describe(' Clinical o bject subs ystem reso urce task tests', fu nction() { | |
| 150 | ||
| 151 | descri be('Create clinical object', f unction() { | |
| 152 | ||
| 153 | it ('should c reate a cl inical obj ect when c alled with the corre ct paramet ers', func tion(done) { | |
| 154 | ||
| 155 | nock(tes tVxsyncEnd point).pos t('/' + vx SyncEndpoi nt).reply( 201, {'sta tus': 'OK' }); | |
| 156 | ||
| 157 | var orde rModel = b uildOrderO bject('act ive', 'tes tReference ID', 'ehmp -order', ' laboratory '); | |
| 158 | clinical Objects.cr eate(logge r, appConf ig, orderM odel.model , function (err, resp onse) { | |
| 159 | logg er.warn('z zzerror %j ', err); | |
| 160 | logg er.warn('z zzresponse %j', resp onse); | |
| 161 | expe ct(respons e).to.be.a n.object() ; | |
| 162 | expe ct(err).to .be.null() ; | |
| 163 | // c onsole.inf o(response .request.h ttpModule) ; | |
| 164 | done (); | |
| 165 | }); | |
| 166 | }) ; | |
| 167 | ||
| 168 | it ('should f ail valida tion and h andle erro rs if doma in is inco rrect', fu nction(don e) { | |
| 169 | var orde rModel = b uildOrderO bject('act ive', 'tes tReference ID', 'ehmp -123', 'wr ong'); | |
| 170 | clinical Objects.cr eate(logge r, appConf ig, orderM odel.model , function (err, resp onse) { | |
| 171 | expe ct(respons e).to.be.u ndefined() ; | |
| 172 | expe ct(err).no t.to.be.un defined(); | |
| 173 | expe ct(err.pop ()).to.be( 'invalid d omain'); | |
| 174 | done (); | |
| 175 | }); | |
| 176 | }) ; | |
| 177 | ||
| 178 | it ('should f ail valida tion and h andle erro rs if call ed with an invalid m odel', fun ction(done ) { | |
| 179 | ||
| 180 | clinical Objects.cr eate(logge r, appConf ig, sample 1.patientU id, functi on(err, re sponse) { | |
| 181 | expe ct(respons e).to.be.u ndefined() ; | |
| 182 | expe ct(err).no t.to.be.un defined(); | |
| 183 | expe ct(err.pop ()).to.be( 'model is not an obj ect'); | |
| 184 | done (); | |
| 185 | }); | |
| 186 | }) ; | |
| 187 | }); | |
| 188 | ||
| 189 | descri be('Read c linical ob ject', fun ction() { | |
| 190 | ||
| 191 | it ('should r etrieve a clinical o bject when called wi th the cor rect param eters', fu nction(don e) { | |
| 192 | nock(tes tEndpoint) | |
| 193 | .fil teringPath (function( path) { | |
| 194 | return ('/ ' + pJDSEn dpoint); | |
| 195 | }) | |
| 196 | .get ('/' + pJD SEndpoint) | |
| 197 | .rep ly(200, bu ildSampleO bject(samp le1)); | |
| 198 | ||
| 199 | clinical Objects.re ad(logger, appConfig , sample1. uid, false , function (err, resp onse) { | |
| 200 | expe ct(respons e).not.to. be.undefin ed(); | |
| 201 | expe ct(respons e.uid).to. be(sample1 .uid); | |
| 202 | expe ct(respons e.patientU id).to.be( sample1.pa tientUid); | |
| 203 | expe ct(respons e.authorUi d).to.be(s ample1.mod el.authorU id); | |
| 204 | expe ct(respons e.domain). to.be(samp le1.model. domain); | |
| 205 | expe ct(respons e.subDomai n).to.be(s ample1.mod el.subDoma in); | |
| 206 | expe ct(respons e.data).to .be.eql(sa mple1.mode l.data); | |
| 207 | expe ct(err).to .be.null() ; | |
| 208 | done (); | |
| 209 | }); | |
| 210 | }) ; | |
| 211 | ||
| 212 | it ('should f ail valida tion and h andle erro rs if call ed with an invalid U ID', funct ion(done) { | |
| 213 | ||
| 214 | clinical Objects.re ad(logger, appConfig , null, fa lse, funct ion(err, r esponse) { | |
| 215 | expe ct(respons e).to.be.u ndefined() ; | |
| 216 | expe ct(err).no t.to.be.un defined(); | |
| 217 | expe ct(logger. info.calle dWithMatch (function( value) { | |
| 218 | return _.c ontains((v alue || {} ).validati onErrors, 'uid not f ound'); | |
| 219 | })). to.be.true (); | |
| 220 | done (); | |
| 221 | }); | |
| 222 | }) ; | |
| 223 | ||
| 224 | it ('should h andle erro rs when th e storage pJDSEndpoi nt returns an error' , function (done) { | |
| 225 | ||
| 226 | nock(tes tEndpoint) | |
| 227 | .fil teringPath (function( path) { | |
| 228 | return ('/ ' + pJDSEn dpoint); | |
| 229 | }) | |
| 230 | .get ('/' + pJD SEndpoint) | |
| 231 | .rep lyWithErro r('Test Fa ilure'); | |
| 232 | ||
| 233 | clinical Objects.re ad(logger, appConfig , sample1. uid, false , function (err, resp onse) { | |
| 234 | expe ct(respons e).to.be.u ndefined() ; | |
| 235 | expe ct(err).no t.to.be.un defined(); | |
| 236 | expe ct(logger. error.call ed).to.be. true(); | |
| 237 | expe ct(err).no t.to.be.un defined(); | |
| 238 | expe ct(err[0]) .to.be('Un able to re ach pJDS') ; | |
| 239 | done (); | |
| 240 | }); | |
| 241 | }) ; | |
| 242 | }); | |
| 243 | ||
| 244 | descri be('Update clinical object', f unction() { | |
| 245 | ||
| 246 | it ('should u pdate a cl inical obj ect when c alled with the corre ct paramet ers', func tion(done) { | |
| 247 | nock(tes tVxsyncEnd point).pos t('/' + vx SyncEndpoi nt).reply( 200, {}); | |
| 248 | ||
| 249 | clinical Objects.up date(logge r, appConf ig, sample 1.uid, upd atedClinin calObject, function( err, respo nse) { | |
| 250 | expe ct(respons e.body).to .be.an.obj ect(); | |
| 251 | expe ct(err).to .be.null() ; | |
| 252 | done (); | |
| 253 | }); | |
| 254 | }) ; | |
| 255 | ||
| 256 | it ('should f ail valida tion and h andle erro rs if call ed with an invalid U ID', funct ion(done) { | |
| 257 | ||
| 258 | var mode l = buildS ampleObjec t(sample1) ; | |
| 259 | clinical Objects.up date(logge r, appConf ig, null, model, fun ction(err, response) { | |
| 260 | expe ct(respons e).to.be.u ndefined() ; | |
| 261 | expe ct(err).no t.to.be.un defined(); | |
| 262 | expe ct(logger. info.calle dWithMatch (function( value) { | |
| 263 | return _.c ontains((v alue || {} ).validati onErrors, 'uid not f ound'); | |
| 264 | })). to.be.true (); | |
| 265 | done (); | |
| 266 | }); | |
| 267 | }) ; | |
| 268 | ||
| 269 | it ('should f ail valida tion and h andle erro rs if call ed with an invalid m odel', fun ction(done ) { | |
| 270 | ||
| 271 | clinical Objects.up date(logge r, appConf ig, sample 1.uid, nul l, functio n(err, res ponse) { | |
| 272 | expe ct(respons e).to.be.u ndefined() ; | |
| 273 | expe ct(err).no t.to.be.un defined(); | |
| 274 | expe ct(logger. error.call ed).to.be. true(); | |
| 275 | done (); | |
| 276 | }); | |
| 277 | }) ; | |
| 278 | }); | |
| 279 | ||
| 280 | descri be('Transf orm patien tUid site piece from VLER or H DR to ICN. ', functio n() { | |
| 281 | it ('should transform site piece from VLER to ICN', function(d one) { | |
| 282 | ||
| 283 | var clin icalObj = {patientUi d:'urn:va: patient:VL ER:1234567 89:1234567 89'}; | |
| 284 | ||
| 285 | clinical Objects.tr ansformPat ientUid(cl inicalObj) ; | |
| 286 | ||
| 287 | expect(c linicalObj .patientUi d).not.to. be.undefin ed(); | |
| 288 | expect(c linicalObj .patientUi d).to.be(' urn:va:pat ient:ICN:1 23456789:1 23456789') ; | |
| 289 | done(); | |
| 290 | }) ; | |
| 291 | ||
| 292 | it ('should transform site piece from HDR to ICN', f unction(do ne) { | |
| 293 | ||
| 294 | var clin icalObj = {patientUi d:'urn:va: patient:HD R:12345678 9:12345678 9'}; | |
| 295 | ||
| 296 | clinical Objects.tr ansformPat ientUid(cl inicalObj) ; | |
| 297 | ||
| 298 | expect(c linicalObj .patientUi d).not.to. be.undefin ed(); | |
| 299 | expect(c linicalObj .patientUi d).to.be(' urn:va:pat ient:ICN:1 23456789:1 23456789') ; | |
| 300 | done(); | |
| 301 | }) ; | |
| 302 | ||
| 303 | it ('shoul d not tran sform site piece fro m R E D A CTED to ICN', function(d one) { | |
| 304 | ||
| 305 | var clinic alObj = {p atientUid: 'urn:va:pa tient: R E D A CTED :3:3'}; | |
| 306 | ||
| 307 | clinical Objects.tr ansformPat ientUid(cl inicalObj) ; | |
| 308 | ||
| 309 | expect(c linicalObj .patientUi d).not.to. be.undefin ed(); | |
| 310 | expect(c linicalObj .patientUi d).not.to. be('urn:va :patient:I CN:3:3'); | |
| 311 | done(); | |
| 312 | }) ; | |
| 313 | }); | |
| 314 | ||
| 315 | descri be('storeT oSolr busi ness rule' , function () { | |
| 316 | de scribe('eh mp-activit y consult' , function () { | |
| 317 | var ehmp ActivityCo nsultClini calObject = { | |
| 318 | uid: 'urn: va:ehmp-ac tivity: R E D A CTED :3:de305d5 4-75b4-431 b-adb2-eb6 b9e546014' , | |
| 319 | patientUid : 'urn:va: patient: R E D A CTED :3:3', | |
| 320 | authorUid: ' PL ', | |
| 321 | doma in: 'ehmp- activity', | |
| 322 | subD omain: 'co nsult', | |
| 323 | visi t: { | |
| 324 | location: 'location' , | |
| 325 | serviceCat egory: 'se rviceCateg ory', | |
| 326 | dateTime: 'dateTime' | |
| 327 | } | |
| 328 | }; | |
| 329 | it('shou ld return true if eh mp-activit y is a con sult and a ctive', fu nction() { | |
| 330 | var document = _.extend( {}, ehmpAc tivityCons ultClinica lObject, { | |
| 331 | ehmpState: 'active' | |
| 332 | }); | |
| 333 | expe ct(clinica lObjects.s toreToSolr (document) ).to.be.tr ue(); | |
| 334 | }); | |
| 335 | it('shou ld return false if e hmp-activi ty is a co nsult and in draft', function( ) { | |
| 336 | var document = _.extend( {}, ehmpAc tivityCons ultClinica lObject, { | |
| 337 | ehmpState: 'draft' | |
| 338 | }); | |
| 339 | expe ct(clinica lObjects.s toreToSolr (document) ).to.be.fa lse(); | |
| 340 | }); | |
| 341 | }) ; | |
| 342 | de scribe('eh mp-activit y request' , function () { | |
| 343 | var ehmp ActivityRe questClini calObject = { | |
| 344 | uid: 'urn: va:ehmp-ac tivity: R E D A CTED :3:de305d5 4-75b4-431 b-adb2-eb6 b9e546014' , | |
| 345 | patientUid : 'urn:va: patient: R E D A CTED :3:3', | |
| 346 | authorUid: ' PL ', | |
| 347 | doma in: 'ehmp- activity', | |
| 348 | subD omain: 're quest', | |
| 349 | visi t: { | |
| 350 | location: 'location' , | |
| 351 | serviceCat egory: 'se rviceCateg ory', | |
| 352 | dateTime: 'dateTime' | |
| 353 | } | |
| 354 | }; | |
| 355 | it('shou ld return true if eh mp-activit y is a req uest and a ctive', fu nction() { | |
| 356 | var document = _.extend( {}, ehmpAc tivityRequ estClinica lObject, { | |
| 357 | ehmpState: 'active' | |
| 358 | }); | |
| 359 | expe ct(clinica lObjects.s toreToSolr (document) ).to.be.tr ue(); | |
| 360 | }); | |
| 361 | ||
| 362 | it('shou ld return false if e hmp-activi ty is a re quest and in draft', function( ) { | |
| 363 | var document = _.extend( {}, ehmpAc tivityRequ estClinica lObject, { | |
| 364 | ehmpState: 'draft' | |
| 365 | }); | |
| 366 | expe ct(clinica lObjects.s toreToSolr (document) ).to.be.fa lse(); | |
| 367 | }); | |
| 368 | }) ; | |
| 369 | de scribe('eh mp-order l aboratory' , function () { | |
| 370 | var ehmp OrderLabor atoryClini calObject = { | |
| 371 | uid: 'urn: va:ehmp-or der: R E D A CTED :3:de305d5 4-75b4-431 b-adb2-eb6 b9e546014' , | |
| 372 | patientUid : 'urn:va: patient: R E D A CTED :3:3', | |
| 373 | authorUid: ' PL ', | |
| 374 | doma in: 'ehmp- order', | |
| 375 | subD omain: 'la boratory', | |
| 376 | visi t: { | |
| 377 | location: 'location' , | |
| 378 | serviceCat egory: 'se rviceCateg ory', | |
| 379 | dateTime: 'dateTime' | |
| 380 | } | |
| 381 | }; | |
| 382 | it('shou ld return false if e hmp-order is a labor atory and active', f unction() { | |
| 383 | var document = _.extend( {}, ehmpOr derLaborat oryClinica lObject, { | |
| 384 | ehmpState: 'active' | |
| 385 | }); | |
| 386 | expe ct(clinica lObjects.s toreToSolr (document) ).to.be.fa lse(); | |
| 387 | }); | |
| 388 | it('shou ld return false if e hmp-order is a labor atory and draft', fu nction() { | |
| 389 | var document = _.extend( {}, ehmpOr derLaborat oryClinica lObject, { | |
| 390 | ehmpState: 'draft' | |
| 391 | }); | |
| 392 | expe ct(clinica lObjects.s toreToSolr (document) ).to.be.fa lse(); | |
| 393 | }); | |
| 394 | }) ; | |
| 395 | }); | |
| 396 | }); |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.