his_emr_api_lab 1.1.3 → 1.1.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: eb21c8db8180a800fc69ebdfcfe9e2e804a96c698e73f28ae3c2c865a8853c16
4
- data.tar.gz: 2e2697ddeb327c79698ca229f9d625b6e6105e5621348df1c7d2d06d5c7b7cbb
3
+ metadata.gz: 87bb3f6d6ab772890afd0597ea354e2c531f00acf0252d003ca4daf3287d5ef9
4
+ data.tar.gz: '0292911676d1e1b21ca843826f98a899fccb2bdd767532b18565722a01acf69c'
5
5
  SHA512:
6
- metadata.gz: 4440f3a2b7493335594206621cb2381207b59dfab73d841431d77ef8ba7f28f1bc033617378c7789f50e52dacdb0318b8e2ab1d93f3929b6a66601dbbfa1537c
7
- data.tar.gz: aacb8d43a4b71dc017a46d3f19791defc5f9f7b0562a96c8514d3d821f7d79124ce59719bcbf91f2042c7da61f61907bbab2b7e04b33b18443c0ea204b902f18
6
+ metadata.gz: 4fb657851d9eaeda1b6003b24ae28989da574b62a070d95e97441211fbf4034b0ae6f95dcfaca809b2661dabc2ca68d0ef725d0d15ba9a462d74c53b5dd96143
7
+ data.tar.gz: 91ebb9c3384c48e043c30057a12c14938110c6e82616caf6ec6b3bbd392affe865ee4369fe8a983936bc3527ca33b5232aa81ea1302cf897397428fc916e0a73
@@ -59,6 +59,9 @@ class Lab::Lims::Api::RestApi
59
59
  end
60
60
 
61
61
  yield order_dto, OpenStruct.new(last_seq: 0)
62
+ rescue LimsApiError => e
63
+ Rails.logger.error("Failed to fetch updates for ##{order.accession_number}: #{e.class} - #{e.message}")
64
+ sleep(1)
62
65
  end
63
66
  end
64
67
 
@@ -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
 
@@ -64,7 +64,7 @@ module Lab
64
64
  first_name: name&.given_name,
65
65
  last_name: name&.family_name,
66
66
  id: national_id&.identifier,
67
- phone_number: phone_number&.value,
67
+ phone_number: phone_number&.value || 'Unknown',
68
68
  gender: person.gender,
69
69
  email: nil
70
70
  }
@@ -83,9 +83,7 @@ module Lab
83
83
  end
84
84
 
85
85
  def format_sample_status_trail(order)
86
- if order.concept_id == ConceptName.find_by_name!('Unknown').concept_id
87
- return []
88
- end
86
+ return [] if order.concept_id == ConceptName.find_by_name!('Unknown').concept_id
89
87
 
90
88
  user = User.find(order.discontinued_by || order.creator)
91
89
  drawn_by = PersonName.find_by_person_id(user.user_id)
@@ -17,7 +17,12 @@ module Lab
17
17
  loop do
18
18
  logger.info('Looking for new orders to push to LIMS...')
19
19
  orders = orders_pending_sync(batch_size).all
20
- orders.each { |order| push_order(order) }
20
+ orders.each do |order|
21
+ push_order(order)
22
+ rescue GatewayError => e
23
+ logger.error("Failed to push order ##{order.accession_number}: #{e.class} - #{e.message}")
24
+ sleep(Lab::Lims::Config.updates_poll_frequency)
25
+ end
21
26
 
22
27
  # Doing this after .each above to stop ActiveRecord from executing
23
28
  # an extra request to the database (ActiveRecord's lazy evaluation
@@ -0,0 +1,7 @@
1
+ class AddDefaultToLimsOrderMapping < ActiveRecord::Migration[5.2]
2
+ def up
3
+ change_column :lab_lims_order_mappings, :revision, :string, limit: 256, default: nil, null: true
4
+ end
5
+
6
+ def down; end
7
+ end
data/lib/lab/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Lab
4
- VERSION = '1.1.3'
4
+ VERSION = '1.1.7'
5
5
  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: 1.1.3
4
+ version: 1.1.7
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-07-19 00:00:00.000000000 Z
11
+ date: 2021-08-09 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