ncs_mdes 0.10.0 → 0.11.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -4,14 +4,13 @@ module NcsNavigator::Mdes
4
4
  ##
5
5
  # One dispostion code in the MDES.
6
6
  class DispositionCode
7
+ ATTRIBUTES = %w(
8
+ category_code disposition event final_category final_code interim_code sub_category
9
+ )
7
10
 
8
- attr_accessor :event
9
- attr_accessor :final_category
10
- attr_accessor :sub_category
11
- attr_accessor :disposition
12
- attr_accessor :category_code
13
- attr_accessor :interim_code
14
- attr_accessor :final_code
11
+ ATTRIBUTES.each do |attr|
12
+ attr_accessor attr
13
+ end
15
14
 
16
15
  ##
17
16
  # Given attributes (presumably loaded from a YAML file) create
@@ -19,9 +18,7 @@ module NcsNavigator::Mdes
19
18
  #
20
19
  # @return [DispositionCode] the created instance.
21
20
  def initialize(attrs)
22
- %w(event final_category sub_category disposition category_code interim_code final_code).each do |a|
23
- self.send("#{a}=", attrs[a])
24
- end
21
+ ATTRIBUTES.each { |a| send("#{a}=", attrs[a]) }
25
22
  end
26
23
 
27
24
  ##
@@ -58,7 +58,9 @@ module NcsNavigator::Mdes
58
58
  when '3.0'
59
59
  create('3.0', '3.0/NCS_Transmission_Schema_3.0.00.09.xsd', '3.0.00.09')
60
60
  when '3.1'
61
- create('3.1', '3.1/NCS_Transmission_Schema_3.1.00.00.xsd', '3.1.00.00')
61
+ create('3.1', '3.1/NCS_Transmission_Schema_3.1.01.00.xsd', '3.1.01.00')
62
+ when '3.2'
63
+ create('3.2', '3.2/NCS_Transmission_Schema_3.2.00.00.xsd', '3.2.00.00')
62
64
  else
63
65
  raise "MDES #{version} is not supported by this version of ncs_mdes"
64
66
  end
@@ -75,20 +75,20 @@ module NcsNavigator::Mdes
75
75
  var.nillable = element['nillable'] == 'true'
76
76
  var.omittable = element['minOccurs'] == '0'
77
77
  var.pii =
78
- case element['pii']
78
+ case element['ncsdoc:pii']
79
79
  when 'Y'; true;
80
80
  when 'P'; :possible;
81
81
  when nil; :unknown;
82
82
  when ''; false;
83
- else element['pii'];
83
+ else element['ncsdoc:pii'];
84
84
  end
85
85
  var.status =
86
- case element['status']
86
+ case element['ncsdoc:status']
87
87
  when '1'; :active;
88
88
  when '2'; :new;
89
89
  when '3'; :modified;
90
90
  when '4'; :retired;
91
- else element['status'];
91
+ else element['ncsdoc:status'];
92
92
  end
93
93
  var.type =
94
94
  if element['type']
@@ -75,10 +75,10 @@ module NcsNavigator::Mdes
75
75
  vt.min_length = elt['value'].to_i
76
76
  when 'enumeration'
77
77
  (vt.code_list ||= CodeList.new) << CodeListEntry.from_xsd_enumeration(elt, options)
78
- if elt['desc'] =~ /\S/
78
+ if elt['ncsdoc:desc'] =~ /\S/
79
79
  if vt.code_list.description.nil?
80
- vt.code_list.description = elt['desc']
81
- elsif vt.code_list.description != elt['desc']
80
+ vt.code_list.description = elt['ncsdoc:desc']
81
+ elsif vt.code_list.description != elt['ncsdoc:desc']
82
82
  log.warn("Code list entry on line #{elt.line} unexpectedly has a different desc from the first entry")
83
83
  end
84
84
  end
@@ -179,9 +179,9 @@ module NcsNavigator::Mdes
179
179
  log.warn("Missing value for code list entry on line #{enum.line}") unless enum['value']
180
180
 
181
181
  new(enum['value'] && enum['value'].strip).tap do |cle|
182
- cle.label = enum['label']
183
- cle.global_value = enum['global_value']
184
- cle.master_cl = enum['master_cl']
182
+ cle.label = enum['ncsdoc:label']
183
+ cle.global_value = enum['ncsdoc:global_value']
184
+ cle.master_cl = enum['ncsdoc:master_cl']
185
185
  end
186
186
  end
187
187
  end
@@ -1,5 +1,5 @@
1
1
  module NcsNavigator
2
2
  module Mdes
3
- VERSION = '0.10.0'
3
+ VERSION = '0.11.0'
4
4
  end
5
5
  end
data/ncs_mdes.gemspec CHANGED
@@ -19,7 +19,7 @@ National Children's Study's Master Data Element Specification.
19
19
  s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
20
20
  s.require_paths = ["lib"]
21
21
 
22
- s.add_dependency 'nokogiri', '~> 1.4'
22
+ s.add_dependency 'nokogiri', '~> 1.5.6'
23
23
 
24
24
  s.add_development_dependency 'rspec', '~> 2.6.0' # Can't use 2.7.0 due to #477
25
25
  s.add_development_dependency 'rake', '~> 0.9.2'
@@ -164,11 +164,25 @@ module NcsNavigator::Mdes
164
164
  include_context 'version docs'
165
165
 
166
166
  it 'has the correct path for the schema' do
167
- subject.schema.should =~ %r{3.1/NCS_Transmission_Schema_3.1.00.00.xsd$}
167
+ subject.schema.should =~ %r{3.1/NCS_Transmission_Schema_3.1.01.00.xsd$}
168
168
  end
169
169
 
170
170
  it 'has a different specification_version' do
171
- subject.specification_version.should == '3.1.00.00'
171
+ subject.specification_version.should == '3.1.01.00'
172
+ end
173
+ end
174
+
175
+ describe '3.2' do
176
+ let(:version) { '3.2' }
177
+
178
+ include_context 'version docs'
179
+
180
+ it 'has the correct path for the schema' do
181
+ subject.schema.should =~ %r{3.2/NCS_Transmission_Schema_3.2.00.00.xsd$}
182
+ end
183
+
184
+ it 'has a different specification_version' do
185
+ subject.specification_version.should == '3.2.00.00'
172
186
  end
173
187
  end
174
188
 
@@ -96,6 +96,13 @@ module NcsNavigator::Mdes
96
96
 
97
97
  include_examples 'tables fully resolved'
98
98
  end
99
+
100
+ context 'in version 3.2' do
101
+ let(:version) { '3.2' }
102
+ let(:expected_table_count) { 576 }
103
+
104
+ include_examples 'tables fully resolved'
105
+ end
99
106
  end
100
107
 
101
108
  describe '#specification_version' do
@@ -171,6 +178,14 @@ module NcsNavigator::Mdes
171
178
  disposition_codes.size.should == 332
172
179
  end
173
180
  end
181
+
182
+ context 'in version 3.2' do
183
+ let(:disposition_codes) { Specification.new('3.2', :log => logger).disposition_codes }
184
+
185
+ it 'has 332 codes' do
186
+ disposition_codes.size.should == 332
187
+ end
188
+ end
174
189
  end
175
190
 
176
191
  describe '#[]' do
@@ -252,6 +267,13 @@ module NcsNavigator::Mdes
252
267
 
253
268
  include_examples 'types fully resolved'
254
269
  end
270
+
271
+ context 'version 3.2' do
272
+ let(:version) { '3.2' }
273
+ let(:expected_type_count) { 651 }
274
+
275
+ include_examples 'types fully resolved'
276
+ end
255
277
  end
256
278
  end
257
279
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ncs_mdes
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.0
4
+ version: 0.11.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-09-17 00:00:00.000000000 Z
12
+ date: 2012-12-20 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: nokogiri
@@ -18,7 +18,7 @@ dependencies:
18
18
  requirements:
19
19
  - - ~>
20
20
  - !ruby/object:Gem::Version
21
- version: '1.4'
21
+ version: 1.5.6
22
22
  type: :runtime
23
23
  prerelease: false
24
24
  version_requirements: !ruby/object:Gem::Requirement
@@ -26,7 +26,7 @@ dependencies:
26
26
  requirements:
27
27
  - - ~>
28
28
  - !ruby/object:Gem::Version
29
- version: '1.4'
29
+ version: 1.5.6
30
30
  - !ruby/object:Gem::Dependency
31
31
  name: rspec
32
32
  requirement: !ruby/object:Gem::Requirement
@@ -133,10 +133,14 @@ files:
133
133
  - documents/3.0/disposition_codes.yml
134
134
  - documents/3.0/extract_disposition_codes.rb
135
135
  - documents/3.0/heuristic_overrides.yml
136
- - documents/3.1/NCS_Transmission_Schema_3.1.00.00.xsd
136
+ - documents/3.1/NCS_Transmission_Schema_3.1.01.00.xsd
137
137
  - documents/3.1/disposition_codes.yml
138
138
  - documents/3.1/extract_disposition_codes.rb
139
139
  - documents/3.1/heuristic_overrides.yml
140
+ - documents/3.2/NCS_Transmission_Schema_3.2.00.00.xsd
141
+ - documents/3.2/disposition_codes.yml
142
+ - documents/3.2/extract_disposition_codes.rb
143
+ - documents/3.2/heuristic_overrides.yml
140
144
  - lib/ncs_navigator/mdes.rb
141
145
  - lib/ncs_navigator/mdes/disposition_code.rb
142
146
  - lib/ncs_navigator/mdes/source_documents.rb
@@ -169,7 +173,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
169
173
  version: '0'
170
174
  segments:
171
175
  - 0
172
- hash: -3213235128109408979
176
+ hash: -1622356402615803316
173
177
  required_rubygems_version: !ruby/object:Gem::Requirement
174
178
  none: false
175
179
  requirements:
@@ -178,7 +182,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
178
182
  version: '0'
179
183
  segments:
180
184
  - 0
181
- hash: -3213235128109408979
185
+ hash: -1622356402615803316
182
186
  requirements: []
183
187
  rubyforge_project:
184
188
  rubygems_version: 1.8.24