renalware-core 2.0.131 → 2.0.132
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/controllers/renalware/admissions/consults_controller.rb +2 -1
- data/app/controllers/renalware/api/ukrdc/patients_controller.rb +4 -1
- data/app/helpers/renalware/definition_list_helper.rb +1 -1
- data/app/models/renalware/admissions/consult.rb +1 -3
- data/app/models/renalware/admissions/consult_query.rb +1 -0
- data/app/models/renalware/admissions/specialty.rb +17 -0
- data/app/models/renalware/transplants/mdm_patients_query.rb +1 -1
- data/app/models/renalware/ukrdc/create_encrypted_patient_xml_files.rb +2 -7
- data/app/models/renalware/ukrdc/create_patient_xml_file.rb +1 -10
- data/app/models/renalware/ukrdc/housekeeping/remove_stale_files.rb +79 -0
- data/app/models/renalware/ukrdc/treatment_timeline/generate_treatments.rb +3 -3
- data/app/models/renalware/ukrdc/xml_renderer.rb +3 -13
- data/app/models/renalware/ukrdc/xsd_schema.rb +23 -0
- data/app/views/renalware/admissions/consults/_form.html.slim +4 -0
- data/app/views/renalware/admissions/consults/_table.html.slim +6 -0
- data/app/views/renalware/admissions/requests/_request.html.slim +3 -2
- data/app/views/renalware/admissions/requests/_table.html.slim +2 -1
- data/config/locales/renalware/admissions/consults.en.yml +2 -1
- data/db/migrate/20150514113239_devise_create_users.rb +6 -11
- data/db/migrate/20190325134823_create_patients_master_index.rb +0 -1
- data/db/migrate/20190718091430_add_code_to_modality_descriptions.rb +1 -1
- data/db/migrate/20200110153522_add_ealert_to_admission_consults.rb +7 -0
- data/db/migrate/20200110160241_create_admission_specialties.rb +19 -0
- data/db/seeds/default/patients/surveys/pos_s_questions.csv +3 -3
- data/lib/renalware/configuration.rb +4 -1
- data/lib/renalware/version.rb +1 -1
- data/lib/tasks/spec.rake +5 -5
- data/lib/tasks/ukrdc.rake +17 -0
- data/spec/factories/admissions/specialties.rb +10 -0
- metadata +31 -11
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: f670bf5df7603c7132365ac119ae9f6bdbb43dde12a24a04d3d015b5a694626c
|
|
4
|
+
data.tar.gz: 0a8dde1dd0be593ee8483e01f8128e31f544a1c6eed362fe8fd263e78fd78684
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: dc8e11f2b13664bddaabdef7d8bede3f1e2a14bc63862b703a628ad3f8fd6019bcb6d285fd40a81bdd530417ce5c46cbfc8ba8f6a61d5901b7e8523ca783b6a6
|
|
7
|
+
data.tar.gz: 5d77baac6abc4e238faa59e4147948315beed80cf363fac2b8c6cb88436b44ff8898a668ef71a3c81a5ccc3e8ca520f596a1919a242275c4540128431f7fa46d
|
|
@@ -100,7 +100,8 @@ module Renalware
|
|
|
100
100
|
.permit(
|
|
101
101
|
:consult_site_id, :hospital_ward_id, :patient_id, :q, :other_site_or_ward,
|
|
102
102
|
:decided_on, :transferred_on, :started_on, :ended_on, :decided_on,
|
|
103
|
-
:aki_risk, :transfer_priority, :priority, :seen_by_id,
|
|
103
|
+
:aki_risk, :transfer_priority, :priority, :seen_by_id,
|
|
104
|
+
:e_alert, :consult_type, :specialty_id,
|
|
104
105
|
:requires_aki_nurse, :description, :contact_number, :rrt
|
|
105
106
|
)
|
|
106
107
|
end
|
|
@@ -26,7 +26,10 @@ module Renalware
|
|
|
26
26
|
end
|
|
27
27
|
|
|
28
28
|
def attempt_to_generate_patient_ukrdc_xml
|
|
29
|
-
Renalware::UKRDC::XmlRenderer.new(
|
|
29
|
+
Renalware::UKRDC::XmlRenderer.new(
|
|
30
|
+
schema: Renalware::UKRDC::XsdSchema.new,
|
|
31
|
+
locals: { patient: patient_presenter }
|
|
32
|
+
).call
|
|
30
33
|
end
|
|
31
34
|
|
|
32
35
|
def patient_presenter
|
|
@@ -14,7 +14,7 @@ module Renalware
|
|
|
14
14
|
|
|
15
15
|
def definition(attribute, label = nil)
|
|
16
16
|
text = label || @model_klass.human_attribute_name(attribute)
|
|
17
|
-
value = public_send(attribute)
|
|
17
|
+
value = __getobj__.public_send(attribute)
|
|
18
18
|
value = yield(value) if value.present? && block_given?
|
|
19
19
|
capture do
|
|
20
20
|
concat content_tag(:dt, text)
|
|
@@ -12,9 +12,6 @@ module Renalware
|
|
|
12
12
|
validates :patient_id, presence: true
|
|
13
13
|
validates :started_on, presence: true
|
|
14
14
|
validates :description, presence: true
|
|
15
|
-
# Currently #consult_type is a string and we are not sure what should be in there
|
|
16
|
-
# Migrated consults may not have a type so only enforce it creation of new ones.
|
|
17
|
-
validates :consult_type, presence: true, on: :create
|
|
18
15
|
validates :priority,
|
|
19
16
|
numericality: {
|
|
20
17
|
only_integer: true,
|
|
@@ -29,6 +26,7 @@ module Renalware
|
|
|
29
26
|
belongs_to :patient, touch: true
|
|
30
27
|
belongs_to :consult_site, class_name: "Admissions::ConsultSite"
|
|
31
28
|
belongs_to :hospital_ward, class_name: "Hospitals::Ward"
|
|
29
|
+
belongs_to :specialty, class_name: "Admissions::Specialty"
|
|
32
30
|
belongs_to :seen_by, class_name: "User"
|
|
33
31
|
|
|
34
32
|
enumerize :transfer_priority, in: %i(unknown necessary desirable potential unnecessary)
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_dependency "renalware/admissions"
|
|
4
|
+
|
|
5
|
+
module Renalware
|
|
6
|
+
module Admissions
|
|
7
|
+
class Specialty < ApplicationRecord
|
|
8
|
+
validates :name, presence: true, uniqueness: true
|
|
9
|
+
|
|
10
|
+
scope :ordered, -> { order(position: :asc) }
|
|
11
|
+
|
|
12
|
+
def to_s
|
|
13
|
+
name
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
@@ -9,7 +9,7 @@ module Renalware
|
|
|
9
9
|
class MDMPatientsQuery
|
|
10
10
|
include ModalityScopes
|
|
11
11
|
include PatientPathologyScopes
|
|
12
|
-
DEFAULT_SEARCH_PREDICATE = "
|
|
12
|
+
DEFAULT_SEARCH_PREDICATE = "cre_date DESC"
|
|
13
13
|
attr_reader :q, :relation, :named_filter
|
|
14
14
|
|
|
15
15
|
def initialize(relation: Transplants::Patient.all, named_filter: nil, q: nil)
|
|
@@ -66,17 +66,12 @@ module Renalware
|
|
|
66
66
|
end
|
|
67
67
|
end
|
|
68
68
|
|
|
69
|
-
def schema
|
|
70
|
-
xsd_path = File.join(Renalware::Engine.root, "vendor/xsd/ukrdc/Schema/UKRDC.xsd")
|
|
71
|
-
xsddoc = Nokogiri::XML(File.read(xsd_path), xsd_path)
|
|
72
|
-
Nokogiri::XML::Schema.from_document(xsddoc)
|
|
73
|
-
end
|
|
74
|
-
|
|
75
69
|
# rubocop:disable Metrics/MethodLength
|
|
76
70
|
def create_patient_xml_files
|
|
77
71
|
count = 0
|
|
78
72
|
patients = ukrdc_patients_who_have_changed_since_last_send
|
|
79
73
|
summary.num_changed_patients = patients.count
|
|
74
|
+
schema = UKRDC::XsdSchema.new
|
|
80
75
|
patients.find_each do |patient|
|
|
81
76
|
count += 1
|
|
82
77
|
Rails.logger.info count
|
|
@@ -92,7 +87,7 @@ module Renalware
|
|
|
92
87
|
).call
|
|
93
88
|
|
|
94
89
|
# Every n patients, force the garbage collector to kick in
|
|
95
|
-
GC.start if (count % 10).zero?
|
|
90
|
+
# GC.start if (count % 10).zero?
|
|
96
91
|
end
|
|
97
92
|
end
|
|
98
93
|
# rubocop:enable Metrics/MethodLength
|
|
@@ -10,7 +10,7 @@ module Renalware
|
|
|
10
10
|
:patient!,
|
|
11
11
|
:dir!,
|
|
12
12
|
:request_uuid!,
|
|
13
|
-
:schema
|
|
13
|
+
:schema!,
|
|
14
14
|
:changes_since,
|
|
15
15
|
:logger,
|
|
16
16
|
:batch_number,
|
|
@@ -102,15 +102,6 @@ module Renalware
|
|
|
102
102
|
nil
|
|
103
103
|
end
|
|
104
104
|
|
|
105
|
-
def schema
|
|
106
|
-
@schema ||= begin
|
|
107
|
-
Rails.logger.info "Creating Nokogiri::XML::Schema"
|
|
108
|
-
xsd_path = File.join(Renalware::Engine.root, "vendor/xsd/ukrdc/Schema/UKRDC.xsd")
|
|
109
|
-
xsddoc = Nokogiri::XML(File.read(xsd_path), xsd_path)
|
|
110
|
-
Nokogiri::XML::Schema.from_document(xsddoc)
|
|
111
|
-
end
|
|
112
|
-
end
|
|
113
|
-
|
|
114
105
|
def default_renderer
|
|
115
106
|
Renalware::UKRDC::XmlRenderer.new(
|
|
116
107
|
schema: schema,
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_dependency "renalware/ukrdc"
|
|
4
|
+
|
|
5
|
+
module Renalware
|
|
6
|
+
module UKRDC
|
|
7
|
+
module Housekeeping
|
|
8
|
+
class RemoveStaleFiles
|
|
9
|
+
def self.call
|
|
10
|
+
new.call
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def call
|
|
14
|
+
return unless Renalware.config.ukrdc_remove_stale_outgoing_files
|
|
15
|
+
|
|
16
|
+
remove_stale_outgoing_files
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
private
|
|
20
|
+
|
|
21
|
+
class OutgoingXmlFile
|
|
22
|
+
pattr_initialize :filename
|
|
23
|
+
|
|
24
|
+
# Returns the integer batch number from the file name
|
|
25
|
+
# e.g. 13 from /var/ukrdc/outgoing/RJZ_000040_1234606005.gpg
|
|
26
|
+
def batch_number
|
|
27
|
+
matches = filename.match(/\w*_(\d{6})_/)
|
|
28
|
+
return unless matches
|
|
29
|
+
|
|
30
|
+
matches[1].to_i
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def remove_stale_outgoing_files
|
|
35
|
+
log "Remove stale outgoing files"
|
|
36
|
+
log "Keeping files in batches #{batch_numbers_to_keep.join(', ')}"
|
|
37
|
+
|
|
38
|
+
Dir.glob(glob_pattern).each do |filename|
|
|
39
|
+
FileUtils.rm filename if remove_file?(filename)
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
# Pattern to use to find batch-numbered files in the outgoing directory
|
|
44
|
+
def glob_pattern
|
|
45
|
+
outgoing_path.join("*.gpg")
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
def outgoing_path
|
|
49
|
+
Pathname(Renalware.config.ukrdc_working_path).join("outgoing")
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
def number_of_batches_to_keep
|
|
53
|
+
Renalware.config.ukrdc_number_of_archived_folders_to_keep.to_i
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
# Returns the ids of a few of the most recent BatchNumbers rows (ie the batch number) that
|
|
57
|
+
# we should not delete - these being the most recent ones
|
|
58
|
+
def batch_numbers_to_keep
|
|
59
|
+
@batch_numbers_to_keep ||= begin
|
|
60
|
+
BatchNumber
|
|
61
|
+
.limit(number_of_batches_to_keep)
|
|
62
|
+
.order(created_at: :desc)
|
|
63
|
+
.pluck(:id)
|
|
64
|
+
end
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
def remove_file?(filename)
|
|
68
|
+
!batch_numbers_to_keep.include?(
|
|
69
|
+
OutgoingXmlFile.new(filename).batch_number
|
|
70
|
+
)
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
def log(msg)
|
|
74
|
+
Rails.logger.info(" " + msg)
|
|
75
|
+
end
|
|
76
|
+
end
|
|
77
|
+
end
|
|
78
|
+
end
|
|
79
|
+
end
|
|
@@ -28,7 +28,7 @@ module Renalware
|
|
|
28
28
|
.where("send_to_renalreg = true or send_to_rpv = true")
|
|
29
29
|
end
|
|
30
30
|
|
|
31
|
-
# rubocop:disable Rails/Output
|
|
31
|
+
# rubocop:disable Rails/Output
|
|
32
32
|
def generate_treatments
|
|
33
33
|
PrepareTables.call
|
|
34
34
|
Rails.logger.info "#{patient_scope.count} patients"
|
|
@@ -36,10 +36,10 @@ module Renalware
|
|
|
36
36
|
print "\n#{patient.id}: "
|
|
37
37
|
GenerateTimeline.new(patient).call
|
|
38
38
|
# Start gargbage collection periodically to prevent server ram issues.
|
|
39
|
-
GC.start if (index % 50).zero?
|
|
39
|
+
# GC.start if (index % 50).zero?
|
|
40
40
|
end
|
|
41
41
|
end
|
|
42
|
-
# rubocop:enable Rails/Output
|
|
42
|
+
# rubocop:enable Rails/Output
|
|
43
43
|
|
|
44
44
|
def log(msg)
|
|
45
45
|
Rails.logger.info(msg)
|
|
@@ -7,7 +7,7 @@ module Renalware
|
|
|
7
7
|
module UKRDC
|
|
8
8
|
class XmlRenderer
|
|
9
9
|
DEFAULT_TEMPLATE = "/renalware/api/ukrdc/patients/show"
|
|
10
|
-
attr_reader :template, :errors, :locals
|
|
10
|
+
attr_reader :template, :errors, :locals, :schema
|
|
11
11
|
|
|
12
12
|
class Success < Renalware::Success
|
|
13
13
|
alias xml object
|
|
@@ -19,7 +19,7 @@ module Renalware
|
|
|
19
19
|
|
|
20
20
|
# Schema is an instance of Nokogiri::XML::Schema passed in for optimisation reasons.
|
|
21
21
|
# If it is not passed in we create it.
|
|
22
|
-
def initialize(schema
|
|
22
|
+
def initialize(schema:, template: nil, locals: {})
|
|
23
23
|
@template = template || DEFAULT_TEMPLATE
|
|
24
24
|
@schema = schema
|
|
25
25
|
@locals = locals
|
|
@@ -47,7 +47,7 @@ module Renalware
|
|
|
47
47
|
|
|
48
48
|
# Returns an array of SchemaValidation errors
|
|
49
49
|
def validation_errors
|
|
50
|
-
@validation_errors ||= schema.validate(
|
|
50
|
+
@validation_errors ||= schema.validate(xml)
|
|
51
51
|
end
|
|
52
52
|
|
|
53
53
|
private
|
|
@@ -58,16 +58,6 @@ module Renalware
|
|
|
58
58
|
instruct[:encoding] = "UTF-8"
|
|
59
59
|
end
|
|
60
60
|
end
|
|
61
|
-
|
|
62
|
-
# It is more performant if schema is passed in in the ctor - but if it isn't we create it.
|
|
63
|
-
def schema
|
|
64
|
-
@schema ||= begin
|
|
65
|
-
Rails.logger.warn "Creating JIT Nokogiri::XML::Schema!"
|
|
66
|
-
xsd_path = File.join(Renalware::Engine.root, "vendor/xsd/ukrdc/Schema/UKRDC.xsd")
|
|
67
|
-
xsddoc = Nokogiri::XML(File.read(xsd_path), xsd_path)
|
|
68
|
-
Nokogiri::XML::Schema.from_document(xsddoc)
|
|
69
|
-
end
|
|
70
|
-
end
|
|
71
61
|
end
|
|
72
62
|
end
|
|
73
63
|
end
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_dependency "renalware/ukrdc"
|
|
4
|
+
|
|
5
|
+
module Renalware
|
|
6
|
+
module UKRDC
|
|
7
|
+
class XsdSchema
|
|
8
|
+
def validate(xml)
|
|
9
|
+
schema.validate(Nokogiri::XML(xml))
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
private
|
|
13
|
+
|
|
14
|
+
def schema
|
|
15
|
+
@schema ||= begin
|
|
16
|
+
xsd_path = File.join(Renalware::Engine.root, "vendor/xsd/ukrdc/Schema/UKRDC.xsd")
|
|
17
|
+
xsddoc = Nokogiri::XML(File.read(xsd_path), xsd_path)
|
|
18
|
+
Nokogiri::XML::Schema.from_document(xsddoc)
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
@@ -29,6 +29,10 @@
|
|
|
29
29
|
|
|
30
30
|
= f.input :other_site_or_ward, wrapper: :horizontal_medium
|
|
31
31
|
= f.input :started_on, as: :date_picker, wrapper: :horizontal_datepicker
|
|
32
|
+
= f.input :e_alert
|
|
33
|
+
= f.association(:specialty,
|
|
34
|
+
wrapper: :horizontal_medium,
|
|
35
|
+
collection: Renalware::Admissions::Specialty.ordered)
|
|
32
36
|
= f.input :consult_type, wrapper: :horizontal_medium
|
|
33
37
|
= f.input :decided_on, as: :date_picker, wrapper: :horizontal_datepicker
|
|
34
38
|
= f.input :transfer_priority, include_blank: false, wrapper: :horizontal_small
|
|
@@ -123,6 +123,12 @@
|
|
|
123
123
|
dd= consult.patient_current_modality
|
|
124
124
|
dt Description
|
|
125
125
|
dd= simple_format consult.description
|
|
126
|
+
dt E-Alert
|
|
127
|
+
dd= yes_no consult.e_alert
|
|
128
|
+
dt Specialty
|
|
129
|
+
dd= consult.specialty
|
|
130
|
+
dt Specialty notes
|
|
131
|
+
dd= consult.consult_type
|
|
126
132
|
|
|
127
133
|
/ When printing we just show the notes on the second row
|
|
128
134
|
tr.print-only.child-row
|
|
@@ -8,14 +8,15 @@ ruby:
|
|
|
8
8
|
td(class="sortable-position-for-model-id-#{request.id}")= request.position
|
|
9
9
|
td.priority
|
|
10
10
|
span= request.priority.text
|
|
11
|
-
td= request.reason.description
|
|
11
|
+
td.col-width-medium-with-ellipsis= request.reason.description
|
|
12
12
|
td= default_patient_link(patient)
|
|
13
13
|
td= patient.nhs_number
|
|
14
14
|
td= patient.hospital_identifiers
|
|
15
|
-
td= request.hospital_unit&.name
|
|
15
|
+
td.col-width-medium-with-ellipsis= request.hospital_unit&.name
|
|
16
16
|
td.col-width-medium-with-ellipsis(title=request.notes)
|
|
17
17
|
= request.notes
|
|
18
18
|
td(title=editing_history)= l(request.created_at)
|
|
19
|
+
td.col-width-medium-with-ellipsis=request.created_by
|
|
19
20
|
td
|
|
20
21
|
= link_to admissions_request_path(request),
|
|
21
22
|
remote: true,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
table.admissions_requests
|
|
2
2
|
thead
|
|
3
|
-
th Rank
|
|
3
|
+
th.col-width-tiny Rank
|
|
4
4
|
th Priority
|
|
5
5
|
th Reason
|
|
6
6
|
th Patient
|
|
@@ -9,6 +9,7 @@ table.admissions_requests
|
|
|
9
9
|
th Location
|
|
10
10
|
th Notes
|
|
11
11
|
th.col-width-date-time Created
|
|
12
|
+
th Created by
|
|
12
13
|
th.col-width-small
|
|
13
14
|
th
|
|
14
15
|
= content_tag(:tbody,
|
|
@@ -37,8 +37,9 @@ class DeviseCreateUsers < ActiveRecord::Migration[4.2]
|
|
|
37
37
|
t.string :signature
|
|
38
38
|
|
|
39
39
|
## Non-devise - account expiry
|
|
40
|
-
t.datetime :last_activity_at
|
|
41
|
-
t.datetime :expired_at
|
|
40
|
+
t.datetime :last_activity_at
|
|
41
|
+
t.datetime :expired_at
|
|
42
|
+
t.datetime :datetime # will be removed later
|
|
42
43
|
|
|
43
44
|
## Non-devise - job title
|
|
44
45
|
t.string :professional_position
|
|
@@ -51,15 +52,9 @@ class DeviseCreateUsers < ActiveRecord::Migration[4.2]
|
|
|
51
52
|
|
|
52
53
|
add_index :users, :email, unique: true
|
|
53
54
|
add_index :users, :reset_password_token, unique: true
|
|
54
|
-
# add_index :users, :confirmation_token, unique: true
|
|
55
|
-
# add_index :users, :unlock_token, unique: true
|
|
56
|
-
|
|
57
55
|
add_index :users, :username, unique: true
|
|
58
|
-
|
|
59
|
-
add_index
|
|
60
|
-
add_index
|
|
61
|
-
|
|
62
|
-
add_index :users, :approved
|
|
63
|
-
|
|
56
|
+
add_index :users, :last_activity_at
|
|
57
|
+
add_index :users, :expired_at
|
|
58
|
+
add_index :users, :approved
|
|
64
59
|
end
|
|
65
60
|
end
|
|
@@ -2,7 +2,6 @@ class CreatePatientsMasterIndex < ActiveRecord::Migration[5.2]
|
|
|
2
2
|
def change
|
|
3
3
|
create_table :patient_master_index do |t|
|
|
4
4
|
t.references :patient, null: true, foreign_key: true
|
|
5
|
-
t.timestamps null: false
|
|
6
5
|
t.string :nhs_number, index: true
|
|
7
6
|
t.string :hospital_number, index: true
|
|
8
7
|
t.string :title
|
|
@@ -2,7 +2,7 @@ class AddCodeToModalityDescriptions < ActiveRecord::Migration[5.2]
|
|
|
2
2
|
def change
|
|
3
3
|
within_renalware_schema do
|
|
4
4
|
add_column :modality_descriptions, :code, :string
|
|
5
|
-
add_index
|
|
5
|
+
add_index :modality_descriptions, :code, unique: true
|
|
6
6
|
end
|
|
7
7
|
end
|
|
8
8
|
end
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
class CreateAdmissionSpecialties < ActiveRecord::Migration[5.2]
|
|
2
|
+
def change
|
|
3
|
+
within_renalware_schema do
|
|
4
|
+
create_table :admission_specialties do |t|
|
|
5
|
+
t.string :name, null: false, index: { unique: true }
|
|
6
|
+
t.integer :position, null: false, default: 0
|
|
7
|
+
t.timestamps null: false
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
add_reference(
|
|
11
|
+
:admission_consults,
|
|
12
|
+
:specialty,
|
|
13
|
+
foreign_key: { to_table: :admission_specialties },
|
|
14
|
+
index: true,
|
|
15
|
+
null: true
|
|
16
|
+
)
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
@@ -16,8 +16,8 @@
|
|
|
16
16
|
"YSQ15",15,"Feeling depressed","^[0-4]$"
|
|
17
17
|
"YSQ16",16,"Changes in skin","^[0-4]$"
|
|
18
18
|
"YSQ17",17,"Diarrhoea","^[0-4]$"
|
|
19
|
-
"YSQ18",18,"
|
|
20
|
-
"YSQ19",19,"
|
|
21
|
-
"YSQ20",20,"
|
|
19
|
+
"YSQ18",18,"Symptom as entered by user","^[0-4]$"
|
|
20
|
+
"YSQ19",19,"Symptom as entered by user","^[0-4]$"
|
|
21
|
+
"YSQ20",20,"Symptom as entered by user","^[0-4]$"
|
|
22
22
|
"YSQ21",21,"Symptom that has affected the patient most",
|
|
23
23
|
"YSQ22",22,"Symptom that has improved the most",
|
|
@@ -68,7 +68,10 @@ module Renalware
|
|
|
68
68
|
end
|
|
69
69
|
config_accessor(:ukrdc_site_code) { ENV.fetch("UKRDC_PREFIX", "RJZ") }
|
|
70
70
|
config_accessor(:ukrdc_number_of_archived_folders_to_keep) do
|
|
71
|
-
ENV.fetch("UKRDC_NUMBER_OF_ARCHIVED_FOLDERS_TO_KEEP", "
|
|
71
|
+
ENV.fetch("UKRDC_NUMBER_OF_ARCHIVED_FOLDERS_TO_KEEP", "7")
|
|
72
|
+
end
|
|
73
|
+
config_accessor(:ukrdc_remove_stale_outgoing_files) do
|
|
74
|
+
ENV.fetch("UKRDC_REMOVE_STALE_OUTGOING_FILES", "true") == "true"
|
|
72
75
|
end
|
|
73
76
|
|
|
74
77
|
# To use a date other that the default changes_since date when
|
data/lib/renalware/version.rb
CHANGED
data/lib/tasks/spec.rake
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require "rspec/core/rake_task"
|
|
4
|
-
|
|
5
3
|
#
|
|
6
4
|
# These tasks run the turnip (migrated from cucumber) features.
|
|
7
5
|
#
|
|
8
6
|
namespace :spec do
|
|
9
7
|
namespace :acceptance do
|
|
10
|
-
|
|
8
|
+
ENV["RACK_ENV"] = ENV["RAILS_ENV"] = "test"
|
|
9
|
+
require "rspec/core/rake_task"
|
|
10
|
+
pattern = "./spec/acceptance/renalware/features/**/*.feature"
|
|
11
11
|
|
|
12
12
|
# domain features are those that do not exercise the UI
|
|
13
13
|
# Usage:
|
|
@@ -20,8 +20,8 @@ namespace :spec do
|
|
|
20
20
|
# Usage:
|
|
21
21
|
# bundle exec rake spec:acceptance:web
|
|
22
22
|
RSpec::Core::RakeTask.new(:web) do |t|
|
|
23
|
-
t.pattern = "spec/acceptance/features/**/*.feature"
|
|
24
|
-
t.rspec_opts = "--tag web" # targets features with the @web tag only
|
|
23
|
+
t.pattern = "./spec/acceptance/renalware/features/**/*.feature"
|
|
24
|
+
t.rspec_opts = "--tag web --require spec_helper" # targets features with the @web tag only
|
|
25
25
|
ENV["TURNIP_WEB"] = "1" # triggers inclusion of web_steps
|
|
26
26
|
end
|
|
27
27
|
|
data/lib/tasks/ukrdc.rake
CHANGED
|
@@ -32,12 +32,28 @@ namespace :ukrdc do
|
|
|
32
32
|
logger = ActiveSupport::TaggedLogging.new(Logger.new(STDOUT))
|
|
33
33
|
logger.level = Logger::INFO
|
|
34
34
|
Rails.logger = logger
|
|
35
|
+
|
|
36
|
+
PROFILE = nil
|
|
37
|
+
if PROFILE
|
|
38
|
+
require "ruby-prof"
|
|
39
|
+
RubyProf.start
|
|
40
|
+
end
|
|
35
41
|
# Renalware::UKRDC::TreatmentTimeline::GenerateTreatments.call
|
|
36
42
|
Renalware::UKRDC::CreateEncryptedPatientXMLFiles.new(
|
|
37
43
|
changed_since: ENV["changed_since"],
|
|
38
44
|
patient_ids: ENV.fetch("patient_ids", "").split(",").map(&:to_i),
|
|
39
45
|
force_send: ENV["force_send"] == "true"
|
|
40
46
|
).call
|
|
47
|
+
|
|
48
|
+
if PROFILE
|
|
49
|
+
result = RubyProf.stop
|
|
50
|
+
pretty = RubyProf::FlatPrinter.new(result)
|
|
51
|
+
pretty.print(STDOUT)
|
|
52
|
+
# printer.print(STDOUT, {})
|
|
53
|
+
# printer = RubyProf::GraphPrinter.new(result)
|
|
54
|
+
# printer = RubyProf::GraphHtmlPrinter.new(result)
|
|
55
|
+
# printer.print(STDOUT, min_percent: 5)
|
|
56
|
+
end
|
|
41
57
|
end
|
|
42
58
|
|
|
43
59
|
desc "Regenerates the ukrdc_treatments table ready for exporting to UKRDC in another task"
|
|
@@ -54,6 +70,7 @@ namespace :ukrdc do
|
|
|
54
70
|
Rails.logger = logger
|
|
55
71
|
logger.info "UKRDC housekeeping"
|
|
56
72
|
Renalware::UKRDC::Housekeeping::RemoveOldExportArchiveFolders.call
|
|
73
|
+
Renalware::UKRDC::Housekeeping::RemoveStaleFiles.call
|
|
57
74
|
end
|
|
58
75
|
|
|
59
76
|
task import: :environment do
|
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.132
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Airslie
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2020-01-
|
|
11
|
+
date: 2020-01-14 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: actionview-component
|
|
@@ -574,16 +574,16 @@ dependencies:
|
|
|
574
574
|
name: paper_trail
|
|
575
575
|
requirement: !ruby/object:Gem::Requirement
|
|
576
576
|
requirements:
|
|
577
|
-
- - "
|
|
577
|
+
- - ">="
|
|
578
578
|
- !ruby/object:Gem::Version
|
|
579
|
-
version:
|
|
579
|
+
version: '0'
|
|
580
580
|
type: :runtime
|
|
581
581
|
prerelease: false
|
|
582
582
|
version_requirements: !ruby/object:Gem::Requirement
|
|
583
583
|
requirements:
|
|
584
|
-
- - "
|
|
584
|
+
- - ">="
|
|
585
585
|
- !ruby/object:Gem::Version
|
|
586
|
-
version:
|
|
586
|
+
version: '0'
|
|
587
587
|
- !ruby/object:Gem::Dependency
|
|
588
588
|
name: paranoia
|
|
589
589
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -618,14 +618,14 @@ dependencies:
|
|
|
618
618
|
requirements:
|
|
619
619
|
- - "~>"
|
|
620
620
|
- !ruby/object:Gem::Version
|
|
621
|
-
version: 1.1
|
|
621
|
+
version: '1.1'
|
|
622
622
|
type: :runtime
|
|
623
623
|
prerelease: false
|
|
624
624
|
version_requirements: !ruby/object:Gem::Requirement
|
|
625
625
|
requirements:
|
|
626
626
|
- - "~>"
|
|
627
627
|
- !ruby/object:Gem::Version
|
|
628
|
-
version: 1.1
|
|
628
|
+
version: '1.1'
|
|
629
629
|
- !ruby/object:Gem::Dependency
|
|
630
630
|
name: prawn
|
|
631
631
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -668,6 +668,20 @@ dependencies:
|
|
|
668
668
|
- - "~>"
|
|
669
669
|
- !ruby/object:Gem::Version
|
|
670
670
|
version: 2.1.0
|
|
671
|
+
- !ruby/object:Gem::Dependency
|
|
672
|
+
name: rack
|
|
673
|
+
requirement: !ruby/object:Gem::Requirement
|
|
674
|
+
requirements:
|
|
675
|
+
- - "~>"
|
|
676
|
+
- !ruby/object:Gem::Version
|
|
677
|
+
version: 2.0.8
|
|
678
|
+
type: :runtime
|
|
679
|
+
prerelease: false
|
|
680
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
681
|
+
requirements:
|
|
682
|
+
- - "~>"
|
|
683
|
+
- !ruby/object:Gem::Version
|
|
684
|
+
version: 2.0.8
|
|
671
685
|
- !ruby/object:Gem::Dependency
|
|
672
686
|
name: rack-attack
|
|
673
687
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -686,14 +700,14 @@ dependencies:
|
|
|
686
700
|
name: rails
|
|
687
701
|
requirement: !ruby/object:Gem::Requirement
|
|
688
702
|
requirements:
|
|
689
|
-
- - "
|
|
703
|
+
- - ">="
|
|
690
704
|
- !ruby/object:Gem::Version
|
|
691
705
|
version: '5.2'
|
|
692
706
|
type: :runtime
|
|
693
707
|
prerelease: false
|
|
694
708
|
version_requirements: !ruby/object:Gem::Requirement
|
|
695
709
|
requirements:
|
|
696
|
-
- - "
|
|
710
|
+
- - ">="
|
|
697
711
|
- !ruby/object:Gem::Version
|
|
698
712
|
version: '5.2'
|
|
699
713
|
- !ruby/object:Gem::Dependency
|
|
@@ -1474,6 +1488,7 @@ files:
|
|
|
1474
1488
|
- app/models/renalware/admissions/consult_site.rb
|
|
1475
1489
|
- app/models/renalware/admissions/request.rb
|
|
1476
1490
|
- app/models/renalware/admissions/request_reason.rb
|
|
1491
|
+
- app/models/renalware/admissions/specialty.rb
|
|
1477
1492
|
- app/models/renalware/api.rb
|
|
1478
1493
|
- app/models/renalware/clinical.rb
|
|
1479
1494
|
- app/models/renalware/clinical/allergy.rb
|
|
@@ -1946,6 +1961,7 @@ files:
|
|
|
1946
1961
|
- app/models/renalware/ukrdc/export_summary.rb
|
|
1947
1962
|
- app/models/renalware/ukrdc/filename.rb
|
|
1948
1963
|
- app/models/renalware/ukrdc/housekeeping/remove_old_export_archive_folders.rb
|
|
1964
|
+
- app/models/renalware/ukrdc/housekeeping/remove_stale_files.rb
|
|
1949
1965
|
- app/models/renalware/ukrdc/incoming/file_list.rb
|
|
1950
1966
|
- app/models/renalware/ukrdc/incoming/import_survey.rb
|
|
1951
1967
|
- app/models/renalware/ukrdc/incoming/import_surveys.rb
|
|
@@ -2003,6 +2019,7 @@ files:
|
|
|
2003
2019
|
- app/models/renalware/ukrdc/treatment_timeline/transfer_out/generator.rb
|
|
2004
2020
|
- app/models/renalware/ukrdc/treatment_timeline/transplant/generator.rb
|
|
2005
2021
|
- app/models/renalware/ukrdc/xml_renderer.rb
|
|
2022
|
+
- app/models/renalware/ukrdc/xsd_schema.rb
|
|
2006
2023
|
- app/models/renalware/user.rb
|
|
2007
2024
|
- app/models/renalware/version.rb
|
|
2008
2025
|
- app/models/renalware/virology.rb
|
|
@@ -3766,6 +3783,8 @@ files:
|
|
|
3766
3783
|
- db/migrate/20191219145651_add_hidden_to_users.rb
|
|
3767
3784
|
- db/migrate/20200106073329_add_next_of_kin_to_patients.rb
|
|
3768
3785
|
- db/migrate/20200106210851_create_case_insensitive_index_on_patients.rb
|
|
3786
|
+
- db/migrate/20200110153522_add_ealert_to_admission_consults.rb
|
|
3787
|
+
- db/migrate/20200110160241_create_admission_specialties.rb
|
|
3769
3788
|
- db/seeds.rb
|
|
3770
3789
|
- db/seeds/default/accesses/access_pd_catheter_insertion_techniques.csv
|
|
3771
3790
|
- db/seeds/default/accesses/access_pd_catheter_insertion_techniques.rb
|
|
@@ -3975,6 +3994,7 @@ files:
|
|
|
3975
3994
|
- spec/factories/admissions/consults.rb
|
|
3976
3995
|
- spec/factories/admissions/request_reasons.rb
|
|
3977
3996
|
- spec/factories/admissions/requests.rb
|
|
3997
|
+
- spec/factories/admissions/specialties.rb
|
|
3978
3998
|
- spec/factories/clinical/allergies.rb
|
|
3979
3999
|
- spec/factories/clinical/body_compositions.rb
|
|
3980
4000
|
- spec/factories/clinical/dry_weights.rb
|
|
@@ -4181,7 +4201,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
4181
4201
|
- !ruby/object:Gem::Version
|
|
4182
4202
|
version: '0'
|
|
4183
4203
|
requirements: []
|
|
4184
|
-
rubygems_version: 3.
|
|
4204
|
+
rubygems_version: 3.1.2
|
|
4185
4205
|
signing_key:
|
|
4186
4206
|
specification_version: 4
|
|
4187
4207
|
summary: Renalware core functionality as a mountable engine.
|