renalware-core 2.0.54 → 2.0.55
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/batch_number.rb +15 -0
- data/app/models/renalware/ukrdc/create_encrypted_patient_xml_files.rb +17 -3
- data/app/models/renalware/ukrdc/create_patient_xml_file.rb +19 -4
- data/db/migrate/20181026145459_create_ukrdc_batch_numbers.rb +8 -0
- data/lib/gpg_encrypt_folder.rb +4 -4
- data/lib/renalware/configuration.rb +1 -0
- data/lib/renalware/version.rb +1 -1
- metadata +3 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 894fbb8d8d83ab547c7a25dec9e6d41eca0a9f9181bd55aef8ece1c65bc26523
|
4
|
+
data.tar.gz: 468716265e6688e6d1e66fa3c6d606948531853285cacb9a1249914c02d6cb21
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2c62a3d4fba4c48455a0882e1b7a3d4353b08a0c557858af1bc27f73387f63a24471d15b0915bf2246836b87b3d3f5478a37e8dc3b427d312ea56ef9a7e09cbc
|
7
|
+
data.tar.gz: 34a24963e66f3d60d6776e63b4233b4ebd36eff7a35ac384f5640442e07e2f32841204503329eb1e8b51e5ca9c1b479b4ec3d7bd94489e88a0b4248c2a942a5e
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_dependency "renalware/ukrdc"
|
4
|
+
|
5
|
+
module Renalware
|
6
|
+
module UKRDC
|
7
|
+
class BatchNumber < ApplicationRecord
|
8
|
+
def self.next
|
9
|
+
new_batcher_number = new
|
10
|
+
new_batcher_number.save!
|
11
|
+
new_batcher_number.id.to_s.rjust(6, "0")
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -12,7 +12,16 @@ module Renalware
|
|
12
12
|
# is mount on a remote share for example on an SFTP server.
|
13
13
|
#
|
14
14
|
class CreateEncryptedPatientXMLFiles
|
15
|
-
attr_reader
|
15
|
+
attr_reader(
|
16
|
+
:patient_ids,
|
17
|
+
:changed_since,
|
18
|
+
:logger,
|
19
|
+
:request_uuid,
|
20
|
+
:paths,
|
21
|
+
:timestamp,
|
22
|
+
:summary,
|
23
|
+
:batch_number
|
24
|
+
)
|
16
25
|
|
17
26
|
def initialize(changed_since: nil, patient_ids: nil, logger: nil)
|
18
27
|
@changed_since = Time.zone.parse(changed_since) if changed_since.present?
|
@@ -26,17 +35,22 @@ module Renalware
|
|
26
35
|
|
27
36
|
def call
|
28
37
|
logger.tagged(request_uuid) do
|
38
|
+
# Skipping transaction for now as worried about the quantity of rows and data invovled.
|
39
|
+
# ActiveRecord::Base.transaction do
|
40
|
+
@batch_number = BatchNumber.next
|
29
41
|
summary.milliseconds_taken = Benchmark.ms do
|
30
42
|
create_patient_xml_files
|
31
43
|
encrypt_patient_xml_files
|
32
44
|
copy_encrypted_xml_files_into_the_outgoing_folder
|
33
45
|
paths.create_symlink_to_latest_timestamped_folder_so_it_is_easier_to_eyeball
|
34
46
|
end
|
47
|
+
# end
|
35
48
|
build_summary
|
36
49
|
print_summary
|
37
50
|
email_summary
|
38
51
|
end
|
39
52
|
rescue StandardError => exception
|
53
|
+
# TODO: if fails before copying to outgoing then we should roll back BatchNumber
|
40
54
|
Engine.exception_notifier.notify(exception)
|
41
55
|
raise exception
|
42
56
|
end
|
@@ -52,6 +66,7 @@ module Renalware
|
|
52
66
|
dir: paths.timestamped_xml_folder,
|
53
67
|
changes_since: changed_since,
|
54
68
|
request_uuid: request_uuid,
|
69
|
+
batch_number: batch_number,
|
55
70
|
logger: logger
|
56
71
|
).call
|
57
72
|
end
|
@@ -127,8 +142,7 @@ module Renalware
|
|
127
142
|
recipient: config.ukrdc_gpg_recipient,
|
128
143
|
keyring: config.ukrdc_gpg_keyring,
|
129
144
|
homedir: config.ukrdc_gpg_homedir,
|
130
|
-
destination_folder: paths.timestamped_encrypted_folder
|
131
|
-
timestamp: timestamp
|
145
|
+
destination_folder: paths.timestamped_encrypted_folder
|
132
146
|
)
|
133
147
|
end
|
134
148
|
end
|
@@ -6,7 +6,15 @@ require "attr_extras"
|
|
6
6
|
module Renalware
|
7
7
|
module UKRDC
|
8
8
|
class CreatePatientXMLFile
|
9
|
-
pattr_initialize [
|
9
|
+
pattr_initialize [
|
10
|
+
:patient!,
|
11
|
+
:dir!,
|
12
|
+
:request_uuid!,
|
13
|
+
:renderer,
|
14
|
+
:changes_since,
|
15
|
+
:logger,
|
16
|
+
:batch_number
|
17
|
+
]
|
10
18
|
|
11
19
|
# rubocop:disable Metrics/AbcSize
|
12
20
|
def call
|
@@ -90,10 +98,17 @@ module Renalware
|
|
90
98
|
end
|
91
99
|
|
92
100
|
def xml_filepath
|
93
|
-
|
101
|
+
File.join(dir, xml_filename)
|
102
|
+
end
|
103
|
+
|
104
|
+
def xml_filename
|
105
|
+
patient_identifier = patient.nhs_number || patient.local_patient_id
|
106
|
+
if patient_identifier.blank?
|
107
|
+
raise(ArgumentError, "Patient has no NHS number or local patient id")
|
108
|
+
end
|
94
109
|
|
95
|
-
|
96
|
-
|
110
|
+
site_code = Renalware.config.ukrdc_site_code # e.g. RJZ
|
111
|
+
"#{site_code}_#{batch_number}_#{patient_identifier.upcase}.xml"
|
97
112
|
end
|
98
113
|
|
99
114
|
class Payload
|
data/lib/gpg_encrypt_folder.rb
CHANGED
@@ -29,8 +29,8 @@ class GpgOptions
|
|
29
29
|
:recipient,
|
30
30
|
:keyring,
|
31
31
|
:homedir,
|
32
|
-
:destination_folder
|
33
|
-
|
32
|
+
:destination_folder
|
33
|
+
]
|
34
34
|
end
|
35
35
|
|
36
36
|
class GpgEncryptFile
|
@@ -72,12 +72,12 @@ class GpgCommand
|
|
72
72
|
"--keyring #{options.keyring}"
|
73
73
|
end
|
74
74
|
|
75
|
-
def
|
75
|
+
def filename_without_extension
|
76
76
|
File.basename(file, ".xml")
|
77
77
|
end
|
78
78
|
|
79
79
|
def output_filename
|
80
|
-
"#{
|
80
|
+
"#{filename_without_extension}.gpg"
|
81
81
|
end
|
82
82
|
|
83
83
|
def encrypted_filename
|
@@ -64,6 +64,7 @@ module Renalware
|
|
64
64
|
config_accessor(:ukrdc_working_path) do
|
65
65
|
ENV.fetch("UKRDC_WORKING_PATH", File.join("/var", "ukrdc"))
|
66
66
|
end
|
67
|
+
config_accessor(:ukrdc_site_code) { ENV.fetch("UKRDC_PREFIX", "RJZ") }
|
67
68
|
|
68
69
|
# We override this in some tests as a means of getting wicked_Pdf to generate an HTML version
|
69
70
|
# of the PDF so we can examine its content
|
data/lib/renalware/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
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.55
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Airslie
|
@@ -1759,6 +1759,7 @@ files:
|
|
1759
1759
|
- app/models/renalware/transplants/registrations/wait_list_query.rb
|
1760
1760
|
- app/models/renalware/transplants/version.rb
|
1761
1761
|
- app/models/renalware/ukrdc.rb
|
1762
|
+
- app/models/renalware/ukrdc/batch_number.rb
|
1762
1763
|
- app/models/renalware/ukrdc/create_encrypted_patient_xml_files.rb
|
1763
1764
|
- app/models/renalware/ukrdc/create_patient_xml_file.rb
|
1764
1765
|
- app/models/renalware/ukrdc/export_summary.rb
|
@@ -3337,6 +3338,7 @@ files:
|
|
3337
3338
|
- db/migrate/20181008145159_create_reporting_daily_ukrdc_view.rb
|
3338
3339
|
- db/migrate/20181013115138_update_reporting_daily_pathology_view_to_v2.rb
|
3339
3340
|
- db/migrate/20181025170410_add_ukrdc_helper_column_to_patients.rb
|
3341
|
+
- db/migrate/20181026145459_create_ukrdc_batch_numbers.rb
|
3340
3342
|
- db/seeds.rb
|
3341
3343
|
- db/seeds/default/accesses/access_pd_catheter_insertion_techniques.csv
|
3342
3344
|
- db/seeds/default/accesses/access_pd_catheter_insertion_techniques.rb
|