Produced by Araxis Merge on 10/2/2017 1:40:10 PM 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 | chef-repo.zip\chef-repo\project_cookbooks\mocks\files\default\node-mocks\nodeMockServices-1.3.0.52.zip | mockMviProcess.js | Fri Apr 24 04:29:04 2015 UTC |
| 2 | chef-repo.zip\chef-repo\project_cookbooks\mocks\files\default\node-mocks\nodeMockServices-1.3.0.52.zip | mockMviProcess.js | Mon Oct 2 12:54:09 2017 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 2 | 254 |
| 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 | /*jslint n ode: true */ | |
| 2 | 'use stric t'; | |
| 3 | ||
| 4 | var config = require ('./config .js'); | |
| 5 | var bunyan = require ('bunyan') ; | |
| 6 | var path = require(' path'); | |
| 7 | var logger = bunyan. createLogg er(config. logger); | |
| 8 | var _ = re quire('lod ash'); | |
| 9 | var async = require( 'async'); | |
| 10 | var mockMv i1305 = re quire('./m ockMvi1305 .js'); | |
| 11 | var mockMv i1309 = re quire('./m ockMvi1309 .js'); | |
| 12 | var libxml js = requi re("libxml js"); | |
| 13 | ||
| 14 | var data_p ath = '/da ta/'; | |
| 15 | var data_f ile_extens ion = '.xm l'; | |
| 16 | ||
| 17 | function g etElement( xmlDoc, pa th, namesp ace) { | |
| 18 | try { | |
| 19 | re turn xmlDo c.get(path , namespac e).text(); | |
| 20 | } | |
| 21 | catch (err) { | |
| 22 | re turn ""; | |
| 23 | } | |
| 24 | } | |
| 25 | ||
| 26 | function g etAttribut e(xmlDoc, path, name space) { | |
| 27 | try { | |
| 28 | re turn xmlDo c.get(path , namespac e).value() ; | |
| 29 | } | |
| 30 | catch (err) { | |
| 31 | re turn ""; | |
| 32 | } | |
| 33 | } | |
| 34 | ||
| 35 | function f etchMviDat a(req, res ) { | |
| 36 | var fi lePath = " mvi/"; | |
| 37 | ||
| 38 | // BH: Should th ese really be initia lized to d efault val ues like t his? | |
| 39 | var la stName = ' EIGHT'; | |
| 40 | var fi rstName = 'PATIENT'; | |
| 41 | var do b = '19350 407'; | |
| 42 | var ss n = ''; | |
| 43 | var pa tientId = '10108V420 871^NI^200 M^USVHA'; | |
| 44 | ||
| 45 | var bo dy = ""; | |
| 46 | req.on ('data', f unction(da ta) { | |
| 47 | lo gger.trace ('fetchMvi Data: rece ived soap message co ntent: ' + data.toSt ring()); | |
| 48 | bo dy = body + data.toS tring(); | |
| 49 | }); | |
| 50 | ||
| 51 | //Once the data has finish ed uploadi ng to the server... | |
| 52 | req.on ('end', fu nction(dat a) { | |
| 53 | // Check to s ee if they sent us a POST with out any bo dy. | |
| 54 | if (body === null || b ody === '' || body = == undefin ed) { | |
| 55 | res.stat us(404).en d("Did you forget to send a PR PA_IN20130 5UV02 or P RPA_IN2013 09UV02 mes sage, the body was e mpty"); | |
| 56 | return; | |
| 57 | } | |
| 58 | ||
| 59 | // Parse that data into an XML ob ject. | |
| 60 | va r xmlDoc = null; | |
| 61 | tr y { | |
| 62 | xmlDoc = libxmljs. parseXmlSt ring(body) ; | |
| 63 | } | |
| 64 | ca tch (err) { | |
| 65 | var s = 'Problem p arsing XML Soap Mess age: ' + e rr; | |
| 66 | logger.w arn(s); | |
| 67 | res.stat us(404).en d(s); | |
| 68 | return; | |
| 69 | } | |
| 70 | ||
| 71 | var namesp ace = { so apenv: 'ht tp://schem as.xmlsoap .org/soap/ envelope/' , vaww: 'h ttp:// URL . DNS ' }; | |
| 72 | va r path1305 = '//soap env:Envelo pe/soapenv :Body/vaww :PRPA_IN20 1305UV02'; | |
| 73 | va r path1309 = '//soap env:Envelo pe/soapenv :Body/vaww :PRPA_IN20 1309UV02'; | |
| 74 | ||
| 75 | // Determine whether we are a 130 5 message or a 1309 message | |
| 76 | va r message1 305 = xmlD oc.get(pat h1305, nam espace); / /If not un defined, w e are a "S earch Pers on (Attend ed)" messa ge | |
| 77 | va r message1 309 = xmlD oc.get(pat h1309, nam espace); / /If not un defined, w e are a "G et Corresp onding IDs " message | |
| 78 | ||
| 79 | if (message1 305 !== un defined) { | |
| 80 | //Since we are a 1 305 messag e, retriev e the last Name, firs tName, dob , and ssn from the m essage sen t to us. | |
| 81 | lastName = getElem ent(xmlDoc , '//livin gSubjectNa me/value/f amily'); | |
| 82 | firstNam e = getEle ment(xmlDo c, '//livi ngSubjectN ame/value/ given'); | |
| 83 | dob = ge tAttribute (xmlDoc, ' //livingSu bjectBirth Time/value /@value'); | |
| 84 | ssn = ge tAttribute (xmlDoc, ' //livingSu bjectId/va lue/@exten sion'); | |
| 85 | ||
| 86 | //Now, s ee which m essage fil e to retur n based of f of our c riteria. | |
| 87 | filePath += "1305/ " + mockMv i1305.fetc hMvi1305Fi leName(las tName, fir stName, do b, ssn); | |
| 88 | } | |
| 89 | el se if (mes sage1309 ! == undefin ed) { | |
| 90 | patientI d = xmlDoc .get('//pa tientIdent ifier/valu e').attr(' extension' ).value(); | |
| 91 | ||
| 92 | //Now, s ee which m essage fil e to retur n based of f of our c riteria. | |
| 93 | logger.d ebug('fetc hMviData: looking up patient i d: ' + pat ientId); | |
| 94 | filePath += "1309/ " + mockMv i1309.fetc hMvi1309Fi leName(pat ientId); | |
| 95 | } | |
| 96 | el se { | |
| 97 | //We wer en't a 130 5 or a 130 9 message, let them know. | |
| 98 | res.stat us(404).en d("You did not send a PRPA_IN2 01305UV02 or PRPA_IN 201309UV02 message, you sent s omething e lse"); | |
| 99 | return; | |
| 100 | } | |
| 101 | ||
| 102 | // We have th e full pat h and name of the fi le, add th e extensio n to it so we can se nd it. | |
| 103 | fi lePath += data_file_ extension; | |
| 104 | lo gger.debug ('fetchMvi Data: send ing file ' + filePat h); | |
| 105 | ||
| 106 | // Add a time stamp to t he header and set th e root dir ectory to find the f ile from. | |
| 107 | va r options = { | |
| 108 | root: pa th.join(__ dirname , data_path) , | |
| 109 | headers: { | |
| 110 | 'x-t imestamp': Date.now( ), | |
| 111 | 'Con tent-Type' : 'text/xm l' | |
| 112 | } | |
| 113 | }; | |
| 114 | ||
| 115 | // Send the f ile back t o them. | |
| 116 | re s.sendFile (filePath, options, function ( err) { | |
| 117 | if (err) { | |
| 118 | logg er.error(e rr); | |
| 119 | res. status(404 ).end("Pro blem sendi ng file: " + err); | |
| 120 | } else { | |
| 121 | logg er.debug(f ilePath + ' sent'); | |
| 122 | } | |
| 123 | }) ; | |
| 124 | }); | |
| 125 | ||
| 126 | } | |
| 127 | ||
| 128 | module.exp orts.fetch MviData = fetchMviDa ta; |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.