his_emr_api_lab 1.2.0 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +3 -1
- data/app/controllers/lab/application_controller.rb +5 -0
- data/app/controllers/lab/orders_controller.rb +3 -3
- data/app/controllers/lab/specimen_types_controller.rb +1 -1
- data/app/controllers/lab/test_result_indicators_controller.rb +6 -4
- data/app/controllers/lab/test_types_controller.rb +1 -1
- data/app/controllers/lab/tests_controller.rb +20 -17
- data/app/jobs/lab/application_job.rb +2 -0
- data/app/jobs/lab/update_patient_orders_job.rb +1 -1
- data/app/mailers/lab/application_mailer.rb +2 -0
- data/app/models/lab/application_record.rb +2 -0
- data/app/models/lab/lab_order.rb +1 -1
- data/app/models/lab/lims_failed_import.rb +2 -0
- data/app/serializers/lab/lab_order_serializer.rb +2 -2
- data/app/serializers/lab/result_serializer.rb +2 -2
- data/app/services/lab/accession_number_service.rb +2 -2
- data/app/services/lab/concepts_service.rb +2 -2
- data/app/services/lab/labelling_service/order_label.rb +2 -2
- data/app/services/lab/lims/api/blackhole_api.rb +1 -1
- data/app/services/lab/lims/api/couchdb_api.rb +3 -3
- data/app/services/lab/lims/api/mysql_api.rb +6 -6
- data/app/services/lab/lims/api/rest_api.rb +378 -372
- data/app/services/lab/lims/api/ws_api.rb +1 -1
- data/app/services/lab/lims/api_factory.rb +1 -1
- data/app/services/lab/lims/config.rb +1 -1
- data/app/services/lab/lims/exceptions.rb +1 -0
- data/app/services/lab/lims/migrator.rb +11 -12
- data/app/services/lab/lims/order_dto.rb +4 -4
- data/app/services/lab/lims/order_serializer.rb +12 -12
- data/app/services/lab/lims/pull_worker.rb +14 -13
- data/app/services/lab/lims/push_worker.rb +5 -5
- data/app/services/lab/lims/utils.rb +4 -6
- data/app/services/lab/lims/worker.rb +1 -1
- data/app/services/lab/orders_search_service.rb +3 -3
- data/app/services/lab/orders_service.rb +5 -5
- data/app/services/lab/results_service.rb +3 -3
- data/app/services/lab/tests_service.rb +5 -5
- data/db/migrate/20210126092910_create_lab_lab_accession_number_counters.rb +2 -0
- data/db/migrate/20210310115457_create_lab_lims_order_mappings.rb +2 -0
- data/db/migrate/20210326195504_add_order_revision_to_lims_order_mapping.rb +2 -0
- data/db/migrate/20210610095024_fix_numeric_results_value_type.rb +2 -0
- data/db/migrate/20210807111531_add_default_to_lims_order_mapping.rb +2 -0
- data/lib/auto12epl.rb +55 -53
- data/lib/couch_bum/couch_bum.rb +4 -4
- data/lib/generators/lab/install/templates/rswag-ui-lab.rb +2 -0
- data/lib/his_emr_api_lab.rb +2 -0
- data/lib/lab/engine.rb +2 -0
- data/lib/lab/version.rb +1 -1
- data/lib/logger_multiplexor.rb +2 -2
- data/lib/tasks/lab_tasks.rake +2 -0
- data/lib/tasks/loaders/loader_mixin.rb +4 -4
- data/lib/tasks/loaders/reasons_for_test_loader.rb +1 -1
- data/lib/tasks/loaders/specimens_loader.rb +6 -7
- data/lib/tasks/loaders/test_result_indicators_loader.rb +5 -5
- metadata +12 -17
data/lib/auto12epl.rb
CHANGED
@@ -1,28 +1,27 @@
|
|
1
1
|
#!/usr/bin/ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
2
4
|
# Jeremy Espino MD MS
|
3
5
|
# 28-JAN-2016
|
4
6
|
|
5
|
-
|
6
7
|
class Float
|
7
8
|
# function to round down a float to an integer value
|
8
|
-
def round_down
|
9
|
-
n < 1 ?
|
9
|
+
def round_down(n = 0)
|
10
|
+
n < 1 ? to_i.to_f : (self - (0.5 / (10**n))).round(n)
|
10
11
|
end
|
11
12
|
end
|
12
13
|
|
13
14
|
# Generates EPL code that conforms to the Auto12-A standard for specimen labeling
|
14
15
|
class Auto12Epl
|
15
|
-
|
16
|
-
attr_accessor :element_font
|
17
|
-
attr_accessor :barcode_human_font
|
16
|
+
attr_accessor :element_font, :barcode_human_font
|
18
17
|
|
19
18
|
DPI = 203
|
20
19
|
LABEL_WIDTH_IN = 2.0
|
21
20
|
LABEL_HEIGHT_IN = 0.5
|
22
21
|
|
23
22
|
# font constants
|
24
|
-
FONT_X_DOTS = [8, 10, 12, 14, 32]
|
25
|
-
FONT_Y_DOTS = [12, 16, 20, 24, 24]
|
23
|
+
FONT_X_DOTS = [8, 10, 12, 14, 32].freeze
|
24
|
+
FONT_Y_DOTS = [12, 16, 20, 24, 24].freeze
|
26
25
|
FONT_PAD_DOTS = 2
|
27
26
|
|
28
27
|
# element heights
|
@@ -58,7 +57,6 @@ class Auto12Epl
|
|
58
57
|
ASCII_HORZ_MULT = 1
|
59
58
|
ASCII_VERT_MULT = 1
|
60
59
|
|
61
|
-
|
62
60
|
def initialize(element_font = 1, barcode_human_font = 1)
|
63
61
|
@element_font = element_font
|
64
62
|
@barcode_human_font = barcode_human_font
|
@@ -66,78 +64,79 @@ class Auto12Epl
|
|
66
64
|
|
67
65
|
# Calculate the number of characters that will fit in a given length
|
68
66
|
def max_characters(font, length)
|
67
|
+
dots_per_char = FONT_X_DOTS.at(font - 1) + FONT_PAD_DOTS
|
69
68
|
|
70
|
-
|
71
|
-
|
72
|
-
num_char = ( (length * DPI) / dots_per_char).round_down
|
69
|
+
num_char = ((length * DPI) / dots_per_char).round_down
|
73
70
|
|
74
71
|
num_char.to_int
|
75
72
|
end
|
76
73
|
|
77
74
|
# Use basic truncation rule to truncate the name element i.e., if > maxCharacters cutoff and trail with +
|
78
75
|
def truncate_name(last_name, first_name, middle_initial, is_stat)
|
79
|
-
if is_stat
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
76
|
+
name_max_characters = if is_stat
|
77
|
+
max_characters(@element_font, STAT_WIDTH_ELEMENT)
|
78
|
+
else
|
79
|
+
max_characters(@element_font, WIDTH_ELEMENT)
|
80
|
+
end
|
84
81
|
|
85
82
|
if concatName(last_name, first_name, middle_initial).length > name_max_characters
|
86
83
|
# truncate last?
|
87
|
-
if last_name.length > 12
|
88
|
-
last_name = last_name[0..11] + '+'
|
89
|
-
end
|
84
|
+
last_name = "#{last_name[0..11]}+" if last_name.length > 12
|
90
85
|
|
91
86
|
# truncate first?
|
92
|
-
if concatName(last_name, first_name, middle_initial).length
|
93
|
-
first_name = first_name[0..7]
|
87
|
+
if concatName(last_name, first_name, middle_initial).length > name_max_characters && first_name.length > 7
|
88
|
+
first_name = "#{first_name[0..7]}+"
|
94
89
|
end
|
95
90
|
end
|
96
91
|
|
97
92
|
concatName(last_name, first_name, middle_initial)
|
98
|
-
|
99
93
|
end
|
100
94
|
|
101
95
|
def concatName(last_name, first_name, middle_initial)
|
102
|
-
last_name
|
96
|
+
"#{last_name}, #{first_name}#{middle_initial.nil? ? '' : " #{middle_initial}"}"
|
103
97
|
end
|
104
98
|
|
105
99
|
# The main function to generate the EPL
|
106
|
-
def generate_epl(last_name, first_name, middle_initial, pid, dob, age, gender, col_date_time, col_name, tests, stat,
|
107
|
-
|
100
|
+
def generate_epl(last_name, first_name, middle_initial, pid, dob, age, gender, col_date_time, col_name, tests, stat,
|
101
|
+
acc_num, schema_track)
|
108
102
|
# format text and set margin
|
109
|
-
if stat
|
103
|
+
if stat.nil?
|
110
104
|
name_text = truncate_name(last_name, first_name, middle_initial, false)
|
111
|
-
pid_dob_age_gender_text = full_justify(pid, dob
|
105
|
+
pid_dob_age_gender_text = full_justify(pid, "#{dob} #{age} #{gender}", @element_font, WIDTH_ELEMENT)
|
112
106
|
l_margin = L_MARGIN
|
113
107
|
l_margin_barcode = L_MARGIN_BARCODE
|
114
108
|
else
|
115
109
|
name_text = truncate_name(last_name, first_name, middle_initial, true)
|
116
|
-
pid_dob_age_gender_text = full_justify(pid, dob
|
110
|
+
pid_dob_age_gender_text = full_justify(pid, "#{dob} #{age} #{gender}", @element_font, STAT_WIDTH_ELEMENT)
|
117
111
|
stat_element_text = pad_stat_w_space(stat)
|
118
112
|
l_margin = L_MARGIN_W_STAT
|
119
113
|
l_margin_barcode = L_MARGIN_BARCODE_W_STAT
|
120
114
|
end
|
121
|
-
barcode_human_text = "#{acc_num} * #{schema_track.gsub(
|
115
|
+
barcode_human_text = "#{acc_num} * #{schema_track.gsub(/-/i, '')}"
|
122
116
|
collector_element_text = "Col: #{col_date_time} #{col_name}"
|
123
117
|
tests_element_text = tests
|
124
118
|
|
125
119
|
# generate EPL statements
|
126
120
|
name_element = generate_ascii_element(to_dots(l_margin), to_dots(HEIGHT_MARGIN), 0, @element_font, false, name_text)
|
127
|
-
pid_dob_age_gender_element = generate_ascii_element(to_dots(l_margin),
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
121
|
+
pid_dob_age_gender_element = generate_ascii_element(to_dots(l_margin),
|
122
|
+
to_dots(HEIGHT_MARGIN + HEIGHT_ELEMENT + HEIGHT_ELEMENT_SPACE), 0, @element_font, false, pid_dob_age_gender_text)
|
123
|
+
barcode_human_element = generate_ascii_element(to_dots(l_margin_barcode),
|
124
|
+
to_dots(HEIGHT_MARGIN + HEIGHT_ELEMENT + HEIGHT_ELEMENT_SPACE + HEIGHT_ELEMENT + HEIGHT_ELEMENT_SPACE + HEIGHT_BARCODE), 0, @barcode_human_font, false, barcode_human_text)
|
125
|
+
collector_element = generate_ascii_element(to_dots(l_margin),
|
126
|
+
to_dots(HEIGHT_MARGIN + HEIGHT_ELEMENT + HEIGHT_ELEMENT_SPACE + HEIGHT_ELEMENT + HEIGHT_ELEMENT_SPACE + HEIGHT_BARCODE + HEIGHT_BARCODE_HUMAN + HEIGHT_ELEMENT_SPACE), 0, @element_font, false, collector_element_text)
|
127
|
+
tests_element = generate_ascii_element(to_dots(l_margin),
|
128
|
+
to_dots(HEIGHT_MARGIN + HEIGHT_ELEMENT + HEIGHT_ELEMENT_SPACE + HEIGHT_ELEMENT + HEIGHT_ELEMENT_SPACE + HEIGHT_BARCODE + HEIGHT_BARCODE_HUMAN + HEIGHT_ELEMENT_SPACE + HEIGHT_ELEMENT + HEIGHT_ELEMENT_SPACE), 0, @element_font, false, tests_element_text)
|
129
|
+
barcode_element = generate_barcode_element(to_dots(l_margin_barcode),
|
130
|
+
to_dots(HEIGHT_MARGIN + HEIGHT_ELEMENT + HEIGHT_ELEMENT_SPACE + HEIGHT_ELEMENT + HEIGHT_ELEMENT_SPACE), to_dots(HEIGHT_BARCODE) - 4, schema_track)
|
131
|
+
stat_element = generate_ascii_element(to_dots(L_MARGIN) + FONT_Y_DOTS.at(@element_font - 1) + FONT_PAD_DOTS,
|
132
|
+
to_dots(HEIGHT_MARGIN), 1, @element_font, true, stat_element_text)
|
133
133
|
|
134
134
|
# combine EPL statements
|
135
|
-
if stat
|
135
|
+
if stat.nil?
|
136
136
|
"\nN\nR216,0\nZT\nS1\n#{name_element}\n#{pid_dob_age_gender_element}\n#{barcode_element}\n#{barcode_human_element}\n#{collector_element}\n#{tests_element}\nP3\n"
|
137
137
|
else
|
138
138
|
"\nN\nR216,0\nZT\nS1\n#{name_element}\n#{pid_dob_age_gender_element}\n#{barcode_element}\n#{barcode_human_element}\n#{collector_element}\n#{tests_element}\n#{stat_element}\nP3\n"
|
139
139
|
end
|
140
|
-
|
141
140
|
end
|
142
141
|
|
143
142
|
# Add spaces before and after the stat text so that black bars appear across the left edge of label
|
@@ -146,7 +145,7 @@ class Auto12Epl
|
|
146
145
|
spaces_needed = (num_char - stat.length) / 1
|
147
146
|
space = ''
|
148
147
|
spaces_needed.times do
|
149
|
-
space
|
148
|
+
space += ' '
|
150
149
|
end
|
151
150
|
space + stat + space
|
152
151
|
end
|
@@ -157,7 +156,7 @@ class Auto12Epl
|
|
157
156
|
spaces_needed = max_char - pid.length - dag.length
|
158
157
|
space = ''
|
159
158
|
spaces_needed.times do
|
160
|
-
space
|
159
|
+
space += ' '
|
161
160
|
end
|
162
161
|
pid + space + dag
|
163
162
|
end
|
@@ -169,33 +168,36 @@ class Auto12Epl
|
|
169
168
|
|
170
169
|
# generate ascii EPL
|
171
170
|
def generate_ascii_element(x, y, rotation, font, is_reverse, text)
|
172
|
-
"A#{x
|
171
|
+
"A#{x},#{y},#{rotation},#{font},#{ASCII_HORZ_MULT},#{ASCII_VERT_MULT},#{is_reverse ? 'R' : 'N'},\"#{text}\""
|
173
172
|
end
|
174
173
|
|
175
174
|
# generate barcode EPL
|
176
175
|
def generate_barcode_element(x, y, height, schema_track)
|
177
|
-
schema_track = schema_track.gsub(
|
178
|
-
"B#{x
|
176
|
+
schema_track = schema_track.gsub('-', '').strip
|
177
|
+
"B#{x},#{y},#{BARCODE_ROTATION},#{BARCODE_TYPE},#{BARCODE_NARROW_WIDTH},#{BARCODE_WIDE_WIDTH},#{height},#{BARCODE_IS_HUMAN_READABLE},\"#{schema_track}\""
|
179
178
|
end
|
180
|
-
|
181
179
|
end
|
182
180
|
|
183
|
-
if __FILE__ == $
|
181
|
+
if __FILE__ == $PROGRAM_NAME
|
184
182
|
|
185
183
|
auto = Auto12Epl.new
|
186
184
|
|
187
|
-
puts auto.generate_epl(
|
185
|
+
puts auto.generate_epl('Banda', 'Mary', 'U', 'Q23-HGF', '12-SEP-1997', '19y', 'F', '01-JAN-2016 14:21', 'byGD',
|
186
|
+
'CHEM7,Ca,Mg', nil, 'KCH-16-00001234', '1600001234')
|
188
187
|
puts "\n"
|
189
|
-
puts auto.generate_epl(
|
188
|
+
puts auto.generate_epl('Banda', 'Mary', 'U', 'Q23-HGF', '12-SEP-1997', '19y', 'F', '01-JAN-2016 14:21', 'byGD',
|
189
|
+
'CHEM7,Ca,Mg', 'STAT CHEM', 'KCH-16-00001234', '1600001234')
|
190
190
|
puts "\n"
|
191
|
-
puts auto.generate_epl(
|
191
|
+
puts auto.generate_epl('Bandajustrightlas', 'Mary', 'U', 'Q23-HGF', '12-SEP-1997', '19y', 'F', '01-JAN-2016 14:21',
|
192
|
+
'byGD', 'CHEM7,Ca,Mg', 'STAT CHEM', 'KCH-16-00001234', '1600001234')
|
192
193
|
puts "\n"
|
193
|
-
puts auto.generate_epl(
|
194
|
+
puts auto.generate_epl('Bandasuperlonglastnamethatwonfit', 'Marysuperlonglastnamethatwonfit', 'U', 'Q23-HGF',
|
195
|
+
'12-SEP-1997', '19y', 'F', '01-JAN-2016 14:21', 'byGD', 'CHEM7,Ca,Mg', 'STAT CHEM', 'KCH-16-00001234', '1600001234')
|
194
196
|
puts "\n"
|
195
|
-
puts auto.generate_epl(
|
197
|
+
puts auto.generate_epl('Bandasuperlonglastnamethatwonfit', 'Mary', 'U', 'Q23-HGF', '12-SEP-1997', '19y', 'F',
|
198
|
+
'01-JAN-2016 14:21', 'byGD', 'CHEM7,Ca,Mg', 'STAT CHEM', 'KCH-16-00001234', '1600001234')
|
196
199
|
puts "\n"
|
197
|
-
puts auto.generate_epl(
|
198
|
-
|
199
|
-
|
200
|
+
puts auto.generate_epl('Banda', 'Marysuperlonglastnamethatwonfit', 'U', 'Q23-HGF', '12-SEP-1997', '19y', 'F',
|
201
|
+
'01-JAN-2016 14:21', 'byGD', 'CHEM7,Ca,Mg', 'STAT CHEM', 'KCH-16-00001234', '1600001234')
|
200
202
|
|
201
203
|
end
|
data/lib/couch_bum/couch_bum.rb
CHANGED
@@ -13,7 +13,7 @@ class CouchBum
|
|
13
13
|
def initialize(database:, protocol: 'http', host: 'localhost', port: 5984, username: nil, password: nil)
|
14
14
|
@connection_string = make_connection_string(protocol, username, password, host, port, database)
|
15
15
|
|
16
|
-
CouchBum.logger ||= Logger.new(
|
16
|
+
CouchBum.logger ||= Logger.new($stdout)
|
17
17
|
end
|
18
18
|
|
19
19
|
##
|
@@ -25,7 +25,7 @@ class CouchBum
|
|
25
25
|
def binge_changes(since: 0, limit: nil, include_docs: nil, &block)
|
26
26
|
catch(:choke) do
|
27
27
|
logger.debug("Binging #{limit} changes from '#{since}'")
|
28
|
-
params = stringify_params(limit
|
28
|
+
params = stringify_params(limit:, include_docs:)
|
29
29
|
params = "since=#{since}&#{params}" unless since.blank?
|
30
30
|
|
31
31
|
changes = couch_rest(:get, "_changes?#{params}")
|
@@ -37,9 +37,9 @@ class CouchBum
|
|
37
37
|
end
|
38
38
|
end
|
39
39
|
|
40
|
-
def couch_rest(method, route,
|
40
|
+
def couch_rest(method, route, *, **)
|
41
41
|
url = expand_route(route)
|
42
|
-
CouchRest.send(method, url,
|
42
|
+
CouchRest.send(method, url, *, **)
|
43
43
|
rescue CouchRest::Exception => e
|
44
44
|
logger.error("Failed to communicate with CouchDB: Status: #{e.http_code} - #{e.http_body}")
|
45
45
|
raise e
|
data/lib/his_emr_api_lab.rb
CHANGED
data/lib/lab/engine.rb
CHANGED
data/lib/lab/version.rb
CHANGED
data/lib/logger_multiplexor.rb
CHANGED
@@ -22,9 +22,9 @@ class LoggerMultiplexor
|
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
25
|
-
def method_missing(method_name, *
|
25
|
+
def method_missing(method_name, *)
|
26
26
|
if respond_to_missing?(method_name)
|
27
|
-
@loggers.each { |logger| logger.send(method_name, *
|
27
|
+
@loggers.each { |logger| logger.send(method_name, *) }
|
28
28
|
else
|
29
29
|
super
|
30
30
|
end
|
data/lib/tasks/lab_tasks.rake
CHANGED
@@ -21,12 +21,12 @@ module Lab
|
|
21
21
|
short_name: name,
|
22
22
|
datatype_id: CONCEPT_DATATYPE_CODED,
|
23
23
|
class_id: CONCEPT_CLASS_TEST,
|
24
|
-
is_set
|
24
|
+
is_set:,
|
25
25
|
uuid: SecureRandom.uuid,
|
26
26
|
creator: User.current.user_id,
|
27
27
|
date_created: Time.now
|
28
28
|
),
|
29
|
-
name
|
29
|
+
name:,
|
30
30
|
locale: 'en',
|
31
31
|
concept_name_type: 'FULLY_SPECIED',
|
32
32
|
uuid: SecureRandom.uuid,
|
@@ -36,11 +36,11 @@ module Lab
|
|
36
36
|
end
|
37
37
|
|
38
38
|
def add_concept_to_set(set_concept_id:, concept_id:)
|
39
|
-
set = ConceptSet.find_by(concept_set: set_concept_id, concept_id:
|
39
|
+
set = ConceptSet.find_by(concept_set: set_concept_id, concept_id:)
|
40
40
|
return set if set
|
41
41
|
|
42
42
|
ConceptSet.create!(concept_set: set_concept_id,
|
43
|
-
concept_id
|
43
|
+
concept_id:,
|
44
44
|
creator: User.current.user_id,
|
45
45
|
date_created: Time.now)
|
46
46
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'csv'
|
4
|
-
require_relative '
|
4
|
+
require_relative 'loader_mixin'
|
5
5
|
|
6
6
|
module Lab
|
7
7
|
module Loaders
|
@@ -10,9 +10,9 @@ module Lab
|
|
10
10
|
module SpecimensLoader
|
11
11
|
class << self
|
12
12
|
include LoaderMixin
|
13
|
-
|
13
|
+
|
14
14
|
def load
|
15
|
-
puts
|
15
|
+
puts '------- Loading tests and specimens ---------'
|
16
16
|
CSV.open(data_path('tests.csv'), headers: :first_row) do |csv|
|
17
17
|
csv.each_with_object({}) do |row, test_types|
|
18
18
|
specimen_name = row['specimen_name']
|
@@ -40,11 +40,10 @@ module Lab
|
|
40
40
|
find_or_create_concept(Lab::Metadata::SPECIMEN_TYPE_CONCEPT_NAME).concept_id
|
41
41
|
end
|
42
42
|
|
43
|
-
|
44
43
|
def create_test_type(name)
|
45
44
|
concept_id = find_or_create_concept(name, is_set: true).concept_id
|
46
45
|
|
47
|
-
add_concept_to_set(set_concept_id: test_type_concept_id, concept_id:
|
46
|
+
add_concept_to_set(set_concept_id: test_type_concept_id, concept_id:)
|
48
47
|
rescue StandardError => e
|
49
48
|
raise "Failed to create test type `#{name}`: #{e}"
|
50
49
|
end
|
@@ -53,8 +52,8 @@ module Lab
|
|
53
52
|
concept_id = find_or_create_concept(name).concept_id
|
54
53
|
|
55
54
|
[
|
56
|
-
add_concept_to_set(set_concept_id: specimen_type_concept_id, concept_id:
|
57
|
-
add_concept_to_set(set_concept_id: test_type.concept_id, concept_id:
|
55
|
+
add_concept_to_set(set_concept_id: specimen_type_concept_id, concept_id:),
|
56
|
+
add_concept_to_set(set_concept_id: test_type.concept_id, concept_id:)
|
58
57
|
]
|
59
58
|
rescue StandardError => e
|
60
59
|
raise "Failed to create specimen type `#{name}`: #{e}"
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'csv'
|
4
|
-
require_relative '
|
4
|
+
require_relative 'loader_mixin'
|
5
5
|
|
6
6
|
module Lab
|
7
7
|
module Loaders
|
@@ -10,11 +10,11 @@ module Lab
|
|
10
10
|
module TestResultIndicatorsLoader
|
11
11
|
class << self
|
12
12
|
include LoaderMixin
|
13
|
-
|
13
|
+
|
14
14
|
def load
|
15
|
-
puts
|
15
|
+
puts '------- Loading measures ------------'
|
16
16
|
CSV.open(data_path('test-measures.csv'), headers: :first_row) do |csv|
|
17
|
-
csv.each_with_object({}) do |row,
|
17
|
+
csv.each_with_object({}) do |row, _test_measures|
|
18
18
|
test_name = row['test_name']
|
19
19
|
measure_name = row['measure_name']
|
20
20
|
|
@@ -33,7 +33,7 @@ module Lab
|
|
33
33
|
def create_test_type(name)
|
34
34
|
concept_id = find_or_create_concept(name, is_set: true).concept_id
|
35
35
|
|
36
|
-
create_concept_set(concept_set: test_type_concept_id, concept_id:
|
36
|
+
create_concept_set(concept_set: test_type_concept_id, concept_id:)
|
37
37
|
rescue StandardError => e
|
38
38
|
raise "Failed to create test type `#{name}`: #{e}"
|
39
39
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: his_emr_api_lab
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Elizabeth Glaser Pediatric Foundation Malawi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-02
|
11
|
+
date: 2024-04-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: couchrest
|
@@ -44,20 +44,14 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version:
|
48
|
-
- - ">="
|
49
|
-
- !ruby/object:Gem::Version
|
50
|
-
version: 5.2.4.3
|
47
|
+
version: 7.0.6
|
51
48
|
type: :runtime
|
52
49
|
prerelease: false
|
53
50
|
version_requirements: !ruby/object:Gem::Requirement
|
54
51
|
requirements:
|
55
52
|
- - "~>"
|
56
53
|
- !ruby/object:Gem::Version
|
57
|
-
version:
|
58
|
-
- - ">="
|
59
|
-
- !ruby/object:Gem::Version
|
60
|
-
version: 5.2.4.3
|
54
|
+
version: 7.0.6
|
61
55
|
- !ruby/object:Gem::Dependency
|
62
56
|
name: socket.io-client-simple
|
63
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -134,42 +128,42 @@ dependencies:
|
|
134
128
|
requirements:
|
135
129
|
- - "~>"
|
136
130
|
- !ruby/object:Gem::Version
|
137
|
-
version: 2.
|
131
|
+
version: 2.5.1
|
138
132
|
type: :development
|
139
133
|
prerelease: false
|
140
134
|
version_requirements: !ruby/object:Gem::Requirement
|
141
135
|
requirements:
|
142
136
|
- - "~>"
|
143
137
|
- !ruby/object:Gem::Version
|
144
|
-
version: 2.
|
138
|
+
version: 2.5.1
|
145
139
|
- !ruby/object:Gem::Dependency
|
146
140
|
name: rswag-specs
|
147
141
|
requirement: !ruby/object:Gem::Requirement
|
148
142
|
requirements:
|
149
143
|
- - "~>"
|
150
144
|
- !ruby/object:Gem::Version
|
151
|
-
version: 2.
|
145
|
+
version: 2.5.1
|
152
146
|
type: :development
|
153
147
|
prerelease: false
|
154
148
|
version_requirements: !ruby/object:Gem::Requirement
|
155
149
|
requirements:
|
156
150
|
- - "~>"
|
157
151
|
- !ruby/object:Gem::Version
|
158
|
-
version: 2.
|
152
|
+
version: 2.5.1
|
159
153
|
- !ruby/object:Gem::Dependency
|
160
154
|
name: rswag-ui
|
161
155
|
requirement: !ruby/object:Gem::Requirement
|
162
156
|
requirements:
|
163
157
|
- - "~>"
|
164
158
|
- !ruby/object:Gem::Version
|
165
|
-
version: 2.
|
159
|
+
version: 2.5.1
|
166
160
|
type: :development
|
167
161
|
prerelease: false
|
168
162
|
version_requirements: !ruby/object:Gem::Requirement
|
169
163
|
requirements:
|
170
164
|
- - "~>"
|
171
165
|
- !ruby/object:Gem::Version
|
172
|
-
version: 2.
|
166
|
+
version: 2.5.1
|
173
167
|
- !ruby/object:Gem::Dependency
|
174
168
|
name: rubocop
|
175
169
|
requirement: !ruby/object:Gem::Requirement
|
@@ -326,6 +320,7 @@ licenses:
|
|
326
320
|
- MIT
|
327
321
|
metadata:
|
328
322
|
source_code_uri: https://github.com/EGPAFMalawiHIS/his_emr_api_lab
|
323
|
+
rubygems_mfa_required: 'true'
|
329
324
|
post_install_message:
|
330
325
|
rdoc_options: []
|
331
326
|
require_paths:
|
@@ -341,7 +336,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
341
336
|
- !ruby/object:Gem::Version
|
342
337
|
version: '0'
|
343
338
|
requirements: []
|
344
|
-
rubygems_version: 3.
|
339
|
+
rubygems_version: 3.4.15
|
345
340
|
signing_key:
|
346
341
|
specification_version: 4
|
347
342
|
summary: Lab extension for the HIS-EMR-API
|