open_ehr 0.6.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +5 -0
- data/Gemfile +14 -0
- data/Gemfile.lock +43 -0
- data/Guardfile +9 -0
- data/History.txt +4 -0
- data/Manifest.txt +16 -0
- data/PostInstall.txt +9 -0
- data/README.rdoc +66 -0
- data/Rakefile +49 -0
- data/VERSION +1 -0
- data/doc/README_rdoc.html +148 -0
- data/doc/created.rid +2 -0
- data/doc/images/brick.png +0 -0
- data/doc/images/brick_link.png +0 -0
- data/doc/images/bug.png +0 -0
- data/doc/images/bullet_black.png +0 -0
- data/doc/images/bullet_toggle_minus.png +0 -0
- data/doc/images/bullet_toggle_plus.png +0 -0
- data/doc/images/date.png +0 -0
- data/doc/images/find.png +0 -0
- data/doc/images/loadingAnimation.gif +0 -0
- data/doc/images/macFFBgHack.png +0 -0
- data/doc/images/package.png +0 -0
- data/doc/images/page_green.png +0 -0
- data/doc/images/page_white_text.png +0 -0
- data/doc/images/page_white_width.png +0 -0
- data/doc/images/plugin.png +0 -0
- data/doc/images/ruby.png +0 -0
- data/doc/images/tag_green.png +0 -0
- data/doc/images/wrench.png +0 -0
- data/doc/images/wrench_orange.png +0 -0
- data/doc/images/zoom.png +0 -0
- data/doc/index.html +54 -0
- data/doc/js/darkfish.js +116 -0
- data/doc/js/jquery.js +32 -0
- data/doc/js/quicksearch.js +114 -0
- data/doc/js/thickbox-compressed.js +10 -0
- data/doc/openehr_terminology.xml +2700 -0
- data/doc/rdoc.css +706 -0
- data/lib/#open_ehr.rb# +11 -0
- data/lib/open_ehr/am/archetype/archetype_description/archetype_description.rb +21 -0
- data/lib/open_ehr/am/archetype/assertion.rb +190 -0
- data/lib/open_ehr/am/archetype/constraint_model/primitive.rb +296 -0
- data/lib/open_ehr/am/archetype/constraint_model.rb +340 -0
- data/lib/open_ehr/am/archetype/ontology.rb +97 -0
- data/lib/open_ehr/am/archetype.rb +134 -0
- data/lib/open_ehr/am/open_ehr_profile/data_types/basic.rb +29 -0
- data/lib/open_ehr/am/open_ehr_profile/data_types/quantity.rb +19 -0
- data/lib/open_ehr/am/open_ehr_profile/data_types/text.rb +12 -0
- data/lib/open_ehr/am.rb +8 -0
- data/lib/open_ehr/assumed_library_types.rb +627 -0
- data/lib/open_ehr/parser/xml_perser.rb +13 -0
- data/lib/open_ehr/parser.rb +19 -0
- data/lib/open_ehr/rm/common/archetyped.rb +182 -0
- data/lib/open_ehr/rm/common/change_control.rb +332 -0
- data/lib/open_ehr/rm/common/directory.rb +29 -0
- data/lib/open_ehr/rm/common/generic.rb +216 -0
- data/lib/open_ehr/rm/common/resource.rb +154 -0
- data/lib/open_ehr/rm/common.rb +14 -0
- data/lib/open_ehr/rm/composition/content/entry.rb +246 -0
- data/lib/open_ehr/rm/composition/content/navigation.rb +31 -0
- data/lib/open_ehr/rm/composition/content.rb +22 -0
- data/lib/open_ehr/rm/composition.rb +103 -0
- data/lib/open_ehr/rm/data_structures/history.rb +117 -0
- data/lib/open_ehr/rm/data_structures/item_structure/representation.rb +63 -0
- data/lib/open_ehr/rm/data_structures/item_structure.rb +216 -0
- data/lib/open_ehr/rm/data_structures.rb +25 -0
- data/lib/open_ehr/rm/data_types/basic.rb +108 -0
- data/lib/open_ehr/rm/data_types/charset.lst +818 -0
- data/lib/open_ehr/rm/data_types/charset_extract.rb +24 -0
- data/lib/open_ehr/rm/data_types/encapsulated.rb +98 -0
- data/lib/open_ehr/rm/data_types/quantity/date_time.rb +229 -0
- data/lib/open_ehr/rm/data_types/quantity.rb +403 -0
- data/lib/open_ehr/rm/data_types/text.rb +168 -0
- data/lib/open_ehr/rm/data_types/time_specification.rb +75 -0
- data/lib/open_ehr/rm/data_types/uri.rb +82 -0
- data/lib/open_ehr/rm/data_types.rb +14 -0
- data/lib/open_ehr/rm/demographic.rb +269 -0
- data/lib/open_ehr/rm/ehr.rb +162 -0
- data/lib/open_ehr/rm/integration.rb +27 -0
- data/lib/open_ehr/rm/security.rb +12 -0
- data/lib/open_ehr/rm/support/assumed_types.rb +81 -0
- data/lib/open_ehr/rm/support/definition.rb +15 -0
- data/lib/open_ehr/rm/support/identification.rb +408 -0
- data/lib/open_ehr/rm/support/measurement.rb +17 -0
- data/lib/open_ehr/rm/support/terminology.rb +135 -0
- data/lib/open_ehr/rm/support.rb +14 -0
- data/lib/open_ehr/rm.rb +16 -0
- data/lib/open_ehr/serializer.rb +272 -0
- data/lib/open_ehr/terminology/open_ehr_terminology.rb +41 -0
- data/lib/open_ehr/terminology.rb +7 -0
- data/lib/open_ehr/writer.rb +12 -0
- data/lib/open_ehr.rb +11 -0
- data/spec/lib/open_ehr/am/archetype/archetype_spec.rb +98 -0
- data/spec/lib/open_ehr/am/archetype/assertion/assertion_spec.rb +60 -0
- data/spec/lib/open_ehr/am/archetype/assertion/assertion_variable_spec.rb +30 -0
- data/spec/lib/open_ehr/am/archetype/assertion/expr_binary_operator.rb +40 -0
- data/spec/lib/open_ehr/am/archetype/assertion/expr_item_spec.rb +28 -0
- data/spec/lib/open_ehr/am/archetype/assertion/expr_leaf_spec.rb +34 -0
- data/spec/lib/open_ehr/am/archetype/assertion/expr_operator_spec.rb +25 -0
- data/spec/lib/open_ehr/am/archetype/assertion/expr_unary_operator_spec.rb +26 -0
- data/spec/lib/open_ehr/am/archetype/assertion/operator_kind_spec.rb +110 -0
- data/spec/lib/open_ehr/am/archetype/constraint_model/archetype_constraint_spec.rb +56 -0
- data/spec/lib/open_ehr/am/archetype/constraint_model/archetype_internal_ref_spec.rb +36 -0
- data/spec/lib/open_ehr/am/archetype/constraint_model/archetype_slot_spec.rb +61 -0
- data/spec/lib/open_ehr/am/archetype/constraint_model/c_attribute_spec.rb +59 -0
- data/spec/lib/open_ehr/am/archetype/constraint_model/c_complex_object_spec.rb +39 -0
- data/spec/lib/open_ehr/am/archetype/constraint_model/c_defined_object_spec.rb +53 -0
- data/spec/lib/open_ehr/am/archetype/constraint_model/c_domain_type_spec.rb +25 -0
- data/spec/lib/open_ehr/am/archetype/constraint_model/c_multiple_attribute_spec.rb +29 -0
- data/spec/lib/open_ehr/am/archetype/constraint_model/c_object_spec.rb +61 -0
- data/spec/lib/open_ehr/am/archetype/constraint_model/c_primitive_object_spec.rb +33 -0
- data/spec/lib/open_ehr/am/archetype/constraint_model/c_reference_object_spec.rb +17 -0
- data/spec/lib/open_ehr/am/archetype/constraint_model/c_single_attribute_spec.rb +28 -0
- data/spec/lib/open_ehr/am/archetype/constraint_model/cardinality_spec.rb +68 -0
- data/spec/lib/open_ehr/am/archetype/constraint_model/constraint_ref_spec.rb +29 -0
- data/spec/lib/open_ehr/am/archetype/constraint_model/primitive/c_boolean_spec.rb +52 -0
- data/spec/lib/open_ehr/am/archetype/constraint_model/primitive/c_date_spec.rb +80 -0
- data/spec/lib/open_ehr/am/archetype/constraint_model/primitive/c_date_time_spec.rb +106 -0
- data/spec/lib/open_ehr/am/archetype/constraint_model/primitive/c_duration_spec.rb +69 -0
- data/spec/lib/open_ehr/am/archetype/constraint_model/primitive/c_integer_spec.rb +62 -0
- data/spec/lib/open_ehr/am/archetype/constraint_model/primitive/c_primitive_spec.rb +39 -0
- data/spec/lib/open_ehr/am/archetype/constraint_model/primitive/c_real_spec.rb +14 -0
- data/spec/lib/open_ehr/am/archetype/constraint_model/primitive/c_string_spec.rb +69 -0
- data/spec/lib/open_ehr/am/archetype/constraint_model/primitive/c_time_spec.rb +79 -0
- data/spec/lib/open_ehr/am/archetype/ontology/archetype_ontology_spec.rb +59 -0
- data/spec/lib/open_ehr/am/archetype/ontology/archetype_term_spec.rb +43 -0
- data/spec/lib/open_ehr/am/archetype/validity_kind_spec.rb +42 -0
- data/spec/lib/open_ehr/assumed_library_types/interval_spec.rb +140 -0
- data/spec/lib/open_ehr/assumed_library_types/iso8601_date_spec.rb +236 -0
- data/spec/lib/open_ehr/assumed_library_types/iso8601_date_time_spec.rb +47 -0
- data/spec/lib/open_ehr/assumed_library_types/iso8601_duration_spec.rb +150 -0
- data/spec/lib/open_ehr/assumed_library_types/iso8601_time_spec.rb +234 -0
- data/spec/lib/open_ehr/assumed_library_types/iso8601_timezone_spec.rb +57 -0
- data/spec/lib/open_ehr/assumed_library_types/time_definitions_spec.rb +136 -0
- data/spec/lib/open_ehr/rm/common/archetyped/archetyped_spec.rb +50 -0
- data/spec/lib/open_ehr/rm/common/archetyped/feeder_audit_details_spec.rb +60 -0
- data/spec/lib/open_ehr/rm/common/archetyped/feeder_audit_spec.rb +51 -0
- data/spec/lib/open_ehr/rm/common/archetyped/link_spec.rb +42 -0
- data/spec/lib/open_ehr/rm/common/archetyped/locatable_spec.rb +89 -0
- data/spec/lib/open_ehr/rm/common/archetyped/pathable_spec.rb +42 -0
- data/spec/lib/open_ehr/rm/common/change_control/contribution_spec.rb +56 -0
- data/spec/lib/open_ehr/rm/common/change_control/imported_version_spec.rb +63 -0
- data/spec/lib/open_ehr/rm/common/change_control/original_version_spec.rb +71 -0
- data/spec/lib/open_ehr/rm/common/change_control/version_spec.rb +92 -0
- data/spec/lib/open_ehr/rm/common/change_control/versioned_object_spec.rb +285 -0
- data/spec/lib/open_ehr/rm/common/directory/folder_spec.rb +26 -0
- data/spec/lib/open_ehr/rm/common/generic/attestation_spec.rb +62 -0
- data/spec/lib/open_ehr/rm/common/generic/audit_details_spec.rb +51 -0
- data/spec/lib/open_ehr/rm/common/generic/participation_spec.rb +36 -0
- data/spec/lib/open_ehr/rm/common/generic/party_identified_spec.rb +64 -0
- data/spec/lib/open_ehr/rm/common/generic/party_proxy_spec.rb +18 -0
- data/spec/lib/open_ehr/rm/common/generic/party_related_spec.rb +24 -0
- data/spec/lib/open_ehr/rm/common/generic/revision_history_item_spec.rb +43 -0
- data/spec/lib/open_ehr/rm/common/generic/revision_history_spec.rb +45 -0
- data/spec/lib/open_ehr/rm/common/resource/authored_resource_spec.rb +68 -0
- data/spec/lib/open_ehr/rm/common/resource/resource_description_item_spec.rb +105 -0
- data/spec/lib/open_ehr/rm/common/resource/resource_description_spec.rb +74 -0
- data/spec/lib/open_ehr/rm/common/resource/translation_details_spec.rb +35 -0
- data/spec/lib/open_ehr/rm/composition/composition_spec.rb +92 -0
- data/spec/lib/open_ehr/rm/composition/content/content_item_spec.rb +14 -0
- data/spec/lib/open_ehr/rm/composition/content/entry/action_spec.rb +69 -0
- data/spec/lib/open_ehr/rm/composition/content/entry/activity_spec.rb +61 -0
- data/spec/lib/open_ehr/rm/composition/content/entry/admin_entry_spec.rb +38 -0
- data/spec/lib/open_ehr/rm/composition/content/entry/care_entry_spec.rb +37 -0
- data/spec/lib/open_ehr/rm/composition/content/entry/entry_spec.rb +88 -0
- data/spec/lib/open_ehr/rm/composition/content/entry/evaluation_spec.rb +37 -0
- data/spec/lib/open_ehr/rm/composition/content/entry/instruction_details_spec.rb +51 -0
- data/spec/lib/open_ehr/rm/composition/content/entry/instruction_spec.rb +62 -0
- data/spec/lib/open_ehr/rm/composition/content/entry/ism_transition_spec.rb +46 -0
- data/spec/lib/open_ehr/rm/composition/content/entry/observation_spec.rb +45 -0
- data/spec/lib/open_ehr/rm/composition/content/navigation/section_spec.rb +32 -0
- data/spec/lib/open_ehr/rm/composition/event_context_spec.rb +88 -0
- data/spec/lib/open_ehr/rm/data_structures/data_structure_spec.rb +21 -0
- data/spec/lib/open_ehr/rm/data_structures/history/event_spec.rb +44 -0
- data/spec/lib/open_ehr/rm/data_structures/history/history_spec.rb +67 -0
- data/spec/lib/open_ehr/rm/data_structures/history/interval_event_spec.rb +43 -0
- data/spec/lib/open_ehr/rm/data_structures/item_structure/item_list_spec.rb +53 -0
- data/spec/lib/open_ehr/rm/data_structures/item_structure/item_single_spec.rb +29 -0
- data/spec/lib/open_ehr/rm/data_structures/item_structure/item_table_spec.rb +147 -0
- data/spec/lib/open_ehr/rm/data_structures/item_structure/item_tree_spec.rb +48 -0
- data/spec/lib/open_ehr/rm/data_structures/item_structure/representation/cluster_spec.rb +26 -0
- data/spec/lib/open_ehr/rm/data_structures/item_structure/representation/element_spec.rb +22 -0
- data/spec/lib/open_ehr/rm/data_types/basic/data_value_spec.rb +17 -0
- data/spec/lib/open_ehr/rm/data_types/basic/dv_boolean_spec.rb +29 -0
- data/spec/lib/open_ehr/rm/data_types/basic/dv_identifier_spec.rb +108 -0
- data/spec/lib/open_ehr/rm/data_types/basic/dv_state_spec.rb +44 -0
- data/spec/lib/open_ehr/rm/data_types/encapsulated/dv_encapsulated_spec.rb +42 -0
- data/spec/lib/open_ehr/rm/data_types/encapsulated/dv_multimedia_spec.rb +79 -0
- data/spec/lib/open_ehr/rm/data_types/encapsulated/dv_parsable_spec.rb +34 -0
- data/spec/lib/open_ehr/rm/data_types/quantity/date_time/dv_date_spec.rb +64 -0
- data/spec/lib/open_ehr/rm/data_types/quantity/date_time/dv_date_time_spec.rb +25 -0
- data/spec/lib/open_ehr/rm/data_types/quantity/date_time/dv_tempral_spec.rb +24 -0
- data/spec/lib/open_ehr/rm/data_types/quantity/date_time/dv_time_spec.rb +37 -0
- data/spec/lib/open_ehr/rm/data_types/quantity/dv_absolute_quantity_spec.rb +35 -0
- data/spec/lib/open_ehr/rm/data_types/quantity/dv_amount_spec.rb +105 -0
- data/spec/lib/open_ehr/rm/data_types/quantity/dv_count_spec.rb +12 -0
- data/spec/lib/open_ehr/rm/data_types/quantity/dv_interval_spec.rb +17 -0
- data/spec/lib/open_ehr/rm/data_types/quantity/dv_ordered_spec.rb +60 -0
- data/spec/lib/open_ehr/rm/data_types/quantity/dv_ordinal_spec.rb +74 -0
- data/spec/lib/open_ehr/rm/data_types/quantity/dv_proportion_spec.rb +162 -0
- data/spec/lib/open_ehr/rm/data_types/quantity/dv_quantified_spec.rb +36 -0
- data/spec/lib/open_ehr/rm/data_types/quantity/dv_quantity_spec.rb +78 -0
- data/spec/lib/open_ehr/rm/data_types/quantity/proportion_kind_spec.rb +24 -0
- data/spec/lib/open_ehr/rm/data_types/quantity/reference_range_spec.rb +43 -0
- data/spec/lib/open_ehr/rm/data_types/text/code_phrase_spec.rb +23 -0
- data/spec/lib/open_ehr/rm/data_types/text/dv_paragraph_spec.rb +13 -0
- data/spec/lib/open_ehr/rm/data_types/text/dv_text_spec.rb +57 -0
- data/spec/lib/open_ehr/rm/data_types/text/term_mapping_spec.rb +59 -0
- data/spec/lib/open_ehr/rm/data_types/uri/dv_ehr_uri_spec.rb +21 -0
- data/spec/lib/open_ehr/rm/data_types/uri/dv_uri_spec.rb +36 -0
- data/spec/lib/open_ehr/rm/demographic/actor_spec.rb +79 -0
- data/spec/lib/open_ehr/rm/demographic/address_spec.rb +33 -0
- data/spec/lib/open_ehr/rm/demographic/capability_spec.rb +37 -0
- data/spec/lib/open_ehr/rm/demographic/contact_spec.rb +45 -0
- data/spec/lib/open_ehr/rm/demographic/party_identity_spec.rb +32 -0
- data/spec/lib/open_ehr/rm/demographic/party_relationship_spec.rb +84 -0
- data/spec/lib/open_ehr/rm/demographic/party_spec.rb +133 -0
- data/spec/lib/open_ehr/rm/demographic/role_spec.rb +58 -0
- data/spec/lib/open_ehr/rm/ehr/ehr_access_spec.rb +33 -0
- data/spec/lib/open_ehr/rm/ehr/ehr_spec.rb +139 -0
- data/spec/lib/open_ehr/rm/ehr/ehr_status_spec.rb +52 -0
- data/spec/lib/open_ehr/rm/ehr/versioned_composition_spec.rb +33 -0
- data/spec/lib/open_ehr/rm/integration/generic_entry_spec.rb +31 -0
- data/spec/lib/open_ehr/rm/support/identification/access_group_ref_spec.rb +19 -0
- data/spec/lib/open_ehr/rm/support/identification/archetype_id_spec.rb +152 -0
- data/spec/lib/open_ehr/rm/support/identification/generic_id_spec.rb +33 -0
- data/spec/lib/open_ehr/rm/support/identification/hier_object_id_spec.rb +12 -0
- data/spec/lib/open_ehr/rm/support/identification/internet_id_spec.rb +12 -0
- data/spec/lib/open_ehr/rm/support/identification/iso_oid_spec.rb +12 -0
- data/spec/lib/open_ehr/rm/support/identification/locatable_ref_spec.rb +34 -0
- data/spec/lib/open_ehr/rm/support/identification/object_id_spec.rb +24 -0
- data/spec/lib/open_ehr/rm/support/identification/object_ref_spec.rb +33 -0
- data/spec/lib/open_ehr/rm/support/identification/object_version_id_spec.rb +60 -0
- data/spec/lib/open_ehr/rm/support/identification/party_ref_spec.rb +29 -0
- data/spec/lib/open_ehr/rm/support/identification/template_id_spec.rb +12 -0
- data/spec/lib/open_ehr/rm/support/identification/terminology_id_spec.rb +33 -0
- data/spec/lib/open_ehr/rm/support/identification/uid_based_id_spec.rb +50 -0
- data/spec/lib/open_ehr/rm/support/identification/uid_spec.rb +29 -0
- data/spec/lib/open_ehr/rm/support/identification/version_tree_id_spec.rb +104 -0
- data/spec/lib/open_ehr/rm/support/measurement_service_spec.rb +7 -0
- data/spec/lib/open_ehr/rm/support/terminology_service_spec.rb +24 -0
- data/spec/lib/open_ehr/serializer/adl-test-entry.most_minimal.test.adl +20 -0
- data/spec/lib/open_ehr/serializer/adl_serializer_spec.rb +47 -0
- data/spec/lib/open_ehr/serializer/openEHR-EHR-SECTION.test.v1.adl +38 -0
- data/spec/lib/open_ehr/serializer/openEHR-EHR-SECTION.test.v1.xml +58 -0
- data/spec/lib/open_ehr/serializer/sample_archetype_spec.rb +44 -0
- data/spec/lib/open_ehr/serializer/xml_serializer_spec.rb +49 -0
- data/spec/lib/open_ehr/terminology/open_ehr_terminology_spec.rb +40 -0
- data/spec/rcov.opts +1 -0
- data/spec/spec.opts +5 -0
- data/spec/spec_helper.rb +54 -0
- 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
|