fhir_stu3_models 3.0.2 → 3.1.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 +26 -0
- data/Gemfile.lock +7 -7
- data/README.md +10 -0
- data/fhir_stu3_models.gemspec +1 -1
- data/lib/fhir_stu3_models/bootstrap/model.rb +21 -0
- data/lib/fhir_stu3_models/version.rb +1 -1
- metadata +6 -6
- data/.travis.yml +0 -25
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6d4ac5285d7cdc6dcbffc30bdea77c7a1e3625ca2d5a6e9ad10b432fad48d4c8
|
4
|
+
data.tar.gz: ce2a61987cf806f2ced3d51cf8be0b6b4c4af75e12f7bd94619caa762949f95a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e9cfe7352d72f3ee8c8a3e1dfda2dbcd34e4d04bfeb6321f44ab031261dc644b0df545b2dbe6a824cab3a2700bbd47046c133d93b8e2f6d22ae92f138d61e991
|
7
|
+
data.tar.gz: 98c446cdd9109bfc7667649e4ec356ae60d5ea1068d7810d753b044c43a5181947f74e9334b6fecfd61fe44041b9202a87cd6aa5a846e9f3894013fc238d2804
|
@@ -0,0 +1,26 @@
|
|
1
|
+
name: Ruby
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
branches: [ master ]
|
6
|
+
pull_request:
|
7
|
+
branches: [ master ]
|
8
|
+
|
9
|
+
jobs:
|
10
|
+
test:
|
11
|
+
runs-on: ubuntu-latest
|
12
|
+
strategy:
|
13
|
+
matrix:
|
14
|
+
ruby-version: ['2.6', '2.7']
|
15
|
+
|
16
|
+
steps:
|
17
|
+
- uses: actions/checkout@v2
|
18
|
+
- name: Set up Ruby
|
19
|
+
uses: ruby/setup-ruby@v1
|
20
|
+
with:
|
21
|
+
ruby-version: ${{ matrix.ruby-version }}
|
22
|
+
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
|
23
|
+
- name: Run tests
|
24
|
+
run: bundle exec rake
|
25
|
+
- name: Rubocop
|
26
|
+
run: bundle exec rubocop
|
data/Gemfile.lock
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
fhir_stu3_models (3.0
|
4
|
+
fhir_stu3_models (3.1.0)
|
5
5
|
bcp47 (>= 0.3)
|
6
6
|
date_time_precision (>= 0.8)
|
7
7
|
mime-types (>= 3.0)
|
8
|
-
nokogiri (>= 1.
|
8
|
+
nokogiri (>= 1.11.4)
|
9
9
|
|
10
10
|
GEM
|
11
11
|
remote: https://rubygems.org/
|
@@ -14,7 +14,7 @@ GEM
|
|
14
14
|
bcp47 (0.3.3)
|
15
15
|
i18n
|
16
16
|
coderay (1.1.2)
|
17
|
-
concurrent-ruby (1.1.
|
17
|
+
concurrent-ruby (1.1.9)
|
18
18
|
date_time_precision (0.8.1)
|
19
19
|
diff-lcs (1.3)
|
20
20
|
docile (1.1.5)
|
@@ -37,7 +37,7 @@ GEM
|
|
37
37
|
guard-test (2.0.8)
|
38
38
|
guard-compat (~> 1.2)
|
39
39
|
test-unit (~> 3.0)
|
40
|
-
i18n (1.8.
|
40
|
+
i18n (1.8.10)
|
41
41
|
concurrent-ruby (~> 1.0)
|
42
42
|
jaro_winkler (1.5.4)
|
43
43
|
json (2.5.1)
|
@@ -50,9 +50,9 @@ GEM
|
|
50
50
|
mime-types (3.3.1)
|
51
51
|
mime-types-data (~> 3.2015)
|
52
52
|
mime-types-data (3.2021.0225)
|
53
|
-
mini_portile2 (2.5.
|
53
|
+
mini_portile2 (2.5.3)
|
54
54
|
nenv (0.3.0)
|
55
|
-
nokogiri (1.11.
|
55
|
+
nokogiri (1.11.7)
|
56
56
|
mini_portile2 (~> 2.5.0)
|
57
57
|
racc (~> 1.4)
|
58
58
|
nokogiri-diff (0.2.0)
|
@@ -74,7 +74,7 @@ GEM
|
|
74
74
|
rb-fsevent (0.10.3)
|
75
75
|
rb-inotify (0.10.0)
|
76
76
|
ffi (~> 1.0)
|
77
|
-
rexml (3.2.
|
77
|
+
rexml (3.2.5)
|
78
78
|
rspec (3.8.0)
|
79
79
|
rspec-core (~> 3.8.0)
|
80
80
|
rspec-expectations (~> 3.8.0)
|
data/README.md
CHANGED
@@ -54,6 +54,16 @@ $ bundle exec rake fhir:console
|
|
54
54
|
'system' => 'http://unitsofmeasure.org'
|
55
55
|
)
|
56
56
|
```
|
57
|
+
|
58
|
+
Iterating over all elements in a resource, including nested elements...
|
59
|
+
```ruby
|
60
|
+
patient.each_element do |value, metadata, path|
|
61
|
+
puts "Info for #{path}:"
|
62
|
+
puts "- value: #{value}"
|
63
|
+
puts "- type: #{metadata['type']}"
|
64
|
+
puts "- cardinality: #{metadata['min']}..#{metadata['max']}"
|
65
|
+
end
|
66
|
+
```
|
57
67
|
|
58
68
|
### Validation
|
59
69
|
|
data/fhir_stu3_models.gemspec
CHANGED
@@ -21,7 +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.add_dependency 'nokogiri', '>= 1.
|
24
|
+
spec.add_dependency 'nokogiri', '>= 1.11.4'
|
25
25
|
spec.add_dependency 'date_time_precision', '>= 0.8'
|
26
26
|
spec.add_dependency 'bcp47', '>= 0.3'
|
27
27
|
spec.add_dependency 'mime-types', '>= 3.0'
|
@@ -294,6 +294,27 @@ module FHIR
|
|
294
294
|
valid
|
295
295
|
end
|
296
296
|
|
297
|
+
def each_element(path = nil, &block)
|
298
|
+
self.class::METADATA.each do |element_name, metadata|
|
299
|
+
local_name = metadata.fetch :local_name, element_name
|
300
|
+
values = [instance_variable_get("@#{local_name}")].flatten.compact
|
301
|
+
next if values.empty?
|
302
|
+
|
303
|
+
values.each_with_index do |value, i|
|
304
|
+
child_path =
|
305
|
+
if path.nil?
|
306
|
+
element_name
|
307
|
+
else
|
308
|
+
"#{path}.#{element_name}"
|
309
|
+
end
|
310
|
+
child_path += "[#{i}]" if metadata['max'] > 1
|
311
|
+
yield value, metadata, child_path
|
312
|
+
value.each_element child_path, &block unless FHIR::STU3::PRIMITIVES.include? metadata['type']
|
313
|
+
end
|
314
|
+
end
|
315
|
+
self
|
316
|
+
end
|
317
|
+
|
297
318
|
private :validate_reference_type, :check_binding_uri, :validate_field
|
298
319
|
end
|
299
320
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fhir_stu3_models
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0
|
4
|
+
version: 3.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jason Walonoski
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: exe
|
12
12
|
cert_chain: []
|
13
|
-
date: 2021-
|
13
|
+
date: 2021-06-24 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: nokogiri
|
@@ -18,14 +18,14 @@ dependencies:
|
|
18
18
|
requirements:
|
19
19
|
- - ">="
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version: 1.
|
21
|
+
version: 1.11.4
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
24
|
version_requirements: !ruby/object:Gem::Requirement
|
25
25
|
requirements:
|
26
26
|
- - ">="
|
27
27
|
- !ruby/object:Gem::Version
|
28
|
-
version: 1.
|
28
|
+
version: 1.11.4
|
29
29
|
- !ruby/object:Gem::Dependency
|
30
30
|
name: date_time_precision
|
31
31
|
requirement: !ruby/object:Gem::Requirement
|
@@ -216,12 +216,12 @@ extensions: []
|
|
216
216
|
extra_rdoc_files: []
|
217
217
|
files:
|
218
218
|
- ".codeclimate.yml"
|
219
|
+
- ".github/workflows/ruby.yml"
|
219
220
|
- ".gitignore"
|
220
221
|
- ".rspec"
|
221
222
|
- ".rubocop.yml"
|
222
223
|
- ".rubocop_todo.yml"
|
223
224
|
- ".simplecov"
|
224
|
-
- ".travis.yml"
|
225
225
|
- Gemfile
|
226
226
|
- Gemfile.lock
|
227
227
|
- Guardfile
|
@@ -1615,7 +1615,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
1615
1615
|
- !ruby/object:Gem::Version
|
1616
1616
|
version: '0'
|
1617
1617
|
requirements: []
|
1618
|
-
rubygems_version: 3.
|
1618
|
+
rubygems_version: 3.0.3
|
1619
1619
|
signing_key:
|
1620
1620
|
specification_version: 4
|
1621
1621
|
summary: A Gem for handling FHIR STU3 models in ruby
|
data/.travis.yml
DELETED
@@ -1,25 +0,0 @@
|
|
1
|
-
language: ruby
|
2
|
-
env:
|
3
|
-
- TESTMEMORY=0 GCDELAY=2.0
|
4
|
-
rvm:
|
5
|
-
- 2.6
|
6
|
-
- 2.7
|
7
|
-
before_script:
|
8
|
-
- curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
|
9
|
-
- chmod +x ./cc-test-reporter
|
10
|
-
- ./cc-test-reporter before-build
|
11
|
-
script:
|
12
|
-
- bundle exec rake
|
13
|
-
after_script:
|
14
|
-
- ./cc-test-reporter after-build -t simplecov --exit-code $TRAVIS_TEST_RESULT
|
15
|
-
notifications:
|
16
|
-
email:
|
17
|
-
recipients:
|
18
|
-
- fhir-testing-list@lists.mitre.org
|
19
|
-
on_failure: change
|
20
|
-
addons:
|
21
|
-
code_climate:
|
22
|
-
repo_token: 0230b3379581b30743b7b4355d7394e427648e604d19a2aba987956201eee290
|
23
|
-
before_install:
|
24
|
-
- gem update --system
|
25
|
-
- gem update bundler
|