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,190 @@
|
|
1
|
+
module OpenEHR
|
2
|
+
module AM
|
3
|
+
module Archetype
|
4
|
+
module Assertion
|
5
|
+
class Assertion
|
6
|
+
attr_reader :expression, :tag
|
7
|
+
attr_accessor :string_expression, :variables
|
8
|
+
|
9
|
+
def initialize(args = { })
|
10
|
+
self.expression = args[:expression]
|
11
|
+
self.tag = args[:tag]
|
12
|
+
self.string_expression = args[:string_expression]
|
13
|
+
self.variables = args[:variables]
|
14
|
+
end
|
15
|
+
|
16
|
+
def expression=(expression)
|
17
|
+
if expression.nil? or expression.type.upcase != 'BOOLEAN'
|
18
|
+
raise ArgumentError, 'invalid expression'
|
19
|
+
end
|
20
|
+
@expression = expression
|
21
|
+
end
|
22
|
+
|
23
|
+
def tag=(tag)
|
24
|
+
if !tag.nil? && tag.empty?
|
25
|
+
raise ArgumentError, 'tag should not be empty'
|
26
|
+
end
|
27
|
+
@tag = tag
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
class ExprItem
|
32
|
+
attr_reader :type
|
33
|
+
|
34
|
+
def initialize(args = { })
|
35
|
+
self.type = args[:type]
|
36
|
+
end
|
37
|
+
|
38
|
+
def type=(type)
|
39
|
+
if type.nil? or type.empty?
|
40
|
+
raise ArgumentError, 'type is mandatory'
|
41
|
+
end
|
42
|
+
@type = type
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
class ExprLeaf < ExprItem
|
47
|
+
attr_reader :item, :reference_type
|
48
|
+
|
49
|
+
def initialize(args = { })
|
50
|
+
super
|
51
|
+
self.item = args[:item]
|
52
|
+
self.reference_type = args[:reference_type]
|
53
|
+
end
|
54
|
+
|
55
|
+
def item=(item)
|
56
|
+
if item.nil?
|
57
|
+
raise ArgumentError, 'item is mandatory'
|
58
|
+
end
|
59
|
+
@item = item
|
60
|
+
end
|
61
|
+
|
62
|
+
def reference_type=(reference_type)
|
63
|
+
if reference_type.nil?
|
64
|
+
raise ArgumentError, 'reference_type is mandatory'
|
65
|
+
end
|
66
|
+
@reference_type = reference_type
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
class ExprOperator < ExprItem
|
71
|
+
attr_accessor :operator, :precedence_overridden
|
72
|
+
|
73
|
+
def initialize(args = { })
|
74
|
+
super
|
75
|
+
self.operator = args[:operator]
|
76
|
+
self.precedence_overridden = args[:precedence_overridden]
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
class ExprUnaryOperator < ExprOperator
|
81
|
+
attr_reader :operand
|
82
|
+
|
83
|
+
def initialize(args = { })
|
84
|
+
super
|
85
|
+
self.operand = args[:operand]
|
86
|
+
end
|
87
|
+
|
88
|
+
def operand=(operand)
|
89
|
+
if operand.nil?
|
90
|
+
raise ArgumentError, 'operand is mandatory'
|
91
|
+
end
|
92
|
+
@operand = operand
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
96
|
+
class ExprBinaryOperator < ExprOperator
|
97
|
+
attr_reader :right_operand, :left_operand
|
98
|
+
|
99
|
+
def initialize(args = { })
|
100
|
+
super
|
101
|
+
self.right_operand = args[:right_operand]
|
102
|
+
self.left_operand = args[:left_operand]
|
103
|
+
end
|
104
|
+
|
105
|
+
def right_operand=(right_operand)
|
106
|
+
if right_operand.nil?
|
107
|
+
raise ArgumentError, 'right_operand is mandatory'
|
108
|
+
end
|
109
|
+
@right_operand = right_operand
|
110
|
+
end
|
111
|
+
|
112
|
+
def left_operand=(left_operand)
|
113
|
+
if left_operand.nil?
|
114
|
+
raise ArgumentError, 'left_operand is mandatory'
|
115
|
+
end
|
116
|
+
@left_operand = left_operand
|
117
|
+
end
|
118
|
+
end
|
119
|
+
|
120
|
+
class AssertionVariable
|
121
|
+
attr_reader :name, :definition
|
122
|
+
|
123
|
+
def initialize(args = { })
|
124
|
+
self.name = args[:name]
|
125
|
+
self.definition = args[:definition]
|
126
|
+
end
|
127
|
+
|
128
|
+
def name=(name)
|
129
|
+
if name.nil?
|
130
|
+
raise ArgumentError, 'name is mandatory'
|
131
|
+
end
|
132
|
+
@name = name
|
133
|
+
end
|
134
|
+
|
135
|
+
def definition=(definition)
|
136
|
+
if definition.nil?
|
137
|
+
raise ArgumentError, 'definition is mandatory'
|
138
|
+
end
|
139
|
+
@definition = definition
|
140
|
+
end
|
141
|
+
end
|
142
|
+
|
143
|
+
class OperatorKind
|
144
|
+
OP_EQ = 2001
|
145
|
+
OP_NE = 2002
|
146
|
+
OP_LE = 2003
|
147
|
+
OP_LT = 2004
|
148
|
+
OP_GE = 2005
|
149
|
+
OP_GT = 2006
|
150
|
+
OP_MATCHES = 2007
|
151
|
+
|
152
|
+
OP_NOT = 2010
|
153
|
+
OP_AND = 2011
|
154
|
+
OP_OR = 2012
|
155
|
+
OP_XOR = 2013
|
156
|
+
OP_IMPLIES = 2014
|
157
|
+
OP_FOR_ALL = 2015
|
158
|
+
OP_EXISTS = 2016
|
159
|
+
|
160
|
+
OP_PLUS = 2020
|
161
|
+
OP_MINUS = 2021
|
162
|
+
OP_MULTIPLY = 2022
|
163
|
+
OP_DIVIDE = 2023
|
164
|
+
OP_EXP = 2024
|
165
|
+
|
166
|
+
attr_reader :value
|
167
|
+
|
168
|
+
def initialize(args = { })
|
169
|
+
self.value = args[:value]
|
170
|
+
end
|
171
|
+
|
172
|
+
def value=(value)
|
173
|
+
unless OperatorKind.valid_operator? value
|
174
|
+
raise ArgumentError, 'invalid value'
|
175
|
+
end
|
176
|
+
@value = value
|
177
|
+
end
|
178
|
+
|
179
|
+
def self.valid_operator?(value)
|
180
|
+
if value >= OP_EQ && value <= OP_EXP
|
181
|
+
return true
|
182
|
+
else
|
183
|
+
return false
|
184
|
+
end
|
185
|
+
end
|
186
|
+
end
|
187
|
+
end # of Assetion
|
188
|
+
end # of Archtype
|
189
|
+
end #of AM
|
190
|
+
end # of OpenEHR
|
@@ -0,0 +1,296 @@
|
|
1
|
+
# Ticket #71
|
2
|
+
module OpenEHR
|
3
|
+
module AM
|
4
|
+
module Archetype
|
5
|
+
module ConstraintModel
|
6
|
+
module Primitive
|
7
|
+
class CPrimitive
|
8
|
+
attr_reader :default_value
|
9
|
+
attr_accessor :assumed_value
|
10
|
+
|
11
|
+
def initialize(args = { })
|
12
|
+
self.default_value = args[:default_value]
|
13
|
+
self.assumed_value = args[:assumed_value]
|
14
|
+
end
|
15
|
+
|
16
|
+
def default_value=(default_value)
|
17
|
+
if default_value.nil?
|
18
|
+
raise ArgumentError, 'default_value is mandatory'
|
19
|
+
end
|
20
|
+
@default_value = default_value
|
21
|
+
end
|
22
|
+
|
23
|
+
def has_assumed_value?
|
24
|
+
return !assumed_value.nil?
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
class CBoolean < CPrimitive
|
29
|
+
attr_reader :true_valid, :false_valid
|
30
|
+
|
31
|
+
def initialize(args = { })
|
32
|
+
binary_consistency(args[:true_valid], args[:false_valid])
|
33
|
+
@true_valid = args[:true_valid]
|
34
|
+
@false_valid = args[:false_valid]
|
35
|
+
super(args)
|
36
|
+
end
|
37
|
+
|
38
|
+
def default_value=(default_value)
|
39
|
+
super
|
40
|
+
default_value_consistency(default_value)
|
41
|
+
end
|
42
|
+
|
43
|
+
def true_valid=(true_valid)
|
44
|
+
binary_consistency(true_valid, @false_valid)
|
45
|
+
@true_valid = true_valid
|
46
|
+
end
|
47
|
+
|
48
|
+
def false_valid=(false_valid)
|
49
|
+
binary_consistency(@true_valid, false_valid)
|
50
|
+
@false_valid = false_valid
|
51
|
+
end
|
52
|
+
|
53
|
+
def true_valid?
|
54
|
+
return @true_valid
|
55
|
+
end
|
56
|
+
|
57
|
+
def false_valid?
|
58
|
+
return @false_valid
|
59
|
+
end
|
60
|
+
|
61
|
+
private
|
62
|
+
def binary_consistency(true_valid, false_valid)
|
63
|
+
if (true_valid == false) && (false_valid == false)
|
64
|
+
raise ArgumentError, 'true_valid or false_valid should be true'
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
def default_value_consistency(default_value)
|
69
|
+
if (!@true_valid && default_value) || (!@false_valid && !default_value)
|
70
|
+
raise ArgumentError, 'default value inconsistency'
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
class CString < CPrimitive
|
76
|
+
attr_reader :pattern, :list
|
77
|
+
|
78
|
+
def initialize(args = { })
|
79
|
+
super
|
80
|
+
consistency(args[:pattern], args[:list])
|
81
|
+
@pattern = args[:pattern]
|
82
|
+
@list = args[:list]
|
83
|
+
end
|
84
|
+
|
85
|
+
def pattern=(pattern)
|
86
|
+
consistency(pattern, @list)
|
87
|
+
@pattern = pattern
|
88
|
+
end
|
89
|
+
|
90
|
+
def list=(list)
|
91
|
+
consistency(@pattern, list)
|
92
|
+
@list = list
|
93
|
+
end
|
94
|
+
|
95
|
+
private
|
96
|
+
def consistency(pattern, list)
|
97
|
+
if pattern.nil? == list.nil?
|
98
|
+
raise ArgumentError, 'consistency invaild'
|
99
|
+
end
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
103
|
+
class CInteger < CPrimitive
|
104
|
+
attr_reader :list, :range
|
105
|
+
|
106
|
+
def initialize(args = { })
|
107
|
+
super
|
108
|
+
consistency(args[:list], args[:range])
|
109
|
+
@list = args[:list]
|
110
|
+
@range = args[:range]
|
111
|
+
end
|
112
|
+
|
113
|
+
def list=(list)
|
114
|
+
consistency(list, @range)
|
115
|
+
@list = list
|
116
|
+
end
|
117
|
+
|
118
|
+
def range=(range)
|
119
|
+
consistency(@list, range)
|
120
|
+
@range = range
|
121
|
+
end
|
122
|
+
|
123
|
+
private
|
124
|
+
def consistency(list, range)
|
125
|
+
if list.nil? == range.nil?
|
126
|
+
raise ArgumentError, 'consistency invalid'
|
127
|
+
end
|
128
|
+
end
|
129
|
+
end
|
130
|
+
|
131
|
+
class CReal < CInteger
|
132
|
+
|
133
|
+
end
|
134
|
+
|
135
|
+
module CDateModule
|
136
|
+
attr_accessor :range, :timezone_validity
|
137
|
+
attr_reader :month_validity, :day_validity
|
138
|
+
|
139
|
+
def month_validity=(month_validity)
|
140
|
+
if (month_validity == ValidityKind::OPTIONAL &&
|
141
|
+
!(@day_validity == ValidityKind::OPTIONAL ||
|
142
|
+
@day_validity == ValidityKind::DISALLOWED)) ||
|
143
|
+
(month_validity == ValidityKind::DISALLOWED &&
|
144
|
+
!(@day_validity == ValidityKind::DISALLOWED))
|
145
|
+
raise ArgumentError, 'month validity disallowed'
|
146
|
+
end
|
147
|
+
@month_validity = month_validity
|
148
|
+
end
|
149
|
+
|
150
|
+
def day_validity=(day_validity)
|
151
|
+
@day_validity = day_validity
|
152
|
+
end
|
153
|
+
|
154
|
+
def validity_is_range?
|
155
|
+
return !@range.nil?
|
156
|
+
end
|
157
|
+
|
158
|
+
private
|
159
|
+
def consistency_validity(month_validity, day_validity)
|
160
|
+
end
|
161
|
+
end
|
162
|
+
|
163
|
+
class CDate < CPrimitive
|
164
|
+
include CDateModule
|
165
|
+
|
166
|
+
def initialize(args = { })
|
167
|
+
super(args)
|
168
|
+
self.range = args[:range]
|
169
|
+
self.timezone_validity = args[:timezone_validity]
|
170
|
+
self.day_validity = args[:day_validity]
|
171
|
+
self.month_validity = args[:month_validity]
|
172
|
+
end
|
173
|
+
end
|
174
|
+
|
175
|
+
module CTimeModule
|
176
|
+
attr_accessor :range
|
177
|
+
attr_reader :minute_validity, :second_validity,
|
178
|
+
:millisecond_validity
|
179
|
+
|
180
|
+
def minute_validity=(minute_validity)
|
181
|
+
if (minute_validity == ValidityKind::OPTIONAL &&
|
182
|
+
@second_validity == ValidityKind::MANDATORY) ||
|
183
|
+
(minute_validity == ValidityKind::DISALLOWED &&
|
184
|
+
@second_validity != ValidityKind::DISALLOWED)
|
185
|
+
raise ArgumentError, 'minute_validity is invalid'
|
186
|
+
end
|
187
|
+
@minute_validity = minute_validity
|
188
|
+
end
|
189
|
+
|
190
|
+
def second_validity=(second_validity)
|
191
|
+
if (second_validity == ValidityKind::OPTIONAL &&
|
192
|
+
@millisecond_validity == ValidityKind::MANDATORY) ||
|
193
|
+
(second_validity == ValidityKind::DISALLOWED &&
|
194
|
+
@millisecond_validity != ValidityKind::DISALLOWED)
|
195
|
+
raise ArgumentError, 'second_validity is invalid'
|
196
|
+
end
|
197
|
+
@second_validity = second_validity
|
198
|
+
end
|
199
|
+
|
200
|
+
def millisecond_validity=(millisecond_validity)
|
201
|
+
@millisecond_validity = millisecond_validity
|
202
|
+
end
|
203
|
+
|
204
|
+
def validity_is_range?
|
205
|
+
return !@range.nil?
|
206
|
+
end
|
207
|
+
end
|
208
|
+
|
209
|
+
class CTime < CPrimitive
|
210
|
+
include CTimeModule
|
211
|
+
|
212
|
+
def initialize(args = { })
|
213
|
+
super
|
214
|
+
self.range = args[:range]
|
215
|
+
self.millisecond_validity = args[:millisecond_validity]
|
216
|
+
self.second_validity = args[:second_validity]
|
217
|
+
self.minute_validity = args[:minute_validity]
|
218
|
+
end
|
219
|
+
end
|
220
|
+
|
221
|
+
class CDateTime < CPrimitive
|
222
|
+
include CDateModule, CTimeModule
|
223
|
+
attr_reader :hour_validity
|
224
|
+
|
225
|
+
def initialize(args = { })
|
226
|
+
super
|
227
|
+
self.timezone_validity = args[:timezone_validity]
|
228
|
+
self.millisecond_validity = args[:millisecond_validity]
|
229
|
+
self.second_validity = args[:second_validity]
|
230
|
+
self.minute_validity = args[:minute_validity]
|
231
|
+
self.hour_validity = args[:hour_vaildity]
|
232
|
+
self.day_validity = args[:day_validity]
|
233
|
+
self.month_validity = args[:day_validity]
|
234
|
+
end
|
235
|
+
|
236
|
+
def hour_validity=(hour_validity)
|
237
|
+
if (hour_validity == ValidityKind::DISALLOWED &&
|
238
|
+
@minute_validity != ValidityKind::DISALLOWED) ||
|
239
|
+
(hour_validity == ValidityKind::OPTIONAL &&
|
240
|
+
!(@minute_validity == ValidityKind::OPTIONAL ||
|
241
|
+
@minute_validity == ValidityKind::DISALLOWED))
|
242
|
+
raise ArgumentError, 'hour_validity is invalid'
|
243
|
+
end
|
244
|
+
@hour_validity = hour_validity
|
245
|
+
end
|
246
|
+
|
247
|
+
def day_validity=(day_validity)
|
248
|
+
if (day_validity == ValidityKind::DISALLOWED &&
|
249
|
+
@hour_validity != ValidityKind::DISALLOWED) ||
|
250
|
+
(day_validity == ValidityKind::OPTIONAL &&
|
251
|
+
!(@hour_validity == ValidityKind::OPTIONAL ||
|
252
|
+
@hour_validity == ValidityKind::DISALLOWED))
|
253
|
+
raise ArgumentError, 'day_validity is invaild'
|
254
|
+
end
|
255
|
+
@day_validity = day_validity
|
256
|
+
end
|
257
|
+
end
|
258
|
+
|
259
|
+
class CDuration < CPrimitive
|
260
|
+
attr_reader :range
|
261
|
+
attr_accessor :years_allowed, :months_allowed, :weeks_allowed,
|
262
|
+
:days_allowed, :hours_allowed, :minutes_allowed,
|
263
|
+
:seconds_allowed, :fractional_seconds_allowed
|
264
|
+
|
265
|
+
def initialize(args = { })
|
266
|
+
super
|
267
|
+
self.fractional_seconds_allowed = args[:fractional_seconds_allowed]
|
268
|
+
self.seconds_allowed = args[:seconds_allowed]
|
269
|
+
self.minutes_allowed = args[:minutes_allowed]
|
270
|
+
self.hours_allowed = args[:hours_allowed]
|
271
|
+
self.days_allowed = args[:days_allowed]
|
272
|
+
self.months_allowed = args[:months_allowed]
|
273
|
+
self.weeks_allowed = args[:weeks_allowed]
|
274
|
+
self.years_allowed = args[:years_allowed]
|
275
|
+
self.range = args[:range]
|
276
|
+
end
|
277
|
+
|
278
|
+
def range=(range)
|
279
|
+
if range.nil? && !(@years_allowed ||
|
280
|
+
@months_allowed ||
|
281
|
+
@weeks_allowed ||
|
282
|
+
@days_allowed ||
|
283
|
+
@hours_allowed ||
|
284
|
+
@minutes_allowed ||
|
285
|
+
@seconds_allowed ||
|
286
|
+
@fractional_seconds_allowed)
|
287
|
+
raise ArgumentError, 'invalid range'
|
288
|
+
end
|
289
|
+
@range = range
|
290
|
+
end
|
291
|
+
end
|
292
|
+
end # of Primitive
|
293
|
+
end # of CostraintModel
|
294
|
+
end # of Archetype
|
295
|
+
end # of AM
|
296
|
+
end # of OpenEHR
|