renalware-core 2.0.78 → 2.0.79
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/app/assets/javascripts/renalware/application.js.erb +1 -0
- data/app/assets/javascripts/renalware/layout.js +3 -0
- data/app/assets/stylesheets/renalware/modules/_patients.scss +2 -1
- data/app/controllers/renalware/admin/feeds/files_controller.rb +7 -1
- data/app/controllers/renalware/patients/practices_controller.rb +1 -1
- data/app/controllers/renalware/patients/primary_care_physician_controller.rb +32 -13
- data/app/controllers/renalware/virology/dashboards_controller.rb +1 -4
- data/app/controllers/renalware/virology/profiles_controller.rb +10 -5
- data/app/documents/renalware/hd/session_document.rb +4 -0
- data/app/documents/renalware/patient_document.rb +15 -1
- data/app/documents/renalware/renal/profile_document.rb +22 -0
- data/app/documents/renalware/virology/profile_document.rb +1 -0
- data/app/models/renalware/clinics/remembered_clinic_visit_preferences.rb +1 -1
- data/app/models/renalware/feeds/files/practice_memberships/import_job.rb +2 -8
- data/app/models/renalware/feeds/files/primary_care_physicians/import_csv.rb +2 -2
- data/app/models/renalware/hd/session/closed.rb +2 -0
- data/app/models/renalware/patients/last_successful_practice_sync_date_query.rb +28 -0
- data/app/models/renalware/patients/practice.rb +0 -2
- data/app/models/renalware/patients/practice_search_query.rb +4 -2
- data/app/models/renalware/patients/sync_gps_via_file_download_job.rb +52 -0
- data/app/models/renalware/patients/sync_ods_job.rb +53 -0
- data/app/models/renalware/patients/sync_practices_via_api.rb +157 -0
- data/app/models/renalware/system/api_log.rb +29 -0
- data/app/presenters/renalware/admissions/consult_summary_part.rb +36 -0
- data/app/presenters/renalware/ukrdc/patient_presenter.rb +66 -6
- data/app/presenters/renalware/virology/dashboard_presenter.rb +32 -0
- data/app/validators/renalware/patients/respiratory_rate_validator.rb +17 -0
- data/app/views/renalware/admissions/consults/_summary_part.html.slim +17 -0
- data/app/views/renalware/admissions/consults/_table.html.slim +58 -19
- data/app/views/renalware/api/ukrdc/patients/_diagnoses.xml.builder +43 -3
- data/app/views/renalware/api/ukrdc/patients/_medications.xml.builder +23 -3
- data/app/views/renalware/api/ukrdc/patients/_social_histories.xml.builder +2 -2
- data/app/views/renalware/hd/protocols/_virology.html.slim +2 -0
- data/app/views/renalware/hd/sessions/_form.html.slim +4 -0
- data/app/views/renalware/pathology/historical_observation_results/index.html.slim +2 -2
- data/app/views/renalware/virology/dashboards/_latest_hep_b_antibody_statuses.html.slim +5 -0
- data/app/views/renalware/virology/dashboards/show.html.slim +6 -3
- data/app/views/renalware/virology/profiles/_summary.html.slim +2 -2
- data/app/views/renalware/virology/profiles/edit.html.slim +1 -0
- data/config/locales/renalware/hd/session.en.yml +4 -0
- data/config/locales/renalware/virology/virology.en.yml +1 -0
- data/db/functions/import_practice_memberships_csv_v03.sql +65 -0
- data/db/migrate/20190531172829_add_last_change_date_to_patient_practices.rb +26 -0
- data/db/migrate/20190602114659_create_system_api_logs.rb +15 -0
- data/db/migrate/20190603084428_add_pages_to_system_api_logs.rb +5 -0
- data/db/migrate/20190603135247_add_columns_to_patient_primary_care_physicians.rb +8 -0
- data/db/migrate/20190603143834_update_import_practice_memberships_csv.rb +13 -0
- data/db/migrate/20190603165812_drop_import_practices_csv_function.rb +13 -0
- data/db/seeds/default/feeds/import_file_types.rb +0 -8
- data/db/seeds/default/renal/prd_descriptions.csv +266 -266
- data/lib/document/enum.rb +4 -0
- data/lib/renalware/configuration.rb +1 -0
- data/lib/renalware/version.rb +1 -1
- data/lib/tasks/feeds/files.rake +0 -16
- data/lib/tasks/hd.rake +2 -0
- data/lib/tasks/ods.rake +10 -0
- data/spec/factories/feeds/file.rb +0 -4
- data/spec/factories/feeds/file_types.rb +2 -7
- data/spec/factories/hd/hd_session_document.rb +2 -0
- data/spec/factories/system/api_logs.rb +19 -0
- data/spec/support/pathology_spec_helper.rb +12 -8
- data/vendor/assets/javascripts/renalware/double_scroll.js +128 -0
- metadata +23 -9
- data/app/models/renalware/feeds/files/practices/convert_xml_to_csv.rb +0 -153
- data/app/models/renalware/feeds/files/practices/country_map.rb +0 -36
- data/app/models/renalware/feeds/files/practices/csv_file.rb +0 -25
- data/app/models/renalware/feeds/files/practices/csv_organisation.rb +0 -37
- data/app/models/renalware/feeds/files/practices/import_csv.rb +0 -32
- data/app/models/renalware/feeds/files/practices/import_job.rb +0 -61
- data/app/models/renalware/feeds/files/practices/xml_parser.rb +0 -102
data/lib/document/enum.rb
CHANGED
data/lib/renalware/version.rb
CHANGED
data/lib/tasks/feeds/files.rake
CHANGED
@@ -2,22 +2,6 @@
|
|
2
2
|
begin
|
3
3
|
namespace :feeds do
|
4
4
|
namespace :files do
|
5
|
-
# TODO: For some reason this is not showing up doing a rake -T
|
6
|
-
# Test file at = "/Users/tim/Downloads/hscorgrefdataxml_data_1.0.1_20170526000001.zip"
|
7
|
-
desc "Import Practices from a zip file downloaded from "\
|
8
|
-
"https://isd.digital.nhs.uk/trud3/user/authenticated/group/0/pack/5/subpack/341/releases " \
|
9
|
-
"Note: if using zsh, you must escape the brackets around the argument when calling "\
|
10
|
-
"e.g. "\
|
11
|
-
"`$ RAILS_LOG_TO_STDOUT=1 bundle exec rake app:feeds:files:import_practices\[/Users/me/x/w/z.zip\]`"
|
12
|
-
task :import_practices, [:absolute_zip_file_path] => [:environment] do |task, args|
|
13
|
-
file = Renalware::Feeds::File.build(
|
14
|
-
location: args.fetch(:absolute_zip_file_path),
|
15
|
-
file_type: :practices
|
16
|
-
)
|
17
|
-
file.save!
|
18
|
-
Renalware::Feeds::Files::Practices::ImportJob.perform_now(file)
|
19
|
-
end
|
20
|
-
|
21
5
|
# TEST_ZIP_FILE_PATH = "/Users/tim/Downloads/hscorgrefdataxml_data_1.0.1_20170526000001.zip"
|
22
6
|
desc "Import GPs"
|
23
7
|
# Test file at "/Users/tim/Downloads/nhs_odsweekly_6.2.0_20170615000001.zip"
|
data/lib/tasks/hd.rake
CHANGED
data/lib/tasks/ods.rake
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "nhs_api_client"
|
4
|
+
|
5
|
+
namespace :ods do
|
6
|
+
desc "Use the NHS Organisation Data Service (ODS) API to fetch updates to practices and GPs"
|
7
|
+
task sync: :environment do
|
8
|
+
Renalware::Patients::SyncODSJob.perform_later(dry_run: ENV["dry_run"] == "true")
|
9
|
+
end
|
10
|
+
end
|
@@ -5,10 +5,6 @@ FactoryBot.define do
|
|
5
5
|
association :file_type, factory: :feed_file_type
|
6
6
|
accountable
|
7
7
|
|
8
|
-
trait :practices do
|
9
|
-
association :file_type, factory: %i(feed_file_type practices)
|
10
|
-
end
|
11
|
-
|
12
8
|
trait :primary_care_physicians do
|
13
9
|
association :file_type, factory: %i(feed_file_type primary_care_physicians)
|
14
10
|
end
|
@@ -2,15 +2,10 @@
|
|
2
2
|
|
3
3
|
FactoryBot.define do
|
4
4
|
factory :feed_file_type, class: "Renalware::Feeds::FileType" do
|
5
|
-
name { "
|
6
|
-
description { "Import
|
5
|
+
name { "PrimaryCarePhysicians" }
|
6
|
+
description { "Import GPs" }
|
7
7
|
prompt { "Where to get the file etc" }
|
8
8
|
|
9
|
-
trait :practices do
|
10
|
-
name { "Practices" }
|
11
|
-
description { "Import practices" }
|
12
|
-
end
|
13
|
-
|
14
9
|
trait :primary_care_physicians do
|
15
10
|
name { "GPs" }
|
16
11
|
description { "Import GPs" }
|
@@ -54,6 +54,7 @@ FactoryBot.define do
|
|
54
54
|
weight { 100.0 }
|
55
55
|
bm_stix { 1.0 }
|
56
56
|
temperature { 36.0 }
|
57
|
+
respiratory_rate { 20.0 }
|
57
58
|
blood_pressure factory: :blood_pressure, strategy: :marshal_dump
|
58
59
|
end
|
59
60
|
|
@@ -62,6 +63,7 @@ FactoryBot.define do
|
|
62
63
|
weight { 99.0 }
|
63
64
|
bm_stix { 0.9 }
|
64
65
|
temperature { 35.0 }
|
66
|
+
respiratory_rate { 25.0 }
|
65
67
|
blood_pressure factory: :blood_pressure, strategy: :marshal_dump
|
66
68
|
end
|
67
69
|
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
FactoryBot.define do
|
4
|
+
factory :api_log, class: "Renalware::System::APILog" do
|
5
|
+
identifier { "A1"}
|
6
|
+
|
7
|
+
trait :done do
|
8
|
+
status { Renalware::System::APILog::STATUS_DONE }
|
9
|
+
end
|
10
|
+
|
11
|
+
trait :working do
|
12
|
+
status { Renalware::System::APILog::STATUS_WORKING }
|
13
|
+
end
|
14
|
+
|
15
|
+
trait :error do
|
16
|
+
status { Renalware::System::APILog::STATUS_ERROR }
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -25,7 +25,9 @@ module PathologySpecHelper
|
|
25
25
|
obx_codes: ["OBX1"],
|
26
26
|
requested_at: 1.year.ago,
|
27
27
|
patient:,
|
28
|
-
created_at: nil
|
28
|
+
created_at: nil,
|
29
|
+
count: 1,
|
30
|
+
result: "1.1")
|
29
31
|
request_desc = create(:pathology_request_description, code: obr_code)
|
30
32
|
create(
|
31
33
|
:pathology_observation_request,
|
@@ -37,13 +39,15 @@ module PathologySpecHelper
|
|
37
39
|
).tap do |request|
|
38
40
|
obx_codes.each do |obx_code|
|
39
41
|
description = create(:pathology_observation_description, code: obx_code)
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
42
|
+
(1..count).each do |num|
|
43
|
+
create(
|
44
|
+
:pathology_observation,
|
45
|
+
request: request,
|
46
|
+
description: description,
|
47
|
+
observed_at: num.years.ago,
|
48
|
+
result: result
|
49
|
+
)
|
50
|
+
end
|
47
51
|
end
|
48
52
|
end
|
49
53
|
end
|
@@ -0,0 +1,128 @@
|
|
1
|
+
/*
|
2
|
+
* @name DoubleScroll
|
3
|
+
* @desc displays scroll bar on top and on the bottom of the div
|
4
|
+
* @requires jQuery
|
5
|
+
*
|
6
|
+
* @author Pawel Suwala - http://suwala.eu/
|
7
|
+
* @author Antoine Vianey - http://www.astek.fr/
|
8
|
+
* @version 0.5 (11-11-2015)
|
9
|
+
*
|
10
|
+
* Dual licensed under the MIT and GPL licenses:
|
11
|
+
* http://www.opensource.org/licenses/mit-license.php
|
12
|
+
* http://www.gnu.org/licenses/gpl.html
|
13
|
+
*
|
14
|
+
* Usage:
|
15
|
+
* https://github.com/avianey/jqDoubleScroll
|
16
|
+
*/
|
17
|
+
(function( $ ) {
|
18
|
+
|
19
|
+
jQuery.fn.doubleScroll = function(userOptions) {
|
20
|
+
|
21
|
+
// Default options
|
22
|
+
var options = {
|
23
|
+
contentElement: undefined, // Widest element, if not specified first child element will be used
|
24
|
+
scrollCss: {
|
25
|
+
'overflow-x': 'auto',
|
26
|
+
'overflow-y': 'hidden',
|
27
|
+
'height': '20px'
|
28
|
+
},
|
29
|
+
contentCss: {
|
30
|
+
'overflow-x': 'auto',
|
31
|
+
'overflow-y': 'hidden'
|
32
|
+
},
|
33
|
+
onlyIfScroll: true, // top scrollbar is not shown if the bottom one is not present
|
34
|
+
resetOnWindowResize: false, // recompute the top ScrollBar requirements when the window is resized
|
35
|
+
timeToWaitForResize: 30 // wait for the last update event (usefull when browser fire resize event constantly during ressing)
|
36
|
+
};
|
37
|
+
|
38
|
+
$.extend(true, options, userOptions);
|
39
|
+
|
40
|
+
// do not modify
|
41
|
+
// internal stuff
|
42
|
+
$.extend(options, {
|
43
|
+
topScrollBarMarkup: '<div class="doubleScroll-scroll-wrapper"><div class="doubleScroll-scroll"></div></div>',
|
44
|
+
topScrollBarWrapperSelector: '.doubleScroll-scroll-wrapper',
|
45
|
+
topScrollBarInnerSelector: '.doubleScroll-scroll'
|
46
|
+
});
|
47
|
+
|
48
|
+
var _showScrollBar = function($self, options) {
|
49
|
+
|
50
|
+
if (options.onlyIfScroll && $self.get(0).scrollWidth <= $self.width()) {
|
51
|
+
// content doesn't scroll
|
52
|
+
// remove any existing occurrence...
|
53
|
+
$self.prev(options.topScrollBarWrapperSelector).remove();
|
54
|
+
return;
|
55
|
+
}
|
56
|
+
|
57
|
+
// add div that will act as an upper scroll only if not already added to the DOM
|
58
|
+
var $topScrollBar = $self.prev(options.topScrollBarWrapperSelector);
|
59
|
+
|
60
|
+
if ($topScrollBar.length == 0) {
|
61
|
+
|
62
|
+
// creating the scrollbar
|
63
|
+
// added before in the DOM
|
64
|
+
$topScrollBar = $(options.topScrollBarMarkup);
|
65
|
+
$self.before($topScrollBar);
|
66
|
+
|
67
|
+
// apply the css
|
68
|
+
$topScrollBar.css(options.scrollCss);
|
69
|
+
$(options.topScrollBarInnerSelector).css("height", "20px");
|
70
|
+
$self.css(options.contentCss);
|
71
|
+
|
72
|
+
// bind upper scroll to bottom scroll
|
73
|
+
$topScrollBar.bind('scroll.doubleScroll', function() {
|
74
|
+
$self.scrollLeft($topScrollBar.scrollLeft());
|
75
|
+
});
|
76
|
+
|
77
|
+
// bind bottom scroll to upper scroll
|
78
|
+
var selfScrollHandler = function() {
|
79
|
+
$topScrollBar.scrollLeft($self.scrollLeft());
|
80
|
+
};
|
81
|
+
$self.bind('scroll.doubleScroll', selfScrollHandler);
|
82
|
+
}
|
83
|
+
|
84
|
+
// find the content element (should be the widest one)
|
85
|
+
var $contentElement;
|
86
|
+
|
87
|
+
if (options.contentElement !== undefined && $self.find(options.contentElement).length !== 0) {
|
88
|
+
$contentElement = $self.find(options.contentElement);
|
89
|
+
} else {
|
90
|
+
$contentElement = $self.find('>:first-child');
|
91
|
+
}
|
92
|
+
|
93
|
+
// set the width of the wrappers
|
94
|
+
$(options.topScrollBarInnerSelector, $topScrollBar).width($contentElement.outerWidth());
|
95
|
+
$topScrollBar.width($self.width());
|
96
|
+
$topScrollBar.scrollLeft($self.scrollLeft());
|
97
|
+
|
98
|
+
}
|
99
|
+
|
100
|
+
return this.each(function() {
|
101
|
+
|
102
|
+
var $self = $(this);
|
103
|
+
|
104
|
+
_showScrollBar($self, options);
|
105
|
+
|
106
|
+
// bind the resize handler
|
107
|
+
// do it once
|
108
|
+
if (options.resetOnWindowResize) {
|
109
|
+
|
110
|
+
var id;
|
111
|
+
var handler = function(e) {
|
112
|
+
_showScrollBar($self, options);
|
113
|
+
};
|
114
|
+
|
115
|
+
$(window).bind('resize.doubleScroll', function() {
|
116
|
+
// adding/removing/replacing the scrollbar might resize the window
|
117
|
+
// so the resizing flag will avoid the infinite loop here...
|
118
|
+
clearTimeout(id);
|
119
|
+
id = setTimeout(handler, options.timeToWaitForResize);
|
120
|
+
});
|
121
|
+
|
122
|
+
}
|
123
|
+
|
124
|
+
});
|
125
|
+
|
126
|
+
}
|
127
|
+
|
128
|
+
}( jQuery ));
|
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.79
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Airslie
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-06-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: active_type
|
@@ -987,6 +987,7 @@ files:
|
|
987
987
|
- app/assets/javascripts/renalware/full_screen.js
|
988
988
|
- app/assets/javascripts/renalware/iframe.js
|
989
989
|
- app/assets/javascripts/renalware/keyboard_shortcuts.js
|
990
|
+
- app/assets/javascripts/renalware/layout.js
|
990
991
|
- app/assets/javascripts/renalware/letters.js
|
991
992
|
- app/assets/javascripts/renalware/masonry.run.js
|
992
993
|
- app/assets/javascripts/renalware/messaging.js
|
@@ -1448,13 +1449,6 @@ files:
|
|
1448
1449
|
- app/models/renalware/feeds/files/import_job_factory.rb
|
1449
1450
|
- app/models/renalware/feeds/files/practice_memberships/import_csv.rb
|
1450
1451
|
- app/models/renalware/feeds/files/practice_memberships/import_job.rb
|
1451
|
-
- app/models/renalware/feeds/files/practices/convert_xml_to_csv.rb
|
1452
|
-
- app/models/renalware/feeds/files/practices/country_map.rb
|
1453
|
-
- app/models/renalware/feeds/files/practices/csv_file.rb
|
1454
|
-
- app/models/renalware/feeds/files/practices/csv_organisation.rb
|
1455
|
-
- app/models/renalware/feeds/files/practices/import_csv.rb
|
1456
|
-
- app/models/renalware/feeds/files/practices/import_job.rb
|
1457
|
-
- app/models/renalware/feeds/files/practices/xml_parser.rb
|
1458
1452
|
- app/models/renalware/feeds/files/primary_care_physicians/import_csv.rb
|
1459
1453
|
- app/models/renalware/feeds/files/primary_care_physicians/import_job.rb
|
1460
1454
|
- app/models/renalware/feeds/files/tissue_typing/import.rb
|
@@ -1696,6 +1690,7 @@ files:
|
|
1696
1690
|
- app/models/renalware/patients/ethnicity.rb
|
1697
1691
|
- app/models/renalware/patients/idempotent_create_patient.rb
|
1698
1692
|
- app/models/renalware/patients/language.rb
|
1693
|
+
- app/models/renalware/patients/last_successful_practice_sync_date_query.rb
|
1699
1694
|
- app/models/renalware/patients/mdm_list_query.rb
|
1700
1695
|
- app/models/renalware/patients/mdm_patients_query.rb
|
1701
1696
|
- app/models/renalware/patients/message_param_parser.rb
|
@@ -1711,6 +1706,9 @@ files:
|
|
1711
1706
|
- app/models/renalware/patients/search_form.rb
|
1712
1707
|
- app/models/renalware/patients/search_query.rb
|
1713
1708
|
- app/models/renalware/patients/summary.rb
|
1709
|
+
- app/models/renalware/patients/sync_gps_via_file_download_job.rb
|
1710
|
+
- app/models/renalware/patients/sync_ods_job.rb
|
1711
|
+
- app/models/renalware/patients/sync_practices_via_api.rb
|
1714
1712
|
- app/models/renalware/patients/user.rb
|
1715
1713
|
- app/models/renalware/patients/version.rb
|
1716
1714
|
- app/models/renalware/patients/worry.rb
|
@@ -1779,6 +1777,7 @@ files:
|
|
1779
1777
|
- app/models/renalware/snippets/snippet_query.rb
|
1780
1778
|
- app/models/renalware/snippets/user.rb
|
1781
1779
|
- app/models/renalware/system.rb
|
1780
|
+
- app/models/renalware/system/api_log.rb
|
1782
1781
|
- app/models/renalware/system/country.rb
|
1783
1782
|
- app/models/renalware/system/download.rb
|
1784
1783
|
- app/models/renalware/system/download_query.rb
|
@@ -1919,6 +1918,7 @@ files:
|
|
1919
1918
|
- app/presenters/renalware/admin/users/summary_part.rb
|
1920
1919
|
- app/presenters/renalware/admissions/admission_presenter.rb
|
1921
1920
|
- app/presenters/renalware/admissions/consult_presenter.rb
|
1921
|
+
- app/presenters/renalware/admissions/consult_summary_part.rb
|
1922
1922
|
- app/presenters/renalware/admissions/summary_part.rb
|
1923
1923
|
- app/presenters/renalware/clinical/dry_weight_presenter.rb
|
1924
1924
|
- app/presenters/renalware/clinical/dry_weights_presenter.rb
|
@@ -2004,6 +2004,7 @@ files:
|
|
2004
2004
|
- app/presenters/renalware/ukrdc/pathology_observation_presenter.rb
|
2005
2005
|
- app/presenters/renalware/ukrdc/pathology_observation_request_presenter.rb
|
2006
2006
|
- app/presenters/renalware/ukrdc/patient_presenter.rb
|
2007
|
+
- app/presenters/renalware/virology/dashboard_presenter.rb
|
2007
2008
|
- app/presenters/string_presenter.rb
|
2008
2009
|
- app/presenters/time_presenter.rb
|
2009
2010
|
- app/presenters/true_class_presenter.rb
|
@@ -2018,6 +2019,7 @@ files:
|
|
2018
2019
|
- app/validators/renalware/patients/height_validator.rb
|
2019
2020
|
- app/validators/renalware/patients/primary_care_physicians/address_validator.rb
|
2020
2021
|
- app/validators/renalware/patients/pulse_validator.rb
|
2022
|
+
- app/validators/renalware/patients/respiratory_rate_validator.rb
|
2021
2023
|
- app/validators/renalware/patients/temperature_validator.rb
|
2022
2024
|
- app/validators/renalware/patients/weight_validator.rb
|
2023
2025
|
- app/values/renalware/address.rb
|
@@ -2077,6 +2079,7 @@ files:
|
|
2077
2079
|
- app/views/renalware/admissions/consults/_filters.html.slim
|
2078
2080
|
- app/views/renalware/admissions/consults/_filters.pdf.slim
|
2079
2081
|
- app/views/renalware/admissions/consults/_form.html.slim
|
2082
|
+
- app/views/renalware/admissions/consults/_summary_part.html.slim
|
2080
2083
|
- app/views/renalware/admissions/consults/_table.html.slim
|
2081
2084
|
- app/views/renalware/admissions/consults/_table.pdf.slim
|
2082
2085
|
- app/views/renalware/admissions/consults/edit.html.slim
|
@@ -2853,6 +2856,7 @@ files:
|
|
2853
2856
|
- app/views/renalware/ukrdc/summary_mailer/export_summary.html.slim
|
2854
2857
|
- app/views/renalware/ukrdc/summary_mailer/export_summary.text.erb
|
2855
2858
|
- app/views/renalware/virology/dashboards/_actions.html.slim
|
2859
|
+
- app/views/renalware/virology/dashboards/_latest_hep_b_antibody_statuses.html.slim
|
2856
2860
|
- app/views/renalware/virology/dashboards/show.html.slim
|
2857
2861
|
- app/views/renalware/virology/profiles/_summary.html.slim
|
2858
2862
|
- app/views/renalware/virology/profiles/edit.html.slim
|
@@ -3029,6 +3033,7 @@ files:
|
|
3029
3033
|
- db/functions/import_gps_csv_v01.sql
|
3030
3034
|
- db/functions/import_practice_memberships_csv_v01.sql
|
3031
3035
|
- db/functions/import_practice_memberships_csv_v02.sql
|
3036
|
+
- db/functions/import_practice_memberships_csv_v03.sql
|
3032
3037
|
- db/functions/import_practices_csv_v01.sql
|
3033
3038
|
- db/functions/new_hl7_message_v01.sql
|
3034
3039
|
- db/functions/preprocess_hl7_message_v01.sql
|
@@ -3467,6 +3472,12 @@ files:
|
|
3467
3472
|
- db/migrate/20190513131826_add_view_count_to_system_help.rb
|
3468
3473
|
- db/migrate/20190513135312_create_pathology_code_groups.rb
|
3469
3474
|
- db/migrate/20190516093707_add_graft_nephectomy_on_to_tx_op_followup.rb
|
3475
|
+
- db/migrate/20190531172829_add_last_change_date_to_patient_practices.rb
|
3476
|
+
- db/migrate/20190602114659_create_system_api_logs.rb
|
3477
|
+
- db/migrate/20190603084428_add_pages_to_system_api_logs.rb
|
3478
|
+
- db/migrate/20190603135247_add_columns_to_patient_primary_care_physicians.rb
|
3479
|
+
- db/migrate/20190603143834_update_import_practice_memberships_csv.rb
|
3480
|
+
- db/migrate/20190603165812_drop_import_practices_csv_function.rb
|
3470
3481
|
- db/seeds.rb
|
3471
3482
|
- db/seeds/default/accesses/access_pd_catheter_insertion_techniques.csv
|
3472
3483
|
- db/seeds/default/accesses/access_pd_catheter_insertion_techniques.rb
|
@@ -3638,6 +3649,7 @@ files:
|
|
3638
3649
|
- lib/tasks/db.rake
|
3639
3650
|
- lib/tasks/feeds/files.rake
|
3640
3651
|
- lib/tasks/hd.rake
|
3652
|
+
- lib/tasks/ods.rake
|
3641
3653
|
- lib/tasks/pathology.rake
|
3642
3654
|
- lib/tasks/reporting.rake
|
3643
3655
|
- lib/tasks/ukrdc.rake
|
@@ -3772,6 +3784,7 @@ files:
|
|
3772
3784
|
- spec/factories/snippets/snippets.rb
|
3773
3785
|
- spec/factories/snippets/users.rb
|
3774
3786
|
- spec/factories/system/addresses.rb
|
3787
|
+
- spec/factories/system/api_logs.rb
|
3775
3788
|
- spec/factories/system/countries.rb
|
3776
3789
|
- spec/factories/system/downloads.rb
|
3777
3790
|
- spec/factories/system/feedback.rb
|
@@ -3821,6 +3834,7 @@ files:
|
|
3821
3834
|
- spec/support/translations.rb
|
3822
3835
|
- spec/support/travel.rb
|
3823
3836
|
- spec/support/webmock.rb
|
3837
|
+
- vendor/assets/javascripts/renalware/double_scroll.js
|
3824
3838
|
- vendor/assets/javascripts/renalware/iframeResizer.contentWindow.js
|
3825
3839
|
- vendor/assets/javascripts/renalware/iframeResizer.js
|
3826
3840
|
- vendor/assets/javascripts/renalware/jquery-readyselector.js
|
@@ -1,153 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require_dependency "renalware/feeds"
|
4
|
-
|
5
|
-
module Renalware
|
6
|
-
module Feeds
|
7
|
-
module Files
|
8
|
-
module Practices
|
9
|
-
class ConvertXmlToCsv
|
10
|
-
PRACTICE_ROLES = %w(RO177 RO76).freeze
|
11
|
-
|
12
|
-
def self.call(xml_path)
|
13
|
-
new.call(xml_path)
|
14
|
-
end
|
15
|
-
|
16
|
-
# Returns path to converted CSV file
|
17
|
-
def call(xml_path)
|
18
|
-
create_practice_csv_from_organisation_xml(xml_path)
|
19
|
-
end
|
20
|
-
|
21
|
-
private
|
22
|
-
|
23
|
-
def create_practice_csv_from_organisation_xml(xml_path)
|
24
|
-
file = CSVFile.new(dir: xml_path.dirname).create do |csv_writer|
|
25
|
-
build_practice_csv_from_organisation_xml(xml_path, csv_writer)
|
26
|
-
end
|
27
|
-
Pathname(file)
|
28
|
-
end
|
29
|
-
|
30
|
-
# While processing the XML using the Nokogiri Read API (wrapper by our XmlParser class)
|
31
|
-
# the memory footprint of the app does not rise which is the important thing here as the
|
32
|
-
# HSCorg XML file is around 400MB. This because we have not loaded the
|
33
|
-
# XML into memory (which would cause memory usage to spike over 1GB) but instead
|
34
|
-
# are walking over the elements. Its slower than SAX which is an alternative, as we have
|
35
|
-
# to inspect every Organisation in in the file even though we only want a subset of them,
|
36
|
-
# but its very easy to read.
|
37
|
-
# Currently takes around 3 minutes as a background job.
|
38
|
-
# Be careful when handling elements that can appear in > 1 place - e.g. Status - and
|
39
|
-
# check the @node.depth.
|
40
|
-
#
|
41
|
-
# There are alternative ways to parse the XML. TRUD provide an XSLT style-sheet which can
|
42
|
-
# extract orgs with a specific primary role (RO76 in our case) to build another XML
|
43
|
-
# document; they provide another XSLT for parsing the XML into CSV files. However they
|
44
|
-
# split the CSV files (a separate one for contact details for example), and do not not
|
45
|
-
# run on Mac/Linux without modification (they expect to be run on Windows).
|
46
|
-
#
|
47
|
-
# Note that the Countries in the file (with current org counts) are as follows:
|
48
|
-
# - ENGLAND (178568)
|
49
|
-
# - WALES (7013)
|
50
|
-
# - SCOTLAND (95)
|
51
|
-
# - NORTHERN IRELAND (19)
|
52
|
-
# - CHANNEL ISLANDS (57)
|
53
|
-
# - ISLE OF MAN (169)
|
54
|
-
#
|
55
|
-
# We must map the first 4 to "United Kingdom", and store e.g. Wales in address.region
|
56
|
-
# The others are genuine countries and left as such
|
57
|
-
#
|
58
|
-
# rubocop:disable Metrics/MethodLength, Metrics/AbcSize, Metrics/PerceivedComplexity
|
59
|
-
# rubocop:disable Metrics/CyclomaticComplexity
|
60
|
-
def build_practice_csv_from_organisation_xml(xml_path, csv_writer)
|
61
|
-
Rails.logger.warn "Converting XML to CSV"
|
62
|
-
practices_count = 0
|
63
|
-
regions = Hash.new(0)
|
64
|
-
# uk = System::Country.find_by(alpha3: "GBR")
|
65
|
-
countries = System::Country.all
|
66
|
-
|
67
|
-
XmlParser.new(Nokogiri::XML::Reader(open(xml_path))) do
|
68
|
-
org = CSVOrganisation.new
|
69
|
-
org.roles = []
|
70
|
-
|
71
|
-
direct_child_of_org_element = -> { @node.depth == 3 }
|
72
|
-
|
73
|
-
inside_element "Organisation" do
|
74
|
-
for_element "Name" do org.name = inner_xml end
|
75
|
-
|
76
|
-
for_element "Status" do
|
77
|
-
# We need to check the depth of this Status element: if it is 3 we are directly
|
78
|
-
# under the Organisation so that's good. Otherwise we are deeper in, probably a
|
79
|
-
# role status, so ignore those.
|
80
|
-
if direct_child_of_org_element.call
|
81
|
-
org.active = attribute("value")&.downcase == "active"
|
82
|
-
end
|
83
|
-
end
|
84
|
-
|
85
|
-
# Be sure not to pick up OrgId nodes under e.g. Target
|
86
|
-
for_element "OrgId" do
|
87
|
-
if direct_child_of_org_element.call
|
88
|
-
org.code = attribute("extension")
|
89
|
-
end
|
90
|
-
end
|
91
|
-
|
92
|
-
inside_element "Contacts" do
|
93
|
-
for_element "Contact" do
|
94
|
-
org.telephone = attribute("value") if @node.attribute("type") == "tel"
|
95
|
-
end
|
96
|
-
end
|
97
|
-
inside_element "GeoLoc" do
|
98
|
-
inside_element "Location" do
|
99
|
-
for_element "AddrLn1" do org.street_1 = inner_xml end
|
100
|
-
for_element "AddrLn2" do org.street_2 = inner_xml end
|
101
|
-
for_element "AddrLn3" do org.street_3 = inner_xml end
|
102
|
-
for_element "Town" do org.city = inner_xml end
|
103
|
-
for_element "County" do org.county = inner_xml end
|
104
|
-
for_element "PostCode" do org.postcode = inner_xml end
|
105
|
-
for_element "Country" do
|
106
|
-
country_name = inner_xml
|
107
|
-
|
108
|
-
CountryMap.new.map(country_name).tap do |mapped|
|
109
|
-
org.region = mapped.region
|
110
|
-
found_country = countries.find_by(name: mapped.country)
|
111
|
-
if found_country.blank?
|
112
|
-
Rails.logger.warn("#{country_name} not mapped")
|
113
|
-
org.skip = true
|
114
|
-
org.region = country_name
|
115
|
-
# raise(CountryNotFoundError, country_name)
|
116
|
-
else
|
117
|
-
org.country_id = found_country.id
|
118
|
-
end
|
119
|
-
end
|
120
|
-
end
|
121
|
-
end
|
122
|
-
end
|
123
|
-
inside_element "Roles" do
|
124
|
-
for_element "Role" do org.roles << @node.attribute("id") end
|
125
|
-
end
|
126
|
-
end
|
127
|
-
|
128
|
-
if (PRACTICE_ROLES & org.roles).any?
|
129
|
-
fail unless org.code&.length == 6
|
130
|
-
|
131
|
-
practices_count += 1
|
132
|
-
if org.skip
|
133
|
-
Rails.logger.warn(
|
134
|
-
"Not importing practice, probably because country country_name not found. "\
|
135
|
-
"#{org}"
|
136
|
-
)
|
137
|
-
else
|
138
|
-
csv_writer << org.to_a
|
139
|
-
end
|
140
|
-
end
|
141
|
-
end
|
142
|
-
Rails.logger.warn "Found regions #{regions}"
|
143
|
-
Rails.logger.warn "Found #{practices_count} practices with role RO76"
|
144
|
-
end
|
145
|
-
|
146
|
-
class CountryNotFoundError < StandardError; end
|
147
|
-
end
|
148
|
-
# rubocop:enable Metrics/MethodLength, Metrics/AbcSize, Metrics/PerceivedComplexity
|
149
|
-
# rubocop:enable Metrics/CyclomaticComplexity
|
150
|
-
end
|
151
|
-
end
|
152
|
-
end
|
153
|
-
end
|