open_ehr 0.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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,103 @@
|
|
1
|
+
# rm::composition
|
2
|
+
# composition module
|
3
|
+
# http://www.openehr.org/uml/release-1.0.1/Browsable/_9_0_76d0249_1109005072243_448526_217Report.html
|
4
|
+
# refs #79
|
5
|
+
include OpenEHR::RM::Common::Archetyped
|
6
|
+
module OpenEHR
|
7
|
+
module RM
|
8
|
+
module Composition
|
9
|
+
class Composition < Locatable
|
10
|
+
attr_reader :language, :category, :territory, :composer
|
11
|
+
attr_accessor :content, :context
|
12
|
+
|
13
|
+
def initialize(args = { })
|
14
|
+
super(args)
|
15
|
+
self.language = args[:language]
|
16
|
+
self.category = args[:category]
|
17
|
+
self.territory = args[:territory]
|
18
|
+
self.composer = args[:composer]
|
19
|
+
self.content = args[:content]
|
20
|
+
self.context = args[:context]
|
21
|
+
end
|
22
|
+
|
23
|
+
def language=(language)
|
24
|
+
if language.nil?
|
25
|
+
raise ArgumentError, 'language is mandatory'
|
26
|
+
end
|
27
|
+
@language = language
|
28
|
+
end
|
29
|
+
|
30
|
+
def category=(category)
|
31
|
+
if category.nil?
|
32
|
+
raise ArgumentError, 'category is mandatory'
|
33
|
+
end
|
34
|
+
@category = category
|
35
|
+
end
|
36
|
+
|
37
|
+
def territory=(territory)
|
38
|
+
if territory.nil?
|
39
|
+
raise ArgumentError, 'territory is mandatory'
|
40
|
+
end
|
41
|
+
@territory = territory
|
42
|
+
end
|
43
|
+
|
44
|
+
def composer=(composer)
|
45
|
+
if composer.nil?
|
46
|
+
raise ArgumentError, 'composer is mandatory'
|
47
|
+
end
|
48
|
+
@composer = composer
|
49
|
+
end
|
50
|
+
|
51
|
+
def is_persistent?
|
52
|
+
return category.value == 'persistent'
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
class EventContext < Pathable
|
57
|
+
attr_reader :start_time, :setting, :participations, :location
|
58
|
+
attr_accessor :end_time, :other_context
|
59
|
+
|
60
|
+
def initialize(args = { })
|
61
|
+
super(args)
|
62
|
+
self.start_time = args[:start_time]
|
63
|
+
self.setting = args[:setting]
|
64
|
+
self.end_time = args[:end_time]
|
65
|
+
self.participations = args[:participations]
|
66
|
+
self.location = args[:location]
|
67
|
+
self.other_context = args[:other_context]
|
68
|
+
end
|
69
|
+
|
70
|
+
def start_time=(start_time)
|
71
|
+
if start_time.nil?
|
72
|
+
raise ArgumentError, 'start_time is mandatory'
|
73
|
+
end
|
74
|
+
@start_time = start_time
|
75
|
+
end
|
76
|
+
|
77
|
+
def setting=(setting)
|
78
|
+
if setting.nil?
|
79
|
+
raise ArgumentError, 'setting is mandatory'
|
80
|
+
end
|
81
|
+
@setting = setting
|
82
|
+
end
|
83
|
+
|
84
|
+
def participations=(participations)
|
85
|
+
if !participations.nil? and participations.empty?
|
86
|
+
raise ArgumentError, 'participations should not be empty'
|
87
|
+
end
|
88
|
+
@participations = participations
|
89
|
+
end
|
90
|
+
|
91
|
+
def location=(location)
|
92
|
+
if !location.nil? and location.empty?
|
93
|
+
raise ArgumentError, 'location should not be empty'
|
94
|
+
end
|
95
|
+
@location = location
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
99
|
+
autoload :Content, 'composition/content'
|
100
|
+
|
101
|
+
end # end of Composition
|
102
|
+
end # end of RM
|
103
|
+
end # end of OpenEHR
|
@@ -0,0 +1,117 @@
|
|
1
|
+
$:.unshift(File.dirname(__FILE__)) unless
|
2
|
+
$:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
|
3
|
+
# rm::data_structures::history
|
4
|
+
# history module
|
5
|
+
# http://www.openehr.org/uml/release-1.0.1/Browsable/_9_0_76d0249_1109157527311_729550_7234Report.html
|
6
|
+
# refs #55
|
7
|
+
require 'time'
|
8
|
+
require 'active_support/core_ext'
|
9
|
+
include OpenEHR::RM::DataStructures
|
10
|
+
include OpenEHR::RM::Common::Archetyped
|
11
|
+
|
12
|
+
module OpenEHR
|
13
|
+
module RM
|
14
|
+
module DataStructures
|
15
|
+
module History
|
16
|
+
class History < DataStructure
|
17
|
+
attr_reader :origin, :events
|
18
|
+
attr_accessor :duration, :period, :summary
|
19
|
+
|
20
|
+
def initialize(args = { })
|
21
|
+
super(args)
|
22
|
+
self.origin = args[:origin]
|
23
|
+
self.duration = args[:duration]
|
24
|
+
self.period = args[:period]
|
25
|
+
self.events = args[:events]
|
26
|
+
self.summary = args[:summary]
|
27
|
+
end
|
28
|
+
|
29
|
+
def origin=(origin)
|
30
|
+
raise ArgumentError, 'origin is mandatory' if origin.nil?
|
31
|
+
@origin = origin
|
32
|
+
end
|
33
|
+
|
34
|
+
def events=(events)
|
35
|
+
if !events.nil? and events.empty?
|
36
|
+
raise ArgumentError, 'events should not be empty'
|
37
|
+
end
|
38
|
+
@events = events
|
39
|
+
end
|
40
|
+
|
41
|
+
def is_periodic?
|
42
|
+
return !@period.nil?
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
class Event < Locatable
|
47
|
+
attr_reader :data, :time
|
48
|
+
attr_accessor :state
|
49
|
+
|
50
|
+
def initialize(args = { })
|
51
|
+
super(args)
|
52
|
+
self.data = args[:data]
|
53
|
+
self.time = args[:time]
|
54
|
+
self.state = args[:state]
|
55
|
+
end
|
56
|
+
|
57
|
+
def data=(data)
|
58
|
+
raise ArgumentError, 'data is mandatory' if data.nil?
|
59
|
+
@data = data
|
60
|
+
end
|
61
|
+
|
62
|
+
def time=(time)
|
63
|
+
raise ArgumentError, 'time is mandatory' if time.nil?
|
64
|
+
@time = time
|
65
|
+
end
|
66
|
+
|
67
|
+
def offset
|
68
|
+
return @time.diff(@parent.origin)
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
class PointEvent < Event
|
73
|
+
|
74
|
+
end
|
75
|
+
|
76
|
+
class IntervalEvent < Event
|
77
|
+
attr_reader :width, :math_function
|
78
|
+
attr_accessor :sample_count
|
79
|
+
|
80
|
+
def initialize(args = { })
|
81
|
+
super(args)
|
82
|
+
self.width = args[:width]
|
83
|
+
self.math_function = args[:math_function]
|
84
|
+
self.sample_count = args[:sample_count]
|
85
|
+
end
|
86
|
+
|
87
|
+
def width=(width)
|
88
|
+
raise ArgumentError, 'width is mandatory' if width.nil?
|
89
|
+
@width = width
|
90
|
+
end
|
91
|
+
|
92
|
+
def math_function=(math_function)
|
93
|
+
if math_function.nil?
|
94
|
+
raise ArgumentError, 'math_function is mandatory'
|
95
|
+
end
|
96
|
+
@math_function = math_function
|
97
|
+
end
|
98
|
+
|
99
|
+
def interval_start_time
|
100
|
+
date_time = ::Time.iso8601(time.as_string)
|
101
|
+
start_time = (@width.years).years.ago date_time
|
102
|
+
start_time = (@width.months).months.ago start_time
|
103
|
+
start_time = (@width.days).days.ago start_time
|
104
|
+
start_time = (@width.hours).hours.ago start_time
|
105
|
+
start_time = (@width.minutes).minutes.ago start_time
|
106
|
+
seconds = @width.seconds
|
107
|
+
unless @width.fractional_second.nil?
|
108
|
+
seconds += @width.fractional_second
|
109
|
+
end
|
110
|
+
start_time = seconds.ago start_time
|
111
|
+
return DvDateTime.new(:value => start_time.iso8601)
|
112
|
+
end
|
113
|
+
end
|
114
|
+
end # end of History
|
115
|
+
end # end of DataStructure
|
116
|
+
end # end of RM
|
117
|
+
end # end of OpenEHR
|
@@ -0,0 +1,63 @@
|
|
1
|
+
# rm::data_structures::item_structure::representation
|
2
|
+
# representation module
|
3
|
+
# http://www.openehr.org/uml/release-1.0.1/Browsable/_9_0_76d0249_1109066789167_738055_2581Report.html
|
4
|
+
# refs #53
|
5
|
+
module OpenEHR
|
6
|
+
module RM
|
7
|
+
module DataStructures
|
8
|
+
module ItemStructure
|
9
|
+
module Representation
|
10
|
+
class Item < OpenEHR::RM::Common::Archetyped::Locatable
|
11
|
+
def initialize(args = {})
|
12
|
+
super(args)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
class Element < Item
|
17
|
+
attr_accessor :value
|
18
|
+
attr_reader :null_flavor
|
19
|
+
def initialize(args = {})
|
20
|
+
super(args)
|
21
|
+
self.value = args[:value]
|
22
|
+
self.null_flavor= args[:null_flavor]
|
23
|
+
end
|
24
|
+
|
25
|
+
def null_flavor=(null_flavor)
|
26
|
+
sr = nil
|
27
|
+
if !null_flavor.nil? and
|
28
|
+
null_flavor.defining_code.terminology_id.name == 'openehr'
|
29
|
+
sr = Terminology.find(:first,
|
30
|
+
:conditions => "code = '#{null_flavor.defining_code.code_string}'")
|
31
|
+
end
|
32
|
+
if null_flavor.nil? or (!sr.nil? and sr.group == 'null flavours')
|
33
|
+
@null_flavor = null_flavor
|
34
|
+
else
|
35
|
+
raise ArgumentError, 'null_flavor is invalid'
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
def is_null?
|
40
|
+
return @value.nil?
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
class Cluster < Item
|
45
|
+
attr_reader :items
|
46
|
+
|
47
|
+
def initialize(args = {})
|
48
|
+
super(args)
|
49
|
+
self.items = args[:items]
|
50
|
+
end
|
51
|
+
|
52
|
+
def items=(items)
|
53
|
+
if !items.nil? and items.empty?
|
54
|
+
raise ArgumentError, 'items should not empty'
|
55
|
+
end
|
56
|
+
@items = items
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end # of Representation
|
60
|
+
end # of ItemStructure
|
61
|
+
end # of DataStructures
|
62
|
+
end # of RM
|
63
|
+
end # of OpenEHR
|
@@ -0,0 +1,216 @@
|
|
1
|
+
# rm::data_structures::item_structure
|
2
|
+
# ItemStructure module
|
3
|
+
# http://www.openehr.org/uml/release-1.0.1/Browsable/_9_0_76d0249_1109346709572_859750_3810Report.html
|
4
|
+
# refs #54
|
5
|
+
require 'set'
|
6
|
+
include OpenEHR::RM::DataStructures
|
7
|
+
module OpenEHR
|
8
|
+
module RM
|
9
|
+
module DataStructures
|
10
|
+
module ItemStructure
|
11
|
+
|
12
|
+
autoload :Representation, 'item_structure/representation'
|
13
|
+
|
14
|
+
class ItemStructure < DataStructure
|
15
|
+
end
|
16
|
+
|
17
|
+
class ItemSingle < ItemStructure
|
18
|
+
attr_reader :item
|
19
|
+
|
20
|
+
def initialize(args = {})
|
21
|
+
super(args)
|
22
|
+
self.item = args[:item]
|
23
|
+
end
|
24
|
+
|
25
|
+
def as_hierarchy
|
26
|
+
return @item
|
27
|
+
end
|
28
|
+
|
29
|
+
def item=(item)
|
30
|
+
raise ArgumentError, 'item is mandatory' if item.nil?
|
31
|
+
@item = item
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
class ItemList < ItemStructure
|
36
|
+
attr_accessor :items
|
37
|
+
|
38
|
+
def initialize(args = {})
|
39
|
+
super(args)
|
40
|
+
self.items = args[:items]
|
41
|
+
end
|
42
|
+
|
43
|
+
def item_count
|
44
|
+
unless @items.nil?
|
45
|
+
return @items.size
|
46
|
+
else
|
47
|
+
return 0
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
def names
|
52
|
+
return @items.collect{|item| item.name}
|
53
|
+
end
|
54
|
+
|
55
|
+
def named_item(a_name)
|
56
|
+
@items.each do |item|
|
57
|
+
return item if item.name.value == a_name
|
58
|
+
end
|
59
|
+
return nil
|
60
|
+
end
|
61
|
+
|
62
|
+
def ith_item(i)
|
63
|
+
raise ArgumentError, 'index invalid' if i <= 0
|
64
|
+
return @items[i - 1]
|
65
|
+
end
|
66
|
+
|
67
|
+
def as_hierarchy
|
68
|
+
return Cluster.new(:name => @name,
|
69
|
+
:archetype_node_id => @archetype_node_id,
|
70
|
+
:items => @items)
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
class ItemTable < ItemStructure
|
75
|
+
attr_accessor :rows
|
76
|
+
|
77
|
+
def initialize(args = {})
|
78
|
+
super(args)
|
79
|
+
self.rows = args[:rows]
|
80
|
+
end
|
81
|
+
|
82
|
+
def row_count
|
83
|
+
if @rows.nil?
|
84
|
+
return 0
|
85
|
+
else
|
86
|
+
return @rows.size
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
def column_count
|
91
|
+
if @rows.nil?
|
92
|
+
return 0
|
93
|
+
else
|
94
|
+
return @rows[0].items.count
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
def row_names
|
99
|
+
if @rows.nil?
|
100
|
+
return []
|
101
|
+
else
|
102
|
+
return @rows.collect{|r| r.name}
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
106
|
+
def column_names
|
107
|
+
if @rows.nil?
|
108
|
+
return []
|
109
|
+
else
|
110
|
+
return @rows[0].items.collect{|i| i.name}
|
111
|
+
end
|
112
|
+
end
|
113
|
+
|
114
|
+
def ith_row(i)
|
115
|
+
raise ArgumentError, 'invalid index' if i<=0 or i>@rows.size
|
116
|
+
return @rows[i - 1]
|
117
|
+
end
|
118
|
+
|
119
|
+
def has_row_with_name?(key)
|
120
|
+
raise ArgumentError, 'invalid argument' if key.nil? or key.empty?
|
121
|
+
@rows.each do |row|
|
122
|
+
return true if row.items[0].name.value == key
|
123
|
+
end
|
124
|
+
return false
|
125
|
+
end
|
126
|
+
|
127
|
+
def has_column_with_name?(key)
|
128
|
+
raise ArgumentError, 'invalid argument' if key.nil? or key.empty?
|
129
|
+
self.column_names.each do |name|
|
130
|
+
return true if name.value == key
|
131
|
+
end
|
132
|
+
return false
|
133
|
+
end
|
134
|
+
|
135
|
+
def named_row(key)
|
136
|
+
raise ArgumentError, 'invalid argument' unless has_row_with_name?(key)
|
137
|
+
@rows.each do |row|
|
138
|
+
return row if row.items[0].name.value == key
|
139
|
+
end
|
140
|
+
end
|
141
|
+
|
142
|
+
def has_row_with_key?(keys)
|
143
|
+
keys.each do |key|
|
144
|
+
@rows.each do |row|
|
145
|
+
return true if row.items[0].name.value == key
|
146
|
+
end
|
147
|
+
end
|
148
|
+
return false
|
149
|
+
end
|
150
|
+
|
151
|
+
def row_with_key(keys)
|
152
|
+
unless has_row_with_key?(keys)
|
153
|
+
raise ArgumentError, 'no row for key'
|
154
|
+
end
|
155
|
+
keys.each do |key|
|
156
|
+
@rows.each do |row|
|
157
|
+
return row if row.items[0].name.value == key
|
158
|
+
end
|
159
|
+
end
|
160
|
+
end
|
161
|
+
|
162
|
+
def element_at_cell_ij(i,j)
|
163
|
+
return @rows[i-1].items[j-1]
|
164
|
+
end
|
165
|
+
|
166
|
+
def element_at_named_cell(row_key, column_key)
|
167
|
+
i,j=0,0
|
168
|
+
@rows[0].items.each do |c|
|
169
|
+
break if c.name.value == column_key
|
170
|
+
i+=1
|
171
|
+
end
|
172
|
+
@rows.each do |row|
|
173
|
+
break if row.name.value == row_key
|
174
|
+
j+=1
|
175
|
+
end
|
176
|
+
return element_at_cell_ij(i,j)
|
177
|
+
end
|
178
|
+
|
179
|
+
def as_hierarchy
|
180
|
+
return @rows[0]
|
181
|
+
end
|
182
|
+
end
|
183
|
+
|
184
|
+
class ItemTree < ItemStructure
|
185
|
+
attr_accessor :items
|
186
|
+
|
187
|
+
def initialize(args ={ })
|
188
|
+
super(args)
|
189
|
+
self.items = args[:items]
|
190
|
+
end
|
191
|
+
|
192
|
+
def has_element_path?(path)
|
193
|
+
paths = [ ]
|
194
|
+
@items.each do |item|
|
195
|
+
paths << item.archetype_node_id
|
196
|
+
end
|
197
|
+
return paths.include? path
|
198
|
+
end
|
199
|
+
|
200
|
+
def element_at_path(path)
|
201
|
+
@items.each do |item|
|
202
|
+
return item if item.archetype_node_id == path
|
203
|
+
end
|
204
|
+
return nil
|
205
|
+
end
|
206
|
+
|
207
|
+
def as_hierarchy
|
208
|
+
return Cluster.new(:name => @name,
|
209
|
+
:archetype_node_id => @archetype_node_id,
|
210
|
+
:items => @items)
|
211
|
+
end
|
212
|
+
end
|
213
|
+
end # of ItemStructure
|
214
|
+
end # of DataStructures
|
215
|
+
end # of RM
|
216
|
+
end # of OpenEHR
|
@@ -0,0 +1,25 @@
|
|
1
|
+
$:.unshift(File.dirname(__FILE__)) unless
|
2
|
+
$:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
|
3
|
+
# rm::data_structures
|
4
|
+
# class DATA_STRUCTURE
|
5
|
+
# http://www.openehr.org/uml/release-1.0.1/Browsable/_9_5_1_76d0249_1140447518205_872539_864Report.html
|
6
|
+
# refs #59
|
7
|
+
|
8
|
+
module OpenEHR
|
9
|
+
module RM
|
10
|
+
module DataStructures
|
11
|
+
autoload :ItemStructure, 'data_structures/item_structure'
|
12
|
+
autoload :History, 'data_structures/history'
|
13
|
+
|
14
|
+
class DataStructure < OpenEHR::RM::Common::Archetyped::Locatable
|
15
|
+
def initialize(args = { })
|
16
|
+
super(args)
|
17
|
+
end
|
18
|
+
|
19
|
+
def as_hierarchy
|
20
|
+
raise NotImplementedError, "as_hirarchy must be implemented"
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end # of Data_Structures
|
24
|
+
end # of RM
|
25
|
+
end # of OpenEHR
|
@@ -0,0 +1,108 @@
|
|
1
|
+
# This module is implemented from this UML:
|
2
|
+
# http://www.openehr.org/uml/release-1.0.1/Browsable/_9_0_76d0249_1109067591791_562382_3151Report.html
|
3
|
+
# Ticket refs #52
|
4
|
+
module OpenEHR
|
5
|
+
module RM
|
6
|
+
module DataTypes
|
7
|
+
module Basic
|
8
|
+
module CanonicalFragment
|
9
|
+
end
|
10
|
+
|
11
|
+
class DataValue
|
12
|
+
include OpenEHR::RM::Support::Definition::BasicDefinition
|
13
|
+
attr_accessor :value
|
14
|
+
alias :v :value
|
15
|
+
|
16
|
+
def initialize(args = {})
|
17
|
+
self.value = args[:value]
|
18
|
+
end
|
19
|
+
|
20
|
+
def ==(other)
|
21
|
+
return self.value == other.value
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
class DvBoolean < DataValue
|
26
|
+
def initialize(args)
|
27
|
+
super(args)
|
28
|
+
end
|
29
|
+
|
30
|
+
def value=(value)
|
31
|
+
raise ArgumentError, "value must not be nil" if value.nil?
|
32
|
+
if value == true or value =~ /TRUE/i
|
33
|
+
@value = true
|
34
|
+
else
|
35
|
+
@value = false
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
def value?
|
40
|
+
@value == true
|
41
|
+
end
|
42
|
+
end # end of DvBoolean
|
43
|
+
|
44
|
+
class DvState < DataValue
|
45
|
+
attr_reader :is_terminal
|
46
|
+
|
47
|
+
def initialize(args)
|
48
|
+
super(args)
|
49
|
+
self.is_terminal = args[:is_terminal]
|
50
|
+
end
|
51
|
+
|
52
|
+
def value=(v)
|
53
|
+
raise ArgumentError, "value should not be nil" if v.nil?
|
54
|
+
@value = v
|
55
|
+
end
|
56
|
+
|
57
|
+
def is_terminal?
|
58
|
+
@is_terminal
|
59
|
+
end
|
60
|
+
|
61
|
+
def is_terminal=(s)
|
62
|
+
raise ArgumentError, "terminal should not be nil" if s.nil?
|
63
|
+
@is_terminal = s
|
64
|
+
end
|
65
|
+
end # end of DvState
|
66
|
+
|
67
|
+
class DvIdentifier < DataValue
|
68
|
+
attr_reader :issuer, :assigner, :id, :type
|
69
|
+
|
70
|
+
def initialize(args = {})
|
71
|
+
self.issuer = args[:issuer]
|
72
|
+
self.assigner = args[:assigner]
|
73
|
+
self.id = args[:id]
|
74
|
+
self.type = args[:type]
|
75
|
+
end
|
76
|
+
|
77
|
+
def issuer=(issuer)
|
78
|
+
if issuer.nil? or issuer.empty?
|
79
|
+
raise ArgumentError, 'issuer is mandatory'
|
80
|
+
end
|
81
|
+
@issuer = issuer
|
82
|
+
end
|
83
|
+
|
84
|
+
def assigner=(assigner)
|
85
|
+
if assigner.nil? or assigner.empty?
|
86
|
+
raise ArgumentError, 'assigner is mandatory'
|
87
|
+
end
|
88
|
+
@assigner = assigner
|
89
|
+
end
|
90
|
+
|
91
|
+
def id=(id)
|
92
|
+
if id.nil? or id.empty?
|
93
|
+
raise ArgumentError, 'id is manadtory'
|
94
|
+
end
|
95
|
+
@id = id
|
96
|
+
end
|
97
|
+
|
98
|
+
def type=(type)
|
99
|
+
if type.nil? or type.empty?
|
100
|
+
raise ArgumentError, 'type is mandatory'
|
101
|
+
end
|
102
|
+
@type = type
|
103
|
+
end
|
104
|
+
end #end of DvIdentifier
|
105
|
+
end # end of Basic
|
106
|
+
end # end of DataTypes
|
107
|
+
end # end of RM
|
108
|
+
end # end of OpenEHR
|