renalware-core 2.0.94 → 2.0.95

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: 5cf20592c0e0b30bb57efbe96dee286e45c0fb4625d0d32e031ef82e5d384626
4
- data.tar.gz: 195e651b6a6fde08627371cfbc5c7332f96b881d0d6d9aff49968bc3e282839e
3
+ metadata.gz: 97f743d2f776695b7e406965b0c575158b831091441c6d687dc618755f503108
4
+ data.tar.gz: 7fa35c1012943e0e1da51d6268fbc38186bfac42eec755ac9319827ad20f9993
5
5
  SHA512:
6
- metadata.gz: cd90a68261532632e4576ce3575bfc71120176a3c89b97dd06db17a5c21c50b42edd677dc8f776c0b3a3a735bfe16c30f1f92924731993dc4153354fab9d724d
7
- data.tar.gz: 60845e032930cdbaddd735cd949540777b02c3f4be99c6e82c951093e310f7c847d36704a8e5af996e476e74e57d586f13812692fcc229719f9db1bef5e4780c
6
+ metadata.gz: 8595949189f925bfa32f89eb30f2f2e1d6be774b776fb01670a0a8270fd945f58db710979c83b178862479582d835cac249a71136281a0566eefe5d59e847cf6
7
+ data.tar.gz: cbf56881a9bdea06a338c2e9bce80daf3fc911248e9aeb0da125655cb5c87fd388b1872d536f8204faed4bc428b0d35953fbb2fcd96703e787373c5124f5e0df
@@ -21,6 +21,9 @@ module Renalware
21
21
  .order([:display_group, :display_order])
22
22
  }
23
23
 
24
+ enum rr_type: { rr_type_simple: 0, rr_type_interpretation: 1 }
25
+ enum rr_coding_standard: { ukrr: 0, pv: 1 }
26
+
24
27
  def self.for(codes)
25
28
  ObservationDescriptionsByCodeQuery.new(codes: codes).call
26
29
  end
@@ -18,7 +18,7 @@ module Renalware
18
18
  Pathology::ObservationRequest
19
19
  .where(id: Pathology::ObservationRequest.distinct_for_patient_id(patient_id))
20
20
  .where("requested_at >= ?", changes_since)
21
- .where("loinc_code is not null")
21
+ .where("coalesce(loinc_code, '') != ''") # excludes NULL and ''
22
22
  .eager_load(
23
23
  :description,
24
24
  observations: { description: :measurement_unit }
@@ -9,6 +9,12 @@ module Renalware
9
9
  def sanitized_notes
10
10
  ::Rails::Html::WhiteListSanitizer.new.sanitize(notes, tags: %w(p br ol li ul span div))
11
11
  end
12
+
13
+ def height_in_cm
14
+ return if height.blank?
15
+
16
+ height * 100
17
+ end
12
18
  end
13
19
  end
14
20
  end
@@ -5,7 +5,8 @@ require_dependency "renalware/pathology"
5
5
  module Renalware
6
6
  module Pathology
7
7
  class ObservationPresenter < SimpleDelegator
8
- delegate :name, :code, :loinc_code, to: :description, prefix: true, allow_nil: true
8
+ delegate :name, :code, :loinc_code, :rr_type, :rr_coding_standard,
9
+ to: :description, prefix: true, allow_nil: true
9
10
  delegate :measurement_unit, to: :description, allow_nil: true
10
11
  delegate :name, to: :measurement_unit, prefix: true, allow_nil: true
11
12
 
@@ -2,7 +2,17 @@
2
2
 
3
3
  module Renalware
4
4
  module UKRDC
5
+ # Assumes the thing being passed to the ctor is of type Pathology::ObservationPresenter hence
6
+ # responds to #description_code
5
7
  class PathologyObservationPresenter < SimpleDelegator
8
+ delegate :rr_type_interpretation?, to: :description
9
+
10
+ INTERPRETATION_CODE_MAP = {
11
+ "positive" => "POS",
12
+ "negative" => "NEG"
13
+ }.freeze
14
+ DEFAULT_INTERPRETATION_CODE = "UNK"
15
+
6
16
  # The PrePost element in ResultItem
7
17
  # For HD patients, all bloods are PRE except the post dialysis urea,
8
18
  # For non-HD patients, all the tests are NA
@@ -19,6 +29,22 @@ module Renalware
19
29
  def result
20
30
  (super || "")[0..19]
21
31
  end
32
+
33
+ def coding_standard
34
+ return if description_rr_coding_standard.blank?
35
+
36
+ description_rr_coding_standard.to_s.upcase
37
+ end
38
+
39
+ def code
40
+ description_loinc_code.presence || description_code
41
+ end
42
+
43
+ def interpretation_code
44
+ sanitized_result = result&.downcase&.strip
45
+
46
+ INTERPRETATION_CODE_MAP.fetch(sanitized_result, DEFAULT_INTERPRETATION_CODE)
47
+ end
22
48
  end
23
49
  end
24
50
  end
@@ -94,10 +94,13 @@ module Renalware
94
94
  end
95
95
 
96
96
  def clinic_visits
97
- clinics_patient
98
- .clinic_visits
99
- .where("date >= ?", changes_since)
100
- .includes(:updated_by)
97
+ @clinic_visits ||= begin
98
+ visits = clinics_patient
99
+ .clinic_visits
100
+ .where("date >= ?", changes_since)
101
+ .includes(:updated_by)
102
+ CollectionPresenter.new(visits, Clinics::ClinicVisitPresenter)
103
+ end
101
104
  end
102
105
 
103
106
  def treatments
@@ -31,7 +31,7 @@ xml.Observations(
31
31
 
32
32
  render "clinic_visit_observation",
33
33
  visit: visit,
34
- method: :height,
34
+ method: :height_in_cm,
35
35
  i18n_key: "height",
36
36
  builder: builder
37
37
  end
@@ -8,17 +8,19 @@ xml.ResultItem do
8
8
  xml.EnteredOn observation.updated_at&.iso8601
9
9
  xml.PrePost observation.pre_post(patient_is_on_hd: patient.current_modality_hd?)
10
10
  xml.ServiceId do
11
- if observation.description_loinc_code.present?
12
- xml.CodingStandard "PV"
13
- xml.Code observation.description_loinc_code
14
- else
15
- xml.CodingStandard "LOCAL"
16
- xml.Code observation.description_code
17
- end
11
+ xml.CodingStandard observation.coding_standard
12
+ xml.Code observation.code
18
13
  xml.Description observation.description_name
19
14
  end
20
15
 
21
- xml.ResultValue observation.result
22
- xml.ResultValueUnits observation.measurement_unit_name
16
+ # If the rrr_type of the observation_descriptions is interpretation (ie an interpretted result
17
+ # like POS NEG)
18
+ if observation.rr_type_interpretation?
19
+ xml.InterpretationCodes observation.interpretation_code
20
+ else
21
+ xml.ResultValue observation.result
22
+ xml.ResultValueUnits observation.measurement_unit_name
23
+ end
24
+
23
25
  xml.ObservationTime observation.observed_at&.iso8601
24
26
  end
@@ -19,4 +19,4 @@ en:
19
19
  height:
20
20
  code: height
21
21
  description: Height Measured
22
- units: "m"
22
+ units: "cm"
@@ -0,0 +1,17 @@
1
+ class ChangeTypeOfPatientsUKRDCExternalId < ActiveRecord::Migration[5.2]
2
+ def change
3
+ within_renalware_schema do
4
+ reversible do |dir|
5
+ dir.up do
6
+ change_column :patients, :ukrdc_external_id, :text, null: true
7
+ end
8
+ dir.down do
9
+ change_column :patients, :ukrdc_external_id, "uuid USING UUID(ukrdc_external_id)", null: true
10
+ end
11
+ end
12
+
13
+ remove_index :patients, :ukrdc_external_id
14
+ add_index :patients, :ukrdc_external_id, unique: true
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,21 @@
1
+ class AddResultTypeToPathologyObservationDescriptions < ActiveRecord::Migration[5.2]
2
+ def change
3
+ within_renalware_schema do
4
+ add_column(
5
+ :pathology_observation_descriptions,
6
+ :rr_type,
7
+ :integer,
8
+ default: 0,
9
+ null: false
10
+ )
11
+
12
+ add_column(
13
+ :pathology_observation_descriptions,
14
+ :rr_coding_standard,
15
+ :integer,
16
+ default: 0,
17
+ null: false
18
+ )
19
+ end
20
+ end
21
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Renalware
4
- VERSION = "2.0.94"
4
+ VERSION = "2.0.95"
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.94
4
+ version: 2.0.95
5
5
  platform: ruby
6
6
  authors:
7
7
  - Airslie
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-07-19 00:00:00.000000000 Z
11
+ date: 2019-07-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: active_type
@@ -2038,7 +2038,7 @@ files:
2038
2038
  - app/presenters/renalware/transplants/patient_presenter.rb
2039
2039
  - app/presenters/renalware/transplants/recipient_dashboard_presenter.rb
2040
2040
  - app/presenters/renalware/transplants/wait_list_registration_presenter.rb
2041
- - app/presenters/renalware/ukrdc/modality_presenter.rb
2041
+ - app/presenters/renalware/ukrdc/modality_presenter.rb.dead
2042
2042
  - app/presenters/renalware/ukrdc/pathology_observation_presenter.rb
2043
2043
  - app/presenters/renalware/ukrdc/pathology_observation_request_presenter.rb
2044
2044
  - app/presenters/renalware/ukrdc/patient_presenter.rb
@@ -3535,6 +3535,8 @@ files:
3535
3535
  - db/migrate/20190709101610_create_pd_regime_for_modalities.rb
3536
3536
  - db/migrate/20190718091430_add_code_to_modality_descriptions.rb
3537
3537
  - db/migrate/20190718095851_add_discharge_reason_code_to_ukrdc_treatments.rb
3538
+ - db/migrate/20190722145936_change_type_of_patients_ukrdc_external_id.rb
3539
+ - db/migrate/20190723150737_add_result_type_to_pathology_observation_descriptions.rb
3538
3540
  - db/seeds.rb
3539
3541
  - db/seeds/default/accesses/access_pd_catheter_insertion_techniques.csv
3540
3542
  - db/seeds/default/accesses/access_pd_catheter_insertion_techniques.rb