renalware-core 2.0.0.pre.rc5 → 2.0.0.pre.rc6
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/assets/stylesheets/renalware/protocol_pdf.scss +26 -4
- data/app/controllers/renalware/base_controller.rb +1 -1
- data/app/controllers/renalware/patients/patients_controller.rb +3 -0
- data/app/jobs/renalware/letters/save_pdf_letter_to_file_job.rb +23 -0
- data/app/models/renalware/letters/part/clinical_observations.rb +34 -1
- data/app/models/renalware/pathology/all_observation_codes.rb +20 -0
- data/app/models/renalware/pathology/current_observation_set.rb +7 -1
- data/app/models/renalware/pathology/observations_jsonb_serializer.rb +5 -16
- data/app/models/renalware/patient.rb +4 -0
- data/app/presenters/renalware/hd/protocol_presenter.rb +5 -0
- data/app/presenters/renalware/patient_presenter.rb +14 -0
- data/app/views/renalware/api/ukrdc/patients/_clinic_visit_observation.xml.builder +2 -1
- data/app/views/renalware/api/ukrdc/patients/_documents.xml.builder +1 -1
- data/app/views/renalware/api/ukrdc/patients/_observations.xml.builder +7 -1
- data/app/views/renalware/api/ukrdc/patients/lab_orders/_result_item.xml.builder +10 -4
- data/app/views/renalware/hd/mdm/_audits.html.slim +3 -3
- data/app/views/renalware/hd/mdm/_sessions.html.slim +6 -5
- data/app/views/renalware/hd/protocols/_recent_pathology.html.slim +10 -0
- data/app/views/renalware/hd/protocols/show.pdf.slim +3 -1
- data/app/views/renalware/letters/parts/_clinical_observations.html.slim +5 -8
- data/app/views/renalware/patients/_side_menu.html.slim +2 -0
- data/app/views/renalware/patients/patients/_patient.html.slim +10 -0
- data/app/views/renalware/patients/patients/_table.html.slim +2 -0
- data/app/views/renalware/patients/patients/index.html.slim +1 -1
- data/app/views/renalware/patients/side_menu/_general.html.slim +0 -1
- data/app/views/renalware/patients/side_menu/_modalities.html.slim +1 -0
- data/app/views/renalware/patients/side_menu/_site_specific_actions.html.slim +1 -0
- data/app/views/renalware/patients/side_menu/_site_specific_links.html.slim +1 -0
- data/config/initializers/devise.rb +1 -1
- data/config/locales/loinc_codes.yml +10 -3
- data/config/locales/renalware/clinics/visit.yml +5 -3
- data/db/migrate/20180119121243_create_trigger_to_preprocess_hl7_msg.rb +50 -0
- data/db/seeds/default/letters/seeds.rb +2 -1
- data/lib/renalware/version.rb +1 -1
- metadata +8 -4
- data/db/seeds/default/letters/letterheads.csv +0 -4
- data/db/seeds/default/letters/letterheads.rb +0 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ce584cb7cbfefee7174f99e866b6a7955c12266f2fd6b0a60d86078dbf342ee2
|
4
|
+
data.tar.gz: 63261ae22a2fa334bb74777b0312ca3101a0cc38b45f964fd15ffaa82d62e7f6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e0f645e776c510e2b1f65c9b786b5838af19d350cc762d01ce6648f207881f6239ae131a10c980264cd123ed5ce6eaa0b1dcd13c2d0e62b2c6576df4feb32cc7
|
7
|
+
data.tar.gz: 0035ed970b1e8776a586398a8ad05e51373dff09467f833d6950f311eaf4e8508b63649849699e599b619c1fe4e689cb3334785ab91da31f1706bb677651ff02
|
@@ -76,15 +76,26 @@ h1 {
|
|
76
76
|
font-size: 1.1rem ;
|
77
77
|
|
78
78
|
&.protocol-hd-profile {
|
79
|
-
width:
|
79
|
+
width: 42%;
|
80
80
|
}
|
81
81
|
|
82
82
|
&.protocol-allergies {
|
83
|
-
width:
|
83
|
+
width: 18%;
|
84
|
+
|
85
|
+
.allergy_status_updated_at {
|
86
|
+
padding-left: 0.2rem;
|
87
|
+
font-weight: normal;
|
88
|
+
}
|
84
89
|
}
|
85
90
|
|
86
91
|
&.protocol-prescriptions {
|
87
|
-
width:
|
92
|
+
width: 25%;
|
93
|
+
}
|
94
|
+
|
95
|
+
&.protocol-recent-pathology {
|
96
|
+
width: 15%;
|
97
|
+
padding: 0;
|
98
|
+
padding-left: .3rem;
|
88
99
|
}
|
89
100
|
}
|
90
101
|
}
|
@@ -198,6 +209,17 @@ h1 {
|
|
198
209
|
}
|
199
210
|
}
|
200
211
|
|
212
|
+
table.recent-pathology {
|
213
|
+
text-align: left;
|
214
|
+
|
215
|
+
td, th {
|
216
|
+
padding-right: 0.2rem;
|
217
|
+
}
|
218
|
+
|
219
|
+
.result {
|
220
|
+
text-align: right;
|
221
|
+
}
|
222
|
+
}
|
201
223
|
|
202
224
|
dl {
|
203
225
|
padding-bottom: 0.2rem;
|
@@ -241,11 +263,11 @@ h1 {
|
|
241
263
|
}
|
242
264
|
|
243
265
|
.allergies {
|
244
|
-
|
245
266
|
.allergy_status {
|
246
267
|
font-weight: normal;
|
247
268
|
margin-right: 10px;
|
248
269
|
}
|
270
|
+
|
249
271
|
.allergy_descriptions {
|
250
272
|
font-weight: bold;
|
251
273
|
padding: 0;
|
@@ -7,9 +7,12 @@ module Renalware
|
|
7
7
|
include Renalware::Concerns::Pageable
|
8
8
|
|
9
9
|
def index
|
10
|
+
sort = params.dig(:q, :s)
|
11
|
+
patient_search.sorts = sort if sort
|
10
12
|
patients = patient_search.result.page(page).per(per_page)
|
11
13
|
authorize patients
|
12
14
|
render locals: {
|
15
|
+
search: patient_search,
|
13
16
|
patients: present(patients, PatientPresenter)
|
14
17
|
}
|
15
18
|
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require_dependency "renalware/letters"
|
2
|
+
require "fileutils"
|
3
|
+
|
4
|
+
module Renalware
|
5
|
+
module Letters
|
6
|
+
class SavePdfLetterToFileJob < ApplicationJob
|
7
|
+
def perform(letter:, file_path:)
|
8
|
+
file_path = Pathname(file_path)
|
9
|
+
create_folder_if_not_exists(file_path)
|
10
|
+
File.open(file_path, "wb") { |file| file << pdf_data_for(letter) }
|
11
|
+
end
|
12
|
+
|
13
|
+
def pdf_data_for(letter)
|
14
|
+
letter = Renalware::Letters::LetterPresenter.new(letter)
|
15
|
+
Renalware::Letters::PdfRenderer.call(letter)
|
16
|
+
end
|
17
|
+
|
18
|
+
def create_folder_if_not_exists(path)
|
19
|
+
FileUtils.mkdir_p(path.dirname)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -3,11 +3,44 @@ require "renalware/letters/part"
|
|
3
3
|
module Renalware
|
4
4
|
module Letters
|
5
5
|
class Part::ClinicalObservations < Part
|
6
|
-
|
6
|
+
include Renalware::AttributeNameHelper
|
7
|
+
OBSERVATION_ATTRS = %i(bp weight height bmi urine_blood urine_protein).freeze
|
8
|
+
OBSERVATION_UNITS = { weight: :kg, height: :m }.freeze
|
9
|
+
delegate(*OBSERVATION_ATTRS, to: :event)
|
10
|
+
delegate :any?, to: :observations
|
11
|
+
|
12
|
+
def each_observation
|
13
|
+
observations.each do |arr|
|
14
|
+
label, result, unit_of_measurement = arr
|
15
|
+
yield(label, result, unit_of_measurement)
|
16
|
+
end
|
17
|
+
end
|
7
18
|
|
8
19
|
def to_partial_path
|
9
20
|
"renalware/letters/parts/clinical_observations"
|
10
21
|
end
|
22
|
+
|
23
|
+
private
|
24
|
+
|
25
|
+
def observations
|
26
|
+
OBSERVATION_ATTRS.each_with_object([]) do |observation, arr|
|
27
|
+
value = send(observation)
|
28
|
+
next if value.blank?
|
29
|
+
arr << [
|
30
|
+
label_for(observation),
|
31
|
+
enum_text_or_raw_value_for(value),
|
32
|
+
OBSERVATION_UNITS[observation]
|
33
|
+
]
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
def label_for(observation)
|
38
|
+
attr_name(Renalware::Clinics::ClinicVisit, observation)
|
39
|
+
end
|
40
|
+
|
41
|
+
def enum_text_or_raw_value_for(value)
|
42
|
+
value.try(:text) || value
|
43
|
+
end
|
11
44
|
end
|
12
45
|
end
|
13
46
|
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require_dependency "renalware/pathology"
|
2
|
+
|
3
|
+
module Renalware
|
4
|
+
module Pathology
|
5
|
+
# A singleton exposing all defined OBX codes as an array of symbols
|
6
|
+
class AllObservationCodes
|
7
|
+
include Singleton
|
8
|
+
|
9
|
+
# Example usage:
|
10
|
+
# AllObservationCodes.include?(code)
|
11
|
+
def self.include?(code)
|
12
|
+
instance.all.include?(code)
|
13
|
+
end
|
14
|
+
|
15
|
+
def all
|
16
|
+
@all ||= ObservationDescription.order(:code).pluck(:code).map(&:upcase).map(&:to_sym)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -22,7 +22,9 @@ module Renalware
|
|
22
22
|
# When displaying or using a patient's current_observation_set the consuming code
|
23
23
|
# must filter out the codes it wants.
|
24
24
|
class CurrentObservationSet < ApplicationRecord
|
25
|
-
belongs_to :patient,
|
25
|
+
belongs_to :patient,
|
26
|
+
class_name: "Renalware::Pathology::Patient",
|
27
|
+
inverse_of: :current_observation_set
|
26
28
|
validates :patient, presence: true
|
27
29
|
serialize :values, ObservationsJsonbSerializer
|
28
30
|
|
@@ -30,6 +32,10 @@ module Renalware
|
|
30
32
|
codes = Array(codes)
|
31
33
|
values.select{ |code, _| codes.include?(code) }
|
32
34
|
end
|
35
|
+
|
36
|
+
def self.null_values_hash
|
37
|
+
HashWithIndifferentAccess.new.extend(ObservationSetMethods)
|
38
|
+
end
|
33
39
|
end
|
34
40
|
end
|
35
41
|
end
|
@@ -2,21 +2,6 @@ require_dependency "renalware/pathology"
|
|
2
2
|
|
3
3
|
module Renalware
|
4
4
|
module Pathology
|
5
|
-
# A singleton exposing all defined OBX codes as an array of symbols
|
6
|
-
class AllObservationCodes
|
7
|
-
include Singleton
|
8
|
-
|
9
|
-
# Example usage:
|
10
|
-
# AllObservationCodes.include?(code)
|
11
|
-
def self.include?(code)
|
12
|
-
instance.all.include?(code)
|
13
|
-
end
|
14
|
-
|
15
|
-
def all
|
16
|
-
@all ||= ObservationDescription.order(:code).pluck(:code).map(&:upcase).map(&:to_sym)
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
5
|
# We mix this module into any database-returned jsonb hash of observations
|
21
6
|
# (e.g. CurrentObservationSet.values and Letter.pathology_snapshot)
|
22
7
|
module ObservationSetMethods
|
@@ -26,7 +11,11 @@ module Renalware
|
|
26
11
|
# values.hgb_result # => 3.3
|
27
12
|
# values.hgb_observed_at # => "2017-17-01"
|
28
13
|
# So the values has methods corresponding to the entire set of possible
|
29
|
-
# OBX codes, and also methods to reach in and get their result and observed_at date
|
14
|
+
# OBX codes, and also methods to reach in and get their result and observed_at date.
|
15
|
+
#
|
16
|
+
# Note that if you get a missing method error for something like #hgb_result it means
|
17
|
+
# that HGB does not exist yet as an ObservationDescription so is not found in
|
18
|
+
# AllObservationCodes hence we can't respond to it.
|
30
19
|
# rubocop:disable Style/MethodMissing
|
31
20
|
def method_missing(method_name, *_args, &_block)
|
32
21
|
code, suffix = method_parts(method_name)
|
@@ -26,6 +26,10 @@ module Renalware
|
|
26
26
|
@secure_id_without_dashes ||= super&.gsub("-", "")
|
27
27
|
end
|
28
28
|
|
29
|
+
def secure_id_dashed
|
30
|
+
self[:secure_id]
|
31
|
+
end
|
32
|
+
|
29
33
|
enumerize :marital_status, in: %i(married single divorced widowed)
|
30
34
|
|
31
35
|
has_paper_trail class_name: "Renalware::Patients::Version"
|
@@ -45,6 +45,11 @@ module Renalware
|
|
45
45
|
::CollectionPresenter.new(prescriptions, ::Renalware::Medications::PrescriptionPresenter)
|
46
46
|
end
|
47
47
|
|
48
|
+
def recent_pathology
|
49
|
+
current_observation_set = Pathology.cast_patient(patient).current_observation_set
|
50
|
+
current_observation_set&.values || Pathology::CurrentObservationSet.null_values_hash
|
51
|
+
end
|
52
|
+
|
48
53
|
def patient_title
|
49
54
|
patient.to_s(:long)
|
50
55
|
end
|
@@ -16,5 +16,19 @@ module Renalware
|
|
16
16
|
return if super.index(" ")
|
17
17
|
"#{super[0..2]} #{super[3..5]} #{super[6..-1]}"
|
18
18
|
end
|
19
|
+
|
20
|
+
def rpv_decision
|
21
|
+
[
|
22
|
+
I18n.l(rpv_decision_on),
|
23
|
+
rpv_recorded_by
|
24
|
+
].compact.join(" by ")
|
25
|
+
end
|
26
|
+
|
27
|
+
def renalreg_decision
|
28
|
+
[
|
29
|
+
I18n.l(renalreg_decision_on),
|
30
|
+
renalreg_recorded_by
|
31
|
+
].compact.join(" by ")
|
32
|
+
end
|
19
33
|
end
|
20
34
|
end
|
@@ -5,7 +5,8 @@ xml.Observation do
|
|
5
5
|
xml.ObservationTime visit.datetime
|
6
6
|
|
7
7
|
xml.ObservationCode do
|
8
|
-
xml.CodingStandard "2.16.840.1.113883.4.642.2.115"
|
8
|
+
# xml.CodingStandard "2.16.840.1.113883.4.642.2.115"
|
9
|
+
xml.CodingStandard "LOCAL"
|
9
10
|
xml.Code I18n.t("loinc.#{i18n_key}.code")
|
10
11
|
xml.Description I18n.t("loinc.#{i18n_key}.description")
|
11
12
|
end
|
@@ -5,7 +5,6 @@
|
|
5
5
|
xml = builder
|
6
6
|
|
7
7
|
xml.Observations(start: Time.zone.today.iso8601, stop: Time.zone.today.iso8601) do
|
8
|
-
xml.comment! "Check what start and stop refer to here"
|
9
8
|
patient.clinic_visits.includes(:updated_by).each do |visit|
|
10
9
|
render "clinic_visit_observation",
|
11
10
|
visit: visit,
|
@@ -22,6 +21,13 @@ xml.Observations(start: Time.zone.today.iso8601, stop: Time.zone.today.iso8601)
|
|
22
21
|
render "clinic_visit_observation",
|
23
22
|
visit: visit,
|
24
23
|
method: :weight,
|
24
|
+
i18n_key: "weight",
|
25
|
+
builder: builder
|
26
|
+
|
27
|
+
render "clinic_visit_observation",
|
28
|
+
visit: visit,
|
29
|
+
method: :height,
|
30
|
+
i18n_key: "height",
|
25
31
|
builder: builder
|
26
32
|
end
|
27
33
|
end
|
@@ -3,14 +3,20 @@ observation = Renalware::Pathology::ObservationPresenter.new(observation)
|
|
3
3
|
observation = Renalware::UKRDC::PathologyObservationPresenter.new(observation)
|
4
4
|
|
5
5
|
xml.ResultItem do
|
6
|
+
# xml.ResultType
|
6
7
|
xml.EnteredOn observation.updated_at&.iso8601
|
7
|
-
xml.ObservationTime observation.observed_at&.iso8601
|
8
8
|
xml.PrePost observation.pre_post(patient_is_on_hd: patient.current_modality_hd?)
|
9
|
-
xml.ResultValue observation.result
|
10
|
-
xml.ResultValueUnits observation.measurement_unit_name
|
11
9
|
xml.ServiceId do
|
12
|
-
xml.Code observation.description_code
|
13
10
|
xml.CodingStandard "LOCAL"
|
11
|
+
xml.Code observation.description_code
|
14
12
|
xml.Description observation.description_name
|
15
13
|
end
|
14
|
+
# xml.SubId
|
15
|
+
xml.ResultValue observation.result
|
16
|
+
xml.ResultValueUnits observation.measurement_unit_name
|
17
|
+
# xml.AbnormalFlags
|
18
|
+
# xml.Status
|
19
|
+
xml.ObservationTime observation.observed_at&.iso8601
|
20
|
+
# xml.Comments
|
21
|
+
# xml.ReferenceComment
|
16
22
|
end
|
@@ -1,6 +1,7 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
1
|
+
article
|
2
|
+
header
|
3
|
+
h2= t(".title")
|
4
|
+
=link_to t(".view_all"),
|
5
|
+
patient_hd_sessions_path(mdm.patient),
|
6
|
+
class: "button left secondary"
|
6
7
|
= render "renalware/hd/sessions/table", sessions: mdm.sessions
|
@@ -0,0 +1,10 @@
|
|
1
|
+
table.recent-pathology
|
2
|
+
tbody
|
3
|
+
tr
|
4
|
+
th.code HGB
|
5
|
+
td.result= recent_pathology.hgb_result
|
6
|
+
td.observed_at= (l(recent_pathology.hgb_observed_at))
|
7
|
+
tr
|
8
|
+
th.code PLT
|
9
|
+
td.result= recent_pathology.plt_result
|
10
|
+
td.observed_at= (l(recent_pathology.plt_observed_at))
|
@@ -15,13 +15,15 @@
|
|
15
15
|
= clinical_patient.allergy_status&.text
|
16
16
|
- if clinical_patient.allergy_status_updated_at
|
17
17
|
span.allergy_status_updated_at
|
18
|
-
= "
|
18
|
+
= "#{l(clinical_patient.allergy_status_updated_at&.to_date)}"
|
19
19
|
th.protocol-prescriptions Prescriptions on HD
|
20
|
+
th.protocol-recent-pathology Recent Pathology
|
20
21
|
tbody
|
21
22
|
tr
|
22
23
|
td= render "profile", profile: protocol.profile
|
23
24
|
td= render "allergies", patient: protocol.patient
|
24
25
|
td= render "prescriptions", prescriptions: protocol.prescriptions
|
26
|
+
td= render "recent_pathology", recent_pathology: protocol.recent_pathology
|
25
27
|
|
26
28
|
.row.collapse
|
27
29
|
.small-12.columns
|
@@ -1,8 +1,5 @@
|
|
1
|
-
.
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
li= inline_value("BMI", clinical_observations.bmi)
|
7
|
-
li= inline_value("Urine Blood", clinical_observations.urine_blood&.text)
|
8
|
-
li= inline_value("Urine Protein", clinical_observations.urine_protein&.text)
|
1
|
+
- if clinical_observations.any?
|
2
|
+
.list.observations
|
3
|
+
ul.inline
|
4
|
+
- clinical_observations.each_observation do |label, value, unit_of_measurement|
|
5
|
+
li= inline_value(label, value, unit_of_measurement)
|
@@ -1,5 +1,7 @@
|
|
1
1
|
ul.side-nav
|
2
2
|
= render "renalware/patients/side_menu/general", patient: patient
|
3
|
+
= render "renalware/patients/side_menu/site_specific_links", patient: patient
|
3
4
|
= render "renalware/patients/side_menu/modalities", patient: patient
|
4
5
|
= render "renalware/patients/side_menu/transplants", patient: patient
|
5
6
|
= render "renalware/patients/side_menu/actions", patient: patient
|
7
|
+
= render "renalware/patients/side_menu/site_specific_actions", patient: patient
|
@@ -6,4 +6,14 @@ tr
|
|
6
6
|
td= patient.sex.code
|
7
7
|
td= patient.born_on
|
8
8
|
td= patient.age
|
9
|
+
- if(patient.send_to_rpv?)
|
10
|
+
td(title="#{patient.rpv_decision}")
|
11
|
+
i.fa.fa-check
|
12
|
+
-else
|
13
|
+
td
|
14
|
+
- if(patient.send_to_renalreg?)
|
15
|
+
td(title="#{patient.renalreg_decision}")
|
16
|
+
i.fa.fa-check
|
17
|
+
-else
|
18
|
+
td
|
9
19
|
td= patient.current_modality
|
@@ -8,6 +8,8 @@ table#patients
|
|
8
8
|
th.col-width-tiny= attr_name(Renalware::Patient, :sex)
|
9
9
|
th.col-width-date= attr_name(Renalware::Patient, :born_on)
|
10
10
|
th.col-width-tiny= attr_name(Renalware::Patient, :age)
|
11
|
+
th.col-width-tiny= sort_link(search, :send_to_rpv, "RPV")
|
12
|
+
th.col-width-tiny= sort_link(search, :send_to_renalreg, "RReg")
|
11
13
|
th.col-width-small Modality
|
12
14
|
|
13
15
|
tbody
|
@@ -0,0 +1 @@
|
|
1
|
+
/ Override this template in the host rails application to add actions specific to the hospital
|
@@ -0,0 +1 @@
|
|
1
|
+
/ Override this template in the host rails application to add links specific to the hospital
|
@@ -11,7 +11,7 @@ Devise.setup do |config|
|
|
11
11
|
# Configure the e-mail address which will be shown in Devise::Mailer,
|
12
12
|
# note that it will be overwritten if you use your own mailer class
|
13
13
|
# with default "from" parameter.
|
14
|
-
config.mailer_sender =
|
14
|
+
config.mailer_sender = Renalware.config.default_from_email_address
|
15
15
|
|
16
16
|
config.parent_controller = "ApplicationController"
|
17
17
|
config.router_name = :renalware
|
@@ -2,15 +2,22 @@ en:
|
|
2
2
|
loinc:
|
3
3
|
blood_pressure:
|
4
4
|
systolic:
|
5
|
-
code: 76538-8
|
5
|
+
# code: 76538-8
|
6
|
+
code: bpsys
|
6
7
|
description: Blood pressure device Cuff pressure.systolic
|
7
8
|
units: "mmHg"
|
8
9
|
diastolic:
|
9
|
-
code: 76539-6
|
10
|
+
# code: 76539-6
|
11
|
+
code: bpdia
|
10
12
|
description: Blood pressure device Cuff pressure.systolic
|
11
13
|
units: "mmHg"
|
12
14
|
weight:
|
13
|
-
code: 3141-9
|
15
|
+
# code: 3141-9
|
16
|
+
code: weight
|
14
17
|
description: Body weight Measured
|
15
18
|
units: "Kg"
|
19
|
+
height:
|
20
|
+
code: height
|
21
|
+
description: Height Measured
|
22
|
+
units: "m"
|
16
23
|
|
@@ -7,9 +7,11 @@ en:
|
|
7
7
|
activerecord:
|
8
8
|
attributes:
|
9
9
|
renalware/clinics/clinic_visit:
|
10
|
-
bp:
|
11
|
-
standing_bp:
|
12
|
-
bmi:
|
10
|
+
bp: BP
|
11
|
+
standing_bp: Standing BP
|
12
|
+
bmi: BMI
|
13
|
+
urine_blood: Urine Blood
|
14
|
+
urine_protein: Urine Protein
|
13
15
|
errors:
|
14
16
|
models:
|
15
17
|
renalware/clinics/clinic_visit:
|
@@ -0,0 +1,50 @@
|
|
1
|
+
class CreateTriggerToPreprocessHL7Msg < ActiveRecord::Migration[5.1]
|
2
|
+
def up
|
3
|
+
sql = <<-SQL
|
4
|
+
/* Create a function for the trigger to call */
|
5
|
+
CREATE FUNCTION preprocess_hl7_message() RETURNS trigger AS
|
6
|
+
$body$
|
7
|
+
BEGIN
|
8
|
+
/*
|
9
|
+
Mirth inserts a row into delayed job when a new HL7 message needs to be processed by Renalware.
|
10
|
+
The SQL it uses looks like this:
|
11
|
+
insert into renalware.delayed_jobs (handler, run_at)
|
12
|
+
values(E'--- !ruby/struct:FeedJob\nraw_message: |\n ' || REPLACE(${message.rawData},E'\r',E'\n '), NOW());
|
13
|
+
This works unless there is a 10^12 value in the unit of measurement segment for an OBX (e.g.
|
14
|
+
for WBC or HGB). Then Mirth encodes the ^ as \S\ because ^ is a significant character in Mirth
|
15
|
+
(field separator). Unfortunately this creates the combination
|
16
|
+
10\S\12 and S\12 is converted to \n when the handler's payload is loaded in by the delayed_job worker.
|
17
|
+
To get around this we need to convert instances of \S\ with another escape sequence eg «
|
18
|
+
and manually map this back to a ^ in the job handler ruby code.
|
19
|
+
|
20
|
+
So here, if this delayed_job is destinated to be picked up by a Feed job handler
|
21
|
+
make sure we convert the Mirth escape sequence \S\ to \\S\\
|
22
|
+
*/
|
23
|
+
IF position('Feed' in NEW.handler) > 0 THEN
|
24
|
+
NEW.handler = replace(NEW.handler, '\S\', '\\S\\');
|
25
|
+
END IF;
|
26
|
+
|
27
|
+
RETURN NEW;
|
28
|
+
END
|
29
|
+
|
30
|
+
$body$
|
31
|
+
LANGUAGE plpgsql;
|
32
|
+
|
33
|
+
/* Create the trigger! */
|
34
|
+
CREATE TRIGGER feed_messages_preprocessing_trigger
|
35
|
+
BEFORE INSERT
|
36
|
+
ON delayed_jobs
|
37
|
+
FOR EACH ROW
|
38
|
+
EXECUTE PROCEDURE preprocess_hl7_message();
|
39
|
+
SQL
|
40
|
+
|
41
|
+
connection.execute(sql)
|
42
|
+
end
|
43
|
+
|
44
|
+
def down
|
45
|
+
connection.execute("
|
46
|
+
drop trigger if exists feed_messages_preprocessing_trigger on delayed_jobs;
|
47
|
+
drop function if exists preprocess_hl7_message();"
|
48
|
+
)
|
49
|
+
end
|
50
|
+
end
|
@@ -1 +1,2 @@
|
|
1
|
-
|
1
|
+
# Empty for now - letters seeds are all app-specific. See spec/dummy/db/seeds/letters
|
2
|
+
# for examples.
|
data/lib/renalware/version.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.0.pre.
|
4
|
+
version: 2.0.0.pre.rc6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Airslie
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-01-
|
11
|
+
date: 2018-01-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -1238,6 +1238,7 @@ files:
|
|
1238
1238
|
- app/jobs/renalware/hd/generate_monthly_statistics_for_patient_job.rb
|
1239
1239
|
- app/jobs/renalware/hd/generate_monthly_statistics_job.rb
|
1240
1240
|
- app/jobs/renalware/hd/update_rolling_patient_statistics_job.rb
|
1241
|
+
- app/jobs/renalware/letters/save_pdf_letter_to_file_job.rb
|
1241
1242
|
- app/jobs/renalware/reporting/refresh_audit_data_job.rb
|
1242
1243
|
- app/mailers/renalware/admin/user_mailer.rb
|
1243
1244
|
- app/mailers/renalware/letters/delivery/errors.rb
|
@@ -1488,6 +1489,7 @@ files:
|
|
1488
1489
|
- app/models/renalware/modalities/pd_to_haemodialysis.rb
|
1489
1490
|
- app/models/renalware/modalities/reason.rb
|
1490
1491
|
- app/models/renalware/pathology.rb
|
1492
|
+
- app/models/renalware/pathology/all_observation_codes.rb
|
1491
1493
|
- app/models/renalware/pathology/clinic.rb
|
1492
1494
|
- app/models/renalware/pathology/consultant.rb
|
1493
1495
|
- app/models/renalware/pathology/create_observations.rb
|
@@ -2082,6 +2084,7 @@ files:
|
|
2082
2084
|
- app/views/renalware/hd/protocols/_allergies.html.slim
|
2083
2085
|
- app/views/renalware/hd/protocols/_prescriptions.html.slim
|
2084
2086
|
- app/views/renalware/hd/protocols/_profile.html.slim
|
2087
|
+
- app/views/renalware/hd/protocols/_recent_pathology.html.slim
|
2085
2088
|
- app/views/renalware/hd/protocols/show.pdf.slim
|
2086
2089
|
- app/views/renalware/hd/sessions/_empty_row.html.slim
|
2087
2090
|
- app/views/renalware/hd/sessions/_form.html.slim
|
@@ -2345,6 +2348,8 @@ files:
|
|
2345
2348
|
- app/views/renalware/patients/side_menu/_general.html.slim
|
2346
2349
|
- app/views/renalware/patients/side_menu/_modalities.html.slim
|
2347
2350
|
- app/views/renalware/patients/side_menu/_options.html.slim.redundant
|
2351
|
+
- app/views/renalware/patients/side_menu/_site_specific_actions.html.slim
|
2352
|
+
- app/views/renalware/patients/side_menu/_site_specific_links.html.slim
|
2348
2353
|
- app/views/renalware/patients/side_menu/_transplants.html.slim
|
2349
2354
|
- app/views/renalware/patients/worries/_delete.html.slim
|
2350
2355
|
- app/views/renalware/patients/worries/_new.html.slim
|
@@ -3049,6 +3054,7 @@ files:
|
|
3049
3054
|
- db/migrate/20180108185400_remove_null_constraint_from_letters_pathology_snapshot.rb
|
3050
3055
|
- db/migrate/20180112151706_create_low_clearance_profiles.rb
|
3051
3056
|
- db/migrate/20180112151813_create_low_clearance_versions.rb
|
3057
|
+
- db/migrate/20180119121243_create_trigger_to_preprocess_hl7_msg.rb
|
3052
3058
|
- db/seeds.rb
|
3053
3059
|
- db/seeds/default/accesses/access_pd_catheter_insertion_techniques.csv
|
3054
3060
|
- db/seeds/default/accesses/access_pd_catheter_insertion_techniques.rb
|
@@ -3077,8 +3083,6 @@ files:
|
|
3077
3083
|
- db/seeds/default/hd/dialysers.rb
|
3078
3084
|
- db/seeds/default/hd/seeds.rb
|
3079
3085
|
- db/seeds/default/housekeeping.rb
|
3080
|
-
- db/seeds/default/letters/letterheads.csv
|
3081
|
-
- db/seeds/default/letters/letterheads.rb
|
3082
3086
|
- db/seeds/default/letters/seeds.rb
|
3083
3087
|
- db/seeds/default/medications/medication_routes.rb
|
3084
3088
|
- db/seeds/default/medications/seeds.rb
|
@@ -1,4 +0,0 @@
|
|
1
|
-
"site_code","unit_info","trust_name","trust_caption","site_info"
|
2
|
-
"MRH","THE RENAL UNIT","Mount Royal Hospital","NHS Foundation Trust","<p>Renal Administration<br>Mount Royal Hospital<br>Ave Mont Royal<br>Montreal H99 9Z9<br><b>Appointments</b>: 099 9999 6244<br><b>Fax</b>: 099 9999 6472<br><b>Switchboard</b>: 099 9999 9000<br><b>GP Email Advice</b>: mountroyal.renal@nhx.xyz</p>"
|
3
|
-
"PEEL","NEPHROLOGY OUTREACH CLINIC","Peel District Hospital","NHS Trust","<p><Dr Lily Sinclair · Dr Thomas Devoe<br>Dr David Monroe · Dr Marta Shearing<br><br>Peel District Hospital<br>Peel Street<br>Montreal H88 8Z8<br>Tel: 088 428417<br>Fax: 088 428415<br>www.peelhosp.nhs.xyz</p>"
|
4
|
-
"FAIR","NEPHROLOGY OUTREACH CLINIC","Fairmount Hospital","NHS Trust","<p>Dr Marta Shearing · Dr Michael Clayton<br>Dr Kathryn Bolkovac · Dr Basher Tarr</b><br><br>Fairmount Hospital<br>Rue Fairmount<br>Montreal H33 3Z3<br><b>Direct Telephone</b>: 033 836 6000<br><b>Fax Number</b>: 033 836 4444<br><b>GP Email Advice</b>: fairmount.renal@nhx.xyz<br><b>www.fairmounthosp.nhs.uk</b></p>"
|
@@ -1,17 +0,0 @@
|
|
1
|
-
module Renalware
|
2
|
-
log "Adding Letterheads" do
|
3
|
-
|
4
|
-
file_path = File.join(File.dirname(__FILE__), "letterheads.csv")
|
5
|
-
|
6
|
-
CSV.foreach(file_path, headers: true) do |row|
|
7
|
-
name = "(#{row["site_code"]}) #{row["unit_info"]}"
|
8
|
-
letterhead = Letters::Letterhead.find_or_initialize_by(name: name)
|
9
|
-
letterhead.site_code = row["site_code"]
|
10
|
-
letterhead.unit_info = row["unit_info"]
|
11
|
-
letterhead.trust_name = row["trust_name"]
|
12
|
-
letterhead.trust_caption = row["trust_caption"]
|
13
|
-
letterhead.site_info = row["site_info"]
|
14
|
-
letterhead.save!
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|