his_emr_api_lab 2.0.9 → 2.1.0

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: 306fe47c9b027c61e15e1bd6fe2cee372f08e084acc06375f3a1dcbdf79be1bd
4
- data.tar.gz: 8ac31940e00893ffcc554e721c12aa957017c7ab8fc7db69c231830eb063595e
3
+ metadata.gz: fa0a902d0f6f1159525e92598deb3ee77684c17c12a52078fa20d44cf2cafec1
4
+ data.tar.gz: a0b8c8d773c498dc77b4beaeb460b491695785cca91245bf62149d434e1e4841
5
5
  SHA512:
6
- metadata.gz: 28b4c75bed9b3da3c47e0c19e717b51606e3ff1212b5c07d9c9e78cd29496d3b18299e0ce394b8491847faf6dc4c3e9eaf7f51e6f3836a7d957dd4f260292aea
7
- data.tar.gz: d9e847ea4fd3c2725ac69222d4e0e1ef8398d06baba9112c2988c0894faeff778eb866ac10a44af3f9a7b9ba9a966c0f90d5f0c704bc0c7a1ff3ce345d238a01
6
+ metadata.gz: f24e327db48725b4ddffb24e12dcd09e02c1a0965ecdeb6aae08ab547305de6053a2d93d07154ed7750639b376b51bbedaeee54ec6cd44eeeb992f6d46dd5e8e
7
+ data.tar.gz: beca813e59561a368b4ad8252f82364b19c801adcead63d8c4b3f1562ebe1066b94f4d09a3abb6c1f734728836de5b719bb3deb685598127220741fcb4f42541
@@ -23,9 +23,10 @@ module Lab
23
23
  patient.family_name,
24
24
  patient.given_name,
25
25
  patient.gender,
26
- drawer_date,
26
+ drawer,
27
27
  tests,
28
28
  order.accession_number,
29
+ patient.arv,
29
30
  number_of_copies
30
31
  )
31
32
  else
@@ -43,6 +44,7 @@ module Lab
43
44
  reason_for_test,
44
45
  order.accession_number,
45
46
  order.accession_number,
47
+ patient.arv,
46
48
  number_of_copies
47
49
  )
48
50
  end
@@ -76,27 +78,22 @@ module Lab
76
78
  patient_identifier = PatientIdentifier.where(type: PatientIdentifierType.where(name: 'National id'),
77
79
  patient_id: order.patient_id)
78
80
  .first
79
-
81
+ arv_identifier = PatientIdentifier.where(type: PatientIdentifierType.where(name: 'ARV Number'),
82
+ patient_id: order.patient_id)
83
+ .first
80
84
  @patient = OpenStruct.new(
81
85
  given_name: person_name.given_name,
82
86
  family_name: person_name.family_name,
83
87
  birthdate: person.birthdate,
84
88
  gender: person.gender,
85
- nhid: patient_identifier&.identifier || 'Unknown'
89
+ nhid: patient_identifier&.identifier || 'Unknown',
90
+ arv: arv_identifier&.identifier || ''
86
91
  )
87
92
  end
88
93
 
89
94
  def drawer
90
95
  return 'N/A' if order.concept_id == unknown_concept.concept_id
91
-
92
- drawer_id = User.find(order.discontinued_by || order.creator).person_id
93
- draw_date = (order.discontinued_date || order.start_date).strftime('%d/%^b/%Y %H:%M:%S')
94
-
95
- name = PersonName.find_by_person_id(drawer_id)
96
- return "#{name.given_name} #{name.family_name} #{draw_date}" if name
97
-
98
- user = User.find_by_user_id(drawer_id)
99
- user ? "#{user.username} #{draw_date}" : 'N/A'
96
+ (order.discontinued_date || order.start_date).strftime('%d/%^b/%Y')
100
97
  end
101
98
 
102
99
  def drawer_date
data/lib/auto12epl.rb CHANGED
@@ -96,7 +96,8 @@ class Auto12Epl
96
96
  "#{last_name}, #{first_name}#{middle_initial.nil? ? '' : " #{middle_initial}"}"
97
97
  end
98
98
 
99
- def generate_small_specimen_label(last_name, first_name, gender, col_date_time, tests, acc_num, number_of_copies = print_copies)
99
+ def generate_small_specimen_label(last_name, first_name, gender, col_date_time, tests, acc_num, arv_number, number_of_copies = print_copies)
100
+ arv_display = tests.match?(/vl/i) ? arv_number : ''
100
101
  <<~TEXT
101
102
  N
102
103
  R216,0
@@ -104,7 +105,7 @@ class Auto12Epl
104
105
  S1
105
106
  A100,6,0,1,1,1,N,"#{first_name}, #{last_name} - #{gender}"
106
107
  B120,40,0,1A,1,2,48,N,"#{acc_num}"
107
- A100,100,0,1,1,1,N,"#{acc_num}"
108
+ A100,100,0,1,1,1,N,"#{acc_num} #{arv_display}"
108
109
  A100,118,0,1,1,1,N,"#{col_date_time}"
109
110
  A100,140,0,1,1,1,N,"#{tests}"
110
111
  P#{number_of_copies}
@@ -113,45 +114,22 @@ class Auto12Epl
113
114
 
114
115
  # The main function to generate the EPL
115
116
  def generate_epl(last_name, first_name, middle_initial, pid, dob, age, gender, col_date_time, col_name, tests, stat,
116
- acc_num, schema_track, number_of_copies = print_copies)
117
- # format text and set margin
118
- if stat.nil?
119
- name_text = truncate_name(last_name, first_name, middle_initial, false)
120
- pid_dob_age_gender_text = full_justify(pid, "#{dob} #{age} #{gender}", @element_font, WIDTH_ELEMENT)
121
- l_margin = L_MARGIN
122
- l_margin_barcode = L_MARGIN_BARCODE
123
- else
124
- name_text = truncate_name(last_name, first_name, middle_initial, true)
125
- pid_dob_age_gender_text = full_justify(pid, "#{dob} #{age} #{gender}", @element_font, STAT_WIDTH_ELEMENT)
126
- stat_element_text = pad_stat_w_space(stat)
127
- l_margin = L_MARGIN_W_STAT
128
- l_margin_barcode = L_MARGIN_BARCODE_W_STAT
129
- end
130
- barcode_human_text = "#{acc_num} * #{schema_track.gsub(/-/i, '')}"
131
- collector_element_text = "Col: #{col_date_time} #{col_name}"
132
- tests_element_text = tests
133
-
134
- # generate EPL statements
135
- name_element = generate_ascii_element(to_dots(l_margin), to_dots(HEIGHT_MARGIN), 0, @element_font, false, name_text)
136
- pid_dob_age_gender_element = generate_ascii_element(to_dots(l_margin),
137
- to_dots(HEIGHT_MARGIN + HEIGHT_ELEMENT + HEIGHT_ELEMENT_SPACE), 0, @element_font, false, pid_dob_age_gender_text)
138
- barcode_human_element = generate_ascii_element(to_dots(l_margin_barcode),
139
- to_dots(HEIGHT_MARGIN + HEIGHT_ELEMENT + HEIGHT_ELEMENT_SPACE + HEIGHT_ELEMENT + HEIGHT_ELEMENT_SPACE + HEIGHT_BARCODE), 0, @barcode_human_font, false, barcode_human_text)
140
- collector_element = generate_ascii_element(to_dots(l_margin),
141
- to_dots(HEIGHT_MARGIN + HEIGHT_ELEMENT + HEIGHT_ELEMENT_SPACE + HEIGHT_ELEMENT + HEIGHT_ELEMENT_SPACE + HEIGHT_BARCODE + HEIGHT_BARCODE_HUMAN + HEIGHT_ELEMENT_SPACE), 0, @element_font, false, collector_element_text)
142
- tests_element = generate_ascii_element(to_dots(l_margin),
143
- to_dots(HEIGHT_MARGIN + HEIGHT_ELEMENT + HEIGHT_ELEMENT_SPACE + HEIGHT_ELEMENT + HEIGHT_ELEMENT_SPACE + HEIGHT_BARCODE + HEIGHT_BARCODE_HUMAN + HEIGHT_ELEMENT_SPACE + HEIGHT_ELEMENT + HEIGHT_ELEMENT_SPACE), 0, @element_font, false, tests_element_text)
144
- barcode_element = generate_barcode_element(to_dots(l_margin_barcode),
145
- to_dots(HEIGHT_MARGIN + HEIGHT_ELEMENT + HEIGHT_ELEMENT_SPACE + HEIGHT_ELEMENT + HEIGHT_ELEMENT_SPACE), to_dots(HEIGHT_BARCODE) - 4, schema_track)
146
- stat_element = generate_ascii_element(to_dots(L_MARGIN) + FONT_Y_DOTS.at(@element_font - 1) + FONT_PAD_DOTS,
147
- to_dots(HEIGHT_MARGIN), 1, @element_font, true, stat_element_text)
148
-
149
- # combine EPL statements
150
- if stat.nil?
151
- "\nN\nR216,0\nZT\nS1\n#{name_element}\n#{pid_dob_age_gender_element}\n#{barcode_element}\n#{barcode_human_element}\n#{collector_element}\n#{tests_element}\nP#{number_of_copies}\n"
152
- else
153
- "\nN\nR216,0\nZT\nS1\n#{name_element}\n#{pid_dob_age_gender_element}\n#{barcode_element}\n#{barcode_human_element}\n#{collector_element}\n#{tests_element}\n#{stat_element}\nP#{number_of_copies}\n"
154
- end
117
+ acc_num, schema_track, arv_number, number_of_copies = print_copies)
118
+ # Show ARV number only if test contains 'vl' (case insensitive)
119
+ arv_display = tests.match?(/vl/i) ? arv_number : ''
120
+
121
+ <<~TEXT
122
+ N
123
+ R130,0
124
+ ZT
125
+ S1
126
+ A100,6,0,1,1,1,N,"#{last_name} #{first_name} (#{age})"
127
+ B100,30,0,1A,2,2,37,N,"#{acc_num}"
128
+ A100,80,0,1,1,1,N,"#{acc_num} #{arv_display}"
129
+ A100,100,0,1,1,1,N,"#{col_date_time} #{tests}"
130
+ A80,6,1,1,1,1,R," #{stat} "
131
+ P#{number_of_copies}
132
+ TEXT
155
133
  end
156
134
 
157
135
  # Add spaces before and after the stat text so that black bars appear across the left edge of label
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.0.9'
4
+ VERSION = '2.1.0'
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: 2.0.9
4
+ version: 2.1.0
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-10-02 00:00:00.000000000 Z
11
+ date: 2026-01-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: couchrest