his_emr_api_lab 2.1.2 → 2.1.3

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: bbe2fcb401fa3f57e0cbc85561f9ef2152e0b1736ca33ea08e36fd8aaffbeeb5
4
- data.tar.gz: e3ab952d0c5ba09a760b554c079873884b9b937bd4822e822c0b1317ca52694c
3
+ metadata.gz: c71682551eb38f2c025993390d6d32f064be0fd35da372dede313882f12c6ad8
4
+ data.tar.gz: f59352b4aceb5d7cf891cb094ef9b213f7e191d453936ca97396101d789e3846
5
5
  SHA512:
6
- metadata.gz: 735e54a4be6f1e29cd34c5b1bad5bca0aab35de90630ab0eca52d339bfff626801db089d1bb80d62f5751cd680d3b14bbb7d975c6c5143db5a2ea2ba8d7324e4
7
- data.tar.gz: 395df3bcfe287ffbe505df72c6d4256715210147a5b933d464c1ec9c617999ead6b0d9cc90eb5e903dc82ccf274ac9afc482cffd2c767756d6c2f0be499ef315
6
+ metadata.gz: 2db7d3ee59f9cd0e94c2eccc5f7a4514d9c25479e6e31dcce709aa3005934b6c3a2b794fa8e297e86a792f9c311a12628bd1c117d8202aafe49da6c72606643a
7
+ data.tar.gz: 025253b76aa0cb65c237e03aecbcf7010a9a847b7c249d46af7c51330fdbf6ef03b6ee82051aa12271984511091a6d639e46b61c9ca51a3714f1b30b806ba623
@@ -11,3 +11,14 @@ module Lab
11
11
  end
12
12
  end
13
13
  end
14
+
15
+
16
+ module Lab
17
+ module Lims
18
+ class LimsException < StandardError; end
19
+ class DuplicateNHID < LimsException; end
20
+ class MissingAccessionNumber < LimsException; end
21
+ class UnknownSpecimenType < LimsException; end
22
+ class UnknownTestType < LimsException; end
23
+ end
24
+ end
@@ -78,9 +78,8 @@ module Lab
78
78
  end
79
79
 
80
80
  def self.find_concept_by_name(name)
81
- ConceptName.joins(:concept)
82
- .merge(Concept.all) # Filter out voided
83
- .where(name: CGI.unescapeHTML(name))
81
+ ConceptName.joins("INNER JOIN concept_attribute ON concept_attribute.concept_id = concept_name.concept_id")
82
+ .where("concept_attribute.value_reference = ?", CGI.unescapeHTML(name))
84
83
  .first
85
84
  end
86
85
  end
@@ -35,7 +35,11 @@ module Lab
35
35
  serializer = Lab::ResultSerializer.serialize(results_obs)
36
36
  end
37
37
 
38
- ProcessLabResultJob.perform_later(results_obs.id, serializer, result_enter_by)
38
+ # force commit all transactions
39
+ ActiveRecord::Base.connection.commit_db_transaction
40
+
41
+ # delay job by a second
42
+ ProcessLabResultJob.set(wait: 1.second).perform_later(results_obs.id, serializer, result_enter_by)
39
43
 
40
44
  Rails.logger.info("Lab::ResultsService: Result created for test #{test_id} #{serializer}")
41
45
  serializer
@@ -78,12 +82,14 @@ module Lab
78
82
  def find_encounter(test, encounter_id: nil, encounter_uuid: nil, date: nil, provider_id: nil)
79
83
  return Encounter.find(encounter_id) if encounter_id
80
84
  return Encounter.find_by_uuid(encounter_uuid) if encounter_uuid
85
+ encounter_type = EncounterType.find_by_name!(Lab::Metadata::ENCOUNTER_TYPE_NAME)
81
86
 
82
87
  encounter = Encounter.new
83
88
  encounter.patient_id = test.person_id
84
89
  encounter.program_id = test.encounter.program_id if Encounter.column_names.include?('program_id')
85
90
  encounter.visit_id = test.encounter.visit_id if Encounter.column_names.include?('visit_id')
86
- encounter.encounter_type = EncounterType.find_by_name!(Lab::Metadata::ENCOUNTER_TYPE_NAME)
91
+ encounter.type = encounter_type
92
+ encounter.encounter_type = encounter_type if (encounter&.encounter_type.nil? || encounter&.type.nil?)
87
93
  encounter.encounter_datetime = date || Date.today
88
94
  encounter.provider_id = provider_id || User.current.user_id if Encounter.column_names.include?('provider_id')
89
95
 
data/lib/lab/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Lab
4
- VERSION = '2.1.2'
4
+ VERSION = '2.1.3'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: his_emr_api_lab
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.2
4
+ version: 2.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Elizabeth Glaser Pediatric Foundation Malawi