medivo 0.1.18 → 0.1.19

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,3 @@
1
1
  module Medivo
2
- VERSION = "0.1.18"
2
+ VERSION = "0.1.19"
3
3
  end
@@ -50,7 +50,7 @@ module Medivo
50
50
  `pdftk #{args}`
51
51
  end
52
52
 
53
- @pdfs.collect do |file|
53
+ @pdfs.each do |file|
54
54
  file.close
55
55
  file.unlink if file.respond_to? :unlink
56
56
  end
@@ -60,6 +60,7 @@ module Medivo
60
60
  pdf.read
61
61
  end
62
62
 
63
+ # don't really have to do close the pdf, but I think it will trash quicker if you do
63
64
  def close
64
65
  if pdf
65
66
  pdf.close
@@ -665,3 +665,59 @@ Served asset /medivo/markerB.png - 200 OK (2ms)
665
665
 
666
666
  Started GET "/assets/medivo/arrow.png" for 127.0.0.1 at 2011-11-08 10:22:13 -0500
667
667
  Served asset /medivo/arrow.png - 200 OK (3ms)
668
+ Processing by OrdersController#download_requisition as HTML
669
+ Rendered text template (0.0ms)
670
+ Sent data unitedhealthcare_requisition.pdf (105.1ms)
671
+ Completed 200 OK in 951ms (Views: 104.3ms)
672
+ Processing by OrdersController#download_result as HTML
673
+ Sent data unitedhealthcare_result.pdf (2.1ms)
674
+ Completed 200 OK in 734ms (Views: 1.4ms)
675
+ Processing by OrdersController#download_requisition as HTML
676
+ Rendered text template (0.0ms)
677
+ Sent data unitedhealthcare_requisition.pdf (63.4ms)
678
+ Completed 200 OK in 952ms (Views: 63.2ms)
679
+ Processing by OrdersController#download_result as HTML
680
+ Sent data unitedhealthcare_result.pdf (2.1ms)
681
+ Completed 200 OK in 735ms (Views: 1.4ms)
682
+ Processing by OrdersController#download_requisition as HTML
683
+ Rendered text template (0.0ms)
684
+ Sent data unitedhealthcare_requisition.pdf (72.8ms)
685
+ Completed 200 OK in 955ms (Views: 72.2ms)
686
+ Processing by OrdersController#download_result as HTML
687
+ Sent data unitedhealthcare_result.pdf (2.1ms)
688
+ Completed 200 OK in 799ms (Views: 1.4ms)
689
+ Processing by OrdersController#download_requisition as HTML
690
+ Rendered text template (0.0ms)
691
+ Sent data unitedhealthcare_requisition.pdf (73.1ms)
692
+ Completed 200 OK in 908ms (Views: 72.6ms)
693
+ Processing by OrdersController#download_result as HTML
694
+ Sent data unitedhealthcare_result.pdf (2.2ms)
695
+ Completed 200 OK in 755ms (Views: 1.7ms)
696
+ Processing by OrdersController#download_requisition as HTML
697
+ Rendered text template (0.0ms)
698
+ Sent data unitedhealthcare_requisition.pdf (72.0ms)
699
+ Completed 200 OK in 903ms (Views: 71.1ms)
700
+ Processing by OrdersController#download_result as HTML
701
+ Sent data unitedhealthcare_result.pdf (2.4ms)
702
+ Completed 200 OK in 761ms (Views: 1.8ms)
703
+ Processing by OrdersController#download_requisition as HTML
704
+ Rendered text template (0.0ms)
705
+ Sent data unitedhealthcare_requisition.pdf (68.7ms)
706
+ Completed 200 OK in 902ms (Views: 68.3ms)
707
+ Processing by OrdersController#download_result as HTML
708
+ Sent data unitedhealthcare_result.pdf (2.2ms)
709
+ Completed 200 OK in 806ms (Views: 1.6ms)
710
+ Processing by OrdersController#download_requisition as HTML
711
+ Rendered text template (0.0ms)
712
+ Sent data unitedhealthcare_requisition.pdf (76.2ms)
713
+ Completed 200 OK in 909ms (Views: 75.7ms)
714
+ Processing by OrdersController#download_result as HTML
715
+ Sent data unitedhealthcare_result.pdf (3.0ms)
716
+ Completed 200 OK in 760ms (Views: 2.2ms)
717
+ Processing by OrdersController#download_requisition as HTML
718
+ Rendered text template (0.0ms)
719
+ Sent data unitedhealthcare_requisition.pdf (72.7ms)
720
+ Completed 200 OK in 905ms (Views: 71.8ms)
721
+ Processing by OrdersController#download_result as HTML
722
+ Sent data unitedhealthcare_result.pdf (2.3ms)
723
+ Completed 200 OK in 722ms (Views: 1.9ms)
@@ -1,12 +1,31 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe Medivo::PdfGenerator do
4
+ MD = <<-MD
5
+ Catherine E. Palmier, M.D.
6
+ Chief Medical Officer,
7
+ UnitedHealthcare Clinical Services
8
+ Southeast Region
9
+ MD
10
+
11
+ let(:uhc_cover_letter_fields) {
12
+ { :full_name => 'dude man',
13
+ :address => '5 willywonka lane',
14
+ :first_name => 'fdudely',
15
+ :sched_date => '2/12/2001',
16
+ :app_date => '2/13/2001',
17
+ :app_time => '9:00', # small field .. so too much text will break test
18
+ :lab_name => 'LabCorp',
19
+ :lab_address => '3 nowhere road',
20
+ :order_number => '87113',
21
+ :director_name=>MD }
22
+ }
4
23
 
5
24
  describe "#variable_fields generates pdf by filling in the variables" do
6
25
 
7
- it "for negative results cover letter" do
26
+ it "simple cover letter" do
8
27
  name = "Duderoni"
9
- path = medivo_fixture_path "negative_results.pdf"
28
+ path = medivo_fixture_path "hepc_negative_results.pdf"
10
29
  pdf_file = Medivo::PdfGenerator.variable_fields(path, {:patient_name=>name})
11
30
  text = pdf_to_text(pdf_file)
12
31
  text.should match name
@@ -14,25 +33,12 @@ describe Medivo::PdfGenerator do
14
33
  end
15
34
 
16
35
  it "for uhc requisition cover letter" do
17
-
18
- fields = {
19
- :full_name => 'my full name',
20
- :address => 'my address',
21
- :first_name => 'me!!!!!',
22
- :sched_date => 'todays date',
23
- :app_date => 'my appt date',
24
- :app_time => 'appt time', # small field .. so too much text will break test
25
- :lab_name => 'LabCorp',
26
- :lab_address => 'the lab address',
27
- :order_number => 'the lab id'
28
- }
29
-
30
36
  path = medivo_fixture_path "uhc_requisition_cover_letter.pdf"
31
- pdf_file = Medivo::PdfGenerator.variable_fields(path, fields)
37
+ pdf_file = Medivo::PdfGenerator.variable_fields(path, uhc_cover_letter_fields)
32
38
 
33
39
  text = pdf_to_text(pdf_file)
34
40
  text = text.strip_space
35
- fields.values.each do |value|
41
+ uhc_cover_letter_fields.values.each do |value|
36
42
  text.should match value.strip_space
37
43
  end
38
44
  pdf_file.unlink
@@ -40,35 +46,20 @@ describe Medivo::PdfGenerator do
40
46
  end
41
47
 
42
48
  it "#variable_fields_with_images accepts image param and stamps image onto pdf" do
43
- md = <<-MD
44
- Catherine E. Palmier, M.D.
45
- Chief Medical Officer,
46
- UnitedHealthcare Clinical Services
47
- Southeast Region
48
- MD
49
-
50
- fields = {
51
- :full_name => 'my full name',
52
- :address => 'my address',
53
- :first_name => 'me!!!!!',
54
- :sched_date => 'todays date',
55
- :app_date => 'my appt date',
56
- :app_time => 'appt time', # small field .. so too much text will break test
57
- :lab_name => 'LabCorp',
58
- :lab_address => 'the lab address',
59
- :order_number => 'the lab id',
60
- :director_name=>md
61
- }
62
-
63
49
  path = medivo_fixture_path "uhc_requisition_cover_letter.pdf"
64
50
  img_path = medivo_fixture_path "Southeast.jpg"
65
51
  pdf_file = Medivo::PdfGenerator.variable_fields_with_images(
66
52
  path,
67
- fields,
53
+ uhc_cover_letter_fields,
68
54
  [{:path=> img_path, :options=>{:at=> [40, 100], :width=>180, :height=>28}}]
69
55
  )
56
+
70
57
  show_me_the_pdf(pdf_file, '/tmp/test.pdf')
71
58
  text = pdf_to_text(pdf_file)
59
+
60
+ uhc_cover_letter_fields.each do |key, value|
61
+ text.should match value unless key == :director_name
62
+ end
72
63
  text.strip_space.should match "Catherine E. Palmier, M.D.".strip_space
73
64
  pdf_file.unlink
74
65
  end
@@ -3,7 +3,7 @@ require 'spec_helper'
3
3
  describe Medivo::PdfGroup do
4
4
 
5
5
  it "can call read on the pdf after creating it" do
6
- path = medivo_fixture_path "result_faq.pdf"
6
+ path = medivo_fixture_path "hepc_result_faq.pdf"
7
7
  pdf_group = Medivo::PdfGroup.create do
8
8
  static_pdf(path)
9
9
  end
@@ -13,16 +13,16 @@ describe Medivo::PdfGroup do
13
13
 
14
14
  it "#variable_fields" do
15
15
  name = "Duderoni"
16
- o = OpenStruct.new(:name=>name)
17
- path = medivo_fixture_path "negative_results.pdf"
16
+ path = medivo_fixture_path "hepc_negative_results.pdf"
18
17
  pdf_group = Medivo::PdfGroup.create do
19
- variable_fields(path, {:patient_name=>o.name})
18
+ variable_fields(path, {:patient_name=>name})
20
19
  end
21
20
  text = pdf_to_text(pdf_group.pdf)
22
21
  text.should match name
23
22
  pdf_group.close
24
23
  end
25
24
 
25
+
26
26
  it "#lab_requisition" do
27
27
  requisition_id = 170420
28
28
  stub_order_requisition(requisition_id, medivo_fixture_path("lc_order_with_requisition.xml"))
@@ -51,7 +51,7 @@ describe Medivo::PdfGroup do
51
51
  end
52
52
 
53
53
  it "#static_pdf" do
54
- path = medivo_fixture_path "result_faq.pdf"
54
+ path = medivo_fixture_path "hepc_result_faq.pdf"
55
55
  pdf_group = Medivo::PdfGroup.create do
56
56
  static_pdf(path)
57
57
  end
@@ -63,12 +63,12 @@ describe Medivo::PdfGroup do
63
63
 
64
64
  it "handles a combination of pdfs" do
65
65
  name = "Duderoni"
66
- cover_letter_path = medivo_fixture_path "negative_results.pdf"
66
+ cover_letter_path = medivo_fixture_path "hepc_negative_results.pdf"
67
67
 
68
68
  requisition_id = 170420
69
69
  stub_order_result(requisition_id, medivo_fixture_path("lc_order_with_normal_results.xml"))
70
70
 
71
- faq_path = medivo_fixture_path "result_faq.pdf"
71
+ faq_path = medivo_fixture_path "hepc_result_faq.pdf"
72
72
 
73
73
  pdf_group = Medivo::PdfGroup.create do
74
74
  variable_fields(cover_letter_path, {:patient_name=>name})
@@ -1,6 +1,9 @@
1
1
  unless defined? SampleUser
2
2
  SampleUser = OpenStruct.new(
3
3
  :member_id => 1,
4
+ :full_name=>'dude man',
5
+ :first_name=>'dude',
6
+ :last_name=>'man',
4
7
  :date_of_birth => Date.new(1938, 3, 3),
5
8
  :address1 => "422 Cattelranchy St",
6
9
  :city => "Dudeville",
@@ -24,21 +27,19 @@ class LabTestOrder
24
27
  return @pdf_requisition if @pdf_requisition
25
28
 
26
29
  cover_letter_fields = {
27
- :full_name => user.full_name,
28
- :address => "#{user.address1}\n#{user.address2}\n#{user.city}, #{user.state} #{user.zip_code}",
29
- :first_name => user.first_name,
30
- :sched_date => Date.today.to_s,
31
- :lab_name => 'LabCorp',
32
- :order_number => requisition_id
30
+ :full_name => user.full_name,
31
+ :address => "#{user.address1}\n#{user.address2}\n#{user.city}, #{user.state} #{user.zip_code}",
32
+ :first_name => user.first_name,
33
+ :sched_date => Date.today.to_s,
34
+ :lab_name => 'LabCorp',
35
+ :order_number => requisition_id
33
36
  }
34
37
 
35
38
  cover_letter_file_path = "#{FIXTURE_PATH}/uhc_requisition_cover_letter.pdf"
36
- faq_path = "#{FIXTURE_PATH}/result_faq.pdf"
37
39
 
38
40
  @pdf_requisition = Medivo::PdfGroup.create do
39
41
  variable_fields(cover_letter_file_path, cover_letter_fields)
40
42
  lab_requisition(requisition_id)
41
- static_pdf(faq_path)
42
43
  end
43
44
  end
44
45
 
@@ -46,19 +47,21 @@ class LabTestOrder
46
47
  return @pdf_result if @pdf_result
47
48
 
48
49
  cover_letter_fields = {
49
- :full_name => user.full_name,
50
- :address => "#{user.address1}\n#{user.address2}\n#{user.city}, #{user.state} #{user.zip_code}",
51
- :first_name => user.first_name,
52
- :sched_date => Date.today.to_s,
53
- :lab_name => 'LabCorp',
54
- :order_number => requisition_id
50
+ :full_name => user.full_name,
51
+ :address => "#{user.address1}\n#{user.address2}\n#{user.city}, #{user.state} #{user.zip_code}",
52
+ :first_name => user.first_name,
53
+ :sched_date => Date.today.to_s,
54
+ :lab_name => 'LabCorp',
55
+ :order_number => requisition_id
55
56
  }
56
57
 
57
58
  cover_letter_file_path = "#{FIXTURE_PATH}/uhc_result_cover_letter.pdf"
59
+ faq_path = "#{FIXTURE_PATH}/hepc_result_faq.pdf"
58
60
 
59
- Medivo::PdfGroup.create do
61
+ @pdf_result = Medivo::PdfGroup.create do
60
62
  variable_fields(cover_letter_file_path, cover_letter_fields)
61
63
  lab_result(requisition_id)
64
+ static_pdf(faq_path)
62
65
  end
63
66
  end
64
67
  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.18
4
+ version: 0.1.19
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -14,7 +14,7 @@ default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rails
17
- requirement: &2170124640 !ruby/object:Gem::Requirement
17
+ requirement: &2152951920 !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: *2170124640
25
+ version_requirements: *2152951920
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: jquery-rails
28
- requirement: &2170124220 !ruby/object:Gem::Requirement
28
+ requirement: &2152951500 !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: *2170124220
36
+ version_requirements: *2152951500
37
37
  - !ruby/object:Gem::Dependency
38
38
  name: coffee-script
39
- requirement: &2170123760 !ruby/object:Gem::Requirement
39
+ requirement: &2152951040 !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: *2170123760
47
+ version_requirements: *2152951040
48
48
  - !ruby/object:Gem::Dependency
49
49
  name: haml-rails
50
- requirement: &2170123340 !ruby/object:Gem::Requirement
50
+ requirement: &2152950620 !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: *2170123340
58
+ version_requirements: *2152950620
59
59
  - !ruby/object:Gem::Dependency
60
60
  name: geocoder
61
- requirement: &2170122920 !ruby/object:Gem::Requirement
61
+ requirement: &2152950200 !ruby/object:Gem::Requirement
62
62
  none: false
63
63
  requirements:
64
64
  - - ! '>='
@@ -66,10 +66,10 @@ dependencies:
66
66
  version: '0'
67
67
  type: :runtime
68
68
  prerelease: false
69
- version_requirements: *2170122920
69
+ version_requirements: *2152950200
70
70
  - !ruby/object:Gem::Dependency
71
71
  name: rest-client
72
- requirement: &2170122500 !ruby/object:Gem::Requirement
72
+ requirement: &2152949700 !ruby/object:Gem::Requirement
73
73
  none: false
74
74
  requirements:
75
75
  - - ! '>='
@@ -77,10 +77,10 @@ dependencies:
77
77
  version: '0'
78
78
  type: :runtime
79
79
  prerelease: false
80
- version_requirements: *2170122500
80
+ version_requirements: *2152949700
81
81
  - !ruby/object:Gem::Dependency
82
82
  name: pdfkit
83
- requirement: &2170122080 !ruby/object:Gem::Requirement
83
+ requirement: &2152949280 !ruby/object:Gem::Requirement
84
84
  none: false
85
85
  requirements:
86
86
  - - ! '>='
@@ -88,10 +88,10 @@ dependencies:
88
88
  version: '0'
89
89
  type: :runtime
90
90
  prerelease: false
91
- version_requirements: *2170122080
91
+ version_requirements: *2152949280
92
92
  - !ruby/object:Gem::Dependency
93
93
  name: prawn
94
- requirement: &2170121660 !ruby/object:Gem::Requirement
94
+ requirement: &2152948860 !ruby/object:Gem::Requirement
95
95
  none: false
96
96
  requirements:
97
97
  - - ! '>='
@@ -99,7 +99,7 @@ dependencies:
99
99
  version: '0'
100
100
  type: :runtime
101
101
  prerelease: false
102
- version_requirements: *2170121660
102
+ version_requirements: *2152948860
103
103
  description: Use the medivo platform to find lab locations, make labcorp appointments,
104
104
  place lab orders
105
105
  email:
@@ -261,11 +261,11 @@ files:
261
261
  - spec/dummy/tmp/cache/assets/E32/FC0/sprockets%2Fe55fb2eef11567fe04fdaf7e73af5ba4
262
262
  - spec/dummy/tmp/cache/assets/E59/D50/sprockets%2Fbe1cc4d9b0efb617e58baa16dd1dee58
263
263
  - spec/dummy/tmp/image_path_fb5f3a59200b_1320622886.pdf
264
+ - spec/fixtures/hepc_negative_results.pdf
265
+ - spec/fixtures/hepc_result_faq.pdf
264
266
  - spec/fixtures/lc_order_with_normal_results.xml
265
267
  - spec/fixtures/lc_order_with_positive_results.xml
266
268
  - spec/fixtures/lc_order_with_requisition.xml
267
- - spec/fixtures/negative_results.pdf
268
- - spec/fixtures/result_faq.pdf
269
269
  - spec/fixtures/Southeast.jpg
270
270
  - spec/fixtures/uhc_requisition_cover_letter.pdf
271
271
  - spec/fixtures/uhc_result_cover_letter.pdf
@@ -298,7 +298,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
298
298
  version: '0'
299
299
  segments:
300
300
  - 0
301
- hash: 1506057069429317681
301
+ hash: -978377392272491129
302
302
  required_rubygems_version: !ruby/object:Gem::Requirement
303
303
  none: false
304
304
  requirements:
@@ -307,7 +307,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
307
307
  version: '0'
308
308
  segments:
309
309
  - 0
310
- hash: 1506057069429317681
310
+ hash: -978377392272491129
311
311
  requirements: []
312
312
  rubyforge_project:
313
313
  rubygems_version: 1.6.2
@@ -410,11 +410,11 @@ test_files:
410
410
  - spec/dummy/tmp/cache/assets/E32/FC0/sprockets%2Fe55fb2eef11567fe04fdaf7e73af5ba4
411
411
  - spec/dummy/tmp/cache/assets/E59/D50/sprockets%2Fbe1cc4d9b0efb617e58baa16dd1dee58
412
412
  - spec/dummy/tmp/image_path_fb5f3a59200b_1320622886.pdf
413
+ - spec/fixtures/hepc_negative_results.pdf
414
+ - spec/fixtures/hepc_result_faq.pdf
413
415
  - spec/fixtures/lc_order_with_normal_results.xml
414
416
  - spec/fixtures/lc_order_with_positive_results.xml
415
417
  - spec/fixtures/lc_order_with_requisition.xml
416
- - spec/fixtures/negative_results.pdf
417
- - spec/fixtures/result_faq.pdf
418
418
  - spec/fixtures/Southeast.jpg
419
419
  - spec/fixtures/uhc_requisition_cover_letter.pdf
420
420
  - spec/fixtures/uhc_result_cover_letter.pdf