fhir_dstu2_models 1.0.3 → 1.0.4

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
  SHA1:
3
- metadata.gz: 17f75c40fac3b9924eccf4b9078838e0911a7265
4
- data.tar.gz: 9592de33a306dbb50e9d3bc7dde374641f339ddb
3
+ metadata.gz: a1140fc77a44dcf10b01c38ef6513f08641eac65
4
+ data.tar.gz: 802d339f92786c05b707528184df1a782728264d
5
5
  SHA512:
6
- metadata.gz: 4c24bb9a06e8a599b9d9890cffe14fe2d26a49f5cb5a310e45c46a5fcc79501e6b8501262633a20beaca0993e3cf7fc3e64e61b2740bc65f3f4dc4ffcbd31326
7
- data.tar.gz: 1ef197009d8a23edd3297e382f698da57403c8184e2e33ba2410ac0571d8f1a23524578e48600be5188213cd6d4f76de801857730f95d34408b43055412f6a36
6
+ metadata.gz: 472ccacf205f9270cee8859250e62dda8283ea3d2ba21096a992ab46bb9e81e3f8315b7a70432c6b7eba0764cc8d2d9d64afdcc85e36b08418152ce6038370db
7
+ data.tar.gz: ba36e569e66c5cb18b9dfeef4fef0c78fa256ea3f25710fc505a8cb2b2e9e609b1460478fcb8cec4bdb7bbf7b844c354f5562caf60f4258c2be377c6d4474259
@@ -2,20 +2,20 @@ language: ruby
2
2
  env:
3
3
  - TESTMEMORY=0 GCDELAY=2.0
4
4
  rvm:
5
- - "2.2.6"
6
- - "2.3.3"
7
- - "2.4.0"
5
+ - 2.2
6
+ - 2.3
7
+ - 2.4
8
+ - 2.5
8
9
  script:
9
10
  - bundle exec rake
10
11
  - bundle exec codeclimate-test-reporter
11
12
  notifications:
12
13
  email:
13
14
  recipients:
14
- - healthcare-ci@googlegroups.com
15
+ - fhir-testing-list@lists.mitre.org
15
16
  on_failure: change
16
17
  addons:
17
18
  code_climate:
18
19
  repo_token: 0230b3379581b30743b7b4355d7394e427648e604d19a2aba987956201eee290
19
20
  before_install:
20
- - gem update --system
21
- - gem update bundler
21
+ - gem install bundler
@@ -1,30 +1,31 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- fhir_dstu2_models (1.0.3)
4
+ fhir_dstu2_models (1.0.4)
5
5
  bcp47 (>= 0.3)
6
6
  date_time_precision (>= 0.8)
7
7
  mime-types (>= 1.16, < 3)
8
- nokogiri (>= 1.7)
8
+ nokogiri (>= 1.8.2)
9
9
 
10
10
  GEM
11
11
  remote: https://rubygems.org/
12
12
  specs:
13
- ast (2.3.0)
13
+ ast (2.4.0)
14
14
  bcp47 (0.3.3)
15
15
  i18n
16
16
  codeclimate-test-reporter (1.0.8)
17
17
  simplecov (<= 0.13)
18
- coderay (1.1.1)
18
+ coderay (1.1.2)
19
+ concurrent-ruby (1.0.5)
19
20
  date_time_precision (0.8.1)
20
21
  diff-lcs (1.3)
21
22
  docile (1.1.5)
22
- ffi (1.9.18)
23
+ ffi (1.9.23)
23
24
  formatador (0.2.5)
24
- guard (2.14.1)
25
+ guard (2.14.2)
25
26
  formatador (>= 0.2.4)
26
27
  listen (>= 2.7, < 4.0)
27
- lumberjack (~> 1.0)
28
+ lumberjack (>= 1.0.12, < 2.0)
28
29
  nenv (~> 0.1)
29
30
  notiffany (~> 0.0)
30
31
  pry (>= 0.9.12)
@@ -38,53 +39,53 @@ GEM
38
39
  guard-test (2.0.8)
39
40
  guard-compat (~> 1.2)
40
41
  test-unit (~> 3.0)
41
- i18n (0.8.6)
42
+ i18n (1.0.1)
43
+ concurrent-ruby (~> 1.0)
42
44
  json (2.1.0)
43
45
  listen (3.1.5)
44
46
  rb-fsevent (~> 0.9, >= 0.9.4)
45
47
  rb-inotify (~> 0.9, >= 0.9.7)
46
48
  ruby_dep (~> 1.2)
47
- lumberjack (1.0.12)
48
- method_source (0.8.2)
49
+ lumberjack (1.0.13)
50
+ method_source (0.9.0)
49
51
  mime-types (2.99.3)
50
- mini_portile2 (2.1.0)
52
+ mini_portile2 (2.3.0)
51
53
  nenv (0.3.0)
52
- nokogiri (1.7.2)
53
- mini_portile2 (~> 2.1.0)
54
+ nokogiri (1.8.2)
55
+ mini_portile2 (~> 2.3.0)
54
56
  nokogiri-diff (0.2.0)
55
57
  nokogiri (~> 1.5)
56
58
  tdiff (~> 0.3, >= 0.3.2)
57
59
  notiffany (0.1.1)
58
60
  nenv (~> 0.1)
59
61
  shellany (~> 0.0)
60
- parallel (1.11.2)
61
- parser (2.4.0.0)
62
- ast (~> 2.2)
63
- power_assert (1.0.2)
62
+ parallel (1.12.1)
63
+ parser (2.5.1.0)
64
+ ast (~> 2.4.0)
65
+ power_assert (1.1.1)
64
66
  powerpack (0.1.1)
65
- pry (0.10.4)
67
+ pry (0.11.3)
66
68
  coderay (~> 1.1.0)
67
- method_source (~> 0.8.1)
68
- slop (~> 3.4)
69
+ method_source (~> 0.9.0)
69
70
  rainbow (2.2.2)
70
71
  rake
71
- rake (12.0.0)
72
- rb-fsevent (0.9.8)
73
- rb-inotify (0.9.8)
74
- ffi (>= 0.5.0)
75
- rspec (3.6.0)
76
- rspec-core (~> 3.6.0)
77
- rspec-expectations (~> 3.6.0)
78
- rspec-mocks (~> 3.6.0)
79
- rspec-core (3.6.0)
80
- rspec-support (~> 3.6.0)
81
- rspec-expectations (3.6.0)
72
+ rake (12.3.1)
73
+ rb-fsevent (0.10.3)
74
+ rb-inotify (0.9.10)
75
+ ffi (>= 0.5.0, < 2)
76
+ rspec (3.7.0)
77
+ rspec-core (~> 3.7.0)
78
+ rspec-expectations (~> 3.7.0)
79
+ rspec-mocks (~> 3.7.0)
80
+ rspec-core (3.7.1)
81
+ rspec-support (~> 3.7.0)
82
+ rspec-expectations (3.7.0)
82
83
  diff-lcs (>= 1.2.0, < 2.0)
83
- rspec-support (~> 3.6.0)
84
- rspec-mocks (3.6.0)
84
+ rspec-support (~> 3.7.0)
85
+ rspec-mocks (3.7.0)
85
86
  diff-lcs (>= 1.2.0, < 2.0)
86
- rspec-support (~> 3.6.0)
87
- rspec-support (3.6.0)
87
+ rspec-support (~> 3.7.0)
88
+ rspec-support (3.7.1)
88
89
  rubocop (0.49.0)
89
90
  parallel (~> 1.10)
90
91
  parser (>= 2.3.3.1, < 3.0)
@@ -92,20 +93,19 @@ GEM
92
93
  rainbow (>= 1.99.1, < 3.0)
93
94
  ruby-progressbar (~> 1.7)
94
95
  unicode-display_width (~> 1.0, >= 1.0.1)
95
- ruby-progressbar (1.8.1)
96
+ ruby-progressbar (1.9.0)
96
97
  ruby_dep (1.5.0)
97
98
  shellany (0.0.1)
98
99
  simplecov (0.13.0)
99
100
  docile (~> 1.1.0)
100
101
  json (>= 1.8, < 3)
101
102
  simplecov-html (~> 0.10.0)
102
- simplecov-html (0.10.1)
103
- slop (3.6.0)
103
+ simplecov-html (0.10.2)
104
104
  tdiff (0.3.3)
105
- test-unit (3.2.4)
105
+ test-unit (3.2.7)
106
106
  power_assert
107
- thor (0.19.4)
108
- unicode-display_width (1.2.1)
107
+ thor (0.20.0)
108
+ unicode-display_width (1.3.2)
109
109
 
110
110
  PLATFORMS
111
111
  ruby
@@ -120,12 +120,12 @@ DEPENDENCIES
120
120
  pry
121
121
  rake
122
122
  rspec
123
- rubocop
123
+ rubocop (= 0.49)
124
124
  simplecov
125
125
  test-unit
126
126
 
127
127
  RUBY VERSION
128
- ruby 2.4.1p111
128
+ ruby 2.2.7p470
129
129
 
130
130
  BUNDLED WITH
131
- 1.15.1
131
+ 1.16.1
data/README.md CHANGED
@@ -28,21 +28,48 @@ json = File.read('patient-example.json')
28
28
  patient = FHIR::DSTU2.from_contents(json)
29
29
  puts patient.to_json
30
30
  ```
31
+
32
+ Creating an `Observation` by hand...
33
+ ```ruby
34
+ obs = FHIR::DSTU2::Observation.new(
35
+ 'status' => 'final',
36
+ 'code' => {
37
+ 'coding' => [{ 'system' => 'http://loinc.org', 'code' => '3141-9', 'display' => 'Weight Measured' }],
38
+ 'text' => 'Weight Measured'
39
+ },
40
+ 'category' => {
41
+ 'coding' => [{ 'system' => 'http://hl7.org/fhir/observation-category', 'code' => 'vital-signs' }]
42
+ },
43
+ 'subject' => { 'reference' => 'Patient/example' },
44
+ 'encounter' => { 'reference' => 'Encounter/example' }
45
+ )
46
+ obs.valueQuantity = FHIR::DSTU2::Quantity.new(
47
+ 'value' => 185,
48
+ 'unit' => 'lbs',
49
+ 'code' => '[lb_av]',
50
+ 'system' => 'http://unitsofmeasure.org'
51
+ )
52
+ ```
53
+
31
54
  ### Validation
32
55
 
33
- Using a base resource definition...
56
+ Using built in validation...
34
57
  ```ruby
35
- sd = FHIR::DSTU2::Definitions.resource_definition('Patient')
36
- sd.validates_resource?(patient) # passing in FHIR::DSTU2::Patient
58
+ patient.valid? # returns true or false
59
+ patient.validate # returns Hash of errors, empty if valid
37
60
  ```
38
- Validation failed? Get the errors and warnings...
61
+
62
+ Using a profile or structure definition...
39
63
  ```ruby
64
+ sd = FHIR::DSTU2::Definitions.resource_definition('Patient')
65
+ sd.validates_resource?(patient) # passing in FHIR::DSTU2::Patient
66
+ # Validation failed? Get the errors and warnings...
40
67
  puts sd.errors
41
68
  puts sd.warnings
42
69
  ```
43
70
  # License
44
71
 
45
- Copyright 2014-2017 The MITRE Corporation
72
+ Copyright 2014-2018 The MITRE Corporation
46
73
 
47
74
  Licensed under the Apache License, Version 2.0 (the "License");
48
75
  you may not use this file except in compliance with the License.
@@ -6,7 +6,7 @@ require 'fhir_dstu2_models/version'
6
6
  Gem::Specification.new do |spec|
7
7
  spec.name = 'fhir_dstu2_models'
8
8
  spec.version = FHIR::DSTU2::Models::VERSION
9
- spec.authors = ['Jason Walonoski', 'Andre Quina', "Michael O'Keefe"]
9
+ spec.authors = ['Jason Walonoski', 'Andre Quina', "Michael O'Keefe", 'Robert Scanlon']
10
10
  spec.email = ['jwalonoski@mitre.org']
11
11
 
12
12
  spec.summary = %q{A Gem for handling FHIR DSTU2 models in ruby}
@@ -20,7 +20,7 @@ Gem::Specification.new do |spec|
20
20
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
21
21
  spec.require_paths = ['lib']
22
22
 
23
- spec.add_dependency 'nokogiri', '>= 1.7'
23
+ spec.add_dependency 'nokogiri', '>= 1.8.2'
24
24
  spec.add_dependency 'date_time_precision', '>= 0.8'
25
25
  spec.add_dependency 'bcp47', '>= 0.3'
26
26
  spec.add_dependency 'mime-types', '>= 1.16', '< 3'
@@ -32,7 +32,7 @@ Gem::Specification.new do |spec|
32
32
  spec.add_development_dependency 'rspec'
33
33
  spec.add_development_dependency 'simplecov'
34
34
  spec.add_development_dependency 'nokogiri-diff'
35
- spec.add_development_dependency 'rubocop'
35
+ spec.add_development_dependency 'rubocop', '0.49'
36
36
  spec.add_development_dependency 'codeclimate-test-reporter'
37
37
  spec.add_development_dependency 'guard-rspec'
38
38
  spec.add_development_dependency 'guard-test'
@@ -17,28 +17,14 @@ module FHIR
17
17
  end
18
18
  end
19
19
  end
20
- hash = prune(hash)
21
- hash['resourceType'] = resourceType if respond_to?(:resourceType) && hash
22
- hash
23
- end
24
-
25
- def prune(thing)
26
- if thing.is_a?(Array)
27
- return nil if thing.empty?
28
- thing.map! { |i| prune(i) }
29
- thing.compact!
30
- return nil if thing.empty?
31
- elsif thing.is_a?(Hash)
32
- return nil if thing.empty?
33
- thing.each do |key, value|
34
- thing[key] = prune(value)
35
- end
36
- thing.delete_if do |_key, value|
37
- value.nil?
38
- end
39
- return nil if thing.empty?
20
+ hash.keep_if do |_key, value|
21
+ !value.nil? && ((value.is_a?(Hash) && !value.empty?) ||
22
+ (value.is_a?(Array) && !value.empty?) ||
23
+ (!value.is_a?(Hash) && !value.is_a?(Array))
24
+ )
40
25
  end
41
- thing
26
+ hash['resourceType'] = resourceType if respond_to?(:resourceType)
27
+ hash
42
28
  end
43
29
 
44
30
  def from_hash(hash)
@@ -131,7 +117,7 @@ module FHIR
131
117
  rval
132
118
  end
133
119
 
134
- private :prune, :make_child, :convert_primitive
120
+ private :make_child, :convert_primitive
135
121
  end
136
122
  end
137
123
  end
@@ -1,7 +1,7 @@
1
1
  module FHIR
2
2
  module DSTU2
3
3
  module Models
4
- VERSION = '1.0.3'.freeze
4
+ VERSION = '1.0.4'.freeze
5
5
  end
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,16 +1,17 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fhir_dstu2_models
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.3
4
+ version: 1.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jason Walonoski
8
8
  - Andre Quina
9
9
  - Michael O'Keefe
10
+ - Robert Scanlon
10
11
  autorequire:
11
12
  bindir: exe
12
13
  cert_chain: []
13
- date: 2017-08-10 00:00:00.000000000 Z
14
+ date: 2018-05-01 00:00:00.000000000 Z
14
15
  dependencies:
15
16
  - !ruby/object:Gem::Dependency
16
17
  name: nokogiri
@@ -18,14 +19,14 @@ dependencies:
18
19
  requirements:
19
20
  - - ">="
20
21
  - !ruby/object:Gem::Version
21
- version: '1.7'
22
+ version: 1.8.2
22
23
  type: :runtime
23
24
  prerelease: false
24
25
  version_requirements: !ruby/object:Gem::Requirement
25
26
  requirements:
26
27
  - - ">="
27
28
  - !ruby/object:Gem::Version
28
- version: '1.7'
29
+ version: 1.8.2
29
30
  - !ruby/object:Gem::Dependency
30
31
  name: date_time_precision
31
32
  requirement: !ruby/object:Gem::Requirement
@@ -176,16 +177,16 @@ dependencies:
176
177
  name: rubocop
177
178
  requirement: !ruby/object:Gem::Requirement
178
179
  requirements:
179
- - - ">="
180
+ - - '='
180
181
  - !ruby/object:Gem::Version
181
- version: '0'
182
+ version: '0.49'
182
183
  type: :development
183
184
  prerelease: false
184
185
  version_requirements: !ruby/object:Gem::Requirement
185
186
  requirements:
186
- - - ">="
187
+ - - '='
187
188
  - !ruby/object:Gem::Version
188
- version: '0'
189
+ version: '0.49'
189
190
  - !ruby/object:Gem::Dependency
190
191
  name: codeclimate-test-reporter
191
192
  requirement: !ruby/object:Gem::Requirement