openehr 1.1.4 → 1.1.5
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +32 -0
- data/Gemfile +1 -21
- data/Guardfile +9 -1
- data/README.rdoc +5 -3
- data/Rakefile +3 -33
- data/features/rmfactory.feature +9 -0
- data/features/step_definitions/rmfactory_steps.rb +12 -0
- data/features/support/env.rb +10 -0
- data/lib/openehr.rb +3 -2
- data/lib/openehr/rm.rb +1 -0
- data/lib/openehr/rm/data_types/basic.rb +5 -1
- data/lib/openehr/rm/data_types/quantity.rb +1 -1
- data/lib/openehr/rm/ehr.rb +1 -1
- data/lib/openehr/rm/factory.rb +180 -0
- data/lib/openehr/version.rb +3 -0
- data/openehr.gemspec +40 -463
- data/spec/lib/openehr/am/openehr_profile/data_types/quantity/c_quantity_item_spec.rb +2 -1
- data/spec/lib/openehr/rm/data_types/basic/dv_state_spec.rb +4 -0
- data/spec/lib/openehr/rm/data_types/text/dv_coded_text_spec.rb +29 -0
- data/spec/lib/openehr/rm/factory_spec.rb +189 -0
- metadata +71 -17
@@ -1,7 +1,8 @@
|
|
1
1
|
# ticket 203
|
2
2
|
require File.dirname(__FILE__) + '/../../../../../../spec_helper'
|
3
|
+
require 'openehr/am/openehr_profile/data_types/quantity'
|
3
4
|
include OpenEHR::AssumedLibraryTypes
|
4
|
-
include
|
5
|
+
include OpenEHR::AM::OpenEHRProfile::DataTypes::Quantity
|
5
6
|
|
6
7
|
describe CQuantityItem do
|
7
8
|
before(:each) do
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../../../../../spec_helper'
|
2
|
+
|
3
|
+
module OpenEHR
|
4
|
+
module RM
|
5
|
+
module DataTypes
|
6
|
+
module Text
|
7
|
+
describe DvCodedText do
|
8
|
+
let(:dv_coded_text) {
|
9
|
+
defining_code = double(CodePhrase)
|
10
|
+
defining_code.stub(:code_string).and_return('Acute myeloid leukemia')
|
11
|
+
DvCodedText.new(value: 'C920', defining_code: defining_code) }
|
12
|
+
|
13
|
+
it "should be_an_instance_of DvCodedText" do
|
14
|
+
dv_coded_text.should be_an_instance_of DvCodedText
|
15
|
+
end
|
16
|
+
|
17
|
+
it 'value should be assigned valid' do
|
18
|
+
dv_coded_text.value.should == 'C920'
|
19
|
+
end
|
20
|
+
|
21
|
+
it 'defining code string is Acute myeloid leukemia' do
|
22
|
+
dv_coded_text.defining_code.code_string.should ==
|
23
|
+
'Acute myeloid leukemia'
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,189 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../../../spec_helper'
|
2
|
+
|
3
|
+
module OpenEHR
|
4
|
+
module RM
|
5
|
+
describe Factory do
|
6
|
+
describe DvBooleanFactory do
|
7
|
+
subject { Factory.create('DvBoolean', value: true) }
|
8
|
+
it { should be_an_instance_of OpenEHR::RM::DataTypes::Basic::DvBoolean }
|
9
|
+
end
|
10
|
+
|
11
|
+
describe DvStateFactory do
|
12
|
+
subject { Factory.create('DV_STATE', value: double(), terminal: true) }
|
13
|
+
it { should be_an_instance_of OpenEHR::RM::DataTypes::Basic::DvState }
|
14
|
+
end
|
15
|
+
|
16
|
+
describe DvIdentifierFactory do
|
17
|
+
subject { Factory.create('DV_IDENTIFIER',
|
18
|
+
issuer: 'Ehime univ', assigner: 'Hospital',
|
19
|
+
id: '012345', type: 'local id') }
|
20
|
+
|
21
|
+
it { should be_an_instance_of OpenEHR::RM::DataTypes::Basic::DvIdentifier }
|
22
|
+
end
|
23
|
+
|
24
|
+
describe DvTextFactory do
|
25
|
+
subject { Factory.create("DvText", value: 'text') }
|
26
|
+
|
27
|
+
it { should be_an_instance_of OpenEHR::RM::DataTypes::Text::DvText }
|
28
|
+
end
|
29
|
+
|
30
|
+
context "DV_TEXT mapped to camelized RM type" do
|
31
|
+
subject { Factory.create('DV_TEXT', value:'text') }
|
32
|
+
|
33
|
+
it { should be_an_instance_of OpenEHR::RM::DataTypes::Text::DvText }
|
34
|
+
end
|
35
|
+
|
36
|
+
describe TermMappingFactory do
|
37
|
+
let(:target) { double() }
|
38
|
+
subject { Factory.create('TERM_MAPPING', target: target, match: '=') }
|
39
|
+
|
40
|
+
it { should be_an_instance_of OpenEHR::RM::DataTypes::Text::TermMapping }
|
41
|
+
end
|
42
|
+
|
43
|
+
describe CodePhraseFactory do
|
44
|
+
let(:terminology_id) { double() }
|
45
|
+
subject { Factory.create('CODE_PHRASE',
|
46
|
+
terminology_id: terminology_id,
|
47
|
+
code_string: 'C890') }
|
48
|
+
|
49
|
+
it { should be_an_instance_of OpenEHR::RM::DataTypes::Text::CodePhrase }
|
50
|
+
end
|
51
|
+
|
52
|
+
describe DvCodedTextFactory do
|
53
|
+
subject { Factory.create('DV_CODED_TEXT', value: 'C089', defining_code: double()) }
|
54
|
+
|
55
|
+
it { should be_an_instance_of OpenEHR::RM::DataTypes::Text::DvCodedText }
|
56
|
+
end
|
57
|
+
|
58
|
+
describe DvParagraphFactory do
|
59
|
+
let(:items) { ['short sentence', 'long sentence']}
|
60
|
+
subject { Factory.create('DV_PARAGRAPH', items: items) }
|
61
|
+
|
62
|
+
it { should be_an_instance_of OpenEHR::RM::DataTypes::Text::DvParagraph }
|
63
|
+
end
|
64
|
+
|
65
|
+
describe DvOrderedFactory do
|
66
|
+
subject { Factory.create('DV_ORDERED') }
|
67
|
+
|
68
|
+
it { should be_an_instance_of OpenEHR::RM::DataTypes::Quantity::DvOrdered }
|
69
|
+
end
|
70
|
+
|
71
|
+
describe DvIntervalFactory do
|
72
|
+
subject { Factory.create('DV_INTERVAL', upper: 100, lower: 1) }
|
73
|
+
|
74
|
+
it { should be_an_instance_of OpenEHR::RM::DataTypes::Quantity::DvInterval }
|
75
|
+
end
|
76
|
+
|
77
|
+
describe ReferenceRangeFactory do
|
78
|
+
subject { Factory.create('REFERENCE_RANGE', meaning: 'spec', range: double) }
|
79
|
+
it { should be_an_instance_of OpenEHR::RM::DataTypes::Quantity::ReferenceRange }
|
80
|
+
end
|
81
|
+
|
82
|
+
describe DvOrdinalFactory do
|
83
|
+
subject { Factory.create('DV_ORDINAL', value: 1, symbol: double()) }
|
84
|
+
|
85
|
+
it { should be_an_instance_of OpenEHR::RM::DataTypes::Quantity::DvOrdinal }
|
86
|
+
end
|
87
|
+
|
88
|
+
describe DvQuantifiedFactory do
|
89
|
+
subject { Factory.create('DV_QUANTIFIED', magnitude: 1) }
|
90
|
+
|
91
|
+
it { should be_an_instance_of OpenEHR::RM::DataTypes::Quantity::DvQuantified }
|
92
|
+
end
|
93
|
+
|
94
|
+
describe DvAmountFactory do
|
95
|
+
subject { Factory.create('DV_AMOUNT', magnitude: 0) }
|
96
|
+
|
97
|
+
it { should be_an_instance_of DataTypes::Quantity::DvAmount }
|
98
|
+
end
|
99
|
+
|
100
|
+
describe DvQuantityFactory do
|
101
|
+
subject { Factory.create("DvQuantity", magnitude: 10, units: 'mg') }
|
102
|
+
|
103
|
+
it { should be_an_instance_of OpenEHR::RM::DataTypes::Quantity::DvQuantity }
|
104
|
+
end
|
105
|
+
|
106
|
+
describe DvCountFactory do
|
107
|
+
subject { Factory.create("DV_COUNT", magnitude: 3) }
|
108
|
+
|
109
|
+
it { should be_an_instance_of DataTypes::Quantity::DvCount }
|
110
|
+
end
|
111
|
+
|
112
|
+
describe DvProportionFactory do
|
113
|
+
subject { Factory.create('DV_PROPORTION', numerator: 2, denominator: 1,
|
114
|
+
type: DataTypes::Quantity::ProportionKind::PK_UNITARY) }
|
115
|
+
|
116
|
+
it { should be_an_instance_of DataTypes::Quantity::DvProportion }
|
117
|
+
end
|
118
|
+
|
119
|
+
describe DvAbsoluteQuantityFactory do
|
120
|
+
subject { Factory.create('DV_ABSOLUTE_QUANTITY', magnitude: 6) }
|
121
|
+
|
122
|
+
it { should be_an_instance_of DataTypes::Quantity::DvAbsoluteQuantity }
|
123
|
+
end
|
124
|
+
|
125
|
+
describe DvTemporalFactory do
|
126
|
+
subject { Factory.create('DV_TEMPORAL', value: '2013-02-20T02:09:30') }
|
127
|
+
|
128
|
+
it { should be_an_instance_of DataTypes::Quantity::DateTime::DvTemporal }
|
129
|
+
end
|
130
|
+
|
131
|
+
describe DvDateFactory do
|
132
|
+
subject { Factory.create("DV_DATE", value: '2013-02-19') }
|
133
|
+
|
134
|
+
it { should be_an_instance_of OpenEHR::RM::DataTypes::Quantity::DateTime::DvDate }
|
135
|
+
end
|
136
|
+
|
137
|
+
describe DvTimeFactory do
|
138
|
+
subject { Factory.create('DV_TIME', value: '02:13:39') }
|
139
|
+
|
140
|
+
it { should be_an_instance_of DataTypes::Quantity::DateTime::DvTime }
|
141
|
+
end
|
142
|
+
|
143
|
+
describe DvDateTimeFactory do
|
144
|
+
subject { Factory.create('DV_DATE_TIME', value: '2013-02-21T01:02:23') }
|
145
|
+
|
146
|
+
it { should be_an_instance_of DataTypes::Quantity::DateTime::DvDateTime }
|
147
|
+
end
|
148
|
+
|
149
|
+
describe DvDurationFactory do
|
150
|
+
subject { Factory.create('DV_DURATION', value: 'P1Y2M') }
|
151
|
+
|
152
|
+
it { should be_an_instance_of DataTypes::Quantity::DateTime::DvDuration }
|
153
|
+
end
|
154
|
+
|
155
|
+
describe DvEncapsulatedFactory do
|
156
|
+
subject { Factory.create('DV_ENCAPSULATED', value: 'sample') }
|
157
|
+
|
158
|
+
it { should be_an_instance_of DataTypes::Encapsulated::DvEncapsulated }
|
159
|
+
end
|
160
|
+
|
161
|
+
describe DvMultimediaFactory do
|
162
|
+
subject { media_type = stub('media_type')
|
163
|
+
media_type.stub(:code_string).and_return('SVG')
|
164
|
+
Factory.create('DV_MULTIMEDIA', value: '<SVG> test </SVG>',
|
165
|
+
media_type: media_type) }
|
166
|
+
|
167
|
+
it { should be_an_instance_of DataTypes::Encapsulated::DvMultimedia }
|
168
|
+
end
|
169
|
+
|
170
|
+
describe DvParsableFactory do
|
171
|
+
subject { Factory.create('DvParsable', value: 'test', formalism: 'plain/text') }
|
172
|
+
|
173
|
+
it { should be_an_instance_of DataTypes::Encapsulated::DvParsable }
|
174
|
+
end
|
175
|
+
|
176
|
+
describe DvUriFactory do
|
177
|
+
subject { Factory.create('DV_URI', value: 'http://openehr.jp') }
|
178
|
+
|
179
|
+
it { should be_an_instance_of DataTypes::URI::DvUri }
|
180
|
+
end
|
181
|
+
|
182
|
+
describe DvEhrUriFactory do
|
183
|
+
subject { Factory.create('DV_EHR_URI', value: 'ehr://test/87284370-2D4B-4e3d-A3F3-F303D2F4F34B@2005-08-02T04:30:00') }
|
184
|
+
|
185
|
+
it { should be_an_instance_of DataTypes::URI::DvEhrUri }
|
186
|
+
end
|
187
|
+
end
|
188
|
+
end
|
189
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: openehr
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.5
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,10 +10,10 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2013-02-20 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
|
-
name:
|
16
|
+
name: rake
|
17
17
|
requirement: !ruby/object:Gem::Requirement
|
18
18
|
none: false
|
19
19
|
requirements:
|
@@ -29,7 +29,7 @@ dependencies:
|
|
29
29
|
- !ruby/object:Gem::Version
|
30
30
|
version: '0'
|
31
31
|
- !ruby/object:Gem::Dependency
|
32
|
-
name:
|
32
|
+
name: xml-simple
|
33
33
|
requirement: !ruby/object:Gem::Requirement
|
34
34
|
none: false
|
35
35
|
requirements:
|
@@ -45,7 +45,7 @@ dependencies:
|
|
45
45
|
- !ruby/object:Gem::Version
|
46
46
|
version: '0'
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
|
-
name:
|
48
|
+
name: activesupport
|
49
49
|
requirement: !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
@@ -61,7 +61,7 @@ dependencies:
|
|
61
61
|
- !ruby/object:Gem::Version
|
62
62
|
version: '0'
|
63
63
|
- !ruby/object:Gem::Dependency
|
64
|
-
name:
|
64
|
+
name: locale
|
65
65
|
requirement: !ruby/object:Gem::Requirement
|
66
66
|
none: false
|
67
67
|
requirements:
|
@@ -77,7 +77,7 @@ dependencies:
|
|
77
77
|
- !ruby/object:Gem::Version
|
78
78
|
version: '0'
|
79
79
|
- !ruby/object:Gem::Dependency
|
80
|
-
name:
|
80
|
+
name: builder
|
81
81
|
requirement: !ruby/object:Gem::Requirement
|
82
82
|
none: false
|
83
83
|
requirements:
|
@@ -205,7 +205,7 @@ dependencies:
|
|
205
205
|
- !ruby/object:Gem::Version
|
206
206
|
version: '0'
|
207
207
|
- !ruby/object:Gem::Dependency
|
208
|
-
name:
|
208
|
+
name: cucumber
|
209
209
|
requirement: !ruby/object:Gem::Requirement
|
210
210
|
none: false
|
211
211
|
requirements:
|
@@ -221,7 +221,7 @@ dependencies:
|
|
221
221
|
- !ruby/object:Gem::Version
|
222
222
|
version: '0'
|
223
223
|
- !ruby/object:Gem::Dependency
|
224
|
-
name:
|
224
|
+
name: guard
|
225
225
|
requirement: !ruby/object:Gem::Requirement
|
226
226
|
none: false
|
227
227
|
requirements:
|
@@ -237,19 +237,51 @@ dependencies:
|
|
237
237
|
- !ruby/object:Gem::Version
|
238
238
|
version: '0'
|
239
239
|
- !ruby/object:Gem::Dependency
|
240
|
-
name:
|
240
|
+
name: guard-rspec
|
241
241
|
requirement: !ruby/object:Gem::Requirement
|
242
242
|
none: false
|
243
243
|
requirements:
|
244
244
|
- - ~>
|
245
245
|
- !ruby/object:Gem::Version
|
246
|
-
version:
|
246
|
+
version: 2.4.0
|
247
247
|
type: :development
|
248
248
|
prerelease: false
|
249
249
|
version_requirements: !ruby/object:Gem::Requirement
|
250
250
|
none: false
|
251
251
|
requirements:
|
252
252
|
- - ~>
|
253
|
+
- !ruby/object:Gem::Version
|
254
|
+
version: 2.4.0
|
255
|
+
- !ruby/object:Gem::Dependency
|
256
|
+
name: guard-cucumber
|
257
|
+
requirement: !ruby/object:Gem::Requirement
|
258
|
+
none: false
|
259
|
+
requirements:
|
260
|
+
- - ! '>='
|
261
|
+
- !ruby/object:Gem::Version
|
262
|
+
version: '0'
|
263
|
+
type: :development
|
264
|
+
prerelease: false
|
265
|
+
version_requirements: !ruby/object:Gem::Requirement
|
266
|
+
none: false
|
267
|
+
requirements:
|
268
|
+
- - ! '>='
|
269
|
+
- !ruby/object:Gem::Version
|
270
|
+
version: '0'
|
271
|
+
- !ruby/object:Gem::Dependency
|
272
|
+
name: spork
|
273
|
+
requirement: !ruby/object:Gem::Requirement
|
274
|
+
none: false
|
275
|
+
requirements:
|
276
|
+
- - ! '>'
|
277
|
+
- !ruby/object:Gem::Version
|
278
|
+
version: 1.0rc
|
279
|
+
type: :development
|
280
|
+
prerelease: false
|
281
|
+
version_requirements: !ruby/object:Gem::Requirement
|
282
|
+
none: false
|
283
|
+
requirements:
|
284
|
+
- - ! '>'
|
253
285
|
- !ruby/object:Gem::Version
|
254
286
|
version: 1.0rc
|
255
287
|
- !ruby/object:Gem::Dependency
|
@@ -284,6 +316,22 @@ dependencies:
|
|
284
316
|
- - ! '>='
|
285
317
|
- !ruby/object:Gem::Version
|
286
318
|
version: '0'
|
319
|
+
- !ruby/object:Gem::Dependency
|
320
|
+
name: listen
|
321
|
+
requirement: !ruby/object:Gem::Requirement
|
322
|
+
none: false
|
323
|
+
requirements:
|
324
|
+
- - '='
|
325
|
+
- !ruby/object:Gem::Version
|
326
|
+
version: '0.6'
|
327
|
+
type: :development
|
328
|
+
prerelease: false
|
329
|
+
version_requirements: !ruby/object:Gem::Requirement
|
330
|
+
none: false
|
331
|
+
requirements:
|
332
|
+
- - '='
|
333
|
+
- !ruby/object:Gem::Version
|
334
|
+
version: '0.6'
|
287
335
|
- !ruby/object:Gem::Dependency
|
288
336
|
name: libnotify
|
289
337
|
requirement: !ruby/object:Gem::Requirement
|
@@ -308,6 +356,7 @@ extra_rdoc_files:
|
|
308
356
|
- README.rdoc
|
309
357
|
files:
|
310
358
|
- .document
|
359
|
+
- .gitignore
|
311
360
|
- .rspec
|
312
361
|
- .travis.yml
|
313
362
|
- Gemfile
|
@@ -318,6 +367,9 @@ files:
|
|
318
367
|
- Rakefile
|
319
368
|
- VERSION
|
320
369
|
- doc/openehr_terminology.xml
|
370
|
+
- features/rmfactory.feature
|
371
|
+
- features/step_definitions/rmfactory_steps.rb
|
372
|
+
- features/support/env.rb
|
321
373
|
- lib/openehr.rb
|
322
374
|
- lib/openehr/am.rb
|
323
375
|
- lib/openehr/am/archetype.rb
|
@@ -365,6 +417,7 @@ files:
|
|
365
417
|
- lib/openehr/rm/data_types/uri.rb
|
366
418
|
- lib/openehr/rm/demographic.rb
|
367
419
|
- lib/openehr/rm/ehr.rb
|
420
|
+
- lib/openehr/rm/factory.rb
|
368
421
|
- lib/openehr/rm/integration.rb
|
369
422
|
- lib/openehr/rm/security.rb
|
370
423
|
- lib/openehr/rm/support.rb
|
@@ -375,6 +428,7 @@ files:
|
|
375
428
|
- lib/openehr/serializer.rb
|
376
429
|
- lib/openehr/terminology.rb
|
377
430
|
- lib/openehr/terminology/open_ehr_terminology.rb
|
431
|
+
- lib/openehr/version.rb
|
378
432
|
- lib/openehr/writer.rb
|
379
433
|
- openehr.gemspec
|
380
434
|
- spec/lib/openehr/am/archetype/archetype_spec.rb
|
@@ -644,6 +698,7 @@ files:
|
|
644
698
|
- spec/lib/openehr/rm/data_types/quantity/proportion_kind_spec.rb
|
645
699
|
- spec/lib/openehr/rm/data_types/quantity/reference_range_spec.rb
|
646
700
|
- spec/lib/openehr/rm/data_types/text/code_phrase_spec.rb
|
701
|
+
- spec/lib/openehr/rm/data_types/text/dv_coded_text_spec.rb
|
647
702
|
- spec/lib/openehr/rm/data_types/text/dv_paragraph_spec.rb
|
648
703
|
- spec/lib/openehr/rm/data_types/text/dv_text_spec.rb
|
649
704
|
- spec/lib/openehr/rm/data_types/text/term_mapping_spec.rb
|
@@ -661,6 +716,7 @@ files:
|
|
661
716
|
- spec/lib/openehr/rm/ehr/ehr_spec.rb
|
662
717
|
- spec/lib/openehr/rm/ehr/ehr_status_spec.rb
|
663
718
|
- spec/lib/openehr/rm/ehr/versioned_composition_spec.rb
|
719
|
+
- spec/lib/openehr/rm/factory_spec.rb
|
664
720
|
- spec/lib/openehr/rm/integration/generic_entry_spec.rb
|
665
721
|
- spec/lib/openehr/rm/support/identification/access_group_ref_spec.rb
|
666
722
|
- spec/lib/openehr/rm/support/identification/archetype_id_spec.rb
|
@@ -689,9 +745,9 @@ files:
|
|
689
745
|
- spec/lib/openehr/terminology/open_ehr_terminology_spec.rb
|
690
746
|
- spec/spec.opts
|
691
747
|
- spec/spec_helper.rb
|
692
|
-
homepage: http://
|
748
|
+
homepage: http://openehr.jp
|
693
749
|
licenses:
|
694
|
-
- Apache 2.0
|
750
|
+
- Apache 2.0
|
695
751
|
post_install_message:
|
696
752
|
rdoc_options: []
|
697
753
|
require_paths:
|
@@ -702,9 +758,6 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
702
758
|
- - ! '>='
|
703
759
|
- !ruby/object:Gem::Version
|
704
760
|
version: '0'
|
705
|
-
segments:
|
706
|
-
- 0
|
707
|
-
hash: -3026411643743733801
|
708
761
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
709
762
|
none: false
|
710
763
|
requirements:
|
@@ -713,8 +766,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
713
766
|
version: '0'
|
714
767
|
requirements: []
|
715
768
|
rubyforge_project:
|
716
|
-
rubygems_version: 1.8.
|
769
|
+
rubygems_version: 1.8.25
|
717
770
|
signing_key:
|
718
771
|
specification_version: 3
|
719
772
|
summary: Ruby implementation of the openEHR specification
|
720
773
|
test_files: []
|
774
|
+
has_rdoc:
|