Produced by Araxis Merge on 7/3/2018 11:43:46 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.
| # | Location | File | Last Modified |
|---|---|---|---|
| 1 | eHealth_v8.2.0_build_8.2.0.1.zip\NHIN_adapter\AdapterSubscriptionServiceTesterWEB\src\main\webapp\js | app.js | Tue Jun 26 18:12:59 2018 UTC |
| 2 | eHealth_v8.2.0_build_8.2.0.1.zip\NHIN_adapter\AdapterSubscriptionServiceTesterWEB\src\main\webapp\js | app.js | Sat Jun 30 13:06:08 2018 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 8 | 678 |
| Changed | 7 | 14 |
| Inserted | 0 | 0 |
| Removed | 0 | 0 |
| 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 |
No regular expressions were active.
| 1 | var app = angular.mo dule('subs criptionSe rviceTeste rApp', []) ; | |
| 2 | ||
| 3 | app.config (function () { | |
| 4 | ||
| 5 | }); | |
| 6 | ||
| 7 | app.contro ller('cont roller', function ( $scope, $h ttp, $time out, $filt er, $eleme nt) { | |
| 8 | ||
| 9 | $sco pe.sites = [ | |
| 10 | {id: "983" , name: "9 83/CHYSHR" }, | |
| 11 | {id: "984" , name: "9 84/DAYTSHR "} | |
| 12 | ]; | |
| 13 | $sco pe.patient s = [ | |
| 14 | {id: " 1012638924 V546709", name: "NWH INONE"} , | |
| 15 | {id: "10 12638925V2 04624", na me: "NWHIN TWO"} , | |
| 16 | {id: " 1012664072 V817050", name: "NWH INTHREE"} , | |
| 17 | {id: " 1012664114 V661390", name: "NWH INFOUR"} , | |
| 18 | {id: "10 12663918V3 62378", na me: "NWHIN FIVE"} , | |
| 19 | {id: "10 12581676V3 77802", na me: "CHDRO NE"} | |
| 20 | ]; | |
| 21 | $s cope.pous = [ | |
| 22 | {id: " TREATMENT" , type: "T reatment"} , | |
| 23 | {id: " COVERAGE", type: "Co verage"} | |
| 24 | ]; | |
| 25 | ||
| 26 | $s cope.proto cols = [ | |
| 27 | "http", | |
| 28 | "https" | |
| 29 | ]; | |
| 30 | ||
| 31 | $sco pe.site = {id:"defau lt",name:" Select Sit e"}; | |
| 32 | $s cope.patie nt = {id:" default",n ame:"Selec t Patient" }; | |
| 33 | $s cope.pou = {id:"defa ult",type: "Select Pu rpose of U se"}; | |
| 34 | ||
| 35 | $s cope.notif yUrlProtoc ol = "http "; | |
| 36 | $s cope.notif yHostName = "MOCK-HO ST"; | |
| 37 | $scope.not ifyPort = " PORT "; | |
| 38 | $s cope.notif yPath = "o n-notify"; | |
| 39 | ||
| 40 | $sco pe.setSite = functio n(site){ | |
| 41 | $scope .site=site ; | |
| 42 | $scope .validateS tart(); | |
| 43 | }; | |
| 44 | $sco pe.setPati ent = func tion(patie nt){ | |
| 45 | $scope .patient=p atient; | |
| 46 | $scope .validateS tart(); | |
| 47 | }; | |
| 48 | $s cope.setPo u = functi on(pou){ | |
| 49 | $scope .pou=pou; | |
| 50 | $scope .validateS tart(); | |
| 51 | }; | |
| 52 | $s cope.setPr otocol = f unction(pr oto) { | |
| 53 | $scope.n otifyUrlPr otocol = p roto; | |
| 54 | $scope.v alidateSta rt(); | |
| 55 | } | |
| 56 | ||
| 57 | $sco pe.validat eStart = f unction(){ | |
| 58 | if($sc ope.site.i d != "defa ult" && $s cope.patie nt.id != " default" & & $scope.p ou.id != " default"){ | |
| 59 | $("#subs cribeButto n").remove Class('dis abled'); | |
| 60 | } | |
| 61 | }; | |
| 62 | ||
| 63 | $sco pe.subscri be = funct ion () { | |
| 64 | ||
| 65 | if( $( "#subscrib eButton"). hasClass(' disabled') ) { | |
| 66 | return ; | |
| 67 | } | |
| 68 | ||
| 69 | $scope.d ocumentRef erences = []; | |
| 70 | $scope.n hioStatuse s = []; | |
| 71 | $scope.s ubscriptio nID = null ; | |
| 72 | $scope.s ubscriptio nStatus = null; | |
| 73 | $scope.l astModifie d = null; | |
| 74 | $scope.E Tag = null ; | |
| 75 | var req = { | |
| 76 | reso urceType: "Subscript ion", | |
| 77 | // f rom Resour ce: id, me ta, implic itRules, a nd languag e | |
| 78 | // f rom Domain Resource: text, cont ained, ext ension, an d modifier Extension | |
| 79 | stat us: "reque sted", // R! reques ted | acti ve | error | off | |
| 80 | cont act: [], / / Contact details fo r source ( e.g. troub leshooting ) | |
| 81 | end: null, // When to au tomaticall y delete t he subscri ption | |
| 82 | reas on: "Prefe tch", // R ! Descrip tion of wh y this sub scription was create d | |
| 83 | crit eria: "Doc umentRefer ence?patie nt=Patient /" + $scop e.patient. id, // R! Rule for server pus h criteria | |
| 84 | erro r: "<strin g>", // La test error note | |
| 85 | chan nel: {// R ! The cha nnel on wh ich to rep ort matche s to the c riteria | |
| 86 | type: $sco pe.useWebS ocket ? "w ebsocket" : "rest-ho ok", // R! rest-hoo k | websoc ket | emai l | sms | message | |
| 87 | endpoint: !$scope.us eWebSocket ? $scope. notifyUrlP rotocol+": //"+$scope .notifyHos tName+":"+ $scope.not ifyPort+"/ "+$scope.n otifyPath : null, // Where the channel p oints to | |
| 88 | payload: n ull, // Mi metype to send, or o mit for no payload | |
| 89 | header: !$ scope.useW ebSocket ? ["X-Trans actionID: DAS-098765 4321"] : n ull // Usa ge depends on the ch annel type | |
| 90 | }, | |
| 91 | exte nsion: [{ | |
| 92 | url: "http :// URL /Structure Definition /EHXSubscr iption/ann ouncePatie nt", | |
| 93 | valueB oolean: $s cope.annou nce | |
| 94 | }, { | |
| 95 | url: "http :// URL /Structure Definition /EHXSubscr iption/aut oDocRetrie ve", | |
| 96 | valueB oolean: $s cope.autoD R | |
| 97 | }, { | |
| 98 | url: "http :// URL /Structure Definition /EHXSubscr iption/ass ertions", | |
| 99 | extens ion: [{ | |
| 100 | url: "us erID", | |
| 101 | valueStr ing: $scop e.site.id + ":user12 3" | |
| 102 | }, { | |
| 103 | url: "us erName", | |
| 104 | valueStr ing: "User 1-2-3" | |
| 105 | }, { | |
| 106 | url: "sy stemID", | |
| 107 | valueStr ing: "JLV" | |
| 108 | }, { | |
| 109 | url: "or ganization ID", | |
| 110 | valueStr ing: "2.16 .840.1.113 883.4.349. 983" | |
| 111 | }, { | |
| 112 | url: "or ganization Name", | |
| 113 | valueStr ing: "Depa rtment of Veterans A ffairs - C HYSHR" | |
| 114 | }, { | |
| 115 | url: "pu rposeOfUse ", | |
| 116 | valueStr ing: $scop e.pou.id | |
| 117 | }, { | |
| 118 | url: "ro le", | |
| 119 | valueStr ing: "1122 47003" | |
| 120 | }] | |
| 121 | }] | |
| 122 | }; | |
| 123 | ||
| 124 | $scope.s ubscriptio nTime = $f ilter('dat e')(new Da te(), 'yyy y-MM-ddTHH :mm:ss', ' UTC') + 'Z '; | |
| 125 | ||
| 126 | //$eleme nt.trigger ('startSub scriptionE vent'); | |
| 127 | ||
| 128 | $http.po st('/Adapt erSubscrip tionServic e/FHIR/Sub scription' , JSON.str ingify(req )).then(fu nction (re sponse) { | |
| 129 | $sco pe.subscri ptionLocat ion = resp onse.heade rs('Locati on').repla ce(/^http[ s]?:/i, '' ); | |
| 130 | ||
| 131 | if ( $scope.use WebSocket) { | |
| 132 | $scope.set upWebSocke t(); | |
| 133 | } | |
| 134 | ||
| 135 | $sco pe.monitor Subscripti on(); | |
| 136 | }); | |
| 137 | }; | |
| 138 | $s cope.getSu bscription StatusClas s = functi on() { | |
| 139 | ||
| 140 | }; | |
| 141 | $s cope.getNh ioStatusCl ass = func tion(nhioS tatus) { | |
| 142 | if(typeo f nhioStat us.stage = = "string" && nhioSt atus.stage .indexOf(" SUCCESS") > -1) { | |
| 143 | retu rn "succes s"; | |
| 144 | } | |
| 145 | if(typeo f nhioStat us.stage = = "string" && nhioSt atus.stage .indexOf(" FAILURE") > -1) { | |
| 146 | retu rn "danger "; | |
| 147 | } | |
| 148 | return " info"; | |
| 149 | }; | |
| 150 | $s cope.findN HIOStatus = function (hcid) { | |
| 151 | for(var i in $scop e.nhioStat uses) { | |
| 152 | if(t ypeof hcid == "strin g" && hcid == $scope .nhioStatu ses[i].hci d) { | |
| 153 | return $sc ope.nhioSt atuses[i]; | |
| 154 | } | |
| 155 | } | |
| 156 | var o = {errors:"E rrors:",do cumentRefe rences:[], hcid:hcid} ; | |
| 157 | $scope.n hioStatuse s.push(o); | |
| 158 | return o ; | |
| 159 | }; | |
| 160 | $s cope.findD ocRefFromH CID = func tion(hcid, entry) { | |
| 161 | var o = $scope.fin dNHIOStatu s(hcid); | |
| 162 | for(var i in o.doc umentRefer ences) { | |
| 163 | if( | |
| 164 | typeof o.d ocumentRef erences[i] .entry == "object" | |
| 165 | && typeof o.document References [i].entry. id == "str ing" | |
| 166 | && typeof entry == " object" | |
| 167 | && typeof entry.id = = "string" | |
| 168 | && o.docum entReferen ces[i].ent ry.id == e ntry.id | |
| 169 | ) { | |
| 170 | return o.d ocumentRef erences[i] ; | |
| 171 | } | |
| 172 | } | |
| 173 | var d = {}; | |
| 174 | o.docume ntReferenc es.push(d) ; | |
| 175 | return d ; | |
| 176 | }; | |
| 177 | $s cope.monit orSubscrip tion = fun ction () { | |
| 178 | var conf ig = null; | |
| 179 | if ($sco pe.ETag != = null) { | |
| 180 | conf ig = {head ers: {'If- None-Match ': $scope. ETag}}; | |
| 181 | } | |
| 182 | $http.ge t($scope.s ubscriptio nLocation, config).t hen(functi on (respon se) { | |
| 183 | $sco pe.ETag = response.h eaders('ET ag'); | |
| 184 | $sco pe.lastMod ified = re sponse.hea ders('Last -Modified' ); | |
| 185 | var subscripti on = respo nse.data; | |
| 186 | var nhioStatus es = []; | |
| 187 | for (var i in subscripti on.extensi on) { | |
| 188 | var ext = subscripti on.extensi on[i]; | |
| 189 | if (ext.ur l === 'htt p:// URL /Structure Definition /EHXSubscr iption/nhi oStatus') { | |
| 190 | var nh ioStatus = ext.exten sion; | |
| 191 | var o = {errors: "Errors:"} ; | |
| 192 | for (v ar j in nh ioStatus) { | |
| 193 | va r field = nhioStatus [j]; | |
| 194 | sw itch (fiel d.url) { | |
| 195 | case 'hc id': | |
| 196 | o.hc id = field .valueStri ng.replace ("urn:oid: ", ""); | |
| 197 | brea k; | |
| 198 | ||
| 199 | case 'st atus': | |
| 200 | o.st atus = fie ld.valueCo de; | |
| 201 | brea k; | |
| 202 | ||
| 203 | case 'ty pe': | |
| 204 | o.st age = fiel d.valueCod e; | |
| 205 | brea k; | |
| 206 | ||
| 207 | case 'er ror': | |
| 208 | o.er rors += (' \n' + fiel d.valueStr ing); | |
| 209 | brea k; | |
| 210 | ||
| 211 | default: | |
| 212 | brea k; | |
| 213 | } | |
| 214 | } | |
| 215 | var n = $scope.f indNHIOSta tus(o.hcid ); | |
| 216 | n.clas sName = $s cope.getNh ioStatusCl ass(o); | |
| 217 | n.hcid = o.hcid; | |
| 218 | n.stat us = o.sta tus; | |
| 219 | n.stag e = o.stag e; | |
| 220 | n.erro rs = o.err ors; | |
| 221 | // add more stuf f here if necessary (like line classes) | |
| 222 | //nhio Statuses.p ush(o); | |
| 223 | } | |
| 224 | } | |
| 225 | $sco pe.subscri ptionStatu s = subscr iption.sta tus; | |
| 226 | //$s cope.nhioS tatuses = nhioStatus es; | |
| 227 | $sco pe.subscri ptionID = subscripti on.id; | |
| 228 | $sco pe.subStat usClass = $scope.get Subscripti onStatusCl ass(); | |
| 229 | ||
| 230 | //$e lement.tri gger('upda teStatusEv ent', | |
| 231 | // {"eta g":$scope. ETag,"last Mod":$scop e.lastModi fied, | |
| 232 | // " subStatus" :$scope.su bscription Status, "s ubId":$sco pe.subscri ptionID}); | |
| 233 | ||
| 234 | $sco pe.refresh Documents( ); | |
| 235 | ||
| 236 | if ( !$scope.us eWebSocket ) { | |
| 237 | if (subscr iption.sta tus !== 'o ff' && sub scription. status !== 'error') { | |
| 238 | $timeo ut($scope. monitorSub scription, 500); | |
| 239 | } | |
| 240 | } el se { | |
| 241 | if (subscr iption.sta tus === 'o ff' || sub scription. status === 'error') { | |
| 242 | if($scope. cleanupUI) { | |
| 243 | $s cope.clean upUI=false ; | |
| 244 | // TODO: remo ve or not? $timeout( $scope.mon itorSubscr iptionMock , 500); | |
| 245 | } | |
| 246 | $scope .tearDownW ebSocket() ; | |
| 247 | } | |
| 248 | } | |
| 249 | }, funct ion (respo nse) { | |
| 250 | if ( !$scope.us eWebSocket ) { | |
| 251 | if (respon se.status === 304) { | |
| 252 | $timeo ut($scope. monitorSub scription, 500); | |
| 253 | } | |
| 254 | } el se { | |
| 255 | if (respon se.status !== 304) { | |
| 256 | if($scope. cleanupUI) { | |
| 257 | $s cope.clean upUI=false ; | |
| 258 | // TODO: remo ve or not? $timeout( $scope.mon itorSubscr iptionMock , 500); | |
| 259 | } | |
| 260 | $scope .tearDownW ebSocket() ; | |
| 261 | } | |
| 262 | } | |
| 263 | }); | |
| 264 | }; | |
| 265 | $s cope.docsR efreshing = false; | |
| 266 | $s cope.refre shDocument s = functi on () { | |
| 267 | if($scop e.docsRefr eshing) { console.lo g("We're a lready pul ling docum ents, let' s just wai t for thos e..."); re turn; } | |
| 268 | $scope.d ocsRefresh ing = true ; | |
| 269 | $http.ge t('/Adapte rSubscript ionService /FHIR/Docu mentRefere nce?patien t=Patient/ ' + $scope .patient.i d + '&_las tUpdated=> =' + $scop e.subscrip tionTime). then(funct ion (respo nse) { | |
| 270 | var bundle = r esponse.da ta; | |
| 271 | var documentRe ferences = []; | |
| 272 | for (var i in bundle.ent ry) { | |
| 273 | var entry = bundle.e ntry[i].re source; | |
| 274 | var hcid = ""; | |
| 275 | var docume ntRetrieve d = false; | |
| 276 | for (var j in entry. extension) { | |
| 277 | var ex t = entry. extension[ j]; | |
| 278 | if (ext.ur l === "htt p:// URL /Structure Definition /EHXDocume nteReferen ce/homeCom munityId") { | |
| 279 | hc id = ext.v alueString .replace(" urn:oid:", ""); | |
| 280 | } | |
| 281 | else if (e xt.url === "http:// URL /Structure Definition /EHXDocume nteReferen ce/documen tRetrieved ") { | |
| 282 | do cumentRetr ieved = ex t.valueBoo lean; | |
| 283 | } | |
| 284 | } | |
| 285 | var o = $s cope.findD ocRefFromH CID(hcid, entry); | |
| 286 | o.hcid = h cid; | |
| 287 | o.entry = entry; | |
| 288 | o.document Retrieved = document Retrieved; | |
| 289 | documentRe ferences.p ush(o); | |
| 290 | $scope.pul lDocument( o, entry.c ontent[0]. attachment .url); | |
| 291 | } | |
| 292 | $sco pe.documen tReference s = docume ntReferenc es; | |
| 293 | $sco pe.docsRef reshing = false; | |
| 294 | }); | |
| 295 | }; | |
| 296 | $s cope.pullD ocument = function(d ocumentObj ect, url) { | |
| 297 | if($scop e.autoDown load && ty peof docum entObject. pulledDocu ment !== " object") { | |
| 298 | $htt p.get("/Ad apterSubsc riptionSer vice/FHIR/ "+url).the n(function (res) { | |
| 299 | documentOb ject.pulle dDocument = res; | |
| 300 | console.lo g(res); | |
| 301 | $scope.ref reshDocume nts(); | |
| 302 | }); | |
| 303 | } | |
| 304 | }; | |
| 305 | $s cope.setup WebSocket = function () { | |
| 306 | var prot = window. location.p rotocol == = 'https:' ? 'wss' : 'ws'; | |
| 307 | var ws = $scope.ws = new Web Socket(pro t + '://' + window.l ocation.ho stname + ' :' + windo w.location .port + '/ AdapterSub scriptionS ervice/Sub scriptionW S'); | |
| 308 | ||
| 309 | ws.onope n = functi on () { | |
| 310 | ws.s end('bind ' + $scope .subscript ionLocatio n.substr($ scope.subs criptionLo cation.las tIndexOf(' /') + 1)); | |
| 311 | }; | |
| 312 | ||
| 313 | ws.onerr or = funct ion () { | |
| 314 | cons ole.log('A n error ha ppened'); | |
| 315 | }; | |
| 316 | ||
| 317 | ws.onmes sage = fun ction (mes sage) { | |
| 318 | cons ole.log(me ssage.data ); | |
| 319 | var data = "" + message. data; | |
| 320 | if ( data.index Of('ping') === 0) { | |
| 321 | ws.send('p ong ' + $s cope.subsc riptionLoc ation.subs tr($scope. subscripti onLocation .lastIndex Of('/') + 1)); | |
| 322 | $scope.mon itorSubscr iption(); | |
| 323 | } | |
| 324 | else if (data. indexOf('u nbound') = == 0) { | |
| 325 | ws.close() ; | |
| 326 | } | |
| 327 | }; | |
| 328 | ||
| 329 | ws.onclo se = funct ion () { | |
| 330 | cons ole.log('W ebSocket c losed'); | |
| 331 | if ( $scope.sub scriptionS tatus !== 'off') { | |
| 332 | $scope.mon itorSubscr iption(); | |
| 333 | console.lo g(' Re-co nnecting.' ); | |
| 334 | $timeout($ scope.setu pWebSocket , 500); | |
| 335 | } | |
| 336 | }; | |
| 337 | }; | |
| 338 | ||
| 339 | $s cope.tearD ownWebSock et = funct ion() { | |
| 340 | $scope.w s.send('un bind ' + $ scope.subs criptionLo cation.sub str($scope .subscript ionLocatio n.lastInde xOf('/') + 1)); | |
| 341 | }; | |
| 342 | ||
| 343 | $s cope.alert = functio n(msg) { | |
| 344 | alert(ms g); | |
| 345 | }; | |
| 346 | }); |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.