renalware-core 2.0.34 → 2.0.35
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/models/renalware/ukrdc/patients_query.rb +2 -1
- data/app/models/renalware/ukrdc/send_patient.rb +12 -3
- data/app/models/renalware/ukrdc/send_patients.rb +1 -1
- data/app/models/renalware/ukrdc/transmission_log.rb +1 -0
- data/app/presenters/renalware/ukrdc/patient_presenter.rb +5 -2
- data/lib/renalware/configuration.rb +3 -0
- data/lib/renalware/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a779b18871bd5f31fe4baa1fc6a868aac2861668a743389e5815729922f1fca3
|
4
|
+
data.tar.gz: ada4dd9150fdfb89dd42dc995516895c133393bd4974c0bbd7981e04bc33d60e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1fb542eadec8a2362be78fa93f34d9a399c04aeb9337106edcc69934d00a679a999dea68e5464a5768c41d4ebba119cbb5216dc0e6e752d879e0e83d01f2a1b5
|
7
|
+
data.tar.gz: e91844cdde10cb7044a6ca6a39ebb9b277f68f38d4c8606e3211fb646ac851d791e77b609c210d541e267e58e83bce8c171b156a8cdf2e99a46d2f87d871a22f
|
@@ -9,10 +9,11 @@ module Renalware
|
|
9
9
|
# patients who have changed since the last time they were exported.
|
10
10
|
class PatientsQuery
|
11
11
|
def call(changed_since: nil)
|
12
|
+
|
12
13
|
if changed_since.present?
|
13
14
|
rpv_patients.where("updated_at > ?", changed_since)
|
14
15
|
else
|
15
|
-
rpv_patients.where("updated_at > sent_to_ukrdc_at")
|
16
|
+
rpv_patients.where("(sent_to_ukrdc_at is null) or (updated_at > sent_to_ukrdc_at)")
|
16
17
|
end
|
17
18
|
end
|
18
19
|
|
@@ -13,9 +13,16 @@ module Renalware
|
|
13
13
|
logger.info " Patient #{patient.to_param}"
|
14
14
|
xml_payload = build_payload(log)
|
15
15
|
if xml_payload_same_as_last_sent_payload?(xml_payload)
|
16
|
+
logger.info " skipping as no change in XML file"
|
16
17
|
log.unsent_no_change_since_last_send!
|
17
18
|
else
|
18
19
|
send_file(xml_payload, log)
|
20
|
+
# Important we use update_column here so we don't trigger updated_at to change
|
21
|
+
# on the patient, which affects the results of PatientsQuery next time.
|
22
|
+
patient.update_column(:sent_to_ukrdc_at, Time.zone.now)
|
23
|
+
logger.info(
|
24
|
+
" sending file and setting patient.sent_to_ukrdc_at = #{patient.sent_to_ukrdc_at}"
|
25
|
+
)
|
19
26
|
end
|
20
27
|
logger.info " Status: #{log.status}"
|
21
28
|
end
|
@@ -58,7 +65,10 @@ module Renalware
|
|
58
65
|
end
|
59
66
|
|
60
67
|
def presenter_for(patient)
|
61
|
-
Renalware::UKRDC::PatientPresenter.new(
|
68
|
+
Renalware::UKRDC::PatientPresenter.new(
|
69
|
+
patient,
|
70
|
+
changes_since: changes_since
|
71
|
+
)
|
62
72
|
end
|
63
73
|
|
64
74
|
# Note a test might have passed in a mock renderer
|
@@ -80,8 +90,6 @@ module Renalware
|
|
80
90
|
@to_md5_hash ||= Digest::MD5.hexdigest(time_neutral_payload)
|
81
91
|
end
|
82
92
|
|
83
|
-
private
|
84
|
-
|
85
93
|
# Remove the time elements from SendingFacility
|
86
94
|
# e.g.
|
87
95
|
# <SendingFacility channelName='Renalware' time='2018-02-26T13:18:02+00:00'/>
|
@@ -92,6 +100,7 @@ module Renalware
|
|
92
100
|
payload
|
93
101
|
.gsub(/<Stream>[^<]*<\/Stream>/, "<Stream>removed</Stream>")
|
94
102
|
.gsub(/ (time|start|stop)=["'][^'"]*['"]/, '')
|
103
|
+
.gsub(/<UpdatedOn>[^<]*<\/UpdatedOn>/, "<UpdatedOn>removed</UpdatedOn>")
|
95
104
|
end
|
96
105
|
end
|
97
106
|
end
|
@@ -68,7 +68,7 @@ module Renalware
|
|
68
68
|
end
|
69
69
|
|
70
70
|
def within_new_folder
|
71
|
-
dir =
|
71
|
+
dir = Pathname(File.join("/var", "ukrdc", timestamp))
|
72
72
|
FileUtils.mkdir_p dir
|
73
73
|
FileUtils.mkdir_p File.join(dir, "xml")
|
74
74
|
FileUtils.mkdir_p File.join(dir, "encrypted")
|
@@ -15,7 +15,10 @@ module Renalware
|
|
15
15
|
if changes_since.present? && changes_since.is_a?(String)
|
16
16
|
changes_since = Time.zone.parse(changes_since)
|
17
17
|
end
|
18
|
-
|
18
|
+
# TODO: document what's happening here with dates
|
19
|
+
@changes_since = changes_since ||
|
20
|
+
patient.sent_to_ukrdc_at ||
|
21
|
+
Renalware.config.ukrdc_default_changes_since_date
|
19
22
|
if @changes_since.blank?
|
20
23
|
raise(
|
21
24
|
ArgumentError,
|
@@ -114,7 +117,7 @@ module Renalware
|
|
114
117
|
end
|
115
118
|
|
116
119
|
def clinics_patient
|
117
|
-
@
|
120
|
+
@clinics_patient ||= Renalware::Clinics.cast_patient(__getobj__)
|
118
121
|
end
|
119
122
|
|
120
123
|
def letters_patient
|
@@ -53,6 +53,9 @@ module Renalware
|
|
53
53
|
ENV["FALLBACK_EMAIL_ADDRESS_FOR_TEST_MESSAGES"]
|
54
54
|
end
|
55
55
|
config_accessor(:ukrdc_sending_facility_name) { ENV["UKRDC_SENDING_FACILITY_NAME"] }
|
56
|
+
config_accessor(:ukrdc_default_changes_since_date) {
|
57
|
+
Date.parse(ENV.fetch("UKRDC_DEFAULT_CHANGES_SINCE_DATE", "2018-01-01"))
|
58
|
+
}
|
56
59
|
|
57
60
|
# We override this in some tests as a means of getting wicked_Pdf to generate an HTML version
|
58
61
|
# of the PDF so we can examine its content
|
data/lib/renalware/version.rb
CHANGED