renalware-core 2.0.84 → 2.0.85
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/documents/renalware/transplants/recipient_operation_document.rb +1 -0
- data/app/presenters/renalware/hd/session_presenter.rb +8 -0
- data/app/presenters/renalware/ukrdc/patient_presenter.rb +6 -0
- data/app/presenters/renalware/ukrdc/transplant_operation_presenter.rb +92 -0
- data/app/views/renalware/api/ukrdc/patients/_procedures.xml.builder +9 -25
- data/app/views/renalware/api/ukrdc/patients/_treatments.xml.builder +27 -4
- data/app/views/renalware/api/ukrdc/patients/procedures/_dialysis_session.xml.builder +1 -1
- data/app/views/renalware/api/ukrdc/patients/procedures/_transplant_operation.xml.builder +35 -0
- data/app/views/renalware/api/ukrdc/patients/show.xml.builder +1 -1
- data/app/views/renalware/transplants/recipient_operations/_form.html.slim +1 -0
- data/config/locales/renalware/transplants/recipient_operation.yml +6 -0
- data/lib/renalware/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 93c145615b9102af8ff6b2ee37f850eded28cac83f10a695345510efbac334b2
|
4
|
+
data.tar.gz: 0ed44c704305710b1a4dd9b8d60160ea1d25005df3a4be52cce462434ea9b3a0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fd753c5b94ade20136d625fe0d216fe67f863737b777e167f9d2f259c0a133649e4f03c0ff1c30a57d5bcefa1f9d6cf4641f61cc8be49270b4a748e673f37931
|
7
|
+
data.tar.gz: de03a58b236ff0f78ff0ab0dd596d6d626afa61920f630cbf22dc53dfd327900afa5f064bb1725b306feca76b43a4581aaceaff3058191e175712d3e3dff7724
|
@@ -21,6 +21,7 @@ module Renalware
|
|
21
21
|
attribute :ukt_donor_number
|
22
22
|
attribute :ukt_notified_at, DateTime
|
23
23
|
attribute :type, Document::Enum
|
24
|
+
attribute :relationship, Document::Enum
|
24
25
|
attribute :gender, Document::Enum, enums: %i(male female)
|
25
26
|
attribute :ethnic_category, Document::Enum
|
26
27
|
attribute :age, Age
|
@@ -135,6 +135,14 @@ module Renalware
|
|
135
135
|
RR40_ACCESS_SIDE_MAP[access_side] || RR40_ACCESS_SIDE_MAP["unknown"]
|
136
136
|
end
|
137
137
|
|
138
|
+
# We only store the abbreviated access (rr02 + " " + rr41) so just take the first word
|
139
|
+
# which will be the rr02 code
|
140
|
+
def access_rr02_code
|
141
|
+
return if access_type_abbreviation.blank?
|
142
|
+
|
143
|
+
access_type_abbreviation.split(" ").first
|
144
|
+
end
|
145
|
+
|
138
146
|
protected
|
139
147
|
|
140
148
|
attr_reader :session, :view_context
|
@@ -53,6 +53,8 @@ module Renalware
|
|
53
53
|
end
|
54
54
|
|
55
55
|
def letters
|
56
|
+
return Letters::Letter.none if send_to_rpv == false
|
57
|
+
|
56
58
|
CollectionPresenter.new(
|
57
59
|
letters_patient
|
58
60
|
.letters
|
@@ -161,6 +163,10 @@ module Renalware
|
|
161
163
|
profile.esrf_on.to_time.iso8601
|
162
164
|
end
|
163
165
|
|
166
|
+
def transplant_operations
|
167
|
+
Transplants::RecipientOperation.for_patient(id).order(performed_on: :asc)
|
168
|
+
end
|
169
|
+
|
164
170
|
private
|
165
171
|
|
166
172
|
def comorbidity_date_time_from_year(year)
|
@@ -0,0 +1,92 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_dependency "renalware/transplants"
|
4
|
+
require "attr_extras"
|
5
|
+
|
6
|
+
module Renalware
|
7
|
+
module UKRDC
|
8
|
+
class TransplantOperationPresenter
|
9
|
+
SNOMED_KIDNEY = { code: "70536003", name: "Kidney Transplant" }.freeze
|
10
|
+
SNOMED_PANCREAS = { code: "62438007", name: "Pancreas Transplant" }.freeze
|
11
|
+
SNOMED_KIDNEY_PANCREAS = { code: "6471000179103", name: "Kidney Transplant" }.freeze
|
12
|
+
|
13
|
+
PROCEDURE_SNOMED_MAP = {
|
14
|
+
kidney: SNOMED_KIDNEY,
|
15
|
+
kidney_dual: SNOMED_KIDNEY,
|
16
|
+
kidney_pancreas: SNOMED_KIDNEY_PANCREAS,
|
17
|
+
pancreas: SNOMED_PANCREAS,
|
18
|
+
kidney_liver: SNOMED_KIDNEY,
|
19
|
+
liver: SNOMED_KIDNEY
|
20
|
+
}.freeze
|
21
|
+
|
22
|
+
TRA76_TYPE_LIVE_RELATED_MAP = {
|
23
|
+
sibling: { code: 21, description: "Transplant; Live related - sibling" },
|
24
|
+
father: { code: 74, description: "Transplant; Live related - father" },
|
25
|
+
mother: { code: 75, description: "Transplant; Live related - mother" },
|
26
|
+
child: { code: 77, description: "Transplant; Live related - child " },
|
27
|
+
other: { code: 23, description: "Transplant; Live related - other" }
|
28
|
+
}.freeze
|
29
|
+
|
30
|
+
TRA76_TYPE_OTHER_MAP = {
|
31
|
+
cadaver: { code: 20, description: "Transplant; Cadaver donor" },
|
32
|
+
live_unrelated: { code: 24, description: "Transplant; Live genetically unrelated" },
|
33
|
+
non_heart_beating: { code: 28, description: "Transplant; non-heart-beating donor" },
|
34
|
+
unknown: { code: 29, description: "Transplant; type unknown" }
|
35
|
+
}.freeze
|
36
|
+
|
37
|
+
NHSBT_TYPE_MAP = {
|
38
|
+
cadaver: "DBD",
|
39
|
+
live_unrelated: "Live",
|
40
|
+
live_related: "Live",
|
41
|
+
non_heart_beating: "DCD"
|
42
|
+
}.freeze
|
43
|
+
|
44
|
+
pattr_initialize :operation
|
45
|
+
delegate_missing_to :operation
|
46
|
+
delegate :document, to: :operation
|
47
|
+
delegate :code, :name, to: :hospital_centre, prefix: true, allow_nil: true
|
48
|
+
|
49
|
+
def procedure_type_snomed_code
|
50
|
+
PROCEDURE_SNOMED_MAP.fetch(operation_type.to_sym)[:code]
|
51
|
+
end
|
52
|
+
|
53
|
+
def procedure_type_name
|
54
|
+
PROCEDURE_SNOMED_MAP.fetch(operation_type.to_sym)[:name]
|
55
|
+
end
|
56
|
+
|
57
|
+
def nhsbt_type
|
58
|
+
NHSBT_TYPE_MAP[document.donor.type&.to_sym]
|
59
|
+
end
|
60
|
+
|
61
|
+
# TRA76 is the type of donor. For us it is a combination of donor type and donor relationship
|
62
|
+
# (if live related).
|
63
|
+
# Unhandled options:
|
64
|
+
# 25 "Transplant; Cadaver donor + transp other organ"
|
65
|
+
# 26 "Transplant; Live donor + transplant other organ"
|
66
|
+
# 27 "Transplant; Live donor non-UK transplant"
|
67
|
+
def rr_tra76_options
|
68
|
+
@rr_tra76_options ||= begin
|
69
|
+
return if document.donor.type.blank?
|
70
|
+
|
71
|
+
donor_type = document.donor.type.to_sym
|
72
|
+
if donor_type == :live_related
|
73
|
+
rr_tra76_live_related
|
74
|
+
else
|
75
|
+
rr_tra76_other(donor_type)
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
private
|
81
|
+
|
82
|
+
def rr_tra76_live_related
|
83
|
+
donor_relationship = document.donor.relationship&.to_sym
|
84
|
+
TRA76_TYPE_LIVE_RELATED_MAP[donor_relationship] || TRA76_TYPE_LIVE_RELATED_MAP[:other]
|
85
|
+
end
|
86
|
+
|
87
|
+
def rr_tra76_other(donor_type)
|
88
|
+
TRA76_TYPE_OTHER_MAP[donor_type] || TRA76_TYPE_OTHER_MAP[:unknown]
|
89
|
+
end
|
90
|
+
end
|
91
|
+
end
|
92
|
+
end
|
@@ -3,35 +3,19 @@
|
|
3
3
|
xml = builder
|
4
4
|
|
5
5
|
xml.Procedures do
|
6
|
+
# HD Session procedures
|
6
7
|
patient.finished_hd_sessions.each do |session|
|
7
8
|
render "renalware/api/ukrdc/patients/procedures/dialysis_session",
|
8
9
|
builder: xml,
|
9
10
|
patient: patient,
|
10
11
|
session: Renalware::HD::SessionPresenter.new(session)
|
11
12
|
end
|
12
|
-
|
13
|
-
#
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
# xml.Code prescription.medication_route&.rr_code
|
21
|
-
# xml.Description prescription.medication_route&.name
|
22
|
-
# end
|
23
|
-
# xml.DrugProduct do
|
24
|
-
# xml.Generic prescription.drug
|
25
|
-
# # xml.Id do
|
26
|
-
# # xml.CodingStandard "DM+D"
|
27
|
-
# # xml.Code "dm + d code for the drug - coming soon"
|
28
|
-
# # xml.Description prescription.drug
|
29
|
-
# # end
|
30
|
-
# end
|
31
|
-
# xml.Frequency prescription.frequency
|
32
|
-
# xml.Comments prescription.notes
|
33
|
-
# # xml.DoseUoM
|
34
|
-
# # xml.Indication
|
35
|
-
# end
|
36
|
-
# end
|
13
|
+
|
14
|
+
# Transplant operation procedures
|
15
|
+
patient.transplant_operations.each do |operation|
|
16
|
+
render "renalware/api/ukrdc/patients/procedures/transplant_operation",
|
17
|
+
builder: xml,
|
18
|
+
patient: patient,
|
19
|
+
operation: Renalware::UKRDC::TransplantOperationPresenter.new(operation)
|
20
|
+
end
|
37
21
|
end
|
@@ -2,12 +2,15 @@
|
|
2
2
|
|
3
3
|
xml = builder
|
4
4
|
|
5
|
-
# A temporary output
|
6
|
-
# crude renal reg modality code assigned to them - HD PD Transplant vCKD - all other modalities
|
5
|
+
# A temporary output of the treatment timeline using just modality descriptions with a
|
6
|
+
# crude renal reg modality code assigned to them - HD, PD, Transplant, vCKD - all other modalities
|
7
7
|
# fall through the gaps at this stage until we implement this properly. Also sub RR modal codes
|
8
8
|
# like CAPD and HDF are not yet implemented, just the top level modality.
|
9
9
|
patient.modalities.each do |modality|
|
10
|
-
|
10
|
+
ukrdc_modality_code_id = modality.description.ukrdc_modality_code_id
|
11
|
+
next if ukrdc_modality_code_id.blank?
|
12
|
+
|
13
|
+
ukrdc_modality_code = Renalware::UKRDC::ModalityCode.find(ukrdc_modality_code_id)
|
11
14
|
|
12
15
|
xml.Treatment do
|
13
16
|
xml.EncounterNumber modality.id
|
@@ -22,7 +25,27 @@ patient.modalities.each do |modality|
|
|
22
25
|
|
23
26
|
xml.AdmitReason do
|
24
27
|
xml.CodingStandard "CF_RR7_TREATMENT"
|
25
|
-
xml.Code
|
28
|
+
xml.Code ukrdc_modality_code.txt_code
|
26
29
|
end
|
30
|
+
|
31
|
+
# # This is a bit of hack to get the HD Profile location for the current modality
|
32
|
+
# if [1, 2, 3, 4, 5, 9].include?(ukrdc_modality_code.txt_code.to_i) # HD
|
33
|
+
# profile = Renalware::HD::Profile
|
34
|
+
# .for_patient(patient)
|
35
|
+
# .where(<<-SQL).first
|
36
|
+
# created_at::date <= '#{modality.started_on}'
|
37
|
+
# and (
|
38
|
+
# deactivated_at is NULL or
|
39
|
+
# (
|
40
|
+
# deactivated_at >= '#{modality.started_on}'
|
41
|
+
# )
|
42
|
+
# )
|
43
|
+
# SQL
|
44
|
+
# if profile&.hospital_unit.present?
|
45
|
+
# xml.Attributes do
|
46
|
+
# xml.QBL05 profile.hospital_unit.unit_type # eg home
|
47
|
+
# end
|
48
|
+
# end
|
49
|
+
# end
|
27
50
|
end
|
28
51
|
end
|
@@ -31,7 +31,7 @@ xml.DialysisSession(
|
|
31
31
|
xml.ExternalId session.uuid
|
32
32
|
xml.Attributes do
|
33
33
|
xml.QHD19 session.had_intradialytic_hypotension?
|
34
|
-
xml.QHD20 session.
|
34
|
+
xml.QHD20 session.access_rr02_code
|
35
35
|
xml.QHD21 session.access_side_rr40_code
|
36
36
|
xml.QHD22 "N" # Access in two sites simultaneously
|
37
37
|
xml.QHD30 session.blood_flow
|
@@ -0,0 +1,35 @@
|
|
1
|
+
xml = builder
|
2
|
+
|
3
|
+
xml.Transplant do
|
4
|
+
if operation.operation_type.present?
|
5
|
+
xml.ProcedureType do
|
6
|
+
xml.CodingStandard "SNOMED"
|
7
|
+
xml.Code operation.procedure_type_snomed_code
|
8
|
+
xml.Description operation.procedure_type_name
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
xml.ProcedureTime operation.performed_on&.to_time&.iso8601
|
13
|
+
|
14
|
+
if operation.hospital_centre_code.present?
|
15
|
+
xml.EnteredAt do
|
16
|
+
xml.CodingStandard "ODS"
|
17
|
+
xml.Code operation.hospital_centre_code
|
18
|
+
xml.Description operation.hospital_centre_name
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
xml.Attributes do
|
23
|
+
if operation.nhsbt_type.present?
|
24
|
+
xml.TRA77 operation.nhsbt_type
|
25
|
+
end
|
26
|
+
# Note sending TRA76 yet as defined as datetime in XSD and needs changeing there.
|
27
|
+
# if operation.rr_tra76_options.present?
|
28
|
+
# xml.TRA76 do
|
29
|
+
# xml.CodingStandard "CF_RR7_TREATMENT"
|
30
|
+
# xml.Code operation.rr_tra76_options[:code]
|
31
|
+
# xml.Description operation.rr_tra76_options[:description]
|
32
|
+
# end
|
33
|
+
# end
|
34
|
+
end
|
35
|
+
end
|
@@ -18,7 +18,7 @@ xml.ukrdc(:PatientRecord, namespace_and_schema) do
|
|
18
18
|
render "social_histories", builder: xml, patient: patient
|
19
19
|
render "family_histories", builder: xml, patient: patient
|
20
20
|
render "observations", builder: xml, patient: patient
|
21
|
-
render "allergies", builder: xml, patient: patient
|
21
|
+
# render "allergies", builder: xml, patient: patient
|
22
22
|
render "diagnoses", builder: xml, patient: patient
|
23
23
|
render "medications", builder: xml, patient: patient
|
24
24
|
render "procedures", builder: xml, patient: patient
|
@@ -41,6 +41,7 @@ ruby:
|
|
41
41
|
locals: { legend: "Donor", name: "donor" } do
|
42
42
|
= fd.simple_fields_for :donor, fd.object.donor do |fcm|
|
43
43
|
= fcm.input :type, wrapper: :horizontal_small
|
44
|
+
= fcm.input :relationship, wrapper: :horizontal_small
|
44
45
|
= fcm.input :ukt_donor_number, wrapper: :horizontal_small
|
45
46
|
= fcm.input :ukt_notified_at, as: :datetime_picker, wrapper: :horizontal_datepicker
|
46
47
|
= fcm.input :gender, wrapper: :horizontal_small
|
@@ -72,6 +72,12 @@ en:
|
|
72
72
|
cadaver: Cadaver
|
73
73
|
non_heart_beating: NHB
|
74
74
|
live_unrelated: Live unrelated
|
75
|
+
relationship:
|
76
|
+
sibling: Sibling
|
77
|
+
father: Father
|
78
|
+
mother: Mother
|
79
|
+
child: Child
|
80
|
+
other: Other
|
75
81
|
ethnic_category:
|
76
82
|
white: "White"
|
77
83
|
black_caribbean: "Black Caribbean"
|
data/lib/renalware/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: renalware-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.85
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Airslie
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-06-
|
11
|
+
date: 2019-06-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: active_type
|
@@ -2022,6 +2022,7 @@ files:
|
|
2022
2022
|
- app/presenters/renalware/ukrdc/pathology_observation_presenter.rb
|
2023
2023
|
- app/presenters/renalware/ukrdc/pathology_observation_request_presenter.rb
|
2024
2024
|
- app/presenters/renalware/ukrdc/patient_presenter.rb
|
2025
|
+
- app/presenters/renalware/ukrdc/transplant_operation_presenter.rb
|
2025
2026
|
- app/presenters/renalware/virology/dashboard_presenter.rb
|
2026
2027
|
- app/presenters/string_presenter.rb
|
2027
2028
|
- app/presenters/time_presenter.rb
|
@@ -2144,6 +2145,7 @@ files:
|
|
2144
2145
|
- app/views/renalware/api/ukrdc/patients/observations/_standing_blood_pressure.xml.builder
|
2145
2146
|
- app/views/renalware/api/ukrdc/patients/observations/_weight.xml.builder
|
2146
2147
|
- app/views/renalware/api/ukrdc/patients/procedures/_dialysis_session.xml.builder
|
2148
|
+
- app/views/renalware/api/ukrdc/patients/procedures/_transplant_operation.xml.builder
|
2147
2149
|
- app/views/renalware/api/ukrdc/patients/show.xml.builder
|
2148
2150
|
- app/views/renalware/api/v1/medications/prescriptions/index.json.jbuilder
|
2149
2151
|
- app/views/renalware/api/v1/patients/patients/index.json.jbuilder
|