919. EPMO Open Source Coordination Office Redaction File Detail Report

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

919.1 Files compared

# Location File Last Modified
1 ehmp.zip\ehmp\ehmp\product\production\vx-sync\tools\sync-tools patient-status-collection.js Mon Jul 10 17:46:22 2017 UTC
2 ehmp.zip\ehmp\ehmp\product\production\vx-sync\tools\sync-tools patient-status-collection.js Tue Oct 3 13:37:47 2017 UTC

919.2 Comparison summary

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

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

919.4 Active regular expressions

No regular expressions were active.

919.5 Comparison detail

  1   'use stric t';
  2  
  3   var _ = re quire('und erscore');
  4   var async  = require( 'async');
  5   var reques t = requir e('request ');
  6   var util =  require(' util');
  7   var clc =  require('c li-color') ;
  8  
  9  
  10   var argv =  require(' yargs')
  11           .u sage('Usag e: $0 --pr otocol <ht tp|https>  --host <ho st> --port  <port> -- path <path > --color  [on|off] - -add <id,  ...> --rem ove <id, . ..>')
  12           .o ption('r',  {
  13                    alia s: 'protoc ol',
  14                    defa ult: 'http ',
  15                    desc ribe: 'pro tocol (htt p or https ) when mak ing the st atus call' ,
  16                    type : 'string'
  17           })
  18           .o ption('h',  {
  19                    alia s: 'host',
  20                     default: ' IP          ',
  21                    desc ribe: 'IP  Address of  the JDS s erver',
  22                    type : 'string'
  23           })
  24           .o ption('p',  {
  25                    alia s: 'port',
  26                     default:  PORT ,
  27                    desc ribe: 'Por t of the J DS server' ,
  28                    type : 'number'
  29           })
  30           .o ption('t',  {
  31                    alia s: 'path',
  32                    defa ult: '/syn c/combined stat/',
  33                    desc ribe: 'Pat h for the  Simple Syn c Status o n the JDS  server',
  34                    type : 'string'
  35           })
  36           .o ption('c',  {
  37                    alia s: 'color' ,
  38                    defa ult: 'on',
  39                    desc ribe: 'Whe n or not t o colorize  the outpu t (default  is on)',
  40                    type : 'string'
  41           })
  42           .o ption('a',  {
  43                    alia s: 'add',
  44                    desc ribe: 'Pat ient Ident ifiers to  add to the  list',
  45                    type : 'string'
  46           })
  47           .o ption('v',  {
  48                    alia s: 'remove ',
  49                    desc ribe: 'Pat ient Ident ifiers to  remove fro m the list ',
  50                    type : 'string'
  51           })
  52           .o ption('l',  {
  53                    alia s: 'list',
  54                    desc ribe: 'If  true, then  list the  patient id entifiers  and stop',
  55                    type : 'boolean '
  56           })
  57           .o ption('s',  {
  58                    alia s: 'sort',
  59                    desc ribe: 'If  true, then  sort the  output by  identifier ',
  60                    type : 'boolean '
  61           })
  62           .a lias('?',  'help')
  63           .s tring('add ')
  64           .s tring('rem ove')
  65           .h elp('help' )
  66           .a rgv;
  67  
  68  
  69   // var pro tocol = ar gv.protoco l || 'http ';
  70   // var hos t = argv.h ost || ' IP          ';
  71   // var por t = argv.p ort ||  PORT ;
  72   // var pat h = argv.p ath || '/s ync/combin edstat/';
  73   var protoc ol = argv. protocol;
  74   var host =  argv.host ;
  75   var port =  argv.port ;
  76   var path =  argv.path ;
  77   var list =  argv.list ;
  78   var sort =  argv.sort ;
  79   var color  = String(a rgv.color) .toLowerCa se() !== ' false' &&  String(arg v.color).t oLowerCase () !== 'of f' && Stri ng(argv.co lor).toLow erCase() ! == 'no';
  80  
  81   var url =  protocol +  '://' + h ost + ':'  + port + p ath;
  82  
  83   var idList  = ['9E7A; 164',
  84           '9 E7A;100608 ',
  85           '9 E7A;253',
  86           '9 E7A;227',
  87           '9 E7A;71',
  88           '9 E7A;239',
  89           '9 E7A;100599 ',
  90           '9 E7A;100001 ',
  91           '9 E7A;231',
  92           '9 E7A;3',
  93           '9 E7A;9',
  94           '9 E7A;18',
  95           '9 E7A;722',
  96           '9 E7A;100716 ',
  97           '9 E7A;100840 ',
  98           '9 E7A;100731 ',
  99           '9 E7A;65',
  100           '9 E7A;8',
  101           '9 E7A;230',
  102           '9 E7A;17',
  103           '9 E7A;100125 ',
  104           '9 E7A;229',
  105           '9 E7A;420',
  106           '9 E7A;100022 ',
  107           '9 E7A;100012 ',
  108           '9 E7A;271',
  109           'C 877;1',
  110           '9 E7A;428',
  111           '9 E7A;1',
  112           '9 E7A;100184 ',
  113           '9 E7A;167',
  114           '9 E7A;100615 ',
  115           '9 E7A;301',
  116           '9 E7A;100033 ',
  117           '9 E7A;100817 ',
  118           '9 E7A;149',
  119           '9 E7A;204'
  120   ];
  121  
  122   var addLis t = buildL istFromArg (argv, 'ad d');
  123   var remove List = bui ldListFrom Arg(argv,  'remove');
  124  
  125   idList = u pdateIdLis t(idList,  addList, r emoveList,  sort);
  126  
  127   if (list)  {
  128           co nsole.log( );
  129  
  130           _. each(idLis t, functio n(id) {
  131                    cons ole.log(id );
  132           }) ;
  133  
  134           co nsole.log( );
  135           pr ocess.exit ();
  136   }
  137  
  138   async.map( idList, fe tchStatus,  function( error, res ult) {
  139           co nsole.log( );
  140  
  141           _. each(resul t, functio n(status)  {
  142                    var  text = sta tus.text;
  143                    if ( color) {
  144                             text =  status.co lorize(tex t);
  145                    }
  146  
  147                    cons ole.log(te xt);
  148           }) ;
  149  
  150           co nsole.log( );
  151           pr ocess.exit ();
  152   });
  153  
  154  
  155   function b uildListFr omArg(argv , argName)  {
  156           if  (!_.has(a rgv, argNa me)) {
  157                    retu rn [];
  158           }
  159  
  160           va r list = a rgv[argNam e];
  161  
  162           if  (!_.isArr ay(list))  {
  163                    list  = [list];
  164           }
  165  
  166           li st = _.map (list, fun ction(item ) {
  167                    retu rn String( item).spli t(',');
  168           }) ;
  169  
  170           li st = _.fla tten(list) ;
  171           li st = _.fil ter(list,  function(i tem) {
  172                    retu rn item.le ngth > 0;
  173           }) ;
  174  
  175           re turn list;
  176   }
  177  
  178   function u pdateIdLis t(idList,  addList, r emoveList,  sort) {
  179           id List = _.f ilter(idLi st, functi on(id) {
  180                    retu rn !_.cont ains(remov eList, id) ;
  181           }) ;
  182  
  183           _. each(addLi st, functi on(id) {
  184                    if ( !_.contain s(idList,  id)) {
  185                             idList .push(id);
  186                    }
  187           }) ;
  188  
  189           if  (sort) {
  190                    idLi st.sort(co mpareIds);
  191                    // i dList.sort (compareId s);
  192           }
  193  
  194           re turn idLis t;
  195   }
  196  
  197   function c ompareIds( id1, id2)  {
  198           if  (id1 ===  id2) {
  199                    retu rn 0;
  200           }
  201  
  202           va r id1Split  = splitId (id1);
  203           va r id2Split  = splitId (id2);
  204  
  205           if  (id1Split .site !==  id2Split.s ite) {
  206                    retu rn id1Spli t.site.loc aleCompare (id2Split. site);
  207           }
  208  
  209           if  (_.isNumb er(Number( id1Split.i d)) && _.i sNumber(Nu mber(id2Sp lit.id)))  {
  210                    retu rn Number( id1Split.i d) - Numbe r(id2Split .id);
  211           }
  212  
  213           re turn id1Sp lit.id.loc aleCompare (id2Split. id);
  214   }
  215  
  216   function s plitId(id)  {
  217           if  (!_.conta ins(id, '; ')) {
  218                    retu rn {
  219                             site:  '^',
  220                             id: id
  221                    };
  222           }
  223  
  224           id  = id.spli t(';');
  225  
  226           re turn {
  227                    site : id[0],
  228                    id:  id[1]
  229           };
  230   }
  231  
  232   function f etchStatus (id, callb ack) {
  233           re quest(url  + id, func tion(error , response , body) {
  234                    if ( error) {
  235                             return  callback( null, buil dStatus(id , error, c lc.redBrig ht));
  236                    }
  237  
  238                    if ( response.s tatusCode  === 404) {
  239                             return  callback( null, buil dStatus(id , 'NOT FOU ND', clc.m agentaBrig ht));
  240                    }
  241  
  242                    if ( response.s tatusCode  !== 200) {
  243                             return  callback( null, buil dStatus(id , util.for mat('UNEXP ECTED RESP ONSE: %s',  String(bo dy)), clc. magentaBri ght));
  244                    }
  245  
  246                    body  = parseRe sponse(bod y);
  247  
  248                    if ( isSimpleSy ncStatusCo mplete(bod y)) {
  249                             return  callback( null, buil dStatus(id , 'COMPLET E', clc.cy anBright)) ;
  250                    }
  251  
  252                    if ( !isSimpleS yncStatusW ithError(b ody)) {
  253                             return  callback( null, buil dStatus(id , 'INCOMPL ETE', clc. blueBright ));
  254                    }
  255  
  256                    retu rn callbac k(null, bu ildStatus( id, 'INCOM PLETE WITH  ERRORS',  clc.yellow Bright));
  257           }) ;
  258   }
  259  
  260   function b uildStatus (id, text,  colorizer ) {
  261           re turn {
  262                    text : util.for mat('%s: % s', id, te xt),
  263                    colo rize: colo rizer
  264           };
  265   }
  266  
  267   function p arseRespon se(respons e) {
  268           tr y {
  269                    retu rn JSON.pa rse(respon se);
  270           }  catch (err or) {
  271                    retu rn respons e;
  272           }
  273   }
  274  
  275  
  276   function i sSimpleSyn cStatusWit hError(sim pleSyncSta tus) {
  277           if  (_.isEmpt y(simpleSy ncStatus))  {
  278                    retu rn false;
  279           }
  280  
  281           if  (simpleSy ncStatus.h asError) {
  282                    retu rn true;
  283           }
  284  
  285           if  (_.isEmpt y(simpleSy ncStatus.s ites)) {
  286                    retu rn false;
  287           }
  288  
  289           re turn _.som e(simpleSy ncStatus.s ites, func tion(site)  {
  290                    retu rn site.ha sError;
  291           }) ;
  292   }
  293  
  294   function i sSimpleSyn cStatusCom plete(simp leSyncStat us) {
  295           if  (_.isEmpt y(simpleSy ncStatus))  {
  296                    retu rn false;
  297           }
  298  
  299           if  (_.has(si mpleSyncSt atus, 'syn cCompleted ') && !sim pleSyncSta tus.syncCo mpleted) {
  300                    retu rn false;
  301           }
  302  
  303           re turn _.eve ry(simpleS yncStatus. sites, fun ction(site ) {
  304                    retu rn site.sy ncComplete d;
  305           }) ;
  306   }