medivo 0.2.5 → 0.2.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -70,38 +70,65 @@ module Medivo
70
70
  find_with_requisition(requsition_id).pdf_requisition
71
71
  end
72
72
 
73
- # loads the results with order
73
+ ##
74
+ # find order and the results as well
74
75
  def self.find_with_results(requsition_id)
75
76
  find(requsition_id, :params=>{:include=>:reconciled_results})
76
77
  end
77
78
 
78
- # must use #find_with_results to get the order before you call this method
79
+ ##
80
+ # NOTE: must use #find_with_results to get the order before you call this method
79
81
  def results
80
82
  Array.wrap(try(:reconciled_results).try(:result))
81
83
  end
82
84
 
83
- # must use #find_with_results to get the order before you call this method
85
+ ##
86
+ # get the result for a particular test result code
87
+ #
88
+ # @param result_lab_code
89
+ #
90
+ # NOTE: must use #find_with_results to get the order before you call this method
91
+ def result_for_test(result_lab_code)
92
+ results.find{|r| r.result_lab_code == result_lab_code}
93
+ end
94
+
95
+ #
96
+ # NOTE: must use #find_with_results to get the order before you call this method
84
97
  def results_summary
85
98
  try(:reconciled_results).try(:results_summary)
86
99
  end
87
100
 
101
+ #
102
+ # NOTE: must use #find_with_results to get the order before you call this method
103
+ def result_date
104
+ results_summary.try(:collection_date)
105
+ end
106
+
107
+ #
108
+ # NOTE: must use #find_with_results to get the order before you call this method
88
109
  def pdf_result
89
110
  Base64::decode64(try(:reconciled_results).try(:results_pdf))
90
111
  end
91
112
 
113
+ ##
114
+ # gets the order, and returns the pdf
92
115
  def self.pdf_result(requsition_id)
93
116
  find_with_results(requsition_id).pdf_result
94
117
  end
95
118
 
96
- def simulate_result(lab_prefix, type='normal')
97
- raise "Incorrect Result Type" unless %w(normal false_positive positive).include?(type) and %w(qd lc).include?(lab_prefix)
98
- body = case type
99
- when 'normal' then
100
- "<mock><simulate>result</simulate><result kind='#{type}' complete='complete'></result></mock>"
101
- when 'false_positive', 'positive' then
102
- "<mock><simulate>result</simulate><result><hl7>#{Base64.encode64(File.read("lib/hl7/#{lab_prefix}_#{type}.hl7"))}</hl7></result></mock>"
119
+ ##
120
+ # @param lab_prefix [ qd, lc ]
121
+ # @param test_name name of test like 'hga1c' or 'hepc'
122
+ # @param type [ normal, false_positive, positive, abnormal ]
123
+ #
124
+ def simulate_result(lab_prefix, test_name, type='normal')
125
+ unless %w(normal false_positive positive abnormal).include?(type) and
126
+ %w(qd lc).include?(lab_prefix)
127
+ raise "Incorrect Result Type"
103
128
  end
104
-
129
+ hl7_file = Rails.root.join("lib/hl7/#{lab_prefix}_#{test_name}_#{type}.hl7").to_s
130
+ hl7 = Base64.encode64(File.read(hl7_file))
131
+ body = "<mock><simulate>result</simulate><result><hl7>#{hl7}</hl7></result></mock>"
105
132
  post(:mock_order, {}, body)
106
133
  end
107
134
 
@@ -1,3 +1,3 @@
1
1
  module Medivo
2
- VERSION = "0.2.5"
2
+ VERSION = "0.2.6"
3
3
  end
@@ -1807,3 +1807,48 @@ Started GET "/medivo/labs/appointment_data?date=11%2F01%2F2011&lab_code=20060" f
1807
1807
  Processing by Medivo::LabsController#appointment_data as HTML
1808
1808
  Parameters: {"date"=>"11/01/2011", "lab_code"=>"20060"}
1809
1809
  Completed 200 OK in 1ms (Views: 0.3ms)
1810
+ Processing by OrdersController#download_requisition as HTML
1811
+ Rendered text template (0.0ms)
1812
+ Sent data unitedhealthcare_requisition.pdf (80.8ms)
1813
+ Completed 200 OK in 919ms (Views: 80.0ms)
1814
+ Processing by OrdersController#download_result as HTML
1815
+ Sent data unitedhealthcare_result.pdf (2.3ms)
1816
+ Completed 200 OK in 693ms (Views: 1.4ms)
1817
+
1818
+
1819
+ Started GET "/medivo/labs/lab_data?zip_code=90210" for 127.0.0.1 at 2011-11-12 15:03:45 -0500
1820
+ Processing by Medivo::LabsController#lab_data as HTML
1821
+ Parameters: {"zip_code"=>"90210"}
1822
+ Completed 200 OK in 378ms (Views: 2.0ms)
1823
+
1824
+
1825
+ Started GET "/labs/lab_search?zip_code=90210" for 127.0.0.1 at 2011-11-12 15:03:48 -0500
1826
+ Processing by LabsController#lab_search as HTML
1827
+ Parameters: {"zip_code"=>"90210"}
1828
+ Completed 200 OK in 241ms (Views: 45.1ms)
1829
+
1830
+
1831
+ Started GET "/assets/application.css" for 127.0.0.1 at 2011-11-12 15:03:48 -0500
1832
+ Served asset /application.css - 200 OK (4ms)
1833
+
1834
+
1835
+ Started GET "/assets/application.js" for 127.0.0.1 at 2011-11-12 15:03:48 -0500
1836
+ Served asset /application.js - 200 OK (21ms)
1837
+
1838
+
1839
+ Started GET "/assets/medivo/markerA.png" for 127.0.0.1 at 2011-11-12 15:03:48 -0500
1840
+ Served asset /medivo/markerA.png - 200 OK (2ms)
1841
+
1842
+
1843
+ Started GET "/assets/medivo/markerB.png" for 127.0.0.1 at 2011-11-12 15:03:48 -0500
1844
+ Served asset /medivo/markerB.png - 200 OK (2ms)
1845
+
1846
+
1847
+ Started GET "/assets/medivo/arrow.png" for 127.0.0.1 at 2011-11-12 15:03:49 -0500
1848
+ Served asset /medivo/arrow.png - 200 OK (2ms)
1849
+
1850
+
1851
+ Started GET "/medivo/labs/appointment_data?date=11%2F01%2F2011&lab_code=20060" for 127.0.0.1 at 2011-11-12 15:03:49 -0500
1852
+ Processing by Medivo::LabsController#appointment_data as HTML
1853
+ Parameters: {"date"=>"11/01/2011", "lab_code"=>"20060"}
1854
+ Completed 200 OK in 1ms (Views: 0.4ms)
@@ -0,0 +1,17 @@
1
+ MSH|^~\&|1100|BN|PWN|BN003015|200906300924||ORU|0129|P|2.3
2
+ PID|1|52285|18071958310|52285|JOHN^DOE||19530627|F|||123 PALM OAK DR.^^APOPKA^FL^32744||(407)444-5555|||||09229470^^^03^^F^Y
3
+ ORC|RE|M158299698^LAB|18071958310^LAB||||||200906290000|||D14854^LAPORTA^D^^^^^U
4
+ OBR|1|M158299698^LAB|18071958310^LAB|001453^Hemoglobin A1c^L|||200906291126|||||||200906291832||||M158299698||M158299698||200906300924|||F
5
+ OBX|1|NM|001463^Hemoglobin A1c^L||8.3|%|<7.0|H||N|F|20080506||200906300245|TA
6
+ NTE|1|L| Diabetic Adult <7.0
7
+ NTE|2|L| Healthy Adult 4.8 - 5.9
8
+ NTE|3|L| (DCCT/NGSP)
9
+ NTE|4|L| American Diabetes Association's Summary of Glycemic
10
+ NTE|5|L| Recommendations for Adults with Diabetes:
11
+ NTE|6|L| Hemoglobin A1c <7.0%. More stringent glycemic goals
12
+ NTE|7|L| (A1c <6.0%) may further reduce complications at the
13
+ NTE|8|L| cost of increased risk of hypoglycemia.
14
+ ORC|RE|1593837^LAB|14537406580^LAB||||||201105260000|||1588628770^BARSON^D^^^^^N
15
+ OBR|2|1593837^LAB|14537406580^LAB|120295^LDL Cholesterol (Direct)^L|||201105250957|||||||201105260204||||1593837||1593837||201106021708|||F
16
+ OBX|1|NM|120297^LDL Chol. (Direct)^L||145|mg/dL|0-99|H||N|F|20020107||201105271606|TA
17
+ ZPS|1|TA|LabCorp Tampa|5610 W LaSalle Street^^Tampa^FL^336071770|8008775227||MD^Farrier^Sean^^^^MD
@@ -0,0 +1,17 @@
1
+ MSH|^~\&|1100|BN|PWN|BN003015|200906300924||ORU|0129|P|2.3
2
+ PID|1|52285|18071958310|52285|JOHN^DOE||19530627|F|||123 PALM OAK DR.^^APOPKA^FL^32744||(407)444-5555|||||09229470^^^03^^F^Y
3
+ ORC|RE|M158299698^LAB|18071958310^LAB||||||200906290000|||D14854^LAPORTA^D^^^^^U
4
+ OBR|1|M158299698^LAB|18071958310^LAB|001453^Hemoglobin A1c^L|||200906291126|||||||200906291832||||M158299698||M158299698||200906300924|||F
5
+ OBX|1|NM|001463^Hemoglobin A1c^L||5.6|%|<7.0|||N|F|20080506||200906300245|TA
6
+ NTE|1|L| Diabetic Adult <7.0
7
+ NTE|2|L| Healthy Adult 4.8 - 5.9
8
+ NTE|3|L| (DCCT/NGSP)
9
+ NTE|4|L| American Diabetes Association's Summary of Glycemic
10
+ NTE|5|L| Recommendations for Adults with Diabetes:
11
+ NTE|6|L| Hemoglobin A1c <7.0%. More stringent glycemic goals
12
+ NTE|7|L| (A1c <6.0%) may further reduce complications at the
13
+ NTE|8|L| cost of increased risk of hypoglycemia.
14
+ ORC|RE|1593837^LAB|14537406580^LAB||||||201105260000|||1588628770^BARSON^D^^^^^N
15
+ OBR|2|1593837^LAB|14537406580^LAB|120295^LDL Cholesterol (Direct)^L|||201105250957|||||||201105260204||||1593837||1593837||201106021708|||F
16
+ OBX|1|NM|120297^LDL Chol. (Direct)^L||90|mg/dL|0-99|||N|F|20020107||201105271606|TA
17
+ ZPS|1|TA|LabCorp Tampa|5610 W LaSalle Street^^Tampa^FL^336071770|8008775227||MD^Farrier^Sean^^^^MD
@@ -0,0 +1,33 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <customer>
3
+ <id>175605</id>
4
+ <requisition-number>175605</requisition-number>
5
+ <account-number>05021390</account-number>
6
+ <confirmation-code>xHEhtKzAEw</confirmation-code>
7
+ <first-name>dan</first-name>
8
+ <last-name>dude</last-name>
9
+ <gender>Male</gender>
10
+ <dob>19801201</dob>
11
+ <state>CA</state>
12
+ <test-types>001453,120295</test-types>
13
+ <test-groups nil="true"></test-groups>
14
+ <reconciled-test-types>001453,120295</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>dudeville</city>
19
+ <zip>90210</zip>
20
+ <address>my house</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>Cho, Jai</physicians-name>
27
+ <physicians-upin>80000239</physicians-upin>
28
+ <physicians-npi>1316979784</physicians-npi>
29
+ <physicians-license>VA 0101-034434</physicians-license>
30
+ <status>approved</status>
31
+ <timestamp>20111112185212</timestamp>
32
+ <take-tests-same-day type="boolean">true</take-tests-same-day>
33
+ </customer>
@@ -0,0 +1,155 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <customer>
3
+ <id>175605</id>
4
+ <requisition-number>175605</requisition-number>
5
+ <account-number>05021390</account-number>
6
+ <confirmation-code>xHEhtKzAEw</confirmation-code>
7
+ <first-name>dan</first-name>
8
+ <last-name>dude</last-name>
9
+ <gender>Male</gender>
10
+ <dob>19801201</dob>
11
+ <state>CA</state>
12
+ <test-types>001453,120295</test-types>
13
+ <test-groups nil="true"></test-groups>
14
+ <reconciled-test-types>001453,120295</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>dudeville</city>
19
+ <zip>90210</zip>
20
+ <address>my house</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>Cho, Jai</physicians-name>
27
+ <physicians-upin>80000239</physicians-upin>
28
+ <physicians-npi>1316979784</physicians-npi>
29
+ <physicians-license>VA 0101-034434</physicians-license>
30
+ <status>approved</status>
31
+ <timestamp>20111112185212</timestamp>
32
+ <reconciled-results>
33
+ <results-summary>
34
+ <clinical-info nil="true"></clinical-info>
35
+ <collection-date type="datetime">2011-05-25T16:57:00Z</collection-date>
36
+ <fasting type="boolean">true</fasting>
37
+ <lab-patient-id>14537406580</lab-patient-id>
38
+ <receipt-date type="datetime">2011-05-26T09:04:00Z</receipt-date>
39
+ <reported-date type="datetime">2011-06-03T00:08:00Z</reported-date>
40
+ </results-summary>
41
+ <results-pdf>
42
+ JVBERi0xLjMKJcOiw6PDj8OTCgoxIDAgb2JqCjw8IC9UeXBlIC9DYXRhbG9nCi9PdXRsaW5lcyAyIDAgUgovUGFnZXMgMyAwIFI+PgplbmRvYmoKMiAwIG9iago8PCAvVHlwZSAvT3V0bGluZXMgPj4KZW5kb2JqCjMgM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ZHrOCNiGI5iKUhz4VQuZc3kITKlQmSs3bwTQvabj5tMVNbfzrGOlfQ/fK023QplbmRzdHJlYW0KZW5kb2JqCgo4IDAgb2JqCjw8IC9UeXBlIC9Gb250Ci9TdWJ0eXBlIC9UeXBlMQovTmFtZSAvRjEKL0Jhc2VGb250IC9Db3VyaWVyCi9FbmNvZGluZyAvV2luQW5zaUVuY29kaW5nCj4+CmVuZG9iago5IDAgb2JqCjw8IC9UeXBlIC9Gb250Ci9TdWJ0eXBlIC9UeXBlMQovTmFtZSAvRjIKL0Jhc2VGb250IC9Db3VyaWVyLUJvbGQKL0VuY29kaW5nIC9XaW5BbnNpRW5jb2RpbmcKPj4KZW5kb2JqCnhyZWYKMCAxMAowMDAwMDAwMDAwIDY1NTM1IGYgCjAwMDAwMDAwMTkgMDAwMDAgbiAKMDAwMDAwMDA4MyAwMDAwMCBuIAowMDAwMDAwMTIwIDAwMDAwIG4gCjAwMDAwMDAyNzQgMDAwMDAgbiAKMDAwMDAwMDMwMyAwMDAwMCBuIAowMDAwMDAwNDI0IDAwMDAwIG4gCjAwMDAwMDA0ODcgMDAwMDAgbiAKMDAwMDAwMTc5NSAwMDAwMCBuIAowMDAwMDAxOTAwIDAwMDAwIG4gCgp0cmFpbGVyCiAgPDwgL1NpemUgMTAKICAgICAvUm9vdCAxIDAgUgogL0luZm8gNSAwIFIKICA+PgpzdGFydHhyZWYKMjAxMAolJUVPRgo=
43
+ </results-pdf>
44
+ <result type="array">
45
+ <result>
46
+ <customer-id type="integer">175605</customer-id>
47
+ <fasting type="boolean">true</fasting>
48
+ <hl7message-nte-id nil="true"></hl7message-nte-id>
49
+ <id type="integer">19060</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>1-100</lab-reference-range>
55
+ <observation-date type="datetime">2011-11-11T11:22:00Z</observation-date>
56
+ <obx-sequence-number type="integer">1</obx-sequence-number>
57
+ <order-lab-code>001453</order-lab-code>
58
+ <order-lab-name>Hemoglobin (Hgb) A1c</order-lab-name>
59
+ <parent-lab-code nil="true"></parent-lab-code>
60
+ <result-lab-code>001453</result-lab-code>
61
+ <result-lab-name>Hemoglobin (Hgb) A1c</result-lab-name>
62
+ <result-status>F</result-status>
63
+ <tnp-reason nil="true"></tnp-reason>
64
+ <units-of-measurement>mg/Ml</units-of-measurement>
65
+ <value>99.9</value>
66
+ <value-type>NM</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">175605</customer-id>
73
+ <fasting type="boolean">true</fasting>
74
+ <hl7message-nte-id nil="true"></hl7message-nte-id>
75
+ <id type="integer">19061</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>1-100</lab-reference-range>
81
+ <observation-date type="datetime">2011-11-11T11:22:00Z</observation-date>
82
+ <obx-sequence-number type="integer">1</obx-sequence-number>
83
+ <order-lab-code>120295</order-lab-code>
84
+ <order-lab-name>LDL Cholesterol (Direct)</order-lab-name>
85
+ <parent-lab-code nil="true"></parent-lab-code>
86
+ <result-lab-code>120295</result-lab-code>
87
+ <result-lab-name>LDL Cholesterol (Direct)</result-lab-name>
88
+ <result-status>F</result-status>
89
+ <tnp-reason nil="true"></tnp-reason>
90
+ <units-of-measurement>mg/Ml</units-of-measurement>
91
+ <value>99.9</value>
92
+ <value-type>NM</value-type>
93
+ <notes nil="true"></notes>
94
+ <lab-facility>01: LabCorp Burlington, 1447 York Court, Burlington NC, phone: 972-566-7500</lab-facility>
95
+ <lab-facility-director>MD Hancock William F</lab-facility-director>
96
+ </result>
97
+ <result>
98
+ <customer-id type="integer">175605</customer-id>
99
+ <fasting type="boolean">true</fasting>
100
+ <hl7message-nte-id type="integer">1242</hl7message-nte-id>
101
+ <id type="integer">19062</id>
102
+ <lab-abnormal-flag>N</lab-abnormal-flag>
103
+ <lab-facility-director-id type="integer">25</lab-facility-director-id>
104
+ <lab-facility-id type="integer">52</lab-facility-id>
105
+ <lab-id type="integer">129</lab-id>
106
+ <lab-reference-range>&lt;7.0</lab-reference-range>
107
+ <observation-date type="datetime">2009-06-30T09:45:00Z</observation-date>
108
+ <obx-sequence-number type="integer">1</obx-sequence-number>
109
+ <order-lab-code>001453</order-lab-code>
110
+ <order-lab-name>Hemoglobin A1c</order-lab-name>
111
+ <parent-lab-code nil="true"></parent-lab-code>
112
+ <result-lab-code>001463</result-lab-code>
113
+ <result-lab-name>Hemoglobin A1c</result-lab-name>
114
+ <result-status>F</result-status>
115
+ <tnp-reason nil="true"></tnp-reason>
116
+ <units-of-measurement>%</units-of-measurement>
117
+ <value>5.6</value>
118
+ <value-type>NM</value-type>
119
+ <notes>Diabetic Adult &lt;7.0 Healthy Adult 4.8 - 5.9 (DCCT/NGSP) American Diabetes Association's Summary of
120
+ Glycemic Recommendations for Adults with Diabetes: Hemoglobin A1c &lt;7.0%. More stringent glycemic goals (A1c
121
+ &lt;6.0%) may further reduce complications at the cost of increased risk of hypoglycemia.
122
+ </notes>
123
+ <lab-facility>TA: LabCorp Tampa, 5610 W LaSalle Street, Tampa FL, phone: 800-877-5227</lab-facility>
124
+ <lab-facility-director>MD Sean Farrier</lab-facility-director>
125
+ </result>
126
+ <result>
127
+ <customer-id type="integer">175605</customer-id>
128
+ <fasting type="boolean">true</fasting>
129
+ <hl7message-nte-id nil="true"></hl7message-nte-id>
130
+ <id type="integer">19063</id>
131
+ <lab-abnormal-flag>N</lab-abnormal-flag>
132
+ <lab-facility-director-id type="integer">25</lab-facility-director-id>
133
+ <lab-facility-id type="integer">52</lab-facility-id>
134
+ <lab-id type="integer">129</lab-id>
135
+ <lab-reference-range>0-99</lab-reference-range>
136
+ <observation-date type="datetime">2011-05-27T23:06:00Z</observation-date>
137
+ <obx-sequence-number type="integer">1</obx-sequence-number>
138
+ <order-lab-code>120295</order-lab-code>
139
+ <order-lab-name>LDL Cholesterol (Direct)</order-lab-name>
140
+ <parent-lab-code nil="true"></parent-lab-code>
141
+ <result-lab-code>120297</result-lab-code>
142
+ <result-lab-name>LDL Chol. (Direct)</result-lab-name>
143
+ <result-status>F</result-status>
144
+ <tnp-reason nil="true"></tnp-reason>
145
+ <units-of-measurement>mg/dL</units-of-measurement>
146
+ <value>90</value>
147
+ <value-type>NM</value-type>
148
+ <notes nil="true"></notes>
149
+ <lab-facility>TA: LabCorp Tampa, 5610 W LaSalle Street, Tampa FL, phone: 800-877-5227</lab-facility>
150
+ <lab-facility-director>MD Sean Farrier</lab-facility-director>
151
+ </result>
152
+ </result>
153
+ </reconciled-results>
154
+ <take-tests-same-day type="boolean">true</take-tests-same-day>
155
+ </customer>
@@ -215,6 +215,15 @@ describe Medivo::Order do
215
215
  text = pdf_stream_to_text(pdf)
216
216
  text.should match /COLLECTED:2011-09-06 RECEIVED:2011-09-06 REPORTED:2011-09-06/
217
217
  end
218
+
219
+ it "#result_date returns a date" do
220
+ order.result_date.should == Time.parse('2011-09-06 07:00 UTC')
221
+ end
222
+
223
+ it "#result_for_test returns result" do
224
+ result = order.result_for_test("144035")
225
+ result.value.should == '12.6'
226
+ end
218
227
  end
219
228
  end
220
229
 
@@ -263,9 +272,8 @@ describe "creating orders" do
263
272
  :dob => "19801201"
264
273
  )
265
274
 
266
-
267
275
  mock.proxy(order).to_xml({}) do |value|
268
- value.strip_space.should == File.read("#{ENGINE_PATH}/spec/fixtures/xml/valid_uhc_order.xml").strip_space
276
+ value.strip_space.should == File.read("#{ENGINE_PATH}/spec/fixtures/xml/lc_hga1c_order_create.xml").strip_space
269
277
  value
270
278
  end
271
279
 
@@ -274,6 +282,28 @@ describe "creating orders" do
274
282
  order.save
275
283
  order.errors.messages.should be_empty
276
284
  end
285
+
286
+ #it "simulate_results" do
287
+ # @requisition_id = '175605'
288
+ # # find order
289
+ # stub_order(@requisition_id, medivo_xml_fixture_path("lc_hga1c_order_find.xml"))
290
+ # Medivo::Order.find(@requisition_id)
291
+ #
292
+ # stub_order_result(@requisition_id, medivo_hl7_fixture_path("lc_order_hga1c_normal_with_results.xml"))
293
+ # p order.simulate_result('lc', 'hga1c', 'normal')
294
+ #end
295
+ #
296
+ #it "get results" do
297
+ # @requisition_id = 175605
298
+ # order = Medivo::Order.new(:requisition_number=>@requisition_id)
299
+ # stub_order_results(@requisition_id, medivo_xml_fixture_path("lc_order_hga1c_normal_with_results.xml"))
300
+ #
301
+ # order = Medivo::Order.find_with_results('175605')
302
+ # p order.to_xml
303
+ # #p order.results_summary
304
+ # #p order.results.collect{|r| [r.result_lab_code, r.value ]}
305
+ # #p order.result_for_test("001463").value
306
+ #end
277
307
  end
278
308
 
279
309
 
@@ -51,6 +51,16 @@ module Medivo::Spec
51
51
  "#{FIXTURE_PATH}/xml/#{file_name}"
52
52
  end
53
53
 
54
+ ##
55
+ # requisition_id Number id of the Medivo::Order you are stubbing
56
+ # file_path String points to the path to xml file with order info which contains
57
+ # requisition that includes requisition pdf
58
+ def stub_order(requisition_id, file_path)
59
+ stub_request(:get,
60
+ "test:test@test.medivo.com/customers/#{requisition_id}.xml").
61
+ to_return(:body => File.read(file_path))
62
+ end
63
+
54
64
  ##
55
65
  # requisition_id Number id of the Medivo::Order you are stubbing
56
66
  # file_path String points to the path to xml file with order info which contains
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.2.5
4
+ version: 0.2.6
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: &2185470960 !ruby/object:Gem::Requirement
17
+ requirement: &2169329100 !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: *2185470960
25
+ version_requirements: *2169329100
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: jquery-rails
28
- requirement: &2185470540 !ruby/object:Gem::Requirement
28
+ requirement: &2169328680 !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: *2185470540
36
+ version_requirements: *2169328680
37
37
  - !ruby/object:Gem::Dependency
38
38
  name: coffee-script
39
- requirement: &2185470060 !ruby/object:Gem::Requirement
39
+ requirement: &2169324880 !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: *2185470060
47
+ version_requirements: *2169324880
48
48
  - !ruby/object:Gem::Dependency
49
49
  name: haml-rails
50
- requirement: &2185466320 !ruby/object:Gem::Requirement
50
+ requirement: &2169324460 !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: *2185466320
58
+ version_requirements: *2169324460
59
59
  - !ruby/object:Gem::Dependency
60
60
  name: geocoder
61
- requirement: &2185465900 !ruby/object:Gem::Requirement
61
+ requirement: &2169324040 !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: *2185465900
69
+ version_requirements: *2169324040
70
70
  - !ruby/object:Gem::Dependency
71
71
  name: rest-client
72
- requirement: &2185465480 !ruby/object:Gem::Requirement
72
+ requirement: &2169323620 !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: *2185465480
80
+ version_requirements: *2169323620
81
81
  - !ruby/object:Gem::Dependency
82
82
  name: pdfkit
83
- requirement: &2185465060 !ruby/object:Gem::Requirement
83
+ requirement: &2169323200 !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: *2185465060
91
+ version_requirements: *2169323200
92
92
  - !ruby/object:Gem::Dependency
93
93
  name: prawn
94
- requirement: &2185464640 !ruby/object:Gem::Requirement
94
+ requirement: &2169322780 !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: *2185464640
102
+ version_requirements: *2169322780
103
103
  description: Use the medivo platform to find lab locations, make labcorp appointments,
104
104
  place lab orders
105
105
  email:
@@ -265,15 +265,19 @@ files:
265
265
  - spec/dummy/tmp/cache/assets/E32/FC0/sprockets%2Fe55fb2eef11567fe04fdaf7e73af5ba4
266
266
  - spec/dummy/tmp/cache/assets/E59/D50/sprockets%2Fbe1cc4d9b0efb617e58baa16dd1dee58
267
267
  - spec/dummy/tmp/image_path_fb5f3a59200b_1320622886.pdf
268
+ - spec/fixtures/hl7/lc_hga1c_abnormal.hl7
269
+ - spec/fixtures/hl7/lc_hga1c_normal.hl7
268
270
  - spec/fixtures/images/southeast.jpg
269
271
  - spec/fixtures/pdfs/hepc_negative_results.pdf
270
272
  - spec/fixtures/pdfs/hepc_result_faq.pdf
271
273
  - spec/fixtures/pdfs/uhc_requisition_cover_letter.pdf
272
274
  - spec/fixtures/pdfs/uhc_result_cover_letter.pdf
275
+ - spec/fixtures/xml/lc_hga1c_order_create.xml
276
+ - spec/fixtures/xml/lc_hga1c_order_find.xml
277
+ - spec/fixtures/xml/lc_hga1c_order_with_normal_results.xml
273
278
  - spec/fixtures/xml/lc_order_with_normal_results.xml
274
279
  - spec/fixtures/xml/lc_order_with_positive_results.xml
275
280
  - spec/fixtures/xml/lc_order_with_requisition.xml
276
- - spec/fixtures/xml/valid_uhc_order.xml
277
281
  - spec/lib/fdf_generator_spec.rb
278
282
  - spec/lib/pdf_generator_spec.rb
279
283
  - spec/lib/pdf_group_spec.rb
@@ -302,7 +306,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
302
306
  version: '0'
303
307
  segments:
304
308
  - 0
305
- hash: -3818122201458021750
309
+ hash: 884917463551088457
306
310
  required_rubygems_version: !ruby/object:Gem::Requirement
307
311
  none: false
308
312
  requirements:
@@ -311,7 +315,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
311
315
  version: '0'
312
316
  segments:
313
317
  - 0
314
- hash: -3818122201458021750
318
+ hash: 884917463551088457
315
319
  requirements: []
316
320
  rubyforge_project:
317
321
  rubygems_version: 1.6.2
@@ -416,15 +420,19 @@ test_files:
416
420
  - spec/dummy/tmp/cache/assets/E32/FC0/sprockets%2Fe55fb2eef11567fe04fdaf7e73af5ba4
417
421
  - spec/dummy/tmp/cache/assets/E59/D50/sprockets%2Fbe1cc4d9b0efb617e58baa16dd1dee58
418
422
  - spec/dummy/tmp/image_path_fb5f3a59200b_1320622886.pdf
423
+ - spec/fixtures/hl7/lc_hga1c_abnormal.hl7
424
+ - spec/fixtures/hl7/lc_hga1c_normal.hl7
419
425
  - spec/fixtures/images/southeast.jpg
420
426
  - spec/fixtures/pdfs/hepc_negative_results.pdf
421
427
  - spec/fixtures/pdfs/hepc_result_faq.pdf
422
428
  - spec/fixtures/pdfs/uhc_requisition_cover_letter.pdf
423
429
  - spec/fixtures/pdfs/uhc_result_cover_letter.pdf
430
+ - spec/fixtures/xml/lc_hga1c_order_create.xml
431
+ - spec/fixtures/xml/lc_hga1c_order_find.xml
432
+ - spec/fixtures/xml/lc_hga1c_order_with_normal_results.xml
424
433
  - spec/fixtures/xml/lc_order_with_normal_results.xml
425
434
  - spec/fixtures/xml/lc_order_with_positive_results.xml
426
435
  - spec/fixtures/xml/lc_order_with_requisition.xml
427
- - spec/fixtures/xml/valid_uhc_order.xml
428
436
  - spec/lib/fdf_generator_spec.rb
429
437
  - spec/lib/pdf_generator_spec.rb
430
438
  - spec/lib/pdf_group_spec.rb