10. EPMO Open Source Coordination Office Redaction File Detail Report

Produced by Araxis Merge on 5/24/2018 2:23: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.

10.1 Files compared

# Location File Last Modified
1 CUI-v2.5.0-release-source.zip\app\services via_api.rb Fri Mar 23 17:02:06 2018 UTC
2 CUI-v2.5.0-release-source.zip\app\services via_api.rb Thu May 17 13:18:18 2018 UTC

10.2 Comparison summary

Description Between
Files 1 and 2
Text Blocks Lines
Unchanged 3 302
Changed 2 4
Inserted 0 0
Removed 0 0

10.3 Comparison options

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

10.4 Active regular expressions

No regular expressions were active.

10.5 Comparison detail

  1   require_re l 'via_api /**/*.rb'
  2  
  3   module VIA _API
  4  
  5     # dateti me format  used by VI STA when s ending/rec eiving dat etime data
  6     # (appoi ntment tim es, etc.)
  7     VISTA_DA TETIME_FOR MAT = '%Y% m%d.%H%M%S '
  8  
  9     # EMR SE RVICE
  10     VIA_EMR_ WSDL          = File. join(ENV[' VIA_API_UR L'], 'EmrS ervice?wsd l')
  11     VIA_EMR_ ENDPOINT_U RL = File. join(ENV[' VIA_API_UR L'], 'EmrS ervice')
  12     VIA_EMR_ NAMESPACE     = ENV[' VIA_API_RO OT_ENDPOIN T']
  13  
  14     # SCHEDU LING SERVI CE
  15     VIA_SCHE DULING_WSD L          = File.joi n(ENV['VIA _API_URL'] , 'Schedul ingService ?wsdl')
  16     VIA_SCHE DULING_END POINT_URL  = File.joi n(ENV['VIA _API_URL'] , 'Schedul ingService ')
  17     VIA_SCHE DULING_NAM ESPACE     = ENV['VIA _API_ROOT_ ENDPOINT']
  18  
  19     EMR_CLIE NT = Savon .client do
  20       endpoi nt(VIA_EMR _ENDPOINT_ URL)
  21       namesp ace(VIA_EM R_NAMESPAC E)
  22       env_na mespace(:s oapenv)
  23       namesp ace_identi fier(:ser)
  24       namesp aces({
  25         'xml ns:xsd'      => '',
  26         'xml ns:xsi'      => '',
  27         'xml ns:soapenv ' => 'http ://schemas .xmlsoap.o rg/soap/en velope/',
  28           'xmlns:ser      => 'http:/ / URL /'
  29       })
  30       if Rai ls.env.dev elopment?
  31         log( true)
  32         logg er(Rails.l ogger)
  33         pret ty_print_x ml(true)
  34       end
  35     end
  36  
  37     SCHEDULI NG_CLIENT  = Savon.cl ient do
  38       endpoi nt(VIA_SCH EDULING_EN DPOINT_URL )
  39       namesp ace(VIA_SC HEDULING_N AMESPACE)
  40       env_na mespace(:s oapenv)
  41       namesp ace_identi fier(:ser)
  42       namesp aces({
  43         'xml ns:xsd'      => '',
  44         'xml ns:xsi'      => '',
  45         'xml ns:soapenv ' => 'http ://schemas .xmlsoap.o rg/soap/en velope/',
  46           'xmlns:ser      => 'http:/ / URL '
  47       })
  48       if Rai ls.env.dev elopment?
  49         log( true)
  50         logg er(Rails.l ogger)
  51         pret ty_print_x ml(true)
  52       end
  53     end
  54  
  55     # Base e rror class  for all V IA API err ors.  If w e add mult iple VIA A PI excepti on
  56     # types  we can res cue all AP I errors u nder one b ase type.
  57     class Vi aApiError  < RuntimeE rror; end
  58  
  59     # Error  returned f rom VISTA  when messa ges contai n <fault>  tags.
  60     class Vi aApiFaultE rror < Via ApiError;  end
  61  
  62     # Error  returned f rom VISTA  when login VIA authen tication c ontains <f ault> tags .
  63     class Vi aApiAuthen ticationEr ror < ViaA piError; e nd
  64  
  65  
  66     class <<  self
  67  
  68       def lo gin_via_re quest(para ms)
  69         requ est = {}
  70         requ est[:siteC ode]    =  params[:si te_code]
  71         requ est[:acces sCode]  =  params[:ac cess_code]
  72         requ est[:verif yCode]  =  params[:ve rify_code]
  73         requ est[:query Bean]= {
  74          pat ient: {
  75           lo calSiteId:  params[:s ite_code]
  76          },
  77          req uestingApp : ENV['VIA _REQ_APP'] ,
  78          con sumingAppT oken: ENV[ 'VIA_CONS_ APP_TOKEN' ],
  79          con sumingAppP assword: E NV['VIA_CO NS_APP_PAS S']
  80         }
  81  
  82         retu rn request
  83       end
  84  
  85       # To c onvert a n oko elemen t to hash  while pars ing a xml
  86       def x2 h(noko_ele ment)
  87         Hash .from_xml( noko_eleme nt.to_s)
  88       end
  89  
  90       def au thenticate (params)
  91  
  92         # NO TE: The du z returned  by the lo ginVIA ope ration can  be used i nterchange ably withi n
  93         #        the VI A web-serv ices like  FindPatien tService,  Scheduling Service, E mrService  etc.
  94  
  95         logi n_via_requ est = EMR_ CLIENT.bui ld_request (:login_v_ i_a, messa ge: login_ via_reques t(params)) .body
  96  
  97         # Ad ding 'ser: ' prefix a s necessar y to the x ml element s.
  98  
  99         logi n_via_requ est = add_ ser_prefix (login_via _request)
  100  
  101         logi n_via_resp onse = EMR _CLIENT.ca ll(:login_ v_i_a, xml : login_vi a_request,  soap_acti on: false) .body
  102  
  103         # Fo r more com plex XML s tructures,
  104         # yo u can pass  any other  object th at is not  a Hash and  responds  to #to_s
  105         # lo gin_via_re sponse = E MR_CLIENT. call(:logi n_via, mes sage: logi n_via_requ est(params )).body
  106         faul t_message  = login_vi a_response .dig(:logi n_via_resp onse, :use r_to, :fau lt, :messa ge)
  107  
  108         if f ault_messa ge.present ?
  109           ra ise ViaApi Authentica tionError. new(fault_ message)
  110         end
  111  
  112         {
  113           du z:       l ogin_via_r esponse[:l ogin_via_r esponse][: user_to][: duz],
  114           us er_name: l ogin_via_r esponse[:l ogin_via_r esponse][: user_to][: name],
  115           si te_id:   l ogin_via_r esponse[:l ogin_via_r esponse][: user_to][: site_id]
  116         }
  117  
  118       end #  def authen ticate
  119  
  120       def va lidate_vis ta_session (vista_ses sion)
  121  
  122         if   vista_sess ion[:duz]. nil?        ||
  123              vista_sess ion[:user_ name].nil?  ||
  124              vista_sess ion[:site_ id].nil?
  125           ra ise ViaApi Authentica tionError. new("Authe ntication  needed")
  126         end
  127       end
  128  
  129       # Conv ert date i n format " YYYYMMDD.H HMMSS" to  Ruby Time  object.
  130       # TODO : handle t ime zones  in the fut ure.
  131       def pa rse_vista_ date(via_a pi_date)
  132         time _in_system _zone = Ti me.strptim e(via_api_ date, VIST A_DATETIME _FORMAT)
  133         Acti veSupport: :TimeZone. new('UTC') .parse(tim e_in_syste m_zone.cti me)
  134       end
  135  
  136       # Conv ert date f rom Ruby T ime object  to "YYYYM MDD.HHMMSS " format.
  137       # TODO : handle t ime zones  in the fut ure.
  138       def en code_vista _date(date time)
  139         date time.strft ime(VISTA_ DATETIME_F ORMAT)
  140       end
  141  
  142       def ad d_ser_pref ix(xml_req uest)
  143         node s = ["//ac cessCode",  "//verify Code", "// siteCode",  "//queryB ean", "//a ppointment "]
  144         doc  = Nokogiri ::XML(xml_ request)
  145         node s.each do  |node|
  146           un less doc.a t_xpath(no de).nil?
  147              doc.at_xpa th(node).n ame = "ser :" + doc.a t_xpath(no de).name
  148           en d
  149         end
  150         retu rn doc.to_ xml
  151       end
  152     end # cl ass << sel f
  153   end # modu le VIA_API