831. EPMO Open Source Coordination Office Redaction File Detail Report

Produced by Araxis Merge on 10/3/2017 11:16:01 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.

831.1 Files compared

# Location File Last Modified
1 ehmp.zip\ehmp\ehmp\product\production\vx-sync\tests\integrationtests\endpoints\writeback writeback-endpoint-itest-spec.js Mon Jul 10 17:46:22 2017 UTC
2 ehmp.zip\ehmp\ehmp\product\production\vx-sync\tests\integrationtests\endpoints\writeback writeback-endpoint-itest-spec.js Tue Oct 3 12:43:52 2017 UTC

831.2 Comparison summary

Description Between
Files 1 and 2
Text Blocks Lines
Unchanged 3 462
Changed 2 4
Inserted 0 0
Removed 0 0

831.3 Comparison options

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

831.4 Active regular expressions

No regular expressions were active.

831.5 Comparison detail

  1   'use stric t';
  2  
  3   require('. ./../../.. /env-setup ');
  4   var _ = re quire('und erscore');
  5   var moment  = require ('moment') ;
  6   var reques t = requir e('request ');
  7   var testCo nfig = req uire(globa l.VX_INTTE STS + 'tes t-config') ;
  8   var vx_syn c_ip = tes tConfig.vx syncIP;
  9   var logger  = require (global.VX _DUMMIES +  'dummy-lo gger');
  10   var JdsCli ent = requ ire(global .VX_SUBSYS TEMS + 'jd s/jds-clie nt');
  11   var wConfi g = requir e(global.V X_ROOT + ' worker-con fig');
  12   var port =   PORT ;
  13   var jds =  new JdsCli ent(logger , wConfig) ;
  14   var tstPid  = '9E7A;3 ';
  15  
  16   var httpCo nfig = {
  17       path:  '/writebac k',
  18       method : 'POST',
  19       port:  port,
  20       json:  true,
  21       host:  vx_sync_ip ,
  22       url: ' http://' +  vx_sync_i p + ':' +  port + '/w riteback',
  23       timeou t: 60000
  24   };
  25   var record Body = {
  26       'drugC lasses': [ {
  27           'c ode': 'AM1 14',
  28           'n ame': 'PEN ICILLINS A ND BETA-LA CTAM ANTIM ICROBIALS' ,
  29           's ummary': ' AllergyDru gClass{uid =\'\'}'
  30       }],
  31       'enter ed': '2005 03172009',
  32       'facil ityCode':  '500',
  33       'facil ityName':  'CAMP MAST ER',
  34       'histo rical': tr ue,
  35       'kind' : 'Allergy \/Adverse  Reaction',
  36       'lastU pdateTime' : '2015031 7200936',
  37       'local Id': '751' ,
  38       'mecha nism': 'PH ARMACOLOGI C',
  39       'origi natorName' : 'VEHU,EI GHT',
  40       'produ cts': [{
  41           'n ame': 'PEN ICILLIN',
  42           's ummary': ' AllergyPro duct{uid=\ '\'}',
  43           'v uid': 'urn :va:vuid:'
  44       }],
  45       'react ions': [{
  46           'n ame': 'ITC HING,WATER ING EYES',
  47           's ummary': ' AllergyRea ction{uid= \'\'}',
  48           'v uid': 'urn :va:vuid:'
  49       }],
  50       'refer ence': '12 5;GMRD(120 .82,',
  51       'stamp Time': '20 0503172009 36',
  52       'summa ry': 'PENI CILLIN',
  53       'typeN ame': 'DRU G',
  54       'uid':  'urn:va:a llergy:9E7 A:3:751',
  55       'verif ied': '200 5031720093 6',
  56       'verif ierName':  '<auto-ver ified>'
  57   };
  58   var dateFo rmat = 'YY YYMMDDHHmm ss';
  59  
  60   xdescribe( 'writeback -endpoint' , function () {
  61       //ensu re patient  is synced
  62       // bef oreEach(fu nction() {
  63       //      var patie ntIsSynced  = false;
  64       //      var syncS tatus;
  65       //      runs(func tion() {
  66       //          jds.g etSyncStat us({
  67       //              t ype: 'pid' ,
  68       //              v alue: reco rdBody.pid
  69       //          }, fu nction(err or, jdsRes ponse, jds Body) {
  70       //              i f (!error)  {
  71       //                   if (jds Response.s tatusCode  === 404) {
  72       //                       var  syncConfi g = _.clon e(httpConf ig);
  73         //                        syncConfig .port =  PORT ;
  74       //                       syn cConfig.ur l = 'http: //' + vx_s ync_ip + ' :' + syncC onfig.port  + '/sync/ doLoad';
  75       //                       syn cConfig.pa th = '/syn c/doLoad';
  76       //                       syn cConfig.me thod = 'GE T';
  77       //                       syn cConfig.qs  = {
  78       //                            pid: reco rdBody.pid
  79       //                       };
  80       //                       con sole.log(' writeback- endpoint-i test-spec  syncing pa tient');
  81       //                       req uest(syncC onfig, fun ction(err,  response)  {
  82       //                            syncStatu s = setInt erval(func tion() {
  83       //                                logge r.debug('w riteback-e ndpoint-it est-spec c hecking sy nc status' );
  84       //                                if (! patientIsS ynced) {
  85       //                                    j ds.getSync Status({
  86       //                                         type: ' pid',
  87       //                                         value:  recordBody .pid
  88       //                                    } , function (error, jd sResponse,  jdsBody)  {
  89       //                                         if (!er ror) {
  90       //                                             if  (jdsRespon se && jdsR esponse.st atusCode = == 200) {
  91       //                                                  if (jdsBo dy && jdsB ody.comple tedStamp)  {
  92       //                                                      var c ompletedSi tes = _.ke ys(jdsBody .completed Stamp.sour ceMetaStam p);
  93       //                                                      logge r.debug(co mpletedSit es);
  94       //                                                      if (j dsBody.com pletedStam p.sourceMe taStamp['9 E7A']) {
  95       //                                                          p atientIsSy nced = tru e;
  96       //                                                          c learInterv al(syncSta tus);
  97       //                                                      }
  98       //                                                  } else {
  99       //                                                      logge r.debug('w riteback-e ndpoint-it est-spec:1 01 no comp letedStamp \n' + JSON .stringify (_.keys(jd sBody)));
  100       //                                                  }
  101       //                                             }
  102       //                                         } else  {
  103       //                                             log ger.error( 'writeback -endpoint- itest-spec :101 ' + J SON.string ify(error) );
  104       //                                         }
  105       //                                    } );
  106       //                                }
  107       //                            }, 10000) ;
  108       //                       });
  109       //                   } else  {
  110       //                       if  (jdsBody & & jdsBody. completedS tamp && jd sBody.comp letedStamp .sourceMet aStamp['9E 7A']) {
  111       //                            patientIs Synced = t rue;
  112       //                       }
  113       //                   }
  114       //              }  else {
  115       //                   logger. error('wri teback-end point-ites t-spec:113  ' + JSON. stringify( error));
  116       //              }
  117       //          });
  118       //      });
  119  
  120       //      waitsFor( function()  {
  121       //          retur n patientI sSynced;
  122       //      }, 'patie nt 9E7A;3  to sync',  950000);
  123       //      clearInte rval(syncS tatus);
  124       // });
  125  
  126       it('ha ppy path',  function( ) {
  127           va r config =  _.clone(h ttpConfig) ;
  128           va r nowMomen t = moment ();
  129           no wMoment.ad d(1, 'days '); //make  sure this  is far en ough in th e future t o prevent  conflict w ith curren t sync tim e
  130           va r now = no wMoment.fo rmat(dateF ormat);
  131           va r body1 =  _.clone(re cordBody);
  132           bo dy1.lastUp dateTime =  now;
  133           bo dy1.verifi ed = now;
  134           de lete body1 .reactions [0].summar y;
  135           co nfig.body  = body1;
  136  
  137           re quest(conf ig, functi on(err, re sponse) {
  138                expect(e rr).toBeFa lsy();
  139                expect(r esponse.st atusCode). toBe(200);
  140                jds.getS yncStatus( {
  141                    type : 'pid',
  142                    valu e: tstPid
  143                }, funct ion(error,  jdsRespon se, jdsBod y) {
  144                    expe ct(error). toBeFalsy( );
  145                    expe ct(jdsResp onse.statu sCode).toB e(200);
  146                    expe ct(jdsBody ).toBeTrut hy();
  147                    var  expectedSt ampTime =  now - 1;
  148                    var  stampTime  = jdsBody. completedS tamp.sourc eMetaStamp ['9E7A'].d omainMetaS tamp.aller gy.stampTi me;
  149                    expe ct(String( stampTime) ).toBe(Str ing(expect edStampTim e));
  150                });
  151           }) ;
  152       });
  153       it('No  UID', fun ction() {
  154           va r config =  _.clone(h ttpConfig) ;
  155           va r now = mo ment().for mat(dateFo rmat);
  156           va r body1 =  _.clone(re cordBody);
  157           bo dy1.lastUp dateTime =  now;
  158           de lete body1 .uid;
  159           co nfig.body  = body1;
  160  
  161           re quest(conf ig, functi on(err, re sponse) {
  162                expect(e rr).toBeFa lsy();
  163                expect(r esponse.st atusCode). toBe(400);
  164           }) ;
  165       });
  166       it('Ma lformed UI D', functi on() {
  167           va r config =  _.clone(h ttpConfig) ;
  168           va r now = mo ment().for mat(dateFo rmat);
  169           va r body1 =  _.clone(re cordBody);
  170           bo dy1.lastUp dateTime =  now;
  171           bo dy1.uid =  'urn:va:al lergy:9E7A :3:751:som ethingelse ';
  172           co nfig.body  = body1;
  173  
  174           re quest(conf ig, functi on(err, re sponse) {
  175                expect(e rr).toBeFa lsy();
  176                expect(r esponse.st atusCode). toBe(400);
  177           }) ;
  178       });
  179       it('Ma lformed Da te', funct ion() {
  180           va r config =  _.clone(h ttpConfig) ;
  181           va r now = mo ment().for mat('x');
  182           va r body1 =  _.clone(re cordBody);
  183           bo dy1.lastUp dateTime =  now;
  184           co nfig.body  = body1;
  185  
  186           re quest(conf ig, functi on(err, re sponse) {
  187                expect(e rr).toBeFa lsy();
  188                expect(r esponse.st atusCode). toBe(400);
  189           }) ;
  190       });
  191       it('No  lastUpdat eTime', fu nction() {
  192           va r config =  _.clone(h ttpConfig) ;
  193           va r body1 =  _.clone(re cordBody);
  194           de lete body1 .lastUpdat eTime;
  195           co nfig.body  = body1;
  196  
  197           re quest(conf ig, functi on(err, re sponse) {
  198                expect(e rr).toBeFa lsy();
  199                expect(r esponse.st atusCode). toBe(400);
  200           }) ;
  201       });
  202       it('No  POST body ', functio n() {
  203           va r config =  _.clone(h ttpConfig) ;
  204  
  205           re quest(conf ig, functi on(err, re sponse) {
  206                expect(e rr).toBeFa lsy();
  207                expect(r esponse.st atusCode). toBe(400);
  208           }) ;
  209       });
  210       it('Ou tdated upd ate time',  function( ) {
  211           va r config =  _.clone(h ttpConfig) ;
  212           va r old = '2 0060304123 456';
  213           va r body1 =  _.clone(re cordBody);
  214           bo dy1.lastUp dateTime =  old;
  215           bo dy1.verifi ed = old;
  216           co nfig.body  = body1;
  217  
  218           re quest(conf ig, functi on(err, re sponse) {
  219                expect(e rr).toBeFa lsy();
  220                expect(r esponse.st atusCode). toBe(200);
  221                jds.getS yncStatus( {
  222                    type : 'pid',
  223                    valu e: tstPid
  224                }, funct ion(error,  jdsRespon se, jdsBod y) {
  225                    expe ct(error). toBeFalsy( );
  226                    expe ct(jdsResp onse.statu sCode).toB e(200);
  227                    expe ct(jdsBody ).toBeTrut hy();
  228                    var  stampTime  = jdsBody. completedS tamp.sourc eMetaStamp ['9E7A'].d omainMetaS tamp.aller gy.stampTi me;
  229                    expe ct(moment( stampTime,  dateForma t).isAfter (moment(ol d, dateFor mat))).toB eTruthy();
  230                });
  231           }) ;
  232       });
  233   });