his_emr_api_lab 1.1.4 → 1.1.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/services/lab/lims/api/rest_api.rb +26 -0
- data/app/services/lab/lims/config.rb +1 -1
- data/app/services/lab/lims/order_dto.rb +1 -1
- data/app/services/lab/lims/worker.rb +1 -1
- data/db/migrate/20210807111531_add_default_to_lims_order_mapping.rb +7 -0
- data/lib/lab/version.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e5421bf2b632a395fa9870ba1a3e855aea8033f8c54034bda352fdf23409812e
|
4
|
+
data.tar.gz: 4cd24426fa0f0a5fe39c416bb0f35f28769c36b95eac72a8abca7579efd75c58
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 54815cf740ce0c0882752a341df21acbd51bde4102b0dcd2ddd581575efb70b9aa1284295dda7e6cb78b5e6355a3c983d5b41acf5f8f40fe8318737a6cce08a5
|
7
|
+
data.tar.gz: b516dd7ac285004b6d4e5125b73e159adf180a07b1cf0470ae4380d02ad274b72d2a68ec697c99deb3f4e8a5f057ec9d0682925e1d1a72b6986852285feea996
|
@@ -44,6 +44,9 @@ class Lab::Lims::Api::RestApi
|
|
44
44
|
|
45
45
|
def consume_orders(*_args, patient_id: nil, **_kwargs)
|
46
46
|
orders_pending_updates(patient_id).each do |order|
|
47
|
+
mapping = Lab::LimsOrderMapping.find_by(order_id: order.order_id)
|
48
|
+
next if mapping.nil? || check_and_fix_duplicate!(mapping, order)
|
49
|
+
|
47
50
|
order_dto = Lab::Lims::OrderSerializer.serialize_order(order)
|
48
51
|
|
49
52
|
if order_dto['priority'].nil? || order_dto['sample_type'].casecmp?('not_specified')
|
@@ -59,6 +62,9 @@ class Lab::Lims::Api::RestApi
|
|
59
62
|
end
|
60
63
|
|
61
64
|
yield order_dto, OpenStruct.new(last_seq: 0)
|
65
|
+
rescue LimsApiError => e
|
66
|
+
Rails.logger.error("Failed to fetch updates for ##{order.accession_number}: #{e.class} - #{e.message}")
|
67
|
+
sleep(1)
|
62
68
|
end
|
63
69
|
end
|
64
70
|
|
@@ -402,4 +408,24 @@ class Lab::Lims::Api::RestApi
|
|
402
408
|
|
403
409
|
orders
|
404
410
|
end
|
411
|
+
|
412
|
+
# Checks for duplicates previously created due to this proving orders that have
|
413
|
+
# not been pushed to LIMS as orders awaiting updates.
|
414
|
+
def check_and_fix_duplicate!(mapping, order)
|
415
|
+
duplicate_orders = Lab::LabOrder.where(accession_number: mapping.lims_id)
|
416
|
+
.where.not(order_id: mapping.order_id)
|
417
|
+
return false if duplicate_orders.size.zero?
|
418
|
+
|
419
|
+
unless order.discontinued
|
420
|
+
order.void('Duplicate created due to bug in HIS-EMR-API-Lab v1.1.7')
|
421
|
+
mapping.destroy
|
422
|
+
return true
|
423
|
+
end
|
424
|
+
|
425
|
+
duplicate_orders.each do |duplicate_order|
|
426
|
+
duplicate_order.void("Has duplicate that contains updates ##{order.order_id}: Duplicate was created by bug in HIS-EMR-API-Lab v1.1.7")
|
427
|
+
end
|
428
|
+
|
429
|
+
true
|
430
|
+
end
|
405
431
|
end
|
@@ -32,7 +32,7 @@ module Lab
|
|
32
32
|
def specimen_type_id
|
33
33
|
lims_specimen_name = self['sample_type']&.strip&.downcase
|
34
34
|
|
35
|
-
if %w[specimen_not_collected not_assigned not_specified].include?(lims_specimen_name)
|
35
|
+
if lims_specimen_name.nil? || %w[specimen_not_collected not_assigned not_specified].include?(lims_specimen_name)
|
36
36
|
return ConceptName.select(:concept_id).find_by_name!('Unknown').concept_id
|
37
37
|
end
|
38
38
|
|
@@ -45,7 +45,7 @@ module Lab
|
|
45
45
|
|
46
46
|
def self.start_worker(worker_name)
|
47
47
|
Rails.logger = LoggerMultiplexor.new(log_path("#{worker_name}.log"), $stdout)
|
48
|
-
ActiveRecord::Base.logger = Rails.logger
|
48
|
+
# ActiveRecord::Base.logger = Rails.logger
|
49
49
|
Rails.logger.level = :debug
|
50
50
|
|
51
51
|
File.open(log_path("#{worker_name}.lock"), File::RDWR | File::CREAT, 0o644) do |fout|
|
data/lib/lab/version.rb
CHANGED
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: 1.1.
|
4
|
+
version: 1.1.8
|
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: 2021-
|
11
|
+
date: 2021-08-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: couchrest
|
@@ -290,6 +290,7 @@ files:
|
|
290
290
|
- db/migrate/20210326195504_add_order_revision_to_lims_order_mapping.rb
|
291
291
|
- db/migrate/20210407071728_create_lab_lims_failed_imports.rb
|
292
292
|
- db/migrate/20210610095024_fix_numeric_results_value_type.rb
|
293
|
+
- db/migrate/20210807111531_add_default_to_lims_order_mapping.rb
|
293
294
|
- lib/auto12epl.rb
|
294
295
|
- lib/couch_bum/couch_bum.rb
|
295
296
|
- lib/generators/lab/install/USAGE
|
@@ -330,7 +331,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
330
331
|
- !ruby/object:Gem::Version
|
331
332
|
version: '0'
|
332
333
|
requirements: []
|
333
|
-
rubygems_version: 3.
|
334
|
+
rubygems_version: 3.1.4
|
334
335
|
signing_key:
|
335
336
|
specification_version: 4
|
336
337
|
summary: Lab extension for the HIS-EMR-API
|