renalware-core 2.0.92 → 2.0.93
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/models/renalware/ukrdc/treatment_timeline/generate_timeline.rb +5 -4
- data/app/models/renalware/ukrdc/treatment_timeline/generator_factory.rb +2 -10
- data/app/models/renalware/ukrdc/treatment_timeline/transfer_out/generator.rb +39 -0
- data/app/models/renalware/ukrdc/treatment_timeline/transplant/generator.rb.wip +37 -0
- data/app/presenters/renalware/ukrdc/patient_presenter.rb +1 -1
- data/app/views/renalware/api/ukrdc/patients/treatments/_discharge_reason.xml.builder +10 -0
- data/app/views/renalware/api/ukrdc/patients/treatments/_generic.xml.builder +6 -0
- data/app/views/renalware/api/ukrdc/patients/treatments/_hd.xml.builder +6 -0
- data/app/views/renalware/api/ukrdc/patients/treatments/_pd.xml.builder +8 -0
- data/db/migrate/20190718091430_add_code_to_modality_descriptions.rb +8 -0
- data/db/migrate/20190718095851_add_discharge_reason_code_to_ukrdc_treatments.rb +8 -0
- data/db/seeds/default/modalities/descriptions.rb +6 -6
- data/lib/gpg_encrypt_folder.rb +5 -1
- data/lib/renalware/version.rb +1 -1
- data/spec/factories/hd/modality_descriptions.rb +1 -0
- data/spec/factories/modalities/modality_descriptions.rb +11 -0
- data/spec/factories/pd/modality_descriptions.rb +1 -0
- metadata +7 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cbabc9a6b80932e592c46522daa87f74509329202942f79e40347c6279c6e25f
|
4
|
+
data.tar.gz: 22c9a48a4150de3041c5345cde18bb7cf13b5a48ba222a703570e900e64cbc54
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ff6e99c1300a67b6ddae37837f7fdea9e5febeb47aacda2e33c6d0fed773db3d843e831761d2e0c7c03dc62bbd11bb9dbbebf6e3e2d0b4f5b9c541c0410e91e1
|
7
|
+
data.tar.gz: 51986e68a6db2f82b72a216a518f9266df7e7d4b513977071b8d7474c17df0b777efd386fe10d30b022b38b0d9784215e847f5a2a3f3fd2468ad627cc876ca43
|
@@ -3,7 +3,6 @@
|
|
3
3
|
require_dependency "renalware/ukrdc"
|
4
4
|
require "attr_extras"
|
5
5
|
|
6
|
-
# rubocop:disable Rails/Output
|
7
6
|
module Renalware
|
8
7
|
module UKRDC
|
9
8
|
module TreatmentTimeline
|
@@ -14,7 +13,7 @@ module Renalware
|
|
14
13
|
pattr_initialize :patient
|
15
14
|
|
16
15
|
def call
|
17
|
-
|
16
|
+
# RemapModelTableNamesToTheirPreparedEquivalents.new.call do
|
18
17
|
Rails.logger.info " Generating Treatment rows for modalities #{modality_names}"
|
19
18
|
modalities.each do |modality|
|
20
19
|
generator = GeneratorFactory.call(modality)
|
@@ -27,7 +26,10 @@ module Renalware
|
|
27
26
|
|
28
27
|
def modalities
|
29
28
|
@modalities ||= begin
|
30
|
-
patient
|
29
|
+
patient
|
30
|
+
.modalities
|
31
|
+
.includes(:description, :created_by)
|
32
|
+
.order(started_on: :asc, updated_at: :asc)
|
31
33
|
end
|
32
34
|
end
|
33
35
|
|
@@ -38,4 +40,3 @@ module Renalware
|
|
38
40
|
end
|
39
41
|
end
|
40
42
|
end
|
41
|
-
# rubocop:enable Rails/Output
|
@@ -10,17 +10,9 @@ module Renalware
|
|
10
10
|
class GeneratorFactory
|
11
11
|
DEFAULT_TYPE = "Generic"
|
12
12
|
|
13
|
-
#
|
14
|
-
# requested modality. If the modality description type is nil then we use a generic
|
15
|
-
# generator. If no generator class is defined matching the description.type, we also
|
16
|
-
# return nil.
|
17
|
-
# Example:
|
18
|
-
# given the modality_description.type of Renalware::Bla::BlaModalityDescription
|
19
|
-
# we will look to see if the constant GenerateBlaBlaTimeline exists and return an instance
|
20
|
-
# if so - otherwise we return an instance of the default generator GenerateGenericTimeline.
|
13
|
+
# Each modality_description has a :code fiekd
|
21
14
|
def self.call(modality)
|
22
|
-
type = modality.description.
|
23
|
-
type = type.gsub("::", "").gsub(/^Renalware/, "").gsub(/ModalityDescription$/, "")
|
15
|
+
type = modality.description.code&.to_s&.camelize
|
24
16
|
(klass_for(type) || klass_for(DEFAULT_TYPE)).new(modality)
|
25
17
|
end
|
26
18
|
|
@@ -0,0 +1,39 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_dependency "renalware/ukrdc"
|
4
|
+
require "attr_extras"
|
5
|
+
|
6
|
+
module Renalware
|
7
|
+
module UKRDC
|
8
|
+
module TreatmentTimeline
|
9
|
+
module TransferOut
|
10
|
+
class Generator
|
11
|
+
RR7_DISCHARGE_CODE_TRANSFER_OUT = 38
|
12
|
+
pattr_initialize :modality
|
13
|
+
delegate :patient, to: :modality
|
14
|
+
|
15
|
+
def call
|
16
|
+
update_discharge_reason_on_most_recent_treatment
|
17
|
+
end
|
18
|
+
|
19
|
+
private
|
20
|
+
|
21
|
+
def most_recent_treatment
|
22
|
+
@most_recent_treatment ||= begin
|
23
|
+
Treatment.where(patient_id: patient.id).order(started_on: :desc).first
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
def update_discharge_reason_on_most_recent_treatment
|
28
|
+
return if most_recent_treatment.blank?
|
29
|
+
|
30
|
+
most_recent_treatment.update!(
|
31
|
+
discharge_reason_code: RR7_DISCHARGE_CODE_TRANSFER_OUT,
|
32
|
+
discharge_reason_comment: "transfer_out"
|
33
|
+
)
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_dependency "renalware/ukrdc"
|
4
|
+
require "attr_extras"
|
5
|
+
|
6
|
+
# QBL TXT Description
|
7
|
+
# "20" "20" "Transplant ; Cadaver donor"
|
8
|
+
# "21" "21" "Transplant ; Live related - sibling"
|
9
|
+
# "74" "74" "Transplant ; Live related - father"
|
10
|
+
# "75" "75" "Transplant ; Live related - mother"
|
11
|
+
# "77" "77" "Transplant ; Live related - child"
|
12
|
+
# "23" "23" "Transplant ; Live related - other"
|
13
|
+
# "24" "24" "Transplant ; Live genetically unrelated"
|
14
|
+
# "25" "25" "Transplant ; Cadaver donor + transp other organ"
|
15
|
+
# "26" "26" "Transplant ; Live donor + transplant other organ"
|
16
|
+
# "27" "27" "Transplant ; Live donor non-UK transplant"
|
17
|
+
# "28" "28" "Transplant ; non-heart-beating donor"
|
18
|
+
# "29" "29" "Transplant ; type unknown"
|
19
|
+
module Renalware
|
20
|
+
module UKRDC
|
21
|
+
module TreatmentTimeline
|
22
|
+
module Transplant
|
23
|
+
class Generator
|
24
|
+
pattr_initialize :modality
|
25
|
+
delegate :patient, to: :modality
|
26
|
+
|
27
|
+
# We need to create a treatment record to match the UKRDC code expectations
|
28
|
+
# based on donor relationship.
|
29
|
+
# Otherwise Default to 29 Transplant ; type unknown
|
30
|
+
def call
|
31
|
+
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -55,7 +55,7 @@ module Renalware
|
|
55
55
|
current_modality.description.is_a?(Renalware::HD::ModalityDescription)
|
56
56
|
end
|
57
57
|
|
58
|
-
# Note we of course only send letters for RPV patients and
|
58
|
+
# Note we of course only send letters for RPV patients and exclude them for all others.
|
59
59
|
def letters
|
60
60
|
return ::Renalware::Letters::Letter.none if send_to_rpv == false
|
61
61
|
|
@@ -20,6 +20,12 @@ xml.Treatment do
|
|
20
20
|
xml.Code treatment.modality_code.txt_code
|
21
21
|
end
|
22
22
|
|
23
|
+
render(
|
24
|
+
"renalware/api/ukrdc/patients/treatments/discharge_reason",
|
25
|
+
treatment: treatment,
|
26
|
+
builder: builder
|
27
|
+
)
|
28
|
+
|
23
29
|
# HD
|
24
30
|
rr8 = treatment.hospital_unit&.unit_type_rr8
|
25
31
|
if rr8.present?
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
xml = builder
|
2
4
|
|
3
5
|
xml.Treatment do
|
@@ -15,4 +17,10 @@ xml.Treatment do
|
|
15
17
|
xml.CodingStandard "CF_RR7_TREATMENT"
|
16
18
|
xml.Code treatment.modality_code.txt_code
|
17
19
|
end
|
20
|
+
|
21
|
+
render(
|
22
|
+
"renalware/api/ukrdc/patients/treatments/discharge_reason",
|
23
|
+
treatment: treatment,
|
24
|
+
builder: builder
|
25
|
+
)
|
18
26
|
end
|
@@ -0,0 +1,8 @@
|
|
1
|
+
class AddDischargeReasonCodeToUKRDCTreatments < ActiveRecord::Migration[5.2]
|
2
|
+
def change
|
3
|
+
within_renalware_schema do
|
4
|
+
add_column :ukrdc_treatments, :discharge_reason_code, :integer
|
5
|
+
add_column :ukrdc_treatments, :discharge_reason_comment, :string
|
6
|
+
end
|
7
|
+
end
|
8
|
+
end
|
@@ -2,11 +2,11 @@
|
|
2
2
|
|
3
3
|
module Renalware
|
4
4
|
log "Adding Modality Descriptions" do
|
5
|
-
Deaths::ModalityDescription.find_or_create_by!(name: "Death")
|
6
|
-
Transplants::DonorModalityDescription.find_or_create_by!(name: "Live Donor")
|
7
|
-
Transplants::RecipientModalityDescription.find_or_create_by!(name: "Transplant")
|
8
|
-
PD::ModalityDescription.find_or_create_by!(name: "PD")
|
9
|
-
HD::ModalityDescription.find_or_create_by!(name: "HD")
|
10
|
-
LowClearance::ModalityDescription.find_or_create_by!(name: "Low Clearance")
|
5
|
+
Deaths::ModalityDescription.find_or_create_by!(name: "Death", code: "death")
|
6
|
+
Transplants::DonorModalityDescription.find_or_create_by!(name: "Live Donor", code: "live_donor")
|
7
|
+
Transplants::RecipientModalityDescription.find_or_create_by!(name: "Transplant", code: "transplant")
|
8
|
+
PD::ModalityDescription.find_or_create_by!(name: "PD", code: "pd")
|
9
|
+
HD::ModalityDescription.find_or_create_by!(name: "HD", code: "hd")
|
10
|
+
LowClearance::ModalityDescription.find_or_create_by!(name: "Low Clearance", code: "low_clearance")
|
11
11
|
end
|
12
12
|
end
|
data/lib/gpg_encrypt_folder.rb
CHANGED
@@ -53,8 +53,12 @@ end
|
|
53
53
|
class GpgCommand
|
54
54
|
pattr_initialize [:file!, :options!]
|
55
55
|
|
56
|
+
# Note we skip using a random seed file (normally created at var/ukrdc/gpgkey/random_seed)
|
57
|
+
# because we had problems at KCH where the file would become corrupt, breaking the export, and
|
58
|
+
# fixable only by deleting the random_seed file and letting gpg re-create one.
|
59
|
+
# Using the --no-random-seed-file option the file is not used so we avoid that problem.
|
56
60
|
def to_s
|
57
|
-
"gpg --armor --no-default-keyring --trust-model always "\
|
61
|
+
"gpg --armor --no-default-keyring --trust-model always --no-random-seed-file "\
|
58
62
|
"#{keyring} #{homedir} #{recipient} "\
|
59
63
|
"-o \"#{encrypted_filename}\" "\
|
60
64
|
"--encrypt \"#{file}\""
|
data/lib/renalware/version.rb
CHANGED
@@ -6,34 +6,45 @@ FactoryBot.define do
|
|
6
6
|
|
7
7
|
initialize_with { Renalware::Modalities::Description.find_or_create_by(name: name) }
|
8
8
|
|
9
|
+
trait :transfer_out do
|
10
|
+
name { "Transfer Out" }
|
11
|
+
code { "transfer_out" }
|
12
|
+
end
|
13
|
+
|
9
14
|
trait :pd do
|
10
15
|
name { "PD" }
|
11
16
|
type { "Renalware::PD::ModalityDescription" }
|
17
|
+
code { "pd" }
|
12
18
|
end
|
13
19
|
|
14
20
|
trait :hd do
|
15
21
|
name { "HD" }
|
16
22
|
type { "Renalware::HD::ModalityDescription" }
|
23
|
+
code { "hd" }
|
17
24
|
end
|
18
25
|
|
19
26
|
trait :transplant do
|
20
27
|
name { "Transplant" }
|
21
28
|
type { "Renalware::Transplants::RecipientModalityDescription" }
|
29
|
+
code { "transplant" }
|
22
30
|
end
|
23
31
|
|
24
32
|
trait :low_clearance do
|
25
33
|
name { "Low Clearance" }
|
26
34
|
type { "Renalware::LowClearance::ModalityDescription" }
|
35
|
+
code { "low_clearance" }
|
27
36
|
end
|
28
37
|
|
29
38
|
trait :death do
|
30
39
|
name { "Death" }
|
31
40
|
type { "Renalware::Deaths::ModalityDescription" }
|
41
|
+
code { "death" }
|
32
42
|
end
|
33
43
|
|
34
44
|
trait :live_donor do
|
35
45
|
name { "Live Donor" }
|
36
46
|
type { "Renalware::Transplants::DonorModalityDescription" }
|
47
|
+
code { "live_donor" }
|
37
48
|
end
|
38
49
|
end
|
39
50
|
end
|
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.93
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Airslie
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-07-
|
11
|
+
date: 2019-07-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: active_type
|
@@ -1858,6 +1858,8 @@ files:
|
|
1858
1858
|
- app/models/renalware/ukrdc/treatment_timeline/pd/regime_decorator.rb
|
1859
1859
|
- app/models/renalware/ukrdc/treatment_timeline/prepare_tables.rb
|
1860
1860
|
- app/models/renalware/ukrdc/treatment_timeline/remap_model_table_names_to_their_prepared_equivalents.rb
|
1861
|
+
- app/models/renalware/ukrdc/treatment_timeline/transfer_out/generator.rb
|
1862
|
+
- app/models/renalware/ukrdc/treatment_timeline/transplant/generator.rb.wip
|
1861
1863
|
- app/models/renalware/ukrdc/xml_renderer.rb
|
1862
1864
|
- app/models/renalware/user.rb
|
1863
1865
|
- app/models/renalware/version.rb
|
@@ -2165,6 +2167,7 @@ files:
|
|
2165
2167
|
- app/views/renalware/api/ukrdc/patients/procedures/_dialysis_session.xml.builder
|
2166
2168
|
- app/views/renalware/api/ukrdc/patients/procedures/_transplant_operation.xml.builder
|
2167
2169
|
- app/views/renalware/api/ukrdc/patients/show.xml.builder
|
2170
|
+
- app/views/renalware/api/ukrdc/patients/treatments/_discharge_reason.xml.builder
|
2168
2171
|
- app/views/renalware/api/ukrdc/patients/treatments/_generic.xml.builder
|
2169
2172
|
- app/views/renalware/api/ukrdc/patients/treatments/_hd.xml.builder
|
2170
2173
|
- app/views/renalware/api/ukrdc/patients/treatments/_pd.xml.builder
|
@@ -3530,6 +3533,8 @@ files:
|
|
3530
3533
|
- db/migrate/20190705083727_alter_ukrdc_treatments.rb
|
3531
3534
|
- db/migrate/20190705105921_create_hd_profile_for_modalites.rb
|
3532
3535
|
- db/migrate/20190709101610_create_pd_regime_for_modalities.rb
|
3536
|
+
- db/migrate/20190718091430_add_code_to_modality_descriptions.rb
|
3537
|
+
- db/migrate/20190718095851_add_discharge_reason_code_to_ukrdc_treatments.rb
|
3533
3538
|
- db/seeds.rb
|
3534
3539
|
- db/seeds/default/accesses/access_pd_catheter_insertion_techniques.csv
|
3535
3540
|
- db/seeds/default/accesses/access_pd_catheter_insertion_techniques.rb
|