renalware-core 2.0.149 → 2.0.151
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +23 -2
- data/app/assets/config/renalware/core/manifest.js +1 -0
- data/app/assets/images/renalware/icons/align-justify.svg +3 -0
- data/app/assets/images/renalware/icons/bar-chart.svg +1 -0
- data/app/assets/images/renalware/icons/chart-bar.svg +1 -0
- data/app/assets/images/renalware/icons/chart.svg +3 -0
- data/app/assets/images/renalware/icons/list-bullet.svg +1 -0
- data/app/assets/images/renalware/icons/list.svg +8 -0
- data/app/assets/javascripts/renalware/README.md +25 -1
- data/app/assets/javascripts/renalware/components/dialogs.js.erb +3 -1
- data/app/assets/javascripts/renalware/components/hd.js +2 -2
- data/app/assets/javascripts/renalware/components/letters.js +1 -1
- data/app/assets/javascripts/renalware/components/masonry.run.js +2 -2
- data/app/assets/javascripts/renalware/components/patient_menu.js +1 -1
- data/app/assets/javascripts/renalware/components/toggler.js +1 -1
- data/app/assets/javascripts/renalware/rollup_compiled.css +87457 -0
- data/app/assets/javascripts/renalware/rollup_compiled.js +3148 -3
- data/app/assets/stylesheets/renalware/core.scss +1 -0
- data/app/assets/stylesheets/renalware/modules/_hd.scss +8 -4
- data/app/assets/stylesheets/renalware/modules/_pathology.scss +8 -1
- data/app/assets/stylesheets/renalware/modules/_pd.scss +35 -0
- data/app/assets/stylesheets/renalware/partials/_charting.scss +17 -0
- data/app/assets/stylesheets/renalware/partials/_forms.scss +5 -1
- data/app/assets/stylesheets/renalware/partials/_simple_form.scss +8 -0
- data/app/assets/stylesheets/renalware/partials/_utilities.scss +12 -0
- data/app/assets/stylesheets/tailwind/tailwind.css +3 -0
- data/app/components/renalware/application_component.rb +2 -1
- data/app/components/renalware/events/{biopsies_component.html.slim → event_list_component.html.slim} +5 -4
- data/app/components/renalware/events/event_list_component.rb +77 -0
- data/app/components/renalware/hd/administer_prescription_dropdown_component.rb +1 -5
- data/app/components/renalware/hd/prescription_last_administration_component.html.slim +0 -1
- data/app/components/renalware/hd/prescription_last_administration_component.rb +8 -7
- data/app/components/renalware/letters/unread_electronic_ccs_component.rb +1 -0
- data/app/components/renalware/pathology/chart_component.html.slim +5 -0
- data/app/components/renalware/pathology/chart_component.rb +40 -0
- data/app/components/renalware/pathology/sparkline_component.html.slim +15 -0
- data/app/components/renalware/pathology/sparkline_component.rb +135 -0
- data/app/components/renalware/patients/side_menu_component.rb +2 -11
- data/app/components/renalware/pd/adequacy_results_component.html.slim +9 -0
- data/app/components/renalware/pd/adequacy_results_component.rb +39 -0
- data/app/components/renalware/pd/pet_results_component.html.slim +37 -0
- data/app/components/renalware/pd/pet_results_component.rb +84 -0
- data/app/{views/renalware/surveys/_eq5d_summary_part.html.slim → components/renalware/surveys/eq5d_component.html.slim} +5 -5
- data/app/{models/renalware/surveys/eq5d_summary_part.rb → components/renalware/surveys/eq5d_component.rb} +7 -5
- data/app/{views/renalware/surveys/_pos_s_summary_part.html.slim → components/renalware/surveys/pos_s_component.html.slim} +6 -9
- data/app/{models/renalware/surveys/pos_s_summary_part.rb → components/renalware/surveys/pos_s_component.rb} +9 -5
- data/app/components/renalware/system/admin_menu_component.rb +2 -2
- data/app/components/renalware/system/article_component.html.slim +3 -0
- data/app/components/renalware/system/article_component.rb +9 -0
- data/app/controllers/renalware/admissions/consults_controller.rb +1 -1
- data/app/controllers/renalware/concerns/pdf_renderable.rb +1 -1
- data/app/controllers/renalware/hd/scheduling/diaries_controller.rb +1 -1
- data/app/controllers/renalware/medications/prescriptions_controller.rb +1 -1
- data/app/controllers/renalware/pathology/charts_controller.rb +21 -0
- data/app/controllers/renalware/pathology/current_observation_results_controller.rb +1 -1
- data/app/controllers/renalware/pathology/historical_observation_results_controller.rb +1 -1
- data/app/controllers/renalware/pathology/nearest_observation_results_controller.rb +52 -0
- data/app/controllers/renalware/pathology/observation_requests_controller.rb +1 -1
- data/app/controllers/renalware/pathology/observations_controller.rb +26 -2
- data/app/controllers/renalware/pathology/requests/requests_controller.rb +7 -5
- data/app/controllers/renalware/pd/adequacy_completions_controller.rb +18 -0
- data/app/controllers/renalware/pd/adequacy_results_controller.rb +98 -0
- data/app/controllers/renalware/pd/pet_completions_controller.rb +18 -0
- data/app/controllers/renalware/pd/pet_results_controller.rb +122 -0
- data/app/controllers/renalware/pd/unified_pet_adequacies_controller.rb +102 -0
- data/app/controllers/renalware/renal/aki_alerts_controller.rb +1 -1
- data/app/controllers/renalware/renal/registry_preflight_checks_controller.rb +55 -19
- data/app/documents/renalware/age.rb +3 -1
- data/app/helpers/renalware/application_helper.rb +7 -7
- data/app/helpers/renalware/article_helper.rb +3 -3
- data/app/helpers/renalware/boolean_helper.rb +15 -0
- data/app/helpers/renalware/clipboard_helper.rb +2 -3
- data/app/helpers/renalware/dashboards_helper.rb +2 -2
- data/app/helpers/renalware/definition_list_helper.rb +3 -3
- data/app/helpers/renalware/devise_helper.rb +1 -1
- data/app/helpers/renalware/form_helper.rb +2 -2
- data/app/helpers/renalware/letters_helper.rb +1 -1
- data/app/helpers/renalware/link_helper.rb +1 -1
- data/app/helpers/renalware/mdm_helper.rb +1 -0
- data/app/helpers/renalware/navigation_helper.rb +1 -1
- data/app/helpers/renalware/patient_helper.rb +2 -2
- data/app/helpers/renalware/snippets_helper.rb +9 -10
- data/app/helpers/renalware/toggle_helper.rb +6 -6
- data/app/helpers/renalware/tooltip_helper.rb +14 -16
- data/app/inputs/clock_picker_input.rb +3 -3
- data/app/inputs/date_picker_input.rb +3 -3
- data/app/inputs/simple_time_input.rb +3 -3
- data/app/inputs/trix_editor_input.rb +2 -0
- data/app/javascript/renalware/controllers/blas_controller.js +37 -0
- data/app/javascript/renalware/controllers/modal_controller.js +137 -0
- data/app/javascript/renalware/controllers/pathology/sparklines_controller.js +206 -0
- data/app/javascript/renalware/controllers/pd/pet_charts_controller.js +169 -0
- data/app/javascript/renalware/controllers/session_controller.js +1 -1
- data/app/javascript/renalware/controllers/simple_toggle_controller.js +17 -0
- data/app/javascript/renalware/controllers/tabs_controller.js +43 -0
- data/app/javascript/renalware/controllers/toggle_controller.js +2 -2
- data/app/javascript/renalware/index.js +10 -0
- data/app/models/concerns/renalware/patients_ransack_helper.rb +2 -0
- data/app/models/renalware/clinics/body_surface_area.rb +40 -0
- data/app/models/renalware/clinics/clinic_visit.rb +21 -1
- data/app/models/renalware/clinics/total_body_water.rb +63 -0
- data/app/models/renalware/events/advanced_care_plan.rb +24 -0
- data/app/models/renalware/events/clinical_frailty_score.rb +24 -0
- data/app/models/renalware/feeds/hl7_message.rb +1 -0
- data/app/models/renalware/hd/prescription_last_administration_query.rb +4 -0
- data/app/models/renalware/hd/session_forms/pdf_renderer.rb +1 -1
- data/app/models/renalware/hd/sessions/auditable_session_collection.rb +4 -1
- data/app/models/renalware/letters/html_renderer.rb +1 -1
- data/app/models/renalware/letters/printing/duplex_interleaved_pdf_renderer.rb +1 -1
- data/app/models/renalware/letters/recipient_address_pdf_renderer.rb +1 -1
- data/app/models/renalware/pathology/nearest_observations_query.rb +44 -0
- data/app/models/renalware/pathology/observations_jsonb_serializer.rb +1 -1
- data/app/models/renalware/patient.rb +16 -1
- data/app/models/renalware/patients/alert.rb +1 -0
- data/app/models/renalware/patients/ingestion/update_master_patient_index.rb +1 -0
- data/app/models/renalware/patients/patient_hospital_identifiers.rb +1 -0
- data/app/models/renalware/pd.rb +2 -0
- data/app/models/renalware/pd/adequacy_calculated_attributes.rb +159 -0
- data/app/models/renalware/pd/adequacy_result.rb +76 -0
- data/app/models/renalware/pd/apd/glucose_calculator.rb +1 -0
- data/app/models/renalware/pd/patient.rb +4 -0
- data/app/models/renalware/pd/pet_dextrose_concentration.rb +17 -0
- data/app/models/renalware/pd/pet_result.rb +92 -0
- data/app/models/renalware/pd/unified_pet_adequacy_form.rb +46 -0
- data/app/models/renalware/renal/registry/preflight_checks/missing_esrf_query.rb +50 -0
- data/app/models/renalware/snippets/duplicate_snippet_title_generator.rb +1 -0
- data/app/models/renalware/transplants/recipient_workup_builder.rb +1 -0
- data/app/models/renalware/transplants/registration_status.rb +1 -1
- data/app/models/renalware/ukrdc/outgoing/rendering/patient_number.rb +1 -1
- data/app/models/renalware/user.rb +10 -0
- data/app/pdfs/renalware/events/event_pdf.rb +1 -0
- data/app/policies/renalware/events/advanced_care_plan_policy.rb +10 -0
- data/app/policies/renalware/events/clinical_frailty_score_policy.rb +10 -0
- data/app/policies/renalware/pd/adequacy_result_policy.rb +15 -0
- data/app/policies/renalware/pd/pet_result_policy.rb +15 -0
- data/app/policies/renalware/renal/registry_preflight_check_policy.rb +4 -0
- data/app/presenters/renalware/clinical/profile_presenter.rb +1 -0
- data/app/presenters/renalware/hd/dashboard_presenter.rb +1 -0
- data/app/presenters/renalware/hd/profile_presenter.rb +1 -0
- data/app/presenters/renalware/hd/scheduling/diary_presenter.rb +1 -0
- data/app/presenters/renalware/hd/session_presenter.rb +1 -0
- data/app/presenters/renalware/hd/unmet_preferences_presenter.rb +1 -1
- data/app/presenters/renalware/mdm_patients_presenter.rb +1 -0
- data/app/presenters/renalware/pd/dashboard_presenter.rb +10 -2
- data/app/presenters/renalware/ukrdc/patient_presenter.rb +1 -0
- data/app/presenters/renalware/user_session_presenter.rb +1 -1
- data/app/validators/renalware/patients/nhs_number_validator.rb +88 -0
- data/app/values/renalware/address.rb +1 -0
- data/app/views/renalware/accesses/assessments/show.html.slim +1 -1
- data/app/views/renalware/accesses/procedures/show.html.slim +1 -1
- data/app/views/renalware/accesses/profiles/show.html.slim +1 -1
- data/app/views/renalware/admin/cache/show.html.slim +36 -0
- data/app/views/renalware/admin/playgrounds/show.html.slim +3 -0
- data/app/views/renalware/clinical/profiles/show.html.slim +11 -1
- data/app/views/renalware/clinics/clinic_visits/_table.html.slim +2 -0
- data/app/views/renalware/clinics/clinic_visits/_table_row.html.slim +2 -0
- data/app/views/renalware/dashboard/letters/_letter.html.slim +1 -1
- data/app/views/renalware/directory/people/show.html.slim +1 -1
- data/app/views/renalware/events/advanced_care_plans/_cell.html.slim +2 -0
- data/app/views/renalware/events/advanced_care_plans/_inputs.html.slim +4 -0
- data/app/views/renalware/events/advanced_care_plans/_toggled_cell.html.slim +8 -0
- data/app/views/renalware/events/clinical_frailty_score/_cell.html.slim +2 -0
- data/app/views/renalware/events/clinical_frailty_score/_inputs.html.slim +4 -0
- data/app/views/renalware/events/clinical_frailty_score/_toggled_cell.html.slim +8 -0
- data/app/views/renalware/events/events/_table.html.slim +1 -1
- data/app/views/renalware/hd/current_profile/_show.html.slim +1 -1
- data/app/views/renalware/hd/current_profile/show.html.slim +1 -1
- data/app/views/renalware/hd/prescription_administrations/_form.html.slim +2 -0
- data/app/views/renalware/hd/sessions/_show.html.slim +1 -1
- data/app/views/renalware/hd/witnesses/_form.html.slim +2 -0
- data/app/views/renalware/letters/electronic_receipts/_table.html.slim +1 -1
- data/app/views/renalware/low_clearance/dashboards/show.html.slim +10 -0
- data/app/views/renalware/mdm/_pathology.html.slim +0 -1
- data/app/views/renalware/mdm/show.html.slim +1 -1
- data/app/views/renalware/navigation/_menu.html.slim +1 -0
- data/app/views/renalware/navigation/_pd.html.slim +5 -0
- data/app/views/renalware/pathology/charts/show.html.slim +11 -0
- data/app/views/renalware/pathology/current_observation_results/index.html.slim +6 -0
- data/app/views/renalware/pathology/historical_observation_results/_table.html.slim +4 -3
- data/app/views/renalware/pathology/historical_observation_results/index.html.slim +1 -1
- data/app/views/renalware/pathology/observations/_diff.html.slim +1 -1
- data/app/views/renalware/patients/patients/show.html.slim +1 -1
- data/app/views/renalware/pd/_exit_site_infections.html.slim +4 -0
- data/app/views/renalware/pd/_peritonitis_episodes.html.slim +3 -0
- data/app/views/renalware/pd/adequacy_completions/_filters.html.slim +19 -0
- data/app/views/renalware/pd/adequacy_completions/index.html.slim +4 -0
- data/app/views/renalware/pd/adequacy_results/_form_fields.html.slim +9 -0
- data/app/views/renalware/pd/adequacy_results/_table.html.slim +72 -0
- data/app/views/renalware/pd/adequacy_results/edit.html.slim +89 -0
- data/app/views/renalware/pd/adequacy_results/index.js.erb +1 -0
- data/app/views/renalware/pd/adequacy_results/new.html.slim +8 -0
- data/app/views/renalware/pd/dashboards/show.html.slim +3 -0
- data/app/views/renalware/pd/dashboards/show/_page_actions.html.slim +14 -0
- data/app/views/renalware/pd/pet_completions/_filters.html.slim +24 -0
- data/app/views/renalware/pd/pet_completions/index.html.slim +4 -0
- data/app/views/renalware/pd/pet_results/_form_fields.html.slim +12 -0
- data/app/views/renalware/pd/pet_results/_pathology_results.html.slim +36 -0
- data/app/views/renalware/pd/pet_results/_table.html.slim +62 -0
- data/app/views/renalware/pd/pet_results/edit.html.slim +35 -0
- data/app/views/renalware/pd/pet_results/index.js.erb +1 -0
- data/app/views/renalware/pd/pet_results/new.html.slim +8 -0
- data/app/views/renalware/pd/unified_pet_adequacies/_form.html.slim +22 -0
- data/app/views/renalware/pd/unified_pet_adequacies/new.html.slim +2 -0
- data/app/views/renalware/renal/profiles/show.html.slim +1 -1
- data/app/views/renalware/renal/registry_preflight_checks/_filters.html.slim +5 -3
- data/app/views/renalware/renal/registry_preflight_checks/_navigation.html.slim +1 -0
- data/app/views/renalware/renal/registry_preflight_checks/deaths.html.slim +2 -1
- data/app/views/renalware/renal/registry_preflight_checks/missing_esrf.html.slim +12 -0
- data/app/views/renalware/renal/registry_preflight_checks/patients.html.slim +1 -2
- data/app/views/renalware/surveys/dashboards/show.html.slim +2 -2
- data/app/views/renalware/transplants/donor_workups/show.html.slim +1 -1
- data/app/views/renalware/transplants/mdm/_bottom.html.slim +3 -1
- data/app/views/renalware/transplants/recipient_followups/show.html.slim +1 -1
- data/app/views/renalware/transplants/recipient_operations/show.html.slim +1 -1
- data/app/views/renalware/transplants/recipient_workups/show.html.slim +1 -1
- data/app/views/renalware/transplants/registrations/show.html.slim +1 -1
- data/config/initializers/inflections.rb +8 -0
- data/config/initializers/wicked_pdf.rb +12 -0
- data/config/locales/en-GB.yml +1 -1
- data/config/locales/renalware/events/advanced_care_plan.en.yml +12 -0
- data/config/locales/renalware/events/biopsy.en.yml +2 -0
- data/config/locales/renalware/events/clinical_frailty_score.en.yml +16 -0
- data/config/locales/renalware/events/clinical_frailty_score_component.en.yml +8 -0
- data/config/locales/renalware/nhs_number.en.yml +6 -0
- data/config/locales/renalware/pd/adequacy_result.en.yml +9 -0
- data/config/locales/renalware/pd/dashboard.en.yml +3 -0
- data/config/locales/renalware/pd/pet_result.en.yml +23 -0
- data/config/locales/renalware/renal/registry.en.yml +1 -0
- data/config/routes/pathology.rb +6 -0
- data/config/routes/pd.rb +5 -0
- data/config/routes/renal.rb +1 -0
- data/db/functions/generate_secure_id_v01.sql +1 -1
- data/db/migrate/20200226145010_add_unique_indexes.rb +46 -0
- data/db/migrate/20200421082715_add_body_surface_area_to_clinic_visits.rb +8 -0
- data/db/migrate/20200421132911_create_pd_pet_dextrose_concentrations.rb +13 -0
- data/db/migrate/20200421143546_create_pet_results.rb +66 -0
- data/db/migrate/20200427123229_create_adequacy_results.rb +54 -0
- data/db/migrate/20200616115709_add_height_weight_to_pd_adequacy_results.rb +8 -0
- data/db/migrate/20200618144228_add_feature_flags_to_users.rb +14 -0
- data/db/seeds/default/events/event_types.csv +2 -0
- data/lib/renalware/engine.rb +4 -2
- data/lib/renalware/version_number.rb +11 -0
- data/lib/tasks/renalware.rake +7 -1
- data/spec/factories/accesses/profiles.rb +1 -0
- data/spec/factories/events/events_types.rb +12 -0
- data/spec/factories/patients/patients.rb +22 -1
- data/spec/factories/pd/adequacy_results.rb +16 -0
- data/spec/factories/pd/pet_results.rb +9 -0
- metadata +115 -25
- data/app/components/renalware/events/biopsies_component.rb +0 -20
- data/lib/renalware/version.rb +0 -5
@@ -411,19 +411,23 @@ use flexbox to layout items inside each prescription.
|
|
411
411
|
.hd-drug--name {
|
412
412
|
font-weight: bold;
|
413
413
|
}
|
414
|
+
|
414
415
|
.hd-drug--name,
|
415
416
|
.hd-drug--dose,
|
416
417
|
.hd-drug--route,
|
417
418
|
.hd-drug--prescribed-on,
|
418
|
-
.hd-drug--frequency
|
419
|
+
.hd-drug--frequency,
|
420
|
+
.hd-drug--prescriber-name,
|
421
|
+
.hd-drug--prescriber-position {
|
419
422
|
display: inline-block;
|
420
423
|
padding-right: .5rem;
|
421
424
|
color: $dark-grey;
|
422
425
|
}
|
423
426
|
|
424
|
-
.hd-drug--prescriber-name
|
425
|
-
|
426
|
-
color: $
|
427
|
+
.hd-drug--prescriber-name,
|
428
|
+
.hd-drug--prescriber-position {
|
429
|
+
color: $muted-dark-grey;
|
430
|
+
padding-right: .3rem;
|
427
431
|
}
|
428
432
|
|
429
433
|
.hd-drug--termination {
|
@@ -37,10 +37,17 @@ table#observations {
|
|
37
37
|
|
38
38
|
td {
|
39
39
|
height: 2rem;
|
40
|
-
overflow:
|
40
|
+
overflow: hidden;
|
41
41
|
padding: 0 .2rem;
|
42
42
|
position: relative;
|
43
43
|
text-align: center;
|
44
|
+
text-overflow: ellipsis;
|
45
|
+
max-width: 4rem;
|
46
|
+
|
47
|
+
&.triangle_in_corner {
|
48
|
+
overflow: visible;
|
49
|
+
max-width: unset;
|
50
|
+
}
|
44
51
|
|
45
52
|
// Generated with http://triangle.designyourcode.io/
|
46
53
|
.triangle-top-right {
|
@@ -1,3 +1,38 @@
|
|
1
|
+
.pet-results--samples-table,
|
2
|
+
.adequacy-results--samples-table {
|
3
|
+
max-width: 640px;
|
4
|
+
|
5
|
+
th {
|
6
|
+
width: 14.3%;
|
7
|
+
}
|
8
|
+
|
9
|
+
thead, tbody, th, td {
|
10
|
+
border: none;
|
11
|
+
text-align: center;
|
12
|
+
}
|
13
|
+
|
14
|
+
input {
|
15
|
+
margin: 0;
|
16
|
+
}
|
17
|
+
}
|
18
|
+
|
19
|
+
.adequacy-path-table {
|
20
|
+
background-color: transparent;
|
21
|
+
thead, tbody, th, td {
|
22
|
+
border: none;
|
23
|
+
text-align: center;
|
24
|
+
}
|
25
|
+
|
26
|
+
thead tr:first-child th {
|
27
|
+
font-style: italic;
|
28
|
+
text-align: center;
|
29
|
+
}
|
30
|
+
|
31
|
+
.bottom-border {
|
32
|
+
border-bottom: 1px solid #ccc;
|
33
|
+
}
|
34
|
+
}
|
35
|
+
|
1
36
|
.current-regime {
|
2
37
|
h3 {
|
3
38
|
font-size: 1rem;
|
@@ -0,0 +1,17 @@
|
|
1
|
+
.bart-chart-icon {
|
2
|
+
position: relative; // required for safari otherwise user cannot click on :before content
|
3
|
+
display: inline-block; // required otherwise IE11 will not be able to click on it
|
4
|
+
|
5
|
+
i {
|
6
|
+
@extend %fa-icon;
|
7
|
+
@extend .fas;
|
8
|
+
font-weight: 600;
|
9
|
+
pointer-events: none;
|
10
|
+
text-align: center;
|
11
|
+
width: 1.2rem;
|
12
|
+
|
13
|
+
&:before {
|
14
|
+
content: asset-data-url("renalware/icons/bar-chart.svg");
|
15
|
+
}
|
16
|
+
}
|
17
|
+
}
|
@@ -182,6 +182,10 @@ article {
|
|
182
182
|
display: inline-block;
|
183
183
|
margin-right: .5rem;
|
184
184
|
}
|
185
|
+
|
186
|
+
&.right {
|
187
|
+
text-align: right;
|
188
|
+
}
|
185
189
|
}
|
186
190
|
|
187
191
|
h3 {
|
@@ -205,7 +209,7 @@ article {
|
|
205
209
|
color: $white;
|
206
210
|
display: block;
|
207
211
|
float: right;
|
208
|
-
padding: 0.
|
212
|
+
padding: 0.2rem 0.4rem;
|
209
213
|
text-decoration: none;
|
210
214
|
margin-left: 0.5rem;
|
211
215
|
|
@@ -1,9 +1,10 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module Renalware
|
4
|
-
class ApplicationComponent <
|
4
|
+
class ApplicationComponent < ViewComponent::Base
|
5
5
|
include Renalware::Engine.routes.url_helpers
|
6
6
|
include Pundit::Helper
|
7
|
+
delegate :current_user, :policy, to: :helpers
|
7
8
|
|
8
9
|
# Not sure why include Renalware::Engine.routes.url_helpers does not make the
|
9
10
|
# engine urls visible in the views (seems to resolve alwatys to /assets?..)
|
data/app/components/renalware/events/{biopsies_component.html.slim → event_list_component.html.slim}
RENAMED
@@ -1,14 +1,15 @@
|
|
1
1
|
article.events
|
2
2
|
header
|
3
|
-
h2
|
3
|
+
h2= title
|
4
4
|
.supplemental
|
5
|
-
span= "#{
|
5
|
+
span= "#{event_count} of #{total_event_count}"
|
6
6
|
span.noprint
|
7
7
|
= link_to "View All",
|
8
8
|
renalware.patient_events_path(patient),
|
9
9
|
class: "button secondary"
|
10
10
|
|
11
|
+
/ NB: Perhaps this component should not lean on external partials?
|
11
12
|
= render "renalware/events/events/table",
|
12
|
-
events:
|
13
|
+
events: events,
|
13
14
|
exclude_type_column: true,
|
14
|
-
|
15
|
+
description_column_title: description_column_title
|
@@ -0,0 +1,77 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Renalware
|
4
|
+
module Events
|
5
|
+
# A generic view component for displaying a summarised list of events of a certain
|
6
|
+
# type - for example Biopsy events - to add to a dashboard or MDM.
|
7
|
+
# Once we have configurable dashboards and MDMs it should be possible to
|
8
|
+
# drop this component onto a dashboard and configure the event class and perhaps
|
9
|
+
# some other custom parameters, and at run time the dashboard is constructed
|
10
|
+
# and will include the requested component. In this way you could choose to
|
11
|
+
# add say list components which each display a different class of event.
|
12
|
+
# Obviously some more thought needs to go into this but as a direction of
|
13
|
+
# travel it has many advantages - for example a hospital can configure the default
|
14
|
+
# dashboards and MDMs, perhaps depending on the user's role, but an individual user
|
15
|
+
# could override and build their own.
|
16
|
+
# Some parameters to think about when configuring an event component
|
17
|
+
# - event class or description - where does the event_type fit in?
|
18
|
+
# - the AR scope to use and whether this affects sorting
|
19
|
+
# - the title displayed above the list of events - is this i18n, derived from the
|
20
|
+
# event type/class, or configured when the dashboard is designed?
|
21
|
+
# - to what extent to the event partials affect display? We have these to help us
|
22
|
+
# build form inputs and display content in table cell/toggled cells, but is this flexible
|
23
|
+
# enough - e.g. is only have a Description HTML table column sufficient for displaying
|
24
|
+
# multiple custom event properties (defined in the event's document) or do we need to allow
|
25
|
+
# partials that control table structure?
|
26
|
+
#
|
27
|
+
# Perhaps a datavase-backed component configuration model could be passed into this component to
|
28
|
+
# drive the display - eg hide_if_no_data of not.
|
29
|
+
class EventListComponent < ApplicationComponent
|
30
|
+
pattr_initialize [
|
31
|
+
:patient!,
|
32
|
+
:event_class!,
|
33
|
+
limit: 6,
|
34
|
+
hide_if_no_data: false # if true and there are no events, nothing will be rendered
|
35
|
+
]
|
36
|
+
|
37
|
+
# This assumes the event class has a scope called #ordered
|
38
|
+
def events
|
39
|
+
@events ||= relation.includes(:created_by).ordered.limit(limit)
|
40
|
+
end
|
41
|
+
|
42
|
+
def event_count
|
43
|
+
@event_count ||= events.length
|
44
|
+
end
|
45
|
+
|
46
|
+
def total_event_count
|
47
|
+
@total_event_count ||= relation.count
|
48
|
+
end
|
49
|
+
|
50
|
+
def title
|
51
|
+
t(:title)
|
52
|
+
end
|
53
|
+
|
54
|
+
def description_column_title
|
55
|
+
t(:description_column_title)
|
56
|
+
end
|
57
|
+
|
58
|
+
# There is the option to prevent anything from displaying if we expose the
|
59
|
+
# render? method and return false
|
60
|
+
def render?
|
61
|
+
return true unless hide_if_no_data
|
62
|
+
|
63
|
+
event_count > 0
|
64
|
+
end
|
65
|
+
|
66
|
+
private
|
67
|
+
|
68
|
+
def relation
|
69
|
+
@relation ||= event_class.for_patient(patient)
|
70
|
+
end
|
71
|
+
|
72
|
+
def t(str)
|
73
|
+
I18n.t(str, scope: event_class.name.underscore, default: "Description")
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
@@ -5,11 +5,7 @@ module Renalware
|
|
5
5
|
class AdministerPrescriptionDropdownComponent < ApplicationComponent
|
6
6
|
include DropdownButtonHelper
|
7
7
|
include PresenterHelper
|
8
|
-
|
9
|
-
|
10
|
-
def initialize(patient:)
|
11
|
-
@patient = patient
|
12
|
-
end
|
8
|
+
pattr_initialize [:patient!]
|
13
9
|
|
14
10
|
def prescriptions_to_give_on_hd
|
15
11
|
@prescriptions_to_give_on_hd ||= begin
|
@@ -3,16 +3,17 @@
|
|
3
3
|
module Renalware
|
4
4
|
module HD
|
5
5
|
class PrescriptionLastAdministrationComponent < ApplicationComponent
|
6
|
-
|
7
|
-
validates :prescription, presence: true
|
8
|
-
|
9
|
-
def initialize(prescription:)
|
10
|
-
@prescription = prescription
|
11
|
-
end
|
6
|
+
pattr_initialize [:prescription!]
|
12
7
|
|
13
8
|
def last_administration
|
9
|
+
return if prescription.blank?
|
10
|
+
|
14
11
|
@last_administration ||=
|
15
|
-
PrescriptionLastAdministrationQuery.
|
12
|
+
PrescriptionLastAdministrationQuery.call(prescription: prescription)
|
13
|
+
end
|
14
|
+
|
15
|
+
def render?
|
16
|
+
last_administration.present?
|
16
17
|
end
|
17
18
|
end
|
18
19
|
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Renalware
|
4
|
+
module Pathology
|
5
|
+
class ChartComponent < ApplicationComponent
|
6
|
+
pattr_initialize [:current_user!, :patient!, :observation_description!]
|
7
|
+
|
8
|
+
def chart_data
|
9
|
+
@chart_data ||= begin
|
10
|
+
Pathology.cast_patient(patient)
|
11
|
+
.observations
|
12
|
+
.where(description_id: observation_description.id)
|
13
|
+
.order(:observed_at)
|
14
|
+
.pluck([:observed_at, :result])
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
# TODO: cache key should expire when a new observation arrives of this type
|
19
|
+
def cache_key
|
20
|
+
"#{patient.cache_key}/chart/#{observation_description.id}"
|
21
|
+
end
|
22
|
+
|
23
|
+
# Because we cache the component html inside the view sidecar, we want to
|
24
|
+
# avoid implementing this method properly - ie checking if there anything
|
25
|
+
# to render - as that would involve querying the database, thus negating
|
26
|
+
# the befit of any caching.
|
27
|
+
def render?
|
28
|
+
true
|
29
|
+
end
|
30
|
+
|
31
|
+
def options
|
32
|
+
{}
|
33
|
+
end
|
34
|
+
|
35
|
+
def dom_id
|
36
|
+
@dom_id ||= ActionView::RecordIdentifier.dom_id(observation_description)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
- cache(self, expires_in: 1.day) do
|
2
|
+
- if chart_data.any?
|
3
|
+
- use_stimulus = false
|
4
|
+
|
5
|
+
- if use_stimulus
|
6
|
+
/ This is the stimulusjs version. See sparklines_controller.js
|
7
|
+
div(data-controller="pathology-sparklines"
|
8
|
+
data-pathology-sparklines-chart-data='[["2010-06-03T16:37:00.000+01:00","106"], ["2011-06-03T16:37:00.000+01:00","110"]]')
|
9
|
+
div(data-target="pathology-sparklines.chart")
|
10
|
+
- else
|
11
|
+
/ This implementation uses ChartKick to insert the chart javascript into the
|
12
|
+
/ page. It works fine, but when there are 50 path results on screen, we are
|
13
|
+
/ inserting 50 copies of the chart defition and options. Hence a stimulusjs
|
14
|
+
/ approach might be better.
|
15
|
+
= area_chart chart_data, options.merge(height: 15, width: 80, id: dom_id)
|
@@ -0,0 +1,135 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# rubocop:disable Metrics/ClassLength
|
4
|
+
module Renalware
|
5
|
+
module Pathology
|
6
|
+
# Renders a pathology sparkline - a small graph of patient results for a particular
|
7
|
+
# OBX (observation_description) over time.
|
8
|
+
# TODO: Move the graph config into JS. Possibly use a stimulus controller
|
9
|
+
class SparklineComponent < ApplicationComponent
|
10
|
+
pattr_initialize [:current_user!, :patient!, :observation_description!]
|
11
|
+
|
12
|
+
CHART_OPTIONS = {
|
13
|
+
library: {
|
14
|
+
chart: {
|
15
|
+
type: "area",
|
16
|
+
margin: [0, 0, 0, 0],
|
17
|
+
height: 20,
|
18
|
+
width: 80,
|
19
|
+
skipClone: true,
|
20
|
+
style: {
|
21
|
+
overflow: "visible"
|
22
|
+
}
|
23
|
+
},
|
24
|
+
credits: {
|
25
|
+
enabled: false
|
26
|
+
},
|
27
|
+
title: "",
|
28
|
+
xAxis: {
|
29
|
+
type: "datetime",
|
30
|
+
tickPositions: [],
|
31
|
+
labels: {
|
32
|
+
enabled: false
|
33
|
+
},
|
34
|
+
startOnTick: false,
|
35
|
+
endOnTick: false,
|
36
|
+
title: {
|
37
|
+
text: nil
|
38
|
+
}
|
39
|
+
},
|
40
|
+
legend: {
|
41
|
+
enabled: false
|
42
|
+
},
|
43
|
+
yAxis: {
|
44
|
+
tickPositions: [0],
|
45
|
+
endOnTick: false,
|
46
|
+
startOnTick: false,
|
47
|
+
title: {
|
48
|
+
text: nil
|
49
|
+
},
|
50
|
+
min: 0,
|
51
|
+
labels: {
|
52
|
+
enabled: false
|
53
|
+
}
|
54
|
+
},
|
55
|
+
tooltip: {
|
56
|
+
hideDelay: 0,
|
57
|
+
outside: true,
|
58
|
+
shared: true,
|
59
|
+
xDateFormat: "%d-%b-%Y"
|
60
|
+
},
|
61
|
+
plotOptions: {
|
62
|
+
area: {
|
63
|
+
fillColor: {
|
64
|
+
linearGradient: {
|
65
|
+
x1: 0,
|
66
|
+
y1: 0,
|
67
|
+
x2: 0,
|
68
|
+
y2: 1
|
69
|
+
},
|
70
|
+
stops: [
|
71
|
+
[0, "#eee"],
|
72
|
+
[0.5, "#fff"]
|
73
|
+
]
|
74
|
+
}
|
75
|
+
},
|
76
|
+
series: {
|
77
|
+
animation: false,
|
78
|
+
lineWidth: 1,
|
79
|
+
shadow: false,
|
80
|
+
states: {
|
81
|
+
hover: {
|
82
|
+
lineWidth: 1
|
83
|
+
}
|
84
|
+
},
|
85
|
+
marker: {
|
86
|
+
radius: 1,
|
87
|
+
states: {
|
88
|
+
hover: {
|
89
|
+
radius: 2
|
90
|
+
}
|
91
|
+
}
|
92
|
+
},
|
93
|
+
fillOpacity: 0.25
|
94
|
+
},
|
95
|
+
column: {
|
96
|
+
negativeColor: "#910000",
|
97
|
+
borderColor: "silver"
|
98
|
+
}
|
99
|
+
}
|
100
|
+
}
|
101
|
+
}.freeze
|
102
|
+
|
103
|
+
def chart_data
|
104
|
+
@chart_data ||= begin
|
105
|
+
patient
|
106
|
+
.observations
|
107
|
+
.where(description_id: observation_description.id)
|
108
|
+
.order(:observed_at)
|
109
|
+
.pluck([:observed_at, :result])
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
113
|
+
def cache_key
|
114
|
+
"#{patient.cache_key}/sparkline/#{observation_description.id}"
|
115
|
+
end
|
116
|
+
|
117
|
+
# Because we cache the component html inside the view sidecar, we want to
|
118
|
+
# avoid implementing this method properly - ie checking if there anything
|
119
|
+
# to render - as that would involve querying the database, thus negating
|
120
|
+
# the befit of any caching.
|
121
|
+
def render?
|
122
|
+
true
|
123
|
+
end
|
124
|
+
|
125
|
+
def options
|
126
|
+
CHART_OPTIONS
|
127
|
+
end
|
128
|
+
|
129
|
+
def dom_id
|
130
|
+
@dom_id ||= ActionView::RecordIdentifier.dom_id(observation_description)
|
131
|
+
end
|
132
|
+
end
|
133
|
+
end
|
134
|
+
end
|
135
|
+
# rubocop:enable Metrics/ClassLength
|