renalware-core 2.0.156 → 2.0.161
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/assets/javascripts/renalware/components/configuration.js +20 -0
- data/app/assets/javascripts/renalware/components/{dialogs.js.erb → dialogs.js} +2 -5
- data/app/assets/javascripts/renalware/components/{feed_only_inputs.js.erb → feed_only_inputs.js} +4 -4
- data/app/assets/javascripts/renalware/{core.js.erb → core.js} +0 -5
- data/app/assets/javascripts/renalware/rollup_compiled.css +42050 -42050
- data/app/assets/javascripts/renalware/rollup_compiled.js +768 -201
- data/app/assets/stylesheets/renalware/modules/_clinical.scss +13 -0
- data/app/components/renalware/admissions/active_consult_alert_component.html.slim +1 -1
- data/app/components/renalware/article_component.rb +1 -1
- data/app/components/renalware/letters/letters_in_progress_component.rb +1 -5
- data/app/components/renalware/letters/unread_electronic_ccs_component.rb +1 -4
- data/app/components/renalware/medications/tabbed_prescriptions_list_component.html.slim +2 -2
- data/app/components/renalware/pathology/sparkline_component.html.slim +1 -1
- data/app/components/renalware/patients/bookmarks_component.rb +1 -5
- data/app/components/renalware/patients/messages_component.rb +2 -8
- data/app/components/renalware/pd/adequacy_results_component.rb +1 -1
- data/app/components/renalware/pd/pet_results_component.html.slim +5 -7
- data/app/components/renalware/surveys/eq5d_component.rb +1 -5
- data/app/components/renalware/surveys/pos_s_component.rb +1 -5
- data/app/components/renalware/system/admin_menu_component.rb +1 -4
- data/app/components/renalware/system/users_awaiting_approval_component.rb +1 -5
- data/app/controllers/renalware/api/token_authenticated_api_controller.rb +1 -1
- data/app/controllers/renalware/api/v1/medications/prescriptions_controller.rb +1 -1
- data/app/controllers/renalware/api/v1/patients/patients_controller.rb +1 -1
- data/app/controllers/renalware/events/events_controller.rb +0 -1
- data/app/controllers/renalware/pd/pet_results_controller.rb +1 -1
- data/{lib → app/documents}/document/attribute_initializer.rb +0 -0
- data/{lib → app/documents}/document/attribute_initializer/active_model.rb +0 -0
- data/{lib → app/documents}/document/attribute_initializer/base.rb +0 -0
- data/{lib → app/documents}/document/attribute_initializer/enum.rb +0 -0
- data/{lib → app/documents}/document/base.rb +0 -0
- data/{lib → app/documents}/document/embedded.rb +0 -0
- data/{lib → app/documents}/document/enum.rb +0 -0
- data/app/javascript/renalware/controllers/modal_controller.js +1 -1
- data/app/jobs/renalware/hd/generate_monthly_statistics.rb +1 -1
- data/app/jobs/renalware/hd/generate_monthly_statistics_for_patient_job.rb +1 -1
- data/app/jobs/renalware/letters/calculate_page_count_job.rb +0 -1
- data/app/jobs/renalware/letters/mailshots/create_mailshot_letters_job.rb +0 -1
- data/app/jobs/renalware/letters/printing/batch_print_job.rb +0 -1
- data/app/jobs/renalware/letters/save_rtf_letter_to_file_job.rb +1 -1
- data/app/mailers/renalware/letters/{delivery/errors.rb → delivery.rb} +2 -1
- data/app/mailers/renalware/letters/delivery/practice_mailer.rb +2 -2
- data/app/models/concerns/renalware/deviseable.rb +3 -3
- data/app/models/renalware/admissions/admission_query.rb +0 -1
- data/{lib → app/models}/renalware/automatic_age_calculator.rb +0 -0
- data/app/models/renalware/clinical/create_allergy.rb +4 -4
- data/app/models/renalware/clinics/create_clinic_visit.rb +4 -4
- data/app/models/renalware/clinics/current_observations.rb +3 -4
- data/app/models/renalware/events/create_event.rb +0 -1
- data/app/models/renalware/feeds/files/exceptions.rb +1 -0
- data/app/models/renalware/feeds/files/practice_memberships/import_csv.rb +0 -1
- data/app/models/renalware/feeds/files/primary_care_physicians/import_csv.rb +0 -1
- data/app/models/renalware/feeds/message_processor.rb +0 -1
- data/app/models/renalware/hd/prescription_administration.rb +6 -4
- data/app/models/renalware/hd/profiles_in_date_range_query.rb +1 -6
- data/app/models/renalware/hd/scheduling/diary_range.rb +1 -2
- data/app/models/renalware/hd/scheduling/find_or_create_diary_by_week_query.rb +1 -1
- data/app/models/renalware/hd/session_forms/batch.rb +0 -1
- data/app/models/renalware/hd/session_forms/batch_compile_pdfs.rb +0 -1
- data/app/models/renalware/hd/session_forms/batch_item.rb +0 -1
- data/app/models/renalware/hd/sessions/close_stale_open_sessions.rb +0 -1
- data/app/models/renalware/letters/approve_letter.rb +0 -1
- data/app/models/renalware/letters/complete_letter.rb +0 -1
- data/app/models/renalware/letters/delivery/delivery_policy.rb +0 -1
- data/app/models/renalware/letters/delivery/email_letter_to_practice.rb +0 -1
- data/app/models/renalware/letters/delivery/practice_email.rb +0 -1
- data/app/models/renalware/letters/html_renderer.rb +1 -1
- data/app/models/renalware/letters/letter_factory.rb +1 -1
- data/app/models/renalware/letters/part/recent_pathology_results.rb +0 -1
- data/app/models/renalware/letters/pathology_layout.rb +1 -1
- data/app/models/renalware/letters/pdf_renderer.rb +1 -1
- data/app/models/renalware/letters/printing/batch_compile_pdfs.rb +0 -1
- data/app/models/renalware/letters/printing/complete_batch.rb +0 -1
- data/app/models/renalware/letters/printing/pdf_combining.rb +0 -2
- data/app/models/renalware/letters/resolve_default_electronic_ccs.rb +0 -2
- data/app/models/renalware/letters/rtf_renderer.rb +3 -2
- data/app/models/renalware/modalities/change_patient_modality.rb +4 -4
- data/app/models/renalware/pathology.rb +1 -0
- data/app/models/renalware/pathology/adjust_observation.rb +0 -1
- data/app/models/renalware/pathology/message_listener.rb +1 -1
- data/app/models/renalware/pathology/observation.rb +1 -1
- data/app/models/renalware/pathology/observation_descriptions_by_code_query.rb +1 -1
- data/app/models/renalware/pathology/observations_grouped_by_date_query.rb +0 -1
- data/app/models/renalware/pathology/observations_grouped_by_date_table.rb +0 -1
- data/app/models/renalware/pathology/ordered_patient_query.rb +1 -1
- data/app/models/renalware/pathology/requests/request_params_factory.rb +0 -1
- data/app/models/renalware/patients/calculate_age.rb +0 -1
- data/app/models/renalware/patients/clear_patient_ukrdc_data.rb +0 -1
- data/app/models/renalware/patients/ingestion/update_master_patient_index.rb +0 -1
- data/app/models/renalware/patients/last_successful_practice_sync_date_query.rb +0 -2
- data/app/models/renalware/patients/primary_care_physician.rb +1 -0
- data/app/models/renalware/patients/sync_ods_job.rb +1 -1
- data/app/models/renalware/patients/sync_practices_via_api.rb +1 -1
- data/app/models/renalware/pd.rb +5 -0
- data/app/models/renalware/pd/{apd/exceptions.rb → apd.rb.dead} +0 -0
- data/app/models/renalware/pd/apd/available_overnight_volume.rb +0 -1
- data/app/models/renalware/pd/apd/regime_calculations.rb +1 -1
- data/app/models/renalware/pd/create_regime.rb +4 -4
- data/app/models/renalware/pd/regimes_in_date_range_query.rb +0 -2
- data/app/models/renalware/pd/revise_regime.rb +5 -5
- data/{lib → app/models}/renalware/remembered_preferences.rb +0 -0
- data/app/models/renalware/research/study_participants_query.rb +0 -1
- data/app/models/renalware/transplants/create_donor_stage.rb +4 -4
- data/app/models/renalware/transplants/registrations/wait_list_query.rb +1 -1
- data/app/models/renalware/ukrdc.rb +1 -0
- data/app/models/renalware/ukrdc/create_encrypted_patient_xml_files.rb +2 -2
- data/app/models/renalware/ukrdc/create_patient_xml_file.rb +1 -2
- data/app/models/renalware/ukrdc/export_summary.rb +0 -1
- data/app/models/renalware/ukrdc/housekeeping/remove_old_export_archive_folders.rb +0 -1
- data/app/models/renalware/ukrdc/incoming/file_list.rb +0 -2
- data/app/models/renalware/ukrdc/incoming/import_survey.rb +0 -1
- data/app/models/renalware/ukrdc/incoming/import_surveys.rb +0 -1
- data/app/models/renalware/ukrdc/incoming/xml_document.rb +0 -1
- data/app/models/renalware/ukrdc/pathology_observation_requests_query.rb +1 -2
- data/app/models/renalware/ukrdc/treatment_timeline/generate_timeline.rb +0 -1
- data/app/models/renalware/ukrdc/treatment_timeline/generate_treatments.rb +1 -1
- data/app/models/renalware/ukrdc/treatment_timeline/generator_factory.rb +1 -1
- data/app/models/renalware/ukrdc/treatment_timeline/hd/generator.rb +1 -1
- data/app/models/renalware/ukrdc/treatment_timeline/pd/generator.rb +0 -1
- data/app/models/renalware/ukrdc/treatment_timeline/pd/regime_decorator.rb +0 -1
- data/app/models/renalware/ukrdc/treatment_timeline/transfer_out/generator.rb +0 -1
- data/app/models/renalware/ukrdc/treatment_timeline/transplant/generator.rb +0 -1
- data/app/models/renalware/ukrdc/xml_renderer.rb +2 -2
- data/app/models/renalware/virology/vaccination.rb +14 -1
- data/app/models/renalware/virology/vaccination_type.rb +16 -0
- data/app/presenters/renalware/accesses/dashboard_presenter.rb +0 -1
- data/app/presenters/renalware/clinical/header_presenter.rb +0 -1
- data/app/presenters/renalware/letters/letter_presenter.rb +1 -1
- data/app/presenters/renalware/letters/part_class_filter.rb +0 -1
- data/app/presenters/renalware/letters/practice_email_meta_data.rb +0 -1
- data/app/presenters/renalware/low_clearance/dashboard_presenter.rb +0 -1
- data/app/presenters/renalware/medications/prescription_presenter.rb +7 -0
- data/app/presenters/renalware/pathology/observations_diff.rb +0 -1
- data/app/presenters/renalware/renal/clinical_summary_presenter.rb +0 -1
- data/app/presenters/renalware/summary_part.rb +0 -2
- data/app/presenters/renalware/transplants/donor_dashboard_presenter.rb +0 -1
- data/app/presenters/renalware/transplants/recipient_dashboard_presenter.rb +0 -1
- data/app/presenters/renalware/ukrdc/transplant_operation_presenter.rb +0 -1
- data/app/presenters/renalware/user_session_presenter.rb +1 -3
- data/app/values/renalware/bmi.rb +0 -2
- data/app/views/renalware/admin/playgrounds/show.html.slim +2 -2
- data/app/views/renalware/hd/prescription_administrations/_form.html.slim +2 -2
- data/app/views/renalware/letters/contacts/_new_person.html.slim +1 -1
- data/app/views/renalware/letters/contacts/_person_from_directory.html.slim +1 -1
- data/app/views/renalware/letters/formatted_letters/_letter.html.slim +13 -14
- data/app/views/renalware/letters/mailshots/mailshots/_form.html.slim +25 -21
- data/app/views/renalware/letters/parts/_allergies.html.slim +1 -1
- data/app/views/renalware/letters/parts/_problems.html.slim +1 -1
- data/app/views/renalware/letters/parts/_recent_pathology_results.html.slim +1 -1
- data/app/views/renalware/medications/home_delivery/events/_edit.html.slim +4 -4
- data/app/views/renalware/medications/prescriptions/_current.html.slim +1 -1
- data/app/views/renalware/medications/prescriptions/_current_hd.html.slim +1 -1
- data/app/views/renalware/medications/prescriptions/_form.html.slim +3 -3
- data/app/views/renalware/medications/prescriptions/_prescription.html.slim +3 -1
- data/app/views/renalware/medications/prescriptions/_recently_stopped.html.slim +1 -1
- data/app/views/renalware/system/view_metadata/_columns_table.html.slim +2 -2
- data/app/views/renalware/system/view_metadata/edit.html.slim +6 -6
- data/app/views/renalware/virology/vaccinations/_cell.html.slim +1 -1
- data/app/views/renalware/virology/vaccinations/_inputs.html.slim +3 -1
- data/app/views/renalware/virology/vaccinations/_toggled_cell.html.slim +3 -1
- data/config/initializers/core_extensions.rb +1 -1
- data/config/initializers/inflections.rb +2 -0
- data/config/locales/renalware/virology/virology.en.yml +4 -0
- data/db/migrate/20201020155510_add_bmi_to_clinic_visits.rb +5 -2
- data/db/migrate/20201105153422_update_medication_current_prescriptions_view.rb +7 -0
- data/db/migrate/20201112152752_update_pd_mdm_patients_view1.rb +7 -0
- data/db/migrate/20210105163944_create_virology_vaccination_types.rb +13 -0
- data/db/seeds/default/seeds.rb +1 -0
- data/db/seeds/default/virology/seeds.rb +3 -0
- data/db/seeds/default/virology/vaccination_types.rb +25 -0
- data/db/views/medication_current_prescriptions_v01.sql +2 -1
- data/db/views/medication_current_prescriptions_v02.sql +30 -0
- data/db/views/pd_mdm_patients_v03.sql +50 -0
- data/db/views/reporting_anaemia_audit_v01.sql +0 -2
- data/lib/core_extensions/active_support/{duration.rb → duration_additions.rb} +0 -0
- data/lib/failure.rb +6 -0
- data/lib/gpg_encrypt_folder.rb +0 -2
- data/lib/month_period.rb +16 -0
- data/lib/renalware/configuration.rb +5 -6
- data/lib/renalware/version_number.rb +1 -1
- data/lib/service_result.rb +17 -0
- data/lib/sql/indexed_case_stmt.rb +1 -3
- data/lib/success.rb +9 -0
- data/lib/tasks/ukrdc.rake +1 -1
- data/lib/week_period.rb +57 -0
- data/spec/factories/events/events.rb +1 -2
- data/spec/factories/letters/letters.rb +4 -11
- data/spec/factories/medications/prescription_version.rb +1 -2
- data/spec/factories/patients/ethnicities.rb +1 -2
- data/spec/factories/pd/bag_types.rb +2 -2
- data/spec/factories/snippets/users.rb +1 -2
- data/spec/factories/transplants/recipient_followups.rb +1 -2
- data/spec/factories/virology/vaccination_types.rb +8 -0
- data/spec/factories/virology/vaccinations.rb +1 -1
- data/{lib/test_support → spec/support}/ajax_helpers.rb +0 -0
- data/{lib/test_support → spec/support}/text_editor_helpers.rb +0 -0
- metadata +41 -38
- data/app/assets/javascripts/renalware/components/reporting.js.erb +0 -0
- data/app/assets/javascripts/renalware/components/session_timeout_redirect.js.erb +0 -37
- data/app/components/renalware/system/article_component.html.slim +0 -3
- data/app/components/renalware/system/article_component.rb +0 -9
- data/app/mailers/renalware/previews/report_preview.rb +0 -14
- data/app/mailers/renalware/previews/ukrdc_summary_preview.rb +0 -20
- data/app/mailers/renalware/previews/user_mailer_preview.rb +0 -16
- data/lib/renalware/failure.rb +0 -6
- data/lib/renalware/month_period.rb +0 -18
- data/lib/renalware/service_result.rb +0 -19
- data/lib/renalware/success.rb +0 -9
- data/lib/renalware/week_period.rb +0 -59
@@ -1,2 +1,2 @@
|
|
1
1
|
/ See Vaccination.to_partial_path etc
|
2
|
-
= event.document.
|
2
|
+
= event.document.to_s
|
@@ -1,4 +1,6 @@
|
|
1
1
|
/ See Vaccination.to_partial_path etc
|
2
2
|
/ Pulled into the New Event form via a js get to EventsController#new
|
3
3
|
= f.simple_fields_for :document, event.document do |fd|
|
4
|
-
|
4
|
+
/= fd.input :type, wrapper: :horizontal_medium
|
5
|
+
= fd.input :type, wrapper: :horizontal_medium, collection: Renalware::Virology::VaccinationType.ordered.pluck(:name, :code)
|
6
|
+
= fd.input :drug, wrapper: :horizontal_medium, collection: Renalware::Drugs::Drug.for(:vaccine).pluck(:name, :name)
|
@@ -3,6 +3,8 @@
|
|
3
3
|
|
4
4
|
dl.dl-horizontal
|
5
5
|
dt= attr_name(document, :type, suffix: ":")
|
6
|
-
dd= document.
|
6
|
+
dd= document.type_name.presence || t("unspecified")
|
7
|
+
dt= attr_name(document, :drug, suffix: ":")
|
8
|
+
dd= document.drug.presence || t("unspecified")
|
7
9
|
dt= attr_name(event, :notes, suffix: ":")
|
8
10
|
dd= event.notes&.html_safe || t("unspecified")
|
@@ -5,7 +5,7 @@ require "core_extensions/i18n/always_cascade"
|
|
5
5
|
require "core_extensions/dumb_delegator"
|
6
6
|
# require "core_extensions/active_record/sort"
|
7
7
|
require "core_extensions/date"
|
8
|
-
require "core_extensions/active_support/
|
8
|
+
require "core_extensions/active_support/duration_additions"
|
9
9
|
require "core_extensions/scenic"
|
10
10
|
require "core_extensions/hash"
|
11
11
|
require "core_extensions/active_record/migration_helpers"
|
@@ -32,6 +32,7 @@ ActiveSupport::Inflector.inflections(:en) do |inflect|
|
|
32
32
|
inflect.acronym "CCs"
|
33
33
|
inflect.acronym "CM"
|
34
34
|
inflect.acronym "CSV"
|
35
|
+
inflect.acronym "CRF"
|
35
36
|
inflect.acronym "DNA"
|
36
37
|
inflect.acronym "EDTA"
|
37
38
|
inflect.acronym "ESRF"
|
@@ -55,6 +56,7 @@ ActiveSupport::Inflector.inflections(:en) do |inflect|
|
|
55
56
|
inflect.acronym "EQ5D"
|
56
57
|
inflect.acronym "EQ5D5L"
|
57
58
|
inflect.acronym "POS"
|
59
|
+
inflect.acronym "YAML"
|
58
60
|
inflect.irregular "feedback", "feedback"
|
59
61
|
inflect.acronym "NHS"
|
60
62
|
inflect.uncountable %w(cache)
|
@@ -5,7 +5,7 @@ class AddBMIToClinicVisits < ActiveRecord::Migration[5.2]
|
|
5
5
|
:clinic_visits,
|
6
6
|
:bmi,
|
7
7
|
:decimal,
|
8
|
-
precision:
|
8
|
+
precision: 10,
|
9
9
|
scale: 1,
|
10
10
|
null: true,
|
11
11
|
comment: "Body Mass Index calculated using a before_save when the clinic visit is updated"
|
@@ -13,10 +13,13 @@ class AddBMIToClinicVisits < ActiveRecord::Migration[5.2]
|
|
13
13
|
|
14
14
|
reversible do |direction|
|
15
15
|
direction.up do
|
16
|
+
# Update the bmi for existing clinic visits, but restrict to avoid generating a
|
17
|
+
# non-sense value in case height or weight were entered incorrectly.
|
18
|
+
# NB: height is in metres and weight in kg
|
16
19
|
connection.execute(
|
17
20
|
"update renalware.clinic_visits "\
|
18
21
|
"set bmi = round(((weight / height)::decimal / height::decimal), 1) "\
|
19
|
-
"where height > 0 and weight > 0;"
|
22
|
+
"where height > 0 and height < 3 and weight > 0 and weight < 500;"
|
20
23
|
)
|
21
24
|
end
|
22
25
|
direction.down do
|
@@ -0,0 +1,13 @@
|
|
1
|
+
class CreateVirologyVaccinationTypes < ActiveRecord::Migration[5.2]
|
2
|
+
within_renalware_schema do
|
3
|
+
def change
|
4
|
+
create_table :virology_vaccination_types do |t|
|
5
|
+
t.string :code, null: false, index: { unique: true }
|
6
|
+
t.string :name, null: false, index: { unique: true }
|
7
|
+
t.integer :position, null: false, default: 0
|
8
|
+
t.datetime :deleted_at
|
9
|
+
t.timestamps null: false
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
data/db/seeds/default/seeds.rb
CHANGED
@@ -0,0 +1,25 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Renalware
|
4
|
+
module Virology
|
5
|
+
log "Adding virology vaccination types" do
|
6
|
+
{
|
7
|
+
hbv1: "HBV Vaccination 1",
|
8
|
+
hbv2: "HBV Vaccination 2",
|
9
|
+
hbv3: "HBV Vaccination 3",
|
10
|
+
hbv4: "HBV Vaccination 4",
|
11
|
+
hbv_booster: "HBV Booster",
|
12
|
+
influenza: "Influenza",
|
13
|
+
pneumococcus: "Pneumococcus",
|
14
|
+
covid19_1: "COVID-19 1",
|
15
|
+
covid19_2: "COVID-19 2",
|
16
|
+
patient_refused: "Patient Refused",
|
17
|
+
patient_refused_covid19: "Patient refused Covid-19 vaccine",
|
18
|
+
patient_refused_covid19_pfizer: "Patient refused Covid-19 vaccine Pfizer",
|
19
|
+
patient_refused_covid19_astrazenica: "Patient refused Covid-19 vaccine Astra Zeneca"
|
20
|
+
}.each do |code, name|
|
21
|
+
VaccinationType.find_or_create_by!(code: code, name: name)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
SELECT distinct on (mp.patient_id, mp.id)
|
2
|
+
mp.id,
|
3
|
+
mp.patient_id,
|
4
|
+
mp.drug_id,
|
5
|
+
mp.treatable_type,
|
6
|
+
mp.treatable_id,
|
7
|
+
mp.dose_amount,
|
8
|
+
mp.dose_unit,
|
9
|
+
mp.medication_route_id,
|
10
|
+
mp.route_description,
|
11
|
+
mp.frequency,
|
12
|
+
mp.notes,
|
13
|
+
mp.prescribed_on,
|
14
|
+
mp.provider,
|
15
|
+
mp.created_at,
|
16
|
+
mp.updated_at,
|
17
|
+
mp.created_by_id,
|
18
|
+
mp.updated_by_id,
|
19
|
+
mp.administer_on_hd,
|
20
|
+
mp.last_delivery_date,
|
21
|
+
drugs.name as drug_name,
|
22
|
+
drug_types.code AS drug_type_code,
|
23
|
+
drug_types.name AS drug_type_name
|
24
|
+
FROM medication_prescriptions mp
|
25
|
+
left outer join medication_prescription_terminations mpt ON mpt.prescription_id = mp.id
|
26
|
+
inner JOIN drugs ON drugs.id = mp.drug_id
|
27
|
+
left outer join drug_types_drugs ON drug_types_drugs.drug_id = drugs.id
|
28
|
+
left outer join drug_types ON drug_types_drugs.drug_type_id = drug_types.id
|
29
|
+
where (mpt.terminated_on IS NULL OR mpt.terminated_on > current_date)
|
30
|
+
order by mp.patient_id asc, mp.id asc;
|
@@ -0,0 +1,50 @@
|
|
1
|
+
select
|
2
|
+
distinct on (P.id)
|
3
|
+
P.id,
|
4
|
+
P.secure_id,
|
5
|
+
(upper(P.family_name) || ', ' || P.given_name) as "patient_name",
|
6
|
+
P.nhs_number,
|
7
|
+
P.local_patient_id as hospital_numbers,
|
8
|
+
P.sex,
|
9
|
+
P.born_on,
|
10
|
+
date_part('year', age(P.born_on)) as "age",
|
11
|
+
RPROF.esrf_on,
|
12
|
+
Mx.modality_name,
|
13
|
+
case
|
14
|
+
when pw.id > 0 then true
|
15
|
+
else false
|
16
|
+
end as on_worryboard,
|
17
|
+
TXRSD."name" tx_status,
|
18
|
+
case pr.type
|
19
|
+
when 'Renalware::PD::APDRegime' then 'APD'
|
20
|
+
when 'Renalware::PD::CAPDRegime' then 'CAPD'
|
21
|
+
end as pd_type,
|
22
|
+
(select
|
23
|
+
date(date_time)
|
24
|
+
from events e
|
25
|
+
inner join event_types et on et.id = e.event_type_id
|
26
|
+
where et.slug = 'pd_line_changes'
|
27
|
+
and e.patient_id = P.id
|
28
|
+
order by date_time desc limit 1) as last_line_change_date,
|
29
|
+
pesi.diagnosis_date as last_esi_date,
|
30
|
+
ppe.diagnosis_date as last_peritonitis_date,
|
31
|
+
(select bmi from clinic_visits cv2 where cv2.patient_id = P.id and bmi > 0 order by date desc limit 1) as bmi,
|
32
|
+
PA.values -> 'HGB' ->> 'result' as hgb,
|
33
|
+
(PA.values -> 'HGB' ->> 'observed_at')::date as hgb_date,
|
34
|
+
PA.values -> 'URE' ->> 'result' as ure,
|
35
|
+
(PA.values -> 'URE' ->> 'observed_at')::date as ure_date,
|
36
|
+
PA.values -> 'CRE' ->> 'result' as cre,
|
37
|
+
(PA.values -> 'CRE' ->> 'observed_at')::date as cre_date,
|
38
|
+
PA.values -> 'EGFR' ->> 'result' as egfr
|
39
|
+
from renalware.patients P
|
40
|
+
left outer join patient_worries pw on pw.patient_id = p.id
|
41
|
+
left outer join renalware.pathology_current_observation_sets PA on PA.patient_id = P.id
|
42
|
+
left outer join renalware.renal_profiles RPROF on RPROF.patient_id = P.id
|
43
|
+
left outer join renalware.transplant_registrations TXR on TXR.patient_id = P.id
|
44
|
+
left outer join renalware.transplant_registration_statuses TXRS on TXRS.registration_id = TXR.id AND TXRS.terminated_on IS NULL
|
45
|
+
left outer join renalware.transplant_registration_status_descriptions TXRSD on TXRSD.id = TXRS.description_id
|
46
|
+
left outer join renalware.pd_regimes pr on pr.patient_id = P.id and pr.start_date <= current_date and pr.end_date is null
|
47
|
+
left outer join renalware.pd_exit_site_infections pesi on pesi.patient_id = P.id
|
48
|
+
left outer join pd_peritonitis_episodes ppe on ppe.patient_id = P.id
|
49
|
+
inner join renalware.patient_current_modalities Mx on Mx.patient_id = P.id and Mx.modality_code = 'pd'
|
50
|
+
order by P.id, pr.start_date desc, pr.created_at desc, pesi.diagnosis_date desc, ppe.diagnosis_date desc;
|
File without changes
|
data/lib/failure.rb
ADDED
data/lib/gpg_encrypt_folder.rb
CHANGED
data/lib/month_period.rb
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class MonthPeriod
|
4
|
+
attr_reader :month, :year, :start, :finish
|
5
|
+
|
6
|
+
def initialize(month:, year:)
|
7
|
+
@month = month
|
8
|
+
@year = year
|
9
|
+
@start = Time.new(year, month, 1, 0, 0, 0)
|
10
|
+
@finish = start.end_of_month.end_of_day
|
11
|
+
end
|
12
|
+
|
13
|
+
def to_range
|
14
|
+
start..finish
|
15
|
+
end
|
16
|
+
end
|
@@ -14,7 +14,6 @@
|
|
14
14
|
# To access configuration settings use e.g.
|
15
15
|
# Renalware.config.x
|
16
16
|
#
|
17
|
-
# rubocop:disable Metrics/ClassLength
|
18
17
|
module Renalware
|
19
18
|
class Configuration
|
20
19
|
include ActiveSupport::Configurable
|
@@ -37,9 +36,6 @@ module Renalware
|
|
37
36
|
config_accessor(:patient_hospital_identifiers) { {} }
|
38
37
|
config_accessor(:session_timeout_polling_frequency) { 1.minute }
|
39
38
|
config_accessor(:session_register_user_user_activity_after) { 2.minutes }
|
40
|
-
config_accessor(:session_expiry_use_previous_mechansim) {
|
41
|
-
ENV["SESSION_EXPIRY_USE_PREVIOUS_MECHANSIM"] == "true"
|
42
|
-
}
|
43
39
|
config_accessor(:duration_of_last_url_memory_after_session_expiry) { 30.minutes }
|
44
40
|
config_accessor(:broadcast_subscription_map) { {} }
|
45
41
|
config_accessor(:include_sunday_on_hd_diaries) { false }
|
@@ -140,6 +136,9 @@ module Renalware
|
|
140
136
|
# Note that the standard HL7 PID admin sex values are not adhered to here. For reference
|
141
137
|
# they are:
|
142
138
|
# F Female, M Male, O Other, U Unknown, A Ambiguous, N Not applicable
|
139
|
+
# Note
|
140
|
+
# - NS = Not Stated
|
141
|
+
# - NK = Not Known
|
143
142
|
config_accessor(:hl7_pid_sex_map) do
|
144
143
|
{
|
145
144
|
"MALE" => "M",
|
@@ -148,7 +147,8 @@ module Renalware
|
|
148
147
|
"UNKNOWN" => "NK",
|
149
148
|
"NOTKNOWN" => "NK",
|
150
149
|
"AMBIGUOUS" => "NS",
|
151
|
-
"NOT APPLICABLE" => "NS"
|
150
|
+
"NOT APPLICABLE" => "NS",
|
151
|
+
"BOTH" => "NS"
|
152
152
|
}.freeze
|
153
153
|
end
|
154
154
|
end
|
@@ -161,4 +161,3 @@ module Renalware
|
|
161
161
|
yield config
|
162
162
|
end
|
163
163
|
end
|
164
|
-
# rubocop:enable Metrics/ClassLength
|
data/lib/success.rb
ADDED
data/lib/tasks/ukrdc.rake
CHANGED
@@ -39,7 +39,7 @@ namespace :ukrdc do
|
|
39
39
|
RubyProf.start
|
40
40
|
end
|
41
41
|
# Renalware::UKRDC::TreatmentTimeline::GenerateTreatments.call
|
42
|
-
Renalware::UKRDC::
|
42
|
+
Renalware::UKRDC::CreateEncryptedPatientXmlFiles.new(
|
43
43
|
changed_since: ENV["changed_since"],
|
44
44
|
patient_ids: ENV.fetch("patient_ids", "").split(",").map(&:to_i),
|
45
45
|
force_send: ENV["force_send"] == "true"
|
data/lib/week_period.rb
ADDED
@@ -0,0 +1,57 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class WeekPeriod
|
4
|
+
attr_reader :year, :week_number, :date_on_first_day_of_week
|
5
|
+
|
6
|
+
def self.from_date(date)
|
7
|
+
date = date.to_date
|
8
|
+
new(week_number: date.cweek, year: date.cwyear)
|
9
|
+
end
|
10
|
+
|
11
|
+
def initialize(week_number:, year:)
|
12
|
+
@week_number = week_number.to_i
|
13
|
+
@year = year.to_i
|
14
|
+
validate_week_number
|
15
|
+
validate_year
|
16
|
+
@date_on_first_day_of_week = Date.commercial(@year, @week_number)
|
17
|
+
end
|
18
|
+
|
19
|
+
def next
|
20
|
+
self.class.from_date(date_on_first_day_of_week + 1.week)
|
21
|
+
end
|
22
|
+
|
23
|
+
def previous
|
24
|
+
self.class.from_date(date_on_first_day_of_week - 1.week)
|
25
|
+
end
|
26
|
+
|
27
|
+
def to_a
|
28
|
+
[week_number, year]
|
29
|
+
end
|
30
|
+
|
31
|
+
def to_s
|
32
|
+
"#{I18n.l(date_on_first_day_of_week, format: :long)} " \
|
33
|
+
"to #{I18n.l(last_day_of_week, format: :long)}"
|
34
|
+
end
|
35
|
+
|
36
|
+
# The date of last day of the week (a Sunday)
|
37
|
+
def last_day_of_week
|
38
|
+
@last_day_of_week ||= (date_on_first_day_of_week + 1.week - 1.minute).to_date
|
39
|
+
end
|
40
|
+
|
41
|
+
def validate_week_number
|
42
|
+
if week_number < 1 || week_number > 53
|
43
|
+
raise(ArgumentError, "invalid date: week_number must be 1-53")
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
def validate_year
|
48
|
+
raise(ArgumentError, "invalid date year must be >= 2000") if year <= 2000
|
49
|
+
end
|
50
|
+
|
51
|
+
def to_h
|
52
|
+
{
|
53
|
+
year: year,
|
54
|
+
week_number: week_number
|
55
|
+
}
|
56
|
+
end
|
57
|
+
end
|