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

27.1 Files compared

# Location File Last Modified
1 rdk.zip\rdk\product\production\rdk\src\fhir\observation\health-factors health-factors.js Mon Aug 21 12:51:00 2017 UTC
2 rdk.zip\rdk\product\production\rdk\src\fhir\observation\health-factors health-factors.js Tue Oct 3 17:15:29 2017 UTC

27.2 Comparison summary

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

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

27.4 Active regular expressions

No regular expressions were active.

27.5 Comparison detail

  1   'use stric t';
  2   var rdk =  require('. ./../../co re/rdk');
  3   var nullch ecker = rd k.utils.nu llchecker;
  4   var _ = re quire('lod ash');
  5   var helper s = requir e('../../c ommon/util s/helpers. js');
  6   var fhirUt ils = requ ire('../.. /common/ut ils/fhir-c onverter') ;
  7   var fhirTo JDSSearch  = require( '../../com mon/utils/ fhir-to-jd s-search') ;
  8   var jds =  require('. ./../commo n/utils/jd s-query-he lper');
  9   var fhirRe source = r equire('.. /common/en tities/fhi r-resource ');
  10  
  11   var concep tCategory  = 'HF';
  12  
  13   var fhirTo JDSMap = {
  14       // **  code           // Not  supported  - pending  clarifica tion of th e FHIR sta ndard.
  15       // **  code-value -x  // Not  supported  - pending  clarifica tion of th e FHIR sta ndard.
  16       // (NO T MAPPED)  data-absen t-reason
  17       date:  'entered',  // Obtain ed date/ti me (e.g. O bservation .appliesDa teTime)
  18       // (NO T MAPPED)  device
  19       // (NO T MAPPED)  encounter
  20       identi fier: 'uid ', // The  unique Id  for a part icular obs ervation
  21       // pat ient
  22       patien t: 'pid',  // the sub ject that  the observ ation is a bout (if p atient)
  23       perfor mer: 'faci lityName',  // Who pe rformed th e observat ion
  24       // (NO T MAPPED)  related
  25       // (NO T MAPPED)  related-ta rget
  26       // (NO T MAPPED)  related-ty pe
  27       // (NO T MAPPED -  hardcoded  to 'unkno wn') relia bility
  28       // (NO T MAPPED)  specimen
  29       // (NO T MAPPED -  harcoded  to 'final' ) status
  30       subjec t: 'pid',  // the sub ject that  the observ ation is a bout
  31       // (NO T MAPPED v alue-conce pt
  32       // (NO T MAPPED v alue-date
  33       // (NO T MAPPED v alue-strin g
  34       // (NO T MAPPED)  value-quan tity
  35   };
  36  
  37   function b uildSearch Query(para ms) {
  38       var qu ery = [];
  39       var da teQuery;
  40  
  41       // sys tem & code
  42       if (nu llchecker. isNotNulli sh(params. code)) {
  43           va r systemCo deQuery =  buildCodeQ uery(param s.code);
  44           if  (systemCo deQuery == = null) {
  45                // syste m/code que ry didn't  map to a J DS filter  that would  yield res ults
  46                return n ull;
  47           }
  48           qu ery.push(b uildCodeQu ery(params .code));
  49       }
  50       // dat e
  51       if (nu llchecker. isNotNulli sh(params. date)) {
  52           da teQuery =  fhirToJDSS earch.buil dDateQuery (params.da te, 'enter ed', false  /*ignoreT ime*/ , tr ue /*inclu deSeconds* / );
  53           if  (dateQuer y) {
  54                query.pu sh(dateQue ry);
  55           }
  56       }
  57       return  fhirToJDS Search.bui ldSearchQu eryString( query);
  58   }
  59  
  60   function b uildCodeQu ery(codeQu ery) {
  61       var co nceptCodeR egex = /^\ /concept\/ .+\.(.+)$/ ; // '/con cept/HF.'  + encodeUR I(jdsItem. name)
  62       var qu eries = [] ;
  63       // FHI R supports  escaped c ommas (\,) . We repla ce non-esc aped comma s with a
  64       // unu sed unicod e characte r to perfo rm the spl it .
  65       var to kens = cod eQuery.rep lace(/([^\ \]),/g, '$ 1\u000B'). split('\u0 00B');
  66  
  67       _.forE ach(tokens , function (token) {
  68           //  unescape  any commas
  69           to ken = toke n.replace( /\\,/g, ', ');
  70           va r code;
  71           va r system;
  72           va r codeSyst emSplit =  token.spli t('|');
  73  
  74           if  (codeSyst emSplit.le ngth > 1)  {
  75                system =  codeSyste mSplit[0];
  76                code = c odeSystemS plit[1];
  77           }  else {
  78                code = c odeSystemS plit[0];
  79           }
  80  
  81             // http:// ehmp. DNS     /terminolo gy/1.0 doe s not exis t in VPR,  FHIR mappi ng associa tes the sy stem with  VPR record 's name.
  82           //  That's th e only sys tem that c ould be qu eried to g et results .
  83             if ((nullc hecker.isN ullish(sys tem) || sy stem === ' http://ehm p. DNS     /terminolo gy/1.0') & & conceptC odeRegex.t est(code))  {
  84                // FHIR  mapping se ts the cod e for all  VPR Health  Factors a s: '/conce pt/HF.' +  encodeURI( jdsItem.na me)
  85                // When  searching  for a code  with that  pattern w e know to  deconstruc t it and s earch for  name
  86                var name  = decodeU RI(code.ma tch(concep tCodeRegex )[1]);
  87                queries. push(jds.e q('name',  '\"' + nam e + '\"')) ;
  88           }
  89       });
  90       if (nu llchecker. isNotNulli sh(codeQue ry) && que ries.lengt h === 0) {
  91           //  No code/s ystem mapp ed to JDS  queries th at would y ield resul ts
  92           re turn null;
  93       }
  94       // com bine all t oken queri es into OR  expressio ns
  95       return  jds.or(qu eries);
  96   }
  97  
  98   function g etHealthFa ctors(conf ig, logger , pid, par ams, callb ack) {
  99       var ba sePath = ' /vpr/' + p id + '/fin d/factor/' ;
  100       var se archQuery  = buildSea rchQuery(p arams);
  101       if (se archQuery  === null)  {
  102           //  search qu ery would  not yield  any result s, short-c ircuit
  103           re turn callb ack(null,  {
  104                data: {
  105                    item s: [],
  106                    tota lItems: 0
  107                }
  108           }) ;
  109       }
  110       var jd sPath = fh irToJDSSea rch.buildJ DSPath(bas ePath, sea rchQuery,  params, fh irToJDSMap );
  111       var op tions = _. extend({},  config.jd sServer, {
  112           ur l: jdsPath ,
  113           lo gger: logg er,
  114           js on: true
  115       });
  116  
  117       rdk.ut ils.http.g et(options , function (error, re sponse, bo dy) {
  118           ca llback(err or, body);
  119       });
  120   }
  121  
  122   function c onvertToFH IRObservat ions(vprIt ems, req)  {
  123       return  _.map(vpr Items, fun ction(vprI tem) {
  124           re turn creat eHF(vprIte m);
  125       });
  126   }
  127  
  128   function c reateHF(jd sItem) {
  129       var fh irItem = { };
  130  
  131       fhirIt em.resourc e = {};
  132       fhirIt em.resourc e.resource Type = 'Ob servation' ;
  133       fhirIt em.resourc e.id = fhi rResource. fixId(jdsI tem.uid);
  134       fhirIt em.resourc e.text = {
  135           's tatus': 'g enerated',
  136           'd iv': '<div >' + jdsIt em.summary  + '</div> '
  137       };
  138       var or gUid = hel pers.gener ateUUID();
  139       fhirIt em.resourc e.containe d = [{
  140           'r esourceTyp e': 'Organ ization',
  141           'i d': orgUid ,
  142           'i dentifier' : [{
  143                'system' : 'urn:oid :2.16.840. 1.113883.6 .233',
  144                'value':  jdsItem.f acilityCod e
  145           }] ,
  146           'n ame': jdsI tem.facili tyName
  147       }];
  148  
  149       fhirIt em.resourc e.code = { };
  150       fhirIt em.resourc e.code.cod ing = [{
  151             'system':  'http://eh mp. DNS     /terminolo gy/1.0',
  152           'c ode': '/co ncept/' +  conceptCat egory + '. ' + encode URI(jdsIte m.name),
  153           'd isplay': j dsItem.nam e
  154       }];
  155  
  156       if (jd sItem.ente red !== un defined) {
  157           fh irItem.res ource.appl iesDateTim e = fhirUt ils.conver tToFhirDat eTime(jdsI tem.entere d, fhirUti ls.getSite Hash(jdsIt em.uid));
  158       }
  159  
  160       //     fhirItem.r esource.is sued  -->  SOURCE?
  161  
  162       fhirIt em.resourc e.status =  'final';
  163       fhirIt em.resourc e.reliabil ity = 'unk nown';
  164       fhirIt em.resourc e.identifi er = [{
  165           'u se': 'offi cial',
  166           // 'label': ' uid',
  167           's ystem': 'h ttp://vist acore.us/f hir/id/uid ',
  168           'v alue': jds Item.uid
  169       }];
  170  
  171       //Extr acting Pat ient dfn g iven uid o f pattern  = urn:va:< collection >:<site>:< dfn>:<ien>
  172       var sp litUid = j dsItem.uid .split(':' );
  173       if (sp litUid.len gth > 5) {
  174           fh irItem.res ource.subj ect = {
  175                'referen ce': 'Pati ent/' + sp litUid[4]
  176           };
  177       }
  178       fhirIt em.resourc e.performe r = [{
  179           'r eference':  orgUid,
  180           'd isplay': j dsItem.fac ilityName
  181       }];
  182       return  fhirItem;
  183   }
  184  
  185  
  186   module.exp orts.getHe althFactor s = getHea lthFactors ;
  187   module.exp orts.conve rtToFHIROb servations  = convert ToFHIRObse rvations;