medivo 0.1.3 → 0.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. data/app/assets/javascripts/medivo/lab_appointment/handlers.coffee +12 -6
  2. data/app/assets/javascripts/medivo/lab_list/handlers.coffee +6 -1
  3. data/app/controllers/medivo/labs_controller.rb +1 -1
  4. data/app/models/medivo/order.rb +14 -1
  5. data/lib/medivo/version.rb +1 -1
  6. data/lib/medivo.rb +6 -1
  7. data/lib/{medivo → pdf/medivo}/fdf_generator.rb +0 -0
  8. data/lib/pdf/medivo/pdf_generator.rb +18 -0
  9. data/lib/pdf/medivo/pdf_group.rb +42 -0
  10. data/lib/{medivo → support}/validators.rb +0 -0
  11. data/spec/dummy/app/views/labs/search.html.haml +8 -8
  12. data/spec/dummy/log/development.log +1080 -0
  13. data/spec/dummy/tmp/cache/assets/C46/F00/sprockets%2F2281d588b540056c5a7306c32a3761b9 +0 -0
  14. data/spec/dummy/tmp/cache/assets/CB4/BD0/sprockets%2F3378f27c0d4f5e6d708665b22707a31f +0 -0
  15. data/spec/dummy/tmp/cache/assets/CD8/DA0/sprockets%2F622aa5281d15503829a5f7a0bf56fc29 +0 -0
  16. data/spec/dummy/tmp/cache/assets/D20/F10/sprockets%2Fb2e907e4faa85fe755f4439e3b229088 +0 -0
  17. data/spec/dummy/tmp/cache/assets/D29/000/sprockets%2F61a10ddf57f1129c02a1049bfed6e007 +0 -0
  18. data/spec/dummy/tmp/cache/assets/D41/250/sprockets%2F7b3c4426715dcd1feedc4a95e5444256 +0 -0
  19. data/spec/dummy/tmp/cache/assets/D4C/7A0/sprockets%2Fbc635c7b186d1ef5178f4ed3722d868b +0 -0
  20. data/spec/dummy/tmp/cache/assets/D5D/3E0/sprockets%2F63fea6cc142b5f02da93bf81e70b2116 +0 -0
  21. data/spec/dummy/tmp/cache/assets/D60/030/sprockets%2Ffc9485f617fc5e9b8918755d2e08ecc6 +0 -0
  22. data/spec/dummy/tmp/cache/assets/D69/130/sprockets%2Fbaa4ec50a34ce938c986612c2a47a64e +0 -0
  23. data/spec/dummy/tmp/cache/assets/D74/9A0/sprockets%2F0ca4e6e833c72156fc7e7d5f007d9ce3 +0 -0
  24. data/spec/dummy/tmp/cache/assets/D76/720/sprockets%2F88d8aa1d2fb41ce79b8ec4150ea74748 +0 -0
  25. data/spec/dummy/tmp/cache/assets/D84/210/sprockets%2Fabd0103ccec2b428ac62c94e4c40b384 +0 -0
  26. data/spec/dummy/tmp/cache/assets/DCE/E80/sprockets%2Fc71ec62157b9cc7aabfc030955cef87b +0 -0
  27. data/spec/dummy/tmp/cache/assets/E04/890/sprockets%2F2f5173deea6c795b8fdde723bb4b63af +0 -0
  28. data/spec/dummy/tmp/pids/server.pid +1 -0
  29. data/spec/fixtures/lc_order_with_normal_results.xml +98 -0
  30. data/spec/fixtures/{lc_positive_results.xml → lc_order_with_positive_results.xml} +0 -0
  31. data/spec/fixtures/{order_with_requisition.xml → lc_order_with_requisition.xml} +0 -0
  32. data/spec/fixtures/negative_results.pdf +0 -0
  33. data/spec/lib/fdf_generator_spec.rb +22 -0
  34. data/spec/lib/pdf_generator_spec.rb +12 -0
  35. data/spec/lib/pdf_group_spec.rb +42 -0
  36. data/spec/models/orders_spec.rb +46 -28
  37. data/spec/spec_helper.rb +3 -0
  38. metadata +54 -29
@@ -0,0 +1 @@
1
+ 50391
@@ -0,0 +1,98 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <customer>
3
+ <id>170850</id>
4
+ <requisition-number>170850</requisition-number>
5
+ <account-number>05021370</account-number>
6
+ <confirmation-code>5Fe976AdeT</confirmation-code>
7
+ <first-name>daniel</first-name>
8
+ <last-name>sudol</last-name>
9
+ <gender>Male</gender>
10
+ <dob>19140303</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>apinto+unknown_email_agent_order@medivo.com</email>
22
+ <draw-location>PSC</draw-location>
23
+ <psc>LABCORP, NEW YORK, 65 BROADWAY SUITE 905</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>20110913221637</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
+ JVBERi0xLjMKJcOiw6PDj8OTCgoxIDAgb2JqCjw8IC9UeXBlIC9DYXRhbG9nCi9PdXRsaW5lcyAyIDAgUgovUGFnZXMgMyAwIFI+PgplbmRvYmoKMiAwIG9iago8PCAvVHlwZSAvT3V0bGluZXMgPj4KZW5kb2JqCjMgMCBvYmoKPDwgL1R5cGUgL1BhZ2VzCi9LaWRzIFs2IDAgUgpdCi9Db3VudCAxCi9SZXNvdXJjZXMgPDwKL1Byb2NTZXQgNCAwIFIKL0ZvbnQgPDwgCi9GMSA4IDAgUgovRjIgOSAwIFIgPj4KPj4KL01lZGlhQm94IFswIDAgNTk1LjI4IDg0MS44OV0KID4+CmVuZG9iago0IDAgb2JqClsvUERGIC9UZXh0IF0KZW5kb2JqCjUgMCBvYmoKPDwKL0NyZWF0aW9uRGF0ZSAoRDoyMDExMDkx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udAovU3VidHlwZSAvVHlwZTEKL05hbWUgL0YxCi9CYXNlRm9udCAvQ291cmllcgovRW5jb2RpbmcgL1dpbkFuc2lFbmNvZGluZwo+PgplbmRvYmoKOSAwIG9iago8PCAvVHlwZSAvRm9udAovU3VidHlwZSAvVHlwZTEKL05hbWUgL0YyCi9CYXNlRm9udCAvQ291cmllci1Cb2xkCi9FbmNvZGluZyAvV2luQW5zaUVuY29kaW5nCj4+CmVuZG9iagp4cmVmCjAgMTAKMDAwMDAwMDAwMCA2NTUzNSBmIAowMDAwMDAwMDE5IDAwMDAwIG4gCjAwMDAwMDAwODMgMDAwMDAgbiAKMDAwMDAwMDEyMCAwMDAwMCBuIAowMDAwMDAwMjc0IDAwMDAwIG4gCjAwMDAwMDAzMDMgMDAwMDAgbiAKMDAwMDAwMDQyNCAwMDAwMCBuIAowMDAwMDAwNDg3IDAwMDAwIG4gCjAwMDAwMDE5MzEgMDAwMDAgbiAKMDAwMDAwMjAzNiAwMDAwMCBuIAoKdHJhaWxlcgogIDw8IC9TaXplIDEwCiAgICAgL1Jvb3QgMSAwIFIKIC9JbmZvIDUgMCBSCiAgPj4Kc3RhcnR4cmVmCjIxNDYKJSVFT0YK
43
+ </results-pdf>
44
+ <result type="array">
45
+ <result>
46
+ <customer-id type="integer">170850</customer-id>
47
+ <fasting nil="true"></fasting>
48
+ <hl7message-nte-id nil="true"></hl7message-nte-id>
49
+ <id type="integer">17934</id>
50
+ <lab-abnormal-flag>N</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>?????</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">170850</customer-id>
73
+ <fasting nil="true"></fasting>
74
+ <hl7message-nte-id type="integer">1201</hl7message-nte-id>
75
+ <id type="integer">17935</id>
76
+ <lab-abnormal-flag>N</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>0</value>
92
+ <value-type>NM</value-type>
93
+ <lab-facility>01: LabCorp Burlington, 1447 York Court, Burlington NC, phone: 972-566-7500</lab-facility>
94
+ <lab-facility-director>MD Hancock William F</lab-facility-director>
95
+ </result>
96
+ </result>
97
+ </reconciled-results>
98
+ </customer>
Binary file
@@ -0,0 +1,22 @@
1
+ require 'spec_helper'
2
+
3
+ describe Medivo::FdfGenerator do
4
+ before(:all) do
5
+ @birth_date = '12/23/1901'
6
+ @fdf = Medivo::FdfGenerator.file({:patient_name=>'jane', :birth_date=>@birth_date , :result_date=> '12/24/1901', :missing=>'dude'})
7
+ end
8
+
9
+ it "generate fdf" do
10
+ fdf = open(@fdf.path, 'r:ascii-8bit').read
11
+ fdf.should == "%FDF-1.2\r%\xE2\xE3\xCF\xD3\r\n1 0 obj\r<< \r/FDF << /Fields [ << /T (patient_name) /V (jane) /ClrF 2 /ClrFf 1 >> << /T (birth_date) /V (12/23/1901) /ClrF 2 /ClrFf 1 >> << /T (result_date) /V (12/24/1901) /ClrF 2 /ClrFf 1 >> << /T (missing) /V (dude) /ClrF 2 /ClrFf 1 >> ] \r>> \r>> \rendobj\rtrailer\r<<\r/Root 1 0 R \r\r>>\r%%EOF\r\n"
12
+ end
13
+
14
+ it "fill in pdf form" do
15
+ pdf_output = `pdftk "#{ENGINE_PATH}/spec/fixtures/negative_results.pdf" fill_form #{@fdf.path} output - flatten`
16
+ text = pdf_to_text(pdf_output)
17
+ text.should =~ /jane/
18
+ text.should =~ Regexp.new(@birth_date)
19
+ text.should =~ Regexp.new('12/24/1901')
20
+ text.should_not =~ /we rock/
21
+ end
22
+ end
@@ -0,0 +1,12 @@
1
+ require 'spec_helper'
2
+
3
+ describe Medivo::PdfGenerator do
4
+
5
+ it "#variable_fields generates pdf by filling in the variables" do
6
+ name = "Duderoni"
7
+ path = "#{ENGINE_PATH}/spec/fixtures/negative_results.pdf"
8
+ pdf_file = Medivo::PdfGenerator.variable_fields(path, {:patient_name=>name})
9
+ text = pdf_to_text(pdf_file.read)
10
+ text.should =~ /#{name}/
11
+ end
12
+ end
@@ -0,0 +1,42 @@
1
+ require 'spec_helper'
2
+
3
+ describe Medivo::PdfGroup do
4
+
5
+ it "#variable_fields" do
6
+ name = "Duderoni"
7
+ path = "#{ENGINE_PATH}/spec/fixtures/negative_results.pdf"
8
+ pdf = Medivo::PdfGroup.create do |pdf|
9
+ pdf.variable_fields(path, {:patient_name=>name})
10
+ end
11
+ text = pdf_to_text(pdf.read)
12
+ text.should =~ /#{name}/
13
+ end
14
+
15
+ it "#lab_requisition" do
16
+ reqiuisition_number = 170420
17
+ order = Medivo::Order.new(:requisition_number=> reqiuisition_number)
18
+ stub_request(:get, "test:test@test.medivo.com/customers/#{order.requisition_id}.xml?include=requisition").
19
+ to_return(:body => File.read("#{ENGINE_PATH}/spec/fixtures/lc_order_with_requisition.xml"))
20
+
21
+ pdf = Medivo::PdfGroup.create do |pdf|
22
+ pdf.lab_requisition(reqiuisition_number)
23
+ end
24
+
25
+ text = pdf_to_text(pdf.read)
26
+ text.should match /Account #:111111111 Req\/Control #:170420/
27
+ end
28
+
29
+ it "#lab_result" do
30
+ reqiuisition_number = 170420
31
+ order = Medivo::Order.new(:requisition_number=>reqiuisition_number)
32
+ stub_request(:get, "test:test@test.medivo.com/customers/#{order.requisition_id}.xml?include=reconciled_results").
33
+ to_return(:body => File.read(("#{ENGINE_PATH}/spec/fixtures/lc_order_with_positive_results.xml")))
34
+
35
+ pdf = Medivo::PdfGroup.create do |pdf|
36
+ pdf.lab_result(reqiuisition_number)
37
+ end
38
+
39
+ text = pdf_to_text(pdf.read)
40
+ text.should match /COLLECTED:2011-09-06 RECEIVED:2011-09-06 REPORTED:2011-09-06/
41
+ end
42
+ end
@@ -115,57 +115,75 @@ describe Medivo::Order do
115
115
  end
116
116
  end
117
117
 
118
- describe "#requisition" do
118
+ describe "getting requisitions with" do
119
119
 
120
- before(:all) do
120
+ before(:each) do
121
121
  @reqiuisition_number = 170420
122
122
  order = Medivo::Order.new(:requisition_number=> @reqiuisition_number)
123
123
  stub_request(:get, "test:test@test.medivo.com/customers/#{order.requisition_id}.xml?include=requisition").
124
- to_return(:body => File.read(("#{ENGINE_PATH}/spec/fixtures/order_with_requisition.xml")))
124
+ to_return(:body => File.read("#{ENGINE_PATH}/spec/fixtures/lc_order_with_requisition.xml"))
125
125
  end
126
+ let(:order) { Medivo::Order.find_with_requisition(@reqiuisition_number) }
126
127
 
127
- describe "#find_with_requisition" do
128
- let(:order) { Medivo::Order.find_with_requisition(@reqiuisition_number) }
129
-
130
- it "gets order with requisition" do
131
- order.should_not be_nil
132
- end
133
-
134
- it "has reconcilled results" do
135
- order.requisition.should_not be_nil
136
- end
128
+ it "#find_with_requisition finds the order including the requisition info" do
129
+ order.should_not be_nil
130
+ order.sameday_requisition.should_not be_nil
131
+ end
137
132
 
133
+ it "#pdf_requisition returns requisition as pdf" do
134
+ pdf = order.pdf_requisition
135
+ text = pdf_to_text(pdf)
136
+ text.should match /This order expires 2012-02-12/
137
+ text.should match /Account #:111111111 Req\/Control #:170420/
138
+ text.should match /Draw Location LABCORP, BEVERLY HILLS, 465 N ROXBURY DR STE 715 BEVERLY HILLS, CA/
138
139
  end
139
140
 
141
+ it "class method #pdf_requisition returns pdf requisition" do
142
+ pdf = Medivo::Order.pdf_requisition(@reqiuisition_number)
143
+ text = pdf_to_text(pdf)
144
+ text.should match /This order expires 2012-02-12/
145
+ text.should match /Account #:111111111 Req\/Control #:170420/
146
+ text.should match /Draw Location LABCORP, BEVERLY HILLS, 465 N ROXBURY DR STE 715 BEVERLY HILLS, CA/
147
+ end
140
148
  end
141
149
 
142
- describe "#results" do
150
+ describe "getting results with" do
143
151
 
144
- before(:all) do
152
+ before(:each) do
145
153
  @reqiuisition_number = 170853
146
154
  order = Medivo::Order.new(:requisition_number=>@reqiuisition_number)
147
155
  stub_request(:get, "test:test@test.medivo.com/customers/#{order.requisition_id}.xml?include=reconciled_results").
148
- to_return(:body => File.read(("#{ENGINE_PATH}/spec/fixtures/lc_positive_results.xml")))
156
+ to_return(:body => File.read(("#{ENGINE_PATH}/spec/fixtures/lc_order_with_positive_results.xml")))
149
157
 
150
158
  end
151
159
 
152
- describe "#find_with_results" do
153
- let(:order) { Medivo::Order.find_with_results(@reqiuisition_number) }
160
+ let(:order) { Medivo::Order.find_with_results(@reqiuisition_number) }
154
161
 
155
- it "gets order with results" do
156
- order.should_not be_nil
157
- end
162
+ it "#find_with_results finds the order including results info" do
163
+ order.should_not be_nil
164
+ end
158
165
 
159
- it "has test names" do
160
- 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]
161
- end
166
+ it "#results returns results info like test names" do
167
+ order.results.should_not be_nil
168
+ 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]
169
+ end
162
170
 
163
- it "has reconcilled results" do
164
- order.results_summary.should_not be_nil
165
- end
171
+ it "#results_summary returns has reconcilled results" do
172
+ order.results_summary.should_not be_nil
173
+ end
174
+
175
+ it "#pdf_result returns has results as pdf" do
176
+ pdf = order.pdf_result
177
+ text = pdf_to_text(pdf)
178
+ text.should match /COLLECTED:2011-09-06 RECEIVED:2011-09-06 REPORTED:2011-09-06/
166
179
  end
167
- end
168
180
 
181
+ it "class method #pdf_result returns has results as pdf" do
182
+ pdf = Medivo::Order.pdf_result(@reqiuisition_number)
183
+ text = pdf_to_text(pdf)
184
+ text.should match /COLLECTED:2011-09-06 RECEIVED:2011-09-06 REPORTED:2011-09-06/
185
+ end
186
+ end
169
187
  end
170
188
 
171
189
  describe Medivo::InsuranceOrder do
data/spec/spec_helper.rb CHANGED
@@ -38,7 +38,10 @@ end
38
38
  ENGINE_PATH = File.expand_path('../..', __FILE__) unless defined? ENGINE_PATH
39
39
  Spork.each_run do
40
40
  Dir["#{Rails.root}/app/**/*.rb"].each { |f| load f }
41
+
41
42
  Dir["#{ENGINE_PATH}/app/**/*.rb"].each { |f| load f }
43
+ Dir["#{ENGINE_PATH}/lib/support/**/*.rb"].each { |f| load f }
44
+ Dir["#{ENGINE_PATH}/lib/pdf/**/*.rb"].each { |f| load f }
42
45
  load "#{ENGINE_PATH}/config/routes.rb"
43
46
  load "#{ENGINE_PATH}/spec/support/blueprints.rb"
44
47
  end
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.1.3
4
+ version: 0.1.4
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-11-03 00:00:00.000000000 -04:00
12
+ date: 2011-11-04 00:00:00.000000000 -04:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rails
17
- requirement: &2165411280 !ruby/object:Gem::Requirement
17
+ requirement: &2158697260 !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: *2165411280
25
+ version_requirements: *2158697260
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: jquery-rails
28
- requirement: &2165410860 !ruby/object:Gem::Requirement
28
+ requirement: &2158696840 !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: *2165410860
36
+ version_requirements: *2158696840
37
37
  - !ruby/object:Gem::Dependency
38
38
  name: coffee-script
39
- requirement: &2165410380 !ruby/object:Gem::Requirement
39
+ requirement: &2158696360 !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: *2165410380
47
+ version_requirements: *2158696360
48
48
  - !ruby/object:Gem::Dependency
49
49
  name: haml-rails
50
- requirement: &2165409960 !ruby/object:Gem::Requirement
50
+ requirement: &2158695940 !ruby/object:Gem::Requirement
51
51
  none: false
52
52
  requirements:
53
53
  - - ! '>='
@@ -55,21 +55,21 @@ dependencies:
55
55
  version: '0'
56
56
  type: :runtime
57
57
  prerelease: false
58
- version_requirements: *2165409960
58
+ version_requirements: *2158695940
59
59
  - !ruby/object:Gem::Dependency
60
- name: mysql2
61
- requirement: &2165409440 !ruby/object:Gem::Requirement
60
+ name: geocoder
61
+ requirement: &2158695500 !ruby/object:Gem::Requirement
62
62
  none: false
63
63
  requirements:
64
- - - ~>
64
+ - - ! '>='
65
65
  - !ruby/object:Gem::Version
66
- version: 0.3.7
66
+ version: '0'
67
67
  type: :runtime
68
68
  prerelease: false
69
- version_requirements: *2165409440
69
+ version_requirements: *2158695500
70
70
  - !ruby/object:Gem::Dependency
71
- name: geocoder
72
- requirement: &2165409000 !ruby/object:Gem::Requirement
71
+ name: rest-client
72
+ requirement: &2158695080 !ruby/object:Gem::Requirement
73
73
  none: false
74
74
  requirements:
75
75
  - - ! '>='
@@ -77,10 +77,21 @@ dependencies:
77
77
  version: '0'
78
78
  type: :runtime
79
79
  prerelease: false
80
- version_requirements: *2165409000
80
+ version_requirements: *2158695080
81
81
  - !ruby/object:Gem::Dependency
82
- name: rest-client
83
- requirement: &2165408540 !ruby/object:Gem::Requirement
82
+ name: pdf-toolkit
83
+ requirement: &2158694640 !ruby/object:Gem::Requirement
84
+ none: false
85
+ requirements:
86
+ - - ! '>='
87
+ - !ruby/object:Gem::Version
88
+ version: '0'
89
+ type: :runtime
90
+ prerelease: false
91
+ version_requirements: *2158694640
92
+ - !ruby/object:Gem::Dependency
93
+ name: pdfkit
94
+ requirement: &2158694220 !ruby/object:Gem::Requirement
84
95
  none: false
85
96
  requirements:
86
97
  - - ! '>='
@@ -88,7 +99,7 @@ dependencies:
88
99
  version: '0'
89
100
  type: :runtime
90
101
  prerelease: false
91
- version_requirements: *2165408540
102
+ version_requirements: *2158694220
92
103
  description: Use the medivo platform to find lab locations, make labcorp appointments,
93
104
  place lab orders
94
105
  email:
@@ -144,10 +155,12 @@ files:
144
155
  - lib/generators/medivo/templates/labs_controller.rb
145
156
  - lib/generators/medivo/templates/search.html.haml
146
157
  - lib/medivo/engine.rb
147
- - lib/medivo/fdf_generator.rb
148
- - lib/medivo/validators.rb
149
158
  - lib/medivo/version.rb
150
159
  - lib/medivo.rb
160
+ - lib/pdf/medivo/fdf_generator.rb
161
+ - lib/pdf/medivo/pdf_generator.rb
162
+ - lib/pdf/medivo/pdf_group.rb
163
+ - lib/support/validators.rb
151
164
  - lib/tasks/medivo_tasks.rake
152
165
  - MIT-LICENSE
153
166
  - Rakefile
@@ -244,9 +257,15 @@ files:
244
257
  - spec/dummy/tmp/cache/assets/E04/890/sprockets%2F2f5173deea6c795b8fdde723bb4b63af
245
258
  - spec/dummy/tmp/cache/assets/E32/FC0/sprockets%2Fe55fb2eef11567fe04fdaf7e73af5ba4
246
259
  - spec/dummy/tmp/cache/assets/E59/D50/sprockets%2Fbe1cc4d9b0efb617e58baa16dd1dee58
247
- - spec/fixtures/lc_positive_results.xml
248
- - spec/fixtures/order_with_requisition.xml
260
+ - spec/dummy/tmp/pids/server.pid
261
+ - spec/fixtures/lc_order_with_normal_results.xml
262
+ - spec/fixtures/lc_order_with_positive_results.xml
263
+ - spec/fixtures/lc_order_with_requisition.xml
264
+ - spec/fixtures/negative_results.pdf
249
265
  - spec/fixtures/valid_uhc_order.xml
266
+ - spec/lib/fdf_generator_spec.rb
267
+ - spec/lib/pdf_generator_spec.rb
268
+ - spec/lib/pdf_group_spec.rb
250
269
  - spec/models/appointment_spec.rb
251
270
  - spec/models/labs_spec.rb
252
271
  - spec/models/orders_spec.rb
@@ -270,7 +289,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
270
289
  version: '0'
271
290
  segments:
272
291
  - 0
273
- hash: 1037468370984486531
292
+ hash: -2872222776584530363
274
293
  required_rubygems_version: !ruby/object:Gem::Requirement
275
294
  none: false
276
295
  requirements:
@@ -279,7 +298,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
279
298
  version: '0'
280
299
  segments:
281
300
  - 0
282
- hash: 1037468370984486531
301
+ hash: -2872222776584530363
283
302
  requirements: []
284
303
  rubyforge_project:
285
304
  rubygems_version: 1.6.2
@@ -379,9 +398,15 @@ test_files:
379
398
  - spec/dummy/tmp/cache/assets/E04/890/sprockets%2F2f5173deea6c795b8fdde723bb4b63af
380
399
  - spec/dummy/tmp/cache/assets/E32/FC0/sprockets%2Fe55fb2eef11567fe04fdaf7e73af5ba4
381
400
  - spec/dummy/tmp/cache/assets/E59/D50/sprockets%2Fbe1cc4d9b0efb617e58baa16dd1dee58
382
- - spec/fixtures/lc_positive_results.xml
383
- - spec/fixtures/order_with_requisition.xml
401
+ - spec/dummy/tmp/pids/server.pid
402
+ - spec/fixtures/lc_order_with_normal_results.xml
403
+ - spec/fixtures/lc_order_with_positive_results.xml
404
+ - spec/fixtures/lc_order_with_requisition.xml
405
+ - spec/fixtures/negative_results.pdf
384
406
  - spec/fixtures/valid_uhc_order.xml
407
+ - spec/lib/fdf_generator_spec.rb
408
+ - spec/lib/pdf_generator_spec.rb
409
+ - spec/lib/pdf_group_spec.rb
385
410
  - spec/models/appointment_spec.rb
386
411
  - spec/models/labs_spec.rb
387
412
  - spec/models/orders_spec.rb