renalware-core 2.0.41 → 2.0.42
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/javascripts/renalware/aki_alerts.js +27 -0
- data/app/assets/javascripts/renalware/application.js.erb +1 -1
- data/app/assets/javascripts/renalware/behaviours.js +5 -0
- data/app/assets/stylesheets/renalware/modules/_hd.scss +9 -0
- data/app/assets/stylesheets/renalware/partials/_button.scss +4 -0
- data/app/assets/stylesheets/renalware/partials/_tables.scss +6 -0
- data/app/controllers/renalware/events/events_controller.rb +3 -15
- data/app/controllers/renalware/hd/transmission_logs_controller.rb +32 -0
- data/app/controllers/renalware/renal/aki_alerts_controller.rb +2 -2
- data/app/controllers/renalware/research/study_participants_controller.rb +5 -0
- data/app/documents/renalware/hd/session_document.rb +13 -0
- data/app/jobs/feed_job.rb +4 -1
- data/app/models/concerns/renalware/patients_ransack_helper.rb +4 -0
- data/app/models/renalware/events/event_query.rb +0 -1
- data/app/models/renalware/feeds/message_processor.rb +30 -6
- data/app/models/renalware/feeds/persist_message.rb +7 -6
- data/app/models/renalware/hd/provider.rb +12 -0
- data/app/models/renalware/hd/provider_unit.rb +15 -0
- data/app/models/renalware/hd/transmission_log.rb +26 -0
- data/app/models/renalware/letters/letter/pending_review.rb +8 -1
- data/app/models/renalware/medications/prescriptions_by_drug_type_query.rb +0 -1
- data/app/models/renalware/pathology/message_listener.rb +7 -7
- data/app/models/renalware/pathology/observation_requests_attributes_builder.rb +5 -5
- data/app/models/renalware/pathology/observations_jsonb_serializer.rb +0 -1
- data/app/models/renalware/patients/message_param_parser.rb +2 -2
- data/app/models/renalware/patients/patient_search.rb +2 -2
- data/app/models/renalware/renal/aki_alert.rb +4 -0
- data/app/models/renalware/renal/aki_alert_query.rb +0 -1
- data/app/models/renalware/renal/aki_alert_search_form.rb +2 -2
- data/app/models/renalware/renal.rb +0 -2
- data/app/views/renalware/hd/transmission_logs/index.html.slim +42 -0
- data/app/views/renalware/medications/drug_types/prescriptions/_filters.html.slim +1 -3
- data/app/views/renalware/navigation/_admin.html.slim +1 -2
- data/app/views/renalware/navigation/_renal.html.slim +1 -1
- data/app/views/renalware/navigation/_super_admin.html.slim +2 -0
- data/app/views/renalware/renal/aki_alerts/_aki_alert.html.slim +1 -3
- data/app/views/renalware/renal/aki_alerts/_filters.html.slim +35 -15
- data/app/views/renalware/renal/aki_alerts/_filters.pdf.slim +4 -1
- data/app/views/renalware/renal/aki_alerts/edit.html.slim +2 -2
- data/app/views/renalware/renal/aki_alerts/index.html.slim +1 -1
- data/app/views/renalware/renal/aki_alerts/index.pdf.slim +0 -5
- data/config/initializers/ransack.rb +15 -1
- data/config/permissions.yml +3 -0
- data/config/routes.rb +2 -4
- data/db/migrate/20151116170200_create_transplant_versions.rb +3 -3
- data/db/migrate/20180622130552_add_external_id_to_hd_sessions.rb +6 -0
- data/db/migrate/20180625124431_add_patient_identifier_to_feed_messages.rb +7 -0
- data/db/migrate/20180702091222_create_hd_providers.rb +8 -0
- data/db/migrate/20180702091237_create_hd_provider_units.rb +11 -0
- data/db/migrate/20180702091352_create_hd_transmission_log.rb +18 -0
- data/db/migrate/20180730154454_add_external_session_id_to_hd_transmission_logs.rb +9 -0
- data/db/migrate/20180802132417_add_missing_indexes_2.rb +18 -0
- data/db/migrate/20180802144507_add_missing_foreign_key_indexes.rb +17 -0
- data/db/migrate/20180803131157_add_uuid_to_hd_transmission_logs.rb +5 -0
- data/db/migrate/20180814103916_create_index_on_lower_patient_family_name.rb +7 -0
- data/db/migrate/20180815144429_update_hd_overall_audit_to_version_8.rb +6 -0
- data/db/views/reporting_hd_overall_audit_v08.sql +46 -0
- data/lib/renalware/version.rb +1 -1
- data/lib/tasks/db.rake +13 -0
- data/lib/tasks/pathology.rake +29 -0
- data/spec/factories/hd/transmission_logs.rb +15 -0
- data/spec/support/capybara.rb +16 -15
- data/vendor/assets/javascripts/renalware/moment.min.js +1 -0
- metadata +25 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: cc71457e0667a1542f20348ec2d9a18f4c63771991d5ec1a04567d4c00998945
|
|
4
|
+
data.tar.gz: 3d125ec394cf34ae6fe52a7e31a1383e3a37e423ede66a73630677aecf7de36f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 7eff31ea5c1a1386c1a6b54004a8ea39822972febf28e2f15860f8d073ee7183028670d5c7ba78f65e2e68c8126c78790917bde0eefc5e37b462af28c977ca7e
|
|
7
|
+
data.tar.gz: c6fead2c420a33575453a89415ea5ec9fe2ce478797ac971b7ab4336f84ad797b9aedbe078dcdf0b76a29405a8991f3f58fd7f265a5cc1c27d8b97b60353fdb9
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
var Renalware = typeof Renalware === 'undefined' ? {} : Renalware;
|
|
2
|
+
|
|
3
|
+
Renalware.AkiAlerts = (function () {
|
|
4
|
+
|
|
5
|
+
var wireUpSetFilterDateToToday = function() {
|
|
6
|
+
$(document).on( "click", "a.set_filter_date_to_today", function(e) {
|
|
7
|
+
e.preventDefault();
|
|
8
|
+
$("#q_date").val(moment().format("DD-MMM-YYYY"))
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
var wireUpSetFilterDateAnyDate = function() {
|
|
13
|
+
$(document).on( "click", "a.set_filter_date_to_any_date", function(e) {
|
|
14
|
+
e.preventDefault();
|
|
15
|
+
$("#q_date").val("")
|
|
16
|
+
});
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
return {
|
|
20
|
+
init : function() {
|
|
21
|
+
wireUpSetFilterDateToToday();
|
|
22
|
+
wireUpSetFilterDateAnyDate();
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
})();
|
|
26
|
+
|
|
27
|
+
$(document).ready(Renalware.AkiAlerts.init);
|
|
@@ -45,6 +45,7 @@
|
|
|
45
45
|
//= require rails.validations
|
|
46
46
|
//= require rails.validations.simple_form
|
|
47
47
|
//= require renalware/print.min
|
|
48
|
+
//= require renalware/moment.min
|
|
48
49
|
//= require_tree .
|
|
49
50
|
//
|
|
50
51
|
|
|
@@ -55,4 +56,3 @@ window.console = window.console || { log: function() {} };
|
|
|
55
56
|
<% if Rails.env.test? %>
|
|
56
57
|
$.fx.off = true;
|
|
57
58
|
<% end %>
|
|
58
|
-
|
|
@@ -36,7 +36,7 @@ module Renalware
|
|
|
36
36
|
|
|
37
37
|
def index
|
|
38
38
|
events_query = EventQuery.new(patient: patient, query: query_params)
|
|
39
|
-
events = events_query.call
|
|
39
|
+
events = events_query.call.page(page).per(per_page)
|
|
40
40
|
authorize events
|
|
41
41
|
events = EventsPresenter.new(patient, events)
|
|
42
42
|
|
|
@@ -93,15 +93,6 @@ module Renalware
|
|
|
93
93
|
|
|
94
94
|
private
|
|
95
95
|
|
|
96
|
-
def events
|
|
97
|
-
@events ||= Event.for_patient(patient)
|
|
98
|
-
.includes(:event_type)
|
|
99
|
-
.includes(:created_by)
|
|
100
|
-
.page(page)
|
|
101
|
-
.per(per_page)
|
|
102
|
-
.ordered
|
|
103
|
-
end
|
|
104
|
-
|
|
105
96
|
def disable_selection_of_event_type?
|
|
106
97
|
event_type_slug.present? && event_type.present?
|
|
107
98
|
end
|
|
@@ -145,8 +136,7 @@ module Renalware
|
|
|
145
136
|
end
|
|
146
137
|
|
|
147
138
|
def document_attributes
|
|
148
|
-
params.require(:events_event)
|
|
149
|
-
.fetch(:document, nil).try(:permit!)
|
|
139
|
+
params.require(:events_event).fetch(:document, nil).try(:permit!)
|
|
150
140
|
end
|
|
151
141
|
|
|
152
142
|
def new_event_for_patient(params = {})
|
|
@@ -176,9 +166,7 @@ module Renalware
|
|
|
176
166
|
end
|
|
177
167
|
|
|
178
168
|
def query_params
|
|
179
|
-
params
|
|
180
|
-
.fetch(:q, {})
|
|
181
|
-
.merge(page: page, per_page: per_page || 20)
|
|
169
|
+
params.fetch(:q, {})
|
|
182
170
|
end
|
|
183
171
|
end
|
|
184
172
|
end
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_dependency "renalware/hd/base_controller"
|
|
4
|
+
require "collection_presenter"
|
|
5
|
+
|
|
6
|
+
module Renalware
|
|
7
|
+
module HD
|
|
8
|
+
class TransmissionLogsController < BaseController
|
|
9
|
+
include PresenterHelper
|
|
10
|
+
include Renalware::Concerns::Pageable
|
|
11
|
+
|
|
12
|
+
# NB be sure not to select the payload as this will slow things down.
|
|
13
|
+
# The payload is loaded by clicking on a link in the table
|
|
14
|
+
def index
|
|
15
|
+
logs = TransmissionLog
|
|
16
|
+
.order(created_at: :desc)
|
|
17
|
+
.select(TransmissionLog.attribute_names - [:payload])
|
|
18
|
+
.page(page).per(per_page)
|
|
19
|
+
authorize logs
|
|
20
|
+
render locals: { logs: logs }
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def show
|
|
24
|
+
log = TransmissionLog.find(params[:id])
|
|
25
|
+
authorize log
|
|
26
|
+
respond_to do |format|
|
|
27
|
+
format.xml { render xml: log.payload }
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
@@ -27,7 +27,7 @@ module Renalware
|
|
|
27
27
|
def update
|
|
28
28
|
authorize alert
|
|
29
29
|
if alert.update(aki_alert_params.merge(by: current_user))
|
|
30
|
-
redirect_to
|
|
30
|
+
redirect_to renal_aki_alerts_path(named_filter: :today)
|
|
31
31
|
else
|
|
32
32
|
render_edit(alert)
|
|
33
33
|
end
|
|
@@ -85,7 +85,7 @@ module Renalware
|
|
|
85
85
|
def search_params
|
|
86
86
|
params
|
|
87
87
|
.require(:q) {}
|
|
88
|
-
.permit(:term, :on_hotlist, :action, :hospital_unit_id, :hospital_ward_id, :s)
|
|
88
|
+
.permit(:date, :term, :on_hotlist, :action, :hospital_unit_id, :hospital_ward_id, :s)
|
|
89
89
|
end
|
|
90
90
|
|
|
91
91
|
def path_params
|
|
@@ -12,6 +12,11 @@ module Renalware
|
|
|
12
12
|
render locals: { study: study, participants: participants }
|
|
13
13
|
end
|
|
14
14
|
|
|
15
|
+
def show
|
|
16
|
+
authorize StudyParticipant, :show?
|
|
17
|
+
redirect_to research_study_participants_path(study)
|
|
18
|
+
end
|
|
19
|
+
|
|
15
20
|
def create
|
|
16
21
|
participant = study.participants.build(participant_params)
|
|
17
22
|
participant.joined_on ||= Time.zone.today
|
|
@@ -113,6 +113,19 @@ module Renalware
|
|
|
113
113
|
attribute :had_blood_transfusion, Document::Enum, enums: %i(yes no), default: :no
|
|
114
114
|
end
|
|
115
115
|
attribute :complications, Complications
|
|
116
|
+
|
|
117
|
+
# rubocop:disable Metrics/AbcSize
|
|
118
|
+
def error_messages
|
|
119
|
+
[
|
|
120
|
+
observations_before.errors.full_messages,
|
|
121
|
+
observations_after.errors.full_messages,
|
|
122
|
+
dialysis.errors.full_messages,
|
|
123
|
+
info.errors.full_messages,
|
|
124
|
+
complications.errors.full_messages,
|
|
125
|
+
hdf.errors.full_messages
|
|
126
|
+
].flatten.compact
|
|
127
|
+
end
|
|
128
|
+
# rubocop:enable Metrics/AbcSize
|
|
116
129
|
end
|
|
117
130
|
end
|
|
118
131
|
end
|
data/app/jobs/feed_job.rb
CHANGED
|
@@ -8,14 +8,38 @@ module Renalware
|
|
|
8
8
|
# Responsible for coordinating the processing sequences of a raw HL7 message.
|
|
9
9
|
#
|
|
10
10
|
class MessageProcessor
|
|
11
|
+
include Broadcasting
|
|
12
|
+
|
|
13
|
+
# For SubscriptionRegistry only, may not be needed as also inc in Broadcasting module
|
|
11
14
|
include Wisper::Publisher
|
|
12
15
|
|
|
13
16
|
def call(raw_message)
|
|
17
|
+
broadcast_args = nil
|
|
18
|
+
|
|
19
|
+
# We want to wrap message processing in a transaction because if message processing
|
|
20
|
+
# fails we don't want to leave an unprocessed message in the feed_messages table.
|
|
21
|
+
# If we did, and the same FeedJob retires a few minutes later, if will try to save to
|
|
22
|
+
# feed_messages with the same MD5 body_hash (the message is identical to one already saved)
|
|
23
|
+
# resulting in unique key violation.
|
|
24
|
+
# Using a transaction here prevents any orphaned records if there is an error.
|
|
25
|
+
# However we should be aware that any listeners raising an error will prevent successful
|
|
26
|
+
# in all other listeners. So a listener should be careful to catch errors and not re-raise
|
|
27
|
+
# them, or use the :message_processed message (lower down) which is safer.
|
|
14
28
|
ActiveRecord::Base.transaction do
|
|
15
|
-
|
|
16
|
-
persist_message(
|
|
17
|
-
|
|
29
|
+
hl7_message = build_hl7_object_from(raw_message)
|
|
30
|
+
feed_message = persist_message(hl7_message)
|
|
31
|
+
broadcast_args = { hl7_message: hl7_message, feed_message: feed_message }
|
|
32
|
+
broadcast(:message_arrived, broadcast_args)
|
|
18
33
|
end
|
|
34
|
+
|
|
35
|
+
# Another event, this one letting anyone interested know that a message been successfully
|
|
36
|
+
# processed. They might want to forward the message on somewhere else for instance.
|
|
37
|
+
# Think Diaverum.
|
|
38
|
+
# The crucial difference here is that an exception raised by a listener does not prevent the
|
|
39
|
+
# main processing of the HL7 message from being rolled back.
|
|
40
|
+
# They could use this for message processing but we'd rather it was used for post-processing
|
|
41
|
+
# e.g. forwarding, logging etc.
|
|
42
|
+
broadcast(:message_processed, broadcast_args)
|
|
19
43
|
rescue StandardError => exception
|
|
20
44
|
notify_exception(exception)
|
|
21
45
|
raise exception
|
|
@@ -23,7 +47,7 @@ module Renalware
|
|
|
23
47
|
|
|
24
48
|
private
|
|
25
49
|
|
|
26
|
-
def
|
|
50
|
+
def build_hl7_object_from(raw_message)
|
|
27
51
|
MessageParser.new.parse(raw_message)
|
|
28
52
|
end
|
|
29
53
|
|
|
@@ -32,8 +56,8 @@ module Renalware
|
|
|
32
56
|
# same message payload is saved twice - in this case we exit #call early, the broadcast
|
|
33
57
|
# is not issued and therefore the message is not processed. The message will go back into
|
|
34
58
|
# the delayed_job queue and retry, failing until it finally gives up!
|
|
35
|
-
def persist_message(
|
|
36
|
-
PersistMessage.new.call(
|
|
59
|
+
def persist_message(hl7_message)
|
|
60
|
+
PersistMessage.new.call(hl7_message)
|
|
37
61
|
end
|
|
38
62
|
|
|
39
63
|
def notify_exception(exception)
|
|
@@ -5,15 +5,16 @@ require_dependency "renalware/feeds"
|
|
|
5
5
|
module Renalware
|
|
6
6
|
module Feeds
|
|
7
7
|
class PersistMessage
|
|
8
|
-
#
|
|
8
|
+
# hl7_message is an HL7Message (a decorator around ::HL7::Message)
|
|
9
9
|
# If the same message is persisted twice we'll get an ActiveRecord::RecordNotUnique error
|
|
10
10
|
# but that's fine as we don't want to process the same HL7 message twice.
|
|
11
|
-
def call(
|
|
11
|
+
def call(hl7_message)
|
|
12
12
|
Message.create!(
|
|
13
|
-
event_code:
|
|
14
|
-
header_id:
|
|
15
|
-
body:
|
|
16
|
-
body_hash: Digest::MD5.hexdigest(
|
|
13
|
+
event_code: hl7_message.type,
|
|
14
|
+
header_id: hl7_message.header_id,
|
|
15
|
+
body: hl7_message.to_s,
|
|
16
|
+
body_hash: Digest::MD5.hexdigest(hl7_message.to_s),
|
|
17
|
+
patient_identifier: hl7_message.patient_identification&.internal_id
|
|
17
18
|
)
|
|
18
19
|
end
|
|
19
20
|
end
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_dependency "renalware/hd"
|
|
4
|
+
|
|
5
|
+
module Renalware
|
|
6
|
+
module HD
|
|
7
|
+
# An HD::Provider is a company managing dialysers for example Diaverum or Fresenius
|
|
8
|
+
class Provider < ApplicationRecord
|
|
9
|
+
validates :name, presence: true
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
end
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_dependency "renalware/hd"
|
|
4
|
+
|
|
5
|
+
module Renalware
|
|
6
|
+
module HD
|
|
7
|
+
# An HD::Provider is a company managing dialysers for example Diaverum or Fresenius
|
|
8
|
+
class ProviderUnit < ApplicationRecord
|
|
9
|
+
belongs_to :hd_provider, class_name: "HD::Provider"
|
|
10
|
+
belongs_to :hospital_unit, class_name: "Hospitals::Unit"
|
|
11
|
+
validates :hd_provider, presence: true
|
|
12
|
+
validates :hospital_unit, presence: true
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_dependency "renalware/hd"
|
|
4
|
+
|
|
5
|
+
module Renalware
|
|
6
|
+
module HD
|
|
7
|
+
# Tracks the import of incoming HD Session data from an integrated dialysis provider
|
|
8
|
+
# and the outgoing data back to that provider, for example HL7 messages.
|
|
9
|
+
class TransmissionLog < ApplicationRecord
|
|
10
|
+
belongs_to :hd_provider_unit, class_name: "ProviderUnit"
|
|
11
|
+
belongs_to :patient, class_name: "Renalware::Patient"
|
|
12
|
+
belongs_to :session
|
|
13
|
+
validates :direction, presence: true
|
|
14
|
+
validates :format, presence: true
|
|
15
|
+
has_many :children,
|
|
16
|
+
class_name: "TransmissionLog",
|
|
17
|
+
foreign_key: "parent_id",
|
|
18
|
+
dependent: :destroy
|
|
19
|
+
belongs_to :parent, class_name: "TransmissionLog"
|
|
20
|
+
|
|
21
|
+
def self.policy_class
|
|
22
|
+
BasePolicy
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
|
@@ -29,7 +29,14 @@ module Renalware
|
|
|
29
29
|
def generate_archive(by:, presenter: default_presenter)
|
|
30
30
|
becomes!(Approved).tap do |letter|
|
|
31
31
|
letter.by = by
|
|
32
|
-
|
|
32
|
+
# Note there is no need to set letter_id: id here but there is an
|
|
33
|
+
# intermittent issue where (oddly) build_archive fails because letter_id not
|
|
34
|
+
# present, so in attempt to fix this we are setting it here explicitly.
|
|
35
|
+
# Using self.id rather than letter.id in case the becomes! has lost the id
|
|
36
|
+
# for some reason. Also moved presenter.content to a new line so we can more easily see
|
|
37
|
+
# if that is causing the error as it does a lot of processing to build the letter.
|
|
38
|
+
achived_letter_content = presenter.content
|
|
39
|
+
letter.build_archive(by: by, content: achived_letter_content, letter_id: id)
|
|
33
40
|
end
|
|
34
41
|
end
|
|
35
42
|
|
|
@@ -3,29 +3,29 @@
|
|
|
3
3
|
require_dependency "renalware/pathology"
|
|
4
4
|
|
|
5
5
|
#
|
|
6
|
-
# When subscribed to HL7 `
|
|
6
|
+
# When subscribed to HL7 `message_arrived` messages, gets notified of incoming HL7 messages
|
|
7
7
|
# and creates the observations contained therein provided the patient exists.
|
|
8
8
|
#
|
|
9
9
|
module Renalware
|
|
10
10
|
module Pathology
|
|
11
11
|
class MessageListener
|
|
12
12
|
# Note: We are already inside a transaction here
|
|
13
|
-
def
|
|
14
|
-
pathology_params = parse_pathology_params(
|
|
13
|
+
def message_arrived(hl7_message:, **)
|
|
14
|
+
pathology_params = parse_pathology_params(hl7_message)
|
|
15
15
|
create_observation_requests_and_their_child_observations_from(pathology_params)
|
|
16
16
|
#
|
|
17
|
-
# Note: The
|
|
17
|
+
# Note: The current_observation_set for the patient is updated by a trigger here!
|
|
18
18
|
#
|
|
19
19
|
end
|
|
20
20
|
|
|
21
21
|
private
|
|
22
22
|
|
|
23
|
-
def parse_pathology_params(
|
|
24
|
-
ObservationRequestsAttributesBuilder.new(
|
|
23
|
+
def parse_pathology_params(hl7_message)
|
|
24
|
+
ObservationRequestsAttributesBuilder.new(hl7_message).parse
|
|
25
25
|
end
|
|
26
26
|
|
|
27
27
|
def create_observation_requests_and_their_child_observations_from(pathology_params)
|
|
28
|
-
return if pathology_params.nil? #
|
|
28
|
+
return if pathology_params.nil? # e.g. patient does not exist
|
|
29
29
|
CreateObservationRequests.new.call(pathology_params)
|
|
30
30
|
end
|
|
31
31
|
end
|
|
@@ -12,13 +12,13 @@ module Renalware
|
|
|
12
12
|
# directly - this would remove the extra level of indirection that this class introduces.
|
|
13
13
|
class ObservationRequestsAttributesBuilder
|
|
14
14
|
DEFAULT_REQUESTOR_NAME = "UNKNOWN"
|
|
15
|
-
delegate :patient_identification, :observation_requests, to: :
|
|
15
|
+
delegate :patient_identification, :observation_requests, to: :hl7_message
|
|
16
16
|
delegate :internal_id, to: :patient_identification
|
|
17
17
|
alias_attribute :requests, :observation_requests
|
|
18
18
|
|
|
19
|
-
#
|
|
20
|
-
def initialize(
|
|
21
|
-
@
|
|
19
|
+
# hl7_message is an HL7Message (a decorator around an ::HL7::Message)
|
|
20
|
+
def initialize(hl7_message, logger = Delayed::Worker.logger)
|
|
21
|
+
@hl7_message = hl7_message
|
|
22
22
|
@logger = logger
|
|
23
23
|
end
|
|
24
24
|
|
|
@@ -40,7 +40,7 @@ module Renalware
|
|
|
40
40
|
|
|
41
41
|
private
|
|
42
42
|
|
|
43
|
-
attr_reader :
|
|
43
|
+
attr_reader :hl7_message, :logger
|
|
44
44
|
|
|
45
45
|
def build_patient_params
|
|
46
46
|
patient = find_patient(internal_id)
|
|
@@ -7,8 +7,8 @@ module Renalware
|
|
|
7
7
|
Renalware::Patient
|
|
8
8
|
.includes(current_modality: [:description])
|
|
9
9
|
.search(params[:patient_search]).tap do |search|
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
search.sorts = %w(family_name_case_insensitive given_name)
|
|
11
|
+
end
|
|
12
12
|
end
|
|
13
13
|
end
|
|
14
14
|
end
|
|
@@ -17,6 +17,10 @@ module Renalware
|
|
|
17
17
|
|
|
18
18
|
scope :today, ->{ where(created_at: Time.zone.today.all_day) }
|
|
19
19
|
scope :hotlist, ->{ where(hotlist: true) }
|
|
20
|
+
|
|
21
|
+
ransacker :created_at_casted do |_parent|
|
|
22
|
+
Arel.sql("date(renal_aki_alerts.created_at)")
|
|
23
|
+
end
|
|
20
24
|
end
|
|
21
25
|
end
|
|
22
26
|
end
|
|
@@ -27,7 +27,6 @@ module Renalware
|
|
|
27
27
|
.joins(:patient) # required for PatientsRansackHelper - see Admission
|
|
28
28
|
.includes(:patient, :updated_by, :action, hospital_ward: :hospital_unit)
|
|
29
29
|
.eager_load(patient: [current_modality: :description])
|
|
30
|
-
.public_send(query[:named_filter].to_s)
|
|
31
30
|
.ransack(query)
|
|
32
31
|
end
|
|
33
32
|
end
|
|
@@ -8,7 +8,7 @@ module Renalware
|
|
|
8
8
|
include ActiveModel::Model
|
|
9
9
|
include Virtus::Model
|
|
10
10
|
|
|
11
|
-
attribute :
|
|
11
|
+
attribute :date, Date
|
|
12
12
|
attribute :hospital_ward_id, Integer
|
|
13
13
|
attribute :action, String
|
|
14
14
|
attribute :term, String
|
|
@@ -19,9 +19,9 @@ module Renalware
|
|
|
19
19
|
def query
|
|
20
20
|
@query ||= begin
|
|
21
21
|
options = {
|
|
22
|
+
created_at_casted_date_equals: date,
|
|
22
23
|
identity_match: term,
|
|
23
24
|
hospital_ward_id_eq: hospital_ward_id,
|
|
24
|
-
hospital_ward_hospital_unit_id_eq: hospital_unit_id,
|
|
25
25
|
action_id_eq: action,
|
|
26
26
|
hotlist_eq: on_hotlist,
|
|
27
27
|
s: s,
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
= within_admin_layout(title: "HD Transmission Logs") do
|
|
2
|
+
.hd_transmission_logs
|
|
3
|
+
table.stripeless
|
|
4
|
+
thead
|
|
5
|
+
tr
|
|
6
|
+
th.col-width-date-time Date
|
|
7
|
+
th.col-width-tiny Direction
|
|
8
|
+
th.col-width-tiny Format
|
|
9
|
+
th.col-width-tiny Payload
|
|
10
|
+
th.col-width-large Filename
|
|
11
|
+
th Patient
|
|
12
|
+
th.col-width-small Ext Session Id
|
|
13
|
+
th.col-width-small Session Id
|
|
14
|
+
th.col-width-tiny Result
|
|
15
|
+
th Errors
|
|
16
|
+
tbody
|
|
17
|
+
- logs.each do |log|
|
|
18
|
+
ruby:
|
|
19
|
+
klass = if log.parent_id.present?
|
|
20
|
+
log.session_id.present? ? "session_import_success" : "session_import_error"
|
|
21
|
+
else
|
|
22
|
+
""
|
|
23
|
+
end
|
|
24
|
+
tr(class=klass)
|
|
25
|
+
td= l(log.created_at)
|
|
26
|
+
td= log.direction
|
|
27
|
+
td= log.format
|
|
28
|
+
td= link_to "...",
|
|
29
|
+
hd_transmission_log_path(log, format: :xml),
|
|
30
|
+
class: "button small_ellipsis_button",
|
|
31
|
+
target: "_blank"
|
|
32
|
+
td
|
|
33
|
+
span(title=log.filepath)= log.filepath && Pathname(log.filepath).basename
|
|
34
|
+
td= log.patient && link_to(log.patient, patient_hd_sessions_path(log.patient))
|
|
35
|
+
td= log.external_session_id
|
|
36
|
+
th
|
|
37
|
+
- if log.patient && log.session
|
|
38
|
+
= link_to log.session_id, patient_hd_session_path(log.patient, log.session)
|
|
39
|
+
td= log.result
|
|
40
|
+
td= log.error_messages.compact.uniq.join("<br>").html_safe
|
|
41
|
+
|
|
42
|
+
= paginate logs
|
|
@@ -10,9 +10,7 @@
|
|
|
10
10
|
method: :get do |f|
|
|
11
11
|
/= search_form_for(search, url: medications_esa_prescriptions_path) do |f|
|
|
12
12
|
.small-6.columns
|
|
13
|
-
|
|
14
|
-
= f.input :patient_given_name_or_patient_family_name_or_drug_name_or_patient_local_patient_id_cont,
|
|
15
|
-
label: t(".search_prompt")
|
|
13
|
+
= f.input search_scope, label: t(".search_prompt")
|
|
16
14
|
.small-3.columns
|
|
17
15
|
= f.input :provider_eq,
|
|
18
16
|
include_blank: true,
|
|
@@ -3,10 +3,9 @@ li.has-dropdown
|
|
|
3
3
|
ul.dropdown
|
|
4
4
|
li= link_to "Users", admin_users_path
|
|
5
5
|
li= link_to "Hospital Units", hospitals_units_path
|
|
6
|
-
li= link_to "HD Cannulation Types", hd_cannulation_types_path
|
|
7
|
-
li= link_to "HD Dialysers", hd_dialysers_path
|
|
8
6
|
li= link_to "Request Form Print History", pathology_requests_requests_path
|
|
9
7
|
li= link_to "Pathology Requesting Configuration", pathology_requests_rules_path
|
|
8
|
+
li= link_to "HD Transmission Logs", hd_transmission_logs_path
|
|
10
9
|
- unless Rails.env.production?
|
|
11
10
|
li
|
|
12
11
|
= link_to "Email Templates", system_email_templates_path
|