Produced by Araxis Merge on 5/29/2018 12:14:32 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 | mobile-kidney-web-2.0.0.zip\mobile-kidney-web\acceptance_test\watir\lib\module | FHIROperationsModule.rb | Wed Apr 4 20:16:46 2018 UTC |
| 2 | mobile-kidney-web-2.0.0.zip\mobile-kidney-web\acceptance_test\watir\lib\module | FHIROperationsModule.rb | Tue May 29 15:34:20 2018 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 2 | 846 |
| 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 | require "a ctive_supp ort/time" | |
| 2 | require "n et/http" | |
| 3 | require "u ri" | |
| 4 | require "j son" | |
| 5 | ||
| 6 | module FHI ROperation sModule | |
| 7 | ||
| 8 | HOST = "localhos t" | |
| 9 | PORT = " PORT " | |
| 10 | ||
| 11 | HTTP_U RI = URI.p arse("http ://#{HOST} :#{PORT}") | |
| 12 | HTTP_O BJ = Net:: HTTP.new(H TTP_URI.ho st, HTTP_U RI.port) | |
| 13 | ||
| 14 | def re moveWeight Entries(pa tientId, f irstName, lastName) | |
| 15 | re moveEntrie s(patientI d, firstNa me, lastNa me, "http: //loinc.or g|29463-7" ) | |
| 16 | end | |
| 17 | ||
| 18 | def re moveBPEntr ies(patien tId, first Name, last Name) | |
| 19 | re moveEntrie s(patientI d, firstNa me, lastNa me, "http: //loinc.or g|8716-3") | |
| 20 | end | |
| 21 | ||
| 22 | def re moveKidney JournalEnt ries(patie ntId, firs tName, las tName) | |
| 23 | re moveEntrie s(patientI d, firstNa me, lastNa me, "https ://wiki.mo bilehealth .va.gov/di splay/PGDM S|86fffcbf -2a1d-44bb -bc19-411f d282bf80") | |
| 24 | end | |
| 25 | ||
| 26 | def re moveGlucos eEntries(p atientId, firstName, lastName) | |
| 27 | re moveEntrie s(patientI d, firstNa me, lastNa me, "http: //loinc.or g|2345-7") | |
| 28 | end | |
| 29 | ||
| 30 | def re moveEntrie s(patientI d, firstNa me, lastNa me, code) | |
| 31 | pa tientFHIRI d = getPat ientId(pat ientId, fi rstName, l astName) | |
| 32 | ||
| 33 | re quest = Ne t::HTTP::D elete.new( "/fhir/Obs ervation?p atient=#{p atientFHIR Id}&code=# {code}") | |
| 34 | re sponse = H TTP_OBJ.re quest(requ est) | |
| 35 | ||
| 36 | pu ts request | |
| 37 | pu ts respons e.code | |
| 38 | pu ts respons e.body | |
| 39 | pu ts "" | |
| 40 | end | |
| 41 | ||
| 42 | def ad dWeightEnt ries(entri es, patien tId, first Name, last Name) | |
| 43 | pa tientFHIRI d = getPat ientId(pat ientId, fi rstName, l astName) | |
| 44 | ||
| 45 | en tries.each do |entry | | |
| 46 | addWeigh tEntry(pat ientFHIRId , entry[:v alue], ent ry[:effect iveDateTim e], entry[ :comments] ) | |
| 47 | en d | |
| 48 | end | |
| 49 | ||
| 50 | def ad dWeightEnt ry(patient FHIRId, va lue, effec tiveDateTi me, commen ts = "") | |
| 51 | re source = { | |
| 52 | resource Type: "Obs ervation", | |
| 53 | meta: { | |
| 54 | tag: [ | |
| 55 | { | |
| 56 | "syste m": "https ://wiki.mo bilehealth .va.gov/di splay/PGDM S/Client+P rovenance+ Mapping", | |
| 57 | "code" : "1e11b69 2-1898-435 1-a7c5-428 f61c91817" , | |
| 58 | "displ ay": "Mobi leKidney" | |
| 59 | } | |
| 60 | ], | |
| 61 | }, | |
| 62 | status: "prelimina ry", | |
| 63 | effectiv eDateTime: effective DateTime, | |
| 64 | code: { | |
| 65 | codi ng: { | |
| 66 | system: "h ttp://loin c.org", | |
| 67 | code: "294 63-7", | |
| 68 | display: " Body weigh t" | |
| 69 | } | |
| 70 | }, | |
| 71 | subject: { | |
| 72 | refe rence: "Pa tient/" + patientFHI RId | |
| 73 | }, | |
| 74 | valueQua ntity: { | |
| 75 | valu e: value, | |
| 76 | unit : "pounds" | |
| 77 | } | |
| 78 | } | |
| 79 | ||
| 80 | if comments then | |
| 81 | resource [:comments ] = commen ts | |
| 82 | en d | |
| 83 | ||
| 84 | ad dEntry(res ource, "Ob servation" ) | |
| 85 | end | |
| 86 | ||
| 87 | def ad dBPEntries (entries, patientId, firstName , lastName ) | |
| 88 | pa tientFHIRI d = getPat ientId(pat ientId, fi rstName, l astName) | |
| 89 | ||
| 90 | en tries.each do |entry | | |
| 91 | addBPEnt ry(patient FHIRId, en try[:systo lic], entr y[:diastol ic], entry [:pulse], entry[:pos ition], en try[:effec tiveDateTi me], entry [:comments ]) | |
| 92 | en d | |
| 93 | end | |
| 94 | ||
| 95 | def ad dBPEntry(p atientFHIR Id, systol ic, diasto lic, pulse , position = "", eff ectiveDate Time, comm ents) | |
| 96 | re source = { | |
| 97 | resource Type: "Obs ervation", | |
| 98 | meta: { | |
| 99 | tag: [ | |
| 100 | { | |
| 101 | "syste m": "https ://wiki.mo bilehealth .va.gov/di splay/PGDM S/Client+P rovenance+ Mapping", | |
| 102 | "code" : "1e11b69 2-1898-435 1-a7c5-428 f61c91817" , | |
| 103 | "displ ay": "Mobi leKidney" | |
| 104 | } | |
| 105 | ], | |
| 106 | }, | |
| 107 | status: "prelimina ry", | |
| 108 | code: { | |
| 109 | codi ng: { | |
| 110 | "system": "http://lo inc.org", | |
| 111 | "code": "8 716-3", | |
| 112 | "display": "Vital Si gns" | |
| 113 | } | |
| 114 | }, | |
| 115 | subject: { | |
| 116 | refe rence: "Pa tient/" + patientFHI RId | |
| 117 | }, | |
| 118 | effectiv eDateTime: effective DateTime, | |
| 119 | componen t: [ | |
| 120 | { | |
| 121 | code: { | |
| 122 | coding : [ | |
| 123 | { | |
| 124 | system: "http://lo inc.org", | |
| 125 | code: "8 480-6", | |
| 126 | display: "Systolic blood pre ssure" | |
| 127 | } | |
| 128 | ] | |
| 129 | }, | |
| 130 | valueQuant ity: { | |
| 131 | value: systolic, | |
| 132 | unit: "mm[Hg]" | |
| 133 | } | |
| 134 | }, | |
| 135 | { | |
| 136 | code: { | |
| 137 | coding : [ | |
| 138 | { | |
| 139 | system: "http://lo inc.org", | |
| 140 | code: "8 462-4", | |
| 141 | display: "Diastoli c blood pr essure" | |
| 142 | } | |
| 143 | ] | |
| 144 | }, | |
| 145 | valueQuant ity: { | |
| 146 | value: diastolic , | |
| 147 | unit: "mm[Hg]" | |
| 148 | } | |
| 149 | }, | |
| 150 | { | |
| 151 | code: { | |
| 152 | coding : [ | |
| 153 | { | |
| 154 | system: "http://lo inc.org", | |
| 155 | code: "8 867-4", | |
| 156 | display: "Heart ra te" | |
| 157 | } | |
| 158 | ] | |
| 159 | }, | |
| 160 | valueQuant ity: { | |
| 161 | value: pulse, | |
| 162 | unit: "bpm" | |
| 163 | } | |
| 164 | } | |
| 165 | ] | |
| 166 | } | |
| 167 | ||
| 168 | if comments then | |
| 169 | resource [:comments ] = commen ts | |
| 170 | en d | |
| 171 | ||
| 172 | if position then | |
| 173 | position Block = ca se positio n | |
| 174 | when "St anding" | |
| 175 | { | |
| 176 | code: { | |
| 177 | coding : [ | |
| 178 | { | |
| 179 | system: "http://lo inc.org", | |
| 180 | code: "6 9001-6", | |
| 181 | display: "Heart ra te --stand ing" | |
| 182 | } | |
| 183 | ] | |
| 184 | }, | |
| 185 | valueStrin g: "Standi ng" | |
| 186 | } | |
| 187 | when "Si tting" | |
| 188 | { | |
| 189 | code: { | |
| 190 | coding : [ | |
| 191 | { | |
| 192 | system: "http://lo inc.org", | |
| 193 | code: "6 9000-8", | |
| 194 | display: "Heart ra te --sitti ng" | |
| 195 | } | |
| 196 | ] | |
| 197 | }, | |
| 198 | valueStrin g: "Sittin g" | |
| 199 | } | |
| 200 | when "Ly ing" | |
| 201 | { | |
| 202 | code: { | |
| 203 | coding : [ | |
| 204 | { | |
| 205 | system: "http://lo inc.org", | |
| 206 | code: "6 8999-2", | |
| 207 | display: "Heart ra te --supin e" | |
| 208 | } | |
| 209 | ] | |
| 210 | }, | |
| 211 | valueStrin g: "Lying" | |
| 212 | } | |
| 213 | end | |
| 214 | ||
| 215 | resource [:componen t][3] = po sitionBloc k | |
| 216 | en d | |
| 217 | ||
| 218 | ad dEntry(res ource, "Ob servation" ) | |
| 219 | end | |
| 220 | ||
| 221 | def ad dKidneyJou rnalEntrie s(entries, patientId , firstNam e, lastNam e) | |
| 222 | pa tientFHIRI d = getPat ientId(pat ientId, fi rstName, l astName) | |
| 223 | ||
| 224 | en tries.each do |entry | | |
| 225 | addKidne yJournalEn try(patien tFHIRId, e ntry[:titl e], entry[ :effective DateTime], entry[:ha sFollowUp] ) | |
| 226 | en d | |
| 227 | end | |
| 228 | ||
| 229 | def ad dKidneyJou rnalEntry( patientFHI RId, title , effectiv eDateTime, hasFollow Up) | |
| 230 | re source = { | |
| 231 | resource Type: "Obs ervation", | |
| 232 | meta: { | |
| 233 | tag: [ | |
| 234 | { | |
| 235 | "syste m": "https ://wiki.mo bilehealth .va.gov/di splay/PGDM S/Client+P rovenance+ Mapping", | |
| 236 | "code" : "1e11b69 2-1898-435 1-a7c5-428 f61c91817" , | |
| 237 | "displ ay": "Mobi leKidney" | |
| 238 | } | |
| 239 | ] | |
| 240 | }, | |
| 241 | status: "prelimina ry", | |
| 242 | effectiv eDateTime: effective DateTime, | |
| 243 | subject: { | |
| 244 | refe rence: "Pa tient/" + patientFHI RId | |
| 245 | }, | |
| 246 | code: { | |
| 247 | codi ng: { | |
| 248 | system: "h ttps://wik i.mobilehe alth.va.go v/display/ PGDMS", | |
| 249 | code: "86f ffcbf-2a1d -44bb-bc19 -411fd282b f80", | |
| 250 | display: " Kidney jou rnal entry " | |
| 251 | } | |
| 252 | }, | |
| 253 | componen t: [ | |
| 254 | { | |
| 255 | code: { | |
| 256 | coding : { | |
| 257 | sy stem: "htt p://snomed .info/sct" , | |
| 258 | co de: "30827 3005", | |
| 259 | di splay: "Fo llow-up st atus (find ing)" | |
| 260 | } | |
| 261 | }, | |
| 262 | valueStrin g: "#{hasF ollowUp}" | |
| 263 | } | |
| 264 | ], | |
| 265 | valueStr ing: title | |
| 266 | } | |
| 267 | ||
| 268 | ad dEntry(res ource, "Ob servation" ) | |
| 269 | end | |
| 270 | ||
| 271 | def ad dGlucoseEn tries(entr ies, patie ntId, firs tName, las tName) | |
| 272 | pa tientFHIRI d = getPat ientId(pat ientId, fi rstName, l astName) | |
| 273 | ||
| 274 | en tries.each do |entry | | |
| 275 | addGluco seEntry(pa tientFHIRI d, entry[: value], en try[:testM ethod], en try[:effec tiveDateTi me], entry [:comments ]) | |
| 276 | en d | |
| 277 | end | |
| 278 | ||
| 279 | def ad dGlucoseEn try(patien tFHIRId, v alue, test Method, ef fectiveDat eTime, com ments) | |
| 280 | re source = { | |
| 281 | resource Type: "Obs ervation", | |
| 282 | meta: { | |
| 283 | tag: [ | |
| 284 | { | |
| 285 | "syste m": "https ://wiki.mo bilehealth .va.gov/di splay/PGDM S/Client+P rovenance+ Mapping", | |
| 286 | "code" : "1e11b69 2-1898-435 1-a7c5-428 f61c91817" , | |
| 287 | "displ ay": "Mobi leKidney" | |
| 288 | } | |
| 289 | ], | |
| 290 | }, | |
| 291 | status: "prelimina ry", | |
| 292 | code: { | |
| 293 | codi ng: { | |
| 294 | system: "h ttp://loin c.org", | |
| 295 | code: "234 5-7", | |
| 296 | display: " Glucose [M ass/volume ] in Serum or Plasma " | |
| 297 | } | |
| 298 | }, | |
| 299 | effectiv eDateTime: effective DateTime, | |
| 300 | subject: { | |
| 301 | refe rence: "Pa tient/" + patientFHI RId | |
| 302 | }, | |
| 303 | valueQua ntity: { | |
| 304 | valu e: value, | |
| 305 | unit : "mg/dl" | |
| 306 | }, | |
| 307 | componen t: [ | |
| 308 | { | |
| 309 | code:{ | |
| 310 | coding :{ | |
| 311 | sy stem:"http ://snomed. info/sct", | |
| 312 | co de:"162549 003", | |
| 313 | di splay: "Ea ting routi ne (observ able entit y)" | |
| 314 | } | |
| 315 | }, | |
| 316 | valueStrin g: testMet hod | |
| 317 | } | |
| 318 | ||
| 319 | ] | |
| 320 | } | |
| 321 | ||
| 322 | if comments then | |
| 323 | resource [:comments ] = commen ts | |
| 324 | en d | |
| 325 | ||
| 326 | ad dEntry(res ource, "Ob servation" ) | |
| 327 | end | |
| 328 | ||
| 329 | def ge tPatientId (patientId , firstNam e, lastNam e) | |
| 330 | pa tientRespo nse = getP atient(pat ientId) | |
| 331 | to tal = pati entRespons e["total"] | |
| 332 | ||
| 333 | if total == 0 then | |
| 334 | patientR esponse = createNewP atient(pat ientId, fi rstName, l astName) | |
| 335 | en d | |
| 336 | ||
| 337 | pa tientFHIRI d = patien tResponse[ "entry"][0 ]["resourc e"]["id"] | |
| 338 | ||
| 339 | re turn patie ntFHIRId | |
| 340 | end | |
| 341 | ||
| 342 | def ge tPatient(p atientId) | |
| 343 | re quest = Ne t::HTTP::G et.new("/f hir/Patien t?identifi er=#{patie ntId}") | |
| 344 | re sponse = H TTP_OBJ.re quest(requ est) | |
| 345 | bo dy = JSON. parse(resp onse.body) | |
| 346 | ||
| 347 | re turn body | |
| 348 | end | |
| 349 | ||
| 350 | def cr eateNewPat ient(patie ntId, firs tName, las tName) | |
| 351 | pa tientResou rce = { | |
| 352 | "resourc eType": "P atient", | |
| 353 | "identif ier": [ | |
| 354 | { | |
| 355 | "type": { | |
| 356 | "codin g": [ | |
| 357 | { | |
| 358 | "system" : "https:/ /pki.dmdc. osd.mil/mi lconnect", | |
| 359 | "code": "EDIPI" | |
| 360 | } | |
| 361 | ] | |
| 362 | }, | |
| 363 | "value": p atientId | |
| 364 | } | |
| 365 | ], | |
| 366 | "active" : true, | |
| 367 | "name": [ | |
| 368 | { | |
| 369 | "use": "of ficial", | |
| 370 | "text": "# {lastName} , #{firstN ame}", | |
| 371 | "family": [ | |
| 372 | lastNa me | |
| 373 | ], | |
| 374 | "given": [ | |
| 375 | firstN ame | |
| 376 | ] | |
| 377 | } | |
| 378 | ] | |
| 379 | } | |
| 380 | ||
| 381 | pu ts "Creati ng Patient FHIR Reso urce" | |
| 382 | ad dEntry(pat ientResour ce, "Patie nt") | |
| 383 | ||
| 384 | sl eep 2 | |
| 385 | ||
| 386 | re turn getPa tient(pati entId) | |
| 387 | end | |
| 388 | ||
| 389 | def ad dEntry(res ource, typ e) | |
| 390 | re quest = Ne t::HTTP::P ost.new("/ fhir/#{typ e}", {"Con tent-Type" : "applica tion/json" }) | |
| 391 | re quest.body = resourc e.to_json | |
| 392 | ||
| 393 | re sponse = H TTP_OBJ.re quest(requ est) | |
| 394 | ||
| 395 | pu ts resourc e | |
| 396 | pu ts respons e.code | |
| 397 | pu ts respons e.body | |
| 398 | pu ts "" | |
| 399 | ||
| 400 | end | |
| 401 | ||
| 402 | def ge tLastUpdat edDateOfKi dneyJourna lByTitle(t itle, pati entId, fir stName, la stName) | |
| 403 | ti tle.gsub! " ", "%20" | |
| 404 | pa tientFHIRI d = getPat ientId(pat ientId, fi rstName, l astName) | |
| 405 | ||
| 406 | co de = "http s://wiki.m obilehealt h.va.gov/d isplay/PGD MS|86fffcb f-2a1d-44b b-bc19-411 fd282bf80" | |
| 407 | re quest = Ne t::HTTP::G et.new("/f hir/Observ ation?pati ent=#{pati entFHIRId} &code=#{co de}&value- string=#{t itle}") | |
| 408 | re sponse = H TTP_OBJ.re quest(requ est) | |
| 409 | bo dy = JSON. parse(resp onse.body) | |
| 410 | la stUpdated = "" | |
| 411 | ||
| 412 | if (body["to tal"] != 0 ) then | |
| 413 | lastUpda ted = form atDateTime (body["ent ry"][0]["r esource"][ "meta"]["l astUpdated "]) | |
| 414 | en d | |
| 415 | ||
| 416 | re turn lastU pdated | |
| 417 | end | |
| 418 | ||
| 419 | def fo rmatDateTi me(dateTim e) | |
| 420 | re turn Time. parse(date Time).in_t ime_zone(" Eastern Ti me (US & C anada)").s trftime("% B %d, %Y % I:%M %p") | |
| 421 | end | |
| 422 | ||
| 423 | end | |
| 424 |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.