open_ehr 0.9.5 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +3 -0
- data/README.rdoc +35 -25
- data/VERSION +1 -1
- data/lib/open_ehr.rb +2 -3
- data/lib/open_ehr/am.rb +1 -2
- data/lib/open_ehr/am/openehr_profile.rb +0 -1
- data/lib/open_ehr/am/openehr_profile/data_types.rb +2 -1
- data/lib/open_ehr/am/openehr_profile/data_types/basic.rb +88 -1
- data/lib/open_ehr/am/openehr_profile/data_types/quantity.rb +51 -2
- data/lib/open_ehr/am/openehr_profile/data_types/text.rb +2 -2
- data/lib/open_ehr/assumed_library_types.rb +5 -0
- data/lib/open_ehr/parser/adl.rb +5 -5
- data/lib/open_ehr/parser/adl_grammar.tt +13 -16
- data/lib/open_ehr/parser/adl_parser.rb +13 -5
- data/lib/open_ehr/parser/cadl_grammar.tt +247 -31
- data/lib/open_ehr/parser/cadl_node.rb +25 -0
- data/lib/open_ehr/parser/dadl_grammar.tt +6 -6
- data/lib/open_ehr/parser/shared_token_grammar.tt +14 -5
- data/lib/open_ehr/rm.rb +1 -2
- data/lib/open_ehr/rm/composition/content/entry.rb +8 -1
- data/lib/open_ehr/rm/data_types.rb +2 -2
- data/lib/open_ehr/rm/data_types/quantity.rb +1 -2
- data/lib/open_ehr/rm/data_types/quantity/date_time.rb +8 -5
- data/lib/open_ehr/rm/data_types/text.rb +7 -6
- data/lib/open_ehr/rm/support/identification.rb +13 -9
- data/open_ehr.gemspec +34 -4
- data/spec/lib/open_ehr/am/openehr_profile/data_types/basic/c_dv_state_spec.rb +34 -0
- data/spec/lib/open_ehr/am/openehr_profile/data_types/basic/non_terminal_state_spec.rb +36 -0
- data/spec/lib/open_ehr/am/openehr_profile/data_types/basic/state_machine_spec.rb +34 -0
- data/spec/lib/open_ehr/am/openehr_profile/data_types/basic/state_spec.rb +26 -0
- data/spec/lib/open_ehr/am/openehr_profile/data_types/basic/terminal_state_spec.rb +18 -0
- data/spec/lib/open_ehr/am/openehr_profile/data_types/basic/transition_spec.rb +62 -0
- data/spec/lib/open_ehr/am/openehr_profile/data_types/quantity/c_dv_ordinal_spec.rb +41 -0
- data/spec/lib/open_ehr/am/openehr_profile/data_types/quantity/c_dv_quantity_spec.rb +50 -0
- data/spec/lib/open_ehr/am/openehr_profile/data_types/quantity/c_quantity_item_spec.rb +46 -0
- data/spec/lib/open_ehr/am/openehr_profile/data_types/text/c_code_phrase_spec.rb +0 -1
- data/spec/lib/open_ehr/assumed_library_types/interval_spec.rb +5 -0
- data/spec/lib/open_ehr/parser/adl14/adl-test-composition.dv_coded_text.test.adl +1 -1
- data/spec/lib/open_ehr/parser/adl14/adl-test-entry.archetype_desc_missing_purpose.test.adl +1 -1
- data/spec/lib/open_ehr/parser/adl14/adl-test-entry.c_dv_ordinal.test.adl +1 -1
- data/spec/lib/open_ehr/parser/adl14/adl-test-entry.c_dv_quantity_empty.test.adl +1 -1
- data/spec/lib/open_ehr/parser/adl14/adl-test-entry.c_dv_quantity_full.test.adl +1 -1
- data/spec/lib/open_ehr/parser/adl14/adl-test-entry.c_dv_quantity_full2.test.adl +1 -1
- data/spec/lib/open_ehr/parser/adl14/adl-test-entry.c_dv_quantity_full3.test.adl +1 -1
- data/spec/lib/open_ehr/parser/adl14/adl-test-entry.c_dv_quantity_item_units_only.test.adl +1 -1
- data/spec/lib/open_ehr/parser/adl14/adl-test-entry.c_dv_quantity_list.test.adl +1 -1
- data/spec/lib/open_ehr/parser/adl14/adl-test-entry.c_dv_quantity_property.test.adl +1 -1
- data/spec/lib/open_ehr/parser/adl14/adl-test-entry.c_dv_quantity_reversed.test.adl +1 -1
- data/spec/lib/open_ehr/parser/adl14/adl-test-entry.constraint_binding.test.adl +1 -1
- data/spec/lib/open_ehr/parser/adl14/adl-test-entry.constraint_ref.test.adl +1 -1
- data/spec/lib/open_ehr/parser/adl14/adl-test-entry.empty_other_contributors.test.adl +1 -1
- data/spec/lib/open_ehr/parser/adl14/adl-test-entry.missing_language.test.adl +1 -1
- data/spec/lib/open_ehr/parser/adl14/adl-test-entry.mixed_node_types.draft.adl +1 -1
- data/spec/lib/open_ehr/parser/adl14/adl-test-entry.most_minimal.test.adl +1 -1
- data/spec/lib/open_ehr/parser/adl14/adl-test-entry.multi_language.test.adl +1 -1
- data/spec/lib/open_ehr/parser/adl14/adl-test-entry.special_string.test.adl +1 -1
- data/spec/lib/open_ehr/parser/adl14/adl-test-entry.structure_test1.test.adl +1 -1
- data/spec/lib/open_ehr/parser/adl14/adl-test-entry.structure_test2.test.adl +1 -1
- data/spec/lib/open_ehr/parser/adl14/adl-test-entry.term_binding.test.adl +1 -1
- data/spec/lib/open_ehr/parser/adl14/adl-test-entry.term_binding2.test.adl +1 -1
- data/spec/lib/open_ehr/parser/adl14/adl-test-entry.unicode_BOM_support.test.adl +1 -1
- data/spec/lib/open_ehr/parser/adl14/adl-test-entry.unicode_support.test.adl +1 -1
- data/spec/lib/open_ehr/parser/adl_archetype_ontology_binding_spec.rb +3 -3
- data/spec/lib/open_ehr/parser/c_dv_quantity_any_allowed_spec.rb +34 -0
- data/spec/lib/open_ehr/parser/c_dv_quantity_shared_example_for_lacked_items_spec.rb +36 -0
- data/spec/lib/open_ehr/parser/c_dv_quantity_shared_example_spec.rb +146 -0
- data/spec/lib/open_ehr/parser/cdv_ordinal_parse_spec.rb +231 -0
- data/spec/lib/open_ehr/parser/code_phrase_spec.rb +7 -2
- data/spec/lib/open_ehr/parser/constraint_binding_spec.rb +26 -0
- data/spec/lib/open_ehr/parser/constraint_ref_spec.rb +32 -0
- data/spec/lib/open_ehr/parser/dv_coded_text_parse_spec.rb +27 -0
- data/spec/lib/open_ehr/parser/empty_other_contributors_spec.rb +19 -0
- data/spec/lib/open_ehr/parser/missing_language_spec.rb +20 -0
- data/spec/lib/open_ehr/parser/missing_purpose_spec.rb +23 -0
- data/spec/lib/open_ehr/parser/mixed_node_types_spec.rb +16 -0
- data/spec/lib/open_ehr/parser/most_minimal_adl_spec.rb +19 -0
- data/spec/lib/open_ehr/parser/multi_language_spec.rb +58 -0
- data/spec/lib/open_ehr/parser/path_based_terminology_binding_spec.rb +30 -0
- data/spec/lib/open_ehr/parser/special_string_spec.rb +20 -0
- data/spec/lib/open_ehr/parser/structure_comment_spec.rb +21 -0
- data/spec/lib/open_ehr/parser/structure_nested_comments_spec.rb +22 -0
- data/spec/lib/open_ehr/parser/structure_spec.rb +202 -0
- data/spec/lib/open_ehr/parser/term_binding_spec.rb +54 -0
- data/spec/lib/open_ehr/parser/unicode_bom_spec.rb +17 -0
- data/spec/lib/open_ehr/parser/unicode_support_spec.rb +46 -0
- data/spec/lib/open_ehr/rm/common/change_control/imported_version_spec.rb +0 -1
- data/spec/lib/open_ehr/rm/common/change_control/original_version_spec.rb +2 -2
- data/spec/lib/open_ehr/rm/common/change_control/version_spec.rb +0 -1
- data/spec/lib/open_ehr/rm/common/change_control/versioned_object_spec.rb +0 -1
- data/spec/lib/open_ehr/rm/common/generic/revision_history_item_spec.rb +3 -3
- data/spec/lib/open_ehr/rm/composition/content/entry/entry_spec.rb +12 -2
- data/spec/lib/open_ehr/rm/data_types/quantity/date_time/dv_date_time_spec.rb +1 -0
- data/spec/lib/open_ehr/rm/data_types/quantity/date_time/{dv_tempral_spec.rb → dv_temporal_spec.rb} +1 -0
- data/spec/lib/open_ehr/rm/data_types/text/dv_text_spec.rb +25 -3
- data/spec/lib/open_ehr/rm/demographic/party_spec.rb +1 -3
- data/spec/lib/open_ehr/rm/support/identification/access_group_ref_spec.rb +2 -2
- data/spec/lib/open_ehr/rm/support/identification/object_version_id_spec.rb +3 -4
- metadata +69 -39
@@ -0,0 +1,36 @@
|
|
1
|
+
# ticket 174
|
2
|
+
require File.dirname(__FILE__) + '/../../../spec_helper'
|
3
|
+
require File.dirname(__FILE__) + '/parser_spec_helper'
|
4
|
+
require 'open_ehr/am/openehr_profile/data_types/quantity'
|
5
|
+
include ::OpenEHR::AM::OpenEHRProfile::DataTypes::Quantity
|
6
|
+
require 'open_ehr/rm/data_types/quantity'
|
7
|
+
include ::OpenEHR::RM::DataTypes::Quantity
|
8
|
+
|
9
|
+
shared_examples 'c_dv_quantity lacked items' do
|
10
|
+
it 'parsed to archetypes' do
|
11
|
+
archetype.should be_an_instance_of Archetype
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
describe 'items only with property' do
|
16
|
+
it_behaves_like 'c_dv_quantity lacked items' do
|
17
|
+
let(:archetype) {adl14_archetype('adl-test-entry.c_dv_quantity_property.test.adl')}
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
describe 'items only with list' do
|
22
|
+
it_behaves_like 'c_dv_quantity lacked items' do
|
23
|
+
let(:archetype) {adl14_archetype('adl-test-entry.c_dv_quantity_list.test.adl')}
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
describe 'reversed items' do
|
28
|
+
it_behaves_like 'c_dv_quantity lacked items' do
|
29
|
+
let(:archetype) {adl14_archetype('adl-test-entry.c_dv_quantity_reversed.test.adl')}
|
30
|
+
end
|
31
|
+
end
|
32
|
+
describe 'units only' do
|
33
|
+
it_behaves_like 'c_dv_quantity lacked items' do
|
34
|
+
let(:archetype) {adl14_archetype('adl-test-entry.c_dv_quantity_item_units_only.test.adl')}
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,146 @@
|
|
1
|
+
# ticket 174
|
2
|
+
require File.dirname(__FILE__) + '/../../../spec_helper'
|
3
|
+
require File.dirname(__FILE__) + '/parser_spec_helper'
|
4
|
+
require 'open_ehr/am/openehr_profile/data_types/quantity'
|
5
|
+
include ::OpenEHR::AM::OpenEHRProfile::DataTypes::Quantity
|
6
|
+
require 'open_ehr/rm/data_types/quantity'
|
7
|
+
include ::OpenEHR::RM::DataTypes::Quantity
|
8
|
+
|
9
|
+
shared_examples 'c_dv_quantity' do
|
10
|
+
context 'CDvQuantity item order change' do
|
11
|
+
before(:all) do
|
12
|
+
@c_dv_quantity = archetype.definition.attributes[0].children[0].attributes[0].children[0].attributes[0].children[0]
|
13
|
+
end
|
14
|
+
|
15
|
+
it 'is an instance of CDvQuantity' do
|
16
|
+
@c_dv_quantity.should be_an_instance_of CDvQuantity
|
17
|
+
end
|
18
|
+
|
19
|
+
context 'property' do
|
20
|
+
before(:all) do
|
21
|
+
@property = @c_dv_quantity.property
|
22
|
+
end
|
23
|
+
|
24
|
+
it 'property should not be nil' do
|
25
|
+
@property.should_not be_nil
|
26
|
+
end
|
27
|
+
|
28
|
+
it 'property terminology id should openehr' do
|
29
|
+
@property.terminology_id.name.should == 'openehr'
|
30
|
+
end
|
31
|
+
|
32
|
+
it 'property code_string is 128' do
|
33
|
+
@property.code_string.should == '128'
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
context 'item list' do
|
38
|
+
before(:all) do
|
39
|
+
@list = @c_dv_quantity.list
|
40
|
+
end
|
41
|
+
|
42
|
+
it 'size is 2' do
|
43
|
+
@list.size.should be 2
|
44
|
+
end
|
45
|
+
|
46
|
+
context 'first item' do
|
47
|
+
before(:all) do
|
48
|
+
@first = @list[0]
|
49
|
+
end
|
50
|
+
|
51
|
+
it 'first is an isntance of CQuantityItem' do
|
52
|
+
@first.should be_an_instance_of CQuantityItem
|
53
|
+
end
|
54
|
+
it 'units is yr' do
|
55
|
+
@first.units.should == 'yr'
|
56
|
+
end
|
57
|
+
|
58
|
+
it 'magnitude lower is 0.0' do
|
59
|
+
@first.magnitude.lower.should == 0.0
|
60
|
+
end
|
61
|
+
|
62
|
+
it 'magnitude upper is 200.0' do
|
63
|
+
@first.magnitude.upper.should == 200.0
|
64
|
+
end
|
65
|
+
|
66
|
+
it 'precision upper is 2' do
|
67
|
+
@first.precision.upper.should be 2
|
68
|
+
end
|
69
|
+
|
70
|
+
it 'precision lower is 2, too' do
|
71
|
+
@first.precision.lower.should be 2
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
context 'secocond item' do
|
76
|
+
before(:all) do
|
77
|
+
@second = @list[1]
|
78
|
+
end
|
79
|
+
|
80
|
+
it 'is an instance of CQuantityItem' do
|
81
|
+
@second.should be_an_instance_of CQuantityItem
|
82
|
+
end
|
83
|
+
|
84
|
+
it 'unit is mth' do
|
85
|
+
@second.units.should == 'mth'
|
86
|
+
end
|
87
|
+
|
88
|
+
it 'magnitude lower is 1.0' do
|
89
|
+
@second.magnitude.lower.should == 1.0
|
90
|
+
end
|
91
|
+
|
92
|
+
it 'magnitude upper is 36.0' do
|
93
|
+
@second.magnitude.upper.should == 36.0
|
94
|
+
end
|
95
|
+
|
96
|
+
it 'precision upper is 2' do
|
97
|
+
@second.precision.upper.should == 2
|
98
|
+
end
|
99
|
+
|
100
|
+
it 'precision lower is 2' do
|
101
|
+
@second.precision.lower.should == 2
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
105
|
+
context 'assumed value' do
|
106
|
+
before(:all) do
|
107
|
+
@assumed_value = @c_dv_quantity.assumed_value
|
108
|
+
end
|
109
|
+
|
110
|
+
it 'is an instance of CQuantityItem' do
|
111
|
+
@assumed_value.should be_an_instance_of DvQuantity
|
112
|
+
end
|
113
|
+
|
114
|
+
it 'units is yr' do
|
115
|
+
@assumed_value.units.should == 'yr'
|
116
|
+
end
|
117
|
+
|
118
|
+
it 'magnitude is 8.0' do
|
119
|
+
@assumed_value.magnitude.should == 8.0
|
120
|
+
end
|
121
|
+
|
122
|
+
it 'precision is 2' do
|
123
|
+
@assumed_value.precision.should be 2
|
124
|
+
end
|
125
|
+
end
|
126
|
+
end
|
127
|
+
end
|
128
|
+
end
|
129
|
+
|
130
|
+
describe 'items start with property' do
|
131
|
+
it_behaves_like 'c_dv_quantity' do
|
132
|
+
let(:archetype) {adl14_archetype('adl-test-entry.c_dv_quantity_full.test.adl')}
|
133
|
+
end
|
134
|
+
end
|
135
|
+
|
136
|
+
describe 'items start with list' do
|
137
|
+
it_behaves_like 'c_dv_quantity' do
|
138
|
+
let(:archetype) {adl14_archetype('adl-test-entry.c_dv_quantity_full2.test.adl')}
|
139
|
+
end
|
140
|
+
end
|
141
|
+
|
142
|
+
describe 'items start with assumed_value' do
|
143
|
+
it_behaves_like 'c_dv_quantity' do
|
144
|
+
let(:archetype) {adl14_archetype('adl-test-entry.c_dv_quantity_full3.test.adl')}
|
145
|
+
end
|
146
|
+
end
|
@@ -0,0 +1,231 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../../../spec_helper'
|
2
|
+
require File.dirname(__FILE__) + '/parser_spec_helper'
|
3
|
+
require 'open_ehr/am/openehr_profile/data_types/quantity'
|
4
|
+
include OpenEHR::AM::OpenEHRProfile::DataTypes::Quantity
|
5
|
+
|
6
|
+
describe ADLParser do
|
7
|
+
describe CDvOrdinal do
|
8
|
+
before(:all) do
|
9
|
+
archetype = adl14_archetype('adl-test-entry.c_dv_ordinal.test.adl')
|
10
|
+
@attributes = archetype.definition.attributes
|
11
|
+
end
|
12
|
+
|
13
|
+
def attr(index)
|
14
|
+
return @attributes[0].children[0].attributes[0].children[index-1].attributes[0].children[0]
|
15
|
+
end
|
16
|
+
|
17
|
+
context '1st ordinals' do
|
18
|
+
before(:all) do
|
19
|
+
@at = attr(1)
|
20
|
+
end
|
21
|
+
|
22
|
+
it 'is an instance of CDvOrdinal' do
|
23
|
+
@at.should be_an_instance_of CDvOrdinal
|
24
|
+
end
|
25
|
+
|
26
|
+
context '1st item' do
|
27
|
+
before(:all) do
|
28
|
+
@item = @at.list[0]
|
29
|
+
end
|
30
|
+
|
31
|
+
it 'value is 0' do
|
32
|
+
@item.value.should be 0
|
33
|
+
end
|
34
|
+
|
35
|
+
it 'symbol value is local::at0003.0]' do
|
36
|
+
@item.symbol.value.should == '[local::at0003.0]'
|
37
|
+
end
|
38
|
+
|
39
|
+
it 'defining code terminology is local' do
|
40
|
+
@item.symbol.defining_code.terminology_id.value.should == 'local'
|
41
|
+
end
|
42
|
+
|
43
|
+
it 'defining code string is at0003.0' do
|
44
|
+
@item.symbol.defining_code.code_string.should == 'at0003.0'
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
context '2nd item' do
|
49
|
+
before(:all) do
|
50
|
+
@item = @at.list[1]
|
51
|
+
end
|
52
|
+
|
53
|
+
it 'value is 1' do
|
54
|
+
@item.value.should be 1
|
55
|
+
end
|
56
|
+
|
57
|
+
it 'symbol value is local::at0003.1' do
|
58
|
+
@item.symbol.value.should == '[local::at0003.1]'
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
context '3nd item' do
|
63
|
+
before(:all) do
|
64
|
+
@item = @at.list[2]
|
65
|
+
end
|
66
|
+
|
67
|
+
it 'value is 2' do
|
68
|
+
@item.value.should be 2
|
69
|
+
end
|
70
|
+
|
71
|
+
it 'symbol value is local::at0003.2' do
|
72
|
+
@item.symbol.value.should == '[local::at0003.2]'
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
context '4th item' do
|
77
|
+
before(:all) do
|
78
|
+
@item = @at.list[3]
|
79
|
+
end
|
80
|
+
|
81
|
+
it 'value is 3' do
|
82
|
+
@item.value.should be 3
|
83
|
+
end
|
84
|
+
|
85
|
+
it 'symbol value is local::at0003.3' do
|
86
|
+
@item.symbol.value.should == '[local::at0003.3]'
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
context '5th item' do
|
91
|
+
before(:all) do
|
92
|
+
@item = @at.list[4]
|
93
|
+
end
|
94
|
+
|
95
|
+
it 'value is 4' do
|
96
|
+
@item.value.should be 4
|
97
|
+
end
|
98
|
+
|
99
|
+
it 'symbol value is local::at0003.4' do
|
100
|
+
@item.symbol.value.should == '[local::at0003.4]'
|
101
|
+
end
|
102
|
+
end
|
103
|
+
|
104
|
+
context '6th item' do
|
105
|
+
before(:all) do
|
106
|
+
@item = @at.list[5]
|
107
|
+
end
|
108
|
+
|
109
|
+
it 'item is nil' do
|
110
|
+
@item.should be_nil
|
111
|
+
end
|
112
|
+
end
|
113
|
+
end
|
114
|
+
|
115
|
+
context '2nd ordinals chunk' do
|
116
|
+
before(:all) do
|
117
|
+
@at = attr(2)
|
118
|
+
end
|
119
|
+
|
120
|
+
it 'is an instance of CDvOrdinal' do
|
121
|
+
@at.should be_an_instance_of CDvOrdinal
|
122
|
+
end
|
123
|
+
|
124
|
+
context '1st item' do
|
125
|
+
before(:all) do
|
126
|
+
@item = @at.list[0]
|
127
|
+
end
|
128
|
+
|
129
|
+
it 'value is 0' do
|
130
|
+
@item.value.should be 0
|
131
|
+
end
|
132
|
+
|
133
|
+
it 'symbol value is local::at0003.0]' do
|
134
|
+
@item.symbol.value.should == '[local::at0003.0]'
|
135
|
+
end
|
136
|
+
|
137
|
+
it 'defining code terminology is local' do
|
138
|
+
@item.symbol.defining_code.terminology_id.value.should == 'local'
|
139
|
+
end
|
140
|
+
|
141
|
+
it 'defining code string is at0003.0' do
|
142
|
+
@item.symbol.defining_code.code_string.should == 'at0003.0'
|
143
|
+
end
|
144
|
+
end
|
145
|
+
|
146
|
+
context '2nd item' do
|
147
|
+
before(:all) do
|
148
|
+
@item = @at.list[1]
|
149
|
+
end
|
150
|
+
|
151
|
+
it 'value is 1' do
|
152
|
+
@item.value.should be 1
|
153
|
+
end
|
154
|
+
|
155
|
+
it 'symbol value is local::at0003.1' do
|
156
|
+
@item.symbol.value.should == '[local::at0003.1]'
|
157
|
+
end
|
158
|
+
end
|
159
|
+
|
160
|
+
context '3nd item' do
|
161
|
+
before(:all) do
|
162
|
+
@item = @at.list[2]
|
163
|
+
end
|
164
|
+
|
165
|
+
it 'value is 2' do
|
166
|
+
@item.value.should be 2
|
167
|
+
end
|
168
|
+
|
169
|
+
it 'symbol value is local::at0003.2' do
|
170
|
+
@item.symbol.value.should == '[local::at0003.2]'
|
171
|
+
end
|
172
|
+
end
|
173
|
+
|
174
|
+
context '4th item' do
|
175
|
+
before(:all) do
|
176
|
+
@item = @at.list[3]
|
177
|
+
end
|
178
|
+
|
179
|
+
it 'value is 3' do
|
180
|
+
@item.value.should be 3
|
181
|
+
end
|
182
|
+
|
183
|
+
it 'symbol value is local::at0003.3' do
|
184
|
+
@item.symbol.value.should == '[local::at0003.3]'
|
185
|
+
end
|
186
|
+
end
|
187
|
+
|
188
|
+
context '5th item' do
|
189
|
+
before(:all) do
|
190
|
+
@item = @at.list[4]
|
191
|
+
end
|
192
|
+
|
193
|
+
it 'value is 3' do
|
194
|
+
@item.value.should be 4
|
195
|
+
end
|
196
|
+
|
197
|
+
it 'symbol value is local::at0003.4' do
|
198
|
+
@item.symbol.value.should == '[local::at0003.4]'
|
199
|
+
end
|
200
|
+
end
|
201
|
+
|
202
|
+
context '6th item' do
|
203
|
+
before(:all) do
|
204
|
+
@item = @at.list[5]
|
205
|
+
end
|
206
|
+
|
207
|
+
it 'item is nil' do
|
208
|
+
@item.should be_nil
|
209
|
+
end
|
210
|
+
end
|
211
|
+
|
212
|
+
it 'has assumed value' do
|
213
|
+
@at.should have_assumed_value
|
214
|
+
end
|
215
|
+
|
216
|
+
it 'assumed_value is 0' do
|
217
|
+
@at.assumed_value.should be 0
|
218
|
+
end
|
219
|
+
end
|
220
|
+
|
221
|
+
context '3rd ordinal is any allowed' do
|
222
|
+
before(:all) do
|
223
|
+
@at = attr(3)
|
224
|
+
end
|
225
|
+
|
226
|
+
it 'is any allowed' do
|
227
|
+
@at.should be_any_allowed
|
228
|
+
end
|
229
|
+
end
|
230
|
+
end
|
231
|
+
end
|
@@ -1,10 +1,11 @@
|
|
1
1
|
require File.dirname(__FILE__) + '/../../../spec_helper'
|
2
2
|
require File.dirname(__FILE__) + '/parser_spec_helper'
|
3
|
-
|
3
|
+
require 'open_ehr/am/openehr_profile/data_types/text'
|
4
|
+
include ::OpenEHR::AM::OpenEHRProfile::DataTypes::Text
|
4
5
|
# ticket 171
|
5
6
|
|
6
7
|
describe ADLParser do
|
7
|
-
context '
|
8
|
+
context 'CCodePhase type' do
|
8
9
|
before(:all) do
|
9
10
|
archetype = adl14_archetype('adl-test-entry.c_code_phrase.test.adl')
|
10
11
|
@attributes = archetype.definition.attributes
|
@@ -19,6 +20,10 @@ describe ADLParser do
|
|
19
20
|
@at = attr(1)
|
20
21
|
end
|
21
22
|
|
23
|
+
it 'at is an instance of CCodePhrase' do
|
24
|
+
@at.should be_an_instance_of CCodePhrase
|
25
|
+
end
|
26
|
+
|
22
27
|
it 'terminology id is icd10' do
|
23
28
|
@at.terminology_id.value.should == 'icd10'
|
24
29
|
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# ticket #175
|
2
|
+
require File.dirname(__FILE__) + '/../../../spec_helper'
|
3
|
+
require File.dirname(__FILE__) + '/parser_spec_helper'
|
4
|
+
|
5
|
+
describe ADLParser do
|
6
|
+
context 'Constraint Bindings' do
|
7
|
+
before(:all) do
|
8
|
+
at = adl14_archetype('adl-test-entry.constraint_binding.test.adl')
|
9
|
+
@ao = at.ontology
|
10
|
+
end
|
11
|
+
|
12
|
+
it 'contraint bindings size is two' do
|
13
|
+
@ao.constraint_bindings.size.should be 2
|
14
|
+
end
|
15
|
+
|
16
|
+
it 'SNOMED_CT binds local ac0001 to http://terminology.org/?terminology_id=snomed_ct&&has_relation=102002;with_target=128004' do
|
17
|
+
@ao.constraint_binding(:terminology => 'SNOMED_CT', :code => 'ac0001').
|
18
|
+
value.should == 'http://terminology.org/?terminology_id=snomed_ct&&has_relation=102002;with_target=128004'
|
19
|
+
end
|
20
|
+
|
21
|
+
it 'ICD10 binds local ac0001 to http://terminology.org/?terminology_id=icd10&&has_relation=a2;with_target=b19' do
|
22
|
+
@ao.constraint_binding(:terminology => 'ICD10', :code => 'ac0001').
|
23
|
+
value.should == 'http://terminology.org/?terminology_id=icd10&&has_relation=a2;with_target=b19'
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|