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,51 @@
1
+ require File.dirname(__FILE__) + '/../../../../../spec_helper'
2
+ include OpenEHR::RM::Common::Archetyped
3
+ include OpenEHR::RM::DataTypes::Encapsulated
4
+ include OpenEHR::RM::DataTypes::Basic
5
+
6
+ describe FeederAudit do
7
+ before(:each) do
8
+ originating_system_audit = stub(FeederAuditDetails, :system_id => 'CASPAR')
9
+ originating_system_item_ids = stub(Array, :size => 10)
10
+ feeder_system_audit = stub(FeederAuditDetails, :system_id => 'BARTHASAR')
11
+ feeder_system_item_ids = stub(Array, :size => 5)
12
+ original_content = stub(DvEncapsulated, :charset => 'UTF-8')
13
+ @feeder_audit = FeederAudit.new(
14
+ :originating_system_audit => originating_system_audit,
15
+ :originating_system_item_ids => originating_system_item_ids,
16
+ :feeder_system_audit => feeder_system_audit,
17
+ :feeder_system_item_ids => feeder_system_item_ids,
18
+ :original_content => original_content)
19
+ end
20
+
21
+ it 'should be an instance of FeederAudit' do
22
+ @feeder_audit.should be_an_instance_of FeederAudit
23
+ end
24
+
25
+ it 'originating_system_audit.system_id should be CASPAR' do
26
+ @feeder_audit.originating_system_audit.system_id.should == 'CASPAR'
27
+ end
28
+
29
+ it 'originating_system_item_ids.size should be equal 10' do
30
+ @feeder_audit.originating_system_item_ids.size.should be_equal 10
31
+ end
32
+
33
+ it 'feeder_system_audit.system_id should BARTHASAR' do
34
+ @feeder_audit.feeder_system_audit.system_id.should == 'BARTHASAR'
35
+ end
36
+
37
+ it 'feeder_system_item_ids.size should be equal 5' do
38
+ @feeder_audit.feeder_system_item_ids.size.should be_equal 5
39
+ end
40
+
41
+ it 'original_content.charset should be UTF-8' do
42
+ @feeder_audit.original_content.charset.should == 'UTF-8'
43
+ end
44
+
45
+ it 'should raise ArgumentError with nil originating_system_audit' do
46
+ lambda {
47
+ @feeder_audit.originating_system_audit = nil
48
+ }.should raise_error ArgumentError
49
+ end
50
+ end
51
+
@@ -0,0 +1,42 @@
1
+ require File.dirname(__FILE__) + '/../../../../../spec_helper'
2
+ include OpenEHR::RM::Common::Archetyped
3
+ include OpenEHR::RM::DataTypes::Text
4
+ include OpenEHR::RM::DataTypes::URI
5
+
6
+ describe Link do
7
+ before(:each) do
8
+ @link = Link.new(:meaning => DvText.new(:value => 'generic'),
9
+ :type => DvText.new(:value => 'problem'),
10
+ :target => DvEhrUri.new(:value => 'ehr://test'))
11
+ end
12
+
13
+ it 'should be an instance of Link' do
14
+ @link.should be_an_instance_of Link
15
+ end
16
+
17
+ it 'meaning should be generic' do
18
+ @link.meaning.value.should == 'generic'
19
+ end
20
+
21
+ it 'target should be ehr://test' do
22
+ @link.target.value.should == 'ehr://test'
23
+ end
24
+
25
+ it 'should raise ArgumentError with nil meaning' do
26
+ lambda {
27
+ @link.meaning = nil
28
+ }.should raise_error ArgumentError
29
+ end
30
+
31
+ it 'should raise ArgumentError with nil type' do
32
+ lambda {
33
+ @link.type = nil
34
+ }.should raise_error ArgumentError
35
+ end
36
+
37
+ it 'should raise ArgumentError with nil target' do
38
+ lambda {
39
+ @link.target = nil
40
+ }.should raise_error ArgumentError
41
+ end
42
+ end
@@ -0,0 +1,89 @@
1
+ require File.dirname(__FILE__) + '/../../../../../spec_helper'
2
+ include OpenEHR::RM::Common::Archetyped
3
+ include OpenEHR::RM::DataTypes::Text
4
+ include OpenEHR::RM::Support::Identification
5
+
6
+ describe Locatable do
7
+ before(:each) do
8
+ name = DvText.new(:value => 'problem/SOAP')
9
+ link = stub(Set, :size => 10, :empty? => false)
10
+ uid = UIDBasedID.new(:value => 'ehr::localhost/3030')
11
+ archetype_id = ArchetypeID.new(:value =>
12
+ 'openEHR-EHR-SECTION.physical_examination.v2')
13
+ archetype_details = stub(Archetyped, :rm_version => '1.2.4',
14
+ :archetype_id => archetype_id)
15
+ feeder_audit = stub(FeederAudit, :system_id => 'MAGI')
16
+ @locatable = Locatable.new(:archetype_node_id => 'at001',
17
+ :name => name,
18
+ :links => link,
19
+ :uid => uid,
20
+ :feeder_audit => feeder_audit,
21
+ :archetype_details => archetype_details)
22
+ end
23
+
24
+ it 'should be_an_instance_of Locatable' do
25
+ @locatable.should be_an_instance_of Locatable
26
+ end
27
+
28
+ it 'archetype_node_id should be at001' do
29
+ @locatable.archetype_node_id.should == 'at001'
30
+ end
31
+
32
+ it 'is_archetype_root? should be true' do
33
+ @locatable.is_archetype_root?.should be_true
34
+ end
35
+
36
+ it 'is_archetype_root? should be false when archetype_details is nil' do
37
+ @locatable.archetype_details = nil
38
+ @locatable.is_archetype_root?.should be_false
39
+ end
40
+
41
+ it 'link size should be 10' do
42
+ @locatable.links.size.should == 10
43
+ end
44
+
45
+ it 'name.value should problem/soap' do
46
+ @locatable.name.value.should == 'problem/SOAP'
47
+ end
48
+
49
+ it 'uid.value should be ehr::localhost/3030' do
50
+ @locatable.uid.value.should == 'ehr::localhost/3030'
51
+ end
52
+
53
+ it 'archetype_details.rm_version should be 1.2.4' do
54
+ @locatable.archetype_details.rm_version.should == '1.2.4'
55
+ end
56
+
57
+ it 'feeer_audit.system_id should MAGI' do
58
+ @locatable.feeder_audit.system_id.should == 'MAGI'
59
+ end
60
+
61
+ it 'concept should be physical_examination' do
62
+ @locatable.concept.value.should == 'physical_examination'
63
+ end
64
+
65
+ it 'should raise ArgumentError with nil archetype_node_id' do
66
+ lambda {
67
+ @locatable.archetype_node_id = nil
68
+ }.should raise_error ArgumentError
69
+ end
70
+
71
+ it 'should raise ArgumentError with nil name' do
72
+ lambda {
73
+ @locatable.name = nil
74
+ }.should raise_error ArgumentError
75
+ end
76
+
77
+ it 'should raise ArgumentError with empty links' do
78
+ lambda {
79
+ @locatable.links = Set.new
80
+ }.should raise_error ArgumentError
81
+ end
82
+
83
+ it 'should raise ArgumentError Archetyped invalid' do
84
+ @locatable.archetype_details = nil
85
+ lambda {
86
+ @locatable.concept
87
+ }.should raise_error ArgumentError
88
+ end
89
+ end
@@ -0,0 +1,42 @@
1
+ require File.dirname(__FILE__) + '/../../../../../spec_helper'
2
+ include OpenEHR::RM::Common::Archetyped
3
+
4
+ describe Pathable do
5
+ before(:each) do
6
+ @pathable = Pathable.new
7
+ end
8
+
9
+ it 'should be an instance of Pathable' do
10
+ @pathable.should be_an_instance_of Pathable
11
+ end
12
+
13
+ it 'item_at_path should raise NotImplementedError' do
14
+ lambda {
15
+ @pathable.item_at_path('/')
16
+ }.should raise_error NotImplementedError
17
+ end
18
+
19
+ it 'items_at_path should raise NotImplementedError' do
20
+ lambda {
21
+ @pathable.items_at_path('/')
22
+ }.should raise_error NotImplementedError
23
+ end
24
+
25
+ it 'path_exists? should raise NotImplementedError' do
26
+ lambda {
27
+ @pathable.path_exists?('/')
28
+ }.should raise_error NotImplementedError
29
+ end
30
+
31
+ it 'path_of_item should raise NotImplementedError' do
32
+ lambda {
33
+ @pathable.path_of_item('/')
34
+ }.should raise_error NotImplementedError
35
+ end
36
+
37
+ it 'path_unique? should raise NotImplementedError' do
38
+ lambda {
39
+ @pathable.path_unique?('/')
40
+ }.should raise_error NotImplementedError
41
+ end
42
+ end
@@ -0,0 +1,56 @@
1
+ require File.dirname(__FILE__) + '/../../../../../spec_helper'
2
+ include OpenEHR::RM::Common::ChangeControl
3
+ include OpenEHR::RM::DataTypes::Text
4
+
5
+ describe Contribution do
6
+ before(:each) do
7
+ uid = HierObjectID.new(:value => 'ABC::DEF::2')
8
+ versions = stub(Set, :size => 2, :empty? => false)
9
+ description = DvText.new(:value => 'test')
10
+ audit = stub(AuditDetails, :empty? => false, :description => description)
11
+ @contribution = Contribution.new(:uid => uid,
12
+ :versions => versions,
13
+ :audit => audit)
14
+ end
15
+
16
+ it 'should be an instance of Contribution' do
17
+ @contribution.should be_an_instance_of Contribution
18
+ end
19
+
20
+ it 'uid.value should be ABC::DEF::2' do
21
+ @contribution.uid.value.should == 'ABC::DEF::2'
22
+ end
23
+
24
+ it 'audit.description should test' do
25
+ @contribution.audit.description.value.should == 'test'
26
+ end
27
+
28
+ it 'versions size should be 2' do
29
+ @contribution.versions.size.should == 2
30
+ end
31
+
32
+ it 'should raise ArgumentError when version is empty' do
33
+ lambda {
34
+ @contribution.versions = Set.new
35
+ }.should raise_error ArgumentError
36
+ end
37
+
38
+ it 'should raise ArgumentError when uid is nil' do
39
+ lambda {
40
+ @contribution.uid = nil
41
+ }.should raise_error ArgumentError
42
+ end
43
+
44
+ it 'should raise ArgumentError audit is nil' do
45
+ lambda {
46
+ @contribution.audit = nil
47
+ }.should raise_error ArgumentError
48
+ end
49
+
50
+ it 'shoudl raise ArgumentError audit.description is empty' do
51
+ nil_audit = stub(AuditDetails, :description => nil)
52
+ lambda {
53
+ @contribution.audit = nil_audit
54
+ }.should raise_error ArgumentError
55
+ end
56
+ end
@@ -0,0 +1,63 @@
1
+ require File.dirname(__FILE__) + '/../../../../../spec_helper'
2
+ #require File.dirname(__FILE__) + '/shared_examples_spec'
3
+ include OpenEHR::RM::Common::ChangeControl
4
+ include OpenEHR::RM::DataTypes::Text
5
+ require 'set'
6
+
7
+ describe ImportedVersion do
8
+ # it_should_behave_like 'change_control'
9
+
10
+ before(:each) do
11
+ uid = ObjectVersionID.new(:value => 'ABCD::EFG::2')
12
+ preceding_version_uid = ObjectVersionID.new(:value => 'HIJ::KLM::1')
13
+ commit_audit = stub(AuditDetails, :committer => 'UNKNOWN', :empty? => false)
14
+ object_id = stub(ObjectID, :value => 'unique')
15
+ contribution = ObjectRef.new(:namespace => 'local',
16
+ :type => 'CONTRIBUTION',
17
+ :id => object_id)
18
+ defining_code = stub(CodePhrase, :code_string => '532')
19
+ lifecycle_state = stub(DvCodedText, :defining_code => defining_code)
20
+ signature = '4760271533c2866579dde347ad28dd79e4aad933'
21
+ @version = Version.new(:uid => uid,
22
+ :preceding_version_uid => preceding_version_uid,
23
+ :data => 'data',
24
+ :contribution => contribution,
25
+ :lifecycle_state => lifecycle_state,
26
+ :commit_audit => commit_audit,
27
+ :signature => signature)
28
+ attestations = stub(Array, :empty? => false, :size => 12)
29
+ other_input_version_uids = stub(Set, :empty? => false, :size => 5)
30
+ @original_version = OriginalVersion.new(:uid => uid,
31
+ :lifecycle_state => lifecycle_state,
32
+ :attestations => attestations,
33
+ :commit_audit => commit_audit,
34
+ :contribution => contribution,
35
+ :other_input_version_uids => other_input_version_uids,
36
+ :preceding_version_uid => preceding_version_uid)
37
+ @imported_version = ImportedVersion.new(:item => @original_version,
38
+ :commit_audit => commit_audit,
39
+ :contribution => contribution)
40
+ end
41
+
42
+ it 'should be an instance of ImportedVersion' do
43
+ @imported_version.should be_an_instance_of ImportedVersion
44
+ end
45
+
46
+ it 'uid should be item.uid' do
47
+ @imported_version.uid.value.should == 'ABCD::EFG::2'
48
+ end
49
+
50
+ it 'lifecycle_state should be item.lifecycle' do
51
+ @imported_version.lifecycle_state.defining_code.code_string.should == '532'
52
+ end
53
+
54
+ it 'preceding_version_uid should be item.preceding_version_uid' do
55
+ @imported_version.preceding_version_uid.value.should == 'HIJ::KLM::1'
56
+ end
57
+
58
+ it 'should raise ArgumentError when item is nil' do
59
+ lambda {
60
+ @imported_version.item = nil
61
+ }.should raise_error ArgumentError
62
+ end
63
+ end
@@ -0,0 +1,71 @@
1
+ require File.dirname(__FILE__) + '/../../../../../spec_helper'
2
+ #require File.dirname(__FILE__) + '/shared_examples_spec'
3
+ require 'set'
4
+ include OpenEHR::RM::Common::ChangeControl
5
+ include OpenEHR::RM::DataTypes::Text
6
+
7
+ describe OriginalVersion do
8
+ # it_should_behave_like 'change_control'
9
+
10
+ before(:each) do
11
+ uid = ObjectVersionID.new(:value => 'ABCD::EFG::2')
12
+ preceding_version_uid = ObjectVersionID.new(:value => 'HIJ::KLM::1')
13
+ commit_audit = stub(AuditDetails, :committer => 'UNKNOWN', :empty? => false)
14
+ object_id = stub(ObjectID, :value => 'unique')
15
+ contribution = ObjectRef.new(:namespace => 'local',
16
+ :type => 'CONTRIBUTION',
17
+ :id => object_id)
18
+ defining_code = stub(CodePhrase, :code_string => '532')
19
+ lifecycle_state = stub(DvCodedText, :defining_code => defining_code)
20
+ signature = '4760271533c2866579dde347ad28dd79e4aad933'
21
+ @version = Version.new(:uid => uid,
22
+ :preceding_version_uid => preceding_version_uid,
23
+ :data => 'data',
24
+ :contribution => contribution,
25
+ :lifecycle_state => lifecycle_state,
26
+ :commit_audit => commit_audit,
27
+ :signature => signature)
28
+ attestations = stub(Array, :empty? => false, :size => 12)
29
+ other_input_version_uids = stub(Set, :empty? => false, :size => 5)
30
+ @original_version = OriginalVersion.new(:uid => uid,
31
+ :lifecycle_state => lifecycle_state,
32
+ :attestations => attestations,
33
+ :commit_audit => commit_audit,
34
+ :contribution => contribution,
35
+ :other_input_version_uids => other_input_version_uids,
36
+ :preceding_version_uid => preceding_version_uid)
37
+ end
38
+
39
+ it 'should be an isntance of OriginalVersion' do
40
+ @original_version.should be_an_instance_of OriginalVersion
41
+ end
42
+
43
+ it 'attestation size should be 12' do
44
+ @original_version.attestations.size.should == 12
45
+ end
46
+
47
+ it 'other_version_input_uids size should be 5' do
48
+ @original_version.other_input_version_uids.size.should == 5
49
+ end
50
+
51
+ it 'is_merged? should be true when other_input_version_uids is nil' do
52
+ @original_version.is_merged?.should be_true
53
+ end
54
+
55
+ it 'is_merged? should not be true when other_input_version_uids is not nil' do
56
+ @original_version.other_input_version_uids = nil
57
+ @original_version.is_merged?.should be_false
58
+ end
59
+
60
+ it 'should raise ArgumentError when attestations is nil' do
61
+ lambda {
62
+ @original_version.attestations = nil
63
+ }.should raise_error ArgumentError
64
+ end
65
+
66
+ it 'should raise ArgumentError when other_input_version_uids is empty' do
67
+ lambda {
68
+ @original_version.other_input_version_uids = Set.new
69
+ }.should raise_error ArgumentError
70
+ end
71
+ end
@@ -0,0 +1,92 @@
1
+ require File.dirname(__FILE__) + '/../../../../../spec_helper'
2
+ #require File.dirname(__FILE__) + '/shared_examples_spec'
3
+ include OpenEHR::RM::Common::ChangeControl
4
+ include OpenEHR::RM::Common::Generic
5
+ include OpenEHR::RM::DataTypes::Text
6
+
7
+ describe Version do
8
+ # it_should_behave_like 'change_control'
9
+ before(:each) do
10
+ uid = ObjectVersionID.new(:value => 'ABCD::EFG::2')
11
+ preceding_version_uid = ObjectVersionID.new(:value => 'HIJ::KLM::1')
12
+ commit_audit = stub(AuditDetails, :committer => 'UNKNOWN', :empty? => false)
13
+ object_id = stub(ObjectID, :value => 'unique')
14
+ contribution = ObjectRef.new(:namespace => 'local',
15
+ :type => 'CONTRIBUTION',
16
+ :id => object_id)
17
+ defining_code = stub(CodePhrase, :code_string => '532')
18
+ lifecycle_state = stub(DvCodedText, :defining_code => defining_code)
19
+ signature = '4760271533c2866579dde347ad28dd79e4aad933'
20
+ @version = Version.new(:uid => uid,
21
+ :preceding_version_uid => preceding_version_uid,
22
+ :data => 'data',
23
+ :contribution => contribution,
24
+ :lifecycle_state => lifecycle_state,
25
+ :commit_audit => commit_audit,
26
+ :signature => signature)
27
+ end
28
+
29
+
30
+ it 'should be an instance of Version' do
31
+ @version.should be_an_instance_of Version
32
+ end
33
+
34
+ it 'uid value should be ABCD::EFG::1' do
35
+ @version.uid.value.should == 'ABCD::EFG::2'
36
+ end
37
+
38
+ it 'commit_audit.committer.should be UNKNOWN' do
39
+ @version.commit_audit.committer.should == 'UNKNOWN'
40
+ end
41
+
42
+ it 'lifecycle_state should be 532' do
43
+ @version.lifecycle_state.defining_code.code_string.should == '532'
44
+ end
45
+
46
+ it 'contribution namespece should be local' do
47
+ @version.contribution.namespace.should == 'local'
48
+ end
49
+
50
+ it 'contribution type should be CONTRIBUTION' do
51
+ contribution = @version.contribution
52
+ contribution.type = 'PARTY'
53
+ lambda {
54
+ @version.contribution = contribution
55
+ }.should raise_error ArgumentError
56
+ end
57
+
58
+ it 'signature should be 4760271533c2866579dde347ad28dd79e4aad933' do
59
+ @version.signature.should == '4760271533c2866579dde347ad28dd79e4aad933'
60
+ end
61
+
62
+ it 'should not be a branch' do
63
+ @version.is_branch?.should_not be true
64
+ end
65
+
66
+ it 'should be a branch' do
67
+ @version.uid.value = 'ABCD::EFG::1.2.3'
68
+ @version.is_branch?.should be true
69
+ end
70
+
71
+ it 'data should be data' do
72
+ @version.data.should == 'data'
73
+ end
74
+
75
+ it 'owner_id value should be ABCD::EFG::2' do
76
+ @version.owner_id.value.should == 'ABCD::EFG::2'
77
+ end
78
+
79
+ it 'canonical form is not well determined' do
80
+ lambda {
81
+ @version.canonical_form
82
+ }.should raise_error NotImplementedError
83
+ end
84
+
85
+ it 'should raise ArgumentError when preceding version id exists and uid version tree is first' do
86
+ @version.uid.value = 'ABC::DEF::1'
87
+ preceding_version_uid = ObjectVersionID.new(:value => 'GHI::JKL::2')
88
+ lambda {
89
+ @version.preceding_version_uid = preceding_version_uid
90
+ }.should raise_error ArgumentError
91
+ end
92
+ end