renalware-core 2.0.37 → 2.0.38
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +3 -1
- data/app/controllers/renalware/hd/diaries_controller.rb +1 -1
- data/app/controllers/renalware/renal/registry_preflight_checks_controller.rb +18 -6
- data/app/controllers/renalware/snippets/snippet_clones_controller.rb +2 -2
- data/app/controllers/renalware/system/errors_controller.rb +2 -2
- data/app/helpers/renalware/article_helper.rb +2 -2
- data/app/models/renalware/letters/pathology_layout.rb +2 -0
- data/app/models/renalware/null_user.rb +2 -0
- data/app/models/renalware/pathology/adjust_observation.rb +2 -0
- data/app/models/renalware/pathology/observations_jsonb_serializer.rb +0 -1
- data/app/models/renalware/renal/patient.rb +5 -0
- data/app/models/renalware/renal/profile.rb +1 -1
- data/app/models/renalware/renal/registry/preflight_checks/deaths_query.rb +2 -5
- data/app/models/renalware/renal/registry/preflight_checks/patients_query.rb +27 -5
- data/app/models/renalware/ukrdc/patients_query.rb +0 -1
- data/app/models/renalware/ukrdc/send_patient.rb +1 -1
- data/app/presenters/renalware/accesses/dashboard_presenter.rb +2 -0
- data/app/presenters/renalware/hd/mdm_presenter.rb +4 -0
- data/app/presenters/renalware/hd/session_presenter.rb +2 -2
- data/app/presenters/renalware/mdm_presenter.rb +21 -0
- data/app/presenters/renalware/patients/banner_presenter.rb +2 -0
- data/app/views/renalware/api/ukrdc/patients/_address.xml.builder +2 -0
- data/app/views/renalware/api/ukrdc/patients/_allergies.xml.builder +2 -0
- data/app/views/renalware/api/ukrdc/patients/_clinic_visit_observation.xml.builder +2 -0
- data/app/views/renalware/api/ukrdc/patients/_clinical_relationships.xml.builder +2 -0
- data/app/views/renalware/api/ukrdc/patients/_diagnoses.xml.builder +2 -0
- data/app/views/renalware/api/ukrdc/patients/_documents.xml.builder +2 -0
- data/app/views/renalware/api/ukrdc/patients/_encounters.xml.builder +2 -0
- data/app/views/renalware/api/ukrdc/patients/_family_histories.xml.builder +2 -0
- data/app/views/renalware/api/ukrdc/patients/_lab_orders.xml.builder +2 -0
- data/app/views/renalware/api/ukrdc/patients/_medications.xml.builder +2 -0
- data/app/views/renalware/api/ukrdc/patients/_name.xml.builder +2 -0
- data/app/views/renalware/api/ukrdc/patients/_observations.xml.builder +2 -0
- data/app/views/renalware/api/ukrdc/patients/_patient.xml.builder +2 -0
- data/app/views/renalware/api/ukrdc/patients/_program_memberships.xml.builder +2 -0
- data/app/views/renalware/api/ukrdc/patients/_sending_facility.xml.builder +2 -0
- data/app/views/renalware/api/ukrdc/patients/_social_histories.xml.builder +2 -0
- data/app/views/renalware/api/ukrdc/patients/_surveys.xml.builder +2 -0
- data/app/views/renalware/api/ukrdc/patients/diagnoses/_cause_of_death.xml.builder +2 -0
- data/app/views/renalware/api/ukrdc/patients/encounters/_hd_session.xml.builder +2 -0
- data/app/views/renalware/api/ukrdc/patients/lab_orders/_lab_order.xml.builder +2 -0
- data/app/views/renalware/api/ukrdc/patients/lab_orders/_result_item.xml.builder +2 -0
- data/app/views/renalware/api/ukrdc/patients/show.xml.builder +2 -0
- data/app/views/renalware/api/v1/medications/prescriptions/index.json.jbuilder +2 -0
- data/app/views/renalware/api/v1/patients/patients/index.json.jbuilder +3 -1
- data/app/views/renalware/api/v1/patients/patients/show.json.jbuilder +2 -0
- data/app/views/renalware/hd/mdm/_summary.html.slim +21 -0
- data/app/views/renalware/hd/mdm/_top.html.slim +2 -0
- data/app/views/renalware/renal/prd_descriptions/search.json.jbuilder +2 -0
- data/app/views/renalware/renal/registry_preflight_checks/_filters.html.slim +19 -0
- data/app/views/renalware/renal/registry_preflight_checks/_table.html.slim +5 -0
- data/app/views/renalware/renal/registry_preflight_checks/deaths.html.slim +4 -0
- data/app/views/renalware/renal/registry_preflight_checks/patients.html.slim +4 -0
- data/lib/document/attribute_initializer.rb +2 -3
- data/lib/document/embedded.rb +26 -0
- data/lib/renalware/version.rb +1 -1
- data/spec/support/capybara.rb +2 -0
- metadata +8 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bded04d49b6bb55e363f0aea57ff4bb129dee0f9e25ffaa3a4d515aa7942f55b
|
4
|
+
data.tar.gz: 2d2513e0f3d161c064f7a7010f4420b0fa7fcbb913e55ecb8130cc88ae0205e3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ce45551e62fdb8f6e03c4845ddbd9fc2b740aeb8f9cdbc2d34197107f285b53fdff81299501822415beabd3413b60e78658837947a30affb147be11fd44188a3
|
7
|
+
data.tar.gz: 32ae5f07a4e9f1c1de68b0ab881712cbebab81c6e722288295fc419c0b0cf8d9467cba7c9d1b8516b060de096742c4bcede1b2c0224a6a05f1fe89df9af80881
|
data/Rakefile
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
# Add your own tasks in files placed in lib/tasks ending in .rake,
|
2
4
|
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
|
3
5
|
|
@@ -11,7 +13,7 @@ end
|
|
11
13
|
|
12
14
|
# We can use rake tasks like app:db:reset when APP_RAKEFILE set
|
13
15
|
unless defined?(APP_RAKEFILE)
|
14
|
-
APP_RAKEFILE = File.expand_path("
|
16
|
+
APP_RAKEFILE = File.expand_path("spec/dummy/Rakefile", __dir__)
|
15
17
|
end
|
16
18
|
|
17
19
|
load "rails/tasks/engine.rake"
|
@@ -53,7 +53,7 @@ module Renalware
|
|
53
53
|
relation: WeeklyDiary.eager_load(
|
54
54
|
slots: [:patient, :station, :diurnal_period_code],
|
55
55
|
master_diary: { slots: [:patient, :station, :diurnal_period_code] }
|
56
|
-
|
56
|
+
),
|
57
57
|
unit_id: unit_id,
|
58
58
|
week_period: week_period,
|
59
59
|
by: current_user
|
@@ -18,6 +18,10 @@ module Renalware
|
|
18
18
|
Renalware::HD.cast_patient(__getobj__)&.hd_profile&.hospital_unit&.unit_code
|
19
19
|
end
|
20
20
|
end
|
21
|
+
|
22
|
+
def renal_profile
|
23
|
+
Renalware::Renal.cast_patient(__getobj__).profile
|
24
|
+
end
|
21
25
|
end
|
22
26
|
|
23
27
|
class DeceasedPatientPresenter < SimpleDelegator
|
@@ -26,13 +30,15 @@ module Renalware
|
|
26
30
|
end
|
27
31
|
|
28
32
|
def hd_unit; end
|
33
|
+
|
34
|
+
def renal_profile
|
35
|
+
Renalware::Renal.cast_patient(__getobj__).profile
|
36
|
+
end
|
29
37
|
end
|
30
38
|
|
31
39
|
def patients
|
32
40
|
authorize [:renalware, :renal, :registry_preflight_check], :patients?
|
33
|
-
query = Registry::PreflightChecks::PatientsQuery.new(
|
34
|
-
query_params: params.fetch(:q, {})
|
35
|
-
)
|
41
|
+
query = Registry::PreflightChecks::PatientsQuery.new(query_params: query_params)
|
36
42
|
patients = query.call.page(page).per(per_page)
|
37
43
|
patients = CollectionPresenter.new(patients, PatientPresenter)
|
38
44
|
render locals: { patients: patients, query: query.search }
|
@@ -40,13 +46,19 @@ module Renalware
|
|
40
46
|
|
41
47
|
def deaths
|
42
48
|
authorize [:renalware, :renal, :registry_preflight_check], :deaths?
|
43
|
-
query = Registry::PreflightChecks::DeathsQuery.new(
|
44
|
-
query_params: params.fetch(:q, {})
|
45
|
-
)
|
49
|
+
query = Registry::PreflightChecks::DeathsQuery.new(query_params: query_params)
|
46
50
|
patients = query.call.page(page).per(per_page)
|
47
51
|
patients = CollectionPresenter.new(patients, DeceasedPatientPresenter)
|
48
52
|
render locals: { patients: patients, query: query.search }
|
49
53
|
end
|
54
|
+
|
55
|
+
private
|
56
|
+
|
57
|
+
def query_params
|
58
|
+
qparams = params.fetch(:q, {})
|
59
|
+
qparams[:profile_esrf_on_gteq] ||= 3.years.ago
|
60
|
+
qparams
|
61
|
+
end
|
50
62
|
end
|
51
63
|
end
|
52
64
|
end
|
@@ -9,8 +9,8 @@ require_dependency "renalware/snippets"
|
|
9
9
|
module Renalware
|
10
10
|
module Snippets
|
11
11
|
class SnippetClonesController < BaseController
|
12
|
-
COPY_SUFFIX = "[COPY]"
|
13
|
-
CLONE_SUFFIX = "[CLONE]"
|
12
|
+
COPY_SUFFIX = "[COPY]"
|
13
|
+
CLONE_SUFFIX = "[CLONE]"
|
14
14
|
|
15
15
|
def create
|
16
16
|
snippet = duplicate_current_snippet
|
@@ -6,11 +6,11 @@ module Renalware
|
|
6
6
|
layout "renalware/layouts/error"
|
7
7
|
|
8
8
|
def not_found
|
9
|
-
render status:
|
9
|
+
render status: :not_found, formats: [:html]
|
10
10
|
end
|
11
11
|
|
12
12
|
def internal_server_error
|
13
|
-
render status:
|
13
|
+
render status: :internal_server_error, formats: [:html]
|
14
14
|
end
|
15
15
|
|
16
16
|
def generate_test_internal_server_error
|
@@ -16,7 +16,6 @@ module Renalware
|
|
16
16
|
# values.hgb_observed_at # => "2017-17-01"
|
17
17
|
# So the values has methods corresponding to the entire set of possible
|
18
18
|
# OBX codes, and also methods to reach in and get their result and observed_at date.
|
19
|
-
# rubocop:disable Style/MethodMissing
|
20
19
|
def method_missing(method_name, *_args, &_block)
|
21
20
|
code, suffix = method_parts(method_name)
|
22
21
|
if VALID_SUFFIXES.include?(suffix) || AllObservationCodes.include?(code)
|
@@ -9,9 +9,14 @@ module Renalware
|
|
9
9
|
scope :having_no_primary_renal_diagnosis, lambda {
|
10
10
|
where(renal_profile: nil)
|
11
11
|
}
|
12
|
+
|
12
13
|
scope :with_profile, lambda {
|
13
14
|
joins("LEFT OUTER JOIN renal_profiles ON renal_profiles.patient_id = patients.id")
|
14
15
|
}
|
16
|
+
|
17
|
+
scope :with_profile_avoiding_redefinition_of_renal_profiles_alias, lambda {
|
18
|
+
eager_load(:profile)
|
19
|
+
}
|
15
20
|
end
|
16
21
|
end
|
17
22
|
end
|
@@ -17,7 +17,7 @@ module Renalware
|
|
17
17
|
|
18
18
|
has_document class_name: "Renalware::Renal::ProfileDocument"
|
19
19
|
|
20
|
-
validates :patient, presence: true
|
20
|
+
validates :patient, presence: true, uniqueness: true
|
21
21
|
validates :esrf_on, timeliness: { type: :date, allow_nil: true }, allow_blank: true
|
22
22
|
validates :first_seen_on,
|
23
23
|
timeliness: {
|
@@ -19,18 +19,15 @@ module Renalware
|
|
19
19
|
end
|
20
20
|
|
21
21
|
def default_relation
|
22
|
-
Renalware::Patient
|
23
|
-
.preload(current_modality: [:description])
|
24
|
-
.all
|
25
|
-
.order(family_name: :asc)
|
22
|
+
Renalware::Renal::Patient.left_outer_joins(:profile)
|
26
23
|
end
|
27
24
|
|
28
25
|
def call
|
29
26
|
search
|
30
27
|
.result
|
31
28
|
.extending(ModalityScopes)
|
29
|
+
.preload(current_modality: [:description])
|
32
30
|
.with_current_modality_matching(MODALITY_NAMES)
|
33
|
-
.joins("LEFT OUTER JOIN renal_profiles ON renal_profiles.patient_id = patients.id")
|
34
31
|
.where("patients.first_cause_id is NULL AND renal_profiles.esrf_on IS NOT NULL")
|
35
32
|
end
|
36
33
|
|
@@ -11,25 +11,47 @@ module Renalware
|
|
11
11
|
MODALITY_NAMES = %w(HD PD Transplant).freeze
|
12
12
|
attr_reader :relation, :query_params
|
13
13
|
|
14
|
+
# rubocop:disable Lint/UnusedMethodArgument
|
14
15
|
def initialize(relation: nil, query_params: {})
|
15
16
|
@relation ||= default_relation
|
16
17
|
@query_params = query_params
|
17
18
|
@query_params[:s] = "modality_descriptions_name ASC" if @query_params[:s].blank?
|
18
19
|
end
|
20
|
+
# rubocop:enable Lint/UnusedMethodArgument
|
19
21
|
|
22
|
+
# The way I understand Ransack is that if you use a query like profile_esrf_gt
|
23
|
+
# (that's the RenalProfile in this case as we are dealing with a Renal::Patient)
|
24
|
+
# it will do the left out join itself onto renal_profiles.
|
25
|
+
# At one point I did a manual join onto renal_profiles here like this
|
26
|
+
# .joins("LEFT OUTER JOIN renal_profiles ON renal_profiles.patient_id = patients.id")
|
27
|
+
# but that only worked when there was no search predicate passed; when you pass eg
|
28
|
+
# profile_esrf_gt it joins onto renal_profiles again and you get a duplicate join.
|
29
|
+
# However using left_outer_joins here somehow prevents a duplicate join;
|
30
|
+
# one join onto renal_profiles is there whether there is a renal_profile_esrf_gt present
|
31
|
+
# or not. However it ONLY works if you use left_outer_joins BEFORE calling .ransack
|
32
|
+
# - calling it afterwards (in #call below) still results in a duplicate join IF
|
33
|
+
# renal_profile_esrf_gt is present in the query.
|
34
|
+
#
|
35
|
+
# I have to say, ransack eats up a lot of time and presents a lot of cognitive friction.
|
36
|
+
# Building a custom form object would have shaved an hour off the writing (mainly
|
37
|
+
# debugging) of this code.
|
38
|
+
#
|
39
|
+
# Update: moved loading of profile to #call.
|
40
|
+
# Having it in #default_relation leads to a duplicate alias if sorting on esrf for
|
41
|
+
# instance. Having to use .eager_load(:profile) in #call. However this creates n+1
|
42
|
+
# queries. Ransack again creating more confusion...
|
20
43
|
def default_relation
|
21
|
-
Renalware::Patient
|
22
|
-
.preload(current_modality: [:description])
|
23
|
-
.all
|
44
|
+
Renalware::Renal::Patient.all
|
24
45
|
end
|
25
46
|
|
26
47
|
def call
|
27
48
|
search
|
28
49
|
.result
|
50
|
+
.eager_load(:profile)
|
51
|
+
.joins("LEFT OUTER JOIN hd_profiles ON hd_profiles.patient_id = patients.id")
|
29
52
|
.extending(ModalityScopes)
|
53
|
+
.preload(current_modality: [:description])
|
30
54
|
.with_current_modality_matching(MODALITY_NAMES)
|
31
|
-
.merge(HD::Patient.with_profile)
|
32
|
-
.joins("LEFT OUTER JOIN renal_profiles ON renal_profiles.patient_id = patients.id")
|
33
55
|
.where(where_conditions)
|
34
56
|
end
|
35
57
|
|
@@ -99,7 +99,7 @@ module Renalware
|
|
99
99
|
def time_neutral_payload
|
100
100
|
payload
|
101
101
|
.gsub(/<Stream>[^<]*<\/Stream>/, "<Stream>removed</Stream>")
|
102
|
-
.gsub(/ (time|start|stop)=["'][^'"]*['"]/,
|
102
|
+
.gsub(/ (time|start|stop)=["'][^'"]*['"]/, "")
|
103
103
|
.gsub(/<UpdatedOn>[^<]*<\/UpdatedOn>/, "<UpdatedOn>removed</UpdatedOn>")
|
104
104
|
end
|
105
105
|
end
|
@@ -70,8 +70,8 @@ module Renalware
|
|
70
70
|
post = after_measurement_for(measurement)
|
71
71
|
return if pre.blank? || post.blank?
|
72
72
|
case pre
|
73
|
-
when ::Float
|
74
|
-
when ::Integer
|
73
|
+
when ::Float then (post - pre).round(1)
|
74
|
+
when ::Integer then (post - pre)
|
75
75
|
end
|
76
76
|
rescue StandardError => exception
|
77
77
|
nil
|
@@ -108,6 +108,26 @@ module Renalware
|
|
108
108
|
CollectionPresenter.new(letters_, Renalware::Letters::LetterPresenterFactory)
|
109
109
|
end
|
110
110
|
|
111
|
+
def current_pathology_for_code(code)
|
112
|
+
result = OpenStruct.new(value: nil, date: nil)
|
113
|
+
hash = patient.current_observation_set&.values_for_codes(code) || {}
|
114
|
+
obs = hash[code]
|
115
|
+
if obs.present?
|
116
|
+
result.value = obs["result"]
|
117
|
+
result.date = obs["observed_at"]
|
118
|
+
result.date = Date.parse(result.date)
|
119
|
+
end
|
120
|
+
result
|
121
|
+
end
|
122
|
+
|
123
|
+
def transplant_status
|
124
|
+
Renalware::Transplants::Registration.for_patient(patient)
|
125
|
+
.first
|
126
|
+
&.current_status
|
127
|
+
&.description
|
128
|
+
&.name
|
129
|
+
end
|
130
|
+
|
111
131
|
private
|
112
132
|
|
113
133
|
def pathology_descriptions_for_codes(codes)
|
@@ -137,3 +157,4 @@ module Renalware
|
|
137
157
|
end
|
138
158
|
end
|
139
159
|
end
|
160
|
+
# rubocop:enable Metrics/ClassLength
|
@@ -0,0 +1,21 @@
|
|
1
|
+
article
|
2
|
+
header
|
3
|
+
h2 Additional Information
|
4
|
+
|
5
|
+
dl.dl-horizontal.xlarge
|
6
|
+
dt Latest Pre mean BP
|
7
|
+
- if mdm.rolling_audit.present?
|
8
|
+
dd= "#{mdm.rolling_audit.pre_mean_systolic_blood_pressure.to_i} / #{mdm.rolling_audit.pre_mean_diastolic_blood_pressure.to_i}"
|
9
|
+
dt Latest Post mean BP
|
10
|
+
- if mdm.rolling_audit.present?
|
11
|
+
dd= "#{mdm.rolling_audit.post_mean_systolic_blood_pressure.to_i} / #{mdm.rolling_audit.post_mean_diastolic_blood_pressure.to_i}"
|
12
|
+
|
13
|
+
dt Latest URR
|
14
|
+
dd
|
15
|
+
- obs = mdm.current_pathology_for_code("URR")
|
16
|
+
= obs.value
|
17
|
+
|
|
18
|
+
= "(#{l(obs.date)})" if obs.date.present?
|
19
|
+
|
20
|
+
dt Transplant status
|
21
|
+
dd= mdm.transplant_status
|
@@ -0,0 +1,19 @@
|
|
1
|
+
.search-form.filters
|
2
|
+
= simple_form_for query,
|
3
|
+
url: url,
|
4
|
+
method: :get,
|
5
|
+
html: { autocomplete: "off" } do |f|
|
6
|
+
.row
|
7
|
+
.medium-2.columns
|
8
|
+
= f.input :profile_esrf_on_gteq, as: :date_picker, label: "ESRF after"
|
9
|
+
|
10
|
+
-if defined?(display_modality_filter) && display_modality_filter
|
11
|
+
.medium-4.large-3.columns
|
12
|
+
= f.input :current_modality_description_id_eq,
|
13
|
+
collection: Renalware::Modalities::Description.pluck("name", "id"),
|
14
|
+
label: "Modality"
|
15
|
+
|
16
|
+
.medium-4.columns.actions.end
|
17
|
+
= f.submit t("helpers.submit.filter"), class: "button", name: nil
|
18
|
+
span= " or "
|
19
|
+
= link_to t("helpers.reset"), url
|
@@ -10,6 +10,10 @@ table.renal-registry-preflight-checks
|
|
10
10
|
"Modality",
|
11
11
|
default_order: :asc)
|
12
12
|
td.col-width-small HD Site
|
13
|
+
td.col-width-date
|
14
|
+
= sort_link([:renalware, query],
|
15
|
+
:profile_esrf_on,
|
16
|
+
"ESRF date")
|
13
17
|
td Missing data
|
14
18
|
tbody
|
15
19
|
- patients.each do |patient|
|
@@ -19,6 +23,7 @@ table.renal-registry-preflight-checks
|
|
19
23
|
td= patient.hospital_identifiers
|
20
24
|
td= patient.current_modality
|
21
25
|
td= patient.hd_unit
|
26
|
+
td= l(patient.renal_profile&.esrf_on)
|
22
27
|
td.missing-data
|
23
28
|
- patient.missing_data.map do |data_item|
|
24
29
|
span(class=data_item)= t(".#{data_item}")
|
@@ -1,4 +1,8 @@
|
|
1
1
|
= within_admin_layout(title: "Renal Registry Return: Preflight Checks") do
|
2
|
+
= render "filters",
|
3
|
+
query: query,
|
4
|
+
url: deaths_renal_registry_preflight_checks_path,
|
5
|
+
display_modality_filter: false
|
2
6
|
= render "navigation"
|
3
7
|
= render "table", patients: patients, query: query
|
4
8
|
= paginate patients
|
@@ -1,4 +1,8 @@
|
|
1
1
|
= within_admin_layout(title: "Renal Registry Return: Preflight Checks") do
|
2
|
+
= render "filters",
|
3
|
+
query: query,
|
4
|
+
url: patients_renal_registry_preflight_checks_path,
|
5
|
+
display_modality_filter: true
|
2
6
|
= render "navigation"
|
3
7
|
= render "table", patients: patients, query: query
|
4
8
|
= paginate patients
|
@@ -12,10 +12,9 @@ module Document
|
|
12
12
|
end
|
13
13
|
|
14
14
|
def self.build_class(type)
|
15
|
-
|
16
|
-
when type == Document::Enum
|
15
|
+
if type == Document::Enum
|
17
16
|
AttributeInitializer::Enum
|
18
|
-
|
17
|
+
elsif type&.included_modules&.include?(::ActiveModel::Model)
|
19
18
|
AttributeInitializer::ActiveModel
|
20
19
|
else
|
21
20
|
AttributeInitializer::Base
|
data/lib/document/embedded.rb
CHANGED
@@ -105,7 +105,33 @@ module Document
|
|
105
105
|
class Embedded
|
106
106
|
include Virtus.model
|
107
107
|
include ActiveModel::Model
|
108
|
+
include ActiveModel::Validations::Callbacks
|
108
109
|
extend Enumerize
|
110
|
+
STRIPPABLE_TYPES = %w(Float Integer).freeze
|
111
|
+
|
112
|
+
before_validation :strip_leading_trailing_whitespace_from_numbers
|
113
|
+
|
114
|
+
def strip_leading_trailing_whitespace_from_numbers
|
115
|
+
attributes.keys.each do |att|
|
116
|
+
# Find the type defined in the document definition eg `attribute :weight, Integer``
|
117
|
+
# Note that primitive could be a string or class, hence :to_s
|
118
|
+
primitive = self.class.attribute_set[att].type.primitive.to_s
|
119
|
+
|
120
|
+
# If the type is in STRIPPABLE_TYPES ie its a numeric type,
|
121
|
+
# and it has arrived as a string (which responds to :strip) then
|
122
|
+
# ensure there are no leading or trailing spaces, otherwise Virtus cannot
|
123
|
+
# coerce it into the correct type. For example Virtus won't corece
|
124
|
+
# " 1" into 1 but will coerce "1" into 1 (FYI the Dry::Types gem (the successor to Virtus)
|
125
|
+
# rectifies this).
|
126
|
+
# Note also that here in this before_validation callback, the act of assignment in
|
127
|
+
# `self[att] =` prompts Virtus to re-attempt to coerce the value, which now, if space
|
128
|
+
# has prevented it from doing so before, it will do successfully.
|
129
|
+
next unless STRIPPABLE_TYPES.include?(primitive)
|
130
|
+
if self[att].respond_to?(:strip)
|
131
|
+
self[att] = self[att].strip
|
132
|
+
end
|
133
|
+
end
|
134
|
+
end
|
109
135
|
|
110
136
|
# Assign a default value to the attributes using a custom type.
|
111
137
|
# Set a validation on nested object.
|
data/lib/renalware/version.rb
CHANGED
data/spec/support/capybara.rb
CHANGED
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.
|
4
|
+
version: 2.0.38
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Airslie
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-07-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: active_type
|
@@ -226,14 +226,14 @@ dependencies:
|
|
226
226
|
requirements:
|
227
227
|
- - "~>"
|
228
228
|
- !ruby/object:Gem::Version
|
229
|
-
version: 2.
|
229
|
+
version: 2.5.0
|
230
230
|
type: :runtime
|
231
231
|
prerelease: false
|
232
232
|
version_requirements: !ruby/object:Gem::Requirement
|
233
233
|
requirements:
|
234
234
|
- - "~>"
|
235
235
|
- !ruby/object:Gem::Version
|
236
|
-
version: 2.
|
236
|
+
version: 2.5.0
|
237
237
|
- !ruby/object:Gem::Dependency
|
238
238
|
name: dumb_delegator
|
239
239
|
requirement: !ruby/object:Gem::Requirement
|
@@ -590,14 +590,14 @@ dependencies:
|
|
590
590
|
requirements:
|
591
591
|
- - "~>"
|
592
592
|
- !ruby/object:Gem::Version
|
593
|
-
version: 5.
|
593
|
+
version: 5.3.0
|
594
594
|
type: :runtime
|
595
595
|
prerelease: false
|
596
596
|
version_requirements: !ruby/object:Gem::Requirement
|
597
597
|
requirements:
|
598
598
|
- - "~>"
|
599
599
|
- !ruby/object:Gem::Version
|
600
|
-
version: 5.
|
600
|
+
version: 5.3.0
|
601
601
|
- !ruby/object:Gem::Dependency
|
602
602
|
name: rails
|
603
603
|
requirement: !ruby/object:Gem::Requirement
|
@@ -2174,6 +2174,7 @@ files:
|
|
2174
2174
|
- app/views/renalware/hd/mdm/_bottom.html.slim
|
2175
2175
|
- app/views/renalware/hd/mdm/_middle.html.slim
|
2176
2176
|
- app/views/renalware/hd/mdm/_sessions.html.slim
|
2177
|
+
- app/views/renalware/hd/mdm/_summary.html.slim
|
2177
2178
|
- app/views/renalware/hd/mdm/_top.html.slim
|
2178
2179
|
- app/views/renalware/hd/mdm_patients/_filters.html.slim
|
2179
2180
|
- app/views/renalware/hd/mdm_patients/_patient.html.slim
|
@@ -2578,6 +2579,7 @@ files:
|
|
2578
2579
|
- app/views/renalware/renal/profiles/_mini.html.slim
|
2579
2580
|
- app/views/renalware/renal/profiles/edit.html.slim
|
2580
2581
|
- app/views/renalware/renal/profiles/show.html.slim
|
2582
|
+
- app/views/renalware/renal/registry_preflight_checks/_filters.html.slim
|
2581
2583
|
- app/views/renalware/renal/registry_preflight_checks/_navigation.html.slim
|
2582
2584
|
- app/views/renalware/renal/registry_preflight_checks/_table.html.slim
|
2583
2585
|
- app/views/renalware/renal/registry_preflight_checks/deaths.html.slim
|