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

79.1 Files compared

# Location File Last Modified
1 rdk.zip\rdk\product\production\rdk\src\resources global-timeline-resource.js Mon Aug 21 12:51:07 2017 UTC
2 rdk.zip\rdk\product\production\rdk\src\resources global-timeline-resource.js Tue Oct 3 17:15:58 2017 UTC

79.2 Comparison summary

Description Between
Files 1 and 2
Text Blocks Lines
Unchanged 2 486
Changed 1 2
Inserted 0 0
Removed 0 0

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

79.4 Active regular expressions

No regular expressions were active.

79.5 Comparison detail

  1   'use stric t';
  2  
  3   var rdk =  require('. ./core/rdk ');
  4   var _ = re quire('lod ash');
  5   var httpUt il = rdk.u tils.http;
  6   var async  = require( 'async');
  7   var moment  = require ('moment') ;
  8   var whiteL ist = ['SC HEDULED/KE PT','CHECK ED IN', 'I NPATIENT A PPOINTMENT ', 'FUTURE ', 'NON-CO UNT', 'ACT ION REQUIR ED', 'NO A CTION TAKE N'];
  9  
  10   function g etResource Config() {
  11       return  [{
  12           na me: 'globa l-timeline -getTimeli ne',
  13           pa th: '',
  14           ge t: getTime line,
  15           re quiredPerm issions: [ 'read-pati ent-record '],
  16           is PatientCen tric: fals e,
  17           su bsystems:  ['patientr ecord', 'j dsSync']
  18       }];
  19   }
  20  
  21   function t rimResultO bjects(val ue, key, l ist) {
  22       //norm alize time  lengths t o YYYYMMDD hhmmss
  23       if (va lue.dateTi me) {
  24           va lue.dateTi me = right Pad(value. dateTime);
  25       }
  26  
  27       if (va lue.refere nceDateTim e) {
  28           va lue.refere nceDateTim e = rightP ad(value.r eferenceDa teTime);
  29       }
  30  
  31       list[k ey] = _.pi ck(value,  'kind', 'd ateTime',  'reference DateTime',  'stay');
  32   }
  33  
  34   function r ightPad(nu m) {
  35       num =  num + '';
  36       if (nu m.length > = 14) {
  37           re turn num;
  38       }
  39  
  40       var pa d = '00000 000000000'  + '';
  41       return  num + pad .substring (0, pad.le ngth - num .length);
  42   }
  43  
  44   function s ortByDateT ime(a, b)  {
  45       a = a. dateTime | | a.refere nceDateTim e;
  46       if (!a ) {
  47           re turn 0;
  48       }
  49  
  50       b = b. dateTime | | b.refere nceDateTim e;
  51       if (!b ) {
  52           re turn 0;
  53       }
  54  
  55       return  a - b;
  56   }
  57  
  58   function g etTimeline (req, res)  {
  59       req.au dit.dataDo main = 'Gl obal Timel ine';
  60       req.au dit.logCat egory = 'T IMELINE';
  61  
  62       getDat a(req, fun ction(err,  data) {
  63           if  (err) {
  64                req.logg er.error(e rr);
  65                res.stat us(err.sta tus || rdk .httpstatu s.internal _server_er ror).rdkSe nd(err);
  66           }  else {
  67                res.stat us(rdk.htt pstatus.ok ).rdkSend( data);
  68           }
  69       });
  70   }
  71  
  72   function g etData(req , callback ) {
  73       var pi d = req.pa ram('pid') ;
  74  
  75         //encounte r: http:// IP                /vpr/10108 V420871/in dex/encoun ter
  76  
  77       async. parallel({
  78                encounte rs: functi on(callbac k) {
  79                    make JdsCall(re q.app.conf ig, '/vpr/ ' + pid +  '/index/en counter?fi lter=ne(re moved,true )', req.lo gger, call back);
  80                }
  81           },
  82           fu nction(err , results)  {
  83                if (err)  {
  84                    req. logger.err or(err);
  85                    retu rn callbac k(err);
  86                } else {
  87                    resu lts = sort InpatientO utpatient( results, r eq.logger) ;
  88                }
  89                callback (null, res ults);
  90           }) ;
  91   }
  92  
  93   function m akeJdsCall (appConfig , jdsPath,  logger, c allback) {
  94       var op tions = _. extend({},  appConfig .jdsServer , {
  95                url: jds Path,
  96                logger:  logger ||  {},
  97                json: tr ue
  98           }) ;
  99  
  100       httpUt il.get(opt ions, func tion(err,  response,  returnedDa ta) {
  101           if  (err) {
  102                options. logger.err or(err.mes sage);
  103                callback (err);
  104                return;
  105           }
  106           if  (returned Data.hasOw nProperty( 'data')) {
  107                callback (null, ret urnedData) ;
  108           }  else {
  109                //malfor med json
  110                err = ne w Error('U nexpected  JSON forma t');
  111                options. logger.err or(err.mes sage);
  112                err.stat us = respo nse.status Code;
  113                callback (err);
  114                return;
  115           }
  116  
  117       });
  118   }
  119  
  120   function s ortInpatie ntOutpatie nt(results , logger)  {
  121  
  122       //retu rn results ; //uncomm ent to sho rtcircuit  parsing an d return r aw JDS res ults
  123  
  124       // JDS  indexes t o parse
  125       // ;;e ncounter
  126       //  ;;     collec tions: vis it, appoin tment
  127       //  ;;     fields : dateTime /V/0
  128       //  ;;     sort:  dateTime d esc
  129  
  130       //  Bu siness log ic definit ions are l ocated on  the F299 G lobal Date  Timeline  Technical  Approach w iki
  131  
  132       var ne wResults =  {
  133           in patient: [ ],
  134           ou tpatient:  []
  135       };
  136  
  137       logger  = logger  || {
  138           er ror: funct ion() {}
  139       };
  140       var en counters;
  141       if (re sults.hasO wnProperty ('encounte rs') && re sults.enco unters.has OwnPropert y('data')  && results .encounter s.data.has OwnPropert y('items') ) {
  142           en counters =  results.e ncounters. data.items ;
  143           va r apptCuto ffDate = m oment();
  144           _. each(encou nters, fun ction(enco unter, key , list) {
  145                switch ( encounter. kind) {
  146                    case  'Discharg e Summary' :
  147                         newResults .inpatient .push(enco unter);
  148                         break;
  149                    case  'Admissio n':
  150                    case  'Visit':
  151                         //check if  we are pr ocessing a n appointm ent
  152                         if (encoun ter.appoin tmentStatu s) {
  153                             //allo w only whi telisted a ppointment  statuses
  154                             if (wh iteList.in dexOf(enco unter.appo intmentSta tus) >= 0)  {
  155                                 // if it is a  valid app ointment m ake sure i t is futur e
  156                                 va r rawVisit Date = enc ounter.dat eTime || e ncounter.r eferenceDa teTime;
  157                                 if  (rawVisit Date) {
  158                                      var appt Date = mom ent(rawVis itDate, 'Y YYYMMDDHHm mss');
  159                                      if (appt Date.isAft er(apptCut offDate))  {
  160                                          if ( encounter. patientCla ssCode &&  encounter. patientCla ssCode ===  'urn:va:p atient-cla ss:IMP') {
  161                                               newResults .inpatient .push(enco unter);
  162                                          } el se {
  163                                               //AMB and  EMER
  164                                               newResults .outpatien t.push(enc ounter);
  165                                          }
  166                                      }
  167                                      //discar d invalid  or non-fut ure appoin tments via  no-op
  168                                 }
  169                             }
  170                         } else {
  171                             //cont inue to pr ocess non- appointmen t visit &  admission  events nor mally
  172                             if (en counter.pa tientClass Code && en counter.pa tientClass Code === ' urn:va:pat ient-class :IMP') {
  173                                 ne wResults.i npatient.p ush(encoun ter);
  174                             } else  {
  175                                 // AMB and EM ER
  176                                 ne wResults.o utpatient. push(encou nter);
  177                             }
  178                         }
  179                         break;
  180                    case  'DoD Appo intment':
  181                         var rawDat e = encoun ter.dateTi me || enco unter.refe renceDateT ime;
  182                         if (rawDat e) {
  183                             var ap ptDateDoD  = moment(r awDate, 'Y YYYMMDDHHm mss');
  184                             if (ap ptDateDoD. isAfter(ap ptCutoffDa te)) {
  185                                 if  (encounte r) {
  186                                      // proce ss only PE NDING and  BOOKED DoD  Appointme nts
  187                                      if (!enc ounter.has OwnPropert y('appoint mentStatus ') || (enc ounter.app ointmentSt atus === ' PENDING')  || (encoun ter.appoin tmentStatu s === 'BOO KED')) {
  188                                          if ( encounter. typeName)  {
  189                                               if (encoun ter.typeNa me === 'IN PATIENT')  {
  190                                                   newRes ults.inpat ient.push( encounter) ;
  191                                               } else if  (encounter .typeName  === 'RNDS* ') {
  192                                                   //INPA TIENT WARD  APPT
  193                                                   newRes ults.inpat ient.push( encounter) ;
  194                                               } else {
  195                                                   newRes ults.outpa tient.push (encounter );
  196                                               }
  197                                          } el se {
  198                                               newResults .outpatien t.push(enc ounter);
  199                                          }
  200                                      }
  201                                 }
  202                             }
  203                             //disc ard invali d or non-f uture appo intments
  204                         }
  205                         break;
  206                    case  'DoD Enco unter':
  207                         if (encoun ter && enc ounter.typ eName) {
  208                             if (en counter.ty peName ===  'INPATIEN T') {
  209                                 ne wResults.i npatient.p ush(encoun ter);
  210                             } else  if (encou nter.typeN ame === 'R NDS*') {
  211                                 // INPATIENT  WARD APPT
  212                                 ne wResults.i npatient.p ush(encoun ter);
  213                             } else  {
  214                                 ne wResults.o utpatient. push(encou nter);
  215                             }
  216                         } else if  (encounter ) {
  217                             newRes ults.outpa tient.push (encounter );
  218                         }
  219  
  220                         break;
  221                    defa ult:
  222                         logger.err or({encoun ter: encou nter}, 'En counter wi th unexpec ted kind a ttribute') ;
  223                         //  noop -  exclude f rom result s if no ki nd
  224                }
  225           }) ;
  226       }
  227  
  228       _.each (newResult s.inpatien t, trimRes ultObjects );
  229       _.each (newResult s.outpatie nt, trimRe sultObject s);
  230  
  231       newRes ults.inpat ientCount  = newResul ts.inpatie nt.length;
  232       newRes ults.outpa tientCount  = newResu lts.outpat ient.lengt h;
  233  
  234       newRes ults.inpat ient = new Results.in patient.so rt(sortByD ateTime);
  235       newRes ults.outpa tient = ne wResults.o utpatient. sort(sortB yDateTime) ;
  236  
  237       return  newResult s;
  238   }
  239  
  240   module.exp orts.getRe sourceConf ig = getRe sourceConf ig;
  241   module.exp orts._trim ResultObje cts = trim ResultObje cts;
  242   module.exp orts._righ tPad = rig htPad;
  243   module.exp orts._sort ByDateTime  = sortByD ateTime;
  244   module.exp orts._sort InpatientO utpatient  = sortInpa tientOutpa tient;