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.
Files changed (98) hide show
  1. data/History.txt +3 -0
  2. data/README.rdoc +35 -25
  3. data/VERSION +1 -1
  4. data/lib/open_ehr.rb +2 -3
  5. data/lib/open_ehr/am.rb +1 -2
  6. data/lib/open_ehr/am/openehr_profile.rb +0 -1
  7. data/lib/open_ehr/am/openehr_profile/data_types.rb +2 -1
  8. data/lib/open_ehr/am/openehr_profile/data_types/basic.rb +88 -1
  9. data/lib/open_ehr/am/openehr_profile/data_types/quantity.rb +51 -2
  10. data/lib/open_ehr/am/openehr_profile/data_types/text.rb +2 -2
  11. data/lib/open_ehr/assumed_library_types.rb +5 -0
  12. data/lib/open_ehr/parser/adl.rb +5 -5
  13. data/lib/open_ehr/parser/adl_grammar.tt +13 -16
  14. data/lib/open_ehr/parser/adl_parser.rb +13 -5
  15. data/lib/open_ehr/parser/cadl_grammar.tt +247 -31
  16. data/lib/open_ehr/parser/cadl_node.rb +25 -0
  17. data/lib/open_ehr/parser/dadl_grammar.tt +6 -6
  18. data/lib/open_ehr/parser/shared_token_grammar.tt +14 -5
  19. data/lib/open_ehr/rm.rb +1 -2
  20. data/lib/open_ehr/rm/composition/content/entry.rb +8 -1
  21. data/lib/open_ehr/rm/data_types.rb +2 -2
  22. data/lib/open_ehr/rm/data_types/quantity.rb +1 -2
  23. data/lib/open_ehr/rm/data_types/quantity/date_time.rb +8 -5
  24. data/lib/open_ehr/rm/data_types/text.rb +7 -6
  25. data/lib/open_ehr/rm/support/identification.rb +13 -9
  26. data/open_ehr.gemspec +34 -4
  27. data/spec/lib/open_ehr/am/openehr_profile/data_types/basic/c_dv_state_spec.rb +34 -0
  28. data/spec/lib/open_ehr/am/openehr_profile/data_types/basic/non_terminal_state_spec.rb +36 -0
  29. data/spec/lib/open_ehr/am/openehr_profile/data_types/basic/state_machine_spec.rb +34 -0
  30. data/spec/lib/open_ehr/am/openehr_profile/data_types/basic/state_spec.rb +26 -0
  31. data/spec/lib/open_ehr/am/openehr_profile/data_types/basic/terminal_state_spec.rb +18 -0
  32. data/spec/lib/open_ehr/am/openehr_profile/data_types/basic/transition_spec.rb +62 -0
  33. data/spec/lib/open_ehr/am/openehr_profile/data_types/quantity/c_dv_ordinal_spec.rb +41 -0
  34. data/spec/lib/open_ehr/am/openehr_profile/data_types/quantity/c_dv_quantity_spec.rb +50 -0
  35. data/spec/lib/open_ehr/am/openehr_profile/data_types/quantity/c_quantity_item_spec.rb +46 -0
  36. data/spec/lib/open_ehr/am/openehr_profile/data_types/text/c_code_phrase_spec.rb +0 -1
  37. data/spec/lib/open_ehr/assumed_library_types/interval_spec.rb +5 -0
  38. data/spec/lib/open_ehr/parser/adl14/adl-test-composition.dv_coded_text.test.adl +1 -1
  39. data/spec/lib/open_ehr/parser/adl14/adl-test-entry.archetype_desc_missing_purpose.test.adl +1 -1
  40. data/spec/lib/open_ehr/parser/adl14/adl-test-entry.c_dv_ordinal.test.adl +1 -1
  41. data/spec/lib/open_ehr/parser/adl14/adl-test-entry.c_dv_quantity_empty.test.adl +1 -1
  42. data/spec/lib/open_ehr/parser/adl14/adl-test-entry.c_dv_quantity_full.test.adl +1 -1
  43. data/spec/lib/open_ehr/parser/adl14/adl-test-entry.c_dv_quantity_full2.test.adl +1 -1
  44. data/spec/lib/open_ehr/parser/adl14/adl-test-entry.c_dv_quantity_full3.test.adl +1 -1
  45. data/spec/lib/open_ehr/parser/adl14/adl-test-entry.c_dv_quantity_item_units_only.test.adl +1 -1
  46. data/spec/lib/open_ehr/parser/adl14/adl-test-entry.c_dv_quantity_list.test.adl +1 -1
  47. data/spec/lib/open_ehr/parser/adl14/adl-test-entry.c_dv_quantity_property.test.adl +1 -1
  48. data/spec/lib/open_ehr/parser/adl14/adl-test-entry.c_dv_quantity_reversed.test.adl +1 -1
  49. data/spec/lib/open_ehr/parser/adl14/adl-test-entry.constraint_binding.test.adl +1 -1
  50. data/spec/lib/open_ehr/parser/adl14/adl-test-entry.constraint_ref.test.adl +1 -1
  51. data/spec/lib/open_ehr/parser/adl14/adl-test-entry.empty_other_contributors.test.adl +1 -1
  52. data/spec/lib/open_ehr/parser/adl14/adl-test-entry.missing_language.test.adl +1 -1
  53. data/spec/lib/open_ehr/parser/adl14/adl-test-entry.mixed_node_types.draft.adl +1 -1
  54. data/spec/lib/open_ehr/parser/adl14/adl-test-entry.most_minimal.test.adl +1 -1
  55. data/spec/lib/open_ehr/parser/adl14/adl-test-entry.multi_language.test.adl +1 -1
  56. data/spec/lib/open_ehr/parser/adl14/adl-test-entry.special_string.test.adl +1 -1
  57. data/spec/lib/open_ehr/parser/adl14/adl-test-entry.structure_test1.test.adl +1 -1
  58. data/spec/lib/open_ehr/parser/adl14/adl-test-entry.structure_test2.test.adl +1 -1
  59. data/spec/lib/open_ehr/parser/adl14/adl-test-entry.term_binding.test.adl +1 -1
  60. data/spec/lib/open_ehr/parser/adl14/adl-test-entry.term_binding2.test.adl +1 -1
  61. data/spec/lib/open_ehr/parser/adl14/adl-test-entry.unicode_BOM_support.test.adl +1 -1
  62. data/spec/lib/open_ehr/parser/adl14/adl-test-entry.unicode_support.test.adl +1 -1
  63. data/spec/lib/open_ehr/parser/adl_archetype_ontology_binding_spec.rb +3 -3
  64. data/spec/lib/open_ehr/parser/c_dv_quantity_any_allowed_spec.rb +34 -0
  65. data/spec/lib/open_ehr/parser/c_dv_quantity_shared_example_for_lacked_items_spec.rb +36 -0
  66. data/spec/lib/open_ehr/parser/c_dv_quantity_shared_example_spec.rb +146 -0
  67. data/spec/lib/open_ehr/parser/cdv_ordinal_parse_spec.rb +231 -0
  68. data/spec/lib/open_ehr/parser/code_phrase_spec.rb +7 -2
  69. data/spec/lib/open_ehr/parser/constraint_binding_spec.rb +26 -0
  70. data/spec/lib/open_ehr/parser/constraint_ref_spec.rb +32 -0
  71. data/spec/lib/open_ehr/parser/dv_coded_text_parse_spec.rb +27 -0
  72. data/spec/lib/open_ehr/parser/empty_other_contributors_spec.rb +19 -0
  73. data/spec/lib/open_ehr/parser/missing_language_spec.rb +20 -0
  74. data/spec/lib/open_ehr/parser/missing_purpose_spec.rb +23 -0
  75. data/spec/lib/open_ehr/parser/mixed_node_types_spec.rb +16 -0
  76. data/spec/lib/open_ehr/parser/most_minimal_adl_spec.rb +19 -0
  77. data/spec/lib/open_ehr/parser/multi_language_spec.rb +58 -0
  78. data/spec/lib/open_ehr/parser/path_based_terminology_binding_spec.rb +30 -0
  79. data/spec/lib/open_ehr/parser/special_string_spec.rb +20 -0
  80. data/spec/lib/open_ehr/parser/structure_comment_spec.rb +21 -0
  81. data/spec/lib/open_ehr/parser/structure_nested_comments_spec.rb +22 -0
  82. data/spec/lib/open_ehr/parser/structure_spec.rb +202 -0
  83. data/spec/lib/open_ehr/parser/term_binding_spec.rb +54 -0
  84. data/spec/lib/open_ehr/parser/unicode_bom_spec.rb +17 -0
  85. data/spec/lib/open_ehr/parser/unicode_support_spec.rb +46 -0
  86. data/spec/lib/open_ehr/rm/common/change_control/imported_version_spec.rb +0 -1
  87. data/spec/lib/open_ehr/rm/common/change_control/original_version_spec.rb +2 -2
  88. data/spec/lib/open_ehr/rm/common/change_control/version_spec.rb +0 -1
  89. data/spec/lib/open_ehr/rm/common/change_control/versioned_object_spec.rb +0 -1
  90. data/spec/lib/open_ehr/rm/common/generic/revision_history_item_spec.rb +3 -3
  91. data/spec/lib/open_ehr/rm/composition/content/entry/entry_spec.rb +12 -2
  92. data/spec/lib/open_ehr/rm/data_types/quantity/date_time/dv_date_time_spec.rb +1 -0
  93. data/spec/lib/open_ehr/rm/data_types/quantity/date_time/{dv_tempral_spec.rb → dv_temporal_spec.rb} +1 -0
  94. data/spec/lib/open_ehr/rm/data_types/text/dv_text_spec.rb +25 -3
  95. data/spec/lib/open_ehr/rm/demographic/party_spec.rb +1 -3
  96. data/spec/lib/open_ehr/rm/support/identification/access_group_ref_spec.rb +2 -2
  97. data/spec/lib/open_ehr/rm/support/identification/object_version_id_spec.rb +3 -4
  98. metadata +69 -39
@@ -1072,9 +1072,12 @@ module OpenEHR
1072
1072
  end
1073
1073
 
1074
1074
  rule V_QUALIFIED_TERM_CODE_REF
1075
- '[' qtc:(NAMECHAR_PAREN+ '::' NAMECHAR+) ']' {
1075
+ '[' ti:(NAMECHAR_PAREN+) '::' cs:(NAMECHAR+) ']' {
1076
1076
  def value
1077
- qtc.text_value
1077
+ term_id = OpenEHR::RM::Support::Identification::TerminologyID.new(
1078
+ :value => ti.text_value)
1079
+ OpenEHR::RM::DataTypes::Text::CodePhrase.new(
1080
+ :terminology_id => term_id, :code_string => cs.text_value)
1078
1081
  end
1079
1082
  }
1080
1083
  end
@@ -1125,7 +1128,13 @@ module OpenEHR
1125
1128
  end
1126
1129
 
1127
1130
  rule V_ISO8601_DURATION
1128
- 'P' ([0-9]+ [yY])? ([0-9]+ [mM])? ([0-9]+ [wW])? ([0-9]+ [dD])? ('T' ([0-9]+ [hH])? ([0-9]+ [mM])? ([0-9]+ ('.' [0-9]+)? [sS])?)?
1131
+ 'P' ([0-9]+ [yY])? ([0-9]+ [mM])? ([0-9]+ [wW])? ([0-9]+ [dD])? 'T' ([0-9]+ [hH]) ([0-9]+ [mM])? ([0-9]+ ('.' [0-9]+)? [sS])?
1132
+ / 'P' ([0-9]+ [yY])? ([0-9]+ [mM])? ([0-9]+ [wW])? ([0-9]+ [dD])? 'T' ([0-9]+ [hH])? ([0-9]+ [mM]) ([0-9]+ ('.' [0-9]+)? [sS])?
1133
+ / 'P' ([0-9]+ [yY])? ([0-9]+ [mM])? ([0-9]+ [wW])? ([0-9]+ [dD])? 'T' ([0-9]+ [hH])? ([0-9]+ [mM])? ([0-9]+ ('.' [0-9]+)? [sS])?
1134
+ / 'P' ([0-9]+ [yY]) ([0-9]+ [mM])? ([0-9]+ [wW])? ([0-9]+ [dD])?
1135
+ / 'P' ([0-9]+ [yY])? ([0-9]+ [mM]) ([0-9]+ [wW])? ([0-9]+ [dD])?
1136
+ / 'P' ([0-9]+ [yY])? ([0-9]+ [mM])? ([0-9]+ [wW]) ([0-9]+ [dD])?
1137
+ / 'P' ([0-9]+ [yY])? ([0-9]+ [mM])? ([0-9]+ [wW])? ([0-9]+ [dD])
1129
1138
  end
1130
1139
 
1131
1140
  rule V_ISO8601_DATE_CONSTRAINT_PATTERN
@@ -1209,9 +1218,9 @@ module OpenEHR
1209
1218
  end
1210
1219
 
1211
1220
  rule V_STRING
1212
- '"' str:((!'"' . / '\"')*) '"' {
1221
+ '"' str:(('\"' / !'"' .)*) '"' {
1213
1222
  def value
1214
- str.text_value
1223
+ str.text_value.tr_s('\\\\', '\\')
1215
1224
  end
1216
1225
  }
1217
1226
  end
@@ -1,5 +1,4 @@
1
- $:.unshift(File.dirname(__FILE__)) unless
2
- $:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
1
+ $:.unshift(File.dirname(__FILE__))
3
2
 
4
3
  module OpenEHR
5
4
  module RM
@@ -3,6 +3,7 @@
3
3
  # http://www.openehr.org/uml/release-1.0.1/Browsable/_9_0_76d0249_1109264528523_312165_346Report.html
4
4
  # refs #56
5
5
  include OpenEHR::RM::Composition::Content
6
+ require 'locale/info'
6
7
 
7
8
  module OpenEHR
8
9
  module RM
@@ -24,11 +25,17 @@ module OpenEHR
24
25
 
25
26
  def language=(language)
26
27
  raise ArgumentError, 'language is mandatory' if language.nil?
28
+ unless Locale::Info.language_code? language.code_string
29
+ raise ArgumentError, 'language code is invalid'
30
+ end
27
31
  @language = language
28
32
  end
29
33
 
30
34
  def encoding=(encoding)
31
- raise ArgumentError, 'encoding is mandatory' if encoding.nil?
35
+ if encoding.nil?
36
+ raise ArgumentError, 'encoding is mandatory'
37
+ end
38
+ Encoding.find(encoding.code_string)
32
39
  @encoding = encoding
33
40
  end
34
41
 
@@ -1,5 +1,5 @@
1
- $:.unshift(File.dirname(__FILE__)) unless
2
- $:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
1
+ $:.unshift(File.dirname(__FILE__))
2
+
3
3
  module OpenEHR
4
4
  module RM
5
5
  module DataTypes
@@ -1,5 +1,4 @@
1
- $:.unshift(File.dirname(__FILE__)) unless
2
- $:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
1
+ $:.unshift(File.dirname(__FILE__))
3
2
  # This modules are implemented from the UML shown bellow
4
3
  # http://www.openehr.org/uml/release-1.0.1/Browsable/_9_0_76d0249_1109599337877_94556_1510Report.html
5
4
  # Ticket refs #50
@@ -1,16 +1,17 @@
1
1
  # This module is implementation of the UML:
2
2
  # http://www.openehr.org/uml/release-1.0.1/Browsable/_9_0_76d0249_1109696321450_28117_5362Report.html
3
3
  # Ticket refs #49
4
- #require 'assumed_library_types'
4
+ require 'open_ehr/assumed_library_types'
5
5
  require 'date'
6
- include OpenEHR::RM::DataTypes::Quantity
7
- include OpenEHR::AssumedLibraryTypes
6
+ require 'open_ehr/rm/data_types/quantity'
8
7
 
9
8
  module OpenEHR
10
9
  module RM
11
10
  module DataTypes
12
11
  module Quantity
13
12
  module DateTime
13
+ include OpenEHR::RM::DataTypes::Quantity
14
+
14
15
  class DvTemporal < DvAbsoluteQuantity
15
16
  def initialize(args = {})
16
17
  self.value = args[:value]
@@ -32,7 +33,8 @@ module OpenEHR
32
33
  end
33
34
 
34
35
  class DvDate < DvTemporal
35
- include ISO8601DateModule
36
+ include OpenEHR::AssumedLibraryTypes::ISO8601DateModule
37
+ include OpenEHR::AssumedLibraryTypes
36
38
 
37
39
  DAYS_IN_MONTH = [0,31,28,31,30,31,30,31,31,30,31,30,31]
38
40
 
@@ -87,6 +89,7 @@ module OpenEHR
87
89
  end
88
90
 
89
91
  class DvTime < DvTemporal
92
+ include OpenEHR::AssumedLibraryTypes
90
93
  include ISO8601TimeModule
91
94
 
92
95
  def value=(value)
@@ -193,7 +196,7 @@ module OpenEHR
193
196
  end
194
197
 
195
198
  class DvDuration < DvTemporal
196
- include AssumedLibraryTypes::ISO8601DurationModule
199
+ include OpenEHR::AssumedLibraryTypes::ISO8601DurationModule
197
200
  attr_reader :value
198
201
 
199
202
  def initialize(args = { })
@@ -83,6 +83,7 @@ module OpenEHR
83
83
  class DvText < OpenEHR::RM::DataTypes::Basic::DataValue
84
84
  attr_reader :formatting, :hyperlink, :mappings,
85
85
  :language, :encoding
86
+ attr_accessor :hyperlink
86
87
 
87
88
  def initialize(args = {})
88
89
  super(args)
@@ -90,6 +91,7 @@ module OpenEHR
90
91
  self.encoding = args[:encoding]
91
92
  self.mappings = args[:mappings]
92
93
  self.language = args[:language]
94
+ self.hyperlink = args[:hyperlink]
93
95
  end
94
96
 
95
97
  def value=(value)
@@ -114,17 +116,16 @@ module OpenEHR
114
116
  end
115
117
  @encoding = encoding
116
118
  end
119
+
117
120
  def mappings=(mappings)
118
- if !mappings.nil? and !mappings.instance_of? Set
119
- raise ArgumentError, "mapping(s) is(are) not valid"
120
- elsif !mappings.nil? and mappings.instance_of? Set and
121
- mappings.empty?
122
- raise ArgumentError, "mapping(s) is(are) not valid"
121
+ if !mappings.nil? && mappings.empty?
122
+ raise ArgumentError, 'mappings should not be empty'
123
123
  end
124
124
  @mappings = mappings
125
125
  end
126
+
126
127
  def language=(language)
127
- if !@language.nil? and language.empty?
128
+ if !language.nil? and language.code_string.empty?
128
129
  raise ArgumentError, "langage is not valid"
129
130
  end
130
131
  @language = language
@@ -18,8 +18,8 @@ module OpenEHR
18
18
  @value = value
19
19
  end
20
20
 
21
- def ==(object_id)
22
- self.value == object_id.value
21
+ def ==(oid)
22
+ self.value == oid.value
23
23
  end
24
24
  end # of ObjectID
25
25
 
@@ -239,15 +239,15 @@ module OpenEHR
239
239
  end
240
240
 
241
241
  class ObjectVersionID < UIDBasedID
242
- attr_reader :object_id, :creating_system_id, :version_tree_id
242
+ attr_reader :creating_system_id, :version_tree_id
243
243
 
244
244
  def initialize(args= {})
245
- super(args)
245
+ super
246
246
  end
247
247
 
248
248
  def value=(value)
249
249
  if /^(\S+)::(\S+)::((\d|\.)+)$/ =~ value
250
- self.object_id = UID.new(:value => $1)
250
+ self.objectid = UID.new(:value => $1)
251
251
  self.creating_system_id = UID.new(:value => $2)
252
252
  self.version_tree_id = VersionTreeID.new(:value => $3)
253
253
  else
@@ -256,14 +256,18 @@ module OpenEHR
256
256
  end
257
257
 
258
258
  def value
259
- return @object_id.value + '::' +
259
+ return @oid.value + '::' +
260
260
  @creating_system_id.value + '::' +
261
261
  @version_tree_id.value
262
262
  end
263
263
 
264
- def object_id=(object_id)
265
- raise ArgumentError, 'object_id is mandatory' if object_id.nil?
266
- @object_id = object_id
264
+ def objectid
265
+ return @oid
266
+ end
267
+
268
+ def objectid=(oid)
269
+ raise ArgumentError, 'objectid is mandatory' if oid.nil?
270
+ @oid = oid
267
271
  end
268
272
 
269
273
  def creating_system_id=(creating_system_id)
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "open_ehr"
8
- s.version = "0.9.5"
8
+ s.version = "1.0.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Shinji KOBAYASHI", "Akimichi Tatsukawa"]
12
- s.date = "2011-12-02"
12
+ s.date = "2011-12-24"
13
13
  s.description = "This project is an implementation of the openEHR specification on Ruby."
14
14
  s.email = "skoba@moss.gr.jp"
15
15
  s.extra_rdoc_files = [
@@ -125,6 +125,15 @@ Gem::Specification.new do |s|
125
125
  "spec/lib/open_ehr/am/archetype/ontology/archetype_ontology_spec.rb",
126
126
  "spec/lib/open_ehr/am/archetype/ontology/archetype_term_spec.rb",
127
127
  "spec/lib/open_ehr/am/archetype/validity_kind_spec.rb",
128
+ "spec/lib/open_ehr/am/openehr_profile/data_types/basic/c_dv_state_spec.rb",
129
+ "spec/lib/open_ehr/am/openehr_profile/data_types/basic/non_terminal_state_spec.rb",
130
+ "spec/lib/open_ehr/am/openehr_profile/data_types/basic/state_machine_spec.rb",
131
+ "spec/lib/open_ehr/am/openehr_profile/data_types/basic/state_spec.rb",
132
+ "spec/lib/open_ehr/am/openehr_profile/data_types/basic/terminal_state_spec.rb",
133
+ "spec/lib/open_ehr/am/openehr_profile/data_types/basic/transition_spec.rb",
134
+ "spec/lib/open_ehr/am/openehr_profile/data_types/quantity/c_dv_ordinal_spec.rb",
135
+ "spec/lib/open_ehr/am/openehr_profile/data_types/quantity/c_dv_quantity_spec.rb",
136
+ "spec/lib/open_ehr/am/openehr_profile/data_types/quantity/c_quantity_item_spec.rb",
128
137
  "spec/lib/open_ehr/am/openehr_profile/data_types/text/c_code_phrase_spec.rb",
129
138
  "spec/lib/open_ehr/assumed_library_types/interval_spec.rb",
130
139
  "spec/lib/open_ehr/assumed_library_types/iso8601_date_spec.rb",
@@ -244,10 +253,31 @@ Gem::Specification.new do |s|
244
253
  "spec/lib/open_ehr/parser/base_spec.rb",
245
254
  "spec/lib/open_ehr/parser/basic_generic_type_spec.rb",
246
255
  "spec/lib/open_ehr/parser/basic_type_spec.rb",
256
+ "spec/lib/open_ehr/parser/c_dv_quantity_any_allowed_spec.rb",
257
+ "spec/lib/open_ehr/parser/c_dv_quantity_shared_example_for_lacked_items_spec.rb",
258
+ "spec/lib/open_ehr/parser/c_dv_quantity_shared_example_spec.rb",
259
+ "spec/lib/open_ehr/parser/cdv_ordinal_parse_spec.rb",
247
260
  "spec/lib/open_ehr/parser/code_phrase_spec.rb",
261
+ "spec/lib/open_ehr/parser/constraint_binding_spec.rb",
262
+ "spec/lib/open_ehr/parser/constraint_ref_spec.rb",
248
263
  "spec/lib/open_ehr/parser/date_time_spec.rb",
249
264
  "spec/lib/open_ehr/parser/duration_spec.rb",
265
+ "spec/lib/open_ehr/parser/dv_coded_text_parse_spec.rb",
266
+ "spec/lib/open_ehr/parser/empty_other_contributors_spec.rb",
267
+ "spec/lib/open_ehr/parser/missing_language_spec.rb",
268
+ "spec/lib/open_ehr/parser/missing_purpose_spec.rb",
269
+ "spec/lib/open_ehr/parser/mixed_node_types_spec.rb",
270
+ "spec/lib/open_ehr/parser/most_minimal_adl_spec.rb",
271
+ "spec/lib/open_ehr/parser/multi_language_spec.rb",
250
272
  "spec/lib/open_ehr/parser/parser_spec_helper.rb",
273
+ "spec/lib/open_ehr/parser/path_based_terminology_binding_spec.rb",
274
+ "spec/lib/open_ehr/parser/special_string_spec.rb",
275
+ "spec/lib/open_ehr/parser/structure_comment_spec.rb",
276
+ "spec/lib/open_ehr/parser/structure_nested_comments_spec.rb",
277
+ "spec/lib/open_ehr/parser/structure_spec.rb",
278
+ "spec/lib/open_ehr/parser/term_binding_spec.rb",
279
+ "spec/lib/open_ehr/parser/unicode_bom_spec.rb",
280
+ "spec/lib/open_ehr/parser/unicode_support_spec.rb",
251
281
  "spec/lib/open_ehr/rm/common/archetyped/archetyped_spec.rb",
252
282
  "spec/lib/open_ehr/rm/common/archetyped/feeder_audit_details_spec.rb",
253
283
  "spec/lib/open_ehr/rm/common/archetyped/feeder_audit_spec.rb",
@@ -306,7 +336,7 @@ Gem::Specification.new do |s|
306
336
  "spec/lib/open_ehr/rm/data_types/quantity/date_time/dv_date_spec.rb",
307
337
  "spec/lib/open_ehr/rm/data_types/quantity/date_time/dv_date_time_spec.rb",
308
338
  "spec/lib/open_ehr/rm/data_types/quantity/date_time/dv_duration_spec.rb",
309
- "spec/lib/open_ehr/rm/data_types/quantity/date_time/dv_tempral_spec.rb",
339
+ "spec/lib/open_ehr/rm/data_types/quantity/date_time/dv_temporal_spec.rb",
310
340
  "spec/lib/open_ehr/rm/data_types/quantity/date_time/dv_time_spec.rb",
311
341
  "spec/lib/open_ehr/rm/data_types/quantity/dv_absolute_quantity_spec.rb",
312
342
  "spec/lib/open_ehr/rm/data_types/quantity/dv_amount_spec.rb",
@@ -369,7 +399,7 @@ Gem::Specification.new do |s|
369
399
  s.homepage = "http://github.com/skoba/ruby-impl-openehr"
370
400
  s.licenses = ["The openEHR Open Source Software license(mozilla tri-license)"]
371
401
  s.require_paths = ["lib"]
372
- s.rubygems_version = "1.8.11"
402
+ s.rubygems_version = "1.8.12"
373
403
  s.summary = "Ruby implementation of the openEHR specification"
374
404
 
375
405
  if s.respond_to? :specification_version then
@@ -0,0 +1,34 @@
1
+ # ticket 192
2
+ require File.dirname(__FILE__) + '/../../../../../../spec_helper'
3
+ require 'open_ehr/am/openehr_profile/data_types/basic'
4
+ include ::OpenEHR::AM::OpenEHRProfile::DataTypes::Basic
5
+ include ::OpenEHR::AssumedLibraryTypes
6
+ require 'set'
7
+
8
+ describe CDvState do
9
+ before(:each) do
10
+ proposed_state = State.new(:name => 'PROPOSED')
11
+ complete_state = TerminalState.new(:name => 'COMPLETED')
12
+ finish = Transition.new(:event => 'finish', :next_state => complete_state)
13
+ transitions = Set[finish]
14
+ non_terminal_state = NonTerminalState.new(:name => 'IN_EXECUTION',
15
+ :transitions => transitions)
16
+ states = Set[proposed_state, non_terminal_state, complete_state]
17
+ state_machine = StateMachine.new(:states => states)
18
+ occurrences = Interval.new(:upper => 1, :lower => 1)
19
+ @c_dv_state = CDvState.new(:value => state_machine, :path => '/',
20
+ :occurrences => occurrences)
21
+ end
22
+
23
+ it 'is an instance of StateMachine' do
24
+ @c_dv_state.should be_an_instance_of CDvState
25
+ end
26
+
27
+ it 'states size should be 3' do
28
+ @c_dv_state.value.states.size.should be 3
29
+ end
30
+
31
+ it 'raise error if value is nil' do
32
+ expect {@c_dv_state.value = nil}.to raise_error
33
+ end
34
+ end
@@ -0,0 +1,36 @@
1
+ # ticket 195
2
+ require File.dirname(__FILE__) + '/../../../../../../spec_helper'
3
+ require 'open_ehr/am/openehr_profile/data_types/basic'
4
+ include ::OpenEHR::AM::OpenEHRProfile::DataTypes::Basic
5
+ require 'set'
6
+
7
+ describe NonTerminalState do
8
+ before(:each) do
9
+ proposed_state = State.new(:name => 'PROPOSED')
10
+ complete_state = TerminalState.new(:name => 'COMPLETED')
11
+ finish = Transition.new(:event => 'finish', :next_state => complete_state)
12
+ transitions = Set[finish]
13
+ @non_terminal_state = NonTerminalState.new(:name => 'IN_EXECUTION',
14
+ :transitions => transitions)
15
+ end
16
+
17
+ it 'is an instance of NonTerminalState' do
18
+ @non_terminal_state.should be_an_instance_of NonTerminalState
19
+ end
20
+
21
+ it 'name is IN_EXECUTION' do
22
+ @non_terminal_state.name.should == 'IN_EXECUTION'
23
+ end
24
+
25
+ it 'size of transitions is 2' do
26
+ @non_terminal_state.transitions.size.should == 1
27
+ end
28
+
29
+ it 'raise error if traisitions is empty' do
30
+ expect {@non_terminal_state.transitions = Set.new}.to raise_error
31
+ end
32
+
33
+ it 'raise error if transitions is nil' do
34
+ expect {@non_terminal_state.transitions = nil}.to raise_error
35
+ end
36
+ end
@@ -0,0 +1,34 @@
1
+ # ticket 193
2
+ require File.dirname(__FILE__) + '/../../../../../../spec_helper'
3
+ require 'open_ehr/am/openehr_profile/data_types/basic'
4
+ include ::OpenEHR::AM::OpenEHRProfile::DataTypes::Basic
5
+ require 'set'
6
+
7
+ describe StateMachine do
8
+ before(:each) do
9
+ proposed_state = State.new(:name => 'PROPOSED')
10
+ complete_state = TerminalState.new(:name => 'COMPLETED')
11
+ finish = Transition.new(:event => 'finish', :next_state => complete_state)
12
+ transitions = Set[finish]
13
+ non_terminal_state = NonTerminalState.new(:name => 'IN_EXECUTION',
14
+ :transitions => transitions)
15
+ states = Set[proposed_state, non_terminal_state, complete_state]
16
+ @state_machine = StateMachine.new(:states => states)
17
+ end
18
+
19
+ it 'is an instance of StateMachine' do
20
+ @state_machine.should be_an_instance_of StateMachine
21
+ end
22
+
23
+ it 'states size is 3' do
24
+ @state_machine.states.size.should be 3
25
+ end
26
+
27
+ it 'raise error if states are nil' do
28
+ expect {@state_machine.states = nil}.to raise_error
29
+ end
30
+
31
+ it 'raise error if states is empty' do
32
+ expect {@state_machine.states = Set.new}.to raise_error
33
+ end
34
+ end
@@ -0,0 +1,26 @@
1
+ # ticket 191
2
+ require File.dirname(__FILE__) + '/../../../../../../spec_helper'
3
+ require 'open_ehr/am/openehr_profile/data_types/basic'
4
+ include ::OpenEHR::AM::OpenEHRProfile::DataTypes::Basic
5
+
6
+ describe State do
7
+ before(:all) do
8
+ @state = State.new(:name => 'PROPOSED')
9
+ end
10
+
11
+ it 'is an instance of State' do
12
+ @state.should be_an_instance_of State
13
+ end
14
+
15
+ it 'name is PROPOSED' do
16
+ @state.name.should == 'PROPOSED'
17
+ end
18
+
19
+ it 'raise error name is empty' do
20
+ expect {@state.name = ''}.to raise_error
21
+ end
22
+
23
+ it 'raise error name is nil' do
24
+ expect {@state.name = nil}.to raise_error
25
+ end
26
+ end
@@ -0,0 +1,18 @@
1
+ # ticket 196
2
+ require File.dirname(__FILE__) + '/../../../../../../spec_helper'
3
+ require 'open_ehr/am/openehr_profile/data_types/basic'
4
+ include ::OpenEHR::AM::OpenEHRProfile::DataTypes::Basic
5
+
6
+ describe TerminalState do
7
+ before(:all) do
8
+ @terminal_state = TerminalState.new(:name => 'PROPOSED')
9
+ end
10
+
11
+ it 'is an instance of TerminalState' do
12
+ @terminal_state.should be_an_instance_of TerminalState
13
+ end
14
+
15
+ it 'name is PROPOSED' do
16
+ @terminal_state.name.should == 'PROPOSED'
17
+ end
18
+ end