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,82 @@
1
+ # This module is implemented from this UML:
2
+ #http://www.openehr.org/uml/release-1.0.1/Browsable/_9_0_76d0249_1109701308832_384250_6986Report.html
3
+ # Ticket refs #46
4
+ require 'uri/generic'
5
+
6
+ module URI
7
+ class EHR < ::URI::Generic
8
+ COMPONENT = [
9
+ :scheme, :path, :fragment, :query
10
+ ].freeze
11
+
12
+ def self.build(args)
13
+ tmp = Util::make_components_hash(self, args)
14
+ super(tmp)
15
+ end
16
+
17
+ def initialize(*arg)
18
+ super(*arg)
19
+ end
20
+
21
+ def self.use_registry
22
+ true
23
+ end
24
+ end
25
+ @@schemes['EHR'] = EHR
26
+ end
27
+
28
+ module OpenEHR
29
+ module RM
30
+ module DataTypes
31
+ module URI
32
+ class DvUri < OpenEHR::RM::DataTypes::Basic::DataValue
33
+ def initialize(args = {})
34
+ self.value = args[:value]
35
+ end
36
+
37
+ def value
38
+ @value.to_s
39
+ end
40
+
41
+ def fragment_id
42
+ @value.fragment
43
+ end
44
+
45
+ def path
46
+ @value.path
47
+ end
48
+
49
+ def query
50
+ @value.query
51
+ end
52
+
53
+ def scheme
54
+ @value.scheme
55
+ end
56
+
57
+ def value=(value)
58
+ raise ArgumentError, "value is empty" if value.nil?
59
+ parse(value)
60
+ end
61
+
62
+ private
63
+
64
+ def parse(value)
65
+ @value = ::URI.parse(value)
66
+ end
67
+ end
68
+
69
+ class DvEhrUri < DvUri
70
+ def initialize(value)
71
+ super(value)
72
+ end
73
+
74
+ def value=(value)
75
+ raise ArgumentError, "scheme must be ehr" if !(value =~ /^ehr/i)
76
+ @value = parse(value)
77
+ end
78
+ end # of DV_EHR_URI
79
+ end # of URI
80
+ end # of DataTypes
81
+ end # of RM
82
+ 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
+ module OpenEHR
4
+ module RM
5
+ module DataTypes
6
+ autoload :Basic, 'data_types/basic'
7
+ autoload :Encapsulated, 'data_types/encapsulated'
8
+ autoload :Quantity, 'data_types/quantity'
9
+ autoload :Text, 'data_types/text'
10
+ autoload :TimeSpecification, 'data_types/time_specification'
11
+ autoload :URI, 'data_types/uri'
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,269 @@
1
+ # This module is based on the UML,
2
+ # http://www.openehr.org/uml/release-1.0.1/Browsable/_9_5_76d0249_1118674798473_6021_0Report.html
3
+ # Ticket refs #45
4
+ include OpenEHR::RM::Common::Archetyped
5
+
6
+ module OpenEHR
7
+ module RM
8
+ module Demographic
9
+ class Party < Locatable
10
+ attr_reader :uid, :identities, :contacts, :relationships,
11
+ :reverse_relationships
12
+ attr_accessor :details
13
+ alias :type :name
14
+
15
+ def initialize(args = { })
16
+ super(args)
17
+ self.uid = args[:uid]
18
+ self.identities = args[:identities]
19
+ self.contacts = args[:contacts]
20
+ self.relationships = args[:relationships]
21
+ self.reverse_relationships =
22
+ args[:reverse_relationships]
23
+ self.details = args[:details]
24
+ end
25
+
26
+ def uid=(uid)
27
+ raise ArgumentError, 'uid is mandatory' if uid.nil?
28
+ @uid = uid
29
+ end
30
+
31
+ def identities=(identities)
32
+ if identities.nil? || identities.empty?
33
+ raise ArgumentError, 'identities are mandatory'
34
+ end
35
+ @identities = identities
36
+ end
37
+
38
+ def contacts=(contacts)
39
+ if !contacts.nil? && contacts.empty?
40
+ raise ArgumentError, 'contacts should not be empty'
41
+ end
42
+ @contacts = contacts
43
+ end
44
+
45
+ def parent=(parent)
46
+ @parent = nil
47
+ end
48
+
49
+ def relationships=(relationships)
50
+ unless relationships.nil?
51
+ if relationships.empty?
52
+ raise ArgumentError, 'relationships should not be empty?'
53
+ else
54
+ relationships.each do |rel|
55
+ if rel.source.id.value != @uid.value
56
+ raise ArgumentError, 'invalid source of relationships'
57
+ end
58
+ end
59
+ end
60
+ end
61
+ @relationships = relationships
62
+ end
63
+
64
+ def reverse_relationships=(reverse_relationships)
65
+ if !reverse_relationships.nil? && reverse_relationships.empty?
66
+ raise ArgumentError, 'reverse_relationships should not be empty'
67
+ end
68
+ @reverse_relationships = reverse_relationships
69
+ end
70
+ end
71
+
72
+ class PartyIdentity < Locatable
73
+ attr_reader :details
74
+
75
+ def initialize(args = { })
76
+ super(args)
77
+ self.details = args[:details]
78
+ end
79
+
80
+ def details=(details)
81
+ if details.nil?
82
+ raise ArgumentError, 'details are mandatory'
83
+ end
84
+ @details = details
85
+ end
86
+
87
+ def purpose
88
+ return @name
89
+ end
90
+ end
91
+
92
+ class Contact < Locatable
93
+ attr_accessor :time_validity
94
+ attr_reader :addresses
95
+
96
+ def initialize(args = { })
97
+ super(args)
98
+ self.addresses = args[:addresses]
99
+ self.time_validity = args[:time_validity]
100
+ end
101
+
102
+ def purpose
103
+ return @name
104
+ end
105
+
106
+ def addresses=(addresses)
107
+ if addresses.nil? || addresses.empty?
108
+ raise ArgumentError, 'address is mandatory'
109
+ end
110
+ @addresses = addresses
111
+ end
112
+ end
113
+
114
+ class Address < Locatable
115
+ attr_reader :details
116
+
117
+ def initialize(args = { })
118
+ super(args)
119
+ self.details = args[:details]
120
+ end
121
+
122
+ def details=(details)
123
+ if details.nil?
124
+ raise ArgumentError, 'details are mandatory'
125
+ end
126
+ @details = details
127
+ end
128
+
129
+ def type
130
+ return @name
131
+ end
132
+ end
133
+
134
+ class Actor < Party
135
+ LEAGAL_IDENTITY = 'legal identity'
136
+ attr_reader :languages, :roles
137
+
138
+ def initialize(args = { })
139
+ super(args)
140
+ self.roles = args[:roles]
141
+ self.languages = args[:languages]
142
+ end
143
+
144
+ def roles=(roles)
145
+ if !roles.nil? && roles.empty?
146
+ raise ArgumentError, 'roles should not be empty'
147
+ end
148
+ @roles = roles
149
+ end
150
+
151
+ def has_legal_identity?
152
+ @identities.each do |identity|
153
+ if identity.purpose.value == LEAGAL_IDENTITY
154
+ return true
155
+ end
156
+ end
157
+ return false
158
+ end
159
+
160
+ def languages=(languages)
161
+ if !languages.nil? && languages.empty?
162
+ raise ArgumentError, 'languages should not be empty.'
163
+ end
164
+ @languages = languages
165
+ end
166
+ end
167
+
168
+ class Person < Actor
169
+
170
+ end
171
+
172
+ class Organisation < Actor
173
+
174
+ end
175
+
176
+ class Group < Actor
177
+
178
+ end
179
+
180
+ class Agent < Actor
181
+
182
+ end
183
+
184
+ class Role < Party
185
+ attr_reader :performer, :capabilities
186
+ attr_accessor :time_validity
187
+
188
+ def initialize(args = { })
189
+ super(args)
190
+ self.performer = args[:performer]
191
+ self.capabilities = args[:capabilities]
192
+ self.time_validity = args[:time_validity]
193
+ end
194
+
195
+ def performer=(performer)
196
+ if performer.nil?
197
+ raise ArgumentError, 'performer is mandatory'
198
+ end
199
+ @performer = performer
200
+ end
201
+
202
+ def capabilities=(capabilities)
203
+ if !capabilities.nil? && capabilities.empty?
204
+ raise ArgumentError, 'capability should not be empty'
205
+ end
206
+ @capabilities = capabilities
207
+ end
208
+ end
209
+
210
+ class Capability < Locatable
211
+ attr_reader :credentials
212
+ attr_accessor :time_validity
213
+
214
+ def initialize(args = { })
215
+ super(args)
216
+ self.credentials = args[:credentials]
217
+ self.time_validity = args[:time_validity]
218
+ end
219
+
220
+ def credentials=(credentials)
221
+ if credentials.nil?
222
+ raise ArgumentError, 'credentials are mandatory'
223
+ end
224
+ @credentials = credentials
225
+ end
226
+ end
227
+
228
+ class PartyRelationship < Locatable
229
+ attr_accessor :details, :time_validity
230
+ attr_reader :source, :target
231
+ alias :type :name
232
+
233
+ def initialize(args = { })
234
+ super(args)
235
+ self.uid = args[:uid]
236
+ self.details = args[:details]
237
+ self.time_validity = args[:time_validity]
238
+ self.source = args[:source]
239
+ self.target = args[:target]
240
+ end
241
+
242
+ def uid=(uid)
243
+ if uid.nil?
244
+ raise ArgumentError, 'uid is mandatory'
245
+ end
246
+ @uid = uid
247
+ end
248
+
249
+ def source=(source)
250
+ if source.nil? or source.id.value != @uid.value
251
+ raise ArgumentError, 'source is invalid'
252
+ end
253
+ @source = source
254
+ end
255
+
256
+ def target=(target)
257
+ if target.nil?
258
+ raise ArgumentError, 'taraget is invalid'
259
+ end
260
+ @target = target
261
+ end
262
+ end
263
+
264
+ class VersionedParty < Locatable
265
+
266
+ end
267
+ end # of Demographic
268
+ end # of RM
269
+ end # of OpenEHR
@@ -0,0 +1,162 @@
1
+ # rm::ehr
2
+ # ehr module
3
+ # http://www.openehr.org/uml/release-1.0.1/Browsable/_9_0_76d0249_1109004889781_854011_47Report.html
4
+ # refs #44
5
+ include OpenEHR::RM::Common::ChangeControl
6
+ include OpenEHR::RM::Common::Archetyped
7
+ include OpenEHR::RM::Security
8
+
9
+ module OpenEHR
10
+ module RM
11
+ module EHR
12
+ class EHR
13
+ attr_reader :system_id, :ehr_id, :time_created, :contributions,
14
+ :ehr_access, :ehr_status, :compositions, :directory
15
+
16
+ def initialize(args = { })
17
+ self.system_id = args[:system_id]
18
+ self.ehr_id = args[:ehr_id]
19
+ self.time_created = args[:time_created]
20
+ self.contributions = args[:contributions]
21
+ self.ehr_access = args[:ehr_access]
22
+ self.ehr_status = args[:ehr_status]
23
+ self.compositions = args[:compositions]
24
+ self.directory = args[:directory]
25
+ end
26
+
27
+ def system_id=(system_id)
28
+ if system_id.nil?
29
+ raise ArgumentError, 'system_id is mandatory'
30
+ end
31
+ @system_id = system_id
32
+ end
33
+
34
+ def ehr_id=(ehr_id)
35
+ if ehr_id.nil?
36
+ raise ArgumentError, 'ehr_id is mandatory'
37
+ end
38
+ @ehr_id = ehr_id
39
+ end
40
+
41
+ def time_created=(time_created)
42
+ if time_created.nil?
43
+ raise ArgumentError, 'time_created is mandatory'
44
+ end
45
+ @time_created = time_created
46
+ end
47
+
48
+ def contributions=(contributions)
49
+ unless contributions.nil?
50
+ contributions.each do |contrib|
51
+ unless contrib.type == 'CONTRIBUTION'
52
+ raise ArgumentError, 'contribution type should be CONTRIBUTION'
53
+ end
54
+ end
55
+ @contributions = contributions
56
+ else
57
+ raise ArgumentError, 'contributions are mandatory'
58
+ end
59
+ end
60
+
61
+ def ehr_access=(ehr_access)
62
+ if ehr_access.nil? || ehr_access.type != 'VERSIONED_EHR_ACCESS'
63
+ raise ArgumentError, 'ehr_access is invalid'
64
+ end
65
+ @ehr_access = ehr_access
66
+ end
67
+
68
+ def ehr_status=(ehr_status)
69
+ if ehr_status.nil? || ehr_status.type != 'VERSIONED_EHR_STATUS'
70
+ raise ArgumentError, 'ehr_status is invalid'
71
+ end
72
+ @ehr_status = ehr_status
73
+ end
74
+
75
+ def compositions=(compositions)
76
+ unless compositions.nil?
77
+ compositions.each do |compo|
78
+ unless compo.type == 'VERSIONED_COMPOSITION'
79
+ raise ArgumentError, 'composition type should be VERSIONED_COMPOSITION'
80
+ end
81
+ end
82
+ @compositions = compositions
83
+ else
84
+ raise ArgumentError, 'compositions are mandatory'
85
+ end
86
+ end
87
+
88
+ def directory=(directory)
89
+ if !directory.nil? && directory.type != 'VERSIONED_FOLDER'
90
+ raise ArgumentError, 'invalid directory'
91
+ end
92
+ @directory = directory
93
+ end
94
+ end
95
+
96
+ class VersionedEHRAccesss < VersionedObject
97
+
98
+ end
99
+
100
+ class EHRAccess < Locatable
101
+ attr_accessor :settings
102
+ attr_reader :scheme
103
+
104
+ def initialize(args = { })
105
+ super(args)
106
+ self.settings = args[:settings]
107
+ self.scheme = args[:scheme]
108
+ end
109
+
110
+ def scheme=(scheme)
111
+ if scheme.nil? || scheme.empty?
112
+ raise ArgumentError, 'scheme is mandatory'
113
+ end
114
+ @scheme = scheme
115
+ end
116
+ end
117
+
118
+ class VersionedEHRStatus < VersionedObject
119
+
120
+ end
121
+
122
+ class EHRStatus < Locatable
123
+ attr_reader :subject
124
+ attr_accessor :is_modifiable, :is_queryable, :other_details
125
+
126
+ def initialize(args = { })
127
+ super(args)
128
+ self.subject = args[:subject]
129
+ self.is_queryable = args[:is_queryable]
130
+ self.is_modifiable = args[:is_modifiable]
131
+ self.other_details = args[:other_details]
132
+ end
133
+
134
+ def subject=(subject)
135
+ raise ArgumentError, 'subject is mandatory' if subject.nil?
136
+ @subject = subject
137
+ end
138
+
139
+ def is_queryable?
140
+ return @is_queryable
141
+ end
142
+
143
+ def is_modifiable?
144
+ return @is_modifiable
145
+ end
146
+
147
+ def parent=(parent)
148
+ unless parent.nil?
149
+ raise ArgumentError, 'parent should be nil'
150
+ end
151
+ @parent = parent
152
+ end
153
+ end
154
+
155
+ class VersionedComposition < VersionedObject
156
+ def is_persistent?
157
+ return @all_versions.first.data.is_persistent?
158
+ end
159
+ end
160
+ end # of EHR
161
+ end # of RM
162
+ end # of OpenEHR
@@ -0,0 +1,27 @@
1
+ # rm::integration
2
+ # integration module
3
+ # http://www.openehr.org/uml/release-1.0.1/Browsable/_9_5_1_76d0249_1140530578205_529440_4046Report.html
4
+ # refs #42
5
+ include OpenEHR::RM::Composition::Content
6
+
7
+ module OpenEHR
8
+ module RM
9
+ module Integration
10
+ class GenericEntry < ContentItem
11
+ attr_reader :data
12
+
13
+ def initialize(args = { })
14
+ super(args)
15
+ self.data = args[:data]
16
+ end
17
+
18
+ def data=(data)
19
+ if data.nil?
20
+ raise ArgumentError, 'data are mandatory'
21
+ end
22
+ @data = data
23
+ end
24
+ end
25
+ end # of Integration
26
+ end # of RM
27
+ end # of OpenEHR
@@ -0,0 +1,12 @@
1
+ # This module is based on the UML,
2
+ # http://www.openehr.org/uml/release-1.0.1/Browsable/_9_5_1_76d0249_1155650882301_836618_5314Report.html
3
+ # Ticket refs #41
4
+ module OpenEHR
5
+ module RM
6
+ module Security
7
+ class AccessControlSettings
8
+
9
+ end
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,81 @@
1
+ # Because his module utilise common methods in both rm
2
+ # and am, I will integrated to /lib/models/assumed_types.rb.
3
+ # By Shinji KOBAYASHI, 2008-07-20
4
+ module OpenEhr
5
+ module RM
6
+ module Support
7
+ module AssumedTypes
8
+ class Interval
9
+ attr_accessor :lower, :upper
10
+ # attr_accessor :lower_included, :lower_unbounded
11
+ # attr_accessor :upper_included, :upper_unbounded
12
+ def initialize(lower, upper,
13
+ lower_included = nil, upper_included = nil)
14
+ if ((lower !=nil) && (upper !=nil)) && lower>upper
15
+ raise ArgumentError, "upper < lower"
16
+ end
17
+ @lower = lower
18
+ @upper = upper
19
+ end
20
+ end
21
+
22
+ class List
23
+ attr_reader :content
24
+
25
+ def initialize(arg)
26
+ @content = arg
27
+ end
28
+
29
+ def first
30
+ @content.first
31
+ end
32
+
33
+ def last
34
+ @content.last
35
+ end
36
+ end
37
+
38
+ class TIME_DEFINITIONS
39
+ end
40
+
41
+
42
+ class ISO8601_DATE < TIME_DEFINITIONS
43
+ end
44
+
45
+ class ISO8601_TIME < TIME_DEFINITIONS
46
+ end
47
+
48
+ class ISO8601_DURATION < TIME_DEFINITIONS
49
+ end
50
+
51
+ class ISO8601_DATE_TIME < TIME_DEFINITIONS
52
+ end
53
+
54
+ class ISO8601_TIMEZONE < TIME_DEFINITIONS
55
+ end
56
+
57
+ class String
58
+ attr_reader :content
59
+ def initialize(arg)
60
+ @content = arg
61
+ end
62
+
63
+ def as_integer
64
+ is_integer if is_integer
65
+ end
66
+
67
+ def is_empty
68
+ end
69
+
70
+ def is_integer
71
+ begin
72
+ Integer(@content)
73
+ rescue
74
+ false
75
+ end
76
+ end
77
+ end
78
+ end
79
+ end
80
+ end
81
+ end
@@ -0,0 +1,15 @@
1
+ module OpenEHR
2
+ module RM
3
+ module Support
4
+ module Definition
5
+ module BasicDefinition
6
+ CR = "\015"
7
+ LF = "\012"
8
+ end
9
+ class OpenEHRDefinitions
10
+ include BasicDefinition
11
+ end
12
+ end
13
+ end
14
+ end
15
+ end