renalware-core 2.0.100 → 2.0.101

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8aa7d57a0adfff2d76fadc4c11c9442fa83d82ca6dd5f01dcca5cfbf4226e0a9
4
- data.tar.gz: 7a7c0329c9a32aac0da27b4165ab2bb1f1c9dd111729d4d86cbfaacab46040d8
3
+ metadata.gz: be1dd365f062fce54445146b4623f13ae28d5ccc97c0530d78b8c4f9e57a4dc5
4
+ data.tar.gz: 1b610c630f72fdb4f66585eeb3fbaf6d659ea5ea8f5b3effbbc2d5d12d64f898
5
5
  SHA512:
6
- metadata.gz: 8f73fec51538a54fa18a57c9f3d2b009f8f64ce1253d7c9a43eb5cc1d19164fcba654b9ec43a976733359a833873299c1c7b199abe75e54d3baf9f3bb8478118
7
- data.tar.gz: f9117254aad358aa7d265db64cfeeba583be6a8cac7c707e33440e8827659abe75529c4c8bcf17e92f4532d1eb10790fb3a498aaba4018f9ed39b9f82a8ef1cd
6
+ metadata.gz: ac5d3ea6f737b6bd9b2fef873c0caf1385747eedc1a010c1b7cb136b63422d223ea648e13cb73a6ae05c8afe9504efdb28f851644e131abf6e047c0908dd2ec7
7
+ data.tar.gz: 535b8985590dc9ee936a504371a0807d4396c8a5e95c3e616217bd3646751de4ccf2cf5a91609a928abbc0395f33b824e0ff71947d761c43f6413626a026ba15
@@ -9,7 +9,7 @@ module Renalware
9
9
  include PresenterHelper
10
10
 
11
11
  def index
12
- stations = Station.for_unit(unit_id).ordered
12
+ stations = Station.for_unit(unit_id).includes(:location).ordered
13
13
  authorize stations
14
14
  render locals: {
15
15
  unit_id: unit_id,
@@ -24,7 +24,7 @@ module Renalware
24
24
  end
25
25
 
26
26
  def index
27
- hospital_units = Unit.all
27
+ hospital_units = Unit.includes(:hospital_centre).all
28
28
  authorize hospital_units
29
29
  render locals: { hospital_units: hospital_units }
30
30
  end
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Renalware
4
+ module PolicyHelper
5
+ def pundit_policy_for(klass)
6
+ Pundit.policy(
7
+ current_user,
8
+ klass.new
9
+ )
10
+ end
11
+ end
12
+ end
@@ -5,7 +5,12 @@ require_dependency "renalware/hospitals"
5
5
  module Renalware
6
6
  module Hospitals
7
7
  class Centre < ApplicationRecord
8
- has_many :units, class_name: "Hospitals::Unit", foreign_key: :hospital_centre_id
8
+ has_many(
9
+ :units,
10
+ class_name: "Hospitals::Unit",
11
+ foreign_key: :hospital_centre_id,
12
+ dependent: :restrict_with_exception
13
+ )
9
14
 
10
15
  scope :ordered, -> { order(:name) }
11
16
  scope :active, -> { where(active: true) }
@@ -19,6 +24,10 @@ module Renalware
19
24
  units.hd_sites.ordered
20
25
  end
21
26
 
27
+ def self.policy_class
28
+ BasePolicy
29
+ end
30
+
22
31
  def to_s
23
32
  if location.present?
24
33
  "#{name} (#{location})"
@@ -13,10 +13,6 @@ module Renalware
13
13
  scope :ordered, -> { order(:name) }
14
14
  scope :active, -> { where(active: true) }
15
15
 
16
- def self.policy_class
17
- BasePolicy
18
- end
19
-
20
16
  def to_s
21
17
  name
22
18
  end
@@ -6,6 +6,10 @@ module Renalware
6
6
  def sort?
7
7
  edit?
8
8
  end
9
+
10
+ def index
11
+ true
12
+ end
9
13
  end
10
14
  end
11
15
  end
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Renalware
4
+ module Hospitals
5
+ class WardPolicy < BasePolicy
6
+ def index?
7
+ true
8
+ end
9
+ end
10
+ end
11
+ end
@@ -12,6 +12,10 @@ module Renalware
12
12
 
13
13
  "background-color: #{location&.colour}"
14
14
  end
15
+
16
+ def self.policy_class
17
+ StationPolicy
18
+ end
15
19
  end
16
20
  end
17
21
  end
@@ -0,0 +1,43 @@
1
+ # frozen_string_literal: true
2
+
3
+ xml = builder
4
+
5
+ observation_times = {
6
+ pre: session.performed_on + session.start_time.seconds_since_midnight.seconds,
7
+ post: session.performed_on + session.end_time.seconds_since_midnight.seconds
8
+ }
9
+
10
+ {
11
+ pre: session.document.observations_before,
12
+ post: session.document.observations_after
13
+ }.each do |pre_post, observations|
14
+ measurements = {
15
+ "blood_pressure.systolic" => observations.blood_pressure&.systolic,
16
+ "blood_pressure.diastolic" => observations.blood_pressure&.diastolic,
17
+ "weight" => observations.weight,
18
+ "bm_stix" => observations.bm_stix,
19
+ }
20
+
21
+ if observations.temperature_measured == :yes
22
+ measurements["temperature"] = observations.temperature
23
+ end
24
+
25
+ if observations.respiratory_rate_measured == :yes
26
+ measurements["respiratory_rate"] = observations.respiratory_rate
27
+ end
28
+
29
+ measurements.each do |i18n_key, value|
30
+ xml.Observation do
31
+ xml.ObservationTime observation_times[pre_post].iso8601
32
+ xml.ObservationCode do
33
+ xml.CodingStandard "PV"
34
+ xml.Code I18n.t("loinc.#{i18n_key}.code")
35
+ xml.Description I18n.t("loinc.#{i18n_key}.description")
36
+ end
37
+
38
+ xml.ObservationValue value
39
+ xml.ObservationUnits I18n.t("loinc.#{i18n_key}.units")
40
+ xml.PrePost pre_post.to_s.upcase # eg PRE or POST
41
+ end
42
+ end
43
+ end
@@ -9,6 +9,10 @@ xml.Medications do
9
9
  if prescription.terminated_or_marked_for_termination?
10
10
  xml.ToTime prescription.terminated_on&.to_datetime
11
11
  end
12
+ xml.EnteringOrganization do
13
+ xml.CodingStandard "ODS"
14
+ xml.Code Renalware.config.ukrdc_site_code
15
+ end
12
16
  xml.Route do
13
17
  xml.CodingStandard "RR22"
14
18
  xml.Code prescription.medication_route&.rr_code
@@ -35,4 +35,7 @@ xml.Observations(
35
35
  i18n_key: "height",
36
36
  builder: builder
37
37
  end
38
+ patient.finished_hd_sessions.each do |session|
39
+ render "hd_session_observations", session: session, builder: builder
40
+ end
38
41
  end
@@ -8,10 +8,12 @@ xml.Treatment do
8
8
  xml.FromTime treatment.started_on&.iso8601
9
9
  xml.ToTime(treatment.ended_on&.iso8601) if treatment.ended_on.present?
10
10
 
11
- if treatment.hospital_unit.present?
12
- xml.HealthCareFacility do
13
- xml.CodingStandard "ODS"
11
+ xml.HealthCareFacility do
12
+ xml.CodingStandard "ODS"
13
+ if treatment.hospital_unit.present?
14
14
  xml.Code treatment.hospital_unit.renal_registry_code
15
+ else
16
+ xml.Code Renalware.config.ukrdc_site_code
15
17
  end
16
18
  end
17
19
 
@@ -1,6 +1,9 @@
1
1
  tr.sortable(id="hd-station-#{station.id}")
2
- td= link_to "Edit", edit_hd_unit_station_path(station.hospital_unit_id, station)
2
+ td
3
+ - if policy(station).update?
4
+ = link_to "Edit", edit_hd_unit_station_path(station.hospital_unit_id, station)
3
5
  td= station.name
4
6
  td= station.location&.name
5
- td.handle
6
- i.fas.fa-bars
7
+ - if policy(station).sort?
8
+ td.handle
9
+ i.fas.fa-bars
@@ -4,6 +4,7 @@ table.hd-stations
4
4
  th.col-width-tiny
5
5
  th.col-width-large Name
6
6
  th Location
7
- th.col-width-tiny Reorder
7
+ - if policy(Renalware::HD::Station.new).sort?
8
+ th.col-width-tiny Reorder
8
9
  tbody.sortables data-rel=sort_hd_unit_stations_path(unit_id: unit_id)
9
10
  = render stations
@@ -4,9 +4,10 @@
4
4
  breadcrumb_for(unit.unit_code, edit_hospitals_unit_path(unit))]
5
5
 
6
6
  = content_for(:actions) do
7
- = link_to t("new_record.link_title"),
8
- new_hd_unit_station_path(unit_id: unit.id),
9
- class: "button"
7
+ - if policy(Renalware::HD::Station.new).create?
8
+ = link_to t("new_record.link_title"),
9
+ new_hd_unit_station_path(unit_id: unit.id),
10
+ class: "button"
10
11
 
11
12
  = within_admin_layout(title: "HD Stations", breadcrumbs: breadcrumbs) do
12
13
 
@@ -1,5 +1,6 @@
1
1
  = content_for(:actions) do
2
- = link_to t("new_record.link_title"), new_hospitals_unit_path, class: "button"
2
+ - if pundit_policy_for(Renalware::Hospitals::Centre).create?
3
+ = link_to t("new_record.link_title"), new_hospitals_unit_path, class: "button"
3
4
 
4
5
  = within_admin_layout(title: "Hospital Units") do
5
6
 
@@ -19,12 +20,14 @@
19
20
  - hospital_units.each do |unit|
20
21
  tr
21
22
  td
22
- = link_to "Edit", edit_hospitals_unit_path(unit.id)
23
- = pipe_separator
24
- = link_to "Delete",
25
- hospitals_unit_path(unit.id),
26
- method: :delete,
27
- data: { confirm: I18n.t("prompts.confirm_delete") }
23
+ - if policy(unit).edit?
24
+ = link_to "Edit", edit_hospitals_unit_path(unit.id)
25
+ = pipe_separator
26
+ - if policy(unit).destroy?
27
+ = link_to "Delete",
28
+ hospitals_unit_path(unit.id),
29
+ method: :delete,
30
+ data: { confirm: I18n.t("prompts.confirm_delete") }
28
31
  td= unit.unit_code
29
32
  td= unit.name
30
33
  td= unit.hospital_centre
@@ -33,8 +36,11 @@
33
36
  td= yes_no unit.is_hd_site
34
37
  td= Renalware::HD::Station.where(hospital_unit_id: unit.id).count
35
38
  td.actions
36
- = link_to("HD Stations", hd_unit_stations_path(unit))
37
- = pipe_separator
38
- = link_to("HD Diaries", hd_unit_diaries_path(unit))
39
- = pipe_separator
40
- = link_to("Wards", hospitals_unit_wards_path(unit))
39
+ - if pundit_policy_for(Renalware::HD::Station).index?
40
+ = link_to("HD Stations", hd_unit_stations_path(unit))
41
+ = pipe_separator
42
+ - if pundit_policy_for(Renalware::HD::Diary).index?
43
+ = link_to("HD Diaries", hd_unit_diaries_path(unit))
44
+ - if pundit_policy_for(Renalware::Hospitals::Ward).index?
45
+ = pipe_separator
46
+ = link_to("Wards", hospitals_unit_wards_path(unit))
@@ -1,7 +1,8 @@
1
1
  = content_for(:actions) do
2
- = link_to "Add",
3
- new_hospitals_unit_ward_path(unit),
4
- class: "button"
2
+ - if policy(Renalware::Hospitals::Ward.new).create?
3
+ = link_to "Add",
4
+ new_hospitals_unit_ward_path(unit),
5
+ class: "button"
5
6
 
6
7
  = within_admin_layout(title: "Wards", breadcrumbs: \
7
8
  breadcrumb_for(unit.name, hospitals_units_path)) do
@@ -2,7 +2,6 @@ li.has-dropdown
2
2
  = link_to "Admin", "#"
3
3
  ul.dropdown
4
4
  li= link_to "Users", admin_users_path
5
- li= link_to "Hospital Units", hospitals_units_path
6
5
  li= link_to "Request Form Print History", pathology_requests_requests_path
7
6
  li= link_to "Pathology Requesting Configuration", pathology_requests_rules_path
8
7
  li= link_to "HD Transmission Logs", hd_transmission_logs_path
@@ -12,4 +12,5 @@ li.has-dropdown
12
12
  li= link_to t(".audits"), reporting_audits_path
13
13
  li= link_to t(".aki_alerts"), renal_aki_alerts_path
14
14
  li= link_to t(".studies"), research_studies_path
15
+ li= link_to t(".hospital_units"), hospitals_units_path
15
16
  li= link_to t(".renal_registry_checks"), patients_renal_registry_preflight_checks_path
@@ -20,3 +20,15 @@ en:
20
20
  code: height
21
21
  description: Height Measured
22
22
  units: "cm"
23
+ temperature:
24
+ code: temperature
25
+ description: Temperature
26
+ units: "C"
27
+ bm_stix:
28
+ code: bm_stix
29
+ description: bm_stix
30
+ units: "?"
31
+ respiratory_rate:
32
+ code: respiratory_rate
33
+ description: respiratory_rate
34
+ units: "?"
@@ -15,6 +15,7 @@ en:
15
15
  aki_alerts: AKI Alerts
16
16
  studies: Clinical Studies
17
17
  renal_registry_checks: Renal Registry Checks
18
+ hospital_units: Hospitals
18
19
  mdms:
19
20
  menu_title: MDMs
20
21
  hd: HD
@@ -1,6 +1,8 @@
1
1
  super_admin:
2
2
  - Renalware::Role
3
3
  - Renalware::Hospitals::Ward
4
+ - Renalware::Hospitals::Centre
5
+ - Renalware::Hospitals::Unit
4
6
  - Renalware::HD::Dialysate
5
7
  - Renalware::HD::Dialyser
6
8
  - Renalware::HD::CannulationType
@@ -16,6 +18,5 @@ admin:
16
18
  - Renalware::Modality::Description
17
19
  - Renalware::OrganismCode
18
20
  - Renalware::PRDDescription
19
- - Renalware::Hospitals::Unit
20
- - Renalware::HD::Station
21
21
  - Renalware::HD::TransmissionLog
22
+ - Renalware::HD::Station
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Renalware
4
- VERSION = "2.0.100"
4
+ VERSION = "2.0.101"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: renalware-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.100
4
+ version: 2.0.101
5
5
  platform: ruby
6
6
  authors:
7
7
  - Airslie
@@ -1324,6 +1324,7 @@ files:
1324
1324
  - app/helpers/renalware/pd_regime_bags_helper.rb
1325
1325
  - app/helpers/renalware/pd_regimes_helper.rb
1326
1326
  - app/helpers/renalware/pdf_helper.rb
1327
+ - app/helpers/renalware/policy_helper.rb
1327
1328
  - app/helpers/renalware/prescriptions_helper.rb
1328
1329
  - app/helpers/renalware/primary_care_physicians_helper.rb
1329
1330
  - app/helpers/renalware/problems_helper.rb
@@ -1895,6 +1896,7 @@ files:
1895
1896
  - app/policies/renalware/hd/open_session_policy.rb
1896
1897
  - app/policies/renalware/hd/session_policy.rb
1897
1898
  - app/policies/renalware/hd/station_policy.rb
1899
+ - app/policies/renalware/hospitals/ward_policy.rb
1898
1900
  - app/policies/renalware/letters/approved_letter_policy.rb
1899
1901
  - app/policies/renalware/letters/completed_letter_policy.rb
1900
1902
  - app/policies/renalware/letters/draft_letter_policy.rb
@@ -2148,6 +2150,7 @@ files:
2148
2150
  - app/views/renalware/api/ukrdc/patients/_documents.xml.builder
2149
2151
  - app/views/renalware/api/ukrdc/patients/_encounters.xml.builder
2150
2152
  - app/views/renalware/api/ukrdc/patients/_family_histories.xml.builder
2153
+ - app/views/renalware/api/ukrdc/patients/_hd_session_observations.xml.builder
2151
2154
  - app/views/renalware/api/ukrdc/patients/_lab_orders.xml.builder
2152
2155
  - app/views/renalware/api/ukrdc/patients/_medications.xml.builder
2153
2156
  - app/views/renalware/api/ukrdc/patients/_name.xml.builder