mahis_emr_api_lab 1.2.5 → 1.2.6

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: 0b93353e9b867677abd45317e32291dcbd53d68e328cb2ac7cc2e294d719b71f
4
- data.tar.gz: 22fcdf2407609885b81df63de7be75ff20156f6b0b6d8de6a6eb8974d54915ae
3
+ metadata.gz: 114c56e62980ef6a721d63240bb14fe640076d26cafb7d4c3fe41483786c9466
4
+ data.tar.gz: 4cdd59a7566f7128e0b6bfa6589d3525559a981891879c42b37e208489e7ca35
5
5
  SHA512:
6
- metadata.gz: e95ee315519fcf1d77d9b337b449921c05489cf7842bf2f74e730f61fd298233aba7b87c0a819b6bcac9f39c58c87703c5ed76a9b7b1f31b60573d3fcceb8b14
7
- data.tar.gz: 3326b887701a0fdf285bb37f2a2daa56500f4b81875080cb711bc25b046370e94c6e198c837e7521415b69ccc0cbfe01cb0c18096e09196f2b79468eaf15fbba
6
+ metadata.gz: 1a73a0cd671d283d5cda912c1ee324eaa6fe5ba15ea25e2864fb50c40e7bf474b2bd517b243a664dca1a15a8850f6a4cef503b114f0db333a3aaa6b807739366
7
+ data.tar.gz: 20e8eb0cda6e7840b38015ee6c25fb1833e07da1fce05e27e30111e29e5efc94b633902068cc2c2dbc3479574cc8291cc863b122c9e547d5e6b45c6f84a470a2
@@ -2,9 +2,10 @@
2
2
 
3
3
  module Lab
4
4
  module LabOrderSerializer
5
- def self.serialize_order(order, tests: nil, requesting_clinician: nil, reason_for_test: nil, target_lab: nil)
5
+ def self.serialize_order(order, tests: nil, requesting_clinician: nil, reason_for_test: nil, target_lab: nil, comment_to_fulfiller: nil)
6
6
  tests ||= order.voided == 1 ? voided_tests(order) : order.tests
7
7
  requesting_clinician ||= order.requesting_clinician
8
+ comment_to_fulfiller ||= order.comment_to_fulfiller
8
9
  reason_for_test ||= order.reason_for_test
9
10
  target_lab = target_lab&.value_text || order.target_lab&.value_text || Location.current_health_center&.name
10
11
  ActiveSupport::HashWithIndifferentAccess.new(
@@ -21,6 +22,7 @@ module Lab
21
22
  },
22
23
  requesting_clinician: requesting_clinician&.value_text,
23
24
  target_lab: target_lab,
25
+ comment_to_fulfiller: comment_to_fulfiller&.value_text,
24
26
  reason_for_test: {
25
27
  concept_id: reason_for_test&.value_coded,
26
28
  name: concept_name(reason_for_test&.value_coded)
@@ -5,6 +5,7 @@ module Lab
5
5
  # Concepts
6
6
  REASON_FOR_TEST_CONCEPT_NAME = 'Reason for test'
7
7
  REQUESTING_CLINICIAN_CONCEPT_NAME = 'Person making request'
8
+ COMMENT_TO_FULFILLER_CONCEPT_NAME = 'Comment to fulfiller'
8
9
  SPECIMEN_TYPE_CONCEPT_NAME = 'Specimen type'
9
10
  TARGET_LAB_CONCEPT_NAME = 'Lab'
10
11
  TEST_RESULT_CONCEPT_NAME = 'Lab test result'
@@ -63,7 +63,8 @@ module Lab
63
63
  Lab::LabOrderSerializer.serialize_order(
64
64
  order, requesting_clinician: add_requesting_clinician(order, order_params),
65
65
  reason_for_test: add_reason_for_test(order, order_params),
66
- target_lab: add_target_lab(order, order_params)
66
+ target_lab: add_target_lab(order, order_params),
67
+ comment_to_fulfiller: add_comment_to_fulfiller(order, order_params)
67
68
  )
68
69
  end
69
70
  end
@@ -97,11 +98,12 @@ module Lab
97
98
  end
98
99
 
99
100
  def void_order(order_id, reason)
100
- order = Lab::LabOrder.includes(%i[requesting_clinician reason_for_test target_lab], tests: [:result])
101
+ order = Lab::LabOrder.includes(%i[requesting_clinician reason_for_test target_lab comment_to_fulfiller], tests: [:result])
101
102
  .find(order_id)
102
103
 
103
104
  order.requesting_clinician&.void(reason)
104
105
  order.reason_for_test&.void(reason)
106
+ order.comment_to_fulfiller&.void(reason)
105
107
  order.target_lab&.void(reason)
106
108
 
107
109
  order.tests.each { |test| test.void(reason) }
@@ -224,6 +226,7 @@ module Lab
224
226
  order.date_created = params[:date]&.to_date || Date.today if order.respond_to?(:date_created)
225
227
  order.start_date = params[:date]&.to_date || Date.today if order.respond_to?(:start_date)
226
228
  order.auto_expire_date = params[:end_date]
229
+ order.comment_to_fulfiller = params[:comment_to_fulfiller] if params[:comment_to_fulfiller]
227
230
  order.accession_number = access_number
228
231
  order.orderer = User.current&.user_id
229
232
 
@@ -256,6 +259,15 @@ module Lab
256
259
  )
257
260
  end
258
261
 
262
+ def add_comment_to_fulfiller(order, params)
263
+ create_order_observation(
264
+ order,
265
+ Lab::Metadata::COMMENT_TO_FULFILLER_CONCEPT_NAME,
266
+ params[:date],
267
+ value_text: params['comment_to_fulfiller']
268
+ )
269
+ end
270
+
259
271
  ##
260
272
  # Attach a reason for the order/test
261
273
  #
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.2.5'
4
+ VERSION = '1.2.6'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mahis_emr_api_lab
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.5
4
+ version: 1.2.6
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: 2025-06-18 00:00:00.000000000 Z
11
+ date: 2025-07-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: couchrest
@@ -198,14 +198,14 @@ dependencies:
198
198
  requirements:
199
199
  - - "~>"
200
200
  - !ruby/object:Gem::Version
201
- version: 1.4.0
201
+ version: '1.7'
202
202
  type: :development
203
203
  prerelease: false
204
204
  version_requirements: !ruby/object:Gem::Requirement
205
205
  requirements:
206
206
  - - "~>"
207
207
  - !ruby/object:Gem::Version
208
- version: 1.4.0
208
+ version: '1.7'
209
209
  description: |
210
210
  This adds a lab interface to the OpenMRS compatible core API provided by
211
211
  [HIS-EMR-API](https://github.com/EGPAFMalawiHIS/HIS-EMR-API).