fhir_models 4.2.1 → 4.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ruby.yml +1 -1
- data/.gitignore +0 -1
- data/.rubocop.yml +5 -1
- data/.rubocop_todo.yml +49 -116
- data/.ruby-version +1 -0
- data/.simplecov +1 -5
- data/.tool-versions +1 -0
- data/Gemfile.lock +29 -23
- data/Guardfile +1 -1
- data/fhir_models.gemspec +2 -1
- data/lib/fhir_models/bootstrap/definitions.rb +16 -3
- data/lib/fhir_models/bootstrap/field.rb +2 -2
- data/lib/fhir_models/bootstrap/generator.rb +9 -7
- data/lib/fhir_models/bootstrap/hashable.rb +23 -17
- data/lib/fhir_models/bootstrap/json.rb +1 -1
- data/lib/fhir_models/bootstrap/model.rb +43 -32
- data/lib/fhir_models/bootstrap/preprocess.rb +25 -17
- data/lib/fhir_models/bootstrap/xml.rb +9 -7
- data/lib/fhir_models/deprecate.rb +1 -0
- data/lib/fhir_models/fhir.rb +7 -6
- data/lib/fhir_models/fhir_ext/element_definition.rb +4 -1
- data/lib/fhir_models/fhir_ext/structure_definition.rb +24 -20
- data/lib/fhir_models/fhir_ext/structure_definition_compare.rb +12 -2
- data/lib/fhir_models/fhir_ext/structure_definition_finding.rb +2 -2
- data/lib/fhir_models/fhirpath/expression.rb +4 -6
- data/lib/fhir_models/fhirpath/parse.rb +10 -7
- data/lib/fhir_models/version.rb +1 -1
- metadata +11 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cbba24e4cace9e2cb19f53f46a06fc8731b982014ee0da534cd0c6dbe6c16199
|
4
|
+
data.tar.gz: 7d2834c9c61fcc01c2d851c5de645a974a8b3d9bf44da2af639b6fde75e8071e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a60709d19586e87f86067a94e1b3867968bd06abd934cb3cfcc4d64ac138cf9389730dd1bd024e5b9ee68eff28d8d605dfdc2e4d22254d783ca56cbb719c897b
|
7
|
+
data.tar.gz: 51cd84621c0e66e28bc793d97edc56f25e641a0fe97e9b376f1978721ee4ffa3cf6a662364a03797e0fe4fec3d21df62ef2034e5711fe12e551be9ae80e54bc2
|
data/.github/workflows/ruby.yml
CHANGED
data/.gitignore
CHANGED
data/.rubocop.yml
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
inherit_from: .rubocop_todo.yml
|
2
2
|
AllCops:
|
3
|
-
TargetRubyVersion:
|
3
|
+
TargetRubyVersion: 3.0
|
4
4
|
Exclude:
|
5
5
|
- 'test/**/*'
|
6
6
|
- 'spec/**/*'
|
@@ -12,6 +12,8 @@ AllCops:
|
|
12
12
|
- 'bin/*'
|
13
13
|
Layout/LineLength:
|
14
14
|
Enabled: false
|
15
|
+
Style/AccessorGrouping:
|
16
|
+
Enabled: false
|
15
17
|
Style/FrozenStringLiteralComment:
|
16
18
|
Enabled: false
|
17
19
|
Style/HashEachMethods:
|
@@ -20,6 +22,8 @@ Style/HashTransformKeys:
|
|
20
22
|
Enabled: true
|
21
23
|
Style/HashTransformValues:
|
22
24
|
Enabled: true
|
25
|
+
Style/WordArray:
|
26
|
+
EnforcedStyle: brackets
|
23
27
|
inherit_mode:
|
24
28
|
merge:
|
25
29
|
- Exclude
|
data/.rubocop_todo.yml
CHANGED
@@ -1,47 +1,19 @@
|
|
1
1
|
# This configuration was generated by
|
2
2
|
# `rubocop --auto-gen-config`
|
3
|
-
# on
|
3
|
+
# on 2023-12-13 19:55:27 UTC using RuboCop version 1.23.0.
|
4
4
|
# The point is for the user to remove these configuration records
|
5
5
|
# one by one as the offenses are removed from the code base.
|
6
6
|
# Note that changes in the inspected code, or installation of new
|
7
7
|
# versions of RuboCop, may require this file to be generated again.
|
8
8
|
|
9
|
-
# Offense count:
|
10
|
-
#
|
11
|
-
Layout/EmptyLineAfterGuardClause:
|
12
|
-
Exclude:
|
13
|
-
- 'lib/fhir_models/bootstrap/definitions.rb'
|
14
|
-
- 'lib/fhir_models/bootstrap/generator.rb'
|
15
|
-
- 'lib/fhir_models/bootstrap/hashable.rb'
|
16
|
-
- 'lib/fhir_models/bootstrap/model.rb'
|
17
|
-
- 'lib/fhir_models/bootstrap/preprocess.rb'
|
18
|
-
- 'lib/fhir_models/bootstrap/xml.rb'
|
19
|
-
- 'lib/fhir_models/deprecate.rb'
|
20
|
-
- 'lib/fhir_models/fhir_ext/element_definition.rb'
|
21
|
-
- 'lib/fhir_models/fhir_ext/structure_definition.rb'
|
22
|
-
- 'lib/fhir_models/fhir_ext/structure_definition_compare.rb'
|
23
|
-
- 'lib/fhir_models/fhirpath/parse.rb'
|
24
|
-
|
25
|
-
# Offense count: 1
|
26
|
-
# Cop supports --auto-correct.
|
27
|
-
Layout/RescueEnsureAlignment:
|
28
|
-
Exclude:
|
29
|
-
- 'lib/fhir_models/bootstrap/hashable.rb'
|
30
|
-
|
31
|
-
# Offense count: 2
|
32
|
-
# Cop supports --auto-correct.
|
33
|
-
Lint/ToJSON:
|
34
|
-
Exclude:
|
35
|
-
- 'lib/fhir_models/bootstrap/json.rb'
|
36
|
-
- 'lib/fhir_models/fhir_ext/structure_definition_finding.rb'
|
37
|
-
|
38
|
-
# Offense count: 40
|
9
|
+
# Offense count: 38
|
10
|
+
# Configuration parameters: IgnoredMethods, CountRepeatedAttributes.
|
39
11
|
Metrics/AbcSize:
|
40
|
-
Max:
|
12
|
+
Max: 394
|
41
13
|
|
42
14
|
# Offense count: 7
|
43
|
-
# Configuration parameters: CountComments, ExcludedMethods.
|
44
|
-
#
|
15
|
+
# Configuration parameters: CountComments, CountAsOne, ExcludedMethods, IgnoredMethods.
|
16
|
+
# IgnoredMethods: refine
|
45
17
|
Metrics/BlockLength:
|
46
18
|
Max: 78
|
47
19
|
|
@@ -51,47 +23,51 @@ Metrics/BlockNesting:
|
|
51
23
|
Max: 5
|
52
24
|
|
53
25
|
# Offense count: 7
|
54
|
-
# Configuration parameters: CountComments.
|
26
|
+
# Configuration parameters: CountComments, CountAsOne.
|
55
27
|
Metrics/ClassLength:
|
56
|
-
Max:
|
28
|
+
Max: 355
|
57
29
|
|
58
|
-
# Offense count:
|
30
|
+
# Offense count: 32
|
31
|
+
# Configuration parameters: IgnoredMethods.
|
59
32
|
Metrics/CyclomaticComplexity:
|
60
|
-
Max:
|
33
|
+
Max: 73
|
61
34
|
|
62
|
-
# Offense count:
|
63
|
-
# Configuration parameters: CountComments, ExcludedMethods.
|
35
|
+
# Offense count: 45
|
36
|
+
# Configuration parameters: CountComments, CountAsOne, ExcludedMethods, IgnoredMethods.
|
64
37
|
Metrics/MethodLength:
|
65
|
-
Max:
|
38
|
+
Max: 132
|
66
39
|
|
67
40
|
# Offense count: 2
|
68
|
-
# Configuration parameters: CountComments.
|
41
|
+
# Configuration parameters: CountComments, CountAsOne.
|
69
42
|
Metrics/ModuleLength:
|
70
|
-
Max:
|
43
|
+
Max: 115
|
71
44
|
|
72
|
-
# Offense count:
|
45
|
+
# Offense count: 28
|
46
|
+
# Configuration parameters: IgnoredMethods.
|
73
47
|
Metrics/PerceivedComplexity:
|
74
|
-
Max:
|
48
|
+
Max: 76
|
49
|
+
|
50
|
+
# Offense count: 5
|
51
|
+
# Configuration parameters: EnforcedStyle, IgnoredPatterns.
|
52
|
+
# SupportedStyles: snake_case, camelCase
|
53
|
+
Naming/MethodName:
|
54
|
+
Exclude:
|
55
|
+
- 'lib/fhir_models/fhir_ext/structure_definition_finding.rb'
|
75
56
|
|
76
57
|
# Offense count: 4
|
77
58
|
# Configuration parameters: MinNameLength, AllowNamesEndingInNumbers, AllowedNames, ForbiddenNames.
|
78
|
-
# AllowedNames:
|
59
|
+
# AllowedNames: at, by, db, id, in, io, ip, of, on, os, pp, to
|
79
60
|
Naming/MethodParameterName:
|
80
61
|
Exclude:
|
81
62
|
- 'lib/fhir_models/fhir_ext/structure_definition_compare.rb'
|
82
63
|
|
83
|
-
# Offense count:
|
64
|
+
# Offense count: 1
|
84
65
|
# Cop supports --auto-correct.
|
85
|
-
# Configuration parameters:
|
86
|
-
|
66
|
+
# Configuration parameters: EnforcedStyle.
|
67
|
+
# SupportedStyles: nested, compact
|
68
|
+
Style/ClassAndModuleChildren:
|
87
69
|
Exclude:
|
88
|
-
- '
|
89
|
-
|
90
|
-
# Offense count: 1
|
91
|
-
# Configuration parameters: .
|
92
|
-
# SupportedStyles: inline, group
|
93
|
-
Style/AccessModifierDeclarations:
|
94
|
-
EnforcedStyle: inline
|
70
|
+
- '.simplecov'
|
95
71
|
|
96
72
|
# Offense count: 17
|
97
73
|
Style/ClassVars:
|
@@ -99,17 +75,23 @@ Style/ClassVars:
|
|
99
75
|
- 'lib/fhir_models/bootstrap/definitions.rb'
|
100
76
|
- 'lib/fhir_models/fhirpath/parse.rb'
|
101
77
|
|
78
|
+
# Offense count: 1
|
79
|
+
Style/CombinableLoops:
|
80
|
+
Exclude:
|
81
|
+
- 'lib/fhir_models/fhir_ext/structure_definition_compare.rb'
|
82
|
+
|
102
83
|
# Offense count: 6
|
84
|
+
# Cop supports --auto-correct.
|
103
85
|
Style/CommentedKeyword:
|
104
86
|
Exclude:
|
105
87
|
- 'lib/fhir_models/bootstrap/hashable.rb'
|
106
88
|
- 'lib/fhir_models/bootstrap/model.rb'
|
107
89
|
|
108
|
-
# Offense count:
|
90
|
+
# Offense count: 15
|
91
|
+
# Configuration parameters: AllowedConstants.
|
109
92
|
Style/Documentation:
|
110
93
|
Exclude:
|
111
|
-
- '
|
112
|
-
- 'test/**/*'
|
94
|
+
- '.simplecov'
|
113
95
|
- 'lib/fhir_models/bootstrap/definitions.rb'
|
114
96
|
- 'lib/fhir_models/bootstrap/field.rb'
|
115
97
|
- 'lib/fhir_models/bootstrap/generator.rb'
|
@@ -136,71 +118,22 @@ Style/IfUnlessModifier:
|
|
136
118
|
- 'lib/fhir_models/fhir_ext/structure_definition.rb'
|
137
119
|
- 'lib/fhir_models/fhir_ext/structure_definition_compare.rb'
|
138
120
|
|
139
|
-
# Offense count: 1
|
140
|
-
Style/MethodMissingSuper:
|
141
|
-
Exclude:
|
142
|
-
- 'lib/fhir_models/bootstrap/model.rb'
|
143
|
-
|
144
121
|
# Offense count: 1
|
145
122
|
Style/MissingRespondToMissing:
|
146
123
|
Exclude:
|
147
124
|
- 'lib/fhir_models/bootstrap/model.rb'
|
148
125
|
|
149
|
-
# Offense count: 9
|
150
|
-
Style/MultipleComparison:
|
151
|
-
Exclude:
|
152
|
-
- 'lib/fhir_models/bootstrap/definitions.rb'
|
153
|
-
- 'lib/fhir_models/bootstrap/generator.rb'
|
154
|
-
- 'lib/fhir_models/bootstrap/model.rb'
|
155
|
-
- 'lib/fhir_models/fhir_ext/structure_definition.rb'
|
156
|
-
|
157
126
|
# Offense count: 2
|
158
|
-
#
|
159
|
-
#
|
160
|
-
|
161
|
-
Style/NumericPredicate:
|
162
|
-
Exclude:
|
163
|
-
- 'spec/**/*'
|
164
|
-
- 'lib/fhir_models/fhir_ext/structure_definition_compare.rb'
|
165
|
-
|
166
|
-
# Offense count: 1
|
167
|
-
# Cop supports --auto-correct.
|
168
|
-
Style/OrAssignment:
|
127
|
+
# Configuration parameters: AllowedMethods.
|
128
|
+
# AllowedMethods: respond_to_missing?
|
129
|
+
Style/OptionalBooleanParameter:
|
169
130
|
Exclude:
|
170
131
|
- 'lib/fhir_models/bootstrap/generator.rb'
|
132
|
+
- 'lib/fhir_models/bootstrap/template.rb'
|
171
133
|
|
172
|
-
# Offense count:
|
173
|
-
# Cop supports --auto-correct.
|
174
|
-
# Configuration parameters: EnforcedStyle.
|
175
|
-
# SupportedStyles: implicit, explicit
|
176
|
-
Style/RescueStandardError:
|
177
|
-
Exclude:
|
178
|
-
- 'lib/fhir_models/bootstrap/definitions.rb'
|
179
|
-
- 'lib/fhir_models/bootstrap/hashable.rb'
|
180
|
-
- 'lib/fhir_models/bootstrap/json.rb'
|
181
|
-
- 'lib/fhir_models/bootstrap/model.rb'
|
182
|
-
- 'lib/fhir_models/bootstrap/xml.rb'
|
183
|
-
- 'lib/fhir_models/fhir.rb'
|
184
|
-
- 'lib/fhir_models/fhir_ext/structure_definition.rb'
|
185
|
-
- 'lib/fhir_models/fhir_ext/structure_definition_finding.rb'
|
186
|
-
- 'lib/fhir_models/fhirpath/expression.rb'
|
187
|
-
- 'lib/fhir_models/fhirpath/parse.rb'
|
188
|
-
|
189
|
-
# Offense count: 4
|
190
|
-
# Cop supports --auto-correct.
|
191
|
-
# Configuration parameters: ConvertCodeThatCanStartToReturnNil, AllowedMethods.
|
192
|
-
# AllowedMethods: present?, blank?, presence, try, try!
|
193
|
-
Style/SafeNavigation:
|
194
|
-
Exclude:
|
195
|
-
- 'lib/fhir_models/bootstrap/definitions.rb'
|
196
|
-
- 'lib/fhir_models/bootstrap/xml.rb'
|
197
|
-
- 'lib/fhir_models/fhir_ext/structure_definition.rb'
|
198
|
-
|
199
|
-
# Offense count: 7
|
134
|
+
# Offense count: 1
|
200
135
|
# Cop supports --auto-correct.
|
201
|
-
# Configuration parameters:
|
202
|
-
|
203
|
-
Style/YodaCondition:
|
136
|
+
# Configuration parameters: AllowModifier.
|
137
|
+
Style/SoleNestedConditional:
|
204
138
|
Exclude:
|
205
|
-
- 'lib/fhir_models/
|
206
|
-
- 'lib/fhir_models/fhirpath/parse.rb'
|
139
|
+
- 'lib/fhir_models/fhir_ext/structure_definition_compare.rb'
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
3.1.2
|
data/.simplecov
CHANGED
@@ -1,14 +1,10 @@
|
|
1
1
|
require 'simplecov'
|
2
2
|
SimpleCov.command_name 'Unit Tests'
|
3
|
-
SimpleCov.start do
|
4
|
-
add_filter "test/"
|
5
|
-
add_group "Library", "lib"
|
6
|
-
end
|
7
3
|
|
8
4
|
class SimpleCov::Formatter::QualityFormatter
|
9
5
|
def format(result)
|
10
6
|
SimpleCov::Formatter::HTMLFormatter.new.format(result)
|
11
|
-
File.open(
|
7
|
+
File.open('coverage/covered_percent', 'w') do |f|
|
12
8
|
f.puts result.source_files.covered_percent.to_f
|
13
9
|
end
|
14
10
|
end
|
data/.tool-versions
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
ruby 3.1.2
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
fhir_models (4.
|
4
|
+
fhir_models (4.3.0)
|
5
5
|
bcp47 (>= 0.3)
|
6
6
|
date_time_precision (>= 0.8)
|
7
7
|
mime-types (>= 3.0)
|
@@ -14,7 +14,7 @@ GEM
|
|
14
14
|
bcp47 (0.3.3)
|
15
15
|
i18n
|
16
16
|
coderay (1.1.3)
|
17
|
-
concurrent-ruby (1.1
|
17
|
+
concurrent-ruby (1.3.1)
|
18
18
|
coolline (0.5.0)
|
19
19
|
unicode_utils (~> 1.4)
|
20
20
|
date_time_precision (0.8.1)
|
@@ -39,22 +39,21 @@ GEM
|
|
39
39
|
guard-test (2.0.8)
|
40
40
|
guard-compat (~> 1.2)
|
41
41
|
test-unit (~> 3.0)
|
42
|
-
i18n (1.
|
42
|
+
i18n (1.14.5)
|
43
43
|
concurrent-ruby (~> 1.0)
|
44
|
-
jaro_winkler (1.5.4)
|
45
44
|
json (2.3.1)
|
46
45
|
listen (3.3.1)
|
47
46
|
rb-fsevent (~> 0.10, >= 0.10.3)
|
48
47
|
rb-inotify (~> 0.9, >= 0.9.10)
|
49
48
|
lumberjack (1.2.8)
|
50
49
|
method_source (1.0.0)
|
51
|
-
mime-types (3.
|
50
|
+
mime-types (3.5.2)
|
52
51
|
mime-types-data (~> 3.2015)
|
53
|
-
mime-types-data (3.
|
54
|
-
mini_portile2 (2.
|
52
|
+
mime-types-data (3.2024.0507)
|
53
|
+
mini_portile2 (2.8.6)
|
55
54
|
nenv (0.3.0)
|
56
|
-
nokogiri (1.
|
57
|
-
mini_portile2 (~> 2.
|
55
|
+
nokogiri (1.16.5)
|
56
|
+
mini_portile2 (~> 2.8.2)
|
58
57
|
racc (~> 1.4)
|
59
58
|
nokogiri-diff (0.2.0)
|
60
59
|
nokogiri (~> 1.5)
|
@@ -62,22 +61,25 @@ GEM
|
|
62
61
|
notiffany (0.1.3)
|
63
62
|
nenv (~> 0.1)
|
64
63
|
shellany (~> 0.0)
|
65
|
-
parallel (1.
|
66
|
-
parser (3.
|
64
|
+
parallel (1.23.0)
|
65
|
+
parser (3.2.2.4)
|
67
66
|
ast (~> 2.4.1)
|
67
|
+
racc
|
68
68
|
power_assert (1.2.0)
|
69
|
-
pry (0.
|
69
|
+
pry (0.14.2)
|
70
70
|
coderay (~> 1.1)
|
71
71
|
method_source (~> 1.0)
|
72
72
|
pry-coolline (0.2.5)
|
73
73
|
coolline (~> 0.5)
|
74
|
-
racc (1.
|
75
|
-
rainbow (3.
|
74
|
+
racc (1.8.0)
|
75
|
+
rainbow (3.1.1)
|
76
76
|
rake (13.0.1)
|
77
77
|
rb-fsevent (0.10.4)
|
78
78
|
rb-inotify (0.10.1)
|
79
79
|
ffi (~> 1.0)
|
80
|
-
|
80
|
+
regexp_parser (2.8.2)
|
81
|
+
rexml (3.2.8)
|
82
|
+
strscan (>= 3.0.9)
|
81
83
|
rspec (3.10.0)
|
82
84
|
rspec-core (~> 3.10.0)
|
83
85
|
rspec-expectations (~> 3.10.0)
|
@@ -91,26 +93,30 @@ GEM
|
|
91
93
|
diff-lcs (>= 1.2.0, < 2.0)
|
92
94
|
rspec-support (~> 3.10.0)
|
93
95
|
rspec-support (3.10.0)
|
94
|
-
rubocop (
|
95
|
-
jaro_winkler (~> 1.5.1)
|
96
|
+
rubocop (1.23.0)
|
96
97
|
parallel (~> 1.10)
|
97
|
-
parser (>=
|
98
|
+
parser (>= 3.0.0.0)
|
98
99
|
rainbow (>= 2.2.2, < 4.0)
|
100
|
+
regexp_parser (>= 1.8, < 3.0)
|
99
101
|
rexml
|
102
|
+
rubocop-ast (>= 1.12.0, < 2.0)
|
100
103
|
ruby-progressbar (~> 1.7)
|
101
|
-
unicode-display_width (>= 1.4.0, <
|
102
|
-
|
104
|
+
unicode-display_width (>= 1.4.0, < 3.0)
|
105
|
+
rubocop-ast (1.30.0)
|
106
|
+
parser (>= 3.2.1.0)
|
107
|
+
ruby-progressbar (1.13.0)
|
103
108
|
shellany (0.0.1)
|
104
109
|
simplecov (0.17.1)
|
105
110
|
docile (~> 1.1)
|
106
111
|
json (>= 1.8, < 3)
|
107
112
|
simplecov-html (~> 0.10.0)
|
108
113
|
simplecov-html (0.10.2)
|
114
|
+
strscan (3.1.0)
|
109
115
|
tdiff (0.3.4)
|
110
116
|
test-unit (3.3.6)
|
111
117
|
power_assert
|
112
118
|
thor (1.0.1)
|
113
|
-
unicode-display_width (
|
119
|
+
unicode-display_width (2.5.0)
|
114
120
|
unicode_utils (1.4.0)
|
115
121
|
|
116
122
|
PLATFORMS
|
@@ -126,12 +132,12 @@ DEPENDENCIES
|
|
126
132
|
pry-coolline
|
127
133
|
rake
|
128
134
|
rspec
|
129
|
-
rubocop (= 0
|
135
|
+
rubocop (= 1.23.0)
|
130
136
|
simplecov (~> 0.17.0)
|
131
137
|
test-unit
|
132
138
|
|
133
139
|
RUBY VERSION
|
134
|
-
ruby
|
140
|
+
ruby 3.1.2p20
|
135
141
|
|
136
142
|
BUNDLED WITH
|
137
143
|
2.2.21
|
data/Guardfile
CHANGED
@@ -15,7 +15,7 @@
|
|
15
15
|
#
|
16
16
|
# and, you'll have to watch "config/Guardfile" instead of "Guardfile"
|
17
17
|
|
18
|
-
#
|
18
|
+
# NOTE: The cmd option is now required due to the increasing number of ways
|
19
19
|
# rspec may be run, below are examples of the most common uses.
|
20
20
|
# * bundler: 'bundle exec rspec'
|
21
21
|
# * bundler binstubs: 'bin/rspec'
|
data/fhir_models.gemspec
CHANGED
@@ -21,6 +21,7 @@ Gem::Specification.new do |spec|
|
|
21
21
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
22
22
|
spec.require_paths = ['lib']
|
23
23
|
|
24
|
+
spec.required_ruby_version = '>= 3.0.0'
|
24
25
|
spec.add_dependency 'nokogiri', '>= 1.11.4'
|
25
26
|
spec.add_dependency 'date_time_precision', '>= 0.8'
|
26
27
|
spec.add_dependency 'bcp47', '>= 0.3'
|
@@ -34,7 +35,7 @@ Gem::Specification.new do |spec|
|
|
34
35
|
spec.add_development_dependency 'rspec'
|
35
36
|
spec.add_development_dependency 'simplecov', '~> 0.17.0'
|
36
37
|
spec.add_development_dependency 'nokogiri-diff'
|
37
|
-
spec.add_development_dependency 'rubocop', '0
|
38
|
+
spec.add_development_dependency 'rubocop', '1.23.0'
|
38
39
|
spec.add_development_dependency 'guard-rspec'
|
39
40
|
spec.add_development_dependency 'guard-test'
|
40
41
|
end
|
@@ -44,6 +44,7 @@ module FHIR
|
|
44
44
|
def self.type_definition(type_name)
|
45
45
|
return nil if type_name.nil?
|
46
46
|
return @@cache[type_name] if @@cache[type_name]
|
47
|
+
|
47
48
|
definition = types.find { |x| x['xmlId'] == type_name || x['name'] == type_name || x['url'] == type_name }
|
48
49
|
@@cache[type_name] = FHIR::StructureDefinition.new(definition) if definition
|
49
50
|
@@cache[type_name]
|
@@ -73,6 +74,7 @@ module FHIR
|
|
73
74
|
def self.resource_definition(resource_name)
|
74
75
|
return nil if resource_name.nil?
|
75
76
|
return @@cache[resource_name] if @@cache[resource_name]
|
77
|
+
|
76
78
|
definition = resources.find { |x| x['xmlId'] == resource_name || x['name'] == resource_name || x['url'] == resource_name }
|
77
79
|
@@cache[resource_name] = FHIR::StructureDefinition.new(definition) if definition
|
78
80
|
@@cache[resource_name]
|
@@ -103,8 +105,10 @@ module FHIR
|
|
103
105
|
|
104
106
|
def self.extension_definition(extension_name)
|
105
107
|
return nil if extension_name.nil?
|
108
|
+
|
106
109
|
extension = extensions.find { |x| x['xmlId'] == extension_name || x['name'] == extension_name || x['url'] == extension_name }
|
107
110
|
return nil if extension.nil?
|
111
|
+
|
108
112
|
FHIR::StructureDefinition.new(extension)
|
109
113
|
end
|
110
114
|
deprecate :get_extension_definition, :extension_definition
|
@@ -112,8 +116,10 @@ module FHIR
|
|
112
116
|
# Get the basetype (String) for a given profile or extension.
|
113
117
|
def self.basetype(uri)
|
114
118
|
return nil if uri.nil?
|
119
|
+
|
115
120
|
defn = profiles.detect { |x| x['url'] == uri } || extensions.detect { |x| x['url'] == uri }
|
116
121
|
return nil if defn.nil?
|
122
|
+
|
117
123
|
defn['baseType']
|
118
124
|
end
|
119
125
|
deprecate :get_basetype, :basetype
|
@@ -121,14 +127,17 @@ module FHIR
|
|
121
127
|
# Get the StructureDefinition for a given profile.
|
122
128
|
def self.profile(uri)
|
123
129
|
return nil if uri.nil?
|
130
|
+
|
124
131
|
defn = profiles.detect { |x| x['url'] == uri } || extensions.detect { |x| x['url'] == uri }
|
125
132
|
return nil if defn.nil?
|
133
|
+
|
126
134
|
FHIR::StructureDefinition.new(defn)
|
127
135
|
end
|
128
136
|
deprecate :get_profile, :profile
|
129
137
|
|
130
138
|
def self.profiles_for_resource(resource_name)
|
131
139
|
return nil if resource_name.nil?
|
140
|
+
|
132
141
|
profiles.select { |x| x['baseType'] == resource_name }.map { |x| FHIR::StructureDefinition.new(x) }
|
133
142
|
end
|
134
143
|
deprecate :get_profiles_for_resource, :profile_for_resource
|
@@ -136,6 +145,7 @@ module FHIR
|
|
136
145
|
# Get a dynamically generated class for a given profile.
|
137
146
|
def self.get_profile_class(uri)
|
138
147
|
return nil if uri.nil?
|
148
|
+
|
139
149
|
load_profiles
|
140
150
|
load_extensions
|
141
151
|
|
@@ -161,7 +171,7 @@ module FHIR
|
|
161
171
|
load f
|
162
172
|
# set the return class type
|
163
173
|
klass = Object.const_get("FHIR::Profile::#{id}::#{type}")
|
164
|
-
rescue
|
174
|
+
rescue StandardError
|
165
175
|
FHIR.logger.error "Failed to generate class for profile #{uri}"
|
166
176
|
end
|
167
177
|
# unlink the file so it can be garbage collected
|
@@ -197,6 +207,7 @@ module FHIR
|
|
197
207
|
def self.get_codes(uri)
|
198
208
|
return nil if uri.nil?
|
199
209
|
return @@cache[uri] if @@cache[uri]
|
210
|
+
|
200
211
|
valueset = expansions.find { |x| x['url'] == uri } || valuesets.find { |x| x['url'] == uri && x['resourceType'] == 'ValueSet' }
|
201
212
|
unless valueset.nil?
|
202
213
|
@@cache[uri] = {}
|
@@ -214,12 +225,12 @@ module FHIR
|
|
214
225
|
system_url = code_group['system']
|
215
226
|
@@cache[uri][system_url] ||= []
|
216
227
|
if !code_group['concept'].nil?
|
217
|
-
code_group['concept']
|
228
|
+
code_group['concept']&.each { |y| @@cache[uri][system_url] << y['code'] }
|
218
229
|
elsif code_group.size == 1
|
219
230
|
# i.e. the only key is 'system', so you import the entire thing
|
220
231
|
systems = valuesets.select { |x| x['resourceType'] == 'CodeSystem' && x['url'] == system_url }
|
221
232
|
systems.each do |included_system|
|
222
|
-
included_system['concept']
|
233
|
+
included_system['concept']&.each { |y| @@cache[uri][system_url] << y['code'] }
|
223
234
|
end
|
224
235
|
end
|
225
236
|
end
|
@@ -233,6 +244,7 @@ module FHIR
|
|
233
244
|
# If one can't be found, return nil
|
234
245
|
def self.get_display(uri, code)
|
235
246
|
return nil if uri.nil? || code.nil?
|
247
|
+
|
236
248
|
valuesets_and_expansions = expansions.select { |ex| ex['compose']['include'].detect { |i| i['system'] == uri } }
|
237
249
|
valuesets_and_expansions += valuesets.select { |vs| vs['url'] == uri }
|
238
250
|
code_hash = nil
|
@@ -272,6 +284,7 @@ module FHIR
|
|
272
284
|
|
273
285
|
def self.search_parameters(type_name)
|
274
286
|
return nil if type_name.nil?
|
287
|
+
|
275
288
|
search_params.select { |p| p['base'].include?(type_name) && p['xpath'] && !p['xpath'].include?('extension') }.map { |p| p['code'] }
|
276
289
|
end
|
277
290
|
deprecate :get_search_parameters, :search_parameters
|
@@ -24,7 +24,7 @@ module FHIR
|
|
24
24
|
def serialize
|
25
25
|
hash = {}
|
26
26
|
instance_variables.each do |v|
|
27
|
-
hash[v.to_s[1
|
27
|
+
hash[v.to_s[1..]] = instance_variable_get(v)
|
28
28
|
end
|
29
29
|
hash.delete('name')
|
30
30
|
prune(hash)
|
@@ -32,7 +32,7 @@ module FHIR
|
|
32
32
|
|
33
33
|
def fix_name(name)
|
34
34
|
fix = nil
|
35
|
-
fix = "local_#{name}" if
|
35
|
+
fix = "local_#{name}" if ['class', 'method', 'resourceType'].include?(name)
|
36
36
|
fix
|
37
37
|
end
|
38
38
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module FHIR
|
2
2
|
module Boot
|
3
3
|
class Generator
|
4
|
-
KNOWN_MISSING_EXPANSIONS =
|
4
|
+
KNOWN_MISSING_EXPANSIONS = ['bcp47', 'bcp13.txt', 'mimetypes', 'LL379-9'].freeze
|
5
5
|
|
6
6
|
attr_accessor :lib
|
7
7
|
attr_accessor :defn
|
@@ -119,6 +119,7 @@ module FHIR
|
|
119
119
|
# skip the first element
|
120
120
|
next if element['path'] == path_type
|
121
121
|
next unless element['type']
|
122
|
+
|
122
123
|
unique_types = element['type'].map { |t| t['code'] }.uniq
|
123
124
|
if unique_types.include?('Element') || unique_types.include?('BackboneElement')
|
124
125
|
child_templates << element['path']
|
@@ -128,6 +129,7 @@ module FHIR
|
|
128
129
|
child_templates.each do |child_name|
|
129
130
|
child_fixed_name = cap_first(child_name.gsub("#{type_name}.", ''))
|
130
131
|
next if child_fixed_name.include?('.')
|
132
|
+
|
131
133
|
child_def = { 'id' => child_fixed_name, 'snapshot' => { 'element' => [] } }
|
132
134
|
# Copy the element definitions for the child structure
|
133
135
|
structure_def['snapshot']['element'].each do |element|
|
@@ -189,13 +191,13 @@ module FHIR
|
|
189
191
|
field.path = element['path'].gsub(path_type, type_name)
|
190
192
|
field.type = data_type
|
191
193
|
field.type = 'Extension' if field.path.end_with?('extension')
|
192
|
-
field.type_profiles = profiles if
|
194
|
+
field.type_profiles = profiles if ['Reference', 'Extension'].include?(data_type)
|
193
195
|
field.min = element['min']
|
194
196
|
field.max = element['max']
|
195
197
|
field.max = field.max.to_i
|
196
198
|
field.max = '*' if element['max'] == '*'
|
197
199
|
|
198
|
-
if
|
200
|
+
if ['code', 'Coding', 'CodeableConcept'].include?(data_type) && element['binding']
|
199
201
|
field.binding = element['binding']
|
200
202
|
field.binding['uri'] = field.binding['valueSet']
|
201
203
|
field.binding.delete('valueSet')
|
@@ -204,15 +206,15 @@ module FHIR
|
|
204
206
|
# set the actual code list
|
205
207
|
binding_uri = field.binding['uri']
|
206
208
|
# Strip off the |4.0.0 or |4.0.1 or |2014-03-26 or similar from the ends of URLs
|
207
|
-
binding_uri&.gsub!(/\|[A-Za-z0-9
|
209
|
+
binding_uri&.gsub!(/\|[A-Za-z0-9.\-]*/, '')
|
208
210
|
codes = @defn.get_codes(binding_uri)
|
209
211
|
field.valid_codes = codes unless codes.nil?
|
210
212
|
if field.valid_codes.empty? && binding_uri && !binding_uri.end_with?(*KNOWN_MISSING_EXPANSIONS)
|
211
213
|
FHIR.logger.warn " MISSING EXPANSION -- #{field.path} #{field.min}..#{field.max}: #{binding_uri} (#{field.binding['strength']})"
|
212
214
|
@missing_expansions = true
|
213
|
-
@missing_required_expansion
|
215
|
+
@missing_required_expansion ||= (field.binding['strength'] == 'required')
|
214
216
|
end
|
215
|
-
elsif
|
217
|
+
elsif ['Element', 'BackboneElement'].include?(data_type)
|
216
218
|
# This is a nested structure or class
|
217
219
|
field.type = "#{hierarchy.join('::')}::#{cap_first(field.name)}"
|
218
220
|
end
|
@@ -223,7 +225,7 @@ module FHIR
|
|
223
225
|
field = FHIR::Field.new(field_base_name)
|
224
226
|
field.path = element['path'].gsub(path_type, type_name)
|
225
227
|
field.type = element['contentReference']
|
226
|
-
field.type = field.type[1
|
228
|
+
field.type = field.type[1..] if field.type[0] == '#'
|
227
229
|
if hierarchy.last == field.type
|
228
230
|
# reference to self
|
229
231
|
field.type = hierarchy.join('::').to_s
|