renalware-core 2.0.35 → 2.0.36
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/letters/lists_controller.rb +6 -6
- data/app/models/renalware/letters/letter.rb +10 -2
- data/app/models/renalware/letters/letter_query.rb +17 -10
- data/app/models/renalware/letters/letterhead.rb +2 -0
- data/app/models/renalware/medications/prescription.rb +4 -2
- data/app/policies/renalware/reporting/audit_policy.rb +11 -1
- data/app/views/renalware/api/ukrdc/patients/_patient.xml.builder +21 -20
- data/app/views/renalware/dashboard/letters/_letter.html.slim +1 -1
- data/app/views/renalware/letters/letters/_letter.html.slim +1 -1
- data/app/views/renalware/letters/lists/_letter.html.slim +1 -1
- data/app/views/renalware/letters/lists/_table.html.slim +1 -1
- data/app/views/renalware/letters/lists/show.html.slim +6 -4
- data/app/views/renalware/patients/patients/show/_contact_details.html.slim +5 -2
- data/app/views/renalware/reporting/audits/index.html.slim +4 -3
- data/db/migrate/20180628132323_add_letter_date_indexes.rb +13 -0
- data/db/seeds/default/medications/medication_routes.rb +1 -1
- data/lib/renalware/version.rb +1 -1
- metadata +3 -3
- data/db/static.obsolete/medication_routes.yml +0 -20
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bfed2445c848af3b0113640b06aedc9fd3debee0dca9281fa939a956aafabbad
|
4
|
+
data.tar.gz: 5dbd07809c7d6aa3c5b5ee64bc743c21419168bfb729bf7b2ba4a8d70aa2be81
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4981dfe990c64aa289d15d18c28c8e7cd1154133cbbc232db7cac4d1486b1dcdd2968d0e069dace77c76086a1fcb660cbd6d49298dce7846766beccf06155859
|
7
|
+
data.tar.gz: a3ebbd8cd62ab6c407e5316840cea7a782e71e69f36770134c83bd6f8afcd739660ad003e1932f2292bd813c673f10e87f08e705678ec2d161abc1af33d1745f
|
@@ -7,6 +7,8 @@ module Renalware
|
|
7
7
|
class ListsController < Letters::BaseController
|
8
8
|
include Renalware::Concerns::Pageable
|
9
9
|
|
10
|
+
# rubocop:disable Metrics/MethodLength
|
11
|
+
# TODO: Use a presenter here
|
10
12
|
def show
|
11
13
|
query = LetterQuery.new(q: params[:q])
|
12
14
|
letters = find_and_authorize_letters(query)
|
@@ -15,17 +17,15 @@ module Renalware
|
|
15
17
|
letters: letters,
|
16
18
|
authors: User.author.ordered,
|
17
19
|
typists: User.ordered,
|
20
|
+
letterheads: Letters::Letterhead.ordered,
|
18
21
|
q: query.search
|
19
22
|
}
|
20
23
|
respond_to do |format|
|
21
|
-
format.html
|
22
|
-
|
23
|
-
end
|
24
|
-
format.js do
|
25
|
-
render locals: locals, layout: false
|
26
|
-
end
|
24
|
+
format.html { render(locals: locals) }
|
25
|
+
format.js { render(locals: locals, layout: false) }
|
27
26
|
end
|
28
27
|
end
|
28
|
+
# rubocop:enable Metrics/MethodLength
|
29
29
|
|
30
30
|
private
|
31
31
|
|
@@ -56,8 +56,8 @@ module Renalware
|
|
56
56
|
}
|
57
57
|
singleton_class.send(:alias_method, :in_progress, :pending)
|
58
58
|
|
59
|
-
scope :reverse, -> { order(
|
60
|
-
scope :ordered, -> { order(
|
59
|
+
scope :reverse, -> { order("#{effective_date_sort} asc") }
|
60
|
+
scope :ordered, -> { order("#{effective_date_sort} desc") }
|
61
61
|
scope :with_letterhead, -> { includes(:letterhead) }
|
62
62
|
scope :with_main_recipient, -> { includes(main_recipient: [:address, :addressee]) }
|
63
63
|
scope :with_author, -> { includes(:author) }
|
@@ -78,6 +78,10 @@ module Renalware
|
|
78
78
|
where(event: event).first
|
79
79
|
end
|
80
80
|
|
81
|
+
def self.effective_date_sort
|
82
|
+
"coalesce(completed_at, approved_at, submitted_for_approval_at, created_at)"
|
83
|
+
end
|
84
|
+
|
81
85
|
EVENTS_MAP = {
|
82
86
|
Clinics::ClinicVisit => Event::ClinicVisit,
|
83
87
|
NilClass => Event::Unknown
|
@@ -124,6 +128,10 @@ module Renalware
|
|
124
128
|
def archive_recipients!
|
125
129
|
recipients.each(&:archive!)
|
126
130
|
end
|
131
|
+
|
132
|
+
def effective_date
|
133
|
+
completed_at || approved_at || submitted_for_approval_at || created_at
|
134
|
+
end
|
127
135
|
end
|
128
136
|
end
|
129
137
|
end
|
@@ -5,23 +5,30 @@ require_dependency "renalware/letters"
|
|
5
5
|
module Renalware
|
6
6
|
module Letters
|
7
7
|
module QueryableLetter
|
8
|
-
|
9
|
-
|
10
|
-
|
8
|
+
extend ActiveSupport::Concern
|
9
|
+
included do
|
10
|
+
self.ransacker :effective_date, type: :date do
|
11
|
+
Arel.sql(Letter.effective_date_sort)
|
12
|
+
end
|
11
13
|
|
12
|
-
|
13
|
-
|
14
|
-
|
14
|
+
def self.state_eq(state = :draft)
|
15
|
+
where(type: Letter.state_class_name(state))
|
16
|
+
end
|
17
|
+
|
18
|
+
def self.finder_needs_type_condition?
|
19
|
+
false
|
20
|
+
end
|
15
21
|
|
16
|
-
|
17
|
-
|
22
|
+
def self.ransackable_scopes(_auth_object = nil)
|
23
|
+
%i(state_eq)
|
24
|
+
end
|
18
25
|
end
|
19
26
|
end
|
20
27
|
|
21
28
|
class LetterQuery
|
22
29
|
def initialize(q: nil)
|
23
30
|
@q = q || {}
|
24
|
-
@q[:s] ||= ["
|
31
|
+
@q[:s] ||= ["effective_date desc"]
|
25
32
|
end
|
26
33
|
|
27
34
|
def call
|
@@ -29,7 +36,7 @@ module Renalware
|
|
29
36
|
end
|
30
37
|
|
31
38
|
def search
|
32
|
-
@search ||= Letter.
|
39
|
+
@search ||= Letter.include(QueryableLetter).includes(:event).search(@q)
|
33
40
|
end
|
34
41
|
end
|
35
42
|
end
|
@@ -46,7 +46,9 @@ module Renalware
|
|
46
46
|
in: DoseUnit.codes,
|
47
47
|
i18n_scope: "enumerize.renalware.medications.prescription.dose_unit"
|
48
48
|
|
49
|
-
scope :ordered,
|
49
|
+
scope :ordered, lambda {
|
50
|
+
joins(:drug).order("drugs.name asc, prescribed_on desc")
|
51
|
+
}
|
50
52
|
scope :with_medication_route, -> { includes(:medication_route) }
|
51
53
|
scope :with_drugs, -> { includes(drug: :drug_types) }
|
52
54
|
scope :with_classifications, -> { includes(drug: :classifications) }
|
@@ -77,7 +79,7 @@ module Renalware
|
|
77
79
|
|
78
80
|
# This is a Ransack-compatible search predicate
|
79
81
|
def self.default_search_order
|
80
|
-
"drug_name"
|
82
|
+
["drug_name asc", "prescribed_on desc"]
|
81
83
|
end
|
82
84
|
|
83
85
|
def self.policy_class
|
@@ -5,7 +5,17 @@ require_dependency "renalware/reporting"
|
|
5
5
|
module Renalware
|
6
6
|
module Reporting
|
7
7
|
class AuditPolicy < BasePolicy
|
8
|
-
|
8
|
+
def refresh?
|
9
|
+
user_is_super_admin?
|
10
|
+
end
|
11
|
+
|
12
|
+
def edit?
|
13
|
+
user_is_super_admin?
|
14
|
+
end
|
15
|
+
|
16
|
+
def update?
|
17
|
+
user_is_super_admin?
|
18
|
+
end
|
9
19
|
end
|
10
20
|
end
|
11
21
|
end
|
@@ -20,6 +20,7 @@ xml.Patient do
|
|
20
20
|
xml.Organization "LOCALHOSP"
|
21
21
|
xml.NumberType "MRN"
|
22
22
|
end
|
23
|
+
break
|
23
24
|
end
|
24
25
|
end
|
25
26
|
|
@@ -44,26 +45,6 @@ xml.Patient do
|
|
44
45
|
end
|
45
46
|
end
|
46
47
|
|
47
|
-
xml.FamilyDoctor do
|
48
|
-
xml.GPPracticeId patient.practice&.code
|
49
|
-
xml.GPId patient.primary_care_physician&.code
|
50
|
-
end
|
51
|
-
|
52
|
-
if patient.ethnicity.present?
|
53
|
-
xml.EthnicGroup do
|
54
|
-
xml.CodingStandard "NHS_DATA_DICTIONARY"
|
55
|
-
xml.Code patient.ethnicity&.rr18_code
|
56
|
-
end
|
57
|
-
end
|
58
|
-
|
59
|
-
if patient.language.present?
|
60
|
-
xml.PrimaryLanguage do
|
61
|
-
xml.CodingStandard "NHS_DATA_DICTIONARY_LANGUAGE_CODE" # ISO 639-1 plus braille and sign
|
62
|
-
xml.Code patient.language&.code
|
63
|
-
xml.Description patient.language
|
64
|
-
end
|
65
|
-
end
|
66
|
-
|
67
48
|
if patient.contact_details?
|
68
49
|
xml.ContactDetails do
|
69
50
|
if patient.email.present?
|
@@ -84,6 +65,26 @@ xml.Patient do
|
|
84
65
|
end
|
85
66
|
end
|
86
67
|
|
68
|
+
xml.FamilyDoctor do
|
69
|
+
xml.GPPracticeId patient.practice&.code
|
70
|
+
xml.GPId patient.primary_care_physician&.code
|
71
|
+
end
|
72
|
+
|
73
|
+
if patient.ethnicity.present?
|
74
|
+
xml.EthnicGroup do
|
75
|
+
xml.CodingStandard "NHS_DATA_DICTIONARY"
|
76
|
+
xml.Code patient.ethnicity&.rr18_code
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
if patient.language.present?
|
81
|
+
xml.PrimaryLanguage do
|
82
|
+
xml.CodingStandard "NHS_DATA_DICTIONARY_LANGUAGE_CODE" # ISO 639-1 plus braille and sign
|
83
|
+
xml.Code patient.language&.code
|
84
|
+
xml.Description patient.language
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
87
88
|
if patient.dead?
|
88
89
|
xml.Death true
|
89
90
|
end
|
@@ -29,7 +29,7 @@ tr(class=letter.state.dasherize)
|
|
29
29
|
td.full-name= default_patient_link(letter.patient)
|
30
30
|
td= letter.patient.nhs_number
|
31
31
|
td= letter.enclosures&.truncate(6)
|
32
|
-
td= l
|
32
|
+
td= l(letter.effective_date)
|
33
33
|
td= letter.author
|
34
34
|
td= letter.typist
|
35
35
|
td.col-width-medium-with-ellipsis= letter.main_recipient.address
|
@@ -8,7 +8,7 @@
|
|
8
8
|
th.col-width-medium= sort_link([:renalware, q], :patient_family_name, "Patient")
|
9
9
|
th.col-width-nhs-no= sort_link([:renalware, q], :patient_nhs_number, "NHS No")
|
10
10
|
th= sort_link([:renalware, q], :enclosures, "Enc.")
|
11
|
-
th.col-width-date-time = sort_link([:renalware, q], :
|
11
|
+
th.col-width-date-time = sort_link([:renalware, q], :effective_date, "Date", default_order: :desc)
|
12
12
|
th= sort_link([:renalware, q], :author_family_name, "Author")
|
13
13
|
th= sort_link([:renalware, q], :created_by_family_name, "Typist")
|
14
14
|
th.col-width-small Recipient
|
@@ -9,13 +9,15 @@
|
|
9
9
|
.row
|
10
10
|
.small-6.medium-1.large-1.columns
|
11
11
|
= f.input :enclosures_present, as: :select, label: "Enclosure"
|
12
|
-
.small-6.medium-
|
12
|
+
.small-6.medium-2.large-2.columns
|
13
13
|
= f.input :state_eq, collection: state_options_for_receptionists, label: "State"
|
14
|
-
.small-6.medium-
|
14
|
+
.small-6.medium-2.large-2.columns
|
15
15
|
= f.input :author_id_eq, as: :user_picker, collection: authors, label: "Author"
|
16
|
-
.small-6.medium-
|
16
|
+
.small-6.medium-2.large-2.columns
|
17
17
|
= f.input :created_by_id_eq, as: :user_picker, collection: typists, label: "Typist"
|
18
|
-
.small-
|
18
|
+
.small-6.medium-3.large-2.columns
|
19
|
+
= f.input :letterhead_id_eq, collection: letterheads, label: "Letterhead"
|
20
|
+
.small-12.medium-2.large-2.columns.actions.end
|
19
21
|
= f.submit t("helpers.submit.filter"), class: "button"
|
20
22
|
span= " or "
|
21
23
|
= link_to t("helpers.reset"), letters_list_path
|
@@ -3,16 +3,19 @@ article
|
|
3
3
|
h2 Contact Details
|
4
4
|
|
5
5
|
dl.dl-horizontal
|
6
|
-
dt Email
|
7
6
|
- if patient.email.present?
|
7
|
+
dt Email
|
8
8
|
dd= patient.email
|
9
9
|
- if patient.current_address&.email.present?
|
10
|
+
dt Email
|
10
11
|
dd= patient.current_address&.email
|
11
12
|
|
12
|
-
dt Telephone
|
13
13
|
- if patient.telephone1.present?
|
14
|
+
dt Telephone
|
14
15
|
dd= patient.telephone1
|
15
16
|
- if patient.telephone2.present?
|
17
|
+
dt Telephone
|
16
18
|
dd= patient.telephone2
|
17
19
|
- if patient.current_address&.telephone.present?
|
20
|
+
dt Telephone
|
18
21
|
dd= patient.current_address&.telephone
|
@@ -16,8 +16,9 @@
|
|
16
16
|
tr
|
17
17
|
td
|
18
18
|
= link_to("View", reporting_audit_path(audit))
|
19
|
-
|
20
|
-
|
19
|
+
- if policy(audit).edit?
|
20
|
+
= pipe_separator
|
21
|
+
= link_to("Edit", edit_reporting_audit_path(audit))
|
21
22
|
td= audit.name
|
22
23
|
td= audit.view_name
|
23
24
|
td= yes_no audit.materialized?
|
@@ -25,7 +26,7 @@
|
|
25
26
|
td= l(audit.updated_at)
|
26
27
|
td= l(audit.refreshed_at)
|
27
28
|
td
|
28
|
-
- if audit.materialized?
|
29
|
+
- if audit.materialized? && policy(audit).refresh?
|
29
30
|
= link_to("Refresh Data",
|
30
31
|
reporting_audit_refreshments_path(audit_id: audit.id),
|
31
32
|
remote: true,
|
@@ -0,0 +1,13 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class AddLetterDateIndexes < ActiveRecord::Migration[5.1]
|
4
|
+
def change
|
5
|
+
add_index :letter_letters, :created_at
|
6
|
+
add_index :letter_letters, :submitted_for_approval_at
|
7
|
+
add_index :letter_letters, :approved_at
|
8
|
+
add_index :letter_letters, :completed_at
|
9
|
+
add_index :letter_letters,
|
10
|
+
"(COALESCE(completed_at, approved_at, submitted_for_approval_at, created_at))",
|
11
|
+
name: "letter_effective_date_idx"
|
12
|
+
end
|
13
|
+
end
|
@@ -2,7 +2,6 @@
|
|
2
2
|
|
3
3
|
module Renalware
|
4
4
|
log "Adding Medication Routes" do
|
5
|
-
|
6
5
|
module RR
|
7
6
|
ORAL = 1
|
8
7
|
TOPICAL = 2
|
@@ -26,6 +25,7 @@ module Renalware
|
|
26
25
|
MRoute.find_or_create_by!(code: "PERCUT", name: "Percutaneous", rr_code: RR::OTHER)
|
27
26
|
MRoute.find_or_create_by!(code: "TOP", name: "Topical", rr_code: RR::TOPICAL)
|
28
27
|
MRoute.find_or_create_by!(code: "OTHER", name: "Other", rr_code: RR::OTHER)
|
28
|
+
MRoute.find_or_create_by!(code: "PR", name: "PerRectum", rr_code: RR::OTHER)
|
29
29
|
end
|
30
30
|
end
|
31
31
|
end
|
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.
|
4
|
+
version: 2.0.36
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Airslie
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-06-
|
11
|
+
date: 2018-06-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: active_type
|
@@ -3275,6 +3275,7 @@ files:
|
|
3275
3275
|
- db/migrate/20180605114332_create_pseudo_encrypt_function.rb
|
3276
3276
|
- db/migrate/20180605141806_add_external_id_to_research_study_participants.rb
|
3277
3277
|
- db/migrate/20180605175211_add_application_url_to_research_studies.rb
|
3278
|
+
- db/migrate/20180628132323_add_letter_date_indexes.rb
|
3278
3279
|
- db/seeds.rb
|
3279
3280
|
- db/seeds/default/accesses/access_pd_catheter_insertion_techniques.csv
|
3280
3281
|
- db/seeds/default/accesses/access_pd_catheter_insertion_techniques.rb
|
@@ -3356,7 +3357,6 @@ files:
|
|
3356
3357
|
- db/seeds/default/transplants/transplant_failure_cause_descriptions.rb
|
3357
3358
|
- db/seeds/default/transplants/transplant_registration_statuses.rb
|
3358
3359
|
- db/seeds/seeds_helper.rb
|
3359
|
-
- db/static.obsolete/medication_routes.yml
|
3360
3360
|
- db/triggers/feed_messages_preprocessing_trigger_v01.sql
|
3361
3361
|
- db/triggers/update_current_observation_set_trigger_v01.sql
|
3362
3362
|
- db/triggers/update_research_study_participants_trigger_v01.sql
|
@@ -1,20 +0,0 @@
|
|
1
|
-
- !ruby/object:MedicationRoute
|
2
|
-
id: 1
|
3
|
-
name: PO
|
4
|
-
decription: "Oral"
|
5
|
-
- !ruby/object:MedicationRoute
|
6
|
-
id: 2
|
7
|
-
name: IV
|
8
|
-
description: "Intravenous"
|
9
|
-
- !ruby/object:MedicationRoute
|
10
|
-
id: 3
|
11
|
-
name: SC
|
12
|
-
description: "Subcutaneous"
|
13
|
-
- !ruby/object:MedicationRoute
|
14
|
-
id: 4
|
15
|
-
name: IM
|
16
|
-
description: "Intramuscular"
|
17
|
-
- !ruby/object:MedicationRoute
|
18
|
-
id: 5
|
19
|
-
name: Other (Please specify in notes)
|
20
|
-
description: "Other (Please specify in notes)"
|