87. EPMO Open Source Coordination Office Redaction File Detail Report

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.

87.1 Files compared

# Location File Last Modified
1 rdk.zip\rdk\product\production\rdk\src\subsystems\clinical-objects clinical-objects-validator-request-spec.js Mon Aug 21 12:51:00 2017 UTC
2 rdk.zip\rdk\product\production\rdk\src\subsystems\clinical-objects clinical-objects-validator-request-spec.js Tue Oct 3 18:31:48 2017 UTC

87.2 Comparison summary

Description Between
Files 1 and 2
Text Blocks Lines
Unchanged 14 944
Changed 13 38
Inserted 0 0
Removed 0 0

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

87.4 Active regular expressions

No regular expressions were active.

87.5 Comparison detail

  1   'use stric t';
  2  
  3   var _ = re quire('lod ash');
  4   var moment  = require ('moment') ;
  5  
  6   var valida tor = requ ire('./cli nical-obje cts-valida tor-reques t');
  7   var pcmm =  require(' ../jbpm/pc mm-subsyst em');
  8   var endToE ndValidato r = requir e('./clini cal-object s-validato r');
  9  
  10   describe(' request cl inical obj ect', func tion() {
  11       descri be('valida tor', func tion() {
  12           va r json;
  13  
  14           be foreEach(f unction()  {
  15                var toda y = moment ();
  16                var earl y = today. add(1, 'da ys');
  17                var late  = today.a dd(4, 'day s');
  18                json = {
  19                    task InstanceId : 'taskIns tance',
  20                    urge ncyId: '5' ,
  21                    urge ncy: 'urge nt',
  22                    earl iestDate:  moment(ear ly).format ('YYYYMMDD HHmmss'),
  23                    late stDate: mo ment(late) .format('Y YYYMMDDHHm mss'),
  24  
  25                title: ' Post proce dure follo w-up',
  26                    requ est: 'This  is my req uest',
  27                      submittedB yUid: 'urn :va:user: R E D A CTED :123',
  28                    subm ittedTimeS tamp: '201 6042000000 0',
  29                    visi t: {
  30                          location:  'urn:va:lo cation: R E D A CTED :303',
  31                         serviceCat egory: 'PS B',
  32                         dateTime:  '201604200 00000'
  33                    }
  34                };
  35  
  36                sinon.st ub(pcmm, ' validate',  function( typeJson,  instanceJs on, appCon fig, callb ack) {
  37                    if ( (instanceJ son.code = == 270) &&  (instance Json.name  === 'LM- T est Team 1 ')) {
  38                         callback(f alse, true );
  39                         return;
  40                    }
  41                    if ( (instanceJ son.code = == 1130) & & (instanc eJson.name  === 'Phys ical Thera py - KDK f loor')) {
  42                         callback(f alse, true );
  43                         return;
  44                    }
  45                    if ( (instanceJ son.code = == 19) &&  (instanceJ son.name = == 'CLERK' )) {
  46                         callback(f alse, true );
  47                         return;
  48                    }
  49                    if ( (instanceJ son.code = == 20) &&  (instanceJ son.name = == 'MEDICA L STUDENT' )) {
  50                         callback(f alse, true );
  51                         return;
  52                    }
  53                    call back(false , false);
  54                });
  55           }) ;
  56  
  57           af terEach(fu nction() {
  58                pcmm.val idate.rest ore();
  59           }) ;
  60  
  61           it ('validate s for me',  function( done) {
  62                json.ass ignTo = 'M e';
  63  
  64                validato r._validat eRequestMo del([], js on, null,  'active',  function(e rrorMessag es) {
  65                    expe ct(errorMe ssages.len gth).to.be (0);
  66                    done ();
  67                });
  68           }) ;
  69  
  70           it ('validate s for pers on', funct ion(done)  {
  71                json.ass ignTo = 'P erson';
  72                json.rou te = {
  73                    faci lity: '500 ',
  74                      person: ' REDA C TED ;5'
  75                };
  76  
  77                validato r._validat eRequestMo del([], js on, null,  'active',  function(e rrorMessag es) {
  78                    expe ct(errorMe ssages.len gth).to.be (0);
  79                    done ();
  80                });
  81           }) ;
  82  
  83           it ('validate s for myTe ams', func tion(done)  {
  84                json.ass ignTo = 'M y Teams';
  85                json.rou te = {
  86                    team : {
  87                         code: 270,
  88                         name: 'LM-  Test Team  1'
  89                    },
  90                    team Focus: {
  91                         code: 270,
  92                         name: 'LM-  Test Team  1'
  93                    },
  94                    pati entsAssign ment: true ,
  95                    assi gnedRoles:  [{
  96                         code: 19,
  97                         name: 'CLE RK'
  98                    }, {
  99                         code: 20,
  100                         name: 'MED ICAL STUDE NT'
  101                    }],
  102                    rout ingCode: ' [TM:LM- Te st Team 1( 270)/TR:CL ERK(19)],[ TM:LM- Tes t Team 1(2 70)/TR:MED ICAL STUDE NT(20)]'
  103                };
  104  
  105                validato r._validat eRequestMo del([], js on, null,  'active',  function(e rrorMessag es) {
  106                    expe ct(errorMe ssages.len gth).to.be (0);
  107                    done ();
  108                });
  109           }) ;
  110  
  111           it ('validate s for anyT eam', func tion(done)  {
  112                json.ass ignTo = 'A ny Team';
  113                json.rou te = {
  114                    faci lity: '500 ',
  115                    team : {
  116                         code: 270,
  117                         name: 'LM-  Test Team  1'
  118                    },
  119                    team Focus: {
  120                         code: 270,
  121                         name: 'LM-  Test Team  1'
  122                    },
  123                    pati entsAssign ment: true ,
  124                    assi gnedRoles:  [{
  125                         code: 19,
  126                         name: 'CLE RK'
  127                    }, {
  128                         code: 20,
  129                         name: 'MED ICAL STUDE NT'
  130                    }],
  131                    rout ingCode: ' [TM:LM- Te st Team 1( 270)/TR:CL ERK(19)/PA :(1)],[TM: LM- Test T eam 1(270) /TR:MEDICA L STUDENT( 20)/PA:(1) ]'
  132                };
  133  
  134                validato r._validat eRequestMo del([], js on, null,  'active',  function(e rrorMessag es) {
  135                    expe ct(errorMe ssages.len gth).to.be (0);
  136                    done ();
  137                });
  138           }) ;
  139  
  140           it ('validate s for anyT eam with t hree-lette r code in  team name' , function (done) {
  141                json.ass ignTo = 'A ny Team';
  142                json.rou te = {
  143                    faci lity: '500 ',
  144                    team : {
  145                         code: 270,
  146                         name: 'LM-  Test Team  1 - ABC'
  147                    },
  148                    pati entsAssign ment: true ,
  149                    assi gnedRoles:  [{
  150                         code: 19,
  151                         name: 'CLE RK'
  152                    }, {
  153                         code: 20,
  154                         name: 'MED ICAL STUDE NT'
  155                    }],
  156                    rout ingCode: ' [TM:LM- Te st Team 1  - ABC(270) /TR:CLERK( 19)/PA:(1) ],[TM:LM-  Test Team  1 - ABC(27 0)/TR:MEDI CAL STUDEN T(20)/PA:( 1)]'
  157                };
  158  
  159                validato r._validat eRequestMo del([], js on, null,  'active',  function(e rrorMessag es) {
  160                    expe ct(errorMe ssages.len gth).to.be (0);
  161                    done ();
  162                });
  163           }) ;
  164  
  165           it ('validate s for anyT eam with t hree-lette r code in  team name  with anoth er hyphena tion in th e name', f unction(do ne) {
  166                json.ass ignTo = 'A ny Team';
  167                json.rou te = {
  168                    faci lity: '500 ',
  169                    team : {
  170                         code: 1130 ,
  171                         name: 'Phy sical Ther apy - KDK  floor - KD K'
  172                    },
  173                    pati entsAssign ment: true ,
  174                    assi gnedRoles:  [{
  175                         code: 19,
  176                         name: 'CLE RK'
  177                    }, {
  178                         code: 20,
  179                         name: 'MED ICAL STUDE NT'
  180                    }],
  181                    rout ingCode: ' [TM:Physic al Therapy  - KDK flo or - KDK(2 70)/TR:CLE RK(19)/PA: (1)],[TM:P hysical Th erapy - KD K floor -  KDK(270)/T R:MEDICAL  STUDENT(20 )/PA:(1)]'
  182                };
  183  
  184                validato r._validat eRequestMo del([], js on, null,  'active',  function(e rrorMessag es) {
  185                    _.ea ch(errorMe ssages, fu nction(mes sage) {
  186                         console.lo g(message) ;
  187                    });
  188                    expe ct(errorMe ssages.len gth).to.be (0);
  189                    done ();
  190                });
  191           }) ;
  192  
  193           it ('rejects  for me if  the \'rout e\' field  is not emp ty', funct ion(done)  {
  194                json.ass ignTo = 'M e';
  195                json.rou te = {
  196                    faci lity: '500 ',
  197                      person: ' REDA C TED ;5'
  198                };
  199  
  200                validato r._validat eRequestMo del([], js on, null,  'active',  function(e rrorMessag es) {
  201                    expe ct(errorMe ssages[0]) .to.be('re quest \'ro ute\' fiel d containe d unexpect ed data');
  202                    done ();
  203                });
  204           }) ;
  205  
  206           de scribe('fo r dates',  function()  {
  207                beforeEa ch(functio n() {
  208                    json .assignTo  = 'Me';
  209                });
  210  
  211                afterEac h(function () {
  212                    json .assignTo  = undefine d;
  213                });
  214  
  215                it('reje cts if lat est date i s malforme d', functi on(done) {
  216                    json .latestDat e = '20160 104240000' ;
  217  
  218                    vali dator._val idateReque stModel([] , json, nu ll, 'activ e', functi on(errorMe ssages) {
  219                         expect(err orMessages [0]).to.be ('Invalid  latest dat e provided ');
  220                         done();
  221                    });
  222                });
  223  
  224                it('...u nless in d raft state ', functio n(done) {
  225                    json .latestDat e = '20160 104240000' ;
  226  
  227                    vali dator._val idateReque stModel([] , json, nu ll, valida tor.DRAFT_ STATE, fun ction(erro rMessages)  {
  228                         expect(err orMessages .length).t o.be(0);
  229                         done();
  230                    });
  231                });
  232  
  233                it('...o r in delet ed state',  function( done) {
  234                    json .latestDat e = '20160 104240000' ;
  235  
  236                    vali dator._val idateReque stModel([] , json, nu ll, valida tor.DELETE D_STATE, f unction(er rorMessage s) {
  237                         expect(err orMessages .length).t o.be(0);
  238                         done();
  239                    });
  240                });
  241  
  242                it('reje cts if lat est date i s really m alformed',  function( done) {
  243                    json .latestDat e = '999';
  244  
  245                    vali dator._val idateReque stModel([] , json, nu ll, 'activ e', functi on(errorMe ssages) {
  246                         expect(err orMessages [0]).to.be ('Invalid  latest dat e provided ');
  247                         done();
  248                    });
  249                });
  250  
  251                it('reje cts if ear liest date  is malfor med', func tion(done)  {
  252                    json .earliestD ate = '201 6010424000 0';
  253  
  254                    vali dator._val idateReque stModel([] , json, nu ll, 'activ e', functi on(errorMe ssages) {
  255                         expect(err orMessages [0]).to.be ('Invalid  earliest d ate provid ed');
  256                         done();
  257                    });
  258                });
  259  
  260                it('reje cts if ear liest date  is later  than lates t date', f unction(do ne) {
  261                    json .latestDat e = '20160 103120000' ;
  262                    json .earliestD ate = '201 6010412000 0';
  263  
  264                    vali dator._val idateReque stModel([] , json, nu ll, 'activ e', functi on(errorMe ssages) {
  265                         expect(err orMessages [0]).to.be ('Latest d ate is bef ore earlie st date');
  266                         done();
  267                    });
  268                });
  269           }) ;
  270  
  271           it ('rejects  if a UID i s bad', fu nction(don e) {
  272                json.ass ignTo = 'P erson';
  273                json.rou te = {
  274                    faci lity: '500 ',
  275                    pers on: 'junk'
  276                };
  277  
  278                validato r._validat eRequestMo del([], js on, null,  'active',  function(e rrorMessag es) {
  279                    expe ct(errorMe ssages.len gth).to.be (1);
  280                    expe ct(errorMe ssages[0]) .to.be('re quest.rout e containe d malforme d person f ield: junk ');
  281                    done ();
  282                });
  283           }) ;
  284  
  285           it ('allows a  bad UID w hile in dr aft state' , function (done) {
  286                json.ass ignTo = 'P erson';
  287                json.rou te = {
  288                    faci lity: '500 ',
  289                    pers on: 'junk'
  290                };
  291  
  292                validato r._validat eRequestMo del([], js on, null,  validator. DRAFT_STAT E, functio n(errorMes sages) {
  293                    expe ct(errorMe ssages.len gth).to.be (0);
  294                    done ();
  295                });
  296           }) ;
  297  
  298           it ('allows a  bad UID w hile in de leted stat e', functi on(done) {
  299                json.ass ignTo = 'P erson';
  300                json.rou te = {
  301                    faci lity: '500 ',
  302                    pers on: 'junk'
  303                };
  304  
  305                validato r._validat eRequestMo del([], js on, null,  validator. DELETED_ST ATE, funct ion(errorM essages) {
  306                    expe ct(errorMe ssages.len gth).to.be (0);
  307                    done ();
  308                });
  309           }) ;
  310  
  311           it ('rejects  if a facil ityCode is  bad', fun ction(done ) {
  312                json.ass ignTo = 'P erson';
  313                json.rou te = {
  314                    faci lity: 'jun k',
  315                      person: ' REDA C TED ;5'
  316                };
  317  
  318                validato r._validat eRequestMo del([], js on, null,  'active',  function(e rrorMessag es) {
  319                    expe ct(errorMe ssages.len gth).to.be (1);
  320                    expe ct(errorMe ssages[0]) .to.be('re quest.rout e containe d malforme d facility  field: ju nk');
  321                    done ();
  322                });
  323           }) ;
  324  
  325           it ('allows a  bad facil ityCode wh ile in dra ft state',  function( done) {
  326                json.ass ignTo = 'P erson';
  327                json.rou te = {
  328                    faci lity: 'jun k',
  329                      person: 'u rn:va:pers on: REDA C TED :5'
  330                };
  331  
  332                validato r._validat eRequestMo del([], js on, null,  validator. DRAFT_STAT E, functio n(errorMes sages) {
  333                    expe ct(errorMe ssages.len gth).to.be (0);
  334                    done ();
  335                });
  336           }) ;
  337  
  338           it ('allows a  bad facil ityCode wh ile in dra ft state',  function( done) {
  339                json.ass ignTo = 'P erson';
  340                json.rou te = {
  341                    faci lity: 'jun k',
  342                      person: 'u rn:va:pers on: REDA C TED :5'
  343                };
  344  
  345                validato r._validat eRequestMo del([], js on, null,  validator. DRAFT_STAT E, functio n(errorMes sages) {
  346                    expe ct(errorMe ssages.len gth).to.be (0);
  347                    done ();
  348                });
  349           }) ;
  350  
  351           it ('successf ully perfo rms end-to -end valid ation', fu nction(don e) {
  352                var endT oEndExampl eJson = {
  353                    'dep loymentId' : 'VistaCo re:Order:1 .0',
  354                    'pro cessDefId' : 'Order.R equest',
  355                    'par ameter' :  {
  356                         'requestAc tivity': {
  357                             'objec tType' : ' requestAct ivity',
  358                               'uid': 'ur n:va:ehmp- activity: R E D A CTED :100716:0e 55ec7b-01a 2-44e3-867 a-343eb33f 035d',
  359                               'patientUi d' : 'urn: va:patient : R E D A CTED :100716:10 0716',
  360                               'authorUid ' : ' R E D A CTED ;100716',
  361                             'domai n': 'ehmp- activity',
  362                             'subDo main': 're quest',
  363                             'visit ' : {
  364                                   'location' : 'urn:va: location: R E D A CTED :100716',
  365                                 's erviceCate gory': 'PS ',
  366                                 'd ateTime':  '201604201 30729'
  367                             },
  368                             'ehmpS tate': 'dr aft',
  369                             'displ ayName': ' Request Ac tivity',
  370                             'refer enceId': ' ',
  371                             'data' : {
  372                                 'a ctivity':  {
  373                                      'deploym entId': 'V istaCore:O rder:1.0',
  374                                      'process Definition Id': 'Orde r.Request' ,
  375                                      'process InstanceId ': '',
  376                                      'state':  'draft',
  377                                        'initiator ': ' REDACT ',
  378                                      'timeSta mp': '2016 0420000000 ',
  379                                      'urgency ': 'Urgent ',
  380                                      'assignT o': 'Me',
  381                                      'routing Code': ''
  382                                 },
  383                                 's ignals': [ ],
  384                                 'r equests':  [
  385                                      {   'tas kInstanceI d':'',
  386                                          'urg encyId': ' 10',
  387                                          'urg ency': 'Ur gent',
  388                                          'ear liestDate' :'20160329 000000',
  389                                          'lat estDate':  '201604200 00000',
  390                                          'tit le': 'Post  procedure  follow-up ',
  391                                          'ass ignTo': 'M e',
  392                                          'req uest': 'Th is is my r equest',
  393                                          'sub mittedByUi d': '122',
  394                                          'sub mittedTime Stamp': '2 0160420000 000',
  395                                          'vis it' :
  396                                          {
  397                                               'location' : 'urn:va: location:[ site]:[IEN ]',
  398                                               'serviceCa tegory': ' PSB',
  399                                               'dateTime' : '2016042 0130729'
  400                                          }
  401                                      }
  402                                 ],
  403                                 'r esponses':  []
  404                             }
  405                         },
  406                          'icn' : ' R E D A CTED ;100716',
  407                          'pid' : ' R E D A CTED ;100716',
  408                         'formActio n':'saved'
  409                    }
  410                };
  411                endToEnd Validator. validateUp date([], e ndToEndExa mpleJson.p arameter.r equestActi vity.uid,  endToEndEx ampleJson. parameter. requestAct ivity, nul l, functio n(errorMes sages) {
  412                    _.ea ch(errorMe ssages, fu nction(err ) {
  413                         console.lo g(err);
  414                    });
  415                    expe ct(errorMe ssages.len gth).to.be (1);
  416                    expe ct(errorMe ssages[0]) .to.be('da ta.activit y.processI nstanceId  cannot be  empty');
  417                    done ();
  418                });
  419           }) ;
  420       });
  421  
  422       descri be('patter n matchers ', functio n() {
  423           it ('recogniz es valid p eople', fu nction() {
  424                  expect(val idator._is ValidPerso n(' R E D A CTED ;3')).to.b e(true);
  425                  expect(val idator._is ValidPerso n(' REDA C TED ;33334')). to.be(true );
  426           }) ;
  427  
  428           it ('doesn\'t  recognize  bad/malfo rmed peopl e', functi on() {
  429                expect(v alidator._ isValidPer son('urn:v a:patient: ABCD:3:3') ).to.be(fa lse);
  430                expect(v alidator._ isValidPer son('urn:v a:location :ABCD:3')) .to.be(fal se);
  431                expect(v alidator._ isValidPer son('urn:v a:patient: 3:3')).to. be(false);
  432  
  433                  expect(val idator._is ValidPerso n(' R E DACTED ;3')).to.b e(false);
  434                  expect(val idator._is ValidPerso n(' REDA C TED ;33334')). to.be(fals e);
  435                  expect(val idator._is ValidPerso n(' R E D A CTED ;')).to.be (false);
  436                expect(v alidator._ isValidPer son(';100' )).to.be(f alse);
  437  
  438                expect(v alidator._ isValidPer son('  ')) .to.be(fal se);
  439                expect(v alidator._ isValidPer son('')).t o.be(false );
  440  
  441                expect(v alidator._ isValidPer son(null)) .to.be(fal se);
  442                expect(v alidator._ isValidPer son(undefi ned)).to.b e(false);
  443  
  444                expect(v alidator._ isValidPer son(true)) .to.be(fal se);
  445                expect(v alidator._ isValidPer son(7)).to .be(false) ;
  446           }) ;
  447  
  448           it ('recogniz es valid f acility co des', func tion() {
  449                expect(v alidator._ isValidFac ilityCode( '500')).to .be(true);
  450                expect(v alidator._ isValidFac ilityCode( 7)).to.be( true);
  451           }) ;
  452  
  453           it ('doesn\'t  recognize  bad facil ity codes' , function () {
  454                expect(v alidator._ isValidFac ilityCode( '500a')).t o.be(false );
  455                expect(v alidator._ isValidFac ilityCode( 'a500')).t o.be(false );
  456                expect(v alidator._ isValidFac ilityCode( 'junk')).t o.be(false );
  457  
  458                expect(v alidator._ isValidFac ilityCode( '  ')).to. be(false);
  459                expect(v alidator._ isValidFac ilityCode( '')).to.be (false);
  460  
  461                expect(v alidator._ isValidFac ilityCode( null)).to. be(false);
  462                expect(v alidator._ isValidFac ilityCode( undefined) ).to.be(fa lse);
  463  
  464                expect(v alidator._ isValidFac ilityCode( true)).to. be(false);
  465           }) ;
  466  
  467           it ('recogniz es valid t eams', fun ction() {
  468                expect(v alidator._ isValidTea m({code: ' 270', name : 'Lalit T est 1'})). to.be(true );
  469           }) ;
  470  
  471           it ('doesn\'t  recognize  malformed  teams', f unction()  {
  472                expect(v alidator._ isValidTea m('urn:va: patient:AB CD:3:3')). to.be(fals e);
  473                expect(v alidator._ isValidTea m({})).to. be(false);
  474                expect(v alidator._ isValidTea m({code: ' 270'})).to .be(false) ;
  475                expect(v alidator._ isValidTea m({name: ' Lalit Test  1'})).to. be(false);
  476                expect(v alidator._ isValidTea m(null)).t o.be(false );
  477           }) ;
  478  
  479           it ('recogniz es valid r oles', fun ction() {
  480                expect(v alidator._ isValidRol e({code: ' 19', name:  'CLERK'}) ).to.be(tr ue);
  481           }) ;
  482  
  483           it ('doesn\'t  recognize  malformed  roles', f unction()  {
  484                expect(v alidator._ isValidRol e('urn:va: patient:AB CD:3:3')). to.be(fals e);
  485                expect(v alidator._ isValidRol e({})).to. be(false);
  486                expect(v alidator._ isValidRol e({code: ' 19'})).to. be(false);
  487                expect(v alidator._ isValidRol e({name: ' CLERK'})). to.be(fals e);
  488                expect(v alidator._ isValidRol e(null)).t o.be(false );
  489           }) ;
  490       });
  491   });