his_emr_api_lab 1.1.19 → 1.1.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1417f8496820741d5eb37f1d2ae95da6ffdb27cc3b434242d079f6780d7eaeec
4
- data.tar.gz: 17bf60bd54605de176c26f87f7da8653789d1df101920814b354512d8cca3c68
3
+ metadata.gz: ef07023388b9d06939b9e9b0d09531aaecf58471eb2e62b2f883bc8112121cf8
4
+ data.tar.gz: b4aa93d96700812eed8cd0c04e37130b56f30fec563c168679b420ccd229ddb7
5
5
  SHA512:
6
- metadata.gz: 6c5722a094de688a6803de102553bdc928e29b28b208bf12f999a98e5d631cbc5b817c5982e5a1bc349a366263dcd3bd66ab2a1618a70b8d4ecbd8f2c86c0644
7
- data.tar.gz: 8ed510173d514efcdf307cbb38d70fb4e25b19752bb95f1f20a0f4a0cdc6efd5b2d3cf5761648b8a5ac92d17072fb4a35bdbca0de929937ecccbe6525e30cfaf
6
+ metadata.gz: 97cb016a11e134600fb11f1017df49f819ca43efdc973f2e526a9493c02e126a7af9af19ce58caa4f4e67b2d13e18fb99b1abd45136cf2dabb54f613c92402a6
7
+ data.tar.gz: cdf3a623a0e5b25e9436aa108cafce799ca1e5fdd7a22688062fcff7a07dcda5f9a5aaab7127952e4ec5569e09c827513b6cf07b446f16b8a29921f28d2016ae
@@ -35,6 +35,10 @@ module Lab
35
35
  class_name: 'Observation',
36
36
  foreign_key: :order_id
37
37
 
38
+ has_one :mapping,
39
+ class_name: '::Lab::LimsOrderMapping',
40
+ foreign_key: :order_id
41
+
38
42
  default_scope do
39
43
  joins(:order_type)
40
44
  .merge(OrderType.where(name: Lab::Metadata::ORDER_TYPE_NAME))
@@ -57,7 +57,11 @@ module Lab
57
57
  elsif mapping
58
58
  Rails.logger.info("Updating order ##{order_dto[:accession_number]} in LIMS")
59
59
  lims_api.update_order(mapping.lims_id, order_dto)
60
- mapping.update(pushed_at: Time.now)
60
+ if order_dto['test_results'].nil? || order_dto['test_results'].empty?
61
+ mapping.update(pushed_at: Time.now)
62
+ else
63
+ mapping.update(pushed_at: Time.now, result_push_status: true)
64
+ end
61
65
  elsif order_dto[:_id] && Lab::LimsOrderMapping.where(lims_id: order_dto[:_id]).exists?
62
66
  # HACK: v1.1.7 had a bug where duplicates of recently created orders where being created by
63
67
  # the pull worker. This here detects those duplicates and voids them.
@@ -67,7 +71,7 @@ module Lab
67
71
  Rails.logger.info("Creating order ##{order_dto[:accession_number]} in LIMS")
68
72
  update = lims_api.create_order(order_dto)
69
73
  Lab::LimsOrderMapping.create!(order: order, lims_id: update['id'], revision: update['rev'],
70
- pushed_at: Time.now)
74
+ pushed_at: Time.now, result_push_status: false)
71
75
  end
72
76
  end
73
77
 
@@ -97,8 +101,9 @@ module Lab
97
101
  .last_updated
98
102
 
99
103
  Lab::LabOrder.left_joins(:results)
104
+ .joins(:mapping)
100
105
  .where('orders.discontinued_date > :last_updated
101
- OR obs.date_created > orders.date_created',
106
+ OR obs.date_created > orders.date_created AND lab_lims_order_mappings.result_push_status = 0',
102
107
  last_updated: last_updated)
103
108
  .group('orders.order_id')
104
109
  .order(discontinued_date: :desc, date_created: :desc)
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.19'
4
+ VERSION = '1.1.20'
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.19
4
+ version: 1.1.20
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-16 00:00:00.000000000 Z
11
+ date: 2022-01-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: couchrest