renalware-core 2.0.0.pre.rc9 → 2.0.0.pre.rc10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/stylesheets/renalware/modules/_clinics.scss +1 -1
- data/app/assets/stylesheets/renalware/modules/_letters.scss +7 -0
- data/app/assets/stylesheets/renalware/partials/_navigation.scss +1 -1
- data/app/controllers/renalware/api/ukrdc/patients_controller.rb +2 -1
- data/app/controllers/renalware/application_controller.rb +13 -0
- data/app/controllers/renalware/base_controller.rb +0 -2
- data/app/controllers/renalware/concerns/cache_busting.rb +21 -0
- data/app/controllers/renalware/devise/passwords_controller.rb +0 -2
- data/app/controllers/renalware/devise/registrations_controller.rb +0 -2
- data/app/controllers/renalware/devise/sessions_controller.rb +0 -2
- data/app/controllers/renalware/events/events_controller.rb +2 -0
- data/app/controllers/renalware/letters/letters_controller.rb +1 -1
- data/app/controllers/renalware/pd/bag_types_controller.rb +1 -1
- data/app/controllers/renalware/virology/dashboards_controller.rb +15 -0
- data/app/controllers/renalware/virology/vaccinations_controller.rb +11 -0
- data/app/documents/renalware/patient_document.rb +9 -0
- data/app/jobs/hl7_message_example.yml +12 -12
- data/app/models/renalware/events/event.rb +28 -3
- data/app/models/renalware/pathology/create_observation_requests.rb +2 -1
- data/app/models/renalware/pathology/observation_description.rb +2 -0
- data/app/models/renalware/pathology/observation_descriptions_by_code_query.rb +2 -1
- data/app/models/renalware/pathology/observation_requests_attributes_builder.rb +14 -1
- data/app/models/renalware/pd/bag_type.rb +2 -0
- data/app/models/renalware/pd/capd_regime.rb +5 -1
- data/app/models/renalware/virology.rb +13 -0
- data/app/models/renalware/virology/profile.rb +8 -0
- data/app/models/renalware/virology/vaccination.rb +24 -0
- data/app/policies/renalware/virology/dasboard_policy.rb +8 -0
- data/app/policies/renalware/virology/vaccination_policy.rb +8 -0
- data/app/presenters/renalware/admissions/summary_part.rb +30 -0
- data/app/presenters/renalware/events/summary_part.rb +31 -0
- data/app/presenters/renalware/letters/summary_part.rb +48 -0
- data/app/presenters/renalware/medications/summary_part.rb +23 -0
- data/app/presenters/renalware/problems/summary_part.rb +19 -0
- data/app/presenters/renalware/renal/clinical_summary_presenter.rb +5 -90
- data/app/presenters/renalware/summary_part.rb +34 -0
- data/app/views/renalware/admissions/_summary_part.html.slim +14 -0
- data/app/views/renalware/clinical/_header.html.slim +3 -3
- data/app/views/renalware/clinics/visits/index.html.slim +0 -1
- data/app/views/renalware/events/events/_event.html.slim +2 -2
- data/app/views/renalware/events/events/_form.html.slim +1 -2
- data/app/views/renalware/events/events/_summary_part.html.slim +15 -0
- data/app/views/renalware/events/events/new.js.erb +2 -3
- data/app/views/renalware/events/events/simple/_event.html.slim +1 -2
- data/app/views/renalware/layouts/_patient.html.slim +1 -0
- data/app/views/renalware/letters/_summary_part.html.slim +16 -0
- data/app/views/renalware/letters/letters/index.html.slim +3 -3
- data/app/views/renalware/mdm_patients/_table.html.slim +1 -1
- data/app/views/renalware/medications/_summary_part.html.slim +18 -0
- data/app/views/renalware/patients/clinical_summaries/show.html.slim +6 -32
- data/app/views/renalware/patients/patients/_form.html.slim +13 -0
- data/app/views/renalware/patients/patients/show.html.slim +2 -0
- data/app/views/renalware/patients/patients/show/_psychosocial.html.slim +15 -0
- data/app/views/renalware/patients/side_menu/_general.html.slim +4 -0
- data/app/views/renalware/problems/problems/_summary_part.html.slim +16 -0
- data/app/views/renalware/virology/dashboards/_actions.html.slim +10 -0
- data/app/views/renalware/virology/dashboards/show.html.slim +6 -0
- data/app/views/renalware/virology/vaccinations/_cell.html.slim +2 -0
- data/app/views/renalware/virology/vaccinations/_inputs.html.slim +4 -0
- data/app/views/renalware/virology/vaccinations/_list.html.slim +14 -0
- data/app/views/renalware/virology/vaccinations/_toggled_cell.html.slim +8 -0
- data/config/locales/en-GB.yml +1 -3
- data/config/locales/en.yml +0 -11
- data/config/locales/renalware/age.yml +0 -1
- data/config/locales/renalware/clinical/allergies.en.yml +0 -3
- data/config/locales/renalware/clinical/body_composition.yml +0 -2
- data/config/locales/renalware/clinical/dry_weight.en.yml +0 -2
- data/config/locales/renalware/clinics/visit.yml +0 -2
- data/config/locales/renalware/feeds/file.en.yml +0 -1
- data/config/locales/renalware/hd/diary_slots.en.yml +0 -1
- data/config/locales/renalware/hd/prescription_administration.en.yml +0 -1
- data/config/locales/renalware/hd/session.en.yml +0 -1
- data/config/locales/renalware/hospitals/unit.yml +0 -2
- data/config/locales/renalware/letters/contact.en.yml +0 -1
- data/config/locales/renalware/letters/letter.en.yml +0 -2
- data/config/locales/renalware/low_clearance/profile.en.yml +0 -1
- data/config/locales/renalware/medications/prescription.yml +0 -2
- data/config/locales/renalware/messaging/internal/messages.en.yml +0 -2
- data/config/locales/renalware/patient.yml +0 -2
- data/config/locales/renalware/patients/side_menu.en.yml +1 -1
- data/config/locales/renalware/pd/assessments.en.yml +0 -1
- data/config/locales/renalware/pd/bag_types.yml +0 -2
- data/config/locales/renalware/pd/regime.en.yml +0 -2
- data/config/locales/renalware/pd/training_sessions.en.yml +0 -1
- data/config/locales/renalware/renal/profile.en.yml +0 -1
- data/config/locales/renalware/renal/registry.en.yml +0 -2
- data/config/locales/renalware/research/study_participant.en.yml +0 -1
- data/config/locales/renalware/snippets/snippets.en.yml +0 -1
- data/config/locales/renalware/transplants/donation.yml +0 -3
- data/config/locales/renalware/transplants/donor_followup.yml +0 -4
- data/config/locales/renalware/transplants/donor_operation.yml +0 -4
- data/config/locales/renalware/transplants/donor_workup.yml +0 -4
- data/config/locales/renalware/transplants/recipient_followup.yml +0 -2
- data/config/locales/renalware/transplants/recipient_operation.yml +0 -4
- data/config/locales/renalware/transplants/recipient_workup.yml +0 -4
- data/config/locales/renalware/transplants/registration.yml +0 -4
- data/config/locales/renalware/virology/virology.en.yml +18 -0
- data/config/routes.rb +8 -0
- data/db/migrate/20180122173922_create_virology_profiles.rb +6 -0
- data/db/migrate/20180213171805_add_display_order_cols_to_observation_descriptions.rb +12 -0
- data/db/seeds/default/events/event_types.csv +1 -0
- data/db/seeds/default/pathology/measurement_units.csv +45 -38
- data/db/seeds/default/pathology/measurement_units.rb +1 -0
- data/lib/renalware/configuration.rb +14 -0
- data/lib/renalware/engine.rb +0 -4
- data/lib/renalware/version.rb +1 -1
- data/lib/sql/index_case_stmt.rb +6 -6
- data/spec/factories/events/events_types.rb +6 -0
- data/spec/factories/virology/vaccinations.rb +6 -0
- metadata +265 -243
- data/app/controllers/application_controller.rb +0 -6
- data/app/models/renalware/pathology/view_current_observation_results.rb.dead +0 -47
- data/app/presenters/renalware/pathology/current_observation_results.dead/html_table_view.rb.dead +0 -67
- data/app/views/renalware/layouts/application.html.slim +0 -44
- data/app/views/renalware/patients/clinical_summaries/_admissions.html.slim +0 -11
- data/app/views/renalware/patients/clinical_summaries/_events.html.slim +0 -11
- data/app/views/renalware/patients/clinical_summaries/_letters.html.slim +0 -12
- data/app/views/renalware/patients/clinical_summaries/_prescriptions.html.slim +0 -16
- data/app/views/renalware/patients/clinical_summaries/_problems.html.slim +0 -13
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 020dc0513f4623aebbe15a14363cd05525eaed0405a8deacb057dcd585e39114
|
4
|
+
data.tar.gz: 89f150581ec3fb071333af4682c971c0564cf71f0c6284d20941e2a0839c14e3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 92079d58e50dcc7a2475ee28850baaaf804e129b15accef98d542fcca39bb5da6691135f307f4098636ca134ad8673c6c139aad6cb656eb90451dced4f4cacdc
|
7
|
+
data.tar.gz: 994ec364d3c9bed98075d17742390327685c5b46465ab016531c25db804e4500709fc4a6907b8e99eb45857785884db3638097a54dae9e0c88836595b369ec3c
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module Renalware
|
2
2
|
module API
|
3
3
|
module UKRDC
|
4
|
-
class PatientsController <
|
4
|
+
class PatientsController < BaseController
|
5
5
|
respond_to :xml
|
6
6
|
|
7
7
|
def show
|
@@ -18,6 +18,7 @@ module Renalware
|
|
18
18
|
|
19
19
|
def patient_presenter
|
20
20
|
patient = Renalware::Patient.find_by!(secure_id: params[:id])
|
21
|
+
authorize patient
|
21
22
|
Renalware::UKRDC::PatientPresenter.new(patient)
|
22
23
|
end
|
23
24
|
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
require_dependency "renalware"
|
2
|
+
|
3
|
+
module Renalware
|
4
|
+
# Note that we inherit from ::ApplicationController which is defined in the host application.
|
5
|
+
# This allows application to
|
6
|
+
# - define the default layout
|
7
|
+
# - intercept requests with before_action etc.
|
8
|
+
class ApplicationController < ::ApplicationController
|
9
|
+
# Prevent CSRF attacks by raising an exception.
|
10
|
+
# For APIs, you may want to use :null_session instead.
|
11
|
+
protect_from_forgery with: :exception
|
12
|
+
end
|
13
|
+
end
|
@@ -10,8 +10,6 @@ module Renalware
|
|
10
10
|
|
11
11
|
rescue_from Pundit::NotAuthorizedError, with: :user_not_authorized
|
12
12
|
|
13
|
-
layout "renalware/layouts/application"
|
14
|
-
|
15
13
|
# Expose a few attributes for use in the patient layout and its partials.
|
16
14
|
# As a rule, we should be passing variables explicitly to all view using `locals`;
|
17
15
|
# however, while not a fan of `helper_method`, exposing e.g. current_patient this (akin to
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require "active_support/concern"
|
2
|
+
|
3
|
+
# The host Rails application's ApplicationController could choose to mix-in this concern in order to
|
4
|
+
# prevent the browser from being able navigate Back to logged-in pages once the user has logged out.
|
5
|
+
module Renalware
|
6
|
+
module Concerns::CacheBusting
|
7
|
+
extend ActiveSupport::Concern
|
8
|
+
|
9
|
+
included do
|
10
|
+
class_eval do
|
11
|
+
before_action :bust_cache
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
def bust_cache
|
16
|
+
response.headers["Cache-Control"] = "no-cache, no-store, max-age=0, must-revalidate"
|
17
|
+
response.headers["Pragma"] = "no-cache"
|
18
|
+
response.headers["Expires"] = "Fri, 01 Jan 1990 00:00:00 GMT"
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -2,8 +2,6 @@ module Renalware
|
|
2
2
|
class Devise::SessionsController < ::Devise::SessionsController
|
3
3
|
include Concerns::DeviseControllerMethods
|
4
4
|
|
5
|
-
layout "renalware/layouts/application"
|
6
|
-
|
7
5
|
# Define the path to go to after logging in:
|
8
6
|
# - if the user has never before logged-in, devise will take them to the root path (dashboard)
|
9
7
|
# - if the user's session timed-out less that 30 minutes ago, we take them back to the
|
@@ -6,6 +6,8 @@ module Renalware
|
|
6
6
|
class EventsController < BaseController
|
7
7
|
include Renalware::Concerns::Pageable
|
8
8
|
|
9
|
+
# HTML GET when rendering the new form
|
10
|
+
# JS GET after user selects event type, prompting us to return event-specific form fields
|
9
11
|
def new
|
10
12
|
save_path_to_return_to
|
11
13
|
render locals: {
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require_dependency "renalware/virology"
|
2
|
+
|
3
|
+
module Renalware
|
4
|
+
module Virology
|
5
|
+
class DashboardsController < BaseController
|
6
|
+
def show
|
7
|
+
authorize patient
|
8
|
+
render locals: {
|
9
|
+
patient: patient,
|
10
|
+
vaccinations: Vaccination.for_patient(patient)
|
11
|
+
}
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
require_dependency "renalware/events"
|
2
|
+
require_dependency "renalware/virology"
|
3
|
+
|
4
|
+
# This controller is mostly empty - we are using it for mainly routing and to let us
|
5
|
+
# override the events 'new' and 'edit' templates. See the base class for most functionality.
|
6
|
+
module Renalware
|
7
|
+
module Virology
|
8
|
+
class VaccinationsController < Events::EventsController
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
@@ -23,6 +23,15 @@ module Renalware
|
|
23
23
|
end
|
24
24
|
attribute :referral, Referral
|
25
25
|
|
26
|
+
class Psychosocial < Document::Embedded
|
27
|
+
attribute :housing, String
|
28
|
+
attribute :social_network, String
|
29
|
+
attribute :care_package, String
|
30
|
+
attribute :other, String
|
31
|
+
attribute :updated_at, Date
|
32
|
+
end
|
33
|
+
attribute :psychosocial, Psychosocial
|
34
|
+
|
26
35
|
class History < Document::Embedded
|
27
36
|
attribute :alcohol, Document::Enum, enums: %i(never rarely social heavy)
|
28
37
|
attribute :smoking, Document::Enum, enums: %i(no ex yes) # RRSMOKING %i(never former current)
|
@@ -5,18 +5,18 @@ raw_message: |
|
|
5
5
|
PV1||Inpatient|NIBC^^^^^^^^|||||MID^KINGS MIDWIVES||||||||||NHS|HXF888888^^^Visit Number|||||||||
|
6
6
|
ORC|RE|^PCS|09B0099478^LA||CM||||200911111841|||MID^KINGS MIDWIVES|||||||
|
7
7
|
OBR|1|^PCS|09B0099478^LA|FBC^FULL BLOOD COUNT^MB||200911111841|200911111841|||||||200911111841|B^Blood|MID^KINGS MIDWIVES||09B0099478||||200911121646||HM|F||||||||||||||||||
|
8
|
-
OBX|1|TX|WBC^WBC^MB||6.09||||||F|||200911112026||BBKA^
|
9
|
-
OBX|2|TX|RBC^RBC^MB||4.00||||||F|||200911112026||BBKA^
|
10
|
-
OBX|3|TX|HGB^Hb^MB||11.8||||||F|||200911112026||BBKA^
|
11
|
-
OBX|4|TX|PCV^PCV^MB||0.344||||||F|||200911112026||BBKA^
|
12
|
-
OBX|5|TX|MCV^MCV^MB||85.9||||||F|||200911112026||BBKA^
|
13
|
-
OBX|6|TX|MCH^MCH^MB||29.5||||||F|||200911112026||BBKA^
|
14
|
-
OBX|7|TX|MCHC^MCHC^MB||34.4||||||F|||200911112026||BBKA^
|
15
|
-
OBX|8|TX|RDW^RDW^MB||13.3||||||F|||200911112026||BBKA^
|
16
|
-
OBX|9|TX|PLT^PLT^MB||259||||||F|||200911112026||BBKA^
|
17
|
-
OBX|10|TX|MPV^Mean Platelet Volume^MB||8.3||||||F|||200911112026||BBKA^
|
18
|
-
OBX|11|TX|NRBC^Machine NRBC^MB||<0.2%||||||F|||200911112026||BBKA^
|
19
|
-
OBX|12|TX|HYPO^% HYPO^MB||0.2||||||F|||200911112026||BBKA^
|
8
|
+
OBX|1|TX|WBC^WBC^MB||6.09||||||F|||200911112026||BBKA^Donald DUCK|
|
9
|
+
OBX|2|TX|RBC^RBC^MB||4.00||||||F|||200911112026||BBKA^Donald DUCK|
|
10
|
+
OBX|3|TX|HGB^Hb^MB||11.8||||||F|||200911112026||BBKA^Donald DUCK|
|
11
|
+
OBX|4|TX|PCV^PCV^MB||0.344||||||F|||200911112026||BBKA^Donald DUCK|
|
12
|
+
OBX|5|TX|MCV^MCV^MB||85.9||||||F|||200911112026||BBKA^Donald DUCK|
|
13
|
+
OBX|6|TX|MCH^MCH^MB||29.5||||||F|||200911112026||BBKA^Donald DUCK|
|
14
|
+
OBX|7|TX|MCHC^MCHC^MB||34.4||||||F|||200911112026||BBKA^Donald DUCK|
|
15
|
+
OBX|8|TX|RDW^RDW^MB||13.3||||||F|||200911112026||BBKA^Donald DUCK|
|
16
|
+
OBX|9|TX|PLT^PLT^MB||259||||||F|||200911112026||BBKA^Donald DUCK|
|
17
|
+
OBX|10|TX|MPV^Mean Platelet Volume^MB||8.3||||||F|||200911112026||BBKA^Donald DUCK|
|
18
|
+
OBX|11|TX|NRBC^Machine NRBC^MB||<0.2%||||||F|||200911112026||BBKA^Donald DUCK|
|
19
|
+
OBX|12|TX|HYPO^% HYPO^MB||0.2||||||F|||200911112026||BBKA^Donald DUCK|
|
20
20
|
OBX|13|TX|NEUT^Neutrophil Count^MB|| 3.16||||||F|||200911121646||BHISVC01^BHI Authchecker|
|
21
21
|
OBX|14|TX|LYM^Lymphocyte Count^MB|| 2.32||||||F|||200911121646||BHISVC01^BHI Authchecker|
|
22
22
|
OBX|15|TX|MON^Monocyte Count^MB|| 0.44||||||F|||200911121646||BHISVC01^BHI Authchecker|
|
@@ -29,12 +29,37 @@ module Renalware
|
|
29
29
|
NullObject.instance
|
30
30
|
end
|
31
31
|
|
32
|
+
def to_s
|
33
|
+
description
|
34
|
+
end
|
35
|
+
|
36
|
+
# As Events are a cross domain model, a subclass can choose to override to_partial_path etc
|
37
|
+
# in order to use events from another namespace for instance.
|
32
38
|
def to_partial_path
|
33
|
-
|
39
|
+
partial_for "inputs"
|
34
40
|
end
|
41
|
+
alias :to_input_partial_path :to_partial_path
|
35
42
|
|
36
|
-
def
|
37
|
-
|
43
|
+
def to_cell_partial_path
|
44
|
+
partial_for "cell"
|
45
|
+
end
|
46
|
+
|
47
|
+
def to_toggled_cell_partial_path
|
48
|
+
partial_for "toggled_cell"
|
49
|
+
end
|
50
|
+
|
51
|
+
def partial_for(partial_type)
|
52
|
+
File.join(
|
53
|
+
"renalware/events/events",
|
54
|
+
partial_type,
|
55
|
+
self.class.name.demodulize.underscore
|
56
|
+
)
|
57
|
+
end
|
58
|
+
|
59
|
+
private
|
60
|
+
|
61
|
+
def our_class_name
|
62
|
+
self.class.name.demodulize.underscore
|
38
63
|
end
|
39
64
|
end
|
40
65
|
end
|
@@ -2,7 +2,8 @@ require_dependency "renalware/pathology"
|
|
2
2
|
|
3
3
|
#
|
4
4
|
# Create pathology observations requests and their child observations for an existing
|
5
|
-
# patient from HL7 message content
|
5
|
+
# patient from HL7 message content previously parsed into an array of hashes (there can be > 1 OBR
|
6
|
+
# in each message).
|
6
7
|
#
|
7
8
|
module Renalware
|
8
9
|
module Pathology
|
@@ -4,6 +4,8 @@ module Renalware
|
|
4
4
|
module Pathology
|
5
5
|
class ObservationDescription < ApplicationRecord
|
6
6
|
belongs_to :measurement_unit
|
7
|
+
validates :display_order, uniqueness: { allow_nil: true }
|
8
|
+
validates :display_order_letters, uniqueness: { allow_nil: true }
|
7
9
|
|
8
10
|
def self.for(codes)
|
9
11
|
ObservationDescriptionsByCodeQuery.new(codes: codes).call
|
@@ -6,7 +6,7 @@ module Renalware
|
|
6
6
|
class ObservationDescriptionsByCodeQuery
|
7
7
|
def initialize(relation: ObservationDescription, codes:)
|
8
8
|
@relation = relation
|
9
|
-
@codes = codes
|
9
|
+
@codes = Array(codes)
|
10
10
|
end
|
11
11
|
|
12
12
|
# Executes SQL that looks like this:
|
@@ -37,6 +37,7 @@ module Renalware
|
|
37
37
|
def verify_all_records_found(records)
|
38
38
|
found_codes = records.map(&:code)
|
39
39
|
|
40
|
+
# TODO: Bug? Shouldn't this be @codes - found_codes?
|
40
41
|
missing_records = found_codes - @codes
|
41
42
|
if missing_records.present?
|
42
43
|
raise ActiveRecord::RecordNotFound, "Missing records for #{missing_records}"
|
@@ -71,13 +71,14 @@ module Renalware
|
|
71
71
|
def build_observations_params(request)
|
72
72
|
request.observations.map do |observation|
|
73
73
|
observation_description = find_observation_description(observation.identifier)
|
74
|
+
next unless validate_observation(observation, observation_description)
|
74
75
|
{
|
75
76
|
description_id: observation_description.id,
|
76
77
|
observed_at: parse_time(observation.date_time),
|
77
78
|
result: observation.value,
|
78
79
|
comment: observation.comment
|
79
80
|
}
|
80
|
-
end
|
81
|
+
end.compact
|
81
82
|
end
|
82
83
|
|
83
84
|
def find_request_description(code)
|
@@ -88,6 +89,18 @@ module Renalware
|
|
88
89
|
ObservationDescription.find_by!(code: code)
|
89
90
|
end
|
90
91
|
|
92
|
+
def validate_observation(observation, observation_description)
|
93
|
+
if observation.date_time.blank?
|
94
|
+
logger.warn(
|
95
|
+
"Skipped observation with blank `observed_at` (date_time) "\
|
96
|
+
"in OBX with code #{observation_description.code}"
|
97
|
+
)
|
98
|
+
false
|
99
|
+
else
|
100
|
+
true
|
101
|
+
end
|
102
|
+
end
|
103
|
+
|
91
104
|
# TODO: Support searching by other local patient ids?
|
92
105
|
def find_patient(local_patient_id)
|
93
106
|
Patient.find_by!(local_patient_id: local_patient_id)
|
@@ -6,6 +6,8 @@ module Renalware
|
|
6
6
|
acts_as_paranoid
|
7
7
|
extend Enumerize
|
8
8
|
|
9
|
+
scope :ordered, ->{ order(manufacturer: :asc, description: :asc) }
|
10
|
+
|
9
11
|
enumerize :glucose_strength, in: { not_applicable: 0, low: 1, medium: 2, high: 3 }
|
10
12
|
|
11
13
|
has_many :bags, class_name: "Renalware::PD::RegimeBag"
|
@@ -6,7 +6,9 @@ module Renalware
|
|
6
6
|
include OrderedScope
|
7
7
|
include PatientScope
|
8
8
|
|
9
|
-
BAG_VOLUMES = [
|
9
|
+
BAG_VOLUMES = [
|
10
|
+
500, 800, 900, 1000, 1100, 1200, 1300, 1400, 1500, 1600, 1700, 1800, 1900, 2000, 2200, 2500
|
11
|
+
].freeze
|
10
12
|
|
11
13
|
before_save :set_glucose_volume_low_strength
|
12
14
|
before_save :set_glucose_volume_medium_strength
|
@@ -18,6 +20,7 @@ module Renalware
|
|
18
20
|
|
19
21
|
private
|
20
22
|
|
23
|
+
# rubocop:disable Metrics/MethodLength
|
21
24
|
def match_bag_type
|
22
25
|
@match_bag_type ||= begin
|
23
26
|
glucose_types = [[], [], []]
|
@@ -34,6 +37,7 @@ module Renalware
|
|
34
37
|
glucose_types
|
35
38
|
end
|
36
39
|
end
|
40
|
+
# rubocop:enable Metrics/MethodLength
|
37
41
|
|
38
42
|
def set_glucose_volume_low_strength
|
39
43
|
if match_bag_type[0].empty?
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require_dependency "renalware/virology"
|
2
|
+
require_dependency "renalware/events"
|
3
|
+
require "document/base"
|
4
|
+
require "document/embedded"
|
5
|
+
require "document/enum"
|
6
|
+
|
7
|
+
module Renalware
|
8
|
+
module Virology
|
9
|
+
class Vaccination < Events::Event
|
10
|
+
include Document::Base
|
11
|
+
|
12
|
+
# Return e.g. "renalware/virology/vaccinations/toggled_cell
|
13
|
+
def partial_for(partial_type)
|
14
|
+
File.join("renalware/virology/vaccinations", partial_type)
|
15
|
+
end
|
16
|
+
|
17
|
+
class Document < Document::Embedded
|
18
|
+
attribute :type, ::Document::Enum # See i18n for options
|
19
|
+
validates :type, presence: true
|
20
|
+
end
|
21
|
+
has_document
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|