renalware-forms 0.1.11 → 0.1.15
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +8 -0
- data/.rspec +1 -0
- data/.rubocop.yml +63 -0
- data/.ruby-version +1 -0
- data/.semaphore/semaphore.yml +51 -0
- data/CHANGELOG.md +52 -0
- data/Gemfile +21 -0
- data/Gemfile.lock +131 -0
- data/bin/rspec +3 -0
- data/default.yml +6 -0
- data/lib/renalware/forms/generic/homecare/v1/footer.rb +2 -0
- data/lib/renalware/forms/generic/homecare/v1.rb +11 -0
- data/lib/renalware/forms/generic/homecare.rb +2 -0
- data/lib/renalware/forms/generic.rb +2 -0
- data/lib/renalware/forms/homecare/args.rb +97 -99
- data/lib/renalware/forms/homecare.rb +3 -4
- data/lib/renalware/forms/version.rb +1 -1
- data/lib/renalware/forms.rb +5 -9
- data/lib/tasks/tasks.rake +3 -1
- data/renalware-forms.gemspec +34 -0
- data/spec/renalware/forms/args_spec.rb +30 -0
- data/spec/renalware/forms/homecare/generic/v1/allergies_spec.rb +38 -0
- data/spec/renalware/forms/homecare/generic/v1/delivery_frequencies_spec.rb +53 -0
- data/spec/renalware/forms/homecare/generic/v1/heading_spec.rb +26 -0
- data/spec/renalware/forms/homecare/generic/v1/mediations_spec.rb +37 -0
- data/spec/renalware/forms/homecare/generic/v1/patient_details_spec.rb +37 -0
- data/spec/renalware/forms/homecare/generic/v1/prescription_durations_spec.rb +52 -0
- data/spec/renalware/forms/homecare/generic/v1/signoff_spec.rb +19 -0
- data/spec/renalware/forms/homecare/pdf_spec.rb +71 -0
- data/spec/spec_helper.rb +78 -0
- metadata +33 -38
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cb8552f50f455db6eef5e37c00b2dedddfa21b4f833d603b71142d7fc49282db
|
4
|
+
data.tar.gz: f70cdcc5f42fab217b1246e6b538658cc8c2c2ab032684ec51f88c6b1e72acf0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 23b6c1b7851bbb8a49b795932d0e5164c2750fbd3b52ea5485ca3d1496d99c6cadb2a0517c65fe229435f5db1b921e697cfbcd577035abeae1727cac9b1962f0
|
7
|
+
data.tar.gz: 45b5577fa64bbda27fd634a55cbc566355890b9bf58b1d0d119558c4d81ca56c46e57ff43b10ce669b280d03189ef1ea81c08274471f439c1097774353f26973
|
data/.gitignore
ADDED
data/.rspec
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--require spec_helper
|
data/.rubocop.yml
ADDED
@@ -0,0 +1,63 @@
|
|
1
|
+
require:
|
2
|
+
- rubocop-rails
|
3
|
+
- rubocop-rspec
|
4
|
+
- rubocop-performance
|
5
|
+
|
6
|
+
# Note that the local default.yml is overwritten on CodeClimate with the contents of
|
7
|
+
# the remote rubocop.yml pulled from GitHub in a codeclimate prepare step.
|
8
|
+
inherit_from:
|
9
|
+
- default.yml
|
10
|
+
|
11
|
+
AllCops:
|
12
|
+
UseCache: true
|
13
|
+
TargetRubyVersion: 3.0
|
14
|
+
# Just defining the Exclude or Include keys here overwrites the settings in default.yml
|
15
|
+
# so we have to redefine the entire set
|
16
|
+
Exclude:
|
17
|
+
- "*.gemspec"
|
18
|
+
- "vendor/**/*"
|
19
|
+
- "bin/**/*"
|
20
|
+
- "lib/tasks/**/*"
|
21
|
+
- "db/**/*"
|
22
|
+
- "spec/dummy/bin/**/*"
|
23
|
+
- "spec/dummy/lib/tasks/**/*"
|
24
|
+
- "spec/dummy/db/**/*"
|
25
|
+
- "tmp/**/*"
|
26
|
+
- "spec/dummy/tmp/**/*"
|
27
|
+
- "vendor/bundle/**/*"
|
28
|
+
- "config/initializers/devise.rb"
|
29
|
+
|
30
|
+
Layout/LineLength:
|
31
|
+
Exclude:
|
32
|
+
- "spec/acceptance/renalware/steps/**/*"
|
33
|
+
|
34
|
+
Metrics/AbcSize:
|
35
|
+
Max: 50
|
36
|
+
RSpec/ExampleLength:
|
37
|
+
Max: 40
|
38
|
+
RSpec/NestedGroups:
|
39
|
+
Max: 4
|
40
|
+
RSpec/MultipleExpectations:
|
41
|
+
Max: 20
|
42
|
+
RSpec/DescribeClass:
|
43
|
+
Enabled: false
|
44
|
+
RSpec/ImplicitSubject:
|
45
|
+
Enabled: false
|
46
|
+
RSpec/DescribedClass:
|
47
|
+
Enabled: false
|
48
|
+
Performance/RedundantBlockCall:
|
49
|
+
Enabled: false
|
50
|
+
Style/NumericPredicate:
|
51
|
+
Enabled: false
|
52
|
+
RSpec/InstanceVariable:
|
53
|
+
Enabled: false
|
54
|
+
Metrics/MethodLength:
|
55
|
+
Max: 50
|
56
|
+
Rails/Date:
|
57
|
+
Enabled: false
|
58
|
+
Rails/TimeZone:
|
59
|
+
Enabled: false
|
60
|
+
Style/AsciiComments:
|
61
|
+
Enabled: false
|
62
|
+
Style/ZeroLengthPredicate:
|
63
|
+
Enabled: false
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
3.0.2
|
@@ -0,0 +1,51 @@
|
|
1
|
+
# Use the latest stable version of Semaphore 2.0 YML syntax:
|
2
|
+
version: v1.0
|
3
|
+
name: renalware-forms
|
4
|
+
|
5
|
+
agent:
|
6
|
+
machine:
|
7
|
+
type: e1-standard-2
|
8
|
+
os_image: ubuntu1804
|
9
|
+
|
10
|
+
blocks:
|
11
|
+
- name: Test setup
|
12
|
+
task:
|
13
|
+
jobs:
|
14
|
+
- name: bundle
|
15
|
+
commands:
|
16
|
+
- checkout
|
17
|
+
- cache restore gems-$SEMAPHORE_GIT_BRANCH-$(checksum Gemfile.lock),gems-$SEMAPHORE_GIT_BRANCH-,gems-master-
|
18
|
+
- sem-version ruby 3.0.2
|
19
|
+
- bundle install --deployment -j 4 --path vendor/bundle
|
20
|
+
- cache store gems-$SEMAPHORE_GIT_BRANCH-$(checksum Gemfile.lock) vendor/bundle
|
21
|
+
|
22
|
+
- name: Tests
|
23
|
+
task:
|
24
|
+
env_vars:
|
25
|
+
- name: RAILS_ENV
|
26
|
+
value: test
|
27
|
+
|
28
|
+
# This secret on semaphore contains the CC_TEST_REPORTER_ID ENV var
|
29
|
+
secrets:
|
30
|
+
- name: renalware-forms
|
31
|
+
|
32
|
+
prologue:
|
33
|
+
commands:
|
34
|
+
- checkout
|
35
|
+
- cache restore gems-$SEMAPHORE_GIT_BRANCH-$(checksum Gemfile.lock),gems-$SEMAPHORE_GIT_BRANCH-,gems-master-
|
36
|
+
- git submodule sync ; git submodule update --init
|
37
|
+
- curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
|
38
|
+
- chmod +x ./cc-test-reporter
|
39
|
+
- ./cc-test-reporter before-build
|
40
|
+
- sem-version ruby 3.0.2
|
41
|
+
- bundle install --deployment --path vendor/bundle
|
42
|
+
|
43
|
+
jobs:
|
44
|
+
- name: RSpec tests
|
45
|
+
commands:
|
46
|
+
- bundle exec rspec --format progress
|
47
|
+
|
48
|
+
epilogue:
|
49
|
+
on_pass:
|
50
|
+
commands:
|
51
|
+
- ./cc-test-reporter after-build
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,52 @@
|
|
1
|
+
# Change Log
|
2
|
+
|
3
|
+
All notable changes to this project will be documented in
|
4
|
+
this [changelog](http://keepachangelog.com/en/0.3.0/).
|
5
|
+
This project adheres to Semantic Versioning.
|
6
|
+
|
7
|
+
## Unreleased
|
8
|
+
### Added
|
9
|
+
### Changed
|
10
|
+
### Fixed
|
11
|
+
|
12
|
+
## 0.1.15
|
13
|
+
6 Oct 2021
|
14
|
+
### Added
|
15
|
+
### Changed
|
16
|
+
### Fixed
|
17
|
+
- Fixed unresolved constant VERSION
|
18
|
+
|
19
|
+
## 0.1.14
|
20
|
+
6 Oct 2021
|
21
|
+
### Added
|
22
|
+
### Changed
|
23
|
+
- Switched from dry-types to Virtus
|
24
|
+
- Use Ruby 3
|
25
|
+
|
26
|
+
### Fixed
|
27
|
+
## 0.1.11
|
28
|
+
3 April 2020
|
29
|
+
### Added
|
30
|
+
### Changed
|
31
|
+
- Switched from Virtus to dry-types
|
32
|
+
### Fixed
|
33
|
+
|
34
|
+
## 0.1.7
|
35
|
+
31 Mar 2020
|
36
|
+
### Added
|
37
|
+
### Changed
|
38
|
+
### Fixed
|
39
|
+
- Remove unused homecare args
|
40
|
+
|
41
|
+
## 0.1.6
|
42
|
+
31 Mar 2020
|
43
|
+
### Added
|
44
|
+
### Changed
|
45
|
+
### Fixed
|
46
|
+
- Support supplying a selected delivery frequency
|
47
|
+
|
48
|
+
## 0.1.3
|
49
|
+
### Added
|
50
|
+
### Changed
|
51
|
+
### Fixed
|
52
|
+
- Bring in allergies
|
data/Gemfile
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
source "https://rubygems.org"
|
2
|
+
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
|
3
|
+
|
4
|
+
# Declare your gem's dependencies in renalware-forms.gemspec.
|
5
|
+
# Bundler will treat runtime dependencies like base dependencies, and
|
6
|
+
# development dependencies will be added by default to the :development group.
|
7
|
+
gemspec
|
8
|
+
|
9
|
+
# Declare any dependencies that are still in development here instead of in
|
10
|
+
# your gemspec. These might include edge Rails or gems from your path or
|
11
|
+
# Git. Remember to move these dependencies to your gemspec before releasing
|
12
|
+
# your gem to rubygems.org.
|
13
|
+
|
14
|
+
group :development, :test do
|
15
|
+
gem "byebug"
|
16
|
+
gem "rubocop"
|
17
|
+
gem "rubocop-performance"
|
18
|
+
gem "rubocop-rails"
|
19
|
+
gem "rubocop-rspec"
|
20
|
+
gem "simplecov", "~> 0.17.1"
|
21
|
+
end
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,131 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
renalware-forms (0.1.15)
|
5
|
+
activemodel
|
6
|
+
attr_extras (~> 6.2)
|
7
|
+
prawn (~> 2.2)
|
8
|
+
prawn-table (~> 0.2)
|
9
|
+
rake
|
10
|
+
virtus
|
11
|
+
|
12
|
+
GEM
|
13
|
+
remote: https://rubygems.org/
|
14
|
+
specs:
|
15
|
+
Ascii85 (1.1.0)
|
16
|
+
activemodel (6.1.4.1)
|
17
|
+
activesupport (= 6.1.4.1)
|
18
|
+
activesupport (6.1.4.1)
|
19
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
20
|
+
i18n (>= 1.6, < 2)
|
21
|
+
minitest (>= 5.1)
|
22
|
+
tzinfo (~> 2.0)
|
23
|
+
zeitwerk (~> 2.3)
|
24
|
+
afm (0.2.2)
|
25
|
+
ast (2.4.2)
|
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)
|
31
|
+
byebug (11.1.3)
|
32
|
+
coercible (1.0.0)
|
33
|
+
descendants_tracker (~> 0.0.1)
|
34
|
+
concurrent-ruby (1.1.9)
|
35
|
+
descendants_tracker (0.0.4)
|
36
|
+
thread_safe (~> 0.3, >= 0.3.1)
|
37
|
+
diff-lcs (1.4.4)
|
38
|
+
docile (1.4.0)
|
39
|
+
hashery (2.1.2)
|
40
|
+
i18n (1.8.10)
|
41
|
+
concurrent-ruby (~> 1.0)
|
42
|
+
ice_nine (0.11.2)
|
43
|
+
json (2.5.1)
|
44
|
+
minitest (5.14.4)
|
45
|
+
parallel (1.21.0)
|
46
|
+
parser (3.0.2.0)
|
47
|
+
ast (~> 2.4.1)
|
48
|
+
pdf-core (0.9.0)
|
49
|
+
pdf-reader (2.5.0)
|
50
|
+
Ascii85 (~> 1.0)
|
51
|
+
afm (~> 0.2.1)
|
52
|
+
hashery (~> 2.0)
|
53
|
+
ruby-rc4
|
54
|
+
ttfunk
|
55
|
+
prawn (2.4.0)
|
56
|
+
pdf-core (~> 0.9.0)
|
57
|
+
ttfunk (~> 1.7)
|
58
|
+
prawn-table (0.2.2)
|
59
|
+
prawn (>= 1.3.0, < 3.0.0)
|
60
|
+
rack (2.2.3)
|
61
|
+
rainbow (3.0.0)
|
62
|
+
rake (13.0.6)
|
63
|
+
regexp_parser (2.1.1)
|
64
|
+
rexml (3.2.5)
|
65
|
+
rspec (3.10.0)
|
66
|
+
rspec-core (~> 3.10.0)
|
67
|
+
rspec-expectations (~> 3.10.0)
|
68
|
+
rspec-mocks (~> 3.10.0)
|
69
|
+
rspec-core (3.10.1)
|
70
|
+
rspec-support (~> 3.10.0)
|
71
|
+
rspec-expectations (3.10.1)
|
72
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
73
|
+
rspec-support (~> 3.10.0)
|
74
|
+
rspec-mocks (3.10.2)
|
75
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
76
|
+
rspec-support (~> 3.10.0)
|
77
|
+
rspec-support (3.10.2)
|
78
|
+
rubocop (1.22.1)
|
79
|
+
parallel (~> 1.10)
|
80
|
+
parser (>= 3.0.0.0)
|
81
|
+
rainbow (>= 2.2.2, < 4.0)
|
82
|
+
regexp_parser (>= 1.8, < 3.0)
|
83
|
+
rexml
|
84
|
+
rubocop-ast (>= 1.12.0, < 2.0)
|
85
|
+
ruby-progressbar (~> 1.7)
|
86
|
+
unicode-display_width (>= 1.4.0, < 3.0)
|
87
|
+
rubocop-ast (1.12.0)
|
88
|
+
parser (>= 3.0.1.1)
|
89
|
+
rubocop-performance (1.11.5)
|
90
|
+
rubocop (>= 1.7.0, < 2.0)
|
91
|
+
rubocop-ast (>= 0.4.0)
|
92
|
+
rubocop-rails (2.12.2)
|
93
|
+
activesupport (>= 4.2.0)
|
94
|
+
rack (>= 1.1)
|
95
|
+
rubocop (>= 1.7.0, < 2.0)
|
96
|
+
rubocop-rspec (2.5.0)
|
97
|
+
rubocop (~> 1.19)
|
98
|
+
ruby-progressbar (1.11.0)
|
99
|
+
ruby-rc4 (0.1.5)
|
100
|
+
simplecov (0.17.1)
|
101
|
+
docile (~> 1.1)
|
102
|
+
json (>= 1.8, < 3)
|
103
|
+
simplecov-html (~> 0.10.0)
|
104
|
+
simplecov-html (0.10.2)
|
105
|
+
thread_safe (0.3.6)
|
106
|
+
ttfunk (1.7.0)
|
107
|
+
tzinfo (2.0.4)
|
108
|
+
concurrent-ruby (~> 1.0)
|
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)
|
114
|
+
zeitwerk (2.4.2)
|
115
|
+
|
116
|
+
PLATFORMS
|
117
|
+
ruby
|
118
|
+
|
119
|
+
DEPENDENCIES
|
120
|
+
byebug
|
121
|
+
pdf-reader
|
122
|
+
renalware-forms!
|
123
|
+
rspec
|
124
|
+
rubocop
|
125
|
+
rubocop-performance
|
126
|
+
rubocop-rails
|
127
|
+
rubocop-rspec
|
128
|
+
simplecov (~> 0.17.1)
|
129
|
+
|
130
|
+
BUNDLED WITH
|
131
|
+
2.2.28
|
data/bin/rspec
ADDED
data/default.yml
ADDED
@@ -0,0 +1,6 @@
|
|
1
|
+
inherit_from:
|
2
|
+
- https://raw.githubusercontent.com/airslie/styleguide/master/rubocop.yml
|
3
|
+
|
4
|
+
# Don't add anything to this file other than the inherit_from above
|
5
|
+
# as this file is overwritten on CodeClimate with the contents of the above
|
6
|
+
# remote url which is downloaded in a CodeClimate prepare step.
|
@@ -6,3 +6,14 @@ module Renalware::Forms::Generic
|
|
6
6
|
end
|
7
7
|
end
|
8
8
|
end
|
9
|
+
|
10
|
+
require_relative "v1/base"
|
11
|
+
require_relative "v1/allergies"
|
12
|
+
require_relative "v1/delivery_frequencies"
|
13
|
+
require_relative "v1/document"
|
14
|
+
require_relative "v1/footer"
|
15
|
+
require_relative "v1/heading"
|
16
|
+
require_relative "v1/medications"
|
17
|
+
require_relative "v1/patient_details"
|
18
|
+
require_relative "v1/prescription_durations"
|
19
|
+
require_relative "v1/signoff"
|
@@ -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
|
-
attribute :
|
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,59 +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
|
-
|
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
|
164
161
|
end
|
162
|
+
# rubocop:enable Metrics/AbcSize, Metrics/MethodLength
|
165
163
|
|
166
164
|
def medications_are_present
|
167
165
|
if medications.size == 0
|