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,340 @@
|
|
1
|
+
$:.unshift(File.dirname(__FILE__))
|
2
|
+
module OpenEHR
|
3
|
+
module AM
|
4
|
+
module Archetype
|
5
|
+
module ConstraintModel
|
6
|
+
|
7
|
+
autoload :Primitive, 'constraint_model/primitive'
|
8
|
+
|
9
|
+
class ArchetypeConstraint
|
10
|
+
attr_reader :path
|
11
|
+
attr_accessor :parent
|
12
|
+
|
13
|
+
def initialize(args = { })
|
14
|
+
self.path = args[:path]
|
15
|
+
self.parent = args[:parent]
|
16
|
+
end
|
17
|
+
|
18
|
+
def path=(path)
|
19
|
+
if path.nil?
|
20
|
+
raise ArgumentError, 'path is mandatory'
|
21
|
+
end
|
22
|
+
@path = path
|
23
|
+
end
|
24
|
+
|
25
|
+
def has_path?(path)
|
26
|
+
return @path.include?(path)
|
27
|
+
end
|
28
|
+
|
29
|
+
def congruent?
|
30
|
+
if @path.index(@parent.path) == 0
|
31
|
+
return true
|
32
|
+
else
|
33
|
+
return false
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
alias is_congruent? congruent?
|
38
|
+
|
39
|
+
def node_conforms_to?(other)
|
40
|
+
if @path.index(other.path) == 0
|
41
|
+
return true
|
42
|
+
else
|
43
|
+
return false
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
class Cardinality
|
49
|
+
attr_accessor :interval, :is_ordered, :is_unique
|
50
|
+
|
51
|
+
def initialize(args = { })
|
52
|
+
@interval = args[:interval]
|
53
|
+
@is_ordered = args[:is_ordered]
|
54
|
+
@is_unique = args[:is_unique]
|
55
|
+
end
|
56
|
+
|
57
|
+
def is_ordered?
|
58
|
+
return @is_ordered
|
59
|
+
end
|
60
|
+
|
61
|
+
alias ordered? is_ordered?
|
62
|
+
|
63
|
+
def is_unique?
|
64
|
+
return @is_unique
|
65
|
+
end
|
66
|
+
|
67
|
+
alias unique? is_unique?
|
68
|
+
|
69
|
+
def is_set?
|
70
|
+
return !@is_ordered && @is_unique
|
71
|
+
end
|
72
|
+
|
73
|
+
alias set? is_set?
|
74
|
+
|
75
|
+
def is_list?
|
76
|
+
return @is_ordered && !@is_unique
|
77
|
+
end
|
78
|
+
|
79
|
+
alias list? is_list?
|
80
|
+
|
81
|
+
def is_bag?
|
82
|
+
return !@is_ordered && !@is_unique
|
83
|
+
end
|
84
|
+
|
85
|
+
alias bag? is_bag?
|
86
|
+
end
|
87
|
+
|
88
|
+
class CObject < ArchetypeConstraint
|
89
|
+
attr_reader :rm_type_name, :node_id, :occurrences
|
90
|
+
|
91
|
+
def initialize(args = { })
|
92
|
+
super(args)
|
93
|
+
self.rm_type_name = args[:rm_type_name]
|
94
|
+
self.node_id = args[:node_id]
|
95
|
+
self.occurrences = args[:occurrences]
|
96
|
+
|
97
|
+
end
|
98
|
+
|
99
|
+
def rm_type_name=(rm_type_name)
|
100
|
+
if rm_type_name.nil? || rm_type_name.empty?
|
101
|
+
raise ArgumentError, 'invalid rm_type_name'
|
102
|
+
end
|
103
|
+
@rm_type_name = rm_type_name
|
104
|
+
end
|
105
|
+
|
106
|
+
def node_id=(node_id)
|
107
|
+
if node_id.nil? || node_id.empty?
|
108
|
+
raise ArgumentError, 'invalid node_id'
|
109
|
+
end
|
110
|
+
@node_id = node_id
|
111
|
+
end
|
112
|
+
|
113
|
+
def occurrences=(occurrences)
|
114
|
+
if occurrences.nil?
|
115
|
+
raise ArgumentError, 'invaild occurrences'
|
116
|
+
end
|
117
|
+
@occurrences = occurrences
|
118
|
+
end
|
119
|
+
|
120
|
+
def self.create(args = { }, &block)
|
121
|
+
c_object = new(args)
|
122
|
+
if block_given?
|
123
|
+
yield c_object
|
124
|
+
end
|
125
|
+
return c_object
|
126
|
+
end
|
127
|
+
end
|
128
|
+
|
129
|
+
class CAttribute < ArchetypeConstraint
|
130
|
+
attr_reader :rm_attribute_name, :existence
|
131
|
+
attr_accessor :children
|
132
|
+
|
133
|
+
def initialize(args = { })
|
134
|
+
super(args)
|
135
|
+
self.rm_attribute_name = args[:rm_attribute_name]
|
136
|
+
self.existence = args[:existence]
|
137
|
+
self.children = args[:children]
|
138
|
+
end
|
139
|
+
|
140
|
+
def rm_attribute_name=(rm_attribute_name)
|
141
|
+
if rm_attribute_name.nil? or rm_attribute_name.empty?
|
142
|
+
raise ArgumentError, 'invalid rm_attribute_name'
|
143
|
+
end
|
144
|
+
@rm_attribute_name = rm_attribute_name
|
145
|
+
end
|
146
|
+
|
147
|
+
def existence=(existence)
|
148
|
+
if existence.nil? || existence.lower < 0 || existence.upper > 1
|
149
|
+
raise ArgumentError, 'invalid existence'
|
150
|
+
end
|
151
|
+
@existence = existence
|
152
|
+
end
|
153
|
+
end
|
154
|
+
|
155
|
+
class CDefinedObject < CObject
|
156
|
+
attr_accessor :assumed_value
|
157
|
+
|
158
|
+
def initialize(args = { })
|
159
|
+
super
|
160
|
+
self.assumed_value = args[:assumed_value]
|
161
|
+
end
|
162
|
+
|
163
|
+
def has_assumed_value?
|
164
|
+
return !@assumed_value.nil?
|
165
|
+
end
|
166
|
+
|
167
|
+
def default_value
|
168
|
+
raise NotImplementedError, 'subclass should implement this method'
|
169
|
+
end
|
170
|
+
|
171
|
+
def valid_value?(value)
|
172
|
+
raise NotImplementedError, 'subclass should implement this method'
|
173
|
+
end
|
174
|
+
|
175
|
+
def any_allowed?
|
176
|
+
raise NotImplementedError, 'subclass should implement this method'
|
177
|
+
end
|
178
|
+
end
|
179
|
+
|
180
|
+
class CPrimitiveObject < CDefinedObject
|
181
|
+
attr_accessor :item
|
182
|
+
|
183
|
+
def initialize(args = { })
|
184
|
+
super
|
185
|
+
self.item = args[:item]
|
186
|
+
end
|
187
|
+
|
188
|
+
def any_allowed?
|
189
|
+
return item.nil?
|
190
|
+
end
|
191
|
+
end
|
192
|
+
|
193
|
+
class CComplexObject < CDefinedObject
|
194
|
+
attr_accessor :attributes
|
195
|
+
|
196
|
+
def initialize(args = { })
|
197
|
+
super
|
198
|
+
self.attributes = args[:attributes]
|
199
|
+
end
|
200
|
+
|
201
|
+
def any_allowed?
|
202
|
+
return (@attributes.nil? or @attributes.empty?)
|
203
|
+
end
|
204
|
+
|
205
|
+
def self.create(args = { }, &block)
|
206
|
+
c_complex_object = new(args)
|
207
|
+
if block_given?
|
208
|
+
yield c_complex_object
|
209
|
+
end
|
210
|
+
return c_complex_object
|
211
|
+
end
|
212
|
+
end
|
213
|
+
|
214
|
+
class CDomainType < CDefinedObject
|
215
|
+
def standard_equivalent
|
216
|
+
raise NotImplementedError, 'subclass should be defined'
|
217
|
+
end
|
218
|
+
end
|
219
|
+
|
220
|
+
class CReferenceObject < CObject
|
221
|
+
|
222
|
+
end
|
223
|
+
|
224
|
+
class ArchetypeInternalRef < CReferenceObject
|
225
|
+
attr_reader :target_path
|
226
|
+
|
227
|
+
def initialize(args = { })
|
228
|
+
super
|
229
|
+
self.target_path = args[:target_path]
|
230
|
+
end
|
231
|
+
|
232
|
+
def target_path=(target_path)
|
233
|
+
if target_path.nil? or target_path.empty?
|
234
|
+
raise ArgumentError, 'target_path is mandatory'
|
235
|
+
end
|
236
|
+
@target_path = target_path
|
237
|
+
end
|
238
|
+
end
|
239
|
+
|
240
|
+
class ArchetypeSlot < CReferenceObject
|
241
|
+
attr_reader :includes, :excludes
|
242
|
+
|
243
|
+
def initialize(args = { })
|
244
|
+
super
|
245
|
+
self.includes = args[:includes]
|
246
|
+
self.excludes = args[:excludes]
|
247
|
+
end
|
248
|
+
|
249
|
+
def includes=(includes)
|
250
|
+
if !includes.nil? && includes.empty?
|
251
|
+
raise ArgumentError, 'includes should not be empty'
|
252
|
+
end
|
253
|
+
@includes = includes
|
254
|
+
end
|
255
|
+
|
256
|
+
def excludes=(excludes)
|
257
|
+
if !excludes.nil? && excludes.empty?
|
258
|
+
raise ArgumentError, 'excludes should not be empty'
|
259
|
+
end
|
260
|
+
@excludes = excludes
|
261
|
+
end
|
262
|
+
|
263
|
+
def any_allowed?
|
264
|
+
return includes.nil? && excludes.nil?
|
265
|
+
end
|
266
|
+
|
267
|
+
def self.create(args = { }, &block)
|
268
|
+
archetype_slot = new(args)
|
269
|
+
archetype_slot.includes = args[:includes]
|
270
|
+
archetype_slot.excludes = args[:excludes]
|
271
|
+
if block_given?
|
272
|
+
yield archetype_slot
|
273
|
+
end
|
274
|
+
return archetype_slot
|
275
|
+
end
|
276
|
+
end
|
277
|
+
|
278
|
+
class ConstraintRef < CReferenceObject
|
279
|
+
attr_reader :reference
|
280
|
+
|
281
|
+
def initialize(args = { })
|
282
|
+
super
|
283
|
+
self.reference = args[:reference]
|
284
|
+
end
|
285
|
+
|
286
|
+
def reference=(reference)
|
287
|
+
if reference.nil?
|
288
|
+
raise ArgumentError, 'reference is mandatory'
|
289
|
+
end
|
290
|
+
@reference = reference
|
291
|
+
end
|
292
|
+
|
293
|
+
def self.create(args = { }, &block)
|
294
|
+
constraint_ref = new(args)
|
295
|
+
constraint_ref.reference = args[:reference]
|
296
|
+
if block_given?
|
297
|
+
yield constraint_ref
|
298
|
+
end
|
299
|
+
return constraint_ref
|
300
|
+
end
|
301
|
+
end
|
302
|
+
|
303
|
+
class CSingleAttribute < CAttribute
|
304
|
+
attr_reader :alternatives
|
305
|
+
|
306
|
+
def initialize(args = { })
|
307
|
+
super
|
308
|
+
self.alternatives = args[:alternatives]
|
309
|
+
end
|
310
|
+
|
311
|
+
def alternatives=(alternatives)
|
312
|
+
if alternatives.nil?
|
313
|
+
raise ArgumentError, 'alternatives are mandatory'
|
314
|
+
end
|
315
|
+
@alternatives = alternatives
|
316
|
+
end
|
317
|
+
end
|
318
|
+
|
319
|
+
class CMultipleAttribute < CAttribute
|
320
|
+
attr_accessor :members
|
321
|
+
attr_reader :cardinality
|
322
|
+
|
323
|
+
def initialize(args = { })
|
324
|
+
super
|
325
|
+
self.members = args[:members]
|
326
|
+
self.cardinality = args[:cardinality]
|
327
|
+
end
|
328
|
+
|
329
|
+
def cardinality=(cardinality)
|
330
|
+
if cardinality.nil?
|
331
|
+
raise ArgumentError, 'cardinality is mandatory'
|
332
|
+
end
|
333
|
+
@cardinality = cardinality
|
334
|
+
end
|
335
|
+
end
|
336
|
+
end # of ConstraintModel
|
337
|
+
end # of Archetype
|
338
|
+
end # of AM
|
339
|
+
end # of OpenEHR
|
340
|
+
|
@@ -0,0 +1,97 @@
|
|
1
|
+
module OpenEHR
|
2
|
+
module AM
|
3
|
+
module Archetype
|
4
|
+
module Ontology
|
5
|
+
class ArchetypeOntology
|
6
|
+
attr_accessor :constraint_definitions, :specialisation_depth
|
7
|
+
attr_accessor :term_attribute_names, :term_bindings
|
8
|
+
attr_reader :terminologies_available, :term_definitions
|
9
|
+
|
10
|
+
def initialize(args = { })
|
11
|
+
self.specialisation_depth = args[:specialisation_depth]
|
12
|
+
self.term_definitions = args[:term_definitions]
|
13
|
+
self.constraint_definitions = args[:constraint_definitions]
|
14
|
+
self.term_bindings = args[:term_bindings]
|
15
|
+
end
|
16
|
+
|
17
|
+
def term_definitions=(term_definitions)
|
18
|
+
if term_definitions.nil?
|
19
|
+
raise ArgumentError, 'term_definitions is mandatory'
|
20
|
+
end
|
21
|
+
@term_definitions = term_definitions
|
22
|
+
end
|
23
|
+
|
24
|
+
def term_codes
|
25
|
+
return @term_definitions.values.collect {|value|
|
26
|
+
value.collect {|term| term.code}}.flatten.uniq
|
27
|
+
end
|
28
|
+
|
29
|
+
def constraint_codes
|
30
|
+
if @constraint_definitions.nil?
|
31
|
+
return nil
|
32
|
+
else
|
33
|
+
return @constraint_definitions.values.collect {|value|
|
34
|
+
value.collect {|term| term.code}}.flatten.uniq
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
def terminologies_available
|
39
|
+
return @term_bindings.keys
|
40
|
+
end
|
41
|
+
|
42
|
+
def constraint_binding(a_terminology, a_code)
|
43
|
+
end
|
44
|
+
|
45
|
+
def constraint_definition(a_lang, a_code)
|
46
|
+
end
|
47
|
+
|
48
|
+
def has_language?(a_lang)
|
49
|
+
end
|
50
|
+
|
51
|
+
def has_terminology?(a_terminology)
|
52
|
+
end
|
53
|
+
|
54
|
+
def term_binding(a_terminology, a_code)
|
55
|
+
end
|
56
|
+
|
57
|
+
def term_definition(a_lang, a_code)
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
class ARCHETYPE_ONTOLOGY < ArchetypeOntology
|
62
|
+
|
63
|
+
end
|
64
|
+
|
65
|
+
class ArchetypeTerm
|
66
|
+
attr_accessor :items
|
67
|
+
attr_reader :code
|
68
|
+
|
69
|
+
def initialize(args = { })
|
70
|
+
self.code = args[:code]
|
71
|
+
self.items =args[:items]
|
72
|
+
end
|
73
|
+
|
74
|
+
def code=(code)
|
75
|
+
if code.nil? or code.empty?
|
76
|
+
raise ArgumentError, 'code is mandatory'
|
77
|
+
end
|
78
|
+
@code = code
|
79
|
+
end
|
80
|
+
|
81
|
+
def keys
|
82
|
+
if items.nil?
|
83
|
+
return Set.new
|
84
|
+
else
|
85
|
+
return Set.new(@items.keys)
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
class ARCHETYPE_TERM < ArchetypeTerm
|
91
|
+
|
92
|
+
end
|
93
|
+
end # end of Ontology
|
94
|
+
end # end of Archetype
|
95
|
+
end # end of AM
|
96
|
+
end # end of OpenEHR
|
97
|
+
|
@@ -0,0 +1,134 @@
|
|
1
|
+
$:.unshift(File.dirname(__FILE__))
|
2
|
+
include OpenEHR::RM::Common::Resource
|
3
|
+
|
4
|
+
module OpenEHR
|
5
|
+
module AM
|
6
|
+
module Archetype
|
7
|
+
module ADLDefinition
|
8
|
+
include OpenEHR::RM::Support::Terminology
|
9
|
+
# include OpenEHR::RM::Support::Terminology::OpenEHR_Code_Set_Identifier
|
10
|
+
CURRENT_ADL_VERSION = "1.4"
|
11
|
+
end
|
12
|
+
|
13
|
+
class Archetype < AuthoredResource
|
14
|
+
include ADLDefinition
|
15
|
+
attr_reader :archetype_id, :concept, :definition, :ontology
|
16
|
+
attr_accessor :uid, :adl_version, :parent_archetype_id, :invariants
|
17
|
+
|
18
|
+
def initialize(args = {})
|
19
|
+
super(args)
|
20
|
+
self.adl_version = args[:adl_version]
|
21
|
+
self.archetype_id = args[:archetype_id]
|
22
|
+
self.uid = args[:uid]
|
23
|
+
self.concept = args[:concept]
|
24
|
+
self.parent_archetype_id = args[:parent_archetype_id]
|
25
|
+
self.definition = args[:definition]
|
26
|
+
self.ontology = args[:ontology]
|
27
|
+
self.invariants = args[:invariants]
|
28
|
+
end
|
29
|
+
|
30
|
+
def archetype_id=(archetype_id)
|
31
|
+
if archetype_id.nil?
|
32
|
+
raise ArgumentError, 'archetype_id is mandatory'
|
33
|
+
end
|
34
|
+
@archetype_id = archetype_id
|
35
|
+
end
|
36
|
+
|
37
|
+
def concept=(concept)
|
38
|
+
if concept.nil?
|
39
|
+
raise ArgumentError, 'concept is mandatory'
|
40
|
+
end
|
41
|
+
@concept = concept
|
42
|
+
end
|
43
|
+
|
44
|
+
def definition=(definition)
|
45
|
+
if definition.nil?
|
46
|
+
raise ArgumentError, 'definition is mandatory'
|
47
|
+
end
|
48
|
+
@definition = definition
|
49
|
+
end
|
50
|
+
|
51
|
+
def ontology=(ontology)
|
52
|
+
if ontology.nil?
|
53
|
+
raise ArgumentError, 'ontology is mandatory'
|
54
|
+
end
|
55
|
+
@ontology = ontology
|
56
|
+
end
|
57
|
+
|
58
|
+
def version
|
59
|
+
return @archetype_id.version_id
|
60
|
+
end
|
61
|
+
|
62
|
+
def short_concept_name
|
63
|
+
return @archetype_id.concept_name
|
64
|
+
end
|
65
|
+
|
66
|
+
def concept_name(a_lang)
|
67
|
+
|
68
|
+
end
|
69
|
+
|
70
|
+
def constraint_references_valid?
|
71
|
+
end
|
72
|
+
|
73
|
+
def internal_references_valid?
|
74
|
+
end
|
75
|
+
|
76
|
+
def is_specialised?
|
77
|
+
end
|
78
|
+
|
79
|
+
def is_valid?
|
80
|
+
end
|
81
|
+
|
82
|
+
def logical_paths(a_lang)
|
83
|
+
end
|
84
|
+
|
85
|
+
def node_ids_vaild?
|
86
|
+
end
|
87
|
+
|
88
|
+
def physical_paths
|
89
|
+
end
|
90
|
+
|
91
|
+
def previous_version
|
92
|
+
end
|
93
|
+
|
94
|
+
def specialisation_depth
|
95
|
+
end
|
96
|
+
|
97
|
+
def self.create(args ={}, &block)
|
98
|
+
archetype = new(args)
|
99
|
+
if block_given?
|
100
|
+
yield archetype
|
101
|
+
end
|
102
|
+
return archetype
|
103
|
+
end
|
104
|
+
|
105
|
+
end # end of Archetype
|
106
|
+
# original file:
|
107
|
+
# ref_imple_eiffel/components/adl_parser/src/interface/adl_definition.e
|
108
|
+
|
109
|
+
class ValidityKind
|
110
|
+
attr_reader :value
|
111
|
+
|
112
|
+
MANDATORY = 1001
|
113
|
+
OPTIONAL = 1002
|
114
|
+
DISALLOWED = 1003
|
115
|
+
|
116
|
+
def initialize(args = { })
|
117
|
+
self.value = args[:value]
|
118
|
+
end
|
119
|
+
|
120
|
+
def value=(value)
|
121
|
+
unless [MANDATORY, OPTIONAL, DISALLOWED].include? value
|
122
|
+
raise ArgumentError, 'invalid value'
|
123
|
+
end
|
124
|
+
@value = value
|
125
|
+
end
|
126
|
+
end
|
127
|
+
|
128
|
+
autoload :Assertion, 'archetype/assertion'
|
129
|
+
autoload :ConstraintModel, 'archetype/constraint_model'
|
130
|
+
autoload :Ontology, 'archetype/ontology'
|
131
|
+
|
132
|
+
end # of Archetype
|
133
|
+
end # of AM
|
134
|
+
end # of OpenEHR
|
@@ -0,0 +1,29 @@
|
|
1
|
+
module OpenEhr
|
2
|
+
module AM
|
3
|
+
module OpenEHR_Profile
|
4
|
+
module DataTypes
|
5
|
+
module Basic
|
6
|
+
class C_DV_STATE
|
7
|
+
end
|
8
|
+
|
9
|
+
class STATE_MACHINE
|
10
|
+
end
|
11
|
+
|
12
|
+
class STATE
|
13
|
+
end
|
14
|
+
|
15
|
+
class TERMINAL_STATE < STATE
|
16
|
+
end
|
17
|
+
|
18
|
+
class NON_TERMINAL_STATE < STATE
|
19
|
+
end
|
20
|
+
|
21
|
+
class TRANSITION
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
|
26
|
+
end # of Data_Types
|
27
|
+
end # of OpenEHR Profile
|
28
|
+
end # of RM
|
29
|
+
end # of OpenEHR
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module OpenEhr
|
2
|
+
module AM
|
3
|
+
module OpenEHR_Profile
|
4
|
+
module DataTypes
|
5
|
+
|
6
|
+
module Quantity
|
7
|
+
class C_DV_QUANTITY < OpenEhr::AM::Archetype::Constraint_Model::C_DOMAIN_TYPE
|
8
|
+
end
|
9
|
+
|
10
|
+
class C_DV_ORDINAL < OpenEhr::AM::Archetype::Constraint_Model::C_DOMAIN_TYPE
|
11
|
+
end
|
12
|
+
|
13
|
+
class C_QUANTITY_ITEM
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end # of Data_Types
|
17
|
+
end # of OpenEHR Profile
|
18
|
+
end # of RM
|
19
|
+
end # of OpenEHR
|
@@ -0,0 +1,12 @@
|
|
1
|
+
module OpenEhr
|
2
|
+
module AM
|
3
|
+
module OpenEHR_Profile
|
4
|
+
module DataTypes
|
5
|
+
module Text
|
6
|
+
class C_CODE_PHASE < OpenEhr::AM::Archetype::Constraint_Model::C_DOMAIN_TYPE
|
7
|
+
end
|
8
|
+
end
|
9
|
+
end # of Data_Types
|
10
|
+
end # of OpenEHR Profile
|
11
|
+
end # of RM
|
12
|
+
end # of OpenEHR
|