medivo 0.0.8 → 0.0.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (41) hide show
  1. data/app/assets/javascripts/medivo/lab_appointments/application.js +0 -0
  2. data/app/assets/javascripts/medivo/lab_appointments/models.coffee +0 -0
  3. data/app/assets/javascripts/medivo/lab_appointments/sample/show_appointments.coffee +0 -0
  4. data/app/assets/javascripts/medivo/lab_appointments/views.coffee +0 -0
  5. data/app/models/medivo/insurance_order.rb +15 -3
  6. data/app/models/medivo/order.rb +28 -10
  7. data/lib/medivo.rb +2 -1
  8. data/lib/medivo/validators.rb +10 -0
  9. data/lib/medivo/version.rb +1 -1
  10. data/spec/dummy/config/medivo_resource.yml +5 -2
  11. data/spec/dummy/log/development.log +125 -0
  12. data/spec/dummy/log/test.log +42 -0
  13. data/spec/dummy/tmp/cache/assets/C46/F00/sprockets%2F2281d588b540056c5a7306c32a3761b9 +0 -0
  14. data/spec/dummy/tmp/cache/assets/C69/500/sprockets%2F140b56780716711c2b6eb1028f042ca6 +0 -0
  15. data/spec/dummy/tmp/cache/assets/C81/D00/sprockets%2F64f056bd752d271308a86a6f865b1911 +0 -0
  16. data/spec/dummy/tmp/cache/assets/CC3/EF0/sprockets%2F453b504c1f8f374578636f699eaa455d +0 -0
  17. data/spec/dummy/tmp/cache/assets/CEC/EF0/sprockets%2F4b24a74018f693c06088bd52f8cc9f86 +0 -0
  18. data/spec/dummy/tmp/cache/assets/D1B/820/sprockets%2F92a83e15913997b3d9ac7ed437b1e44c +0 -0
  19. data/spec/dummy/tmp/cache/assets/D20/F10/sprockets%2Fb2e907e4faa85fe755f4439e3b229088 +0 -0
  20. data/spec/dummy/tmp/cache/assets/D29/000/sprockets%2F61a10ddf57f1129c02a1049bfed6e007 +0 -0
  21. data/spec/dummy/tmp/cache/assets/D30/920/sprockets%2Fcc4603fc6441ca421a7d02886a81ab9d +0 -0
  22. data/spec/dummy/tmp/cache/assets/D32/A10/sprockets%2F13fe41fee1fe35b49d145bcc06610705 +0 -0
  23. data/spec/dummy/tmp/cache/assets/D36/870/sprockets%2Fce9e887568de873b133ae43d7c977f68 +0 -0
  24. data/spec/dummy/tmp/cache/assets/D4C/7A0/sprockets%2Fbc635c7b186d1ef5178f4ed3722d868b +0 -0
  25. data/spec/dummy/tmp/cache/assets/D54/ED0/sprockets%2F71c9fa01091d432b131da3bb73faf3d4 +0 -0
  26. data/spec/dummy/tmp/cache/assets/D55/ED0/sprockets%2F0f673e42e816c6fe5b66a5c96f896f1a +0 -0
  27. data/spec/dummy/tmp/cache/assets/D5D/3E0/sprockets%2F63fea6cc142b5f02da93bf81e70b2116 +0 -0
  28. data/spec/dummy/tmp/cache/assets/D65/6D0/sprockets%2F3ce07ca1958d7ab3e80c4b3e0d24088c +0 -0
  29. data/spec/dummy/tmp/cache/assets/D68/AD0/sprockets%2F19727663b4ec901b812dbdabee2526ec +0 -0
  30. data/spec/dummy/tmp/cache/assets/D74/9A0/sprockets%2F0ca4e6e833c72156fc7e7d5f007d9ce3 +0 -0
  31. data/spec/dummy/tmp/cache/assets/D76/720/sprockets%2F88d8aa1d2fb41ce79b8ec4150ea74748 +0 -0
  32. data/spec/dummy/tmp/cache/assets/D84/210/sprockets%2Fabd0103ccec2b428ac62c94e4c40b384 +0 -0
  33. data/spec/dummy/tmp/cache/assets/DC1/230/sprockets%2F3a36cd467bdce1914a2b7af4ed4114cf +0 -0
  34. data/spec/dummy/tmp/cache/assets/DD4/2B0/sprockets%2Fef214a63f29afe7f3cbffc65af943108 +0 -0
  35. data/spec/dummy/tmp/cache/assets/E04/890/sprockets%2F2f5173deea6c795b8fdde723bb4b63af +0 -0
  36. data/spec/dummy/tmp/pids/server.pid +1 -1
  37. data/spec/fixtures/lc_positive_results.xml +182 -0
  38. data/spec/fixtures/valid_uhc_order.xml +36 -0
  39. data/spec/models/orders_spec.rb +109 -10
  40. data/spec/support/blueprints.rb +48 -48
  41. metadata +24 -16
@@ -6,6 +6,7 @@ module Medivo
6
6
  include ActiveModel::Validations
7
7
 
8
8
  validates_presence_of :relationship, :company_name, :policy_number, :group_number
9
+ validates :relationship, :inclusion => { :in => 1..2 }
9
10
 
10
11
  def initialize(attributes = {})
11
12
  @attributes = attributes
@@ -15,22 +16,33 @@ module Medivo
15
16
  @attributes[key]
16
17
  end
17
18
 
19
+ def to_hash
20
+ @attributes
21
+ end
22
+
18
23
  def validate(record)
19
24
  primary_insurance = record.attributes[:primary_insurance]
20
25
  record.errors.add(:primary_insurance, "primary_insurance field must be present") and return unless primary_insurance
21
26
  record.errors.add(:primary_insurance, "primary_insurance field must be of PrimaryInsurance class") unless primary_insurance.is_a? PrimaryInsurance
22
27
  primary_insurance.valid?
23
- record.errors.add(:'primary_insurance.relationship', "primary_insurance relationship field must be the value 1") unless primary_insurance.read_attribute_for_validation(:relationship) == 1
24
- for field in %w(company_name policy_number group_number)
25
- record.errors.add(:"primary_insurance.#{field}", "primary_insurance #{field} must be present") unless primary_insurance.read_attribute_for_validation(field)
28
+ primary_insurance.errors.messages.each do |field,value|
29
+ record.errors.add(:"primary_insurance.#{field}", value.first)
26
30
  end
27
31
  end
28
32
  end
29
33
 
30
34
  class InsuranceOrder < Order
35
+ set_element_name 'customer'
36
+ set_collection_name 'customers'
37
+
31
38
  validates_with Medivo::ArrayValidator, :fields => [:diagnosis_code]
32
39
  validates_with PrimaryInsurance
33
40
 
41
+ def to_xml(options={})
42
+ options.merge!(:root=>self.class.element_name)
43
+ @attributes.merge(:primary_insurance=>primary_insurance.to_hash).to_xml(options)
44
+ end
45
+
34
46
  # when getting the insurance info from medivo labs
35
47
  def insurance
36
48
  @insurance ||= try(:insurance_information).try(:primary_insurance_info)
@@ -5,22 +5,27 @@ module Medivo
5
5
  set_element_name 'customer'
6
6
  set_collection_name 'customers'
7
7
 
8
- validates_presence_of :email, :address, :zip, :dob, :home_phone, :psc,
8
+ validates_presence_of :first_name, :last_name, :email, :address,
9
+ :state, :zip, :dob, :home_phone, :psc,
9
10
  :test_types, :gender, :account_number
10
11
  validates_inclusion_of :gender, :in => %w(Male Female)
11
12
  validates_with Medivo::DateValidator, :fields=>[:dob]
12
- validates_with Medivo::ArrayValidator, :fields=>[:test_types]
13
+ validates_with Medivo::TestTypesValidator, :fields=>[:test_types]
13
14
 
14
- def read_attribute_for_validation(key)
15
- @attributes[key]
16
- end
15
+ extend ActiveModel::Callbacks
16
+ # need to set up this dummy call .. for subclass to be able to use it at all
17
+ define_model_callbacks :create, :only=>[]
17
18
 
18
19
  def initialize(attributes = {}, persisted = false)
19
20
  super(attributes, persisted)
20
- self.draw_location = 'PSC'
21
+ self.draw_location = "PSC"
21
22
  self.take_tests_same_day = true
22
23
  end
23
24
 
25
+ def read_attribute_for_validation(key)
26
+ @attributes[key]
27
+ end
28
+
24
29
  # overriding save to return false if it does not save without errors
25
30
  def save
26
31
  new? ? create : update
@@ -30,11 +35,12 @@ module Medivo
30
35
  # overriding create to capture 404 status and put that in error
31
36
  # messages instead of throwing exception
32
37
  def create
33
- super
34
- @remote_errors = nil
38
+ run_callbacks(:create)
39
+ super
40
+ @remote_errors = nil
35
41
  rescue ActiveResource::ResourceNotFound => e
36
42
  @remote_errors = e
37
- load_remote_errors(e,true)
43
+ load_remote_errors(e, true)
38
44
  end
39
45
 
40
46
  def to_param
@@ -49,8 +55,19 @@ module Medivo
49
55
  find(requsition_id)
50
56
  end
51
57
 
58
+ # loads the results with order
59
+ def self.find_with_results(requsition_id)
60
+ find(requsition_id, :params=>{:include=>:reconciled_results})
61
+ end
62
+
63
+ # must use #find_with_results to get the order before you call this method
52
64
  def results
53
- @results ||= Array.wrap(try(:reconciled_results).try(:result))
65
+ Array.wrap(try(:reconciled_results).try(:result))
66
+ end
67
+
68
+ # must use #find_with_results to get the order before you call this method
69
+ def results_summary
70
+ try(:reconciled_results).try(:results_summary)
54
71
  end
55
72
 
56
73
  def simulate_result(lab_prefix, type='normal')
@@ -64,5 +81,6 @@ module Medivo
64
81
 
65
82
  post(:mock_order, {}, body)
66
83
  end
84
+
67
85
  end
68
86
  end
data/lib/medivo.rb CHANGED
@@ -4,4 +4,5 @@ require "medivo/validators"
4
4
  require 'jquery-rails'
5
5
  require 'coffee-script'
6
6
  require 'haml-rails'
7
- require 'geocoder'
7
+ require 'geocoder'
8
+ Geocoder::Configuration.lookup = :geocoder_ca
@@ -8,6 +8,16 @@ module Medivo
8
8
  end
9
9
  end
10
10
 
11
+ class TestTypesValidator < ActiveModel::Validator
12
+ def validate(record)
13
+ for field in options[:fields]
14
+ value = record.attributes[field]
15
+ valid = value.is_a?(String) and value.split(",").is_a?(Array) rescue false
16
+ record.errors.add(field, "#{field} must be a comma delimited string of one of more test id's' like so: \"test_type1\" or \"test_type1, test_type2\" ") unless valid
17
+ end
18
+ end
19
+ end
20
+
11
21
  # A valid date for the orders is a little different that usual .. so take note '%Y%m%d'
12
22
  # has no slashes or dashes .. so a date is valid that looks like: '20111202'
13
23
  class DateValidator < ActiveModel::Validator
@@ -1,3 +1,3 @@
1
1
  module Medivo
2
- VERSION = "0.0.8"
2
+ VERSION = "0.0.9"
3
3
  end
@@ -5,5 +5,8 @@ test:
5
5
 
6
6
  development:
7
7
  href: https://api16-staging.medivo.com
8
- user: vertex
9
- password: orderdude1
8
+ user: uhcc
9
+ password: uhctoken1
10
+
11
+
12
+
@@ -12797,3 +12797,128 @@ Served asset /medivo/markerC.png - 304 Not Modified (0ms)
12797
12797
 
12798
12798
  Started GET "/assets/medivo/arrow.png" for 127.0.0.1 at 2011-10-27 12:04:43 +0100
12799
12799
  Served asset /medivo/arrow.png - 304 Not Modified (0ms)
12800
+
12801
+
12802
+ Started GET "/labs/search" for 127.0.0.1 at 2011-10-28 00:25:35 +0100
12803
+ Processing by LabsController#search as HTML
12804
+ Rendered labs/search.html.haml within layouts/application (28.2ms)
12805
+ Compiled application.css (0ms) (pid 14412)
12806
+ Compiled application.js (7ms) (pid 14412)
12807
+ Compiled jquery.js (1ms) (pid 14412)
12808
+ Compiled jquery_ujs.js (0ms) (pid 14412)
12809
+ Compiled medivo/lab_list/application.js (7ms) (pid 14412)
12810
+ Compiled medivo/handlebars.js (0ms) (pid 14412)
12811
+ Compiled medivo/lab_list/models.js (201ms) (pid 14412)
12812
+ Compiled medivo/lab_list/views.js (206ms) (pid 14412)
12813
+ Compiled medivo/lab_list/init.js (165ms) (pid 14412)
12814
+ Compiled medivo/lab_list/sample/show_labs.js (157ms) (pid 14412)
12815
+ Completed 200 OK in 1131ms (Views: 864.8ms)
12816
+
12817
+
12818
+ Started GET "/assets/application.css?body=1" for 127.0.0.1 at 2011-10-28 00:25:36 +0100
12819
+ Served asset /application.css - 304 Not Modified (0ms)
12820
+
12821
+
12822
+ Started GET "/assets/medivo/handlebars.js?body=1" for 127.0.0.1 at 2011-10-28 00:25:36 +0100
12823
+ Served asset /medivo/handlebars.js - 304 Not Modified (5ms)
12824
+
12825
+
12826
+ Started GET "/assets/medivo/lab_list/views.js?body=1" for 127.0.0.1 at 2011-10-28 00:25:36 +0100
12827
+ Served asset /medivo/lab_list/views.js - 304 Not Modified (21ms)
12828
+
12829
+
12830
+ Started GET "/assets/jquery_ujs.js?body=1" for 127.0.0.1 at 2011-10-28 00:25:36 +0100
12831
+ Served asset /jquery_ujs.js - 304 Not Modified (1ms)
12832
+
12833
+
12834
+ Started GET "/assets/medivo/lab_list/models.js?body=1" for 127.0.0.1 at 2011-10-28 00:25:36 +0100
12835
+ Served asset /medivo/lab_list/models.js - 304 Not Modified (2ms)
12836
+
12837
+
12838
+ Started GET "/assets/medivo/lab_list/init.js?body=1" for 127.0.0.1 at 2011-10-28 00:25:36 +0100
12839
+ Served asset /medivo/lab_list/init.js - 304 Not Modified (2ms)
12840
+
12841
+
12842
+ Started GET "/assets/jquery.js?body=1" for 127.0.0.1 at 2011-10-28 00:25:36 +0100
12843
+ Served asset /jquery.js - 304 Not Modified (2ms)
12844
+
12845
+
12846
+ Started GET "/assets/medivo/lab_list/application.js?body=1" for 127.0.0.1 at 2011-10-28 00:25:36 +0100
12847
+ Served asset /medivo/lab_list/application.js - 304 Not Modified (4ms)
12848
+
12849
+
12850
+ Started GET "/assets/medivo/lab_list/sample/show_labs.js?body=1" for 127.0.0.1 at 2011-10-28 00:25:36 +0100
12851
+ Served asset /medivo/lab_list/sample/show_labs.js - 304 Not Modified (2ms)
12852
+
12853
+
12854
+ Started GET "/assets/application.js?body=1" for 127.0.0.1 at 2011-10-28 00:25:36 +0100
12855
+ Served asset /application.js - 304 Not Modified (0ms)
12856
+
12857
+
12858
+ Started GET "/labs/search?zip_code=90210" for 127.0.0.1 at 2011-10-28 00:25:58 +0100
12859
+ Processing by LabsController#search as HTML
12860
+ Parameters: {"zip_code"=>"90210"}
12861
+ Rendered labs/search.html.haml within layouts/application (9.9ms)
12862
+ Completed 200 OK in 2443ms (Views: 30.5ms)
12863
+
12864
+
12865
+ Started GET "/assets/application.css?body=1" for 127.0.0.1 at 2011-10-28 00:26:01 +0100
12866
+ Served asset /application.css - 304 Not Modified (0ms)
12867
+
12868
+
12869
+ Started GET "/assets/jquery.js?body=1" for 127.0.0.1 at 2011-10-28 00:26:01 +0100
12870
+ Served asset /jquery.js - 304 Not Modified (0ms)
12871
+
12872
+
12873
+ Started GET "/assets/jquery_ujs.js?body=1" for 127.0.0.1 at 2011-10-28 00:26:01 +0100
12874
+ Served asset /jquery_ujs.js - 304 Not Modified (0ms)
12875
+
12876
+
12877
+ Started GET "/assets/medivo/handlebars.js?body=1" for 127.0.0.1 at 2011-10-28 00:26:01 +0100
12878
+ Served asset /medivo/handlebars.js - 304 Not Modified (0ms)
12879
+
12880
+
12881
+ Started GET "/assets/medivo/lab_list/models.js?body=1" for 127.0.0.1 at 2011-10-28 00:26:01 +0100
12882
+ Served asset /medivo/lab_list/models.js - 304 Not Modified (0ms)
12883
+
12884
+
12885
+ Started GET "/assets/medivo/lab_list/views.js?body=1" for 127.0.0.1 at 2011-10-28 00:26:01 +0100
12886
+ Served asset /medivo/lab_list/views.js - 304 Not Modified (0ms)
12887
+
12888
+
12889
+ Started GET "/assets/medivo/lab_list/init.js?body=1" for 127.0.0.1 at 2011-10-28 00:26:01 +0100
12890
+ Served asset /medivo/lab_list/init.js - 304 Not Modified (0ms)
12891
+
12892
+
12893
+ Started GET "/assets/medivo/lab_list/application.js?body=1" for 127.0.0.1 at 2011-10-28 00:26:01 +0100
12894
+ Served asset /medivo/lab_list/application.js - 304 Not Modified (0ms)
12895
+
12896
+
12897
+ Started GET "/assets/medivo/lab_list/sample/show_labs.js?body=1" for 127.0.0.1 at 2011-10-28 00:26:01 +0100
12898
+ Served asset /medivo/lab_list/sample/show_labs.js - 304 Not Modified (0ms)
12899
+
12900
+
12901
+ Started GET "/assets/application.js?body=1" for 127.0.0.1 at 2011-10-28 00:26:01 +0100
12902
+ Served asset /application.js - 304 Not Modified (0ms)
12903
+
12904
+
12905
+ Started GET "/assets/medivo/markerC.png" for 127.0.0.1 at 2011-10-28 00:26:01 +0100
12906
+ Served asset /medivo/markerC.png - 304 Not Modified (5ms)
12907
+
12908
+
12909
+ Started GET "/assets/medivo/markerA.png" for 127.0.0.1 at 2011-10-28 00:26:01 +0100
12910
+ Served asset /medivo/markerA.png - 304 Not Modified (3ms)
12911
+
12912
+
12913
+ Started GET "/assets/medivo/markerB.png" for 127.0.0.1 at 2011-10-28 00:26:01 +0100
12914
+ Served asset /medivo/markerB.png - 304 Not Modified (2ms)
12915
+
12916
+
12917
+ Started GET "/assets/medivo/arrow.png" for 127.0.0.1 at 2011-10-28 00:26:01 +0100
12918
+ Served asset /medivo/arrow.png - 304 Not Modified (3ms)
12919
+
12920
+
12921
+ Started GET "/medivo/labs/lab_data?utf8=%E2%9C%93&zip_code=10005&commit=Search" for 127.0.0.1 at 2011-10-28 00:26:13 +0100
12922
+ Processing by Medivo::LabsController#lab_data as JS
12923
+ Parameters: {"utf8"=>"✓", "zip_code"=>"10005", "commit"=>"Search"}
12924
+ Completed 200 OK in 2453ms (Views: 20.0ms)
@@ -1060,3 +1060,45 @@ Served asset /medivo/markerB.png - 200 OK (3ms)
1060
1060
 
1061
1061
  Started GET "/assets/medivo/arrow.png" for 127.0.0.1 at 2011-10-27 12:24:04 +0100
1062
1062
  Served asset /medivo/arrow.png - 200 OK (4ms)
1063
+
1064
+
1065
+ Started GET "/medivo/labs/lab_data?zip_code=90210" for 127.0.0.1 at 2011-10-28 15:11:07 +0100
1066
+ Processing by Medivo::LabsController#lab_data as HTML
1067
+ Parameters: {"zip_code"=>"90210"}
1068
+ Completed 200 OK in 680ms (Views: 1.1ms)
1069
+
1070
+
1071
+ Started GET "/labs/search?zip_code=90210" for 127.0.0.1 at 2011-10-28 15:11:10 +0100
1072
+ Processing by LabsController#search as HTML
1073
+ Parameters: {"zip_code"=>"90210"}
1074
+ Completed 200 OK in 523ms (Views: 112.8ms)
1075
+
1076
+
1077
+ Started GET "/assets/application.css" for 127.0.0.1 at 2011-10-28 15:11:10 +0100
1078
+ Compiled application.css (1ms) (pid 19378)
1079
+ Served asset /application.css - 200 OK (9ms)
1080
+
1081
+
1082
+ Started GET "/assets/application.js" for 127.0.0.1 at 2011-10-28 15:11:10 +0100
1083
+ Compiled application.js (6ms) (pid 19378)
1084
+ Compiled jquery.js (44ms) (pid 19378)
1085
+ Compiled jquery_ujs.js (0ms) (pid 19378)
1086
+ Compiled medivo/lab_list/application.js (6ms) (pid 19378)
1087
+ Compiled medivo/handlebars.js (1ms) (pid 19378)
1088
+ Compiled medivo/lab_list/models.js (198ms) (pid 19378)
1089
+ Compiled medivo/lab_list/views.js (225ms) (pid 19378)
1090
+ Compiled medivo/lab_list/init.js (168ms) (pid 19378)
1091
+ Compiled medivo/lab_list/sample/show_labs.js (159ms) (pid 19378)
1092
+ Served asset /application.js - 200 OK (863ms)
1093
+
1094
+
1095
+ Started GET "/assets/medivo/markerA.png" for 127.0.0.1 at 2011-10-28 15:11:11 +0100
1096
+ Served asset /medivo/markerA.png - 200 OK (5ms)
1097
+
1098
+
1099
+ Started GET "/assets/medivo/markerB.png" for 127.0.0.1 at 2011-10-28 15:11:11 +0100
1100
+ Served asset /medivo/markerB.png - 200 OK (3ms)
1101
+
1102
+
1103
+ Started GET "/assets/medivo/arrow.png" for 127.0.0.1 at 2011-10-28 15:11:11 +0100
1104
+ Served asset /medivo/arrow.png - 200 OK (4ms)
@@ -1 +1 @@
1
- 11588
1
+ 14412
@@ -0,0 +1,182 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <customer>
3
+ <id>170853</id>
4
+ <requisition-number>170853</requisition-number>
5
+ <account-number>05021370</account-number>
6
+ <confirmation-code>dhDEH525Fe</confirmation-code>
7
+ <first-name>daniel</first-name>
8
+ <last-name>sudol</last-name>
9
+ <gender>Male</gender>
10
+ <dob>19801201</dob>
11
+ <state>NY</state>
12
+ <test-types>144028</test-types>
13
+ <test-groups nil="true"></test-groups>
14
+ <reconciled-test-types>144028</reconciled-test-types>
15
+ <home-phone>4155551212</home-phone>
16
+ <work-phone nil="true"></work-phone>
17
+ <mobile-phone nil="true"></mobile-phone>
18
+ <city>New York City</city>
19
+ <zip>10005</zip>
20
+ <address>55 Broad st</address>
21
+ <email>dude@dude.com</email>
22
+ <draw-location>PSC</draw-location>
23
+ <psc>LABCORP, BEVERLY HILLS, 465 N ROXBURY DR STE 715</psc>
24
+ <reference nil="true"></reference>
25
+ <grouping nil="true"></grouping>
26
+ <physicians-name>Bhan, Jason</physicians-name>
27
+ <physicians-upin nil="true"></physicians-upin>
28
+ <physicians-npi>1841295896</physicians-npi>
29
+ <physicians-license>12345</physicians-license>
30
+ <status>approved</status>
31
+ <timestamp>20110914001531</timestamp>
32
+ <reconciled-results>
33
+ <results-summary>
34
+ <clinical-info nil="true"></clinical-info>
35
+ <collection-date type="datetime">2011-09-06T07:00:00Z</collection-date>
36
+ <fasting nil="true"></fasting>
37
+ <lab-patient-id>CB016631A</lab-patient-id>
38
+ <receipt-date type="datetime">2011-09-06T23:07:00Z</receipt-date>
39
+ <reported-date type="datetime">2011-09-06T23:09:00Z</reported-date>
40
+ </results-summary>
41
+ <results-pdf>
42
+ JVBERi0xLjMKJcOiw6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UgMCBSCiAgPj4Kc3RhcnR4cmVmCjIxNTgKJSVFT0YK
43
+ </results-pdf>
44
+ <result type="array">
45
+ <result>
46
+ <customer-id type="integer">170853</customer-id>
47
+ <fasting nil="true"></fasting>
48
+ <hl7message-nte-id nil="true"></hl7message-nte-id>
49
+ <id type="integer">17939</id>
50
+ <lab-abnormal-flag>A</lab-abnormal-flag>
51
+ <lab-facility-director-id type="integer">20</lab-facility-director-id>
52
+ <lab-facility-id type="integer">69</lab-facility-id>
53
+ <lab-id type="integer">129</lab-id>
54
+ <lab-reference-range>NON-REACTIVE</lab-reference-range>
55
+ <observation-date type="datetime">2011-09-06T23:09:00Z</observation-date>
56
+ <obx-sequence-number type="integer">1</obx-sequence-number>
57
+ <order-lab-code>144028</order-lab-code>
58
+ <order-lab-name>Hepatitis C Virus (HCV) Antibody With Reflex to Quantitative Real-time PCR</order-lab-name>
59
+ <parent-lab-code nil="true"></parent-lab-code>
60
+ <result-lab-code>55071600</result-lab-code>
61
+ <result-lab-name>HEPATITIS C ANTIBODY</result-lab-name>
62
+ <result-status>F</result-status>
63
+ <tnp-reason nil="true"></tnp-reason>
64
+ <units-of-measurement nil="true"></units-of-measurement>
65
+ <value>REACTIVE</value>
66
+ <value-type>ST</value-type>
67
+ <notes nil="true"></notes>
68
+ <lab-facility>01: LabCorp Burlington, 1447 York Court, Burlington NC, phone: 972-566-7500</lab-facility>
69
+ <lab-facility-director>MD Hancock William F</lab-facility-director>
70
+ </result>
71
+ <result>
72
+ <customer-id type="integer">170853</customer-id>
73
+ <fasting nil="true"></fasting>
74
+ <hl7message-nte-id type="integer">1203</hl7message-nte-id>
75
+ <id type="integer">17940</id>
76
+ <lab-abnormal-flag>H</lab-abnormal-flag>
77
+ <lab-facility-director-id type="integer">20</lab-facility-director-id>
78
+ <lab-facility-id type="integer">69</lab-facility-id>
79
+ <lab-id type="integer">129</lab-id>
80
+ <lab-reference-range>&lt;1.00</lab-reference-range>
81
+ <observation-date type="datetime">2011-09-06T23:09:00Z</observation-date>
82
+ <obx-sequence-number type="integer">2</obx-sequence-number>
83
+ <order-lab-code>144028</order-lab-code>
84
+ <order-lab-name>Hepatitis C Virus (HCV) Antibody With Reflex to Quantitative Real-time PCR</order-lab-name>
85
+ <parent-lab-code nil="true"></parent-lab-code>
86
+ <result-lab-code>144035</result-lab-code>
87
+ <result-lab-name>SIGNAL TO CUT-OFF</result-lab-name>
88
+ <result-status>F</result-status>
89
+ <tnp-reason nil="true"></tnp-reason>
90
+ <units-of-measurement nil="true"></units-of-measurement>
91
+ <value>12.6</value>
92
+ <value-type>NM</value-type>
93
+ <notes>The patient's sample tests reactive with a high S/CO ratio: &gt; or = 8.0. Samples with high S/CO ratios
94
+ have been shown to repeat as positive using a different methodology 95% of the time or greater. Therefore,
95
+ additional testing for verification of the result is not recommended. (CDC MMWR No. RR-3,2003).
96
+ </notes>
97
+ <lab-facility>01: LabCorp Burlington, 1447 York Court, Burlington NC, phone: 972-566-7500</lab-facility>
98
+ <lab-facility-director>MD Hancock William F</lab-facility-director>
99
+ </result>
100
+ <result>
101
+ <customer-id type="integer">170853</customer-id>
102
+ <fasting nil="true"></fasting>
103
+ <hl7message-nte-id nil="true"></hl7message-nte-id>
104
+ <id type="integer">17941</id>
105
+ <lab-abnormal-flag>H</lab-abnormal-flag>
106
+ <lab-facility-director-id type="integer">20</lab-facility-director-id>
107
+ <lab-facility-id type="integer">69</lab-facility-id>
108
+ <lab-id type="integer">129</lab-id>
109
+ <lab-reference-range>&lt;43</lab-reference-range>
110
+ <observation-date type="datetime">2011-09-06T23:09:00Z</observation-date>
111
+ <obx-sequence-number type="integer">1</obx-sequence-number>
112
+ <order-lab-code>144028</order-lab-code>
113
+ <order-lab-name>Hepatitis C Virus (HCV), Quantitative, Real-time PCR</order-lab-name>
114
+ <parent-lab-code nil="true"></parent-lab-code>
115
+ <result-lab-code>550069</result-lab-code>
116
+ <result-lab-name>HCV RNA, QUANTITATIVE REAL TIME PCR</result-lab-name>
117
+ <result-status>F</result-status>
118
+ <tnp-reason nil="true"></tnp-reason>
119
+ <units-of-measurement>IU/mL</units-of-measurement>
120
+ <value>128</value>
121
+ <value-type>NM</value-type>
122
+ <notes nil="true"></notes>
123
+ <lab-facility>01: LabCorp Burlington, 1447 York Court, Burlington NC, phone: 972-566-7500</lab-facility>
124
+ <lab-facility-director>MD Hancock William F</lab-facility-director>
125
+ </result>
126
+ <result>
127
+ <customer-id type="integer">170853</customer-id>
128
+ <fasting nil="true"></fasting>
129
+ <hl7message-nte-id nil="true"></hl7message-nte-id>
130
+ <id type="integer">17942</id>
131
+ <lab-abnormal-flag>H</lab-abnormal-flag>
132
+ <lab-facility-director-id type="integer">20</lab-facility-director-id>
133
+ <lab-facility-id type="integer">69</lab-facility-id>
134
+ <lab-id type="integer">129</lab-id>
135
+ <lab-reference-range>&lt;1.63</lab-reference-range>
136
+ <observation-date type="datetime">2011-09-06T23:09:00Z</observation-date>
137
+ <obx-sequence-number type="integer">2</obx-sequence-number>
138
+ <order-lab-code>144028</order-lab-code>
139
+ <order-lab-name>Hepatitis C Virus (HCV), Quantitative, Real-time PCR</order-lab-name>
140
+ <parent-lab-code nil="true"></parent-lab-code>
141
+ <result-lab-code>??????</result-lab-code>
142
+ <result-lab-name>HCV RNA, QUANTITATIVE REAL TIME PCR</result-lab-name>
143
+ <result-status>F</result-status>
144
+ <tnp-reason nil="true"></tnp-reason>
145
+ <units-of-measurement>Log IU/mL</units-of-measurement>
146
+ <value>2.11</value>
147
+ <value-type>NM</value-type>
148
+ <notes nil="true"></notes>
149
+ <lab-facility>01: LabCorp Burlington, 1447 York Court, Burlington NC, phone: 972-566-7500</lab-facility>
150
+ <lab-facility-director>MD Hancock William F</lab-facility-director>
151
+ </result>
152
+ <result>
153
+ <customer-id type="integer">170853</customer-id>
154
+ <fasting nil="true"></fasting>
155
+ <hl7message-nte-id type="integer">1204</hl7message-nte-id>
156
+ <id type="integer">17943</id>
157
+ <lab-abnormal-flag>N</lab-abnormal-flag>
158
+ <lab-facility-director-id type="integer">20</lab-facility-director-id>
159
+ <lab-facility-id type="integer">69</lab-facility-id>
160
+ <lab-id type="integer">129</lab-id>
161
+ <lab-reference-range nil="true"></lab-reference-range>
162
+ <observation-date type="datetime">2011-09-06T23:09:00Z</observation-date>
163
+ <obx-sequence-number type="integer">3</obx-sequence-number>
164
+ <order-lab-code>144028</order-lab-code>
165
+ <order-lab-name>Hepatitis C Virus (HCV), Quantitative, Real-time PCR</order-lab-name>
166
+ <parent-lab-code nil="true"></parent-lab-code>
167
+ <result-lab-code>10001538</result-lab-code>
168
+ <result-lab-name nil="true"></result-lab-name>
169
+ <result-status>F</result-status>
170
+ <tnp-reason nil="true"></tnp-reason>
171
+ <units-of-measurement nil="true"></units-of-measurement>
172
+ <value nil="true"></value>
173
+ <value-type>TX</value-type>
174
+ <notes>This test was performed using the COBAS(R)AmpliPrep/ COBAS(R)TaqMan(R)HCV Test Kit (Roche Molecular
175
+ Systems,Inc.).
176
+ </notes>
177
+ <lab-facility>01: LabCorp Burlington, 1447 York Court, Burlington NC, phone: 972-566-7500</lab-facility>
178
+ <lab-facility-director>MD Hancock William F</lab-facility-director>
179
+ </result>
180
+ </result>
181
+ </reconciled-results>
182
+ </customer>
@@ -0,0 +1,36 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <customer>
3
+ <primary-insurance>
4
+ <relationship type="integer">1
5
+ </relationship>
6
+ <company-name>Dude Insurance</company-name>
7
+ <policy-number>1234</policy-number>
8
+ <group-number>555</group-number>
9
+ </primary-insurance>
10
+ <diagnosis-code type="array">
11
+ <diagnosis-code>
12
+ <icd type="integer">9
13
+ </icd>
14
+ <code>250.00</code>
15
+ </diagnosis-code>
16
+ </diagnosis-code>
17
+ <first-name>dan
18
+ </first-name>
19
+ <last-name>dude</last-name>
20
+ <email>dude@dude.com</email>
21
+ <address>my house</address>
22
+ <city>dudeville</city>
23
+ <state>CA</state>
24
+ <zip>90210</zip>
25
+ <dob>19801201</dob>
26
+ <home-phone>4155551212</home-phone>
27
+ <psc type="integer">1752</psc>
28
+ <test-types>001453,120295</test-types>
29
+ <account-number>05021390
30
+ </account-number>
31
+ <gender>Male</gender>
32
+ <draw-location>PSC</draw-location>
33
+ <take-tests-same-day
34
+ type="boolean">true
35
+ </take-tests-same-day>
36
+ </customer>
@@ -23,10 +23,10 @@ describe Medivo::Order do
23
23
  order.errors.messages[:dob].should include "invalid dob. needs to be in '%Y%m%d' format"
24
24
  end
25
25
 
26
- it "test_types should be an array" do
26
+ it "test_types should be an string of test id's delimited by comma" do
27
27
  order = Medivo::Order.new({:test_types=>[1, 2]})
28
28
  order.valid?
29
- order.errors.messages[:test_types].should == nil
29
+ order.errors.messages[:test_types].should be_present
30
30
  end
31
31
 
32
32
  it "sets default fields" do
@@ -45,13 +45,17 @@ describe Medivo::Order do
45
45
  to_return(:body => '<errors><error>Test type not found: 2020</error></errors>',
46
46
  :status => 404)
47
47
  order = Medivo::Order.new(
48
+ :first_name=>'dan',
49
+ :last_name=>'dude',
48
50
  :email => "dude@dude.com",
49
51
  :address=> "my house",
52
+ :city=> "dudeville",
53
+ :state=> "CA",
50
54
  :zip=> "90210",
51
55
  :dob=> "19801201",
52
56
  :home_phone=> "4155551212",
53
57
  :psc=> 11,
54
- :test_types=> [2020],
58
+ :test_types=> "2020",
55
59
  :account_number => "423",
56
60
  :gender => "Male",
57
61
  :dob => "19801201")
@@ -72,13 +76,17 @@ describe Medivo::Order do
72
76
 
73
77
  it "creates valid order" do
74
78
  order = Medivo::Order.new(
79
+ :first_name=>'dan',
80
+ :last_name=>'dude',
75
81
  :email => "dude@dude.com",
76
82
  :address=> "my house",
83
+ :city=> "dudeville",
84
+ :state=> "CA",
77
85
  :zip=> "90210",
78
86
  :dob=> "19801201",
79
87
  :home_phone=> "4155551212",
80
- :psc=> 11,
81
- :test_types=> [2020],
88
+ :psc=> 11, # lab_id
89
+ :test_types=> "2020", # test_id's
82
90
  :account_number => "423",
83
91
  :gender => "Male",
84
92
  :dob => "19801201")
@@ -86,8 +94,7 @@ describe Medivo::Order do
86
94
  order.valid?.should == true
87
95
 
88
96
  stub_request(:post, "http://test:test@test.medivo.com/customers.xml").
89
- to_return(:body => order.to_xml,
90
- :status => 200)
97
+ to_return(:body => order.to_xml, :status => 200)
91
98
 
92
99
  order.save.should == true
93
100
  end
@@ -108,6 +115,55 @@ describe Medivo::Order do
108
115
  end
109
116
  end
110
117
 
118
+ describe "#results" do
119
+ before(:all) do
120
+ @reqiuisition_number = 170853
121
+ order = Medivo::Order.new(:requisition_number=>@reqiuisition_number)
122
+ stub_request(:get, "test:test@test.medivo.com/customers/#{order.requisition_id}.xml?include=reconciled_results").
123
+ to_return(:body => File.read(("#{ENGINE_PATH}/spec/fixtures/lc_positive_results.xml")))
124
+
125
+ end
126
+
127
+ describe "#find_with_results" do
128
+ before(:all) { @order = Medivo::Order.find_with_results(@reqiuisition_number) }
129
+
130
+ it "gets order with results" do
131
+ @order.should_not be_nil
132
+ end
133
+
134
+ it "has test names" do
135
+ @order.results.collect(&:result_lab_name).should == ["HEPATITIS C ANTIBODY", "SIGNAL TO CUT-OFF", "HCV RNA, QUANTITATIVE REAL TIME PCR", "HCV RNA, QUANTITATIVE REAL TIME PCR", nil]
136
+ end
137
+
138
+ it "has reconcilled results" do
139
+ @order.results_summary.should_not be_nil
140
+ end
141
+ end
142
+ end
143
+
144
+ end
145
+
146
+ describe Medivo::PrimaryInsurance do
147
+ it "makes valid model" do
148
+ insurance_info = Medivo::PrimaryInsurance.new(
149
+ :relationship=>1,
150
+ :company_name=>"Dude Insurance",
151
+ :policy_number=>"1234",
152
+ :group_number =>"555"
153
+ )
154
+ insurance_info.valid?.should == true
155
+ end
156
+
157
+ it "shows error messages for invalid model" do
158
+ insurance_info = Medivo::PrimaryInsurance.new(
159
+ :company_name=>"Dude Insurance",
160
+ :policy_number=>"1234",
161
+ :group_number =>"555"
162
+ )
163
+ insurance_info.valid?.should == false
164
+ insurance_info.errors.messages.keys.should == [:relationship]
165
+ insurance_info.errors.messages[:relationship].should include "can't be blank"
166
+ end
111
167
  end
112
168
 
113
169
  describe Medivo::InsuranceOrder do
@@ -117,10 +173,53 @@ describe Medivo::InsuranceOrder do
117
173
  order.errors.messages[:primary_insurance].should include "primary_insurance field must be present"
118
174
  end
119
175
 
120
- it "primary insurance should have all required fields" do
176
+ it "shows missing fields from primary insurance" do
121
177
  order = Medivo::InsuranceOrder.new(:primary_insurance => Medivo::PrimaryInsurance.new)
122
178
  order.valid?
123
- order.errors.messages[:"primary_insurance.company_name"].should include "primary_insurance company_name must be present"
124
- order.errors.messages[:"primary_insurance.relationship"].should include "primary_insurance relationship field must be the value 1"
179
+ order.errors.messages[:"primary_insurance.company_name"].should include "can't be blank"
180
+ order.errors.messages[:"primary_insurance.relationship"].should include "can't be blank"
125
181
  end
126
182
  end
183
+
184
+ describe "creating orders" do
185
+ it "UHC Commercial insurance order" do
186
+ insurance_info = Medivo::PrimaryInsurance.new(
187
+ :relationship=>1,
188
+ :company_name=>"Dude Insurance",
189
+ :policy_number=>"1234",
190
+ :group_number =>"555"
191
+ )
192
+
193
+ order = Medivo::InsuranceOrder.new(
194
+ :primary_insurance => insurance_info,
195
+ :diagnosis_code => [{:icd=>9, :code=>'250.00'}],
196
+ :first_name=>'dan',
197
+ :last_name=>'dude',
198
+ :email => "dude@dude.com",
199
+ :address=> "my house",
200
+ :city=> "dudeville",
201
+ :state=> "CA",
202
+ :zip=> "90210",
203
+ :dob=> "19801201",
204
+ :home_phone=> "4155551212",
205
+ :psc=> 1752, # lab_id
206
+ :test_types=>"001453,120295", # test_id's
207
+ :account_number => "05021390",
208
+ :gender => "Male",
209
+ :dob => "19801201"
210
+ )
211
+
212
+
213
+ mock.proxy(order).to_xml({}) do |value|
214
+ value.gsub(/\s/, '').should == File.read("#{ENGINE_PATH}/spec/fixtures/valid_uhc_order.xml").gsub(/\s/, '')
215
+ value
216
+ end
217
+
218
+ stub_request(:post, "http://test:test@test.medivo.com/customers.xml").to_return(:status=> 200)
219
+
220
+ order.save
221
+ order.errors.messages.should be_empty
222
+ end
223
+ end
224
+
225
+
@@ -1,55 +1,55 @@
1
- #BeverlyHillsZipCode = Medivo::ZipCode.new(
2
- # {
3
- # :city => "Beverly Hills",
4
- # :state_short => "CA",
5
- # :zip_code => "90210",
6
- # :lat => 34.0901,
7
- # :lng => -118.4065
8
- # }
9
- #)
10
1
 
11
2
  BeverlyHillsLab1 = Medivo::Lab.new(
12
- {
13
- "id"=>1752,
14
- "lab_id"=> 129,
15
- "name"=>"LABCORP, BEVERLY HILLS, 465 N ROXBURY DR STE 715",
16
- "active"=>true,
17
- "address"=>"465 N ROXBURY DR STE 715",
18
- "city"=>"BEVERLY HILLS",
19
- "code"=>"20060",
20
- "distance"=>"1.4191127132891",
21
- "hours"=>"MONDAY-FRIDAY LUNCH SATURDAY, 8:00AM-5:00PM NOON-1:00PM 9:00AM-1:00PM",
22
- "lat"=>"34.06831",
23
- "lng"=>"-118.40716",
24
- "long"=>"-118.40716",
25
- "state"=>"CA",
26
- "telephone"=>"310-275-4953",
27
- "type_of_service"=>"Routine Clinical Laboratory Collections, Pediatric",
28
- "updated_at"=>"2011-01-25T09:51:11Z",
29
- "zip"=>"90210"
30
- }
3
+ "id"=>1752,
4
+ "lab_id"=> 129,
5
+ "name"=>"LABCORP, BEVERLY HILLS, 465 N ROXBURY DR STE 715",
6
+ "active"=>true,
7
+ "address"=>"465 N ROXBURY DR STE 715",
8
+ "city"=>"BEVERLY HILLS",
9
+ "code"=>"20060",
10
+ "distance"=>"1.4191127132891",
11
+ "hours"=>"MONDAY-FRIDAY LUNCH SATURDAY, 8:00AM-5:00PM NOON-1:00PM 9:00AM-1:00PM",
12
+ "lat"=>"34.06831",
13
+ "lng"=>"-118.40716",
14
+ "long"=>"-118.40716",
15
+ "state"=>"CA",
16
+ "telephone"=>"310-275-4953",
17
+ "type_of_service"=>"Routine Clinical Laboratory Collections, Pediatric",
18
+ "updated_at"=>"2011-01-25T09:51:11Z",
19
+ "zip"=>"90210"
31
20
  )
32
21
 
33
22
  BeverlyHillsLab2 = Medivo::Lab.new(
34
- {
35
- "id"=>1753,
36
- "lab_id"=>129,
37
- "name"=>"LABCORP, LOS ANGELES, 8737 BEVERLY BLVD STE 401",
38
- "active"=>true,
39
- "address"=>"8737 BEVERLY BLVD STE 401",
40
- "city"=>"LOS ANGELES",
41
- "code"=>"22974",
42
- "distance"=>"1.6266877775802",
43
- "fax"=>"310-652-0676",
44
- "hours"=>"MONDAY-FRIDAY LUNCH, 8:00AM-5:00PM NOON-1:00PM",
45
- "lat"=>"34.076852",
46
- "lng"=>"-118.381669",
47
- "long"=>"-118.381669",
48
- "state"=>"CA",
49
- "telephone"=>"310-652-0542",
50
- "type_of_service"=>"Routine Clinical Laboratory Collections, Pediatric",
51
- "updated_at"=>"2011-01-25T09:51:17Z",
52
- "zip"=>"90048"
53
- }
23
+ "id"=>1753,
24
+ "lab_id"=>129,
25
+ "name"=>"LABCORP, LOS ANGELES, 8737 BEVERLY BLVD STE 401",
26
+ "active"=>true,
27
+ "address"=>"8737 BEVERLY BLVD STE 401",
28
+ "city"=>"LOS ANGELES",
29
+ "code"=>"22974",
30
+ "distance"=>"1.6266877775802",
31
+ "fax"=>"310-652-0676",
32
+ "hours"=>"MONDAY-FRIDAY LUNCH, 8:00AM-5:00PM NOON-1:00PM",
33
+ "lat"=>"34.076852",
34
+ "lng"=>"-118.381669",
35
+ "long"=>"-118.381669",
36
+ "state"=>"CA",
37
+ "telephone"=>"310-652-0542",
38
+ "type_of_service"=>"Routine Clinical Laboratory Collections, Pediatric",
39
+ "updated_at"=>"2011-01-25T09:51:17Z",
40
+ "zip"=>"90048"
54
41
  )
55
42
 
43
+
44
+ Order1 = Medivo::Order.new(
45
+ :email => "dude@dude.com",
46
+ :address=> "my house",
47
+ :zip=> "10005",
48
+ :dob=> "19801201",
49
+ :home_phone=> "4155551212",
50
+ :psc=> 11,
51
+ :test_types=> [144028],
52
+ :account_number => "423",
53
+ :gender => "Male",
54
+ :dob => "19801201"
55
+ )
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: medivo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8
4
+ version: 0.0.9
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,12 +9,12 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-10-27 00:00:00.000000000 +01:00
12
+ date: 2011-10-28 00:00:00.000000000 +01:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rails
17
- requirement: &2168647680 !ruby/object:Gem::Requirement
17
+ requirement: &2173497960 !ruby/object:Gem::Requirement
18
18
  none: false
19
19
  requirements:
20
20
  - - ~>
@@ -22,10 +22,10 @@ dependencies:
22
22
  version: 3.1.0
23
23
  type: :runtime
24
24
  prerelease: false
25
- version_requirements: *2168647680
25
+ version_requirements: *2173497960
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: jquery-rails
28
- requirement: &2168647260 !ruby/object:Gem::Requirement
28
+ requirement: &2173496800 !ruby/object:Gem::Requirement
29
29
  none: false
30
30
  requirements:
31
31
  - - ! '>='
@@ -33,10 +33,10 @@ dependencies:
33
33
  version: '0'
34
34
  type: :runtime
35
35
  prerelease: false
36
- version_requirements: *2168647260
36
+ version_requirements: *2173496800
37
37
  - !ruby/object:Gem::Dependency
38
38
  name: coffee-script
39
- requirement: &2168646800 !ruby/object:Gem::Requirement
39
+ requirement: &2173495660 !ruby/object:Gem::Requirement
40
40
  none: false
41
41
  requirements:
42
42
  - - ! '>='
@@ -44,10 +44,10 @@ dependencies:
44
44
  version: '0'
45
45
  type: :runtime
46
46
  prerelease: false
47
- version_requirements: *2168646800
47
+ version_requirements: *2173495660
48
48
  - !ruby/object:Gem::Dependency
49
49
  name: haml-rails
50
- requirement: &2168646380 !ruby/object:Gem::Requirement
50
+ requirement: &2173494760 !ruby/object:Gem::Requirement
51
51
  none: false
52
52
  requirements:
53
53
  - - ! '>='
@@ -55,10 +55,10 @@ dependencies:
55
55
  version: '0'
56
56
  type: :runtime
57
57
  prerelease: false
58
- version_requirements: *2168646380
58
+ version_requirements: *2173494760
59
59
  - !ruby/object:Gem::Dependency
60
60
  name: mysql2
61
- requirement: &2168645880 !ruby/object:Gem::Requirement
61
+ requirement: &2173491620 !ruby/object:Gem::Requirement
62
62
  none: false
63
63
  requirements:
64
64
  - - ~>
@@ -66,10 +66,10 @@ dependencies:
66
66
  version: 0.3.7
67
67
  type: :runtime
68
68
  prerelease: false
69
- version_requirements: *2168645880
69
+ version_requirements: *2173491620
70
70
  - !ruby/object:Gem::Dependency
71
71
  name: geocoder
72
- requirement: &2168645460 !ruby/object:Gem::Requirement
72
+ requirement: &2173490220 !ruby/object:Gem::Requirement
73
73
  none: false
74
74
  requirements:
75
75
  - - ! '>='
@@ -77,7 +77,7 @@ dependencies:
77
77
  version: '0'
78
78
  type: :runtime
79
79
  prerelease: false
80
- version_requirements: *2168645460
80
+ version_requirements: *2173490220
81
81
  description: Use the medivo platform to make a lab order or find a lab location
82
82
  email:
83
83
  - dsudol@medivo.com
@@ -99,6 +99,10 @@ files:
99
99
  - app/assets/images/medivo/markerJ.png
100
100
  - app/assets/images/medivo/markerK.png
101
101
  - app/assets/javascripts/medivo/handlebars.js
102
+ - app/assets/javascripts/medivo/lab_appointments/application.js
103
+ - app/assets/javascripts/medivo/lab_appointments/models.coffee
104
+ - app/assets/javascripts/medivo/lab_appointments/sample/show_appointments.coffee
105
+ - app/assets/javascripts/medivo/lab_appointments/views.coffee
102
106
  - app/assets/javascripts/medivo/lab_list/application.js
103
107
  - app/assets/javascripts/medivo/lab_list/init.coffee
104
108
  - app/assets/javascripts/medivo/lab_list/models.coffee
@@ -197,6 +201,8 @@ files:
197
201
  - spec/dummy/tmp/cache/assets/E04/890/sprockets%2F2f5173deea6c795b8fdde723bb4b63af
198
202
  - spec/dummy/tmp/cache/assets/E59/D50/sprockets%2Fbe1cc4d9b0efb617e58baa16dd1dee58
199
203
  - spec/dummy/tmp/pids/server.pid
204
+ - spec/fixtures/lc_positive_results.xml
205
+ - spec/fixtures/valid_uhc_order.xml
200
206
  - spec/models/labs_spec.rb
201
207
  - spec/models/orders_spec.rb
202
208
  - spec/requests/labs_spec.rb
@@ -217,7 +223,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
217
223
  version: '0'
218
224
  segments:
219
225
  - 0
220
- hash: 1468048922068634242
226
+ hash: 2372410355728827398
221
227
  required_rubygems_version: !ruby/object:Gem::Requirement
222
228
  none: false
223
229
  requirements:
@@ -226,7 +232,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
226
232
  version: '0'
227
233
  segments:
228
234
  - 0
229
- hash: 1468048922068634242
235
+ hash: 2372410355728827398
230
236
  requirements: []
231
237
  rubyforge_project:
232
238
  rubygems_version: 1.6.2
@@ -307,6 +313,8 @@ test_files:
307
313
  - spec/dummy/tmp/cache/assets/E04/890/sprockets%2F2f5173deea6c795b8fdde723bb4b63af
308
314
  - spec/dummy/tmp/cache/assets/E59/D50/sprockets%2Fbe1cc4d9b0efb617e58baa16dd1dee58
309
315
  - spec/dummy/tmp/pids/server.pid
316
+ - spec/fixtures/lc_positive_results.xml
317
+ - spec/fixtures/valid_uhc_order.xml
310
318
  - spec/models/labs_spec.rb
311
319
  - spec/models/orders_spec.rb
312
320
  - spec/requests/labs_spec.rb