renalware-core 2.0.113 → 2.0.115
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/Rakefile +0 -2
- data/app/assets/javascripts/renalware/application.js.erb +0 -1
- data/app/assets/javascripts/renalware/feed_only_inputs.js.erb +26 -0
- data/app/assets/javascripts/renalware/feeds.js +50 -0
- data/app/assets/javascripts/renalware/person_ajax_search.js +43 -0
- data/app/assets/stylesheets/renalware/application.scss +0 -1
- data/app/assets/stylesheets/renalware/modules/_admin.scss +7 -0
- data/app/assets/stylesheets/renalware/modules/_pathology.scss +1 -1
- data/app/assets/stylesheets/renalware/modules/_patients.scss +6 -0
- data/app/assets/stylesheets/renalware/modules/_snippets.scss +2 -2
- data/app/assets/stylesheets/renalware/partials/_forms.scss +5 -1
- data/app/assets/stylesheets/renalware/partials/_layout.scss +4 -0
- data/app/{views/renalware/patients/_side_menu.html.slim → components/renalware/patients/side_menu_component.html.slim} +0 -0
- data/app/components/renalware/patients/side_menu_component.rb +18 -0
- data/app/controllers/renalware/clinical/body_compositions_controller.rb +6 -0
- data/app/controllers/renalware/feeds/hl7_test_messages_controller.rb +60 -0
- data/app/controllers/renalware/hd/mdm_patients_controller.rb +16 -6
- data/app/controllers/renalware/hd/scheduling/diaries_controller.rb +91 -0
- data/app/controllers/renalware/hd/scheduling/diary_slots_controller.rb +169 -0
- data/app/controllers/renalware/hd/session_forms/batches_controller.rb +1 -1
- data/app/controllers/renalware/pathology/observation_requests_controller.rb +23 -4
- data/app/controllers/renalware/pathology/requests/requests_controller.rb +0 -4
- data/app/controllers/renalware/patients/abridgements_controller.rb +39 -0
- data/app/controllers/renalware/pd/regimes_controller.rb +26 -0
- data/app/controllers/renalware/problems/problems_controller.rb +2 -2
- data/app/helpers/renalware/application_helper.rb +9 -0
- data/app/helpers/renalware/article_helper.rb +18 -0
- data/app/helpers/renalware/form_helper.rb +3 -2
- data/app/helpers/renalware/users_helper.rb +5 -1
- data/app/javascript/controllers/clipboard_controller.js +16 -0
- data/app/javascript/packs/renalware_core.js +20 -0
- data/app/jobs/feed_job.rb +1 -3
- data/app/jobs/hl7_message_example.yml +2 -2
- data/app/models/renalware/feeds/files/practice_memberships/import_job.rb +3 -0
- data/app/models/renalware/feeds/files/primary_care_physicians/import_job.rb +2 -0
- data/app/models/renalware/feeds/hl7_message.rb +57 -6
- data/app/models/renalware/feeds/hl7_test_form.rb +10 -0
- data/app/models/renalware/feeds/hl7_test_message.rb +11 -0
- data/app/models/renalware/feeds/message_parser.rb +6 -2
- data/app/models/renalware/feeds/message_processor.rb +44 -32
- data/app/models/renalware/feeds/persist_message.rb +9 -3
- data/app/models/renalware/feeds.rb +2 -0
- data/app/models/renalware/hd/scheduling/archive_arguments.rb +19 -0
- data/app/models/renalware/hd/scheduling/diary.rb +54 -0
- data/app/models/renalware/hd/scheduling/diary_housekeeping_job.rb +84 -0
- data/app/models/renalware/hd/scheduling/diary_range.rb +69 -0
- data/app/models/renalware/hd/scheduling/diary_slot.rb +88 -0
- data/app/models/renalware/hd/scheduling/find_or_create_diary_by_week_query.rb +52 -0
- data/app/models/renalware/hd/scheduling/find_or_create_master_diary.rb +27 -0
- data/app/models/renalware/hd/scheduling/master_diary.rb +35 -0
- data/app/models/renalware/hd/scheduling/weekly_diary.rb +47 -0
- data/app/models/renalware/pathology/message_listener.rb +2 -2
- data/app/models/renalware/pathology/requests/global_rule/latest_crf_older_than_weeks.rb +38 -0
- data/app/models/renalware/pathology/requests/global_rule/patient_is_diabetic.rb +1 -1
- data/app/models/renalware/patient.rb +1 -1
- data/app/models/renalware/patients/abridgement.rb +18 -0
- data/app/models/renalware/patients/abridgement_search_form.rb +12 -0
- data/app/models/renalware/patients/ingestion/command.rb +25 -0
- data/app/models/renalware/patients/ingestion/command_factory.rb +135 -0
- data/app/models/renalware/patients/ingestion/commands/add_or_update_patient.rb +65 -0
- data/app/models/renalware/patients/ingestion/message_listener.rb +21 -0
- data/app/models/renalware/patients/ingestion/message_mapper.rb +26 -0
- data/app/models/renalware/patients/ingestion/message_mappers/patient.rb +73 -0
- data/app/models/renalware/patients/ingestion/update_master_patient_index.rb +60 -0
- data/app/models/renalware/patients/ingestion/update_master_patient_index_job.rb.dead +20 -0
- data/app/models/renalware/patients.rb +4 -3
- data/app/models/renalware/problems/problem.rb +6 -2
- data/app/models/renalware/ukrdc/incoming/paths.rb +6 -7
- data/app/policies/renalware/admin/devops_policy.rb +18 -0
- data/app/policies/renalware/hd/{diary_policy.rb → scheduling/diary_policy.rb} +3 -1
- data/app/presenters/renalware/clinical/profile_presenter.rb +2 -1
- data/app/presenters/renalware/directory/person_auto_complete_presenter.rb +1 -1
- data/app/presenters/renalware/hd/scheduling/diary_presenter.rb +84 -0
- data/app/presenters/renalware/hd/scheduling/diary_slot_presenter.rb +74 -0
- data/app/presenters/renalware/hd/scheduling/null_slot.rb +42 -0
- data/app/presenters/renalware/pd/dashboard_presenter.rb +3 -2
- data/app/views/renalware/accesses/procedures/_form.html.slim +5 -1
- data/app/views/renalware/accesses/procedures/_list.html.slim +11 -4
- data/app/views/renalware/accesses/procedures/show.html.slim +17 -19
- data/app/views/renalware/addresses/_form.html.slim +17 -12
- data/app/views/renalware/admin/cache/show.html.slim +24 -0
- data/app/views/renalware/clinical/body_compositions/_list.html.slim +7 -43
- data/app/views/renalware/clinical/body_compositions/_table.html.slim +42 -0
- data/app/views/renalware/clinical/body_compositions/index.html.slim +9 -0
- data/app/views/renalware/clinical/dry_weights/_list.html.slim +2 -8
- data/app/views/renalware/clinical/dry_weights/_table.html.slim +7 -0
- data/app/views/renalware/clinical/profiles/show.html.slim +4 -2
- data/app/views/renalware/feeds/hl7_test_messages/create.js.erb +10 -0
- data/app/views/renalware/feeds/hl7_test_messages/new.slim +18 -0
- data/app/views/renalware/hd/mdm_patients/_filters.html.slim +0 -11
- data/app/views/renalware/hd/mdm_patients/_page_actions.html.slim +29 -0
- data/app/views/renalware/hd/mdm_patients/index.html.slim +7 -4
- data/app/views/renalware/hd/{diaries → scheduling/diaries}/_page_actions.html.slim +4 -4
- data/app/views/renalware/hd/{diaries → scheduling/diaries}/_table.html.slim +0 -0
- data/app/views/renalware/hd/{diaries → scheduling/diaries}/_weekly_diary.html.slim +1 -1
- data/app/views/renalware/hd/{diaries → scheduling/diaries}/edit.html.slim +6 -6
- data/app/views/renalware/hd/{diaries → scheduling/diaries}/index.html.slim +0 -0
- data/app/views/renalware/hd/{diaries → scheduling/diaries}/show.pdf.slim +0 -0
- data/app/views/renalware/hd/{diary_slots → scheduling/diary_slots}/_form.html.slim +15 -6
- data/app/views/renalware/hd/{diary_slots → scheduling/diary_slots}/_slot.html.slim +2 -2
- data/app/views/renalware/hd/{diary_slots → scheduling/diary_slots}/_tab.html.slim +1 -1
- data/app/views/renalware/hd/{diary_slots → scheduling/diary_slots}/create.js.erb +1 -1
- data/app/views/renalware/hd/{diary_slots → scheduling/diary_slots}/destroy.js.erb +1 -1
- data/app/views/renalware/hd/{diary_slots → scheduling/diary_slots}/edit.html.slim +2 -2
- data/app/views/renalware/hd/{diary_slots → scheduling/diary_slots}/new.html.slim +0 -0
- data/app/views/renalware/hd/{diary_slots → scheduling/diary_slots}/new.js.erb +0 -0
- data/app/views/renalware/hd/{diary_slots → scheduling/diary_slots}/show.js.erb +0 -0
- data/app/views/renalware/hd/{diary_slots → scheduling/diary_slots}/update.js.erb +1 -1
- data/app/views/renalware/hospitals/units/index.html.slim +2 -2
- data/app/views/renalware/layouts/_patient.html.slim +2 -1
- data/app/views/renalware/letters/contacts/_form.html.slim +10 -13
- data/app/views/renalware/letters/letters/_form.html.slim +2 -9
- data/app/views/renalware/navigation/_developer.html.slim +4 -0
- data/app/views/renalware/navigation/_menu.html.slim +2 -0
- data/app/views/renalware/pathology/observation_requests/_filters.html.slim +17 -0
- data/app/views/renalware/pathology/observation_requests/index.html.slim +2 -1
- data/app/views/renalware/patients/_layout.html.slim +1 -1
- data/app/views/renalware/patients/_side_menu.html.slim.dead +7 -0
- data/app/views/renalware/patients/abridgements/_abridgement.html.slim +8 -0
- data/app/views/renalware/patients/abridgements/_table.html.slim +12 -0
- data/app/views/renalware/patients/abridgements/index.html.slim +22 -0
- data/app/views/renalware/patients/alerts/create.json +3 -0
- data/app/views/renalware/patients/patients/_form.html.slim +36 -17
- data/app/views/renalware/patients/patients/edit.html.slim +1 -1
- data/app/views/renalware/patients/patients/new.html.slim +1 -1
- data/app/views/renalware/patients/side_menu/_actions.html.slim +2 -0
- data/app/views/renalware/pd/_apd_regimes.html.slim +1 -1
- data/app/views/renalware/pd/_capd_regimes.html.slim +1 -1
- data/app/views/renalware/pd/dashboards/show/_apd_regimes.html.slim +11 -2
- data/app/views/renalware/pd/dashboards/show/_capd_regimes.html.slim +11 -2
- data/app/views/renalware/pd/regimes/index.html.slim +7 -0
- data/app/views/renalware/renal/profiles/_form.html.slim +7 -24
- data/app/views/renalware/shared/documents/_binary_marker_input.html.slim +2 -2
- data/app/views/renalware/shared/documents/_blood_group_input.html.slim +4 -2
- data/app/views/renalware/transplants/registrations/_form.html.slim +22 -17
- data/config/locales/renalware/clinical/body_composition.yml +6 -3
- data/config/locales/renalware/clinical/dry_weight.en.yml +4 -3
- data/config/locales/renalware/hd/diary_slots.en.yml +3 -2
- data/config/locales/renalware/letters/contact.en.yml +0 -2
- data/config/routes/feeds.rb +5 -0
- data/config/routes/hd.rb +11 -7
- data/config/routes/letters.rb +0 -5
- data/config/routes/patients.rb +1 -0
- data/config/routes/pd.rb +2 -2
- data/config/routes/renal.rb +0 -5
- data/config/routes.rb +1 -0
- data/config/webpack/development.js +5 -0
- data/config/webpack/environment.js +3 -0
- data/config/webpack/production.js +5 -0
- data/config/webpack/test.js +5 -0
- data/config/webpacker.yml +103 -0
- data/db/functions/hd_diary_archive_elapsed_master_slots_v01.sql +40 -0
- data/db/migrate/20190322120025_create_feed_hl7_test_messages.rb +12 -0
- data/db/migrate/20190325134823_create_patients_master_index.rb +24 -0
- data/db/migrate/20190327100851_add_handled_to_feed_messages.rb +5 -0
- data/db/migrate/20191012121433_add_consultant_to_users.rb +7 -0
- data/db/migrate/20191018143635_create_hd_diary_matrix_view.rb +7 -0
- data/db/migrate/20191018144917_create_fn_to_archive_master_slots.rb +9 -0
- data/db/views/hd_diary_matrix_v01.sql +38 -0
- data/lib/core_extensions/active_record/sort.rb +27 -9
- data/lib/renalware/configuration.rb +3 -0
- data/lib/renalware/engine.rb +31 -0
- data/lib/renalware/version.rb +1 -1
- data/lib/renalware/week_period.rb +8 -7
- data/lib/renalware.rb +13 -1
- data/lib/tasks/hd.rake +7 -0
- data/lib/tasks/pathology.rake +1 -1
- data/lib/tasks/renalware.rake +89 -4
- data/spec/factories/hd/scheduling/diaries.rb +18 -0
- data/spec/factories/hd/{slots.rb → scheduling/slots.rb} +1 -1
- data/spec/factories/patients/abridgements.rb +9 -0
- data/spec/support/hl7_helpers.rb +13 -0
- data/spec/support/pages/letters/form.rb +4 -1
- metadata +126 -50
- data/app/assets/javascripts/renalware/auto_complete.js +0 -63
- data/app/controllers/renalware/hd/diaries_controller.rb +0 -89
- data/app/controllers/renalware/hd/diary_slots_controller.rb +0 -175
- data/app/controllers/renalware/letters/descriptions_controller.rb +0 -22
- data/app/controllers/renalware/renal/prd_descriptions_controller.rb +0 -15
- data/app/models/renalware/hd/archive_yesterdays_slots_job.rb +0 -69
- data/app/models/renalware/hd/diary.rb +0 -41
- data/app/models/renalware/hd/diary_slot.rb +0 -83
- data/app/models/renalware/hd/find_or_create_diary_by_week_query.rb +0 -50
- data/app/models/renalware/hd/find_or_create_master_diary.rb +0 -26
- data/app/models/renalware/hd/master_diary.rb +0 -32
- data/app/models/renalware/hd/weekly_diary.rb +0 -45
- data/app/models/renalware/renal/prd_descriptions/search_query.rb +0 -35
- data/app/presenters/renalware/hd/diary_presenter.rb +0 -79
- data/app/presenters/renalware/hd/diary_slot_presenter.rb +0 -72
- data/app/presenters/renalware/hd/null_slot.rb +0 -40
- data/app/views/renalware/renal/prd_descriptions/search.json.jbuilder +0 -6
- data/lib/test_support/autocomplete_helpers.rb +0 -14
- data/spec/factories/hd/diaries.rb +0 -14
data/config/routes/hd.rb
CHANGED
|
@@ -41,14 +41,18 @@ namespace :hd do
|
|
|
41
41
|
resources :stations do
|
|
42
42
|
post :sort, on: :collection
|
|
43
43
|
end
|
|
44
|
-
resources :diaries, only: [:index, :show]
|
|
45
|
-
get "diaries/:year/:week_number/edit", to: "diaries#edit", as: :edit_diary
|
|
46
44
|
end
|
|
47
|
-
|
|
48
|
-
resources :
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
45
|
+
namespace :scheduling do
|
|
46
|
+
resources :units, only: [] do
|
|
47
|
+
resources :diaries, only: [:index, :show]
|
|
48
|
+
get "diaries/:year/:week_number/edit", to: "diaries#edit", as: :edit_diary
|
|
49
|
+
end
|
|
50
|
+
resources :diaries, only: [] do
|
|
51
|
+
resources :slots, except: :show, controller: :diary_slots
|
|
52
|
+
get "slots/day/:day_of_week/period/:diurnal_period_code_id/station/:station_id",
|
|
53
|
+
to: "diary_slots#show",
|
|
54
|
+
as: :refresh_slot
|
|
55
|
+
end
|
|
52
56
|
end
|
|
53
57
|
namespace :session_forms do
|
|
54
58
|
resources :batches, only: [:create, :show] do
|
data/config/routes/letters.rb
CHANGED
|
@@ -27,11 +27,6 @@ namespace :letters do
|
|
|
27
27
|
resources :completions, only: [:new, :create], controller: "completed_batches"
|
|
28
28
|
end
|
|
29
29
|
resource :pdf_letter_cache, only: [:destroy], controller: "pdf_letter_cache"
|
|
30
|
-
resources :descriptions, only: :search do
|
|
31
|
-
collection do
|
|
32
|
-
get :search
|
|
33
|
-
end
|
|
34
|
-
end
|
|
35
30
|
|
|
36
31
|
# Letters::ListsController displays prefined lists of letters. The default list is :all
|
|
37
32
|
# We want to support dynamic urls with letters_list_path(named_parameeter: :all)
|
data/config/routes/patients.rb
CHANGED
data/config/routes/pd.rb
CHANGED
|
@@ -6,11 +6,11 @@ resources :patients, only: [] do
|
|
|
6
6
|
resources :apd_regimes,
|
|
7
7
|
controller: "regimes",
|
|
8
8
|
type: "PD::APDRegime",
|
|
9
|
-
only: [:new, :create, :edit, :update, :show]
|
|
9
|
+
only: [:new, :create, :edit, :update, :show, :index]
|
|
10
10
|
resources :capd_regimes,
|
|
11
11
|
controller: "regimes",
|
|
12
12
|
type: "PD::CAPDRegime",
|
|
13
|
-
only: [:new, :create, :edit, :update, :show]
|
|
13
|
+
only: [:new, :create, :edit, :update, :show, :index]
|
|
14
14
|
resources :regimes, only: [:new, :create, :edit, :update, :show]
|
|
15
15
|
resources :peritonitis_episodes, only: [:new, :create, :show, :edit, :update]
|
|
16
16
|
resources :exit_site_infections, only: [:new, :create, :show, :edit, :update]
|
data/config/routes/renal.rb
CHANGED
|
@@ -7,11 +7,6 @@ resources :patients, only: [] do
|
|
|
7
7
|
end
|
|
8
8
|
|
|
9
9
|
namespace :renal do
|
|
10
|
-
resources :prd_descriptions, only: [:search] do
|
|
11
|
-
collection do
|
|
12
|
-
get :search
|
|
13
|
-
end
|
|
14
|
-
end
|
|
15
10
|
resources :aki_alerts, only: [:edit, :update, :index]
|
|
16
11
|
resources :registry_preflight_checks, only: [] do
|
|
17
12
|
collection do
|
data/config/routes.rb
CHANGED
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
# Note: You must restart bin/webpack-dev-server for changes to take effect
|
|
2
|
+
|
|
3
|
+
default: &default
|
|
4
|
+
source_path: app/javascript
|
|
5
|
+
source_entry_path: packs
|
|
6
|
+
# public_root_path: /Users/tim/Sites/airslie/renalware/renalwarev2/spec/dummy/public
|
|
7
|
+
public_root_path: public
|
|
8
|
+
public_output_path: renalware-core-packs
|
|
9
|
+
cache_path: tmp/cache/webpacker
|
|
10
|
+
check_yarn_integrity: false
|
|
11
|
+
webpack_compile_output: true
|
|
12
|
+
|
|
13
|
+
# Additional paths webpack should lookup modules
|
|
14
|
+
# ['app/assets', 'engine/foo/app/assets']
|
|
15
|
+
resolved_paths: []
|
|
16
|
+
|
|
17
|
+
# Reload manifest.json on all requests so we reload latest compiled packs
|
|
18
|
+
cache_manifest: false
|
|
19
|
+
|
|
20
|
+
# Extract and emit a css file
|
|
21
|
+
extract_css: false
|
|
22
|
+
|
|
23
|
+
static_assets_extensions:
|
|
24
|
+
- .jpg
|
|
25
|
+
- .jpeg
|
|
26
|
+
- .png
|
|
27
|
+
- .gif
|
|
28
|
+
- .tiff
|
|
29
|
+
- .ico
|
|
30
|
+
- .svg
|
|
31
|
+
- .eot
|
|
32
|
+
- .otf
|
|
33
|
+
- .ttf
|
|
34
|
+
- .woff
|
|
35
|
+
- .woff2
|
|
36
|
+
|
|
37
|
+
extensions:
|
|
38
|
+
- .mjs
|
|
39
|
+
- .js
|
|
40
|
+
- .sass
|
|
41
|
+
- .scss
|
|
42
|
+
- .css
|
|
43
|
+
- .module.sass
|
|
44
|
+
- .module.scss
|
|
45
|
+
- .module.css
|
|
46
|
+
- .png
|
|
47
|
+
- .svg
|
|
48
|
+
- .gif
|
|
49
|
+
- .jpeg
|
|
50
|
+
- .jpg
|
|
51
|
+
|
|
52
|
+
development:
|
|
53
|
+
<<: *default
|
|
54
|
+
compile: true
|
|
55
|
+
|
|
56
|
+
# Verifies that correct packages and versions are installed by inspecting package.json, yarn.lock, and node_modules
|
|
57
|
+
check_yarn_integrity: false
|
|
58
|
+
|
|
59
|
+
# Reference: https://webpack.js.org/configuration/dev-server/
|
|
60
|
+
dev_server:
|
|
61
|
+
https: false
|
|
62
|
+
host: localhost
|
|
63
|
+
port: 3035
|
|
64
|
+
public: localhost:3035
|
|
65
|
+
hmr: false
|
|
66
|
+
# Inline should be set to true if using HMR
|
|
67
|
+
inline: true
|
|
68
|
+
overlay: true
|
|
69
|
+
compress: true
|
|
70
|
+
disable_host_check: true
|
|
71
|
+
use_local_ip: false
|
|
72
|
+
quiet: false
|
|
73
|
+
headers:
|
|
74
|
+
'Access-Control-Allow-Origin': '*'
|
|
75
|
+
watch_options:
|
|
76
|
+
ignored: '**/node_modules/**'
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
test:
|
|
80
|
+
<<: *default
|
|
81
|
+
compile: true
|
|
82
|
+
|
|
83
|
+
# Compile test packs to a separate directory
|
|
84
|
+
# public_output_path: packs-test
|
|
85
|
+
|
|
86
|
+
staging:
|
|
87
|
+
<<: *default
|
|
88
|
+
|
|
89
|
+
compile: false
|
|
90
|
+
extract_css: true
|
|
91
|
+
cache_manifest: true
|
|
92
|
+
|
|
93
|
+
production:
|
|
94
|
+
<<: *default
|
|
95
|
+
|
|
96
|
+
# Production depends on precompilation of packs prior to booting for performance.
|
|
97
|
+
compile: false
|
|
98
|
+
|
|
99
|
+
# Extract and emit a css file
|
|
100
|
+
extract_css: true
|
|
101
|
+
|
|
102
|
+
# Cache manifest.json for performance
|
|
103
|
+
cache_manifest: true
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
CREATE OR REPLACE FUNCTION renalware.hd_diary_archive_elapsed_master_slots()
|
|
2
|
+
RETURNS void
|
|
3
|
+
AS $$
|
|
4
|
+
BEGIN
|
|
5
|
+
|
|
6
|
+
INSERT into hd_diary_slots
|
|
7
|
+
(
|
|
8
|
+
diary_id,
|
|
9
|
+
station_id,
|
|
10
|
+
day_of_week,
|
|
11
|
+
diurnal_period_code_id,
|
|
12
|
+
patient_id,
|
|
13
|
+
created_by_id,
|
|
14
|
+
updated_by_id,
|
|
15
|
+
created_at,
|
|
16
|
+
updated_at,
|
|
17
|
+
deleted_at
|
|
18
|
+
)
|
|
19
|
+
(
|
|
20
|
+
select
|
|
21
|
+
weekly_diary_id,
|
|
22
|
+
station_id,
|
|
23
|
+
day_of_week,
|
|
24
|
+
diurnal_period_code_id,
|
|
25
|
+
patient_id,
|
|
26
|
+
master_slot_created_by_id,
|
|
27
|
+
master_slot_updated_by_id,
|
|
28
|
+
master_slot_created_at,
|
|
29
|
+
master_slot_updated_at,
|
|
30
|
+
deleted_at
|
|
31
|
+
from renalware.hd_diary_matrix -- a SQL view
|
|
32
|
+
where
|
|
33
|
+
weekly_slot_id is null
|
|
34
|
+
and master_slot_id is not null
|
|
35
|
+
and master_slot_created_at <= slot_date
|
|
36
|
+
and slot_date >= now() - interval '3 months'
|
|
37
|
+
);
|
|
38
|
+
|
|
39
|
+
END;
|
|
40
|
+
$$ LANGUAGE plpgsql;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
class CreateFeedHL7TestMessages < ActiveRecord::Migration[5.2]
|
|
2
|
+
def change
|
|
3
|
+
within_renalware_schema do
|
|
4
|
+
create_table :feed_hl7_test_messages do |t|
|
|
5
|
+
t.string :name, null: false, index: true
|
|
6
|
+
t.string :description
|
|
7
|
+
t.text :body, null: false
|
|
8
|
+
t.timestamps
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
end
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
class CreatePatientsMasterIndex < ActiveRecord::Migration[5.2]
|
|
2
|
+
def change
|
|
3
|
+
create_table :patient_master_index do |t|
|
|
4
|
+
t.references :patient, null: true, foreign_key: true
|
|
5
|
+
t.timestamps null: false
|
|
6
|
+
t.string :nhs_number, index: true
|
|
7
|
+
t.string :hospital_number, index: true
|
|
8
|
+
t.string :title
|
|
9
|
+
t.string :family_name
|
|
10
|
+
t.string :middle_name
|
|
11
|
+
t.string :given_name
|
|
12
|
+
t.string :suffix
|
|
13
|
+
t.string :sex
|
|
14
|
+
t.date :born_on
|
|
15
|
+
t.datetime :died_at
|
|
16
|
+
t.string :ethnicity
|
|
17
|
+
t.string :practice_code
|
|
18
|
+
t.string :gp_code
|
|
19
|
+
t.timestamps null: false
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
add_index :patient_master_index, [:family_name, :given_name]
|
|
23
|
+
end
|
|
24
|
+
end
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
-- First build a matrix of 'virtual' empty slots - by creating a cartesian product
|
|
2
|
+
-- of weeks in the last year, unit, stations, days and periods (am pm eve)
|
|
3
|
+
-- This can creates 50,0000+ rows
|
|
4
|
+
with hd_empty_diary_matrix as (
|
|
5
|
+
SELECT
|
|
6
|
+
extract(YEAR from the_date) as year,
|
|
7
|
+
extract(WEEK from the_date) as week_number,
|
|
8
|
+
h.id as hospital_unit_id,
|
|
9
|
+
s.id as station_id,
|
|
10
|
+
day_of_week,
|
|
11
|
+
period.id as diurnal_period_code_id
|
|
12
|
+
from generate_series(now() - interval '1 year', now() - interval '1 week', '1 week') as the_date
|
|
13
|
+
cross join hospital_units h
|
|
14
|
+
cross join hd_stations s
|
|
15
|
+
CROSS JOIN (SELECT generate_series(1, 7) AS day_of_week) as A
|
|
16
|
+
CROSS JOIN hd_diurnal_period_codes period
|
|
17
|
+
where h.is_hd_site = TRUE
|
|
18
|
+
order by year, week_number, hospital_unit_id, station_id, day_of_week, diurnal_period_code_id
|
|
19
|
+
)
|
|
20
|
+
-- Now decorate the previous query by adding columns for the slots (master and weekly) that we actually have
|
|
21
|
+
select
|
|
22
|
+
M.*
|
|
23
|
+
,WD.id as weekly_diary_id
|
|
24
|
+
,MD.id as master_diary_id
|
|
25
|
+
,WS.id as weekly_slot_id
|
|
26
|
+
,MS.id as master_slot_id
|
|
27
|
+
,coalesce(WS.patient_id, MS.patient_id) as patient_id
|
|
28
|
+
,MS.deleted_at
|
|
29
|
+
,MS.created_by_id as master_slot_created_by_id
|
|
30
|
+
,MS.updated_by_id as master_slot_updated_by_id
|
|
31
|
+
,MS.created_at::date as master_slot_created_at
|
|
32
|
+
,MS.updated_at::date as master_slot_updated_at
|
|
33
|
+
,to_date(WD.year::text || '-' || WD.week_number::text || '-' || MS.day_of_week::text , 'iyyy-iw-ID') slot_date
|
|
34
|
+
from hd_empty_diary_matrix M
|
|
35
|
+
left outer join hd_diaries WD on WD.hospital_unit_id = M.hospital_unit_id AND WD.year = M.year AND WD.week_number = M.week_number AND WD.master = false
|
|
36
|
+
left outer join hd_diaries MD on MD.hospital_unit_id = M.hospital_unit_id AND MD.master = true
|
|
37
|
+
left outer join hd_diary_slots WS on WS.diary_id = WD.id AND WS.station_id = M.station_id and WS.day_of_week = M.day_of_week AND WS.diurnal_period_code_id = M.diurnal_period_code_id
|
|
38
|
+
left outer join hd_diary_slots MS on MS.diary_id = MD.id AND MS.station_id = M.station_id and MS.day_of_week = M.day_of_week AND MS.diurnal_period_code_id = M.diurnal_period_code_id
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
# Adds a sort method to ActiveRecord class. Given a list of IDs, it will sort
|
|
4
|
-
# the records in the order of the ids. Assumes that the model has the :position attribute.
|
|
5
|
-
#
|
|
6
|
-
# ActiveRecord::Base.class_eval do
|
|
7
|
-
# include RailsExtensions::ActiveRecord::Sort
|
|
8
|
-
# end
|
|
9
|
-
|
|
10
3
|
module CoreExtensions
|
|
11
4
|
module ActiveRecord
|
|
5
|
+
# Assumes that the model has the #position attribute and adds 2 features to a model that
|
|
6
|
+
# includes it:
|
|
7
|
+
# 1. Set the :position to the next highest value when a new row is added. If the model has a
|
|
8
|
+
# position_sorting_scope scope or class method, this is used to narrow the range of records
|
|
9
|
+
# searched when finding the current max position
|
|
10
|
+
# 2. Add ability to sort rows based on an array of ids.
|
|
11
|
+
#
|
|
12
|
+
# TODO: move to a model concern and include selectively rather than globally.
|
|
12
13
|
module Sort
|
|
13
14
|
def self.included(base)
|
|
14
15
|
base.extend ClassMethods
|
|
@@ -17,17 +18,34 @@ module CoreExtensions
|
|
|
17
18
|
end
|
|
18
19
|
|
|
19
20
|
module ClassMethods
|
|
21
|
+
# A controller #sort action might for instance invoke this class method on an object.
|
|
22
|
+
# The array of ids are the model to sort, and sorting is done by updating each model's
|
|
23
|
+
# position to reflect their place in the array.
|
|
20
24
|
def sort(ids)
|
|
21
|
-
ids.each_with_index do |id, index|
|
|
25
|
+
Array(ids).each_with_index do |id, index|
|
|
22
26
|
where(id: id).update_all(["position=?", index + 1])
|
|
23
27
|
end
|
|
24
28
|
end
|
|
25
29
|
end
|
|
26
30
|
|
|
31
|
+
# Invoked by the callback when a record is created to set the initial value of #position.
|
|
32
|
+
# If no position_sorting_scope is defined on the model class, we set position to the max
|
|
33
|
+
# position in the whole table. If position_sorting_scope is provided we use it to refine the
|
|
34
|
+
# grouping and hence the max(position) found - for example to get the max position where
|
|
35
|
+
# patient_id = 123
|
|
36
|
+
#
|
|
37
|
+
# Example scope in a model:
|
|
38
|
+
# scope :position_sorting_scope, ->(problem) { where(patient_id: problem.patient.id) }
|
|
39
|
+
#
|
|
27
40
|
def set_position
|
|
28
41
|
return unless respond_to?(:position)
|
|
29
42
|
|
|
30
|
-
|
|
43
|
+
scope = if self.class.respond_to?(:position_sorting_scope)
|
|
44
|
+
self.class.position_sorting_scope(self)
|
|
45
|
+
else
|
|
46
|
+
self.class
|
|
47
|
+
end
|
|
48
|
+
self.position = (scope.maximum(:position) || 0) + 1
|
|
31
49
|
end
|
|
32
50
|
end
|
|
33
51
|
end
|
|
@@ -86,6 +86,9 @@ module Renalware
|
|
|
86
86
|
|
|
87
87
|
config_accessor(:hd_session_prescriptions_require_signoff) { true }
|
|
88
88
|
config_accessor(:batch_printing_enabled) { true }
|
|
89
|
+
config_accessor(:generate_pathology_request_forms_from_hd_mdm_listing) { true }
|
|
90
|
+
config_accessor(:disable_inputs_controlled_by_tissue_typing_feed) { false }
|
|
91
|
+
config_accessor(:disable_inputs_controlled_by_demographics_feed) { false }
|
|
89
92
|
|
|
90
93
|
# A host app can override this to add/remove/re-order the clinical summary display
|
|
91
94
|
# Note these have to be strings - they mapped to constants in ClinicalSummaryPresenter.
|
data/lib/renalware/engine.rb
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
require "rubygems"
|
|
4
|
+
require "action_view/component/base"
|
|
4
5
|
require "active_type"
|
|
5
6
|
require "activerecord-import"
|
|
6
7
|
require "ahoy"
|
|
@@ -49,8 +50,10 @@ require "sass-rails"
|
|
|
49
50
|
require "scenic"
|
|
50
51
|
require "slim-rails"
|
|
51
52
|
require "trix"
|
|
53
|
+
require "uglifier"
|
|
52
54
|
require "validates_timeliness"
|
|
53
55
|
require "virtus"
|
|
56
|
+
require "webpacker"
|
|
54
57
|
require "wicked_pdf"
|
|
55
58
|
require "wisper"
|
|
56
59
|
require "wisper/activejob"
|
|
@@ -62,9 +65,36 @@ module Renalware
|
|
|
62
65
|
# This will keep Rails Engine from generating all table prefixes with the engines name
|
|
63
66
|
def self.table_name_prefix; end
|
|
64
67
|
|
|
68
|
+
# rubocop:disable Metrics/ClassLength
|
|
65
69
|
class Engine < ::Rails::Engine
|
|
66
70
|
isolate_namespace Renalware
|
|
67
71
|
|
|
72
|
+
# Configure webpacker dev server proxy
|
|
73
|
+
# rubocop:disable Style/RescueStandardError
|
|
74
|
+
initializer "webpacker.proxy" do |app|
|
|
75
|
+
insert_middleware = begin
|
|
76
|
+
Renalware.webpacker.config.dev_server.present?
|
|
77
|
+
rescue
|
|
78
|
+
nil
|
|
79
|
+
end
|
|
80
|
+
next unless insert_middleware
|
|
81
|
+
|
|
82
|
+
app.middleware.insert_before(
|
|
83
|
+
0, Webpacker::DevServerProxy, # "Webpacker::DevServerProxy" if Rails version < 5
|
|
84
|
+
ssl_verify_none: true,
|
|
85
|
+
webpacker: Renalware.webpacker
|
|
86
|
+
)
|
|
87
|
+
end
|
|
88
|
+
# rubocop:enable Style/RescueStandardError
|
|
89
|
+
|
|
90
|
+
# Allow the host app to consume webpacker-compiled packs in the engine's public folder.
|
|
91
|
+
initializer :packs do |_app|
|
|
92
|
+
config.app_middleware.use(
|
|
93
|
+
Rack::Static,
|
|
94
|
+
urls: ["/renalware-core-packs"], root: Engine.root.join("public")
|
|
95
|
+
)
|
|
96
|
+
end
|
|
97
|
+
|
|
68
98
|
# Define a attr on the Engine's eigenclass so a host application
|
|
69
99
|
# can set an exception handler instance. It must accept a .notify(excetion) method.
|
|
70
100
|
# We use the exception handler when logging errors in background jobs only.
|
|
@@ -192,3 +222,4 @@ module Renalware
|
|
|
192
222
|
end
|
|
193
223
|
end
|
|
194
224
|
end
|
|
225
|
+
# rubocop:enable Metrics/ClassLength
|
data/lib/renalware/version.rb
CHANGED
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
module Renalware
|
|
4
4
|
class WeekPeriod
|
|
5
|
-
attr_reader :year, :week_number, :
|
|
5
|
+
attr_reader :year, :week_number, :date_on_first_day_of_week
|
|
6
6
|
|
|
7
7
|
def self.from_date(date)
|
|
8
8
|
date = date.to_date
|
|
9
|
-
new(week_number: date.cweek, year: date.
|
|
9
|
+
new(week_number: date.cweek, year: date.cwyear)
|
|
10
10
|
end
|
|
11
11
|
|
|
12
12
|
def initialize(week_number:, year:)
|
|
@@ -14,15 +14,15 @@ module Renalware
|
|
|
14
14
|
@year = year.to_i
|
|
15
15
|
validate_week_number
|
|
16
16
|
validate_year
|
|
17
|
-
@
|
|
17
|
+
@date_on_first_day_of_week = Date.commercial(@year, @week_number)
|
|
18
18
|
end
|
|
19
19
|
|
|
20
20
|
def next
|
|
21
|
-
self.class.from_date(
|
|
21
|
+
self.class.from_date(date_on_first_day_of_week + 1.week)
|
|
22
22
|
end
|
|
23
23
|
|
|
24
24
|
def previous
|
|
25
|
-
self.class.from_date(
|
|
25
|
+
self.class.from_date(date_on_first_day_of_week - 1.week)
|
|
26
26
|
end
|
|
27
27
|
|
|
28
28
|
def to_a
|
|
@@ -30,12 +30,13 @@ module Renalware
|
|
|
30
30
|
end
|
|
31
31
|
|
|
32
32
|
def to_s
|
|
33
|
-
"#{I18n.l(
|
|
33
|
+
"#{I18n.l(date_on_first_day_of_week, format: :long)} " \
|
|
34
|
+
"to #{I18n.l(last_day_of_week, format: :long)}"
|
|
34
35
|
end
|
|
35
36
|
|
|
36
37
|
# The date of last day of the week (a Sunday)
|
|
37
38
|
def last_day_of_week
|
|
38
|
-
@last_day_of_week ||= (
|
|
39
|
+
@last_day_of_week ||= (date_on_first_day_of_week + 1.week - 1.minute).to_date
|
|
39
40
|
end
|
|
40
41
|
|
|
41
42
|
def validate_week_number
|
data/lib/renalware.rb
CHANGED
|
@@ -4,5 +4,17 @@ require "renalware/engine"
|
|
|
4
4
|
require "renalware/configuration"
|
|
5
5
|
|
|
6
6
|
module Renalware
|
|
7
|
-
#
|
|
7
|
+
# Configure Webpacker instance.
|
|
8
|
+
# See https://github.com/rails/webpacker/blob/master/docs/engines.md
|
|
9
|
+
class << self
|
|
10
|
+
def webpacker
|
|
11
|
+
@webpacker ||= begin
|
|
12
|
+
root_path = Pathname.new(File.join(__dir__, ".."))
|
|
13
|
+
::Webpacker::Instance.new(
|
|
14
|
+
root_path: root_path,
|
|
15
|
+
config_path: root_path.join("config/webpacker.yml")
|
|
16
|
+
)
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
8
20
|
end
|
data/lib/tasks/hd.rake
CHANGED
|
@@ -12,4 +12,11 @@ namespace :hd do
|
|
|
12
12
|
performed_before: 3.days.ago
|
|
13
13
|
)
|
|
14
14
|
end
|
|
15
|
+
|
|
16
|
+
namespace :diary do
|
|
17
|
+
task housekeeping: :environment do
|
|
18
|
+
Rails.logger = Logger.new(STDOUT)
|
|
19
|
+
Delayed::Job.enqueue Renalware::HD::Scheduling::ArchiveYesterdaysSlotsJob.new
|
|
20
|
+
end
|
|
21
|
+
end
|
|
15
22
|
end
|
data/lib/tasks/pathology.rake
CHANGED
|
@@ -23,7 +23,7 @@ namespace :pathology do
|
|
|
23
23
|
# Load the message into a hash as delayed_Job would do and splat the hash keys as keyword args
|
|
24
24
|
# into the FeedJob ctor.
|
|
25
25
|
hash = YAML.safe_load(*raw_message).symbolize_keys
|
|
26
|
-
FeedJob.new(hash[:raw_message])
|
|
26
|
+
Delayed::Job.enqueue FeedJob.new(hash[:raw_message])
|
|
27
27
|
end
|
|
28
28
|
|
|
29
29
|
desc "In development only, enqueue a test HL7 message"
|