renalware-core 2.0.136 → 2.0.137
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 +4 -4
- data/app/components/renalware/application_component.rb +5 -5
- data/app/components/renalware/letters/letters_in_progress_component.rb +3 -3
- data/app/controllers/renalware/feeds/hl7_test_messages_controller.rb +2 -2
- data/app/controllers/renalware/patients/bookmarks_controller.rb +0 -2
- data/app/controllers/renalware/pd/pet_adequacy_results_controller.rb +0 -4
- data/app/controllers/renalware/pd/regimes_controller.rb +0 -4
- data/app/documents/renalware/hd/session_document.rb +0 -3
- data/app/inputs/date_picker_input.rb +0 -2
- data/app/models/renalware/accesses/patient.rb +2 -2
- data/app/models/renalware/events/event.rb +3 -0
- data/app/models/renalware/feeds/files/practice_memberships/import_job.rb +0 -3
- data/app/models/renalware/feeds/files/primary_care_physicians/import_job.rb +0 -3
- data/app/models/renalware/hd/mdm_patients_query.rb +2 -2
- data/app/models/renalware/letters/printing/batch_compile_pdfs.rb +0 -2
- data/app/models/renalware/pathology/code_group.rb +2 -2
- data/app/models/renalware/pathology/current_observation_set.rb +4 -4
- data/app/models/renalware/pd/apd/calculate_volumes.rb +0 -2
- data/app/models/renalware/renal/registry/preflight_checks/patients_query.rb +0 -2
- data/app/models/renalware/system/update_user.rb +0 -2
- data/app/models/renalware/ukrdc/incoming/import_surveys.rb +2 -4
- data/app/models/renalware/ukrdc/treatment_timeline/generate_treatments.rb +1 -1
- data/app/models/renalware/ukrdc/treatment_timeline/pd/generator.rb +2 -2
- data/app/models/renalware/user.rb +0 -1
- data/app/pdfs/renalware/events/event_pdf.rb +2 -2
- data/app/presenters/renalware/hd/protocol_presenter.rb +1 -1
- data/app/validators/renalware/pdf_friendly_validator.rb +34 -0
- data/app/views/renalware/events/events/_form.html.slim +1 -0
- data/db/migrate/20200127170711_add_created_by_to_pathology_code_groups.rb +5 -5
- data/lib/renalware/version.rb +1 -1
- data/spec/factories/accesses/assessments.rb +1 -1
- data/spec/factories/accesses/catheter_insertion_techniques.rb +1 -1
- data/spec/factories/pathology/code_groups.rb +1 -1
- data/spec/support/devise_spec_helper.rb +4 -4
- data/spec/support/pages/letters/form.rb +0 -3
- metadata +3 -28
- data/app/views/renalware/api/ukrdc/patients/_address.xml.builder +0 -18
- data/app/views/renalware/api/ukrdc/patients/_allergies.xml.builder +0 -21
- data/app/views/renalware/api/ukrdc/patients/_clinic_visit_observation.xml.builder +0 -28
- data/app/views/renalware/api/ukrdc/patients/_diagnoses.xml.builder +0 -57
- data/app/views/renalware/api/ukrdc/patients/_documents.xml.builder +0 -38
- data/app/views/renalware/api/ukrdc/patients/_encounters.xml.builder +0 -7
- data/app/views/renalware/api/ukrdc/patients/_hd_session_observations.xml.builder +0 -39
- data/app/views/renalware/api/ukrdc/patients/_lab_orders.xml.builder +0 -48
- data/app/views/renalware/api/ukrdc/patients/_medications.xml.builder +0 -47
- data/app/views/renalware/api/ukrdc/patients/_name.xml.builder +0 -8
- data/app/views/renalware/api/ukrdc/patients/_observations.xml.builder +0 -41
- data/app/views/renalware/api/ukrdc/patients/_patient.xml.builder +0 -88
- data/app/views/renalware/api/ukrdc/patients/_procedures.xml.builder +0 -21
- data/app/views/renalware/api/ukrdc/patients/_sending_facility.xml.builder +0 -9
- data/app/views/renalware/api/ukrdc/patients/_social_histories.xml.builder +0 -15
- data/app/views/renalware/api/ukrdc/patients/_treatments.xml.builder +0 -65
- data/app/views/renalware/api/ukrdc/patients/diagnoses/_cause_of_death.xml.builder +0 -16
- data/app/views/renalware/api/ukrdc/patients/lab_orders/_lab_order.xml.builder.dead +0 -42
- data/app/views/renalware/api/ukrdc/patients/lab_orders/_result_item.xml.builder.dead +0 -26
- data/app/views/renalware/api/ukrdc/patients/procedures/_dialysis_session.xml.builder +0 -42
- data/app/views/renalware/api/ukrdc/patients/procedures/_transplant_operation.xml.builder +0 -37
- data/app/views/renalware/api/ukrdc/patients/show.xml.builder +0 -26
- data/app/views/renalware/api/ukrdc/patients/treatments/_discharge_reason.xml.builder +0 -10
- data/app/views/renalware/api/ukrdc/patients/treatments/_generic.xml.builder +0 -26
- data/app/views/renalware/api/ukrdc/patients/treatments/_hd.xml.builder +0 -38
- data/app/views/renalware/api/ukrdc/patients/treatments/_pd.xml.builder +0 -26
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 81d09134cf1a4ea4796c62cae9f367d2e336ee1d65e4707efcb49d7c58c7dcb4
|
|
4
|
+
data.tar.gz: 7cb276e32f591a30a8e94874e6d51330c765720acc9800d3c34828d85052e996
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 7a8927c295304770d15f255702c1ad63cfeeb84a730745de3cd18bb438e6170c687f005d80019d434ea5170a5e84fe3c3935790fa3ea0fa181903f8ef163dfa4
|
|
7
|
+
data.tar.gz: 9c15f68020b3f733a6883ce21982057541d882b2ccd1432e3613970cfcf72229ef181a721abf9b600e1d49a4ffb190895d49bd682f333b2352a21f4d6eca6654
|
|
@@ -5,10 +5,10 @@ module Renalware
|
|
|
5
5
|
include Renalware::Engine.routes.url_helpers
|
|
6
6
|
include Pundit::Helper
|
|
7
7
|
|
|
8
|
-
# Not sure why include Renalware::Engine.routes.url_helpers does not make the
|
|
9
|
-
# engine urls visible in the views (seems to resolve alwatys to /assets?..)
|
|
10
|
-
# so we expose routes here so inside a component html file we can use
|
|
11
|
-
# e.g. renalware.bookmarks_path
|
|
8
|
+
# Not sure why include Renalware::Engine.routes.url_helpers does not make the
|
|
9
|
+
# engine urls visible in the views (seems to resolve alwatys to /assets?..)
|
|
10
|
+
# so we expose routes here so inside a component html file we can use
|
|
11
|
+
# e.g. renalware.bookmarks_path
|
|
12
12
|
def renalware
|
|
13
13
|
Renalware::Engine.routes.url_helpers
|
|
14
14
|
end
|
|
@@ -19,4 +19,4 @@ module Renalware
|
|
|
19
19
|
current_user && Pundit.policy(current_user, record)
|
|
20
20
|
end
|
|
21
21
|
end
|
|
22
|
-
end
|
|
22
|
+
end
|
|
@@ -4,7 +4,7 @@ module Renalware
|
|
|
4
4
|
module Letters
|
|
5
5
|
class LettersInProgressComponent < ApplicationComponent
|
|
6
6
|
attr_reader :current_user
|
|
7
|
-
|
|
7
|
+
|
|
8
8
|
def initialize(current_user:)
|
|
9
9
|
@current_user = current_user
|
|
10
10
|
end
|
|
@@ -22,8 +22,8 @@ module Renalware
|
|
|
22
22
|
end
|
|
23
23
|
end
|
|
24
24
|
|
|
25
|
-
private
|
|
26
|
-
|
|
25
|
+
private
|
|
26
|
+
|
|
27
27
|
def present_letters(letters)
|
|
28
28
|
CollectionPresenter.new(letters, Letters::LetterPresenterFactory)
|
|
29
29
|
end
|
|
@@ -11,7 +11,7 @@ module Renalware
|
|
|
11
11
|
render locals: { form: HL7TestForm.new, test_messages: test_messages }
|
|
12
12
|
end
|
|
13
13
|
|
|
14
|
-
# rubocop:disable Metrics/
|
|
14
|
+
# rubocop:disable Metrics/MethodLength
|
|
15
15
|
def create
|
|
16
16
|
authorize [:renalware, :admin, :devops], :create?
|
|
17
17
|
body = replace_placeholders_in_hl7_message(form_params[:body])
|
|
@@ -29,7 +29,7 @@ module Renalware
|
|
|
29
29
|
}
|
|
30
30
|
end
|
|
31
31
|
end
|
|
32
|
-
# rubocop:enable Metrics/
|
|
32
|
+
# rubocop:enable Metrics/MethodLength
|
|
33
33
|
|
|
34
34
|
# # Delayed::Job.enqueue job
|
|
35
35
|
# redirect_to(
|
|
@@ -28,7 +28,6 @@ module Renalware
|
|
|
28
28
|
end
|
|
29
29
|
|
|
30
30
|
# idempotent
|
|
31
|
-
# rubocop:disable Metrics/AbcSize
|
|
32
31
|
def destroy
|
|
33
32
|
bookmark = user.bookmarks.find_by(id: params[:id])
|
|
34
33
|
patient = bookmark&.patient
|
|
@@ -42,7 +41,6 @@ module Renalware
|
|
|
42
41
|
redirect_back(fallback_location: patient_path(fallback_location),
|
|
43
42
|
notice: success_msg_for("bookmark"))
|
|
44
43
|
end
|
|
45
|
-
# rubocop:enable Metrics/AbcSize
|
|
46
44
|
|
|
47
45
|
private
|
|
48
46
|
|
|
@@ -14,7 +14,6 @@ module Renalware
|
|
|
14
14
|
render locals: { pet_adequacy_result: result, patient: patient }
|
|
15
15
|
end
|
|
16
16
|
|
|
17
|
-
# rubocop:disable Metrics/AbcSize
|
|
18
17
|
def create
|
|
19
18
|
result = patient.pet_adequacy_results.new(pet_adequacy_result_params)
|
|
20
19
|
authorize result
|
|
@@ -25,13 +24,11 @@ module Renalware
|
|
|
25
24
|
render :new, locals: { pet_adequacy_result: result, patient: patient }
|
|
26
25
|
end
|
|
27
26
|
end
|
|
28
|
-
# rubocop:enable Metrics/AbcSize
|
|
29
27
|
|
|
30
28
|
def edit
|
|
31
29
|
render locals: { pet_adequacy_result: pet_adequacy_result, patient: patient }
|
|
32
30
|
end
|
|
33
31
|
|
|
34
|
-
# rubocop:disable Metrics/AbcSize
|
|
35
32
|
def update
|
|
36
33
|
pet_adequacy_result.assign_attributes(pet_adequacy_result_params)
|
|
37
34
|
if pet_adequacy_result.save
|
|
@@ -41,7 +38,6 @@ module Renalware
|
|
|
41
38
|
render :edit, locals: { pet_adequacy_result: pet_adequacy_result, patient: patient }
|
|
42
39
|
end
|
|
43
40
|
end
|
|
44
|
-
# rubocop:enable Metrics/AbcSize
|
|
45
41
|
|
|
46
42
|
def show
|
|
47
43
|
render locals: { pet_adequacy_result: pet_adequacy_result, patient: patient }
|
|
@@ -34,7 +34,6 @@ module Renalware
|
|
|
34
34
|
}
|
|
35
35
|
end
|
|
36
36
|
|
|
37
|
-
# rubocop:disable Metrics/AbcSize
|
|
38
37
|
def create
|
|
39
38
|
result = CreateRegime.new(patient: patient)
|
|
40
39
|
.call(by: current_user, params: pd_regime_params)
|
|
@@ -49,7 +48,6 @@ module Renalware
|
|
|
49
48
|
}
|
|
50
49
|
end
|
|
51
50
|
end
|
|
52
|
-
# rubocop:enable Metrics/AbcSize
|
|
53
51
|
|
|
54
52
|
def edit
|
|
55
53
|
render :edit, locals: {
|
|
@@ -58,7 +56,6 @@ module Renalware
|
|
|
58
56
|
}
|
|
59
57
|
end
|
|
60
58
|
|
|
61
|
-
# rubocop:disable Metrics/AbcSize
|
|
62
59
|
def update
|
|
63
60
|
result = ReviseRegime.new(pd_regime).call(by: current_user, params: pd_regime_params)
|
|
64
61
|
|
|
@@ -73,7 +70,6 @@ module Renalware
|
|
|
73
70
|
}
|
|
74
71
|
end
|
|
75
72
|
end
|
|
76
|
-
# rubocop:enable Metrics/AbcSize
|
|
77
73
|
|
|
78
74
|
def show
|
|
79
75
|
render :show, locals: {
|
|
@@ -129,8 +129,6 @@ module Renalware
|
|
|
129
129
|
attribute :safe_to_use, Document::Enum, default: :Y
|
|
130
130
|
end
|
|
131
131
|
attribute :avf_avg_assessment, AvfAvgAssessment
|
|
132
|
-
|
|
133
|
-
# rubocop:disable Metrics/AbcSize
|
|
134
132
|
def error_messages
|
|
135
133
|
[
|
|
136
134
|
observations_before.errors.full_messages,
|
|
@@ -141,7 +139,6 @@ module Renalware
|
|
|
141
139
|
hdf.errors.full_messages
|
|
142
140
|
].flatten.compact
|
|
143
141
|
end
|
|
144
|
-
# rubocop:enable Metrics/AbcSize
|
|
145
142
|
end
|
|
146
143
|
end
|
|
147
144
|
end
|
|
@@ -16,7 +16,6 @@ class DatePickerInput < SimpleForm::Inputs::StringInput
|
|
|
16
16
|
end
|
|
17
17
|
end
|
|
18
18
|
|
|
19
|
-
# rubocop:disable Metrics/AbcSize
|
|
20
19
|
def input_column(_wrapper_options = {})
|
|
21
20
|
html_options = input_html_options
|
|
22
21
|
html_options[:class] ||= []
|
|
@@ -27,7 +26,6 @@ class DatePickerInput < SimpleForm::Inputs::StringInput
|
|
|
27
26
|
template.concat @builder.text_field(attribute_name, html_options.merge(value: value))
|
|
28
27
|
end
|
|
29
28
|
end
|
|
30
|
-
# rubocop:enable Metrics/AbcSize
|
|
31
29
|
|
|
32
30
|
def icon_calendar
|
|
33
31
|
"<span class='prefix'><i class='far fa-calendar'></i></span>".html_safe
|
|
@@ -28,12 +28,12 @@ module Renalware
|
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
# Because the database allows multiple current access profiles, this scope
|
|
31
|
-
# needs to choose just one, otherwise queries that merge in this scope
|
|
31
|
+
# needs to choose just one, otherwise queries that merge in this scope
|
|
32
32
|
# can have duplicates, or worse, broken pagination.
|
|
33
33
|
scope :with_profile, lambda {
|
|
34
34
|
joins(<<-SQL)
|
|
35
35
|
left outer join (
|
|
36
|
-
select distinct on (patient_id) * from access_profiles
|
|
36
|
+
select distinct on (patient_id) * from access_profiles
|
|
37
37
|
where
|
|
38
38
|
access_profiles.terminated_on is null
|
|
39
39
|
and access_profiles.started_on <= current_date
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
+
require_dependency "renalware/pdf_friendly_validator"
|
|
3
4
|
require_dependency "renalware/events"
|
|
4
5
|
|
|
5
6
|
module Renalware
|
|
@@ -22,6 +23,8 @@ module Renalware
|
|
|
22
23
|
validates :date_time, presence: true
|
|
23
24
|
validates :event_type_id, presence: true
|
|
24
25
|
validates :date_time, timeliness: { type: :datetime }
|
|
26
|
+
validates :notes, "renalware/pdf_friendly": true
|
|
27
|
+
validates :description, "renalware/pdf_friendly": true
|
|
25
28
|
|
|
26
29
|
scope :ordered, -> { order(date_time: :desc, updated_at: :desc) }
|
|
27
30
|
|
|
@@ -10,8 +10,6 @@ module Renalware
|
|
|
10
10
|
include StringLogging
|
|
11
11
|
include Feeds::Job
|
|
12
12
|
FILE_TO_EXTRACT_FROM_ARCHIVE = /epracmem.csv/.freeze
|
|
13
|
-
|
|
14
|
-
# rubocop:disable Metrics/AbcSize
|
|
15
13
|
# TODO: refactor
|
|
16
14
|
def perform(file)
|
|
17
15
|
logging_to_stringio(strio = StringIO.new)
|
|
@@ -27,7 +25,6 @@ module Renalware
|
|
|
27
25
|
ensure
|
|
28
26
|
file.update!(status: status, result: strio.string, time_taken: elapsed_ms)
|
|
29
27
|
end
|
|
30
|
-
# rubocop:enable Metrics/AbcSize
|
|
31
28
|
|
|
32
29
|
private
|
|
33
30
|
|
|
@@ -11,8 +11,6 @@ module Renalware
|
|
|
11
11
|
include Feeds::Job
|
|
12
12
|
|
|
13
13
|
FILE_TO_EXTRACT_FROM_ARCHIVE = /^egpcur.csv$/.freeze
|
|
14
|
-
|
|
15
|
-
# rubocop:disable Metrics/AbcSize
|
|
16
14
|
def perform(file)
|
|
17
15
|
logging_to_stringio(strio = StringIO.new)
|
|
18
16
|
log "PrimaryCarePhysician count before update: #{primary_care_physician_count}"
|
|
@@ -27,7 +25,6 @@ module Renalware
|
|
|
27
25
|
ensure
|
|
28
26
|
file.update!(status: status, result: strio.string, time_taken: elapsed_ms)
|
|
29
27
|
end
|
|
30
|
-
# rubocop:enable Metrics/AbcSize
|
|
31
28
|
|
|
32
29
|
private
|
|
33
30
|
|
|
@@ -20,7 +20,7 @@ module Renalware
|
|
|
20
20
|
search.result
|
|
21
21
|
end
|
|
22
22
|
|
|
23
|
-
# rubocop:disable Metrics/MethodLength
|
|
23
|
+
# rubocop:disable Metrics/MethodLength
|
|
24
24
|
def search
|
|
25
25
|
@search ||= begin
|
|
26
26
|
HD::Patient
|
|
@@ -39,7 +39,7 @@ module Renalware
|
|
|
39
39
|
.ransack(params)
|
|
40
40
|
end
|
|
41
41
|
end
|
|
42
|
-
# rubocop:enable Metrics/MethodLength
|
|
42
|
+
# rubocop:enable Metrics/MethodLength
|
|
43
43
|
|
|
44
44
|
# Module to allow us to mixin ransackers
|
|
45
45
|
module QueryablePatient
|
|
@@ -25,7 +25,6 @@ module Renalware
|
|
|
25
25
|
Rails.logger.info "Compiling letter PDFs for batch #{batch.id} in folder #{dir}"
|
|
26
26
|
end
|
|
27
27
|
|
|
28
|
-
# rubocop:disable Metrics/AbcSize
|
|
29
28
|
def call
|
|
30
29
|
batch.status = :processing
|
|
31
30
|
batch.save_by!(user)
|
|
@@ -38,7 +37,6 @@ module Renalware
|
|
|
38
37
|
batch.status = :awaiting_printing
|
|
39
38
|
batch.save_by!(user)
|
|
40
39
|
end
|
|
41
|
-
# rubocop:enable Metrics/AbcSize
|
|
42
40
|
|
|
43
41
|
private
|
|
44
42
|
|
|
@@ -31,7 +31,7 @@ module Renalware
|
|
|
31
31
|
class CodeGroup < ApplicationRecord
|
|
32
32
|
include Accountable
|
|
33
33
|
has_paper_trail(
|
|
34
|
-
class_name: "Renalware::Pathology::Version",
|
|
34
|
+
class_name: "Renalware::Pathology::Version",
|
|
35
35
|
on: [:create, :update, :destroy]
|
|
36
36
|
)
|
|
37
37
|
validates :name, presence: true, uniqueness: true
|
|
@@ -50,7 +50,7 @@ module Renalware
|
|
|
50
50
|
group = CodeGroup.find_by(name: name)
|
|
51
51
|
return [] if group.nil?
|
|
52
52
|
|
|
53
|
-
group
|
|
53
|
+
group
|
|
54
54
|
.observation_descriptions
|
|
55
55
|
.order(subgroup: :asc, position_within_subgroup: :asc)
|
|
56
56
|
end
|
|
@@ -31,14 +31,14 @@ module Renalware
|
|
|
31
31
|
serialize :values, ObservationsJsonbSerializer
|
|
32
32
|
|
|
33
33
|
# Select values frm the set where the code matches the code or array of codes
|
|
34
|
-
# requested.
|
|
34
|
+
# requested.
|
|
35
35
|
# When the code is not found in the set, return an empty hash for that code.
|
|
36
|
-
# When the patient has no current_observation_set, return an empty hash for each code.
|
|
36
|
+
# When the patient has no current_observation_set, return an empty hash for each code.
|
|
37
37
|
# We need to be sure to extend the HashWithIndifferentAccess returned from
|
|
38
38
|
# #select with the ObservationSetMethods so a user can call eg {..}.hgb_date
|
|
39
39
|
# or {..}.plt etc without error
|
|
40
40
|
def values_for_codes(codes)
|
|
41
|
-
hash = Array(codes).each_with_object(HashWithIndifferentAccess.new) do |code, hash|
|
|
41
|
+
hash = Array(codes).each_with_object(HashWithIndifferentAccess.new) do |code, hash|
|
|
42
42
|
hash[code] = values[code] || CurrentObservationSet.null_values_hash
|
|
43
43
|
end
|
|
44
44
|
hash.extend(ObservationSetMethods)
|
|
@@ -54,7 +54,7 @@ module Renalware
|
|
|
54
54
|
ObservationsJsonbSerializer.load(HashWithIndifferentAccess.new)
|
|
55
55
|
end
|
|
56
56
|
|
|
57
|
-
def values_for_codes(
|
|
57
|
+
def values_for_codes(_codes)
|
|
58
58
|
CurrentObservationSet.null_values_hash
|
|
59
59
|
end
|
|
60
60
|
end
|
|
@@ -13,7 +13,6 @@ module Renalware
|
|
|
13
13
|
@regime = decorate(regime)
|
|
14
14
|
end
|
|
15
15
|
|
|
16
|
-
# rubocop:disable Metrics/AbcSize
|
|
17
16
|
def call
|
|
18
17
|
regime.overnight_volume = regime.calculated_overnight_volume
|
|
19
18
|
regime.daily_volume = regime.calculated_daily_volume
|
|
@@ -21,7 +20,6 @@ module Renalware
|
|
|
21
20
|
regime.glucose_volume_medium_strength = regime.volume_of_glucose_at_strength(:medium)
|
|
22
21
|
regime.glucose_volume_high_strength = regime.volume_of_glucose_at_strength(:high)
|
|
23
22
|
end
|
|
24
|
-
# rubocop:enable Metrics/AbcSize
|
|
25
23
|
|
|
26
24
|
private
|
|
27
25
|
|
|
@@ -73,7 +73,6 @@ module Renalware
|
|
|
73
73
|
|
|
74
74
|
# Putting this here for now so all incomplete data criteria is all in one place.
|
|
75
75
|
# Build an array of symbols for all missing data identified by the above query
|
|
76
|
-
# rubocop:disable Metrics/AbcSize
|
|
77
76
|
def self.missing_data_for(patient)
|
|
78
77
|
renal_profile = Renal.cast_patient(patient).profile
|
|
79
78
|
missing = []
|
|
@@ -85,7 +84,6 @@ module Renalware
|
|
|
85
84
|
end
|
|
86
85
|
missing
|
|
87
86
|
end
|
|
88
|
-
# rubocop:enable Metrics/AbcSize
|
|
89
87
|
|
|
90
88
|
module QueryablePatient
|
|
91
89
|
extend ActiveSupport::Concern
|
|
@@ -20,7 +20,6 @@ module Renalware
|
|
|
20
20
|
|
|
21
21
|
private
|
|
22
22
|
|
|
23
|
-
# rubocop:disable Metrics/AbcSize
|
|
24
23
|
def update!(params)
|
|
25
24
|
User.transaction do
|
|
26
25
|
approve if can_approve?(params)
|
|
@@ -34,7 +33,6 @@ module Renalware
|
|
|
34
33
|
rescue ActiveRecord::RecordInvalid
|
|
35
34
|
false
|
|
36
35
|
end
|
|
37
|
-
# rubocop:enable Metrics/AbcSize
|
|
38
36
|
|
|
39
37
|
def notify!
|
|
40
38
|
notifications.each { |n| n.public_send(delivery_method) } if notifications.any?
|
|
@@ -23,7 +23,7 @@ module Renalware
|
|
|
23
23
|
FileUtils.mv filepath, paths.archive.join(filepath.basename)
|
|
24
24
|
next
|
|
25
25
|
end
|
|
26
|
-
|
|
26
|
+
|
|
27
27
|
logger.info "Processing: #{filepath}"
|
|
28
28
|
import_surveys_from_file(filepath)
|
|
29
29
|
end
|
|
@@ -38,7 +38,7 @@ module Renalware
|
|
|
38
38
|
# This assumes filenames are unique across time, which they should be.
|
|
39
39
|
# Note we match on the whole file path, so if the location of the folder changes
|
|
40
40
|
# and we are presented with familiar files, then they will be imported again. Its unlikely
|
|
41
|
-
# those two things will happen together though.
|
|
41
|
+
# those two things will happen together though.
|
|
42
42
|
def already_imported?(filepath)
|
|
43
43
|
TransmissionLog.exists?(file_path: filepath.to_s, status: :imported)
|
|
44
44
|
end
|
|
@@ -46,7 +46,6 @@ module Renalware
|
|
|
46
46
|
# Import all surverys (they will be for the same patient) in the XML file.
|
|
47
47
|
# Note that #with_logging yields a block that will catch and save any error to
|
|
48
48
|
# ukrdc_transmission_logs
|
|
49
|
-
# rubocop:disable Metrics/AbcSize
|
|
50
49
|
def import_surveys_from_file(file)
|
|
51
50
|
# Important to create the log before we do anything that might cause an error
|
|
52
51
|
# eg parse the xml etc.
|
|
@@ -64,7 +63,6 @@ module Renalware
|
|
|
64
63
|
ensure
|
|
65
64
|
FileUtils.mv file, paths.archive.join(file.basename)
|
|
66
65
|
end
|
|
67
|
-
# rubocop:enable Metrics/AbcSize
|
|
68
66
|
|
|
69
67
|
def import_survey(survey_hash, patient)
|
|
70
68
|
ImportSurvey.new(
|
|
@@ -32,7 +32,7 @@ module Renalware
|
|
|
32
32
|
def generate_treatments
|
|
33
33
|
PrepareTables.call
|
|
34
34
|
Rails.logger.info "#{patient_scope.count} patients"
|
|
35
|
-
patient_scope.find_each.with_index do |patient,
|
|
35
|
+
patient_scope.find_each.with_index do |patient, _index|
|
|
36
36
|
print "\n#{patient.id}: "
|
|
37
37
|
GenerateTimeline.new(patient).call
|
|
38
38
|
# Start gargbage collection periodically to prevent server ram issues.
|
|
@@ -79,7 +79,7 @@ module Renalware
|
|
|
79
79
|
create_treatment(regime, start_date, end_date)
|
|
80
80
|
end
|
|
81
81
|
|
|
82
|
-
# rubocop:disable Metrics/
|
|
82
|
+
# rubocop:disable Metrics/MethodLength
|
|
83
83
|
def create_treatment(regime, start_date, end_date)
|
|
84
84
|
treatments << Treatment.create!(
|
|
85
85
|
patient: patient,
|
|
@@ -99,7 +99,7 @@ module Renalware
|
|
|
99
99
|
previous_treatment.update!(ended_on: start_date)
|
|
100
100
|
end
|
|
101
101
|
end
|
|
102
|
-
# rubocop:enable Metrics/
|
|
102
|
+
# rubocop:enable Metrics/MethodLength
|
|
103
103
|
|
|
104
104
|
def treatments
|
|
105
105
|
@treatments ||= []
|
|
@@ -92,7 +92,6 @@ module Renalware
|
|
|
92
92
|
OpenSSL::HMAC.hexdigest(digest, key, id.to_s)
|
|
93
93
|
end
|
|
94
94
|
|
|
95
|
-
|
|
96
95
|
# We implement a simple can? method ion the use because in places we pass a current user
|
|
97
96
|
# from an ActionView::Component to a partial, and in the specs the partial says it cannot
|
|
98
97
|
# Example usage user.can?(:edit, letter)
|