his_emr_api_lab 2.1.2 → 2.1.4
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 +4 -4
- data/app/services/lab/concepts_service.rb +2 -2
- data/app/services/lab/lims/exceptions.rb +11 -0
- data/app/services/lab/lims/order_serializer.rb +3 -8
- data/app/services/lab/lims/utils.rb +2 -3
- data/app/services/lab/results_service.rb +8 -2
- data/lib/lab/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 2086e2372ae3182efa9a1eb56d5dfe0845f770800f25891dec98af02530d7953
|
|
4
|
+
data.tar.gz: cebae46dd81f29f128b6904ccaa7dbefc780b0dfcc57d9f2e1f3087f86cfc830
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 6381879cefbb24c3226d2a68f458e26cea19bcf3db7f4b50fb97a14afc7b94958f2e76178d8f1fa0f4abd6ff976ddaa0ca5ce3f26fb309414117f0b82c872389
|
|
7
|
+
data.tar.gz: b6bede3239bb94db739c4ea1f7cf817a4eb217b9c5ba77bb9b3678dcb1b3edba44f41f71c8e0db00d9f1d333458a49376d8bb57a631473ed35ef4d3641293399
|
|
@@ -9,7 +9,7 @@ module Lab
|
|
|
9
9
|
FROM concept_set cs
|
|
10
10
|
INNER JOIN concept_name cn ON cn.concept_id = cs.concept_id
|
|
11
11
|
INNER JOIN concept_attribute ca ON ca.value_reference = #{ActiveRecord::Base.connection.quote(nlims_code)}
|
|
12
|
-
AND ca.attribute_type_id =
|
|
12
|
+
AND ca.attribute_type_id = #{ConceptAttributeType.nlims_code.concept_attribute_type_id}
|
|
13
13
|
WHERE cs.concept_id IN (SELECT concept_set.concept_id
|
|
14
14
|
FROM concept_set
|
|
15
15
|
WHERE concept_set.concept_set IN (SELECT concept_name.concept_id
|
|
@@ -22,8 +22,8 @@ module Lab
|
|
|
22
22
|
FROM concept_name
|
|
23
23
|
WHERE concept_name.voided = 0
|
|
24
24
|
AND concept_name.name = 'Test type')
|
|
25
|
-
AND concept_set.concept_id = ca.concept_id
|
|
26
25
|
)
|
|
26
|
+
AND cs.concept_set = ca.concept_id
|
|
27
27
|
GROUP BY cn.concept_id
|
|
28
28
|
SQL
|
|
29
29
|
end
|
|
@@ -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
|
|
@@ -144,10 +144,9 @@ module Lab
|
|
|
144
144
|
end
|
|
145
145
|
|
|
146
146
|
def format_test_status_trail(order)
|
|
147
|
-
tests = order.voided ? order.tests : Lab::LabOrderSerializer.voided_tests(order)
|
|
148
|
-
|
|
147
|
+
tests = order.voided.zero? ? order.tests : Lab::LabOrderSerializer.voided_tests(order)
|
|
149
148
|
tests.each_with_object({}) do |test, trail|
|
|
150
|
-
test_name = format_test_name(
|
|
149
|
+
test_name = format_test_name(::Concept.find(test.value_coded).test_catalogue_name)
|
|
151
150
|
|
|
152
151
|
current_test_trail = trail[test_name] = {}
|
|
153
152
|
|
|
@@ -209,11 +208,7 @@ module Lab
|
|
|
209
208
|
end
|
|
210
209
|
|
|
211
210
|
def format_test_name(test_name)
|
|
212
|
-
return
|
|
213
|
-
|
|
214
|
-
return 'TB' if test_name.casecmp?('TB Program')
|
|
215
|
-
|
|
216
|
-
test_name.titleize
|
|
211
|
+
return test_name
|
|
217
212
|
end
|
|
218
213
|
|
|
219
214
|
def format_sample_priority(priority)
|
|
@@ -78,9 +78,8 @@ module Lab
|
|
|
78
78
|
end
|
|
79
79
|
|
|
80
80
|
def self.find_concept_by_name(name)
|
|
81
|
-
ConceptName.joins(
|
|
82
|
-
.
|
|
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
|
-
|
|
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.
|
|
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