renalware-core 2.0.120 → 2.0.121

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7f770b5732c50a59986a8f3578ede55d2d537df63280d181cfab33057ebdf92f
4
- data.tar.gz: f962a48b76616f1fdc9a578a1d1c2da7fe899b72ea48f78b6c503e074a72a343
3
+ metadata.gz: 9b93f9d4c837438e01bbb281d1a8a81046ae012697e1f6906cb008e401162cb0
4
+ data.tar.gz: 474cf5ccd494cbcf535ca7d11dee7e96bb1675f023dda2327b8fbe8a74d80fa2
5
5
  SHA512:
6
- metadata.gz: 30f1a2a55139d8bb6149c1c81afa23ac26a93003fd4e4774e6f2d5314c6a6cb0240ae2813d2f68faf3dbfe88169be878779f8079d9963d03e7c774bfb8b516a9
7
- data.tar.gz: 73bff07bf3e82eeaae125ef6b470d8a01eba01a5da5f3c0106d9e405339c2fae1a9e0ba9d7dca0d07fa899c622447a703ba68c94a27c2aebe971ee4287942f38
6
+ metadata.gz: a6d2790007b3bcf1f1173c421f8b0060c0b40345bb0323e5893dc83e3d39164e4c1e5653d9acf15d0b3ac163664fcc9f8a68e4b4a4df416e05c5d8a8c73d5240
7
+ data.tar.gz: b82938bbc38a637773a7999da0f416b98050a7efa56848f18e2741fb084b167e91900b836b99a50db736b7e07b3af75f666d5d51041d2f32ded7fae957289914
@@ -129,6 +129,8 @@ module Renalware
129
129
  alias_attribute :died_at, :death_date
130
130
 
131
131
  def internal_id
132
+ return unless defined?(patient_id_list)
133
+
132
134
  patient_id_list.split("^").first
133
135
  end
134
136
 
@@ -156,17 +158,26 @@ module Renalware
156
158
  super.split("^")
157
159
  end
158
160
 
159
- # Try to read sex_admin, but be aware it raises an error if it is not in F|M|O|U|A|N|C
160
- # in which case append the actual value so we know what is causing the failure.
161
+ # We don't use the HL7::Message#sex_admin method (from the ruby hl7 gem) because it
162
+ # raises an error during reading if the sex value in the PID is not in (F|M|O|U|A|N|C).
163
+ # I think that behaviour is a not quite right as a hospital might not use those values in
164
+ # their HL7 PID implementation, especially in the UK. KCH does not for instance.
165
+ # So instead we read the PID array directly, and map whatever is in there to its Renalware
166
+ # equivalent, then overwrite the existing #admin_sex method so the HL7::Message version
167
+ # cannot be called. If we can't map it we just return whatever is in there and its up to
168
+ # calling code to handle any coercion issues. The hl7_pid_sex_map hash can be configured
169
+ # by the host app to support whatever sex values it uses intenrally.
170
+ # I think some work needs to be done on Renalware sex and gender (which are slightly
171
+ # conflated in Renalware). For example:
172
+ # - the LOINC names for administrative sex: Male Female Unknown (https://loinc.org/72143-1/)
173
+ # - the LOINC names for sex at birth: Male Female Unknown (https://loinc.org/LL3324-2/)
174
+ # - HL7's definitions: F Female, M Male, O Other, U Unknown, A Ambiguous, N Not applicable
175
+ # - gender: 7 options https://loinc.org/76691-5/
161
176
  def sex
162
- self[8] = self[8]&.upcase # Sex eg F should always be uppercase so no harm in doing this
163
- self[8] = "M" if self[8] == "MALE"
164
- self[8] = "F" if self[8] == "FEMALE"
165
- self[8] = "O" if self[8] == "OTHER"
166
- admin_sex
167
- rescue HL7::InvalidDataError => e
168
- raise e, "#{e} value is '#{self[8]}'", e.backtrace
177
+ pid_sex = self[8]&.upcase
178
+ Renalware.config.hl7_pid_sex_map.fetch(pid_sex, pid_sex)
169
179
  end
180
+ alias admin_sex sex
170
181
 
171
182
  private
172
183
 
@@ -105,6 +105,24 @@ module Renalware
105
105
  )
106
106
  }
107
107
  }
108
+
109
+ # This the default mapping from possible HL7 PID 'administrative sex' values that we
110
+ # might see in a message, to their Renalware equivalent. A hospital can override this
111
+ # mapping if they have different values in their HL7 messages.
112
+ # Note that the standard HL7 PID admin sex values are not adhered to here. For reference
113
+ # they are:
114
+ # F Female, M Male, O Other, U Unknown, A Ambiguous, N Not applicable
115
+ config_accessor(:hl7_pid_sex_map) do
116
+ {
117
+ "MALE" => "M",
118
+ "FEMALE" => "F",
119
+ "OTHER" => "NS",
120
+ "UNKNOWN" => "NK",
121
+ "NOTKNOWN" => "NK",
122
+ "AMBIGUOUS" => "NS",
123
+ "NOT APPLICABLE" => "NS"
124
+ }.freeze
125
+ end
108
126
  end
109
127
 
110
128
  def self.config
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Renalware
4
- VERSION = "2.0.120"
4
+ VERSION = "2.0.121"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: renalware-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.120
4
+ version: 2.0.121
5
5
  platform: ruby
6
6
  authors:
7
7
  - Airslie
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-10-31 00:00:00.000000000 Z
11
+ date: 2019-11-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: actionview-component