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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 181086d1ec5a5fc79aeb1f31ee96d41783421214068279e7685c32b0310b08c1
4
- data.tar.gz: 124fa4c1c4b5f8a7a7c9aa6653b194f2ebd773664dded89be7a9c163681ae677
3
+ metadata.gz: 17b52d0a15890cefaeb0f17f380dfdb7ad4278a018e33c8efce02d0223087661
4
+ data.tar.gz: e03e9e3936da756f26656fa3a3f7f20a0aa2adbc8b4a3e6ffa4171722945fa56
5
5
  SHA512:
6
- metadata.gz: 6f47a359295804dfd868b3af40a2370a5c40c8a3e0483aa2b73030d890791519eab1e750b59ffe72920562ccce5713ecea1284a9508b7dc26934768ef32ab81d
7
- data.tar.gz: 138c530b7af35432e90d8a1a8cb4483dc69d0c0c6cfa0eab0901c7713e1d8849fd12c49a3bba31a9d41a4f38f16cc5ec278d124fb8b7f029f6a9907f9cfaca77
6
+ metadata.gz: 7916272475387df5ae34a022fa4119bbe563e556607e3c695255193fc1f2058ced488dd3cbd72f6cb21923ccfde2a782ae2a92d66993b41a0a5bec500c640a01
7
+ data.tar.gz: 24e0160727b509117d8c1ec5b60154e43b15180b1e94113b8e1bcc072083301196c79b8ea21a3e469b458f896701709af7c0ff8a7ea7a5cf702130e402f3bfe8
data/CHANGELOG.md CHANGED
@@ -9,6 +9,14 @@ This project adheres to Semantic Versioning.
9
9
  ### Changed
10
10
  ### Fixed
11
11
 
12
+ ## 0.1.14
13
+ 6 Oct 2021
14
+ ### Added
15
+ ### Changed
16
+ - Switched from dry-types to Virtus
17
+ - Use Ruby 3
18
+
19
+ ### Fixed
12
20
  ## 0.1.11
13
21
  3 April 2020
14
22
  ### Added
data/Gemfile.lock CHANGED
@@ -1,14 +1,13 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- renalware-forms (0.1.13)
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 "dry-types"
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
- module Types
10
- include Dry.Types()
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 < Dry::Struct
12
+ class Medication
13
+ include Virtus.model(strict: true)
17
14
  include ActiveModel::Validations
18
15
 
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
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, Types::Coercible::String
28
- attribute :version, Types::Coercible::Integer
29
- attribute :title, Types::String.default("").optional
30
- attribute :given_name, Types::String
31
- attribute :family_name, Types::String
32
- attribute :nhs_number, Types::String.default("").optional
33
- attribute :born_on, Types::Params::Date
34
- attribute :modality , Types::Coercible::String.optional
35
- attribute :telephone, Types::String.default("").optional
36
- attribute :hospital_number, Types::String.default("").optional
37
- attribute :address, Types::Array.of(Types::Coercible::String).default([].dup, shared: true)
38
- attribute :postcode, Types::String.default("").optional
39
- attribute :prescriber_name, Types::String.default("").optional
40
- # attribute :prescription_date, Types::Params::Date
41
- attribute :hospital_name, Types::String.default("")
42
- attribute :hospital_department, Types::String.default("").optional
43
- attribute :hospital_address, Types::Array.of(Types::Coercible::String).default([], shared: true)
44
- attribute :hospital_telephone, Types::String.default("").optional
45
- attribute :po_number, Types::String.default("").optional
46
- attribute :generated_at, (Types::Params::DateTime.default { DateTime.now })
47
- attribute :no_known_allergies, Types::Bool.optional
48
- attribute :allergies, Types::Array.of(Types::Coercible::String)
49
- attribute :drug_type, Types::Coercible::String.optional
50
- # attribute :prescription_duration, Types::String
51
- attribute :administration_device, Types::String.default("").optional
52
- attribute :medications, Types::Array.of(Medication).default([].dup, shared: true)
53
- attribute :consultant, Types::String.default("").optional
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"
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&.is_a?(Array)
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
- 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: [
133
- "The Royal London Hospital",
134
- "Barts Health NHS Trust",
135
- "Whitechapel",
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: 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
-
164
- args
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
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Renalware
4
4
  module Forms
5
- VERSION = "0.1.13"
5
+ VERSION = "0.1.14"
6
6
  end
7
7
  end
@@ -1,4 +1,6 @@
1
- $:.push File.expand_path("lib", __dir__)
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 e.g. home care prescriptions"
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 "dry-types"
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.13
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: dry-types
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: 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'
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: pdf-reader
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 e.g. home care prescriptions
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: