renalware-forms 0.1.10 → 0.1.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/renalware/forms/homecare/args.rb +95 -87
- data/lib/renalware/forms/version.rb +1 -1
- metadata +21 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 92ef42b414ec62117acbf04fc22a9bf34e1ca82176a69c02914c564345f6f327
|
4
|
+
data.tar.gz: c951b4c7190b188bda3d2544e96fe173bf52b19ee3eb77313215c4b5708c738b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0e834a60b44a5244f9845eb8897624a1a64fba69c2dca49755dab064f61629a78f4bb020624ff007ab4376da87b2dd562f526d068972b848534e5068398c0784
|
7
|
+
data.tar.gz: 23b9b51811838cc076afb490526bd79adc2943a16038b7be9747122f05ee9c9d00ef84d08b27523346de161a643d680ae0c4c64f84bebd5bd7a56357a58e2b53
|
@@ -1,58 +1,68 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require "
|
3
|
+
require "dry-types"
|
4
|
+
require "dry-struct"
|
4
5
|
require "active_model"
|
5
6
|
|
6
7
|
# rubocop:disable Metrics/ClassLength
|
7
8
|
module Renalware::Forms
|
8
|
-
|
9
|
-
include
|
9
|
+
module Types
|
10
|
+
include Dry.Types()
|
11
|
+
end
|
12
|
+
|
13
|
+
class Homecare::Args < Dry::Struct
|
10
14
|
include ActiveModel::Validations
|
11
15
|
|
12
|
-
class Medication
|
13
|
-
include Virtus.model(strict: true)
|
16
|
+
class Medication < Dry::Struct
|
14
17
|
include ActiveModel::Validations
|
15
18
|
|
16
|
-
attribute :date, Date
|
17
|
-
attribute :drug, String
|
18
|
-
attribute :dose, String
|
19
|
-
attribute :route, String
|
20
|
-
attribute :frequency, String
|
19
|
+
attribute :date, Types::Params::Date
|
20
|
+
attribute :drug, Types::String
|
21
|
+
attribute :dose, Types::String
|
22
|
+
attribute :route, Types::String
|
23
|
+
attribute :frequency, Types::String
|
21
24
|
end
|
22
25
|
|
23
26
|
# The first 2 attrbutes are used to drive what PDF to build
|
24
|
-
attribute :provider, String
|
25
|
-
attribute :version, Integer
|
26
|
-
attribute :title, String
|
27
|
-
attribute :given_name, String
|
28
|
-
attribute :family_name, String
|
29
|
-
attribute :nhs_number, String
|
30
|
-
attribute :born_on, Date
|
31
|
-
attribute :modality, String
|
32
|
-
attribute :telephone, String
|
33
|
-
attribute :hospital_number, String
|
34
|
-
attribute :address, Array(String),
|
35
|
-
attribute :postcode, String
|
36
|
-
attribute :
|
37
|
-
attribute :
|
38
|
-
attribute :
|
39
|
-
attribute :
|
40
|
-
attribute :
|
41
|
-
attribute :
|
42
|
-
attribute :
|
43
|
-
attribute :
|
44
|
-
attribute :
|
45
|
-
attribute :
|
46
|
-
attribute :
|
47
|
-
attribute :
|
48
|
-
attribute :
|
49
|
-
attribute :
|
50
|
-
attribute :
|
51
|
-
attribute
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
attribute
|
27
|
+
attribute :provider, Types::Coercible::String
|
28
|
+
attribute :version, Types::Integer
|
29
|
+
attribute :title, Types::String.default("")
|
30
|
+
attribute :given_name, Types::String
|
31
|
+
attribute :family_name, Types::String
|
32
|
+
attribute :nhs_number, Types::String.default("")
|
33
|
+
attribute :born_on, Types::Params::Date
|
34
|
+
attribute :modality, Types::String.default("")
|
35
|
+
attribute :telephone, Types::String.default("")
|
36
|
+
attribute :hospital_number, Types::String.default("")
|
37
|
+
attribute :address, Types::Array.of(Types::Coercible::String).default([].dup, shared: true)
|
38
|
+
attribute :postcode, Types::String.default("")
|
39
|
+
attribute :prescriber_name, Types::String.default("")
|
40
|
+
attribute :prescription_date, Types::Params::Date
|
41
|
+
attribute :hospital_name, Types::String.default("")
|
42
|
+
attribute :hospital_department, Types::String.default("")
|
43
|
+
attribute :hospital_address, Types::Array.of(Types::Coercible::String).default([], shared: true)
|
44
|
+
attribute :hospital_telephone, Types::String.default("")
|
45
|
+
attribute :po_number, Types::String.default("")
|
46
|
+
attribute :generated_at, (Types::Params::DateTime.default { DateTime.now })
|
47
|
+
attribute :no_known_allergies, Types::Bool
|
48
|
+
attribute :allergies, Types::Array.of(Types::Coercible::String)
|
49
|
+
attribute :drug_type, Types::Coercible::String
|
50
|
+
# attribute :prescription_duration, Types::String
|
51
|
+
attribute :administration_device, Types::String.default("")
|
52
|
+
attribute :medications, Types::Array.of(Medication).default([].dup, shared: true)
|
53
|
+
attribute :consultant, Types::String.default("")
|
54
|
+
attribute(
|
55
|
+
:delivery_frequencies,
|
56
|
+
Types::Array.of(Types::Coercible::String).default(["3 months", "6 months"].freeze)
|
57
|
+
)
|
58
|
+
attribute(
|
59
|
+
:prescription_durations,
|
60
|
+
Types::Array
|
61
|
+
.of(Types::Coercible::String)
|
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"
|
56
66
|
|
57
67
|
validates :family_name, presence: true
|
58
68
|
validates :given_name, presence: true
|
@@ -100,27 +110,26 @@ module Renalware::Forms
|
|
100
110
|
end
|
101
111
|
|
102
112
|
def self.test_data(provider: :generic, version: 1)
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
args.hospital_address = [
|
113
|
+
args = new(
|
114
|
+
provider: provider,
|
115
|
+
version: version,
|
116
|
+
title: "Mr",
|
117
|
+
given_name: "Jack",
|
118
|
+
family_name: "JONES",
|
119
|
+
nhs_number: "0123456789",
|
120
|
+
born_on: Date.parse("2001-01-01"),
|
121
|
+
telephone: "07000 000001",
|
122
|
+
hospital_number: "ABC123",
|
123
|
+
modality: "HD",
|
124
|
+
address: ["line1", "", nil, "line2", "line3 "],
|
125
|
+
postcode: "TW1 1UU",
|
126
|
+
prescriber_name: "Dr X Yz",
|
127
|
+
prescription_date: Date.today.to_s,
|
128
|
+
consultant: "Dr Pepper",
|
129
|
+
hospital_name: "THE ROYAL LONDON HOSPITAL",
|
130
|
+
hospital_telephone: "0000 000001",
|
131
|
+
hospital_department: "Renal",
|
132
|
+
hospital_address: [
|
124
133
|
"The Royal London Hospital",
|
125
134
|
"Barts Health NHS Trust",
|
126
135
|
"Whitechapel",
|
@@ -129,30 +138,29 @@ module Renalware::Forms
|
|
129
138
|
"UK",
|
130
139
|
"Tel: 0800 00000000",
|
131
140
|
"Another line"
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
end
|
141
|
+
],
|
142
|
+
no_known_allergies: false,
|
143
|
+
allergies: ["Nuts", nil, "Penicillin", "Mown grass"],
|
144
|
+
drug_type: "ESA",
|
145
|
+
prescription_duration: "1 month",
|
146
|
+
administration_device: "device?",
|
147
|
+
po_number: "P123",
|
148
|
+
delivery_frequencies: ["1 week", "3 months", "6 months", "12 month"],
|
149
|
+
prescription_durations: ["3 months", "6 months", "12 months"],
|
150
|
+
selected_prescription_duration: "6 months",
|
151
|
+
selected_delivery_frequency: "6 months"
|
152
|
+
)
|
153
|
+
|
154
|
+
args.medications << Medication.new(
|
155
|
+
date: Date.today,
|
156
|
+
drug: "Example drug",
|
157
|
+
dose: "1 unit",
|
158
|
+
route: "PO",
|
159
|
+
frequency: "3"
|
160
|
+
)
|
161
|
+
|
162
|
+
raise ArgumentError, args.errors unless args.valid?
|
163
|
+
args
|
156
164
|
end
|
157
165
|
|
158
166
|
def medications_are_present
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
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.11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Airslie Ltd
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-04-
|
11
|
+
date: 2020-04-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activemodel
|
@@ -81,19 +81,33 @@ dependencies:
|
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
|
-
name:
|
84
|
+
name: dry-types
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- - "
|
87
|
+
- - ">="
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: '
|
89
|
+
version: '0'
|
90
90
|
type: :runtime
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- - "
|
94
|
+
- - ">="
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version: '
|
96
|
+
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: dry-struct
|
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'
|
97
111
|
- !ruby/object:Gem::Dependency
|
98
112
|
name: zeitwerk
|
99
113
|
requirement: !ruby/object:Gem::Requirement
|