Produced by Araxis Merge on 3/1/2018 12:13:17 PM Central Standard 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_xchange_cif.zip\NHIN_adapter\AdapterSubscriptionServiceTesterWEB\src\main\webapp\js | app.js | Thu Feb 22 14:18:54 2018 UTC |
| 2 | ehealth_xchange_cif.zip\NHIN_adapter\AdapterSubscriptionServiceTesterWEB\src\main\webapp\js | app.js | Wed Feb 28 18:10:51 2018 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 7 | 382 |
| Changed | 6 | 12 |
| 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', [ '$scope', '$http', ' $timeout', '$filter' , function ($scope, $http, $ti meout, $fi lter) { | |
| 8 | $s cope.subsc ribe = fun ction () { | |
| 9 | $scope.d ocumentRef erences = null; | |
| 10 | $scope.n hioStatuse s = null; | |
| 11 | $scope.s ubscriptio nID = null ; | |
| 12 | $scope.s ubscriptio nStatus = null; | |
| 13 | $scope.l astModifie d = null; | |
| 14 | $scope.E Tag = null ; | |
| 15 | var req = { | |
| 16 | reso urceType: "Subscript ion", | |
| 17 | // f rom Resour ce: id, me ta, implic itRules, a nd languag e | |
| 18 | // f rom Domain Resource: text, cont ained, ext ension, an d modifier Extension | |
| 19 | stat us: "reque sted", // R! reques ted | acti ve | error | off | |
| 20 | cont act: [], / / Contact details fo r source ( e.g. troub leshooting ) | |
| 21 | end: null, // When to au tomaticall y delete t he subscri ption | |
| 22 | reas on: "Prefe tch", // R ! Descrip tion of wh y this sub scription was create d | |
| 23 | crit eria: "Doc umentRefer ence?patie nt=Patient /" + $scop e.patientI D, // R! Rule for s erver push criteria | |
| 24 | erro r: "<strin g>", // La test error note | |
| 25 | chan nel: {// R ! The cha nnel on wh ich to rep ort matche s to the c riteria | |
| 26 | type: $sco pe.useWebS ocket ? "w ebsocket" : "rest-ho ok", // R! rest-hoo k | websoc ket | emai l | sms | message | |
| 27 | endpoint: !$scope.us eWebSocket ? "http:/ /MOCK-HOST :8090/on-n otify" : n ull, // Wh ere the ch annel poin ts to | |
| 28 | payload: n ull, // Mi metype to send, or o mit for no payload | |
| 29 | header: !$ scope.useW ebSocket ? ["X-Trans actionID: DAS-098765 4321"] : n ull // Usa ge depends on the ch annel type | |
| 30 | }, | |
| 31 | exte nsion: [{ | |
| 32 | url: "http ://ehx. DNS /Structure Definition /EHXSubscr iption/ann ouncePatie nt", | |
| 33 | valueB oolean: $s cope.annou nce | |
| 34 | }, { | |
| 35 | url: "http ://ehx. DNS /Structure Definition /EHXSubscr iption/aut oDocRetrie ve", | |
| 36 | valueB oolean: $s cope.autoD R | |
| 37 | }, { | |
| 38 | url: "http ://ehx. DNS /Structure Definition /EHXSubscr iption/ass ertions", | |
| 39 | extens ion: [{ | |
| 40 | url: "us erID", | |
| 41 | valueStrin g: " REDACTED " | |
| 42 | }, { | |
| 43 | url: "us erName", | |
| 44 | valueStr ing: "User 1-2-3" | |
| 45 | }, { | |
| 46 | url: "sy stemID", | |
| 47 | valueStr ing: "JLV" | |
| 48 | }, { | |
| 49 | url: "or ganization ID", | |
| 50 | valueStr ing: "2.16 .840.1.113 883.4.349. 983" | |
| 51 | }, { | |
| 52 | url: "or ganization Name", | |
| 53 | valueStr ing: "Depa rtment of Veterans A ffairs - C HYSHR" | |
| 54 | }, { | |
| 55 | url: "pu rposeOfUse ", | |
| 56 | valueStr ing: "TREA TMENT" | |
| 57 | }, { | |
| 58 | url: "ro le", | |
| 59 | valueStr ing: "1122 47003" | |
| 60 | }] | |
| 61 | }] | |
| 62 | }; | |
| 63 | ||
| 64 | $scope.s ubscriptio nTime = $f ilter('dat e')(new Da te(), 'yyy y-MM-ddTHH :mm:ss', ' UTC') + 'Z '; | |
| 65 | ||
| 66 | $http.po st('/Adapt erSubscrip tionServic e/FHIR/Sub scription' , JSON.str ingify(req )).then(fu nction (re sponse) { | |
| 67 | $sco pe.subscri ptionLocat ion = resp onse.heade rs('Locati on'); | |
| 68 | ||
| 69 | if ( $scope.use WebSocket) { | |
| 70 | $scope.set upWebSocke t(); | |
| 71 | } | |
| 72 | ||
| 73 | $sco pe.monitor Subscripti on(); | |
| 74 | }); | |
| 75 | }; | |
| 76 | ||
| 77 | $s cope.monit orSubscrip tion = fun ction () { | |
| 78 | var conf ig = null; | |
| 79 | if ($sco pe.ETag != = null) { | |
| 80 | conf ig = {head ers: {'If- None-Match ': $scope. ETag}}; | |
| 81 | } | |
| 82 | $http.ge t($scope.s ubscriptio nLocation, config).t hen(functi on (respon se) { | |
| 83 | $sco pe.ETag = response.h eaders('ET ag'); | |
| 84 | $sco pe.lastMod ified = re sponse.hea ders('Last -Modified' ); | |
| 85 | var subscripti on = respo nse.data; | |
| 86 | var nhioStatus es = []; | |
| 87 | for (var i in subscripti on.extensi on) { | |
| 88 | var ext = subscripti on.extensi on[i]; | |
| 89 | if (ext.ur l === 'htt p://ehx. DNS /Structure Definition /EHXSubscr iption/nhi oStatus') { | |
| 90 | var nh ioStatus = ext.exten sion; | |
| 91 | var o = {}; | |
| 92 | for (v ar j in nh ioStatus) { | |
| 93 | va r field = nhioStatus [j]; | |
| 94 | sw itch (fiel d.url) { | |
| 95 | case 'hc id': | |
| 96 | o.hc id = field .valueStri ng; | |
| 97 | brea k; | |
| 98 | ||
| 99 | case 'st atus': | |
| 100 | o.st atus = fie ld.valueCo de; | |
| 101 | brea k; | |
| 102 | ||
| 103 | case 'ty pe': | |
| 104 | o.st age = fiel d.valueCod e; | |
| 105 | brea k; | |
| 106 | ||
| 107 | default: | |
| 108 | brea k; | |
| 109 | } | |
| 110 | } | |
| 111 | nhioSt atuses.pus h(o); | |
| 112 | } | |
| 113 | } | |
| 114 | $sco pe.subscri ptionStatu s = subscr iption.sta tus; | |
| 115 | $sco pe.nhioSta tuses = nh ioStatuses ; | |
| 116 | $sco pe.subscri ptionID = subscripti on.id; | |
| 117 | ||
| 118 | $htt p.get('/Ad apterSubsc riptionSer vice/FHIR/ DocumentRe ference?pa tient=Pati ent/' + $s cope.patie ntID + '&_ lastUpdate d=>=' + $s cope.subsc riptionTim e).then(fu nction (re sponse) { | |
| 119 | var bundle = respons e.data; | |
| 120 | var docume ntReferenc es = []; | |
| 121 | for (var i in bundle .entry) { | |
| 122 | var en try = bund le.entry[i ].resource ; | |
| 123 | var hc id = ""; | |
| 124 | for (v ar j in en try.extens ion) { | |
| 125 | va r ext = en try.extens ion[j]; | |
| 126 | if (ext.ur l === "htt p://ehx. DNS /Structure Definition /EHXDocume nteReferen ce/homeCom munityId") { | |
| 127 | hcid = e xt.valueSt ring; | |
| 128 | break; | |
| 129 | } | |
| 130 | } | |
| 131 | docume ntReferenc es.push({ | |
| 132 | hc id: hcid, | |
| 133 | en try: entry | |
| 134 | }); | |
| 135 | } | |
| 136 | $scope.doc umentRefer ences = do cumentRefe rences; | |
| 137 | }); | |
| 138 | ||
| 139 | if ( !$scope.us eWebSocket ) { | |
| 140 | if (subscr iption.sta tus !== 'o ff') { | |
| 141 | $timeo ut($scope. monitorSub scription, 1000); | |
| 142 | } | |
| 143 | } el se { | |
| 144 | if (subscr iption.sta tus === 'o ff') { | |
| 145 | $scope .tearDownW ebSocket() ; | |
| 146 | } | |
| 147 | } | |
| 148 | }, funct ion (respo nse) { | |
| 149 | if ( !$scope.us eWebSocket ) { | |
| 150 | if (respon se.status === 304) { | |
| 151 | $timeo ut($scope. monitorSub scription, 1000); | |
| 152 | } | |
| 153 | } el se { | |
| 154 | if (respon se.status !== 304) { | |
| 155 | $scope .tearDownW ebSocket() ; | |
| 156 | } | |
| 157 | } | |
| 158 | }); | |
| 159 | }; | |
| 160 | ||
| 161 | $s cope.setup WebSocket = function () { | |
| 162 | var prot = window. location.p rotocol == = 'https:' ? 'wss' : 'ws'; | |
| 163 | var ws = $scope.ws = new Web Socket(pro t + '://' + window.l ocation.ho stname + ' :' + windo w.location .port + '/ AdapterSub scriptionS ervice/Sub scriptionW S'); | |
| 164 | ||
| 165 | ws.onope n = functi on () { | |
| 166 | ws.s end('bind ' + $scope .subscript ionLocatio n.substr($ scope.subs criptionLo cation.las tIndexOf(' /') + 1)); | |
| 167 | }; | |
| 168 | ||
| 169 | ws.onerr or = funct ion () { | |
| 170 | cons ole.log('A n error ha ppened'); | |
| 171 | }; | |
| 172 | ||
| 173 | ws.onmes sage = fun ction (mes sage) { | |
| 174 | cons ole.log(me ssage.data ); | |
| 175 | var data = "" + message. data; | |
| 176 | if ( data.index Of('ping') === 0) { | |
| 177 | $scope.mon itorSubscr iption(); | |
| 178 | } | |
| 179 | else if (data. indexOf('u nbound') = == 0) { | |
| 180 | ws.close() ; | |
| 181 | } | |
| 182 | }; | |
| 183 | ||
| 184 | ws.onclo se = funct ion () { | |
| 185 | cons ole.log('W ebSocket c losed'); | |
| 186 | if ( $scope.sub scriptionS tatus !== 'off') { | |
| 187 | $scope.mon itorSubscr iption(); | |
| 188 | console.lo g(' Re-co nnecting.' ); | |
| 189 | $timeout($ scope.setu pWebSocket , 500); | |
| 190 | } | |
| 191 | }; | |
| 192 | }; | |
| 193 | ||
| 194 | $s cope.tearD ownWebSock et = funct ion() { | |
| 195 | $scope.w s.send('un bind ' + $ scope.subs criptionLo cation.sub str($scope .subscript ionLocatio n.lastInde xOf('/') + 1)); | |
| 196 | }; | |
| 197 | }]); |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.