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,408 @@
1
+ $:.unshift(File.dirname(__FILE__))
2
+ # This module is an implementation of this UML:
3
+ # http://www.openehr.org/uml/release-1.0.1/Browsable/_9_0_76d0249_1109331021343_528780_2066Report.html
4
+ # Ticket refs #39
5
+ module OpenEHR
6
+ module RM
7
+ module Support
8
+ module Identification
9
+ class ObjectID
10
+ attr_reader :value
11
+
12
+ def initialize(args = {})
13
+ self.value=args[:value]
14
+ end
15
+
16
+ def value=(value)
17
+ raise ArgumentError, "empty value" if value.nil? or value.empty?
18
+ @value = value
19
+ end
20
+
21
+ def ==(object_id)
22
+ self.value == object_id.value
23
+ end
24
+ end # of ObjectID
25
+
26
+ class ObjectRef
27
+ attr_reader :namespace, :type, :id
28
+
29
+ def initialize(args = {})
30
+ self.namespace = args[:namespace]
31
+ self.type = args[:type]
32
+ self.id = args[:id]
33
+ end
34
+
35
+ def namespace=(namespace)
36
+ if namespace.nil? or namespace.empty? or
37
+ !(/^[a-zA-Z][a-zA-Z0-9_\-\:\/\&\+\?]*$/ =~ namespace)
38
+ raise ArgumentError
39
+ end
40
+ @namespace = namespace
41
+ end
42
+
43
+ def type=(type)
44
+ raise ArgumentError if type.nil? or type.empty?
45
+ @type = type
46
+ end
47
+
48
+ def id=(id)
49
+ raise ArgumentError if id.nil?
50
+ @id = id
51
+ end
52
+ end
53
+
54
+ class ArchetypeID < ObjectID
55
+ attr_reader :rm_originator, :rm_name, :rm_entity,
56
+ :concept_name, :specialisation, :version_id
57
+
58
+ def initialize(args = {})
59
+ if args[:value].nil?
60
+ self.rm_originator = args[:rm_originator]
61
+ self.rm_name = args[:rm_name]
62
+ self.rm_entity = args[:rm_entity]
63
+ self.concept_name = args[:concept_name]
64
+ self.version_id = args[:version_id]
65
+ self.specialisation = args[:specialisation]
66
+ else
67
+ super(args)
68
+ end
69
+ end
70
+
71
+ def value=(value)
72
+ if /([a-zA-Z]\w+)-([a-zA-Z]\w+)-([a-zA-Z]\w+)\.([a-zA-Z]\w+)(-([a-zA-Z]\w+))?\.(v[1-9]\d*)/ =~ value
73
+ self.rm_originator = $1
74
+ self.rm_name = $2
75
+ self.rm_entity = $3
76
+ self.concept_name = $4
77
+ self.specialisation = $6
78
+ self.version_id = $7
79
+ else
80
+ raise ArgumentError, 'invalid archetype id form'
81
+ end
82
+ end
83
+
84
+ def qualified_rm_entity
85
+ return @rm_originator + '-' + @rm_name + '-' + @rm_entity
86
+ end
87
+
88
+ def domain_concept
89
+ if @specialisation.nil?
90
+ return @concept_name
91
+ else
92
+ return @concept_name + '-' + @specialisation
93
+ end
94
+ end
95
+
96
+ def value
97
+ return self.qualified_rm_entity + '.' +
98
+ self.domain_concept + '.' + @version_id
99
+ end
100
+
101
+ def concept_name=(concept_name)
102
+ if concept_name.nil? or concept_name.empty?
103
+ raise ArgumentError, 'concept_name is mandatory'
104
+ end
105
+ @concept_name = concept_name
106
+ end
107
+
108
+ def domain_concept=(domain_concept)
109
+ if domain_concept.nil? or domain_concept.empty?
110
+ raise ArgumentError, "domain concept not valid"
111
+ end
112
+ if /([a-zA-Z]\w+)(-([a-zA-Z]\w))?/ =~ domain_concept
113
+ self.concept_name = $1
114
+ self.specialisation = $3
115
+ else
116
+ raise ArgumentError, 'invalid domain concept form'
117
+ end
118
+ end
119
+
120
+ def rm_name=(rm_name)
121
+ raise ArgumentError, "rm_name not valid" if rm_name.nil? or rm_name.empty?
122
+ @rm_name = rm_name
123
+ end
124
+
125
+ def rm_entity=(rm_entity)
126
+ if rm_entity.nil? or rm_entity.empty?
127
+ raise ArgumentError, "rm_entity is mandatory"
128
+ end
129
+ @rm_entity = rm_entity
130
+ end
131
+
132
+ def rm_originator=(rm_originator)
133
+ if rm_originator.nil? or rm_originator.empty?
134
+ raise ArgumentError, "rm_originator not valid"
135
+ end
136
+ @rm_originator = rm_originator
137
+ end
138
+
139
+ def specialisation=(specialisation)
140
+ if !specialisation.nil? and specialisation.empty?
141
+ raise ArgumentError, "rm_specialisation not valid"
142
+ end
143
+ @specialisation = specialisation
144
+ end
145
+
146
+ def version_id=(version_id)
147
+ raise ArgumentError, "version_id not valid" if version_id.nil? or version_id.empty?
148
+ @version_id = version_id
149
+ end
150
+ end
151
+
152
+ class TerminologyID < ObjectID
153
+ attr_reader :name, :version_id
154
+
155
+ def initialize(args = {})
156
+ if args[:value].nil?
157
+ self.name = args[:name]
158
+ self.version_id = args[:version_id]
159
+ else
160
+ super(args)
161
+ end
162
+ end
163
+
164
+ def value
165
+ if @version_id.empty?
166
+ @name
167
+ else
168
+ @name + '(' + @version_id + ')'
169
+ end
170
+ end
171
+
172
+
173
+ def value=(value)
174
+ raise ArgumentError, "value not valid" if value.nil? or value.empty?
175
+ if /(.*)\((.*)\)/ =~ value
176
+ self.name = $1
177
+ self.version_id = $2
178
+ else
179
+ self.name = value
180
+ self.version_id = ''
181
+ end
182
+ end
183
+
184
+ def name=(name)
185
+ raise ArgumentError, "name not valid" if name.nil? or name.empty?
186
+ @name = name
187
+ end
188
+
189
+ def version_id=(version_id)
190
+ if version_id.nil?
191
+ @version_id = ''
192
+ else
193
+ @version_id = version_id
194
+ end
195
+ end
196
+ end # of Terminology_ID
197
+
198
+ class GenericID < ObjectID
199
+ attr_reader :scheme
200
+
201
+ def initialize(args)
202
+ super(args)
203
+ self.scheme = args[:scheme]
204
+ end
205
+
206
+ def scheme=(scheme)
207
+ if scheme.nil? or scheme.empty?
208
+ raise ArgumentError, "scheme not valid"
209
+ end
210
+ @scheme = scheme
211
+ end
212
+ end # of Generic_ID
213
+
214
+ class TemplateID < ObjectID
215
+
216
+ end
217
+
218
+ class UIDBasedID < ObjectID
219
+ attr_reader :root, :extension
220
+
221
+ def initialize(args = {})
222
+ super(args)
223
+ end
224
+
225
+ def value=(value)
226
+ super(value)
227
+ if /(\S+)::(\S+)/ =~ value
228
+ @root = UID.new(:value => $1)
229
+ @extension = $2
230
+ else
231
+ @root = UID.new(:value => value)
232
+ @extension = ''
233
+ end
234
+ end
235
+
236
+ def has_extension?
237
+ return !@extension.empty?
238
+ end
239
+ end
240
+
241
+ class ObjectVersionID < UIDBasedID
242
+ attr_reader :object_id, :creating_system_id, :version_tree_id
243
+
244
+ def initialize(args= {})
245
+ super(args)
246
+ end
247
+
248
+ def value=(value)
249
+ if /^(\S+)::(\S+)::((\d|\.)+)$/ =~ value
250
+ self.object_id = UID.new(:value => $1)
251
+ self.creating_system_id = UID.new(:value => $2)
252
+ self.version_tree_id = VersionTreeID.new(:value => $3)
253
+ else
254
+ raise ArgumentError, 'invalid format'
255
+ end
256
+ end
257
+
258
+ def value
259
+ return @object_id.value + '::' +
260
+ @creating_system_id.value + '::' +
261
+ @version_tree_id.value
262
+ end
263
+
264
+ def object_id=(object_id)
265
+ raise ArgumentError, 'object_id is mandatory' if object_id.nil?
266
+ @object_id = object_id
267
+ end
268
+
269
+ def creating_system_id=(creating_system_id)
270
+ if creating_system_id.nil?
271
+ raise ArgumentError, 'creating_system_id is mandatory'
272
+ end
273
+ @creating_system_id = creating_system_id
274
+ end
275
+
276
+ def version_tree_id=(version_tree_id)
277
+ if version_tree_id.nil?
278
+ raise ArgumentError, 'version_tree_id is mandatory'
279
+ end
280
+ @version_tree_id = version_tree_id
281
+ end
282
+
283
+ def is_branch?
284
+ return @version_tree_id.is_branch?
285
+ end
286
+ end
287
+
288
+ class LocatableRef < ObjectRef
289
+ attr_reader :path
290
+
291
+ def initialize(args = {})
292
+ super(args)
293
+ self.path = args[:path]
294
+ end
295
+
296
+ def path=(path)
297
+ raise ArgumentError if path.nil? or path.empty?
298
+ @path = path
299
+ end
300
+
301
+ def as_uri
302
+ 'ehr://' + @id.value + '/' + @path
303
+ end
304
+ end
305
+
306
+ class PartyRef < ObjectRef
307
+ def type=(type)
308
+ parties = %w[PERSON ORGANISATION GROUP AGENT ROLE PARTY ACTOR]
309
+ raise ArgumentError, 'type invalid' unless parties.include? type
310
+ @type = type
311
+ end
312
+ end
313
+
314
+ class AccessGroupRef < ObjectRef
315
+ def initialize(args = {})
316
+ super(args)
317
+ @type = 'ACCESS_GROUP'
318
+ end
319
+
320
+ def type=(type)
321
+ end
322
+ end
323
+
324
+ class HierObjectID < UIDBasedID
325
+
326
+ end
327
+
328
+ class VersionTreeID
329
+ attr_reader :trunk_version, :branch_number, :branch_version
330
+
331
+ def initialize(args = {})
332
+ self.value = args[:value]
333
+ end
334
+
335
+ def value=(value)
336
+ raise ArgumentError, 'value invalid' if value.nil? or value.empty?
337
+ (trunk_version, branch_number, branch_version) = value.split '.'
338
+ self.trunk_version = trunk_version
339
+ self.branch_number = branch_number
340
+ self.branch_version = branch_version
341
+ end
342
+
343
+ def value
344
+ @value = trunk_version
345
+ @value = @value + '.' + @branch_number unless @branch_number.nil?
346
+ @value = @value + '.' + @branch_version unless @branch_version.nil?
347
+ return @value
348
+ end
349
+
350
+ def trunk_version=(trunk_version)
351
+ if trunk_version.nil? || (trunk_version.to_i < 1)
352
+ raise ArgumentError, 'trunk_version invalid'
353
+ end
354
+ @trunk_version = trunk_version
355
+ end
356
+
357
+ def branch_number=(branch_number)
358
+ unless branch_number.nil? or branch_number.to_i >= 1
359
+ raise ArgumentError, 'branch number invalid'
360
+ end
361
+ @branch_number = branch_number
362
+ end
363
+
364
+ def branch_version=(branch_version)
365
+ if (!branch_version.nil? and !(branch_version.to_i >= 1)) or
366
+ (!branch_version.nil? and @branch_number.nil?)
367
+ raise ArgumentError, 'branch version invalid'
368
+ end
369
+ @branch_version = branch_version
370
+ end
371
+
372
+ def is_branch?
373
+ !@branch_version.nil? and !@branch_number.nil?
374
+ end
375
+
376
+ def is_first?
377
+ trunk_version == '1'
378
+ end
379
+ end
380
+
381
+ class UID
382
+ attr_reader :value
383
+
384
+ def initialize(args = {})
385
+ self.value = args[:value]
386
+ end
387
+
388
+ def value=(value)
389
+ raise ArgumentError if value.nil? or value.empty?
390
+ @value = value
391
+ end
392
+ end
393
+
394
+ class UUID < UID
395
+
396
+ end
397
+
398
+ class InternetID <UID
399
+
400
+ end
401
+
402
+ class IsoOID <UID
403
+
404
+ end
405
+ end # of Identification
406
+ end # of Support
407
+ end # of RM
408
+ end # of OpenEHR
@@ -0,0 +1,17 @@
1
+ module OpenEHR
2
+ module RM
3
+ module Support
4
+ module Measurement
5
+ class MeasurementService
6
+ end
7
+ module ExternalEnvironmentAccess
8
+ def eea_terminology_svc
9
+ end
10
+
11
+ def eea_measurement_svc
12
+ end
13
+ end
14
+ end # of Measurment
15
+ end # of Support
16
+ end # of RM
17
+ end # of OpenEHR
@@ -0,0 +1,135 @@
1
+
2
+ module OpenEHR
3
+ module RM
4
+ module Support
5
+ module Terminology
6
+ class CodeSetAccess
7
+ def all_codes
8
+ raise NotImplementedError, "all_codes must be implemented"
9
+ end
10
+
11
+ def has_code(a_code)
12
+ raise NotImplementedError, "has_code must be implemented"
13
+ end
14
+
15
+ def has_lang(a_lang)
16
+ raise NotImplementedError, "has_lang must be implemented"
17
+ end
18
+
19
+ def id
20
+ raise NotImplementedError, "id must be returned"
21
+ end
22
+ end
23
+
24
+ module OpenEHRCodeSetIdentifier
25
+ CODE_SET_ID_CHARACER_SETS = "character sets".freeze
26
+ CODE_SET_ID_COMPRESSION_ALGORITHMS = "compression algorithms".freeze
27
+ CODE_SET_ID_COUNTRIES = "countries".freeze
28
+ CODE_SET_ID_INTEGRITY_CHECK_ALGORITHMS = "integrity check algorithms".freeze
29
+ CODE_SET_ID_LANGUAGES = "languages".freeze
30
+ CODE_SET_ID_MEDIA_TYPES = "media types".freeze
31
+ def valid_code_set_id(an_id)
32
+ !@an_id.nil?
33
+ end
34
+ end
35
+
36
+ module OpenEHRTerminologyGroupIdentifiers
37
+ GROUP_ID_ATTESTATION_REASON = "attestation reason".freeze
38
+ GROUP_ID_AUDIT_CHANGE_TYPE = "audit change type".freeze
39
+ GROUP_ID_COMPOSITION_CATEGORY = "composition category".freeze
40
+ GROUP_ID_MATH_FUNCTION = "event math function".freeze
41
+ GROUP_ID_INSTRUCTION_STATES = "instruction states".freeze
42
+ GROUP_ID_INSTRUCTION_TRANSITIONS = "instruction transitions".freeze
43
+ GROUP_ID_NULL_FLAVOURS = "null flavours".freeze
44
+ GROUP_ID_PARTICIPATION_FUNCTION = "participation function".freeze
45
+ GROUP_ID_PARTICIPATION_MODE = "participation mode".freeze
46
+ GROUP_ID_PROPERTY = "property".freeze
47
+ GROUP_ID_SETTING = "setting".freeze.freeze
48
+ GROUP_ID_SUBJECT_RELATIONSHIP = "subject relationship".freeze
49
+ GROUP_ID_TERM_MAPPING_PURPOSE = "term mapping purpose".freeze
50
+ GROUP_ID_VERSION_LIFECYCLE_STATE = "version lifecycle state".freeze
51
+ TERMINOLOGY_ID = "openehr".freeze
52
+ end
53
+
54
+ class TerminologyAccess
55
+ attr_reader :id
56
+
57
+ def initialize(args = {})
58
+ self.id = args[:id]
59
+ end
60
+
61
+ def all_codes
62
+ raise NotImplementedError, "all_codes is not implemented"
63
+ end
64
+
65
+ def codes_for_group_id(group_id)
66
+ raise NotImplementedError, "codes_for_group_id is not implemented"
67
+ end
68
+
69
+ def codes_for_group_name(name, lang)
70
+ raise NotImplementedError, "codes_for_group_name is not implemented"
71
+ end
72
+
73
+ def has_code_for_group_id(group_id, a_code)
74
+
75
+ end
76
+
77
+ def id=(id)
78
+ @terminology = Terminology.find_all_by_name(id)
79
+ @id = id
80
+ end
81
+
82
+ def rubric_for_code(code, lang)
83
+ return Terminology.find(:first, :conditions => {:code => code,
84
+ :lang => lang})
85
+ end
86
+
87
+ private
88
+ def id_exists
89
+ if id.nil?
90
+ raise ArgumentError, "id must not be nil"
91
+ elsif id.empty?
92
+ raise ArgumentError, "id must not be empty"
93
+ end
94
+ end
95
+ end
96
+
97
+ class TerminologyService
98
+ include OpenEHRCodeSetIdentifier, OpenEHRTerminologyGroupIdentifiers
99
+
100
+ def code_set(name)
101
+ raise NotImplementedError, "code_set is not implemented"
102
+ end
103
+
104
+ def code_set_for_id(id)
105
+ raise NotImplementedError, "code_set_for_id is not implemented"
106
+ end
107
+
108
+ def code_set_identifiers
109
+ raise NotImplementedError, "code_set_for_identifiers is not implemented"
110
+ end
111
+
112
+ def has_code_set(name)
113
+ raise NotImplementedError, "has_code_set is not implemented"
114
+ end
115
+
116
+ def has_terminology?(name)
117
+ raise NotImplementedError, "has_terminology is not implemented"
118
+ end
119
+
120
+ def openehr_code_sets
121
+ raise NotImplementedError, "openehr_code_set is not implemented"
122
+ end
123
+
124
+ def terminology(name)
125
+ return TerminologyAccess.new(:id => name)
126
+ end
127
+
128
+ def terminology_identifiers
129
+ raise NotImplementedError, "terminology_identiferes is not implemented"
130
+ end
131
+ end
132
+ end # of Terminology
133
+ end # of Support
134
+ end # of RM
135
+ end # of OpenEHR
@@ -0,0 +1,14 @@
1
+ $:.unshift(File.dirname(__FILE__)) unless
2
+ $:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
3
+
4
+ module OpenEHR
5
+ module RM
6
+ module Support
7
+ autoload :AssumedTypes, 'support/assumed_types'
8
+ autoload :Definition, 'support/definition'
9
+ autoload :Identification, 'support/identification'
10
+ autoload :Measurement, 'support/measurement'
11
+ autoload :Terminology, 'support/terminology'
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,16 @@
1
+ $:.unshift(File.dirname(__FILE__)) unless
2
+ $:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
3
+
4
+ module OpenEHR
5
+ module RM
6
+ autoload :Common, 'rm/common'
7
+ autoload :Composition, 'rm/composition'
8
+ autoload :DataStructures, 'rm/data_structures'
9
+ autoload :DataTypes, 'rm/data_types'
10
+ autoload :Demographic, 'rm/demographic'
11
+ autoload :EHR, 'rm/ehr'
12
+ autoload :Integration, 'rm/integration'
13
+ autoload :Security, 'rm/security'
14
+ autoload :Support, 'rm/support'
15
+ end
16
+ end