33. EPMO Open Source Coordination Office Redaction File Detail Report

Produced by Araxis Merge on 10/4/2017 8:04:33 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.

33.1 Files compared

# Location File Last Modified
1 rdk.zip\rdk\product\production\rdk\src\fhir\procedure procedure-resource.js Mon Aug 21 12:51:00 2017 UTC
2 rdk.zip\rdk\product\production\rdk\src\fhir\procedure procedure-resource.js Tue Oct 3 18:05:12 2017 UTC

33.2 Comparison summary

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

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

33.4 Active regular expressions

No regular expressions were active.

33.5 Comparison detail

  1   'use stric t';
  2   var rdk =  require('. ./../core/ rdk');
  3   var nullch ecker = rd k.utils.nu llchecker;
  4   var _ = re quire('lod ash');
  5   var proced ure = requ ire('./pro cedure');
  6   var fhirTo JDSSearch  = require( '../common /utils/fhi r-to-jds-s earch');
  7   var fhirRe source = r equire('.. /common/en tities/fhi r-resource ');
  8   var educat ions = req uire('./ed ucations') ;
  9   var async  = require( 'async');
  10   var confUt ils = requ ire('../co nformance/ conformanc e-utils');
  11   var confor mance = re quire('../ conformanc e/conforma nce-resour ce');
  12  
  13   //-------- ---------- ---------- ---------- ---------- ---------- -----
  14   // NOTE: O NLY allowa ble _tag f ilters are  the enume rations be low
  15   // NOTE: i f no _tag  filter are  given the n  procedu re request  will
  16   //       p ull BOTH e ducations  and non-ed ucations p rocedure d ata.
  17   //-------- ---------- ---------- ---------- ---------- ---------- -----
  18   var allowa bleDomains  = {
  19       PROCED URE: 'proc edure',
  20       EDUCAT IONS: 'edu cations',
  21       getAll : function () {return  this.PROC EDURE + ',  ' + this. EDUCATIONS ;}
  22   };
  23  
  24   function g etResource Config() {
  25       return  [{
  26           na me: 'fhir- procedure' ,
  27           pa th: '',
  28           ge t: getProc edure,
  29           su bsystems:  ['patientr ecord', 'j ds', 'solr ', 'jdsSyn c', 'autho rization'] ,
  30           in terceptors : { fhirPi d: true },
  31           re quiredPerm issions: [ 'read-fhir '],
  32           is PatientCen tric: true ,
  33           pe rmitRespon seFormat:  true
  34       },{
  35           na me: 'fhir- procedure- search',
  36           pa th: '_sear ch',
  37           po st: getPro cedure,
  38           su bsystems:  ['patientr ecord', 'j ds', 'solr ', 'jdsSyn c', 'autho rization'] ,
  39           in terceptors : { fhirPi d: true },
  40           re quiredPerm issions: [ 'read-fhir '],
  41           is PatientCen tric: true ,
  42           pe rmitRespon seFormat:  true
  43       }];
  44   }
  45  
  46   //Issue ca ll to Conf ormance re gistration
  47   conformanc e.register (confUtils .domains.P ROCEDURE,  createConf ormanceDat a());
  48  
  49   function c reateConfo rmanceData () {
  50       var re sourceType  = confUti ls.domains .PROCEDURE ;
  51       var pr ofileRefer ence = 'ht tp://www.h l7.org/FHI R/2015May/ procedure. html';
  52       var in teractions  = [ 'read ', 'search -type'];
  53  
  54       return  confUtils .createCon formanceDa ta(resourc eType, pro fileRefere nce,
  55                interact ions, proc edure.fhir ToJDSAttrM ap);
  56   }
  57  
  58   /**
  59    * @api {g et} /fhir/ patient/{i d}/procedu re Get Pro cedure
  60    * @apiNam e getProce dure
  61    * @apiGro up Procedu re
  62    * @apiPar am {String } id The p atient id
  63    * @apiPar am {Number } [_count]  The numbe r of resul ts to show .
  64    * @apiPar am {String } [_tag] T o specify  a specific  subset, e ither proc edure or e ducations
  65    *
  66    * @apiDes cription C onverts a  vpr 'proce dure' reso urce into  a FHIR 'pr ocedure' r esource.
  67    *
  68    * @apiExa mple {js}   Examples:
  69    *      //  Limiting  results co unt
  70    *        http:// IP             /resource/ fhir/patie nt/ R E D A CTED ;253/proce dure?_coun t=1
  71    *
  72    * @apiSuc cess {json } data Jso n object c onforming  to the <a  href="http ://www.hl7 .org/FHIR/ 2015May/pr ocedure.ht ml">Proced ure  FHIR  DTSU2 spec ification< /a>.
  73    * @apiSuc cessExampl e Success- Response:
  74    * {
  75    *    "res ourceType" : "Bundle" ,
  76    *    "typ e": "colle ction",
  77    *    "id" : "ccebfbe 9-edaf-4c3 8-e54c-9c2 741bdd61e" ,
  78    *    "lin k": [
  79    *         {
  80    *             "relat ion": "sel f",
  81    *               "url": "ht tp://127.0 .0.1: PORT /resource/ fhir/patie nt/ REDA C TED ;100816/pr ocedure"
  82    *         }
  83    *    ],
  84    *    "tot al": 1,
  85    *    "ent ry": [
  86    *         {
  87    *             "resou rce": {
  88    *                 "r esourceTyp e": "Proce dure",
  89    *                 "i d": "a7da3 796-174e-4 6fc-b77d-b 4913af5a05 f",
  90    *                 "t ext": {
  91    *                      "status" : "generat ed",
  92    *                      "div": " <div>LAPAR ASCOPY</di v>"
  93    *                 },
  94    *                 "s tatus": "c ompleted",
  95    *                 "i dentifier" : [
  96    *                      {
  97    *                          "sys tem": "urn :oid:2.16. 840.1.1138 83.6.233",
  98    *                          "val ue": "urn: va:procedu re:ABCD:22 6:50;MCAR( 699,"
  99    *                      }
  100    *                 ],
  101    *                 "p atient": {
  102    *                      "referen ce": "Pati ent/HDR;50 00000317V3 87446"
  103    *                 },
  104    *                 "t ype": {
  105    *                      "coding" : [
  106    *                          {
  107    *                                "system":  "gov.va.fi leman697-2 : R E D A CTED ",
  108    *                               "display":  "LAPARASC OPY",
  109    *                               "primary":  true
  110    *                          }
  111    *                      ]
  112    *                 },
  113    *                 "e xtension":  [
  114    *                      {
  115    *                          "url ": "http:/ /vistacore .us/fhir/e xtensions/ procedure# category",
  116    *                          "val ueString":  "CP"
  117    *                      },
  118    *                      {
  119    *                          "url ": "http:/ /vistacore .us/fhir/e xtensions/ procedure# stampTime" ,
  120    *                          "val ueString":  "20150825 173613"
  121    *                      },
  122    *                      {
  123    *                          "url ": "http:/ /vistacore .us/fhir/e xtensions/ procedure# dateTime",
  124    *                          "val ueString":  "19981119 0800"
  125    *                      },
  126    *                      {
  127    *                          "url ": "http:/ /vistacore .us/fhir/e xtensions/ procedure# facilityCo de",
  128    *                          "val ueString":  "561"
  129    *                      },
  130    *                      {
  131    *                          "url ": "http:/ /vistacore .us/fhir/e xtensions/ procedure# facilityNa me",
  132    *                          "val ueString":  "New Jers ey HCS"
  133    *                      },
  134    *                      {
  135    *                          "url ": "http:/ /vistacore .us/fhir/e xtensions/ procedure# kind",
  136    *                          "val ueString":  "Procedur e"
  137    *                      },
  138    *                      {
  139    *                          "url ": "http:/ /vistacore .us/fhir/e xtensions/ procedure# localId",
  140    *                          "val ueString":  "50;MCAR( 699,"
  141    *                      }
  142    *                 ]
  143    *             }
  144    *         }
  145    *    ]
  146    *}
  147    *
  148    * @apiErr or (Error  400) Inval id paramet er values.
  149    * @apiErr orExample  Error-Resp onse:
  150    * HTTP/1. 1 400 Bad
  151    * {
  152    *      In valid para meter valu es.
  153    * }
  154    */
  155  
  156   function b uildBundle (results,  req, total ) {
  157       var li nk;
  158       if (re q) {
  159           li nk = [new  fhirResour ce.Link(re q.protocol  + '://' +  req.heade rs.host +  req.origin alUrl, 'se lf')];
  160       }
  161  
  162       var en try = [];
  163       _.forE ach(result s, functio n(aResult)  {
  164           en try.push(n ew fhirRes ource.Entr y(aResult) );
  165       });
  166  
  167       return  (new fhir Resource.B undle(link , entry, t otal));
  168   }
  169  
  170   function b uildTask(r eq, res, m odule) {
  171       // tas k function  called by  async
  172       return  function( callback)  {
  173           mo dule.getDa ta(req.app .config, r eq.logger,  req.query .pid, req. query, fun ction(err,  inputJSON ) {
  174                if (null checker.is NotNullish (err)) {
  175                    retu rn res.sta tus(err.co de || 500) .send(err. message);
  176                }
  177                var outJ SON = modu le.convert ToFhir(inp utJSON.dat a.items, r eq);
  178                return c allback(er r, outJSON );
  179           }) ;
  180       };
  181   }
  182  
  183   function g etProcedur e(req, res ) {
  184       var pi d = req.qu ery.pid;
  185       var pa rams = req .query;
  186       var do mainFilter  = params. _tag;
  187  
  188       if (nu llchecker. isNullish( pid)) {
  189           re turn res.s tatus(rdk. httpstatus .bad_forma t).send('M issing req uired para meter: pid ');
  190       }
  191  
  192       valida teParams(r eq.query,  /*onSucces s*/ functi on() {
  193  
  194  
  195           va r tasks;
  196           if  (nullchec ker.isNull ish(domain Filter)) {
  197                tasks =  [buildTask (req, res,  procedure ), buildTa sk(req, re s, educati ons)];
  198           }  else {
  199                switch ( domainFilt er) {
  200                    case  allowable Domains.PR OCEDURE:
  201                         tasks = [b uildTask(r eq, res, p rocedure)] ;
  202                         break;
  203                    case  allowable Domains.ED UCATIONS:
  204                         tasks = [b uildTask(r eq, res, e ducations) ];
  205                         break;
  206                    defa ult:
  207                         return res .status(rd k.httpstat us.bad_req uest).send ('Invalid  _tag param eter.  Onl y allowabl e _tag val ues are:'  + allowabl eDomains.g etAll());
  208                }
  209           }
  210  
  211           as ync.parall el(tasks,  function(e rr, result s) {
  212                if (err)  {
  213                    retu rn res.sta tus(rdk.ht tpstatus.i nternal_se rver_error ).rdkSend( err);
  214                }
  215  
  216                //------ ---------- ---------- ---------- ---------- ---------- ---
  217                // 1) co nsolidate  all entrie s into a s ingle arra y. Note, c oncat
  218                //    wi ll take le ave out em pty array  items.
  219                // 2) re duce total  number of  entries a s specific ed per _co unt
  220                // 3) bu ild and se nd final B undle of a ll gathere d entries.
  221                //------ ---------- ---------- ---------- ---------- ---------- ---
  222  
  223                var reso urces = _. flatten(re sults);
  224  
  225                limitFHI RResultByC ount(resou rces, para ms._count) ;
  226                var fhir Bundle = b uildBundle (resources , req, res ources.len gth);
  227  
  228                return r es.status( rdk.httpst atus.ok).s end(fhirBu ndle);
  229           }) ;
  230  
  231       }, /*o nError*/ f unction(er rors) {
  232           re turn res.s tatus(rdk. httpstatus .bad_reque st).send(' Invalid pa rameters:'  + fhirToJ DSSearch.v alidationE rrorsToStr ing(errors ));
  233       }); // end-valida teParams
  234   }
  235  
  236  
  237   function v alidatePar ams(params , onSucces s, onError ) {
  238       // che ck common  parameters
  239       fhirTo JDSSearch. validateCo mmonParams (params, f unction()  {
  240           //  validate  date
  241           fh irToJDSSea rch.valida teDatePara ms(params,  ['date'],  onSuccess , onError  );
  242           //  FUTURE-TO DO: add va lidation f or code pa ram
  243       }, onE rror);
  244   }
  245  
  246   function l imitFHIRRe sultByCoun t(fhirBund le, countS tr) {
  247       if (nu llchecker. isNotNulli sh(countSt r)) {
  248           va r count =  parseInt(c ountStr);
  249           fh irBundle.e ntry = _.t ake(fhirBu ndle.entry , count);
  250       }
  251   }
  252  
  253   module.exp orts.getRe sourceConf ig = getRe sourceConf ig;
  254   module.exp orts.getPr ocedure =  getProcedu re;
  255   module.exp orts.creat eConforman ceData = c reateConfo rmanceData ;