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.
| # | Location | File | Last Modified |
|---|---|---|---|
| 1 | rdk.zip\rdk\product\production\rdk\src\fhir\educations | educations-resource.js | Mon Aug 21 12:51:00 2017 UTC |
| 2 | rdk.zip\rdk\product\production\rdk\src\fhir\educations | educations-resource.js | Tue Oct 3 17:15:16 2017 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 2 | 500 |
| Changed | 1 | 2 |
| 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 | '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 errors = require ('../commo n/errors.j s'); | |
| 6 | var helper s = requir e('../comm on/utils/h elpers.js' ); | |
| 7 | var fhirUt ils = requ ire('../co mmon/utils /fhir-conv erter'); | |
| 8 | var fhirRe source = r equire('.. /common/en tities/fhi r-resource '); | |
| 9 | ||
| 10 | ||
| 11 | var concep tCategory = 'ED'; | |
| 12 | ||
| 13 | var getRes ourceConfi g = functi on() { | |
| 14 | return [{ | |
| 15 | na me: 'fhir- educations ', | |
| 16 | pa th: '', | |
| 17 | ge t: getEduc ations, | |
| 18 | su bsystems: ['patientr ecord', 'j ds', 'auth orization' ], | |
| 19 | re quiredPerm issions: [ ], | |
| 20 | is PatientCen tric: true , | |
| 21 | pe rmitRespon seFormat: true | |
| 22 | }]; | |
| 23 | }; | |
| 24 | ||
| 25 | function g etEducatio ns(req, re s) { | |
| 26 | ||
| 27 | var pi d = req.qu ery['subje ct.identif ier']; | |
| 28 | if (nu llchecker. isNullish( pid)) { | |
| 29 | re turn res.s tatus(rdk. httpstatus .bad_reque st).send(' Missing su bject.iden tifier par ameter'); | |
| 30 | } | |
| 31 | req._p id = pid; | |
| 32 | getDat a(req, pid , function (err, inpu tJSON) { | |
| 33 | if (err inst anceof err ors.FetchE rror) { | |
| 34 | req.logg er.error(e rr.message ); | |
| 35 | res.stat us(rdk.htt pstatus.in ternal_ser ver_error) .send('The re was an error proc essing you r request. The error has been logged.'); | |
| 36 | } else if (e rr instanc eof errors .NotFoundE rror) { | |
| 37 | res.stat us(rdk.htt pstatus.no t_found).s end(err.er ror); | |
| 38 | } else if (e rr) { | |
| 39 | res.stat us(rdk.htt pstatus.in ternal_ser ver_error) .send(err. message); | |
| 40 | } else { | |
| 41 | ||
| 42 | var outJ SON = {}; | |
| 43 | outJSON = convertT oFhir(inpu tJSON.data .items, re q); | |
| 44 | ||
| 45 | res.stat us(200).se nd(buildBu ndle(outJS ON, req, i nputJSON.d ata.totalI tems)); | |
| 46 | } | |
| 47 | }); | |
| 48 | ||
| 49 | } | |
| 50 | ||
| 51 | function g etData(req , pid, cal lback) { | |
| 52 | ||
| 53 | var co nfig = req .app.confi g; | |
| 54 | var jd sPath = '/ vpr/' + pi d + '/find /education /'; | |
| 55 | var op tions = _. extend({}, config.jd sServer, { | |
| 56 | ur l: jdsPath , | |
| 57 | lo gger: req. logger, | |
| 58 | js on: true | |
| 59 | }); | |
| 60 | ||
| 61 | rdk.ut ils.http.g et(options , function (error, re sponse, ob j) { | |
| 62 | re q.logger.d ebug('call back from fetch()'); | |
| 63 | if (error) { | |
| 64 | callback (new error s.FetchErr or('Error fetching p id=' + pid + ' - ' + (error.me ssage || e rror), err or)); | |
| 65 | } else { | |
| 66 | if ('dat a' in obj) { | |
| 67 | retu rn callbac k(null, ob j); | |
| 68 | } else i f ('error' in obj) { | |
| 69 | if ( errors.isN otFound(ob j)) { | |
| 70 | return cal lback(new errors.Not FoundError ('Object n ot found', obj)); | |
| 71 | } | |
| 72 | } | |
| 73 | ||
| 74 | return c allback(ne w Error('T here was a n error pr ocessing y our reques t. The err or has bee n logged.' )); | |
| 75 | } | |
| 76 | }); | |
| 77 | } | |
| 78 | ||
| 79 | function b uildBundle (results, req, total ) { | |
| 80 | var li nk; | |
| 81 | var en try = []; | |
| 82 | ||
| 83 | if (re q) { | |
| 84 | li nk = [new fhirResour ce.Link(re q.protocol + '://' + req.heade rs.host + req.origin alUrl, 'se lf')]; | |
| 85 | } | |
| 86 | for (v ar i = 0; i < result s.length; i++) { | |
| 87 | en try.push(n ew fhirRes ource.Entr y(results[ i])); | |
| 88 | } | |
| 89 | return (new fhir Resource.B undle(link , entry, t otal)); | |
| 90 | } | |
| 91 | ||
| 92 | function c onvertToFh ir(items, req) { | |
| 93 | var fh irItems = []; | |
| 94 | for (v ar i = 0; i < items. length; i+ +) { | |
| 95 | fh irItems.pu sh(createI tem(items[ i], req._p id)); | |
| 96 | } | |
| 97 | return fhirItems ; | |
| 98 | } | |
| 99 | ||
| 100 | /** | |
| 101 | * | |
| 102 | * @param jdsItem | |
| 103 | * @param fhirItems | |
| 104 | * @param host | |
| 105 | * @param updated | |
| 106 | */ | |
| 107 | function c reateItem( jdsItem, p id) { | |
| 108 | var fh irItem = { }; | |
| 109 | ||
| 110 | fhirIt em.resourc e = {}; | |
| 111 | fhirIt em.resourc e.resource Type = 'Pr ocedure'; | |
| 112 | ||
| 113 | if (jd sItem.summ ary) { | |
| 114 | fh irItem.res ource.text = { | |
| 115 | 'status' : 'generat ed', | |
| 116 | 'div': ' <div>' + _ .escape(jd sItem.summ ary) + '</ div>' | |
| 117 | }; | |
| 118 | } | |
| 119 | ||
| 120 | var or gUid = hel pers.gener ateUUID(); | |
| 121 | fhirIt em.resourc e.containe d = [{ | |
| 122 | 'r esourceTyp e': 'Organ ization', | |
| 123 | '_ id': orgUi d, | |
| 124 | 'i dentifier' : [{ | |
| 125 | //'label ': 'facili ty-code', | |
| 126 | 'system' : 'urn:oid :2.16.840. 1.113883.6 .233', | |
| 127 | 'value': jdsItem.f acilityCod e | |
| 128 | }] , | |
| 129 | 'n ame': jdsI tem.facili tyName | |
| 130 | }]; | |
| 131 | ||
| 132 | //---- ---------- ---------- ---------- ---------- ---------- ---------- ----- | |
| 133 | // "identifie r" | |
| 134 | fhirIt em.resourc e.identifi er = [{ | |
| 135 | 'u se': 'offi cial', | |
| 136 | // 'label': ' uid', | |
| 137 | 's ystem': 'h ttp://vist acore.us/f hir/id/uid ', | |
| 138 | 'v alue': jds Item.uid | |
| 139 | }]; | |
| 140 | ||
| 141 | //---- ---------- ---------- ---------- ---------- ---------- ---------- ----- | |
| 142 | // "patient" | |
| 143 | // var splitU id = jdsIt em.uid.spl it(':'); | |
| 144 | // if (splitU id.length > 5) { | |
| 145 | // fhirIt em.resourc e.patient = { | |
| 146 | // 'r eference': 'Patient/ ' + splitU id[4] | |
| 147 | // }; | |
| 148 | // } | |
| 149 | fhirIt em.resourc e.patient = { | |
| 150 | 'r eference': 'Patient/ ' + pid | |
| 151 | }; | |
| 152 | ||
| 153 | //---- ---------- ---------- ---------- ---------- ---------- ---------- ----- | |
| 154 | // "status" | |
| 155 | fhirIt em.resourc e.status = 'complete d'; | |
| 156 | ||
| 157 | //---- ---------- ---------- ---------- ---------- ---------- ---------- ----- | |
| 158 | // "category" | |
| 159 | ||
| 160 | //---- ---------- ---------- ---------- ---------- ---------- ---------- ----- | |
| 161 | // "type" | |
| 162 | fhirIt em.resourc e.type = { }; | |
| 163 | fhirIt em.resourc e.type.cod ing = [{ | |
| 164 | 'system': 'http://eh mp. DNS /terminolo gy/1.0', | |
| 165 | 'c ode': '/co ncept/' + conceptCat egory + '. ' + encode URI(jdsIte m.name), | |
| 166 | 'd isplay': j dsItem.nam e | |
| 167 | }]; | |
| 168 | ||
| 169 | //---- ---------- ---------- ---------- ---------- ---------- ---------- ----- | |
| 170 | // "bodySite" : [{ // P recise loc ation deta ils | |
| 171 | // // site[ x]: Precis e location details. One of the se 2: | |
| 172 | // "siteCod eableConce pt" : { Co deableConc ept } | |
| 173 | // "siteRef erence" : { Referenc e(BodySite ) } | |
| 174 | // }], | |
| 175 | ||
| 176 | //---- ---------- ---------- ---------- ---------- ---------- ---------- ----- | |
| 177 | // "indicatio n" : [{ Co deableConc ept }], // Reason pr ocedure pe rformed | |
| 178 | ||
| 179 | //---- ---------- ---------- ---------- ---------- ---------- ---------- ----- | |
| 180 | // "perform er" : [{ / / The peop le who per formed the procedure | |
| 181 | // "perso n" : { Ref erence(Pra ctitioner| Patient|Re latedPerso n) }, // | |
| 182 | // The reference to the pra ctitioner | |
| 183 | // "role" : { Codea bleConcept } // The role the p erson was in | |
| 184 | // }], | |
| 185 | ||
| 186 | //---- ---------- ---------- ---------- ---------- ---------- ---------- ----- | |
| 187 | // per formed[x]: Date/Peri od the pro cedure was performed . One of t hese 2: | |
| 188 | if (jd sItem.ente red !== un defined) { | |
| 189 | fh irItem.res ource.perf ormedDateT ime = fhir Utils.conv ertToFhirD ateTime(jd sItem.ente red, fhirU tils.getSi teHash(jds Item.uid)) ; | |
| 190 | } | |
| 191 | ||
| 192 | //---- ---------- ---------- ---------- ---------- ---------- ---------- ----- | |
| 193 | // "encount er" : { Re ference(En counter) } , // The e ncounter w hen proced ure perfor med | |
| 194 | fhirIt em.resourc e.encounte r = { | |
| 195 | 'r eference': jdsItem.e ncounterUi d, | |
| 196 | 'd isplay': j dsItem.enc ounterName | |
| 197 | }; | |
| 198 | ||
| 199 | //---- ---------- ---------- ---------- ---------- ---------- ---------- ----- | |
| 200 | // "locatio n" : { Ref erence(Loc ation) }, // Where t he procedu re happene d | |
| 201 | fhirIt em.resourc e.location = { | |
| 202 | 'r eference': jdsItem.l ocationUid , | |
| 203 | 'd isplay': j dsItem.loc ationName | |
| 204 | }; | |
| 205 | ||
| 206 | //---- ---------- ---------- ---------- ---------- ---------- ---------- ----- | |
| 207 | // "outcome " : { Code ableConcep t }, // Wh at was res ult of pro cedure? | |
| 208 | fhirIt em.resourc e.outcome = { | |
| 209 | 't ext': jdsI tem.result | |
| 210 | }; | |
| 211 | ||
| 212 | //---- ---------- ---------- ---------- ---------- ---------- ---------- ----- | |
| 213 | // "report" : [{ Refe rence(Diag nosticRepo rt) }], // Any repor t that res ults from the proced ure | |
| 214 | //---- ---------- ---------- ---------- ---------- ---------- ---------- ----- | |
| 215 | // "complic ation" : [ { Codeable Concept }] , // Compl ication fo llowing th e procedur e | |
| 216 | //---- ---------- ---------- ---------- ---------- ---------- ---------- ----- | |
| 217 | // "followU p" : [{ Co deableConc ept }], // Instructi ons for fo llow up | |
| 218 | ||
| 219 | //---- ---------- ---------- ---------- ---------- ---------- ---------- ----- | |
| 220 | // "related Item" : [{ // A proc edure that is relate d to this one | |
| 221 | // "type" : "<code> ", // caus ed-by | be cause-of | |
| 222 | // "targe t" : { Ref erence(All ergyIntole rance|Care Plan|Condi tion| | |
| 223 | // Diagno sticReport |FamilyMem berHistory |ImagingSt udy|Immuni zation| | |
| 224 | // Immuni zationReco mmendation |Medicatio nAdministr ation|Medi cationDisp ense| | |
| 225 | // Medica tionPrescr iption|Med icationSta tement|Obs ervation|P rocedure) } // The related it em - e.g. a procedur e | |
| 226 | // }], | |
| 227 | ||
| 228 | //---- ---------- ---------- ---------- ---------- ---------- ---------- ----- | |
| 229 | // "notes" : "<string >", // Add itional in formation about proc edure | |
| 230 | ||
| 231 | //---- ---------- ---------- ---------- ---------- ---------- ---------- ----- | |
| 232 | // "device" : [{ // D evice chan ged in pro cedure | |
| 233 | // "actio n" : { Cod eableConce pt }, // K ind of cha nge to dev ice | |
| 234 | // "manip ulated" : { Referenc e(Device) } // R! D evice that was chang ed | |
| 235 | // }], | |
| 236 | ||
| 237 | //---- ---------- ---------- ---------- ---------- ---------- ---------- ----- | |
| 238 | // "used" : [{ Refere nce(Device |Medicatio n|Substanc e) }] // I tems used during pro cedure | |
| 239 | ||
| 240 | ||
| 241 | ||
| 242 | // fhirItems. push(fhirI tem); | |
| 243 | return fhirItem. resource; | |
| 244 | } | |
| 245 | ||
| 246 | ||
| 247 | module.exp orts.build Bundle = b uildBundle ; | |
| 248 | module.exp orts.conve rtToFhir = convertTo Fhir; | |
| 249 | module.exp orts.creat eItem = cr eateItem; | |
| 250 | module.exp orts.getRe sourceConf ig = getRe sourceConf ig; | |
| 251 | module.exp orts.getEd ucations = getEducat ions; |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.