renalware-core 2.0.102 → 2.0.103

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: e133555ef2e268c6afe1886268f93c58e83e894946580483a919e39d93f1b077
4
- data.tar.gz: 6f95064fe71e9d753935ce21c44cd46486e973f940777ff065be97fe502fa7bb
3
+ metadata.gz: b3fcf667f61a34da31971a76359ec16409ac8da3f4f118b9b42de1de51249623
4
+ data.tar.gz: '0109e1864753ae09f154ab1f3e1f764f116475a1835d627955d4ade5294bf26f'
5
5
  SHA512:
6
- metadata.gz: c3e4ce78a878dd8933d791d30c7692056997b4194468c53924d2620f126192296e117c5b1d7db72b74e6fdd7a69ec63e3d95913497e43291038409ce1fcfa917
7
- data.tar.gz: 3a377a342f2585c1341860e233dc7af417cd66d9cc43306bb3648fd9ca8f572cd01938134494a5b96b7d5734a032c00944e109dde7dfe08211f1f6ce57f1ec2d
6
+ metadata.gz: 1b555f9e3be2c7c52b3864c69cb346d99a1ea75465e9556bff4d2c735a9c12237492bbfdf7ecc0304447a1362f53d8f0a14941f2278eaf5cd6ec2bf016fc8851
7
+ data.tar.gz: a0ca258b95dcfcbefce04d1f3c2832592154f1e9fb2ccb56b8f9da0350f066bdbabe7b6412ebdf9342f2a5309c9b34dbd28dd4b07e8dba3cbd14ec2fe771f41f
@@ -4,8 +4,22 @@ require "document/enum"
4
4
 
5
5
  module Renalware
6
6
  class SmokingStatus < NestedAttribute
7
+ SMOKING_SNOMED_MAP = {
8
+ current: { code: 77176002, description: "Current" },
9
+ non_smoker: { code: 8392000, description: "Non" },
10
+ ex_smoker: { code: 8517006, description: "Ex" }
11
+ }.freeze
12
+
7
13
  attribute :value,
8
14
  Document::Enum,
9
15
  enums: %i(non_smoker ex_smoker current)
16
+
17
+ def snomed_code
18
+ SMOKING_SNOMED_MAP.dig(value&.to_sym, :code)
19
+ end
20
+
21
+ def snomed_description
22
+ SMOKING_SNOMED_MAP.dig(value&.to_sym, :description)
23
+ end
10
24
  end
11
25
  end
@@ -38,13 +38,6 @@ module Renalware
38
38
  super
39
39
  end
40
40
 
41
- # def modalities
42
- # __getobj__
43
- # .modalities
44
- # .includes(:description)
45
- # .order(started_on: :asc, created_at: :asc)
46
- # end
47
-
48
41
  def dead?
49
42
  current_modality_death?
50
43
  end
@@ -158,15 +151,19 @@ module Renalware
158
151
  end
159
152
 
160
153
  def clinical_history
161
- @clinical_history ||= document&.history || NullObject.new
154
+ @clinical_history ||= document&.history || NullObject.instance
162
155
  end
163
156
 
164
157
  def smoking_history?
165
158
  clinical_history.smoking.present?
166
159
  end
167
160
 
161
+ def smoking_cormbidity
162
+ comorbidity_attributes[:smoking]
163
+ end
164
+
168
165
  def profile
169
- renal_patient.profile || NullObject.instance
166
+ renal_patient.profile || Renalware::Renal::Profile.new
170
167
  end
171
168
 
172
169
  def first_seen_on
@@ -192,11 +189,11 @@ module Renalware
192
189
  end
193
190
 
194
191
  def comorbidity_attributes
195
- profile&.document&.comorbidities&.attributes || {}
192
+ profile.document&.comorbidities&.attributes || {}
196
193
  end
197
194
 
198
195
  def comorbidities
199
- @comorbidities ||= profile&.document&.comorbidities
196
+ @comorbidities ||= profile.document&.comorbidities
200
197
  end
201
198
 
202
199
  def clinical_patient
@@ -22,12 +22,12 @@ xml.Diagnoses do
22
22
  end
23
23
  end
24
24
 
25
- if patient.smoking_history?
25
+ if patient.smoking_cormbidity&.value.present?
26
26
  xml.Diagnosis do
27
27
  xml.Diagnosis do
28
28
  xml.CodingStandard "SNOMED"
29
- xml.Code patient.snomed_smoking_history.code
30
- xml.Description "Smoking history: #{patient.snomed_smoking_history.description}"
29
+ xml.Code patient.smoking_cormbidity.snomed_code
30
+ xml.Description "Smoking history: #{patient.smoking_cormbidity.snomed_description}"
31
31
  end
32
32
  # We don't store a smoking date (it doesn't make much sense to) but UKRDC
33
33
  # would like a date so send th ESRF date. See email from GS to TC 23/5/18.
@@ -17,14 +17,6 @@ observation_times = {
17
17
  "weight" => observations.weight
18
18
  }
19
19
 
20
- if observations.temperature_measured == :yes
21
- measurements["temperature"] = observations.temperature
22
- end
23
-
24
- if observations.respiratory_rate_measured == :yes
25
- measurements["respiratory_rate"] = observations.respiratory_rate
26
- end
27
-
28
20
  measurements.each do |i18n_key, value|
29
21
  xml.Observation do
30
22
  xml.ObservationTime observation_times[pre_post].iso8601
@@ -9,7 +9,7 @@ cause_code = 99 if cause_code == 34
9
9
  xml.CauseOfDeath do
10
10
  xml.DiagnosisType "final"
11
11
  xml.Diagnosis do
12
- xml.CodingStandard "EDTA"
12
+ xml.CodingStandard "EDTA_COD"
13
13
  xml.Code cause_code
14
14
  end
15
15
  xml.EnteredOn cause.created_at.to_datetime
@@ -15,7 +15,7 @@ xml.ukrdc(:PatientRecord, namespace_and_schema) do
15
15
  render "sending_facility", builder: xml, patient: patient
16
16
  render "patient", builder: xml, patient: patient
17
17
  render "lab_orders", builder: xml, patient: patient
18
- render "social_histories", builder: xml, patient: patient
18
+ # render "social_histories", builder: xml, patient: patient
19
19
  render "family_histories", builder: xml, patient: patient
20
20
  render "observations", builder: xml, patient: patient
21
21
  # render "allergies", builder: xml, patient: patient
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Renalware
4
- VERSION = "2.0.102"
4
+ VERSION = "2.0.103"
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.102
4
+ version: 2.0.103
5
5
  platform: ruby
6
6
  authors:
7
7
  - Airslie
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-09-03 00:00:00.000000000 Z
11
+ date: 2019-09-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: active_type