fhir_dstu2_models 1.0.11 → 1.1.0

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: dbc067c3c0131d09389762011313c28ce54cfb0cff5fd7f5620141bb398cc836
4
- data.tar.gz: 2ede16263fc0b8bd831b73e3dabf9d53c0e9d1f263b06a7fab5054a77d5279e0
3
+ metadata.gz: 54f49487a37795261c72615095996fa66403bfad69901301bf94e108848c785c
4
+ data.tar.gz: 38b9da91f0e4ba38c801b7004ac3434bd89467e60a73cceceb66a0334c21268c
5
5
  SHA512:
6
- metadata.gz: 427ed8a3a9f179ce1f155ce999e61c47e1a79d84b1148d90002a9cd74df70bdabc33409285e0f80179f21b7044e78ae65b816b81f80c26e1c3b842e2960d4747
7
- data.tar.gz: 6b3883925afc71acf2b61806c16c26330882c1c11238602e3550b30dd2e8c690f214aae81b756c038f4a5000033b19fbf4df2323ec9f45f281aeb7c5bce12184
6
+ metadata.gz: ad5546d62aaf98a88a3682a66ffc0b05cbecf73c3f862ea1b0621f9ebd2bdb0b69f695c8081082d72830c30eaff9757160496b73a62b0b2bfd47b52eb45b37bb
7
+ data.tar.gz: dd97e4d646c1153df883574be1cef7c38c3659c8873eb82fd153e6eae8e7ddee26f0c25ad3bacbbfc51a7d25018dfce3b5a418f5740a314d2345a04f8580c6b6
@@ -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_dstu2_models (1.0.11)
4
+ fhir_dstu2_models (1.1.0)
5
5
  bcp47 (>= 0.3)
6
6
  date_time_precision (>= 0.8)
7
7
  mime-types (>= 3.0)
8
- nokogiri (>= 1.10.4)
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.8)
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.9)
40
+ i18n (1.8.10)
41
41
  concurrent-ruby (~> 1.0)
42
42
  jaro_winkler (1.5.4)
43
43
  json (2.3.1)
@@ -49,10 +49,10 @@ GEM
49
49
  method_source (0.9.2)
50
50
  mime-types (3.3.1)
51
51
  mime-types-data (~> 3.2015)
52
- mime-types-data (3.2019.0331)
53
- mini_portile2 (2.5.0)
52
+ mime-types-data (3.2021.0225)
53
+ mini_portile2 (2.5.3)
54
54
  nenv (0.3.0)
55
- nokogiri (1.11.2)
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.4)
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)
@@ -130,4 +130,4 @@ RUBY VERSION
130
130
  ruby 2.7.2p137
131
131
 
132
132
  BUNDLED WITH
133
- 2.1.4
133
+ 2.2.17
data/README.md CHANGED
@@ -51,6 +51,16 @@ obs.valueQuantity = FHIR::DSTU2::Quantity.new(
51
51
  )
52
52
  ```
53
53
 
54
+ Iterating over all elements in a resource, including nested elements...
55
+ ```ruby
56
+ patient.each_element do |value, metadata, path|
57
+ puts "Info for #{path}:"
58
+ puts "- value: #{value}"
59
+ puts "- type: #{metadata['type']}"
60
+ puts "- cardinality: #{metadata['min']}..#{metadata['max']}"
61
+ end
62
+ ```
63
+
54
64
  ### Validation
55
65
 
56
66
  Using built in validation...
@@ -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.10.4'
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'
@@ -302,6 +302,27 @@ module FHIR
302
302
  valid
303
303
  end
304
304
 
305
+ def each_element(path = nil, &block)
306
+ self.class::METADATA.each do |element_name, metadata|
307
+ local_name = metadata.fetch :local_name, element_name
308
+ values = [instance_variable_get("@#{local_name}")].flatten.compact
309
+ next if values.empty?
310
+
311
+ values.each_with_index do |value, i|
312
+ child_path =
313
+ if path.nil?
314
+ element_name
315
+ else
316
+ "#{path}.#{element_name}"
317
+ end
318
+ child_path += "[#{i}]" if metadata['max'] > 1
319
+ yield value, metadata, child_path
320
+ value.each_element child_path, &block unless FHIR::DSTU2::PRIMITIVES.include? metadata['type']
321
+ end
322
+ end
323
+ self
324
+ end
325
+
305
326
  private :validate_reference_type, :check_binding_uri, :validate_field
306
327
  end
307
328
  end
@@ -1,7 +1,7 @@
1
1
  module FHIR
2
2
  module DSTU2
3
3
  module Models
4
- VERSION = '1.0.11'.freeze
4
+ VERSION = '1.1.0'.freeze
5
5
  end
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fhir_dstu2_models
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.11
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jason Walonoski
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: exe
13
13
  cert_chain: []
14
- date: 2021-03-31 00:00:00.000000000 Z
14
+ date: 2021-06-24 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: nokogiri
@@ -19,14 +19,14 @@ dependencies:
19
19
  requirements:
20
20
  - - ">="
21
21
  - !ruby/object:Gem::Version
22
- version: 1.10.4
22
+ version: 1.11.4
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
26
26
  requirements:
27
27
  - - ">="
28
28
  - !ruby/object:Gem::Version
29
- version: 1.10.4
29
+ version: 1.11.4
30
30
  - !ruby/object:Gem::Dependency
31
31
  name: date_time_precision
32
32
  requirement: !ruby/object:Gem::Requirement
@@ -217,12 +217,12 @@ extensions: []
217
217
  extra_rdoc_files: []
218
218
  files:
219
219
  - ".codeclimate.yml"
220
+ - ".github/workflows/ruby.yml"
220
221
  - ".gitignore"
221
222
  - ".rspec"
222
223
  - ".rubocop.yml"
223
224
  - ".rubocop_todo.yml"
224
225
  - ".simplecov"
225
- - ".travis.yml"
226
226
  - Gemfile
227
227
  - Gemfile.lock
228
228
  - Guardfile
@@ -2124,7 +2124,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
2124
2124
  - !ruby/object:Gem::Version
2125
2125
  version: '0'
2126
2126
  requirements: []
2127
- rubygems_version: 3.1.4
2127
+ rubygems_version: 3.0.3
2128
2128
  signing_key:
2129
2129
  specification_version: 4
2130
2130
  summary: A Gem for handling FHIR DSTU2 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 install bundler