905. EPMO Open Source Coordination Office Redaction File Detail Report

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

905.1 Files compared

# Location File Last Modified
1 ehmp.zip\ehmp\ehmp\product\production\vx-sync\tests\unittests\utils\patient-record-retirement patient-record-retirement-util-spec.js Mon Jul 10 17:46:22 2017 UTC
2 ehmp.zip\ehmp\ehmp\product\production\vx-sync\tests\unittests\utils\patient-record-retirement patient-record-retirement-util-spec.js Tue Oct 3 13:24:22 2017 UTC

905.2 Comparison summary

Description Between
Files 1 and 2
Text Blocks Lines
Unchanged 7 790
Changed 6 14
Inserted 0 0
Removed 0 0

905.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

905.4 Active regular expressions

No regular expressions were active.

905.5 Comparison detail

  1   'use stric t';
  2  
  3   require('. ./../../.. /env-setup ');
  4  
  5   var _ = re quire('und erscore');
  6   var JdsCli entDummy =  require(g lobal.VX_D UMMIES + ' jds-client -dummy');
  7   var Record Retirement Util = req uire(globa l.VX_UTILS  + 'patien t-record-r etirement/ patient-re cord-retir ement-util ');
  8   var nock =  require(' nock');
  9   var log =  require(gl obal.VX_DU MMIES + '/ dummy-logg er');
  10   var moment  = require ('moment') ;
  11   var Publis herRouterD ummy = req uire(globa l.VX_DUMMI ES + '/pub lisherRout erDummy');
  12   // NOTE: b e sure nex t line is  commented  out before  pushing
  13   // log = r equire('bu nyan').cre ateLogger( {
  14   //      na me: 'patie nt-record- retirement -util-spec ',
  15   //      le vel: 'debu g'
  16   // });
  17  
  18   var config  = {
  19           'r ecordRetir ement': {
  20                    'rul es': {
  21                             'large PatientRec ord': {
  22                                      'patient TotalSizeL imit': 100 000000,
  23                                      'avgSize PerEvent':  100
  24                             }
  25                    },
  26                    'las tAccessed' : 180
  27           },
  28           'j ds': {},
  29           sy ncRequestA pi: {
  30                    'pro tocol': 'h ttp',
  31                     'host': ' IP        ',
  32                     'port': ' PORT ',
  33                    'tim eout': 300 000
  34           },
  35   };
  36  
  37   function c reateEnvir onment(log , config)  {
  38           re turn {
  39                    jds:  new JdsCl ientDummy( log, confi g),
  40                    publ isherRoute r: new Pub lisherRout erDummy()
  41           };
  42   }
  43  
  44   var fullPa tientList  = [{
  45           jp id: 'aaaaa -bbbbb-ccc cc',
  46           la stAccessTi me: 201610 17132715,
  47           pa tientIdent ifiers: [
  48                    'AAA A;1',
  49                    'BBB B;1'
  50           ]
  51   }, {
  52           jp id: 'bbbbb -ccccc-ddd dd',
  53           la stAccesTim e: 2016101 7132715,
  54           pa tientIdent ifiers: [
  55                    'CCC C;1',
  56                    'DDD D;1'
  57           ]
  58   }];
  59  
  60   var errorP atient = {
  61           jp id: 'eeeee -fffff-ggg gg',
  62           la stAccesTim e: 2016101 7132715,
  63           pa tientIdent ifiers: [
  64                    'ERR OR;1',
  65           ]
  66   };
  67  
  68   describe(' patient-re cord-retir ement-util ', functio n() {
  69           de scribe('ge tPidsToRet ire', func tion() {
  70                    it(' normal pat h', functi on() {
  71                             var en vironment  = createEn vironment( log, confi g);
  72                             enviro nment.jds. _setRespon seData([nu ll], [{
  73                                      statusCo de: 200
  74                             }], [{
  75                                      items: f ullPatient List
  76                             }]);
  77  
  78                             var re cordRetire mentUtil =  new Recor dRetiremen tUtil(log,  config, e nvironment );
  79  
  80                             record Retirement Util.getPi dsToRetire (function( error, pat ientList)  {
  81                                      expect(e rror).toBe Falsy();
  82                                      expect(p atientList ).toBeTrut hy();
  83                                      expect(p atientList [0]).toBeT ruthy();
  84                                      expect(p atientList [0].patien tIdentifie rs).toBeTr uthy();
  85                                      expect(p atientList [0].patien tIdentifie rs).toCont ain('AAAA; 1');
  86                                      expect(p atientList [0].patien tIdentifie rs).toCont ain('BBBB; 1');
  87                             });
  88                    });
  89  
  90                    it(' error path : error fr om jds', f unction()  {
  91                             var en vironment  = createEn vironment( log, confi g);
  92                             enviro nment.jds. _setRespon seData(['e rror!'], [ null], [nu ll]);
  93  
  94                             var re cordRetire mentUtil =  new Recor dRetiremen tUtil(log,  config, e nvironment );
  95  
  96                             record Retirement Util.getPi dsToRetire (function( error, pat ientList)  {
  97                                      expect(e rror).toBe Truthy();
  98                                      expect(p atientList ).toBeFals y();
  99                             });
  100                    });
  101                    it(' error path : no respo nse from j ds', funct ion() {
  102                             var en vironment  = createEn vironment( log, confi g);
  103                             enviro nment.jds. _setRespon seData([nu ll], [null ], [null]) ;
  104  
  105                             var re cordRetire mentUtil =  new Recor dRetiremen tUtil(log,  config, e nvironment );
  106  
  107                             record Retirement Util.getPi dsToRetire (function( error, pat ientList)  {
  108                                      expect(e rror).toBe Truthy();
  109                                      expect(p atientList ).toBeFals y();
  110                             });
  111                    });
  112                    it(' error path : unexpect ed respons e from jds ', functio n() {
  113                             var en vironment  = createEn vironment( log, confi g);
  114                             enviro nment.jds. _setRespon seData([nu ll], [{
  115                                      statusCo de: 400,
  116                                      body: {
  117                                               error: 'er ror!'
  118                                      }
  119                             }], [n ull]);
  120  
  121                             var re cordRetire mentUtil =  new Recor dRetiremen tUtil(log,  config, e nvironment );
  122  
  123                             record Retirement Util.getPi dsToRetire (function( error, pat ientList)  {
  124                                      expect(e rror).toBe Truthy();
  125                                      expect(p atientList ).toBeFals y();
  126                             });
  127                    });
  128                    it(' error path : null res ult from j ds', funct ion() {
  129                             var en vironment  = createEn vironment( log, confi g);
  130                             enviro nment.jds. _setRespon seData([nu ll], [{
  131                                      statusCo de: 200
  132                             }], [n ull]);
  133  
  134                             var re cordRetire mentUtil =  new Recor dRetiremen tUtil(log,  config, e nvironment );
  135  
  136                             record Retirement Util.getPi dsToRetire (function( error, pat ientList)  {
  137                                      expect(e rror).toBe Truthy();
  138                                      expect(p atientList ).toBeFals y();
  139                             });
  140                    });
  141  
  142                    it(' use instan ce\'s last Accessed v alue if it  exists',  function()  {
  143                             var en vironment  = createEn vironment( log, confi g);
  144                             enviro nment.jds. _setRespon seData([nu ll], [{
  145                                      statusCo de: 200
  146                             }], [{
  147                                      items: f ullPatient List
  148                             }]);
  149  
  150                             var la stAccessed  = 3;
  151  
  152                             var la stAccessTi me = momen t().subtra ct(lastAcc essed, 'da ys');
  153                             var co nfigLastAc cessTime =  moment(). subtract(c onfig.reco rdRetireme nt.lastAcc essed, 'da ys');
  154  
  155                             spyOn( environmen t.jds, 'ge tPatientLi st').andCa llThrough( );
  156  
  157                             var re cordRetire mentUtil =  new Recor dRetiremen tUtil(log,  config, e nvironment , lastAcce ssed);
  158  
  159                             record Retirement Util.getPi dsToRetire (function( error, pat ientList)  {
  160                                      expect(e rror).toBe Falsy();
  161                                      expect(p atientList ).toBeTrut hy();
  162                                      expect(p atientList [0]).toBeT ruthy();
  163                                      expect(p atientList [0].patien tIdentifie rs).toBeTr uthy();
  164                                      expect(p atientList [0].patien tIdentifie rs).toCont ain('AAAA; 1');
  165                                      expect(p atientList [0].patien tIdentifie rs).toCont ain('BBBB; 1');
  166  
  167                                      var resu ltLastAcce ssTime = e nvironment .jds.getPa tientList. calls[0].a rgs[0];
  168                                      expect(m oment(resu ltLastAcce ssTime, 'Y YYYMMDDHHm mss').isSa me(lastAcc essTime, ' day')).toB e(true);
  169                                      expect(m oment(resu ltLastAcce ssTime, 'Y YYYMMDDHHm mss').isSa me(configL astAccessT ime, 'day' )).toBe(fa lse);
  170                             });
  171                    });
  172  
  173                    it(' use config  lastAcces sed value  if instanc e\'s lastA ccessed va lue does n ot exist',  function( ) {
  174                             var en vironment  = createEn vironment( log, confi g);
  175                             enviro nment.jds. _setRespon seData([nu ll], [{
  176                                      statusCo de: 200
  177                             }], [{
  178                                      items: f ullPatient List
  179                             }]);
  180  
  181                             var co nfigLastAc cessTime =  moment(). subtract(c onfig.reco rdRetireme nt.lastAcc essed, 'da ys');
  182  
  183                             spyOn( environmen t.jds, 'ge tPatientLi st').andCa llThrough( );
  184  
  185                             var re cordRetire mentUtil =  new Recor dRetiremen tUtil(log,  config, e nvironment );
  186  
  187                             record Retirement Util.getPi dsToRetire (function( error, pat ientList)  {
  188                                      expect(e rror).toBe Falsy();
  189                                      expect(p atientList ).toBeTrut hy();
  190                                      expect(p atientList [0]).toBeT ruthy();
  191                                      expect(p atientList [0].patien tIdentifie rs).toBeTr uthy();
  192                                      expect(p atientList [0].patien tIdentifie rs).toCont ain('AAAA; 1');
  193                                      expect(p atientList [0].patien tIdentifie rs).toCont ain('BBBB; 1');
  194  
  195                                      var resu ltLastAcce ssTime = e nvironment .jds.getPa tientList. calls[0].a rgs[0];
  196                                      expect(m oment(resu ltLastAcce ssTime, 'Y YYYMMDDHHm mss').isSa me(configL astAccessT ime, 'day' )).toBe(tr ue);
  197                             });
  198                    });
  199           }) ;
  200           de scribe('ru nRetiremen tRules', f unction()  {
  201                    befo reEach(fun ction() {
  202                             var sy ncStatusEn dpointResp onse1 = {
  203                                      'jpid':  'aaaaa-bbb bb-ccccc',
  204                                      'identif ierDocSize s': {
  205                                               'totalSize ': 32,
  206                                               'AAAA;1':  'NO_DOCUME NTS',
  207                                               'BBBB;1':  32
  208                                      },
  209                                      'syncSta tus': {
  210                                               'completed Stamp': {
  211                                                       's ourceMetaS tamp': {
  212                                                                'AAA A': {
  213                                                                         'domai nMetaStamp ': {
  214                                                                                  'allergy ': {
  215                                                                                           'domain':  'allergy',
  216                                                                                           'eventCoun t': 3
  217                                                                                  }
  218                                                                         }
  219                                                                },
  220                                                                'BBB B': {
  221                                                                         'domai nMetaStamp ': {
  222                                                                                  'allergy ': {
  223                                                                                           'domain':  'allergy',
  224                                                                                           'eventCoun t': 3
  225                                                                                  }
  226                                                                         }
  227                                                                }
  228                                                       }
  229                                               }
  230                                      }
  231                             };
  232  
  233                             var sy ncStatusEn dpointResp onse2 = {
  234                                      'jpid':  'bbbbb-ccc cc-ddddd',
  235                                      'identif ierDocSize s': {
  236                                               'totalSize ': 1000000 01,
  237                                               'CCCC;1':  'NO_DOCUME NTS',
  238                                               'DDDD;1':  100000001
  239                                      },
  240                                      'syncSta tus': {
  241                                               'completed Stamp': {
  242                                                       's ourceMetaS tamp': {
  243                                                                'CCC C': {
  244                                                                         'domai nMetaStamp ': {
  245                                                                                  'allergy ': {
  246                                                                                           'domain':  'allergy',
  247                                                                                           'eventCoun t': 3
  248                                                                                  }
  249                                                                         }
  250                                                                },
  251                                                                'DDD D': {
  252                                                                         'domai nMetaStamp ': {
  253                                                                                  'allergy ': {
  254                                                                                           'domain':  'allergy',
  255                                                                                           'eventCoun t': 3
  256                                                                                  }
  257                                                                         }
  258                                                                }
  259                                                       }
  260                                               }
  261                                      }
  262                             };
  263  
  264                             nock.c leanAll();
  265                             nock.d isableNetC onnect();
  266                              nock('http :// IP             ')
  267                                      .get('/s ync/status ?pid=AAAA; 1&docStatu s=true')
  268                                      .reply(2 00, JSON.s tringify(s yncStatusE ndpointRes ponse1));
  269                              nock('http :// IP             ')
  270                                      .get('/s ync/status ?pid=BBBB; 1&docStatu s=true')
  271                                      .reply(2 00, JSON.s tringify(s yncStatusE ndpointRes ponse1));
  272                              nock('http :// IP             ')
  273                                      .get('/s ync/status ?pid=CCCC; 1&docStatu s=true')
  274                                      .reply(2 00, JSON.s tringify(s yncStatusE ndpointRes ponse2));
  275                              nock('http :// IP             ')
  276                                      .get('/s ync/status ?pid=DDDD; 1&docStatu s=true')
  277                                      .reply(2 00, JSON.s tringify(s yncStatusE ndpointRes ponse2));
  278                              nock('http :// IP             ')
  279                                      .get('/s ync/status ?pid=ERROR ;1&docStat us=true')
  280                                      .reply(4 00);
  281                    });
  282  
  283                    it(' normal pat h', functi on() {
  284                             var en vironment  = createEn vironment( log, confi g);
  285                             var re cordRetire mentUtil =  new Recor dRetiremen tUtil(log,  config, e nvironment );
  286  
  287                             var do ne = false ;
  288  
  289                             record Retirement Util.runRe tirementRu les(fullPa tientList,  function( error, pat ientList)  {
  290                                      expect(e rror).toBe Falsy();
  291                                      expect(p atientList ).toBeTrut hy();
  292                                      expect(p atientList [0]).toBeT ruthy();
  293                                      expect(p atientList [0].patien tIdentifie rs).toBeTr uthy();
  294                                      expect(p atientList [0].patien tIdentifie rs).toCont ain('AAAA; 1');
  295                                      expect(p atientList [0].patien tIdentifie rs).toCont ain('BBBB; 1');
  296  
  297                                      done = t rue;
  298                             });
  299  
  300                             waitsF or(functio n() {
  301                                      return d one;
  302                             });
  303                    });
  304  
  305                    it(' normal pat h: no pati ents', fun ction() {
  306                             var en vironment  = createEn vironment( log, confi g);
  307                             var re cordRetire mentUtil =  new Recor dRetiremen tUtil(log,  config, e nvironment );
  308  
  309                             var do ne = false ;
  310  
  311                             record Retirement Util.runRe tirementRu les(null,  function(e rror, pati entList) {
  312                                      expect(e rror).toBe Falsy();
  313                                      expect(p atientList ).toBeFals y();
  314  
  315                                      done = t rue;
  316                             });
  317  
  318                             waitsF or(functio n() {
  319                                      return d one;
  320                             });
  321                    });
  322  
  323  
  324                    it(' error path : error re turned by  rules engi ne', funct ion() {
  325                             var en vironment  = createEn vironment( log, confi g);
  326                             var re cordRetire mentUtil =  new Recor dRetiremen tUtil(log,  config, e nvironment );
  327  
  328                             var do ne = false ;
  329  
  330                             record Retirement Util.runRe tirementRu les([error Patient],  function(e rror, pati entList) {
  331                                      expect(e rror).toBe Truthy();
  332                                      expect(p atientList ).toBeFals y();
  333                                      done = t rue;
  334  
  335                             });
  336                             waitsF or(functio n() {
  337                                      return d one;
  338                             });
  339                    });
  340           }) ;
  341           de scribe('se ndRetireme ntJobs', f unction()  {
  342                    var  referenceI nfo = {
  343                             sessio nId: 'TEST ',
  344                             utilit yType: 'Pa tient Reco rd Retirem ent Utilit y Unit Tes t'
  345                    };
  346  
  347                    it(' normal pat h', functi on() {
  348                             var en vironment  = createEn vironment( log, confi g);
  349                             var re cordRetire mentUtil =  new Recor dRetiremen tUtil(log,  config, e nvironment );
  350  
  351                             var jo bsSentToBe anstalk =  [];
  352                             spyOn( environmen t.publishe rRouter, ' publish'). andCallFak e(function (job, call back) {
  353                                      jobsSent ToBeanstal k.push(job );
  354                                      return c allback(nu ll, 1);
  355                             });
  356  
  357                             record Retirement Util.sendR etirementJ obs(fullPa tientList,  reference Info, func tion(error , count) {
  358                                      expect(e rror).toBe Falsy();
  359                                      expect(c ount).toEq ual(2);
  360                                      expect(j obsSentToB eanstalk.l ength).toE qual(2);
  361  
  362                                      _.each(j obsSentToB eanstalk,  function(j ob){
  363                                               expect(job .reference Info).toEq ual(jasmin e.objectCo ntaining({
  364                                                       se ssionId: r eferenceIn fo.session Id,
  365                                                       re questId: j asmine.any (String),
  366                                                       ut ilityType:  reference Info.utili tyType
  367                                               }));
  368                                      });
  369                             });
  370                    });
  371                    it(' normal pat h: no pati ents', fun ction(){
  372                             var en vironment  = createEn vironment( log, confi g);
  373                             var re cordRetire mentUtil =  new Recor dRetiremen tUtil(log,  config, e nvironment );
  374  
  375                             var jo bsSentToBe anstalk =  [];
  376                             spyOn( environmen t.publishe rRouter, ' publish'). andCallFak e(function (job, call back) {
  377                                      jobsSent ToBeanstal k.push(job );
  378                                      return c allback(nu ll, 1);
  379                             });
  380  
  381                             record Retirement Util.sendR etirementJ obs(null,  referenceI nfo, funct ion(error,  count) {
  382                                      expect(e rror).toBe Falsy();
  383                                      expect(c ount).toEq ual(0);
  384                                      expect(j obsSentToB eanstalk.l ength).toE qual(0);
  385                             });
  386                    });
  387                    it(' error path : publishe rRouter re turns erro r', functi on() {
  388                             var en vironment  = createEn vironment( log, confi g);
  389                             var re cordRetire mentUtil =  new Recor dRetiremen tUtil(log,  config, e nvironment );
  390  
  391                             spyOn( environmen t.publishe rRouter, ' publish'). andCallFak e(function (job, call back) {
  392                                      return c allback('e rror');
  393                             });
  394  
  395                             record Retirement Util.sendR etirementJ obs(fullPa tientList,  reference Info, func tion(error , count) {
  396                                      expect(e rror).toBe Truthy();
  397                                      expect(c ount).toEq ual(0);
  398                             });
  399  
  400                    });
  401           }) ;
  402   });