open_ehr 0.6.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (253) hide show
  1. data/.document +5 -0
  2. data/Gemfile +14 -0
  3. data/Gemfile.lock +43 -0
  4. data/Guardfile +9 -0
  5. data/History.txt +4 -0
  6. data/Manifest.txt +16 -0
  7. data/PostInstall.txt +9 -0
  8. data/README.rdoc +66 -0
  9. data/Rakefile +49 -0
  10. data/VERSION +1 -0
  11. data/doc/README_rdoc.html +148 -0
  12. data/doc/created.rid +2 -0
  13. data/doc/images/brick.png +0 -0
  14. data/doc/images/brick_link.png +0 -0
  15. data/doc/images/bug.png +0 -0
  16. data/doc/images/bullet_black.png +0 -0
  17. data/doc/images/bullet_toggle_minus.png +0 -0
  18. data/doc/images/bullet_toggle_plus.png +0 -0
  19. data/doc/images/date.png +0 -0
  20. data/doc/images/find.png +0 -0
  21. data/doc/images/loadingAnimation.gif +0 -0
  22. data/doc/images/macFFBgHack.png +0 -0
  23. data/doc/images/package.png +0 -0
  24. data/doc/images/page_green.png +0 -0
  25. data/doc/images/page_white_text.png +0 -0
  26. data/doc/images/page_white_width.png +0 -0
  27. data/doc/images/plugin.png +0 -0
  28. data/doc/images/ruby.png +0 -0
  29. data/doc/images/tag_green.png +0 -0
  30. data/doc/images/wrench.png +0 -0
  31. data/doc/images/wrench_orange.png +0 -0
  32. data/doc/images/zoom.png +0 -0
  33. data/doc/index.html +54 -0
  34. data/doc/js/darkfish.js +116 -0
  35. data/doc/js/jquery.js +32 -0
  36. data/doc/js/quicksearch.js +114 -0
  37. data/doc/js/thickbox-compressed.js +10 -0
  38. data/doc/openehr_terminology.xml +2700 -0
  39. data/doc/rdoc.css +706 -0
  40. data/lib/#open_ehr.rb# +11 -0
  41. data/lib/open_ehr/am/archetype/archetype_description/archetype_description.rb +21 -0
  42. data/lib/open_ehr/am/archetype/assertion.rb +190 -0
  43. data/lib/open_ehr/am/archetype/constraint_model/primitive.rb +296 -0
  44. data/lib/open_ehr/am/archetype/constraint_model.rb +340 -0
  45. data/lib/open_ehr/am/archetype/ontology.rb +97 -0
  46. data/lib/open_ehr/am/archetype.rb +134 -0
  47. data/lib/open_ehr/am/open_ehr_profile/data_types/basic.rb +29 -0
  48. data/lib/open_ehr/am/open_ehr_profile/data_types/quantity.rb +19 -0
  49. data/lib/open_ehr/am/open_ehr_profile/data_types/text.rb +12 -0
  50. data/lib/open_ehr/am.rb +8 -0
  51. data/lib/open_ehr/assumed_library_types.rb +627 -0
  52. data/lib/open_ehr/parser/xml_perser.rb +13 -0
  53. data/lib/open_ehr/parser.rb +19 -0
  54. data/lib/open_ehr/rm/common/archetyped.rb +182 -0
  55. data/lib/open_ehr/rm/common/change_control.rb +332 -0
  56. data/lib/open_ehr/rm/common/directory.rb +29 -0
  57. data/lib/open_ehr/rm/common/generic.rb +216 -0
  58. data/lib/open_ehr/rm/common/resource.rb +154 -0
  59. data/lib/open_ehr/rm/common.rb +14 -0
  60. data/lib/open_ehr/rm/composition/content/entry.rb +246 -0
  61. data/lib/open_ehr/rm/composition/content/navigation.rb +31 -0
  62. data/lib/open_ehr/rm/composition/content.rb +22 -0
  63. data/lib/open_ehr/rm/composition.rb +103 -0
  64. data/lib/open_ehr/rm/data_structures/history.rb +117 -0
  65. data/lib/open_ehr/rm/data_structures/item_structure/representation.rb +63 -0
  66. data/lib/open_ehr/rm/data_structures/item_structure.rb +216 -0
  67. data/lib/open_ehr/rm/data_structures.rb +25 -0
  68. data/lib/open_ehr/rm/data_types/basic.rb +108 -0
  69. data/lib/open_ehr/rm/data_types/charset.lst +818 -0
  70. data/lib/open_ehr/rm/data_types/charset_extract.rb +24 -0
  71. data/lib/open_ehr/rm/data_types/encapsulated.rb +98 -0
  72. data/lib/open_ehr/rm/data_types/quantity/date_time.rb +229 -0
  73. data/lib/open_ehr/rm/data_types/quantity.rb +403 -0
  74. data/lib/open_ehr/rm/data_types/text.rb +168 -0
  75. data/lib/open_ehr/rm/data_types/time_specification.rb +75 -0
  76. data/lib/open_ehr/rm/data_types/uri.rb +82 -0
  77. data/lib/open_ehr/rm/data_types.rb +14 -0
  78. data/lib/open_ehr/rm/demographic.rb +269 -0
  79. data/lib/open_ehr/rm/ehr.rb +162 -0
  80. data/lib/open_ehr/rm/integration.rb +27 -0
  81. data/lib/open_ehr/rm/security.rb +12 -0
  82. data/lib/open_ehr/rm/support/assumed_types.rb +81 -0
  83. data/lib/open_ehr/rm/support/definition.rb +15 -0
  84. data/lib/open_ehr/rm/support/identification.rb +408 -0
  85. data/lib/open_ehr/rm/support/measurement.rb +17 -0
  86. data/lib/open_ehr/rm/support/terminology.rb +135 -0
  87. data/lib/open_ehr/rm/support.rb +14 -0
  88. data/lib/open_ehr/rm.rb +16 -0
  89. data/lib/open_ehr/serializer.rb +272 -0
  90. data/lib/open_ehr/terminology/open_ehr_terminology.rb +41 -0
  91. data/lib/open_ehr/terminology.rb +7 -0
  92. data/lib/open_ehr/writer.rb +12 -0
  93. data/lib/open_ehr.rb +11 -0
  94. data/spec/lib/open_ehr/am/archetype/archetype_spec.rb +98 -0
  95. data/spec/lib/open_ehr/am/archetype/assertion/assertion_spec.rb +60 -0
  96. data/spec/lib/open_ehr/am/archetype/assertion/assertion_variable_spec.rb +30 -0
  97. data/spec/lib/open_ehr/am/archetype/assertion/expr_binary_operator.rb +40 -0
  98. data/spec/lib/open_ehr/am/archetype/assertion/expr_item_spec.rb +28 -0
  99. data/spec/lib/open_ehr/am/archetype/assertion/expr_leaf_spec.rb +34 -0
  100. data/spec/lib/open_ehr/am/archetype/assertion/expr_operator_spec.rb +25 -0
  101. data/spec/lib/open_ehr/am/archetype/assertion/expr_unary_operator_spec.rb +26 -0
  102. data/spec/lib/open_ehr/am/archetype/assertion/operator_kind_spec.rb +110 -0
  103. data/spec/lib/open_ehr/am/archetype/constraint_model/archetype_constraint_spec.rb +56 -0
  104. data/spec/lib/open_ehr/am/archetype/constraint_model/archetype_internal_ref_spec.rb +36 -0
  105. data/spec/lib/open_ehr/am/archetype/constraint_model/archetype_slot_spec.rb +61 -0
  106. data/spec/lib/open_ehr/am/archetype/constraint_model/c_attribute_spec.rb +59 -0
  107. data/spec/lib/open_ehr/am/archetype/constraint_model/c_complex_object_spec.rb +39 -0
  108. data/spec/lib/open_ehr/am/archetype/constraint_model/c_defined_object_spec.rb +53 -0
  109. data/spec/lib/open_ehr/am/archetype/constraint_model/c_domain_type_spec.rb +25 -0
  110. data/spec/lib/open_ehr/am/archetype/constraint_model/c_multiple_attribute_spec.rb +29 -0
  111. data/spec/lib/open_ehr/am/archetype/constraint_model/c_object_spec.rb +61 -0
  112. data/spec/lib/open_ehr/am/archetype/constraint_model/c_primitive_object_spec.rb +33 -0
  113. data/spec/lib/open_ehr/am/archetype/constraint_model/c_reference_object_spec.rb +17 -0
  114. data/spec/lib/open_ehr/am/archetype/constraint_model/c_single_attribute_spec.rb +28 -0
  115. data/spec/lib/open_ehr/am/archetype/constraint_model/cardinality_spec.rb +68 -0
  116. data/spec/lib/open_ehr/am/archetype/constraint_model/constraint_ref_spec.rb +29 -0
  117. data/spec/lib/open_ehr/am/archetype/constraint_model/primitive/c_boolean_spec.rb +52 -0
  118. data/spec/lib/open_ehr/am/archetype/constraint_model/primitive/c_date_spec.rb +80 -0
  119. data/spec/lib/open_ehr/am/archetype/constraint_model/primitive/c_date_time_spec.rb +106 -0
  120. data/spec/lib/open_ehr/am/archetype/constraint_model/primitive/c_duration_spec.rb +69 -0
  121. data/spec/lib/open_ehr/am/archetype/constraint_model/primitive/c_integer_spec.rb +62 -0
  122. data/spec/lib/open_ehr/am/archetype/constraint_model/primitive/c_primitive_spec.rb +39 -0
  123. data/spec/lib/open_ehr/am/archetype/constraint_model/primitive/c_real_spec.rb +14 -0
  124. data/spec/lib/open_ehr/am/archetype/constraint_model/primitive/c_string_spec.rb +69 -0
  125. data/spec/lib/open_ehr/am/archetype/constraint_model/primitive/c_time_spec.rb +79 -0
  126. data/spec/lib/open_ehr/am/archetype/ontology/archetype_ontology_spec.rb +59 -0
  127. data/spec/lib/open_ehr/am/archetype/ontology/archetype_term_spec.rb +43 -0
  128. data/spec/lib/open_ehr/am/archetype/validity_kind_spec.rb +42 -0
  129. data/spec/lib/open_ehr/assumed_library_types/interval_spec.rb +140 -0
  130. data/spec/lib/open_ehr/assumed_library_types/iso8601_date_spec.rb +236 -0
  131. data/spec/lib/open_ehr/assumed_library_types/iso8601_date_time_spec.rb +47 -0
  132. data/spec/lib/open_ehr/assumed_library_types/iso8601_duration_spec.rb +150 -0
  133. data/spec/lib/open_ehr/assumed_library_types/iso8601_time_spec.rb +234 -0
  134. data/spec/lib/open_ehr/assumed_library_types/iso8601_timezone_spec.rb +57 -0
  135. data/spec/lib/open_ehr/assumed_library_types/time_definitions_spec.rb +136 -0
  136. data/spec/lib/open_ehr/rm/common/archetyped/archetyped_spec.rb +50 -0
  137. data/spec/lib/open_ehr/rm/common/archetyped/feeder_audit_details_spec.rb +60 -0
  138. data/spec/lib/open_ehr/rm/common/archetyped/feeder_audit_spec.rb +51 -0
  139. data/spec/lib/open_ehr/rm/common/archetyped/link_spec.rb +42 -0
  140. data/spec/lib/open_ehr/rm/common/archetyped/locatable_spec.rb +89 -0
  141. data/spec/lib/open_ehr/rm/common/archetyped/pathable_spec.rb +42 -0
  142. data/spec/lib/open_ehr/rm/common/change_control/contribution_spec.rb +56 -0
  143. data/spec/lib/open_ehr/rm/common/change_control/imported_version_spec.rb +63 -0
  144. data/spec/lib/open_ehr/rm/common/change_control/original_version_spec.rb +71 -0
  145. data/spec/lib/open_ehr/rm/common/change_control/version_spec.rb +92 -0
  146. data/spec/lib/open_ehr/rm/common/change_control/versioned_object_spec.rb +285 -0
  147. data/spec/lib/open_ehr/rm/common/directory/folder_spec.rb +26 -0
  148. data/spec/lib/open_ehr/rm/common/generic/attestation_spec.rb +62 -0
  149. data/spec/lib/open_ehr/rm/common/generic/audit_details_spec.rb +51 -0
  150. data/spec/lib/open_ehr/rm/common/generic/participation_spec.rb +36 -0
  151. data/spec/lib/open_ehr/rm/common/generic/party_identified_spec.rb +64 -0
  152. data/spec/lib/open_ehr/rm/common/generic/party_proxy_spec.rb +18 -0
  153. data/spec/lib/open_ehr/rm/common/generic/party_related_spec.rb +24 -0
  154. data/spec/lib/open_ehr/rm/common/generic/revision_history_item_spec.rb +43 -0
  155. data/spec/lib/open_ehr/rm/common/generic/revision_history_spec.rb +45 -0
  156. data/spec/lib/open_ehr/rm/common/resource/authored_resource_spec.rb +68 -0
  157. data/spec/lib/open_ehr/rm/common/resource/resource_description_item_spec.rb +105 -0
  158. data/spec/lib/open_ehr/rm/common/resource/resource_description_spec.rb +74 -0
  159. data/spec/lib/open_ehr/rm/common/resource/translation_details_spec.rb +35 -0
  160. data/spec/lib/open_ehr/rm/composition/composition_spec.rb +92 -0
  161. data/spec/lib/open_ehr/rm/composition/content/content_item_spec.rb +14 -0
  162. data/spec/lib/open_ehr/rm/composition/content/entry/action_spec.rb +69 -0
  163. data/spec/lib/open_ehr/rm/composition/content/entry/activity_spec.rb +61 -0
  164. data/spec/lib/open_ehr/rm/composition/content/entry/admin_entry_spec.rb +38 -0
  165. data/spec/lib/open_ehr/rm/composition/content/entry/care_entry_spec.rb +37 -0
  166. data/spec/lib/open_ehr/rm/composition/content/entry/entry_spec.rb +88 -0
  167. data/spec/lib/open_ehr/rm/composition/content/entry/evaluation_spec.rb +37 -0
  168. data/spec/lib/open_ehr/rm/composition/content/entry/instruction_details_spec.rb +51 -0
  169. data/spec/lib/open_ehr/rm/composition/content/entry/instruction_spec.rb +62 -0
  170. data/spec/lib/open_ehr/rm/composition/content/entry/ism_transition_spec.rb +46 -0
  171. data/spec/lib/open_ehr/rm/composition/content/entry/observation_spec.rb +45 -0
  172. data/spec/lib/open_ehr/rm/composition/content/navigation/section_spec.rb +32 -0
  173. data/spec/lib/open_ehr/rm/composition/event_context_spec.rb +88 -0
  174. data/spec/lib/open_ehr/rm/data_structures/data_structure_spec.rb +21 -0
  175. data/spec/lib/open_ehr/rm/data_structures/history/event_spec.rb +44 -0
  176. data/spec/lib/open_ehr/rm/data_structures/history/history_spec.rb +67 -0
  177. data/spec/lib/open_ehr/rm/data_structures/history/interval_event_spec.rb +43 -0
  178. data/spec/lib/open_ehr/rm/data_structures/item_structure/item_list_spec.rb +53 -0
  179. data/spec/lib/open_ehr/rm/data_structures/item_structure/item_single_spec.rb +29 -0
  180. data/spec/lib/open_ehr/rm/data_structures/item_structure/item_table_spec.rb +147 -0
  181. data/spec/lib/open_ehr/rm/data_structures/item_structure/item_tree_spec.rb +48 -0
  182. data/spec/lib/open_ehr/rm/data_structures/item_structure/representation/cluster_spec.rb +26 -0
  183. data/spec/lib/open_ehr/rm/data_structures/item_structure/representation/element_spec.rb +22 -0
  184. data/spec/lib/open_ehr/rm/data_types/basic/data_value_spec.rb +17 -0
  185. data/spec/lib/open_ehr/rm/data_types/basic/dv_boolean_spec.rb +29 -0
  186. data/spec/lib/open_ehr/rm/data_types/basic/dv_identifier_spec.rb +108 -0
  187. data/spec/lib/open_ehr/rm/data_types/basic/dv_state_spec.rb +44 -0
  188. data/spec/lib/open_ehr/rm/data_types/encapsulated/dv_encapsulated_spec.rb +42 -0
  189. data/spec/lib/open_ehr/rm/data_types/encapsulated/dv_multimedia_spec.rb +79 -0
  190. data/spec/lib/open_ehr/rm/data_types/encapsulated/dv_parsable_spec.rb +34 -0
  191. data/spec/lib/open_ehr/rm/data_types/quantity/date_time/dv_date_spec.rb +64 -0
  192. data/spec/lib/open_ehr/rm/data_types/quantity/date_time/dv_date_time_spec.rb +25 -0
  193. data/spec/lib/open_ehr/rm/data_types/quantity/date_time/dv_tempral_spec.rb +24 -0
  194. data/spec/lib/open_ehr/rm/data_types/quantity/date_time/dv_time_spec.rb +37 -0
  195. data/spec/lib/open_ehr/rm/data_types/quantity/dv_absolute_quantity_spec.rb +35 -0
  196. data/spec/lib/open_ehr/rm/data_types/quantity/dv_amount_spec.rb +105 -0
  197. data/spec/lib/open_ehr/rm/data_types/quantity/dv_count_spec.rb +12 -0
  198. data/spec/lib/open_ehr/rm/data_types/quantity/dv_interval_spec.rb +17 -0
  199. data/spec/lib/open_ehr/rm/data_types/quantity/dv_ordered_spec.rb +60 -0
  200. data/spec/lib/open_ehr/rm/data_types/quantity/dv_ordinal_spec.rb +74 -0
  201. data/spec/lib/open_ehr/rm/data_types/quantity/dv_proportion_spec.rb +162 -0
  202. data/spec/lib/open_ehr/rm/data_types/quantity/dv_quantified_spec.rb +36 -0
  203. data/spec/lib/open_ehr/rm/data_types/quantity/dv_quantity_spec.rb +78 -0
  204. data/spec/lib/open_ehr/rm/data_types/quantity/proportion_kind_spec.rb +24 -0
  205. data/spec/lib/open_ehr/rm/data_types/quantity/reference_range_spec.rb +43 -0
  206. data/spec/lib/open_ehr/rm/data_types/text/code_phrase_spec.rb +23 -0
  207. data/spec/lib/open_ehr/rm/data_types/text/dv_paragraph_spec.rb +13 -0
  208. data/spec/lib/open_ehr/rm/data_types/text/dv_text_spec.rb +57 -0
  209. data/spec/lib/open_ehr/rm/data_types/text/term_mapping_spec.rb +59 -0
  210. data/spec/lib/open_ehr/rm/data_types/uri/dv_ehr_uri_spec.rb +21 -0
  211. data/spec/lib/open_ehr/rm/data_types/uri/dv_uri_spec.rb +36 -0
  212. data/spec/lib/open_ehr/rm/demographic/actor_spec.rb +79 -0
  213. data/spec/lib/open_ehr/rm/demographic/address_spec.rb +33 -0
  214. data/spec/lib/open_ehr/rm/demographic/capability_spec.rb +37 -0
  215. data/spec/lib/open_ehr/rm/demographic/contact_spec.rb +45 -0
  216. data/spec/lib/open_ehr/rm/demographic/party_identity_spec.rb +32 -0
  217. data/spec/lib/open_ehr/rm/demographic/party_relationship_spec.rb +84 -0
  218. data/spec/lib/open_ehr/rm/demographic/party_spec.rb +133 -0
  219. data/spec/lib/open_ehr/rm/demographic/role_spec.rb +58 -0
  220. data/spec/lib/open_ehr/rm/ehr/ehr_access_spec.rb +33 -0
  221. data/spec/lib/open_ehr/rm/ehr/ehr_spec.rb +139 -0
  222. data/spec/lib/open_ehr/rm/ehr/ehr_status_spec.rb +52 -0
  223. data/spec/lib/open_ehr/rm/ehr/versioned_composition_spec.rb +33 -0
  224. data/spec/lib/open_ehr/rm/integration/generic_entry_spec.rb +31 -0
  225. data/spec/lib/open_ehr/rm/support/identification/access_group_ref_spec.rb +19 -0
  226. data/spec/lib/open_ehr/rm/support/identification/archetype_id_spec.rb +152 -0
  227. data/spec/lib/open_ehr/rm/support/identification/generic_id_spec.rb +33 -0
  228. data/spec/lib/open_ehr/rm/support/identification/hier_object_id_spec.rb +12 -0
  229. data/spec/lib/open_ehr/rm/support/identification/internet_id_spec.rb +12 -0
  230. data/spec/lib/open_ehr/rm/support/identification/iso_oid_spec.rb +12 -0
  231. data/spec/lib/open_ehr/rm/support/identification/locatable_ref_spec.rb +34 -0
  232. data/spec/lib/open_ehr/rm/support/identification/object_id_spec.rb +24 -0
  233. data/spec/lib/open_ehr/rm/support/identification/object_ref_spec.rb +33 -0
  234. data/spec/lib/open_ehr/rm/support/identification/object_version_id_spec.rb +60 -0
  235. data/spec/lib/open_ehr/rm/support/identification/party_ref_spec.rb +29 -0
  236. data/spec/lib/open_ehr/rm/support/identification/template_id_spec.rb +12 -0
  237. data/spec/lib/open_ehr/rm/support/identification/terminology_id_spec.rb +33 -0
  238. data/spec/lib/open_ehr/rm/support/identification/uid_based_id_spec.rb +50 -0
  239. data/spec/lib/open_ehr/rm/support/identification/uid_spec.rb +29 -0
  240. data/spec/lib/open_ehr/rm/support/identification/version_tree_id_spec.rb +104 -0
  241. data/spec/lib/open_ehr/rm/support/measurement_service_spec.rb +7 -0
  242. data/spec/lib/open_ehr/rm/support/terminology_service_spec.rb +24 -0
  243. data/spec/lib/open_ehr/serializer/adl-test-entry.most_minimal.test.adl +20 -0
  244. data/spec/lib/open_ehr/serializer/adl_serializer_spec.rb +47 -0
  245. data/spec/lib/open_ehr/serializer/openEHR-EHR-SECTION.test.v1.adl +38 -0
  246. data/spec/lib/open_ehr/serializer/openEHR-EHR-SECTION.test.v1.xml +58 -0
  247. data/spec/lib/open_ehr/serializer/sample_archetype_spec.rb +44 -0
  248. data/spec/lib/open_ehr/serializer/xml_serializer_spec.rb +49 -0
  249. data/spec/lib/open_ehr/terminology/open_ehr_terminology_spec.rb +40 -0
  250. data/spec/rcov.opts +1 -0
  251. data/spec/spec.opts +5 -0
  252. data/spec/spec_helper.rb +54 -0
  253. metadata +401 -0
@@ -0,0 +1,340 @@
1
+ $:.unshift(File.dirname(__FILE__))
2
+ module OpenEHR
3
+ module AM
4
+ module Archetype
5
+ module ConstraintModel
6
+
7
+ autoload :Primitive, 'constraint_model/primitive'
8
+
9
+ class ArchetypeConstraint
10
+ attr_reader :path
11
+ attr_accessor :parent
12
+
13
+ def initialize(args = { })
14
+ self.path = args[:path]
15
+ self.parent = args[:parent]
16
+ end
17
+
18
+ def path=(path)
19
+ if path.nil?
20
+ raise ArgumentError, 'path is mandatory'
21
+ end
22
+ @path = path
23
+ end
24
+
25
+ def has_path?(path)
26
+ return @path.include?(path)
27
+ end
28
+
29
+ def congruent?
30
+ if @path.index(@parent.path) == 0
31
+ return true
32
+ else
33
+ return false
34
+ end
35
+ end
36
+
37
+ alias is_congruent? congruent?
38
+
39
+ def node_conforms_to?(other)
40
+ if @path.index(other.path) == 0
41
+ return true
42
+ else
43
+ return false
44
+ end
45
+ end
46
+ end
47
+
48
+ class Cardinality
49
+ attr_accessor :interval, :is_ordered, :is_unique
50
+
51
+ def initialize(args = { })
52
+ @interval = args[:interval]
53
+ @is_ordered = args[:is_ordered]
54
+ @is_unique = args[:is_unique]
55
+ end
56
+
57
+ def is_ordered?
58
+ return @is_ordered
59
+ end
60
+
61
+ alias ordered? is_ordered?
62
+
63
+ def is_unique?
64
+ return @is_unique
65
+ end
66
+
67
+ alias unique? is_unique?
68
+
69
+ def is_set?
70
+ return !@is_ordered && @is_unique
71
+ end
72
+
73
+ alias set? is_set?
74
+
75
+ def is_list?
76
+ return @is_ordered && !@is_unique
77
+ end
78
+
79
+ alias list? is_list?
80
+
81
+ def is_bag?
82
+ return !@is_ordered && !@is_unique
83
+ end
84
+
85
+ alias bag? is_bag?
86
+ end
87
+
88
+ class CObject < ArchetypeConstraint
89
+ attr_reader :rm_type_name, :node_id, :occurrences
90
+
91
+ def initialize(args = { })
92
+ super(args)
93
+ self.rm_type_name = args[:rm_type_name]
94
+ self.node_id = args[:node_id]
95
+ self.occurrences = args[:occurrences]
96
+
97
+ end
98
+
99
+ def rm_type_name=(rm_type_name)
100
+ if rm_type_name.nil? || rm_type_name.empty?
101
+ raise ArgumentError, 'invalid rm_type_name'
102
+ end
103
+ @rm_type_name = rm_type_name
104
+ end
105
+
106
+ def node_id=(node_id)
107
+ if node_id.nil? || node_id.empty?
108
+ raise ArgumentError, 'invalid node_id'
109
+ end
110
+ @node_id = node_id
111
+ end
112
+
113
+ def occurrences=(occurrences)
114
+ if occurrences.nil?
115
+ raise ArgumentError, 'invaild occurrences'
116
+ end
117
+ @occurrences = occurrences
118
+ end
119
+
120
+ def self.create(args = { }, &block)
121
+ c_object = new(args)
122
+ if block_given?
123
+ yield c_object
124
+ end
125
+ return c_object
126
+ end
127
+ end
128
+
129
+ class CAttribute < ArchetypeConstraint
130
+ attr_reader :rm_attribute_name, :existence
131
+ attr_accessor :children
132
+
133
+ def initialize(args = { })
134
+ super(args)
135
+ self.rm_attribute_name = args[:rm_attribute_name]
136
+ self.existence = args[:existence]
137
+ self.children = args[:children]
138
+ end
139
+
140
+ def rm_attribute_name=(rm_attribute_name)
141
+ if rm_attribute_name.nil? or rm_attribute_name.empty?
142
+ raise ArgumentError, 'invalid rm_attribute_name'
143
+ end
144
+ @rm_attribute_name = rm_attribute_name
145
+ end
146
+
147
+ def existence=(existence)
148
+ if existence.nil? || existence.lower < 0 || existence.upper > 1
149
+ raise ArgumentError, 'invalid existence'
150
+ end
151
+ @existence = existence
152
+ end
153
+ end
154
+
155
+ class CDefinedObject < CObject
156
+ attr_accessor :assumed_value
157
+
158
+ def initialize(args = { })
159
+ super
160
+ self.assumed_value = args[:assumed_value]
161
+ end
162
+
163
+ def has_assumed_value?
164
+ return !@assumed_value.nil?
165
+ end
166
+
167
+ def default_value
168
+ raise NotImplementedError, 'subclass should implement this method'
169
+ end
170
+
171
+ def valid_value?(value)
172
+ raise NotImplementedError, 'subclass should implement this method'
173
+ end
174
+
175
+ def any_allowed?
176
+ raise NotImplementedError, 'subclass should implement this method'
177
+ end
178
+ end
179
+
180
+ class CPrimitiveObject < CDefinedObject
181
+ attr_accessor :item
182
+
183
+ def initialize(args = { })
184
+ super
185
+ self.item = args[:item]
186
+ end
187
+
188
+ def any_allowed?
189
+ return item.nil?
190
+ end
191
+ end
192
+
193
+ class CComplexObject < CDefinedObject
194
+ attr_accessor :attributes
195
+
196
+ def initialize(args = { })
197
+ super
198
+ self.attributes = args[:attributes]
199
+ end
200
+
201
+ def any_allowed?
202
+ return (@attributes.nil? or @attributes.empty?)
203
+ end
204
+
205
+ def self.create(args = { }, &block)
206
+ c_complex_object = new(args)
207
+ if block_given?
208
+ yield c_complex_object
209
+ end
210
+ return c_complex_object
211
+ end
212
+ end
213
+
214
+ class CDomainType < CDefinedObject
215
+ def standard_equivalent
216
+ raise NotImplementedError, 'subclass should be defined'
217
+ end
218
+ end
219
+
220
+ class CReferenceObject < CObject
221
+
222
+ end
223
+
224
+ class ArchetypeInternalRef < CReferenceObject
225
+ attr_reader :target_path
226
+
227
+ def initialize(args = { })
228
+ super
229
+ self.target_path = args[:target_path]
230
+ end
231
+
232
+ def target_path=(target_path)
233
+ if target_path.nil? or target_path.empty?
234
+ raise ArgumentError, 'target_path is mandatory'
235
+ end
236
+ @target_path = target_path
237
+ end
238
+ end
239
+
240
+ class ArchetypeSlot < CReferenceObject
241
+ attr_reader :includes, :excludes
242
+
243
+ def initialize(args = { })
244
+ super
245
+ self.includes = args[:includes]
246
+ self.excludes = args[:excludes]
247
+ end
248
+
249
+ def includes=(includes)
250
+ if !includes.nil? && includes.empty?
251
+ raise ArgumentError, 'includes should not be empty'
252
+ end
253
+ @includes = includes
254
+ end
255
+
256
+ def excludes=(excludes)
257
+ if !excludes.nil? && excludes.empty?
258
+ raise ArgumentError, 'excludes should not be empty'
259
+ end
260
+ @excludes = excludes
261
+ end
262
+
263
+ def any_allowed?
264
+ return includes.nil? && excludes.nil?
265
+ end
266
+
267
+ def self.create(args = { }, &block)
268
+ archetype_slot = new(args)
269
+ archetype_slot.includes = args[:includes]
270
+ archetype_slot.excludes = args[:excludes]
271
+ if block_given?
272
+ yield archetype_slot
273
+ end
274
+ return archetype_slot
275
+ end
276
+ end
277
+
278
+ class ConstraintRef < CReferenceObject
279
+ attr_reader :reference
280
+
281
+ def initialize(args = { })
282
+ super
283
+ self.reference = args[:reference]
284
+ end
285
+
286
+ def reference=(reference)
287
+ if reference.nil?
288
+ raise ArgumentError, 'reference is mandatory'
289
+ end
290
+ @reference = reference
291
+ end
292
+
293
+ def self.create(args = { }, &block)
294
+ constraint_ref = new(args)
295
+ constraint_ref.reference = args[:reference]
296
+ if block_given?
297
+ yield constraint_ref
298
+ end
299
+ return constraint_ref
300
+ end
301
+ end
302
+
303
+ class CSingleAttribute < CAttribute
304
+ attr_reader :alternatives
305
+
306
+ def initialize(args = { })
307
+ super
308
+ self.alternatives = args[:alternatives]
309
+ end
310
+
311
+ def alternatives=(alternatives)
312
+ if alternatives.nil?
313
+ raise ArgumentError, 'alternatives are mandatory'
314
+ end
315
+ @alternatives = alternatives
316
+ end
317
+ end
318
+
319
+ class CMultipleAttribute < CAttribute
320
+ attr_accessor :members
321
+ attr_reader :cardinality
322
+
323
+ def initialize(args = { })
324
+ super
325
+ self.members = args[:members]
326
+ self.cardinality = args[:cardinality]
327
+ end
328
+
329
+ def cardinality=(cardinality)
330
+ if cardinality.nil?
331
+ raise ArgumentError, 'cardinality is mandatory'
332
+ end
333
+ @cardinality = cardinality
334
+ end
335
+ end
336
+ end # of ConstraintModel
337
+ end # of Archetype
338
+ end # of AM
339
+ end # of OpenEHR
340
+
@@ -0,0 +1,97 @@
1
+ module OpenEHR
2
+ module AM
3
+ module Archetype
4
+ module Ontology
5
+ class ArchetypeOntology
6
+ attr_accessor :constraint_definitions, :specialisation_depth
7
+ attr_accessor :term_attribute_names, :term_bindings
8
+ attr_reader :terminologies_available, :term_definitions
9
+
10
+ def initialize(args = { })
11
+ self.specialisation_depth = args[:specialisation_depth]
12
+ self.term_definitions = args[:term_definitions]
13
+ self.constraint_definitions = args[:constraint_definitions]
14
+ self.term_bindings = args[:term_bindings]
15
+ end
16
+
17
+ def term_definitions=(term_definitions)
18
+ if term_definitions.nil?
19
+ raise ArgumentError, 'term_definitions is mandatory'
20
+ end
21
+ @term_definitions = term_definitions
22
+ end
23
+
24
+ def term_codes
25
+ return @term_definitions.values.collect {|value|
26
+ value.collect {|term| term.code}}.flatten.uniq
27
+ end
28
+
29
+ def constraint_codes
30
+ if @constraint_definitions.nil?
31
+ return nil
32
+ else
33
+ return @constraint_definitions.values.collect {|value|
34
+ value.collect {|term| term.code}}.flatten.uniq
35
+ end
36
+ end
37
+
38
+ def terminologies_available
39
+ return @term_bindings.keys
40
+ end
41
+
42
+ def constraint_binding(a_terminology, a_code)
43
+ end
44
+
45
+ def constraint_definition(a_lang, a_code)
46
+ end
47
+
48
+ def has_language?(a_lang)
49
+ end
50
+
51
+ def has_terminology?(a_terminology)
52
+ end
53
+
54
+ def term_binding(a_terminology, a_code)
55
+ end
56
+
57
+ def term_definition(a_lang, a_code)
58
+ end
59
+ end
60
+
61
+ class ARCHETYPE_ONTOLOGY < ArchetypeOntology
62
+
63
+ end
64
+
65
+ class ArchetypeTerm
66
+ attr_accessor :items
67
+ attr_reader :code
68
+
69
+ def initialize(args = { })
70
+ self.code = args[:code]
71
+ self.items =args[:items]
72
+ end
73
+
74
+ def code=(code)
75
+ if code.nil? or code.empty?
76
+ raise ArgumentError, 'code is mandatory'
77
+ end
78
+ @code = code
79
+ end
80
+
81
+ def keys
82
+ if items.nil?
83
+ return Set.new
84
+ else
85
+ return Set.new(@items.keys)
86
+ end
87
+ end
88
+ end
89
+
90
+ class ARCHETYPE_TERM < ArchetypeTerm
91
+
92
+ end
93
+ end # end of Ontology
94
+ end # end of Archetype
95
+ end # end of AM
96
+ end # end of OpenEHR
97
+
@@ -0,0 +1,134 @@
1
+ $:.unshift(File.dirname(__FILE__))
2
+ include OpenEHR::RM::Common::Resource
3
+
4
+ module OpenEHR
5
+ module AM
6
+ module Archetype
7
+ module ADLDefinition
8
+ include OpenEHR::RM::Support::Terminology
9
+ # include OpenEHR::RM::Support::Terminology::OpenEHR_Code_Set_Identifier
10
+ CURRENT_ADL_VERSION = "1.4"
11
+ end
12
+
13
+ class Archetype < AuthoredResource
14
+ include ADLDefinition
15
+ attr_reader :archetype_id, :concept, :definition, :ontology
16
+ attr_accessor :uid, :adl_version, :parent_archetype_id, :invariants
17
+
18
+ def initialize(args = {})
19
+ super(args)
20
+ self.adl_version = args[:adl_version]
21
+ self.archetype_id = args[:archetype_id]
22
+ self.uid = args[:uid]
23
+ self.concept = args[:concept]
24
+ self.parent_archetype_id = args[:parent_archetype_id]
25
+ self.definition = args[:definition]
26
+ self.ontology = args[:ontology]
27
+ self.invariants = args[:invariants]
28
+ end
29
+
30
+ def archetype_id=(archetype_id)
31
+ if archetype_id.nil?
32
+ raise ArgumentError, 'archetype_id is mandatory'
33
+ end
34
+ @archetype_id = archetype_id
35
+ end
36
+
37
+ def concept=(concept)
38
+ if concept.nil?
39
+ raise ArgumentError, 'concept is mandatory'
40
+ end
41
+ @concept = concept
42
+ end
43
+
44
+ def definition=(definition)
45
+ if definition.nil?
46
+ raise ArgumentError, 'definition is mandatory'
47
+ end
48
+ @definition = definition
49
+ end
50
+
51
+ def ontology=(ontology)
52
+ if ontology.nil?
53
+ raise ArgumentError, 'ontology is mandatory'
54
+ end
55
+ @ontology = ontology
56
+ end
57
+
58
+ def version
59
+ return @archetype_id.version_id
60
+ end
61
+
62
+ def short_concept_name
63
+ return @archetype_id.concept_name
64
+ end
65
+
66
+ def concept_name(a_lang)
67
+
68
+ end
69
+
70
+ def constraint_references_valid?
71
+ end
72
+
73
+ def internal_references_valid?
74
+ end
75
+
76
+ def is_specialised?
77
+ end
78
+
79
+ def is_valid?
80
+ end
81
+
82
+ def logical_paths(a_lang)
83
+ end
84
+
85
+ def node_ids_vaild?
86
+ end
87
+
88
+ def physical_paths
89
+ end
90
+
91
+ def previous_version
92
+ end
93
+
94
+ def specialisation_depth
95
+ end
96
+
97
+ def self.create(args ={}, &block)
98
+ archetype = new(args)
99
+ if block_given?
100
+ yield archetype
101
+ end
102
+ return archetype
103
+ end
104
+
105
+ end # end of Archetype
106
+ # original file:
107
+ # ref_imple_eiffel/components/adl_parser/src/interface/adl_definition.e
108
+
109
+ class ValidityKind
110
+ attr_reader :value
111
+
112
+ MANDATORY = 1001
113
+ OPTIONAL = 1002
114
+ DISALLOWED = 1003
115
+
116
+ def initialize(args = { })
117
+ self.value = args[:value]
118
+ end
119
+
120
+ def value=(value)
121
+ unless [MANDATORY, OPTIONAL, DISALLOWED].include? value
122
+ raise ArgumentError, 'invalid value'
123
+ end
124
+ @value = value
125
+ end
126
+ end
127
+
128
+ autoload :Assertion, 'archetype/assertion'
129
+ autoload :ConstraintModel, 'archetype/constraint_model'
130
+ autoload :Ontology, 'archetype/ontology'
131
+
132
+ end # of Archetype
133
+ end # of AM
134
+ end # of OpenEHR
@@ -0,0 +1,29 @@
1
+ module OpenEhr
2
+ module AM
3
+ module OpenEHR_Profile
4
+ module DataTypes
5
+ module Basic
6
+ class C_DV_STATE
7
+ end
8
+
9
+ class STATE_MACHINE
10
+ end
11
+
12
+ class STATE
13
+ end
14
+
15
+ class TERMINAL_STATE < STATE
16
+ end
17
+
18
+ class NON_TERMINAL_STATE < STATE
19
+ end
20
+
21
+ class TRANSITION
22
+ end
23
+ end
24
+
25
+
26
+ end # of Data_Types
27
+ end # of OpenEHR Profile
28
+ end # of RM
29
+ end # of OpenEHR
@@ -0,0 +1,19 @@
1
+ module OpenEhr
2
+ module AM
3
+ module OpenEHR_Profile
4
+ module DataTypes
5
+
6
+ module Quantity
7
+ class C_DV_QUANTITY < OpenEhr::AM::Archetype::Constraint_Model::C_DOMAIN_TYPE
8
+ end
9
+
10
+ class C_DV_ORDINAL < OpenEhr::AM::Archetype::Constraint_Model::C_DOMAIN_TYPE
11
+ end
12
+
13
+ class C_QUANTITY_ITEM
14
+ end
15
+ end
16
+ end # of Data_Types
17
+ end # of OpenEHR Profile
18
+ end # of RM
19
+ end # of OpenEHR
@@ -0,0 +1,12 @@
1
+ module OpenEhr
2
+ module AM
3
+ module OpenEHR_Profile
4
+ module DataTypes
5
+ module Text
6
+ class C_CODE_PHASE < OpenEhr::AM::Archetype::Constraint_Model::C_DOMAIN_TYPE
7
+ end
8
+ end
9
+ end # of Data_Types
10
+ end # of OpenEHR Profile
11
+ end # of RM
12
+ end # of OpenEHR
@@ -0,0 +1,8 @@
1
+ $:.unshift(File.dirname(__FILE__)) unless
2
+ $:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
3
+
4
+ module OpenEHR
5
+ module AM
6
+ autoload :Archetype, 'am/archetype'
7
+ end
8
+ end