his_emr_api_lab 0.0.7 → 0.0.8

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: 2de242e5fc5982f097e27abb3b4c85ac45b3eb8296ba53bf285ebe8a3422d486
4
- data.tar.gz: '064059e7286ba44485e1707c2be889126776e15125732859bc41c682d4784002'
3
+ metadata.gz: 7b410e215fad55950c150d2ec7a82bda3f434cca4cc287e0d4fca2a9116e9182
4
+ data.tar.gz: 6b3a0c75c303c2139c1f6f963875667c4606bce42d23f6a22c277412e24db960
5
5
  SHA512:
6
- metadata.gz: c2bff8f28b0319d9cb19120704738a5cad5820cc8036abb083666d40d3b5f07d1c9d460b9c5b93bc5c7fe5cf393ac091196d0042bbf50730ad812dc1cad0979e
7
- data.tar.gz: 8c1b11e868f38fcd9c61d275b2bd74783dd698eaaea2ee88d2819b76c944c36972856090a239f7087b3c96a65de7104fd65347ce7128f3c76d799768dbd80253
6
+ metadata.gz: 4f6068aecbc02d5c3df75ac422c4d4f9baeac86c6559a1e75078ef68088b4e6702239a366fb5e5879a2925592e3440a2880668bcc50f4730c9d2051f522ac94a
7
+ data.tar.gz: 5e3b4d61f507f2de7847951dcdd738a50dd29ba4ae5f981ce8284f3ba11c35d6d1c337787c1b78154b96eb318fc5343d404a3827fd02c89ffc3da60eb2d617c3
@@ -27,7 +27,7 @@ module Lab
27
27
  '',
28
28
  drawer,
29
29
  '',
30
- specimen,
30
+ tests,
31
31
  reason_for_test,
32
32
  order.accession_number,
33
33
  order.accession_number)
@@ -36,7 +36,7 @@ module Lab
36
36
  def reason_for_test
37
37
  return 'Unknown' unless order.reason_for_test
38
38
 
39
- ConceptName.find_by_concept_id(order.reason_for_test.value_coded)&.name || 'Unknown'
39
+ short_concept_name(order.reason_for_test.value_coded) || 'Unknown'
40
40
  end
41
41
 
42
42
  def patient
@@ -73,6 +73,24 @@ module Lab
73
73
  ConceptName.find_by_concept_id(order.concept_id)&.name || 'Unknown'
74
74
  end
75
75
 
76
+ def tests
77
+ tests = order.tests.map do |test|
78
+ name = short_concept_name(test.value_coded) || 'Unknown'
79
+
80
+ next 'VL' if name.match?(/Viral load/i)
81
+
82
+ name.size > 7 ? name[0..6] : name
83
+ end
84
+
85
+ tests.join(', ')
86
+ end
87
+
88
+ def short_concept_name(concept_id)
89
+ ConceptName.where(concept_id: concept_id)
90
+ .min_by { |concept| concept.name.size }
91
+ &.name
92
+ end
93
+
76
94
  def unknown_concept
77
95
  ConceptName.find_by_name('Unknown')
78
96
  end
@@ -28,7 +28,9 @@ module Lab
28
28
  fout.write("Worker ##{Process.pid} started at #{Time.now}")
29
29
  worker = new(Api.new)
30
30
  worker.pull_orders
31
- worker.push_orders
31
+ # TODO: Verify that names being pushed to LIMS are of the correct format (ie matching
32
+ # LIMS naming conventions). Enable pushing when that is done
33
+ # worker.push_orders
32
34
  end
33
35
  end
34
36
 
data/lib/lab/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Lab
4
- VERSION = '0.0.7'
4
+ VERSION = '0.0.8'
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: 0.0.7
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Elizabeth Glaser Pediatric Foundation Malawi