renalware-forms 0.1.13 → 0.1.14
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -0
- data/Gemfile.lock +15 -25
- data/lib/renalware/forms/homecare/args.rb +97 -100
- data/lib/renalware/forms/version.rb +1 -1
- data/renalware-forms.gemspec +7 -6
- metadata +5 -19
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 17b52d0a15890cefaeb0f17f380dfdb7ad4278a018e33c8efce02d0223087661
|
4
|
+
data.tar.gz: e03e9e3936da756f26656fa3a3f7f20a0aa2adbc8b4a3e6ffa4171722945fa56
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7916272475387df5ae34a022fa4119bbe563e556607e3c695255193fc1f2058ced488dd3cbd72f6cb21923ccfde2a782ae2a92d66993b41a0a5bec500c640a01
|
7
|
+
data.tar.gz: 24e0160727b509117d8c1ec5b60154e43b15180b1e94113b8e1bcc072083301196c79b8ea21a3e469b458f896701709af7c0ff8a7ea7a5cf702130e402f3bfe8
|
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,14 +1,13 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
renalware-forms (0.1.
|
4
|
+
renalware-forms (0.1.14)
|
5
5
|
activemodel
|
6
6
|
attr_extras (~> 6.2)
|
7
|
-
dry-struct
|
8
|
-
dry-types
|
9
7
|
prawn (~> 2.2)
|
10
8
|
prawn-table (~> 0.2)
|
11
9
|
rake
|
10
|
+
virtus
|
12
11
|
|
13
12
|
GEM
|
14
13
|
remote: https://rubygems.org/
|
@@ -25,32 +24,18 @@ GEM
|
|
25
24
|
afm (0.2.2)
|
26
25
|
ast (2.4.2)
|
27
26
|
attr_extras (6.2.4)
|
27
|
+
axiom-types (0.1.1)
|
28
|
+
descendants_tracker (~> 0.0.4)
|
29
|
+
ice_nine (~> 0.11.0)
|
30
|
+
thread_safe (~> 0.3, >= 0.3.1)
|
28
31
|
byebug (11.1.3)
|
32
|
+
coercible (1.0.0)
|
33
|
+
descendants_tracker (~> 0.0.1)
|
29
34
|
concurrent-ruby (1.1.9)
|
35
|
+
descendants_tracker (0.0.4)
|
36
|
+
thread_safe (~> 0.3, >= 0.3.1)
|
30
37
|
diff-lcs (1.4.4)
|
31
38
|
docile (1.4.0)
|
32
|
-
dry-configurable (0.13.0)
|
33
|
-
concurrent-ruby (~> 1.0)
|
34
|
-
dry-core (~> 0.6)
|
35
|
-
dry-container (0.9.0)
|
36
|
-
concurrent-ruby (~> 1.0)
|
37
|
-
dry-configurable (~> 0.13, >= 0.13.0)
|
38
|
-
dry-core (0.7.1)
|
39
|
-
concurrent-ruby (~> 1.0)
|
40
|
-
dry-inflector (0.2.1)
|
41
|
-
dry-logic (1.2.0)
|
42
|
-
concurrent-ruby (~> 1.0)
|
43
|
-
dry-core (~> 0.5, >= 0.5)
|
44
|
-
dry-struct (1.4.0)
|
45
|
-
dry-core (~> 0.5, >= 0.5)
|
46
|
-
dry-types (~> 1.5)
|
47
|
-
ice_nine (~> 0.11)
|
48
|
-
dry-types (1.5.1)
|
49
|
-
concurrent-ruby (~> 1.0)
|
50
|
-
dry-container (~> 0.3)
|
51
|
-
dry-core (~> 0.5, >= 0.5)
|
52
|
-
dry-inflector (~> 0.1, >= 0.1.2)
|
53
|
-
dry-logic (~> 1.0, >= 1.0.2)
|
54
39
|
hashery (2.1.2)
|
55
40
|
i18n (1.8.10)
|
56
41
|
concurrent-ruby (~> 1.0)
|
@@ -117,10 +102,15 @@ GEM
|
|
117
102
|
json (>= 1.8, < 3)
|
118
103
|
simplecov-html (~> 0.10.0)
|
119
104
|
simplecov-html (0.10.2)
|
105
|
+
thread_safe (0.3.6)
|
120
106
|
ttfunk (1.7.0)
|
121
107
|
tzinfo (2.0.4)
|
122
108
|
concurrent-ruby (~> 1.0)
|
123
109
|
unicode-display_width (2.1.0)
|
110
|
+
virtus (2.0.0)
|
111
|
+
axiom-types (~> 0.1)
|
112
|
+
coercible (~> 1.0)
|
113
|
+
descendants_tracker (~> 0.0, >= 0.0.3)
|
124
114
|
zeitwerk (2.4.2)
|
125
115
|
|
126
116
|
PLATFORMS
|
@@ -1,68 +1,61 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require "
|
4
|
-
require "dry-struct"
|
3
|
+
require "virtus"
|
5
4
|
require "active_model"
|
6
5
|
|
7
6
|
# rubocop:disable Metrics/ClassLength
|
8
7
|
module Renalware::Forms
|
9
|
-
|
10
|
-
include
|
11
|
-
end
|
12
|
-
|
13
|
-
class Homecare::Args < Dry::Struct
|
8
|
+
class Homecare::Args
|
9
|
+
include Virtus.model
|
14
10
|
include ActiveModel::Validations
|
15
11
|
|
16
|
-
class Medication
|
12
|
+
class Medication
|
13
|
+
include Virtus.model(strict: true)
|
17
14
|
include ActiveModel::Validations
|
18
15
|
|
19
|
-
attribute :date,
|
20
|
-
attribute :drug,
|
21
|
-
attribute :dose,
|
22
|
-
attribute :route,
|
23
|
-
attribute :frequency,
|
16
|
+
attribute :date, Date
|
17
|
+
attribute :drug, String
|
18
|
+
attribute :dose, String
|
19
|
+
attribute :route, String
|
20
|
+
attribute :frequency, String
|
24
21
|
end
|
25
22
|
|
26
23
|
# The first 2 attrbutes are used to drive what PDF to build
|
27
|
-
attribute :provider,
|
28
|
-
attribute :version,
|
29
|
-
attribute :title,
|
30
|
-
attribute :given_name,
|
31
|
-
attribute :family_name,
|
32
|
-
attribute :nhs_number,
|
33
|
-
attribute :born_on,
|
34
|
-
attribute :modality ,
|
35
|
-
attribute :
|
36
|
-
attribute :
|
37
|
-
attribute :
|
38
|
-
attribute :
|
39
|
-
attribute :
|
40
|
-
|
41
|
-
attribute :
|
42
|
-
attribute :
|
43
|
-
attribute :
|
44
|
-
attribute :
|
45
|
-
attribute :
|
46
|
-
attribute :
|
47
|
-
attribute :
|
48
|
-
attribute :
|
49
|
-
attribute :
|
50
|
-
|
51
|
-
attribute :
|
52
|
-
attribute :
|
53
|
-
attribute :
|
54
|
-
attribute
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
attribute
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
.default(["3 months", "6 months", "12 months"].freeze)
|
63
|
-
)
|
64
|
-
attribute :selected_prescription_duration, Types::String.default("") # e.g. "6 months"
|
65
|
-
attribute :selected_delivery_frequency, Types::String.default("") # e.g. "6 months"
|
24
|
+
attribute :provider, String
|
25
|
+
attribute :version, Integer
|
26
|
+
attribute :title, String, default: ""
|
27
|
+
attribute :given_name, String
|
28
|
+
attribute :family_name, String
|
29
|
+
attribute :nhs_number, String, default: ""
|
30
|
+
attribute :born_on, Date
|
31
|
+
attribute :modality, String, default: ""
|
32
|
+
attribute :fmc_patient, String, default: ""
|
33
|
+
attribute :telephone, String, default: ""
|
34
|
+
attribute :hospital_number, String, default: ""
|
35
|
+
attribute :address, Array(String), default: []
|
36
|
+
attribute :postcode, String, default: ""
|
37
|
+
attribute :modality, String
|
38
|
+
attribute :prescriber_name, String, default: ""
|
39
|
+
attribute :prescription_date, Date
|
40
|
+
attribute :hospital_name, String
|
41
|
+
attribute :hospital_department, String
|
42
|
+
attribute :hospital_address, Array[String]
|
43
|
+
attribute :hospital_telephone, String
|
44
|
+
attribute :po_number, String
|
45
|
+
attribute :generated_at, DateTime
|
46
|
+
attribute :no_known_allergies, Boolean
|
47
|
+
attribute :allergies, Array[String]
|
48
|
+
attribute :drug_type, String
|
49
|
+
attribute :administration_route, String
|
50
|
+
attribute :administration_frequency, String
|
51
|
+
attribute :prescription_duration, String
|
52
|
+
attribute :administration_device, String
|
53
|
+
attribute :medications, Array[Medication]
|
54
|
+
attribute :consultant, String
|
55
|
+
attribute :delivery_frequencies, Array[String], default: ["3 months", "6 months"]
|
56
|
+
attribute :selected_delivery_frequency, String # e.g. "6 months"
|
57
|
+
attribute :prescription_durations, Array[String] # e.g. ["3 months", "6 months"]
|
58
|
+
attribute :selected_prescription_duration, String # e.g. "3 months"
|
66
59
|
|
67
60
|
validates :family_name, presence: true
|
68
61
|
validates :given_name, presence: true
|
@@ -94,7 +87,7 @@ module Renalware::Forms
|
|
94
87
|
end
|
95
88
|
|
96
89
|
def format_address_array(add)
|
97
|
-
return unless add
|
90
|
+
return unless add.is_a?(Array)
|
98
91
|
|
99
92
|
add.compact.reject { |line| line == "" }.uniq&.join("\n")
|
100
93
|
end
|
@@ -109,60 +102,64 @@ module Renalware::Forms
|
|
109
102
|
Array(allergies).uniq.compact.join("<br>")
|
110
103
|
end
|
111
104
|
|
105
|
+
# rubocop:disable Metrics/AbcSize, Metrics/MethodLength
|
112
106
|
def self.test_data(provider: :generic, version: 1)
|
113
|
-
|
114
|
-
provider
|
115
|
-
version
|
116
|
-
title
|
117
|
-
given_name
|
118
|
-
family_name
|
119
|
-
nhs_number
|
120
|
-
born_on
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
107
|
+
new.tap do |args|
|
108
|
+
args.provider = provider
|
109
|
+
args.version = version
|
110
|
+
args.title = "Mr"
|
111
|
+
args.given_name = "Jack"
|
112
|
+
args.family_name = "JONES"
|
113
|
+
args.nhs_number = "0123456789"
|
114
|
+
args.born_on = Date.parse("2001-01-01")
|
115
|
+
args.fmc_patient = "123"
|
116
|
+
args.telephone = "07000 000001"
|
117
|
+
args.hospital_number = "ABC123"
|
118
|
+
args.modality = "PD"
|
119
|
+
args.address = ["line1", "", nil, "line2", "line3 "]
|
120
|
+
args.postcode = "TW1 1UU"
|
121
|
+
args.modality = "HD"
|
122
|
+
args.prescriber_name = "Dr X Yz"
|
123
|
+
args.prescription_date = Date.today.to_s
|
124
|
+
args.consultant = "Dr Pepper"
|
125
|
+
args.hospital_name = "THE ROYAL LONDON HOSPITAL"
|
126
|
+
args.hospital_telephone = "0000 000001"
|
127
|
+
args.hospital_department = "Renal"
|
128
|
+
args.hospital_address = [
|
129
|
+
nil,
|
130
|
+
"WHITECHAPEL",
|
131
|
+
"",
|
136
132
|
"LONDON",
|
137
133
|
"E1 1FR",
|
138
134
|
"UK",
|
139
135
|
"Tel: 0800 00000000",
|
140
136
|
"Another line"
|
141
|
-
]
|
142
|
-
no_known_allergies
|
143
|
-
allergies
|
144
|
-
drug_type
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
137
|
+
]
|
138
|
+
args.no_known_allergies = false
|
139
|
+
args.allergies = ["Nuts", nil, "Penicillin", "Mown grass"]
|
140
|
+
args.drug_type = "ESA"
|
141
|
+
args.administration_frequency = "Daily"
|
142
|
+
args.administration_route = "Per Oral"
|
143
|
+
args.prescription_duration = "1 month"
|
144
|
+
args.administration_device = "device?"
|
145
|
+
args.po_number = "P123"
|
146
|
+
args.generated_at = Time.now
|
147
|
+
args.delivery_frequencies = ["1 week", "3 months", "6 months", "12 month"]
|
148
|
+
args.prescription_durations = ["3 months", "6 months", "12 months"]
|
149
|
+
args.selected_prescription_duration = "6 months"
|
150
|
+
|
151
|
+
args.medications << Medication.new(
|
152
|
+
date: Date.today,
|
153
|
+
drug: "Example drug",
|
154
|
+
dose: "1 unit",
|
155
|
+
route: "PO",
|
156
|
+
frequency: "3"
|
157
|
+
)
|
158
|
+
|
159
|
+
raise ArgumentError, args.errors unless args.valid?
|
160
|
+
end
|
165
161
|
end
|
162
|
+
# rubocop:enable Metrics/AbcSize, Metrics/MethodLength
|
166
163
|
|
167
164
|
def medications_are_present
|
168
165
|
if medications.size == 0
|
data/renalware-forms.gemspec
CHANGED
@@ -1,4 +1,6 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
$LOAD_PATH.push File.expand_path("lib", __dir__)
|
2
4
|
|
3
5
|
# Maintain your gem's version:
|
4
6
|
require "renalware/forms/version"
|
@@ -11,13 +13,13 @@ Gem::Specification.new do |spec|
|
|
11
13
|
spec.email = ["dev@aisrlie.com"]
|
12
14
|
spec.homepage = "http://airslie.com"
|
13
15
|
spec.summary = "PDF library for Renalware forms"
|
14
|
-
spec.description = "The home for various forms for external providers
|
16
|
+
spec.description = "The home for various forms for external providers eg home care prescriptions"
|
15
17
|
spec.license = "MIT"
|
16
18
|
spec.required_ruby_version = ">= 3.0.0"
|
17
19
|
|
18
20
|
spec.files = `git ls-files`.split("\n")
|
19
21
|
spec.test_files = `git ls-files -- {spec}/*`.split("\n")
|
20
|
-
spec.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
22
|
+
spec.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
|
21
23
|
spec.require_paths = ["lib"]
|
22
24
|
spec.extra_rdoc_files = ["README.md"]
|
23
25
|
|
@@ -26,8 +28,7 @@ Gem::Specification.new do |spec|
|
|
26
28
|
spec.add_dependency "prawn", "~> 2.2"
|
27
29
|
spec.add_dependency "prawn-table", "~> 0.2"
|
28
30
|
spec.add_dependency "rake"
|
29
|
-
spec.add_dependency "
|
30
|
-
spec.add_dependency "dry-struct"
|
31
|
-
spec.add_development_dependency "rspec"
|
31
|
+
spec.add_dependency "virtus"
|
32
32
|
spec.add_development_dependency "pdf-reader"
|
33
|
+
spec.add_development_dependency "rspec"
|
33
34
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: renalware-forms
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.14
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Airslie Ltd
|
@@ -81,7 +81,7 @@ dependencies:
|
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
|
-
name:
|
84
|
+
name: virtus
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
87
|
- - ">="
|
@@ -95,21 +95,7 @@ dependencies:
|
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '0'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
|
-
name:
|
99
|
-
requirement: !ruby/object:Gem::Requirement
|
100
|
-
requirements:
|
101
|
-
- - ">="
|
102
|
-
- !ruby/object:Gem::Version
|
103
|
-
version: '0'
|
104
|
-
type: :runtime
|
105
|
-
prerelease: false
|
106
|
-
version_requirements: !ruby/object:Gem::Requirement
|
107
|
-
requirements:
|
108
|
-
- - ">="
|
109
|
-
- !ruby/object:Gem::Version
|
110
|
-
version: '0'
|
111
|
-
- !ruby/object:Gem::Dependency
|
112
|
-
name: rspec
|
98
|
+
name: pdf-reader
|
113
99
|
requirement: !ruby/object:Gem::Requirement
|
114
100
|
requirements:
|
115
101
|
- - ">="
|
@@ -123,7 +109,7 @@ dependencies:
|
|
123
109
|
- !ruby/object:Gem::Version
|
124
110
|
version: '0'
|
125
111
|
- !ruby/object:Gem::Dependency
|
126
|
-
name:
|
112
|
+
name: rspec
|
127
113
|
requirement: !ruby/object:Gem::Requirement
|
128
114
|
requirements:
|
129
115
|
- - ">="
|
@@ -136,7 +122,7 @@ dependencies:
|
|
136
122
|
- - ">="
|
137
123
|
- !ruby/object:Gem::Version
|
138
124
|
version: '0'
|
139
|
-
description: The home for various forms for external providers
|
125
|
+
description: The home for various forms for external providers eg home care prescriptions
|
140
126
|
email:
|
141
127
|
- dev@aisrlie.com
|
142
128
|
executables:
|