open_ehr 0.9.3 → 0.9.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/History.txt +6 -0
- data/README.rdoc +6 -8
- data/VERSION +1 -1
- data/lib/open_ehr/am/archetype/constraint_model/primitive.rb +2 -2
- data/lib/open_ehr/am/archetype/ontology.rb +23 -28
- data/lib/open_ehr/am/archetype.rb +1 -1
- data/lib/open_ehr/parser/adl.rb +42 -4
- data/lib/open_ehr/parser/adl_grammar.tt +67 -42
- data/lib/open_ehr/parser/adl_parser.rb +1 -1
- data/lib/open_ehr/parser/cadl_grammar.tt +227 -61
- data/lib/open_ehr/parser/cadl_node.rb +1 -0
- data/lib/open_ehr/parser/dadl_grammar.tt +10 -10
- data/lib/open_ehr/parser/shared_token_grammar.tt +13 -13
- data/open_ehr.gemspec +14 -4
- data/spec/lib/open_ehr/am/archetype/archetype_spec.rb +1 -1
- data/spec/lib/open_ehr/am/archetype/ontology/archetype_ontology_spec.rb +22 -13
- data/spec/lib/open_ehr/parser/adl14/adl-test-SOME_TYPE.generic_type_use_node.draft.adl +1 -1
- data/spec/lib/open_ehr/parser/adl14/adl-test-entry.archetype_bindings.test.adl +1 -1
- data/spec/lib/open_ehr/parser/adl14/adl-test-entry.archetype_internal_ref.test.adl +1 -1
- data/spec/lib/open_ehr/parser/adl14/adl-test-entry.archetype_internal_ref2.test.adl +1 -1
- data/spec/lib/open_ehr/parser/adl14/adl-test-entry.archetype_language.test.adl +1 -1
- data/spec/lib/open_ehr/parser/adl14/adl-test-entry.archetype_language_no_accreditation.test.adl +1 -1
- data/spec/lib/open_ehr/parser/adl14/adl-test-entry.archetype_language_order_of_translation_details.test.adl +1 -1
- data/spec/lib/open_ehr/parser/adl14/adl-test-entry.archetype_ontology.test.adl +1 -1
- data/spec/lib/open_ehr/parser/adl14/adl-test-entry.translations_author_language.test.adl +1 -1
- data/spec/lib/open_ehr/parser/adl14/adl-test-entry.translations_language_author.test.adl +1 -1
- data/spec/lib/open_ehr/parser/adl_archetype_internal_ref2_spec.rb +42 -0
- data/spec/lib/open_ehr/parser/adl_archetype_internal_ref_spec.rb +125 -0
- data/spec/lib/open_ehr/parser/adl_archetype_internal_ref_with_generics_spec.rb +258 -0
- data/spec/lib/open_ehr/parser/adl_archetype_ontology_binding_spec.rb +98 -0
- data/spec/lib/open_ehr/parser/adl_archetype_ontology_spec.rb +42 -0
- data/spec/lib/open_ehr/parser/adl_description_spec.rb +13 -2
- data/spec/lib/open_ehr/parser/adl_language_no_accreditation_spec.rb +66 -0
- data/spec/lib/open_ehr/parser/adl_language_order_spec.rb +68 -0
- data/spec/lib/open_ehr/parser/adl_language_spec.rb +119 -0
- data/spec/lib/open_ehr/parser/adl_language_translation_author_language_spec.rb +50 -0
- data/spec/lib/open_ehr/parser/adl_language_translation_language_author_spec.rb +46 -0
- data/spec/lib/open_ehr/parser/adl_parser_spec.rb +2 -2
- data/spec/lib/open_ehr/parser/parser_spec_helper.rb +7 -0
- data/spec/lib/open_ehr/rm/common/resource/translation_details_spec.rb +4 -4
- metadata +49 -39
- data/Gemfile.lock +0 -85
@@ -0,0 +1,42 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../../../spec_helper'
|
2
|
+
require File.dirname(__FILE__) + '/parser_spec_helper'
|
3
|
+
include OpenEHR::AM::Archetype::Ontology
|
4
|
+
|
5
|
+
describe ADLParser do
|
6
|
+
context 'ArchetypeOntology' do
|
7
|
+
before(:all) do
|
8
|
+
at = adl14_archetype('adl-test-entry.archetype_ontology.test.adl')
|
9
|
+
@ontology = at.ontology
|
10
|
+
end
|
11
|
+
|
12
|
+
it 'is an instance of ArchetypeOntology' do
|
13
|
+
@ontology.should be_an_instance_of ArchetypeOntology
|
14
|
+
end
|
15
|
+
|
16
|
+
it 's primary language is en' do
|
17
|
+
@ontology.primary_language.should == 'en'
|
18
|
+
end
|
19
|
+
|
20
|
+
it 's languages available are en' do
|
21
|
+
@ontology.languages_available.should == ['en']
|
22
|
+
end
|
23
|
+
|
24
|
+
context 'en terms' do
|
25
|
+
before(:all) do
|
26
|
+
@archetype_term = @ontology.term_definition(:lang => 'en', :code => 'at0000')
|
27
|
+
end
|
28
|
+
|
29
|
+
it 's text is some text' do
|
30
|
+
@archetype_term.items['text'].should == 'some text'
|
31
|
+
end
|
32
|
+
|
33
|
+
it 's description is some description' do
|
34
|
+
@archetype_term.items['description'].should == 'some description'
|
35
|
+
end
|
36
|
+
|
37
|
+
it 's commen is some comment' do
|
38
|
+
@archetype_term.items['comment'].should == 'some comment'
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -107,12 +107,12 @@ describe ADLParser do
|
|
107
107
|
end
|
108
108
|
|
109
109
|
it 'ligne guide is http://guidelines.are.us/wherever/fr' do
|
110
|
-
@original_resource_uri[
|
110
|
+
@original_resource_uri['ligne guide'].should ==
|
111
111
|
'http://guidelines.are.us/wherever/fr'
|
112
112
|
end
|
113
113
|
|
114
114
|
it 'medline is http://some%20medline%20ref' do
|
115
|
-
@original_resource_uri[
|
115
|
+
@original_resource_uri['medline'].should == 'http://some%20medline%20ref'
|
116
116
|
end
|
117
117
|
end
|
118
118
|
end
|
@@ -150,4 +150,15 @@ describe ADLParser do
|
|
150
150
|
end
|
151
151
|
end
|
152
152
|
end
|
153
|
+
|
154
|
+
context 'failed for empty other contributors' do
|
155
|
+
before(:all) do
|
156
|
+
adl_dir = File.dirname(__FILE__) + '/adl14/'
|
157
|
+
@ap = ADLParser.new(adl_dir + 'adl-test-entry.archetype_description2.test.adl')
|
158
|
+
end
|
159
|
+
|
160
|
+
it 'fails empty other comtributors' do
|
161
|
+
@ap.parse.should raise_error
|
162
|
+
end
|
163
|
+
end
|
153
164
|
end
|
@@ -0,0 +1,66 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../../../spec_helper'
|
2
|
+
require File.dirname(__FILE__) + '/parser_spec_helper'
|
3
|
+
include OpenEHR::Parser
|
4
|
+
|
5
|
+
describe ADLParser do
|
6
|
+
context 'Language no accrediition' do
|
7
|
+
before(:all) do
|
8
|
+
target_adl_file = 'adl-test-entry.archetype_language_no_accreditation.test.adl'
|
9
|
+
ap = ADLParser.new(ADL14DIR + target_adl_file)
|
10
|
+
archetype = ap.parse
|
11
|
+
@translations = archetype.translations
|
12
|
+
end
|
13
|
+
|
14
|
+
it 'exists' do
|
15
|
+
@translations.should_not be_nil
|
16
|
+
end
|
17
|
+
|
18
|
+
context 'German translation' do
|
19
|
+
before(:all) do
|
20
|
+
@de = @translations['de']
|
21
|
+
end
|
22
|
+
|
23
|
+
it 'exists' do
|
24
|
+
@de.should_not be_nil
|
25
|
+
end
|
26
|
+
|
27
|
+
context 'author' do
|
28
|
+
before(:all) do
|
29
|
+
@author = @de.author
|
30
|
+
end
|
31
|
+
|
32
|
+
it 'exists' do
|
33
|
+
@author.should_not be_nil
|
34
|
+
end
|
35
|
+
|
36
|
+
it 'name is Harry Potter' do
|
37
|
+
@author['name'].should == 'Harry Potter'
|
38
|
+
end
|
39
|
+
|
40
|
+
it 'email is harry@something.somewhere.co.uk' do
|
41
|
+
@author['email'].should == 'harry@something.somewhere.co.uk'
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
context 'accreditation' do
|
46
|
+
it 'not exist' do
|
47
|
+
@de.accreditation.should be_nil
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
context 'other details' do
|
52
|
+
before(:all) do
|
53
|
+
@other_details = @de.other_details
|
54
|
+
end
|
55
|
+
|
56
|
+
it 'review 1 is Ron Weasley' do
|
57
|
+
@other_details['review 1'].should == 'Ron Weasley'
|
58
|
+
end
|
59
|
+
|
60
|
+
it 'review 2 is Rubeus Hagrid' do
|
61
|
+
@other_details['review 2'].should == 'Rubeus Hagrid'
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
@@ -0,0 +1,68 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../../../spec_helper'
|
2
|
+
require File.dirname(__FILE__) + '/parser_spec_helper'
|
3
|
+
include OpenEHR::Parser
|
4
|
+
|
5
|
+
describe ADLParser do
|
6
|
+
context 'Language order of translation details' do
|
7
|
+
before(:all) do
|
8
|
+
target_adl_file = 'adl-test-entry.archetype_language_order_of_translation_details.test.adl'
|
9
|
+
ap = ADLParser.new(ADL14DIR + '/' + target_adl_file)
|
10
|
+
archetype = ap.parse
|
11
|
+
@translations = archetype.translations
|
12
|
+
end
|
13
|
+
|
14
|
+
it 'translation is not nil' do
|
15
|
+
@translations.should_not be_nil
|
16
|
+
end
|
17
|
+
|
18
|
+
context 'German translation' do
|
19
|
+
before(:all) do
|
20
|
+
@de = @translations['de']
|
21
|
+
end
|
22
|
+
|
23
|
+
it 'exists' do
|
24
|
+
@de.should_not be_nil
|
25
|
+
end
|
26
|
+
|
27
|
+
context 'author' do
|
28
|
+
before(:all) do
|
29
|
+
@author = @de.author
|
30
|
+
end
|
31
|
+
|
32
|
+
it 'exists' do
|
33
|
+
@author.should_not be_nil
|
34
|
+
end
|
35
|
+
|
36
|
+
it 'name is Harry Potter' do
|
37
|
+
@author['name'].should == 'Harry Potter'
|
38
|
+
end
|
39
|
+
|
40
|
+
it 'email is harry@something.somewhere.co.uk' do
|
41
|
+
@author['email'].should == 'harry@something.somewhere.co.uk'
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
it 'accreditation is Seven OWLs at Hogwards' do
|
46
|
+
@de.accreditation.should == 'Seven OWLs at Hogwards'
|
47
|
+
end
|
48
|
+
|
49
|
+
context 'other details' do
|
50
|
+
before(:all) do
|
51
|
+
@other_details = @de.other_details
|
52
|
+
end
|
53
|
+
|
54
|
+
it 'review 1 is Ron Weasley' do
|
55
|
+
@other_details['review 1'].should == 'Ron Weasley'
|
56
|
+
end
|
57
|
+
|
58
|
+
it 'review 2 is Rubeus Hagrid' do
|
59
|
+
@other_details['review 2'].should == 'Rubeus Hagrid'
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
it 'language code is de' do
|
64
|
+
@de.language.code_string.should == 'de'
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
@@ -0,0 +1,119 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../../../spec_helper'
|
2
|
+
require File.dirname(__FILE__) + '/parser_spec_helper'
|
3
|
+
include OpenEHR::Parser
|
4
|
+
|
5
|
+
describe ADLParser do
|
6
|
+
context 'Language' do
|
7
|
+
before(:all) do
|
8
|
+
target_adl_file = 'adl-test-entry.archetype_language.test.adl'
|
9
|
+
ap = ADLParser.new(ADL14DIR + target_adl_file)
|
10
|
+
@archetype = ap.parse
|
11
|
+
end
|
12
|
+
|
13
|
+
context 'original language' do
|
14
|
+
before(:all) do
|
15
|
+
@original_language = @archetype.original_language
|
16
|
+
end
|
17
|
+
|
18
|
+
it 'original language is en' do
|
19
|
+
@original_language.code_string.should == 'en'
|
20
|
+
end
|
21
|
+
|
22
|
+
it 'terminology_id ISO_639-1' do
|
23
|
+
@original_language.terminology_id.value.should == 'ISO_639-1'
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
context 'translations' do
|
28
|
+
before(:all) do
|
29
|
+
@translations = @archetype.translations
|
30
|
+
end
|
31
|
+
|
32
|
+
it 'translation is not nil' do
|
33
|
+
@translations.should_not be_nil
|
34
|
+
end
|
35
|
+
|
36
|
+
context 'German translation' do
|
37
|
+
before(:all) do
|
38
|
+
@de = @translations['de']
|
39
|
+
end
|
40
|
+
|
41
|
+
it 'translation is not nil' do
|
42
|
+
@de.should_not be_nil
|
43
|
+
end
|
44
|
+
|
45
|
+
it 'German code_string is de' do
|
46
|
+
@de.language.code_string.should == 'de'
|
47
|
+
end
|
48
|
+
|
49
|
+
it 'terminology id is ISO_639-1' do
|
50
|
+
@de.language.terminology_id.value.should == 'ISO_639-1'
|
51
|
+
end
|
52
|
+
|
53
|
+
it 'accreditation is British Medical Translator id 00400595' do
|
54
|
+
@de.accreditation.should == 'British Medical Translator id 00400595'
|
55
|
+
end
|
56
|
+
|
57
|
+
context 'author' do
|
58
|
+
before(:all) do
|
59
|
+
@author = @de.author
|
60
|
+
end
|
61
|
+
|
62
|
+
it 'name is Harry Potter' do
|
63
|
+
@author['name'].should == 'Harry Potter'
|
64
|
+
end
|
65
|
+
|
66
|
+
it 'email is harry@something.somewhere.co.uk' do
|
67
|
+
@author['email'].should == 'harry@something.somewhere.co.uk'
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
context 'other_details' do
|
72
|
+
before(:all) do
|
73
|
+
@other_details = @de.other_details
|
74
|
+
end
|
75
|
+
|
76
|
+
it 'review 1 is Ron Weasley' do
|
77
|
+
@other_details['review 1'].should == 'Ron Weasley'
|
78
|
+
end
|
79
|
+
|
80
|
+
it 'review 2 is Rubeus Hagrid' do
|
81
|
+
@other_details['review 2'].should == 'Rubeus Hagrid'
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
context 'Russian translation' do
|
87
|
+
before(:all) do
|
88
|
+
@ru = @translations['ru']
|
89
|
+
end
|
90
|
+
|
91
|
+
it 'code is ru' do
|
92
|
+
@ru.language.code_string.should == 'ru'
|
93
|
+
end
|
94
|
+
|
95
|
+
it 'terminology id is ISO_639-1' do
|
96
|
+
@ru.language.terminology_id.value.should == 'ISO_639-1'
|
97
|
+
end
|
98
|
+
|
99
|
+
it 'accreditation is Russion Translator id 892230A' do
|
100
|
+
@ru.accreditation.should == 'Russion Translator id 892230A'
|
101
|
+
end
|
102
|
+
|
103
|
+
context 'author' do
|
104
|
+
before(:all) do
|
105
|
+
@author = @ru.author
|
106
|
+
end
|
107
|
+
|
108
|
+
it 'name is Vladimir Nabokov' do
|
109
|
+
@author['name'].should == 'Vladimir Nabokov'
|
110
|
+
end
|
111
|
+
|
112
|
+
it 'email is vladimir@something.somewhere.ru' do
|
113
|
+
@author['email'].should == 'vladimir@something.somewhere.ru'
|
114
|
+
end
|
115
|
+
end
|
116
|
+
end
|
117
|
+
end
|
118
|
+
end
|
119
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../../../spec_helper'
|
2
|
+
require File.dirname(__FILE__) + '/parser_spec_helper'
|
3
|
+
include OpenEHR::Parser
|
4
|
+
|
5
|
+
describe ADLParser do
|
6
|
+
context 'Language author parsing behavior' do
|
7
|
+
before(:all) do
|
8
|
+
target_adl_file = 'adl-test-entry.translations_author_language.test.adl'
|
9
|
+
ap = ADLParser.new(ADL14DIR + target_adl_file)
|
10
|
+
archetype = ap.parse
|
11
|
+
@translations = archetype.translations
|
12
|
+
end
|
13
|
+
|
14
|
+
it 'translations exists' do
|
15
|
+
@translations.should_not be_nil
|
16
|
+
end
|
17
|
+
|
18
|
+
context 'German translation' do
|
19
|
+
before(:all) do
|
20
|
+
@de = @translations['de']
|
21
|
+
end
|
22
|
+
|
23
|
+
it 'exists' do
|
24
|
+
@de.should_not be_nil
|
25
|
+
end
|
26
|
+
|
27
|
+
it 'language code string is de' do
|
28
|
+
@de.language.code_string.should == 'de'
|
29
|
+
end
|
30
|
+
|
31
|
+
context 'author' do
|
32
|
+
before(:all) do
|
33
|
+
@author = @de.author
|
34
|
+
end
|
35
|
+
|
36
|
+
it 'exists' do
|
37
|
+
@author.should_not be_nil
|
38
|
+
end
|
39
|
+
|
40
|
+
it 'name is Harry Potter' do
|
41
|
+
@author['name'].should == 'Harry Potter'
|
42
|
+
end
|
43
|
+
|
44
|
+
it 'email is harry@something.somewhere.co.uk' do
|
45
|
+
@author['email'].should == 'harry@something.somewhere.co.uk'
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../../../spec_helper'
|
2
|
+
require File.dirname(__FILE__) + '/parser_spec_helper'
|
3
|
+
include OpenEHR::Parser
|
4
|
+
|
5
|
+
describe ADLParser do
|
6
|
+
context 'Language author parsing behavior' do
|
7
|
+
before(:all) do
|
8
|
+
TARGET_ADL_FILE = 'adl-test-entry.translations_language_author.test.adl'
|
9
|
+
ap = ADLParser.new(ADL14DIR + TARGET_ADL_FILE)
|
10
|
+
archetype = ap.parse
|
11
|
+
@translations = archetype.translations
|
12
|
+
end
|
13
|
+
|
14
|
+
it 'translations exists' do
|
15
|
+
@translations.should_not be_nil
|
16
|
+
end
|
17
|
+
|
18
|
+
context 'German translation' do
|
19
|
+
before(:all) do
|
20
|
+
@de = @translations['de']
|
21
|
+
end
|
22
|
+
|
23
|
+
it 'exists' do
|
24
|
+
@de.should_not be_nil
|
25
|
+
end
|
26
|
+
|
27
|
+
it 'language code string is de' do
|
28
|
+
@de.language.code_string.should == 'de'
|
29
|
+
end
|
30
|
+
|
31
|
+
context 'author' do
|
32
|
+
before(:all) do
|
33
|
+
@author = @de.author
|
34
|
+
end
|
35
|
+
|
36
|
+
it 'name is Harry Potter' do
|
37
|
+
@author['name'].should == 'Harry Potter'
|
38
|
+
end
|
39
|
+
|
40
|
+
it 'email is harry@something.somewhere.co.uk' do
|
41
|
+
@author['email'].should == 'harry@something.somewhere.co.uk'
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
@@ -324,12 +324,12 @@ describe ADLParser do
|
|
324
324
|
|
325
325
|
it 'term_definitions parsed and assigned properly' do
|
326
326
|
@archetype_ontology.term_definition(:lang => 'en',
|
327
|
-
:code => 'at0000')[
|
327
|
+
:code => 'at0000').items['text'].should == 'Summary'
|
328
328
|
end
|
329
329
|
|
330
330
|
it 'description term_definitions parsed and assigned properly' do
|
331
331
|
@archetype_ontology.term_definition(:lang => 'en',
|
332
|
-
:code => 'at0000')[
|
332
|
+
:code => 'at0000').items['description'].should ==
|
333
333
|
'A heading for conclusions and other evaluations'
|
334
334
|
end
|
335
335
|
|
@@ -5,11 +5,11 @@ include OpenEHR::RM::DataTypes::Text
|
|
5
5
|
describe TranslationDetails do
|
6
6
|
before(:each) do
|
7
7
|
language = stub(CodePhrase, :code_string => 'ja')
|
8
|
-
author = Hash['
|
8
|
+
author = Hash['name', 'Shinji KOBAYASHI']
|
9
9
|
@translation_details =
|
10
10
|
TranslationDetails.new(:language => language,
|
11
11
|
:author => author,
|
12
|
-
:accreditation => '
|
12
|
+
:accreditation => 'Japanese Medical license 333',
|
13
13
|
:other_details => {'ja' => 'Japanese'})
|
14
14
|
end
|
15
15
|
|
@@ -22,11 +22,11 @@ describe TranslationDetails do
|
|
22
22
|
end
|
23
23
|
|
24
24
|
it 'authour should be Shinji KOBAYASHI' do
|
25
|
-
@translation_details.author
|
25
|
+
@translation_details.author['name'].should == 'Shinji KOBAYASHI'
|
26
26
|
end
|
27
27
|
|
28
28
|
it 'accreditation should be skoba@moss.gr.jp' do
|
29
|
-
@translation_details.accreditation.should == '
|
29
|
+
@translation_details.accreditation.should == 'Japanese Medical license 333'
|
30
30
|
end
|
31
31
|
|
32
32
|
it 'other_details should ja, Japanese' do
|