openehr 1.2.99999 → 1.2.999999
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/README.rdoc +4 -4
- data/lib/openehr/am/archetype.rb +6 -0
- data/lib/openehr/parser/adl_grammar.tt +35 -7
- data/lib/openehr/parser/adl_parser.rb +6 -1
- data/lib/openehr/parser/opt_parser.rb +71 -50
- data/lib/openehr/rm.rb +1 -2
- data/lib/openehr/rm/data_types/basic.rb +6 -2
- data/lib/openehr/rm/factory.rb +46 -3
- data/lib/openehr/serializer.rb +20 -0
- data/lib/openehr/version.rb +1 -1
- metadata +34 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 0b1262bf46aa8257e7bb3aded5078ca794a14febe4b60f258ad515f7b63fb372
|
4
|
+
data.tar.gz: 073635b1014bb231c543566532b6327b9e2c211a95eb0d8f85502e03530b5107
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cd81e9d640e206637b9cc742294f079627699eb9d93abf243efc9e93141c16db987c5d5ebb7068a5f87cb56f378268ab5606f183646b98e6374f89f5f128e541
|
7
|
+
data.tar.gz: 3505875a5655d03b0657521dae3c657c33db22c0d61db91be7d559de6106d2f24429daa1b1ec9a54292e2d10922ec9d393052e5d5ff7bfcf8bf77d490ac99396
|
data/README.rdoc
CHANGED
@@ -7,9 +7,9 @@ A Ruby implementation of the openEHR specifications
|
|
7
7
|
|
8
8
|
= Requirements
|
9
9
|
|
10
|
-
* Supports
|
11
|
-
* Developed with CRuby 2.
|
12
|
-
* Ruby
|
10
|
+
* Supports CRuby 2.3.6, 2.4.3, 2.5.0 or equivalents.
|
11
|
+
* Developed with CRuby 2.5.0 on FreeBSD and Linux.
|
12
|
+
* Ruby 2.2 or earlier are no longer supported.
|
13
13
|
|
14
14
|
=Description
|
15
15
|
|
@@ -66,7 +66,7 @@ All Rights Reserved.
|
|
66
66
|
|
67
67
|
This product is released under Apache 2.0 license
|
68
68
|
|
69
|
-
Copyright [2012-
|
69
|
+
Copyright [2012-2018] openEHR Ruby implementation project.
|
70
70
|
|
71
71
|
Licensed under the Apache License, Version 2.0 (the "License");
|
72
72
|
you may not use this file except in compliance with the License.
|
data/lib/openehr/am/archetype.rb
CHANGED
@@ -100,6 +100,12 @@ module OpenEHR
|
|
100
100
|
return archetype
|
101
101
|
end
|
102
102
|
|
103
|
+
def to_rm
|
104
|
+
::OpenEHR::RM::Factory.create(definition.rm_type_name,
|
105
|
+
archetype_node_id: definition.archetype_node_id,
|
106
|
+
name: definition
|
107
|
+
)
|
108
|
+
end
|
103
109
|
end # end of Archetype
|
104
110
|
# original file:
|
105
111
|
# ref_imple_eiffel/components/adl_parser/src/interface/adl_definition.e
|
@@ -25,6 +25,10 @@ module OpenEHR
|
|
25
25
|
arch_identification.adl_version
|
26
26
|
end
|
27
27
|
|
28
|
+
def uid
|
29
|
+
arch_identification.uid
|
30
|
+
end
|
31
|
+
|
28
32
|
def concept
|
29
33
|
arch_concept.value
|
30
34
|
end
|
@@ -61,6 +65,10 @@ module OpenEHR
|
|
61
65
|
head.value[:adl_version]
|
62
66
|
end
|
63
67
|
|
68
|
+
def uid
|
69
|
+
head.value[:uid]
|
70
|
+
end
|
71
|
+
|
64
72
|
def is_controlled?
|
65
73
|
head.value[:is_controlled?]
|
66
74
|
end
|
@@ -89,11 +97,10 @@ module OpenEHR
|
|
89
97
|
end
|
90
98
|
|
91
99
|
rule arch_meta_data_items
|
92
|
-
item:arch_meta_data_item
|
100
|
+
item:arch_meta_data_item other_items:(';' white_space arch_meta_data_item)* {
|
93
101
|
def value
|
94
102
|
v = item.value
|
95
|
-
|
96
|
-
v
|
103
|
+
other_items.elements.map {|m| m.arch_meta_data_item.value }.inject(v, :update)
|
97
104
|
end
|
98
105
|
}
|
99
106
|
end
|
@@ -104,9 +111,14 @@ module OpenEHR
|
|
104
111
|
{:adl_version => ver.value}
|
105
112
|
end
|
106
113
|
}
|
114
|
+
/ SYM_UID SYM_EQ uid:V_HIER_OBJECT space {
|
115
|
+
def value
|
116
|
+
{ :uid => uid.value }
|
117
|
+
end
|
118
|
+
}
|
107
119
|
/ SYM_IS_CONTROLED space {
|
108
120
|
def value
|
109
|
-
{:is_controled? => true} #
|
121
|
+
{ :is_controled? => true } # If elements[0]
|
110
122
|
end
|
111
123
|
}
|
112
124
|
end
|
@@ -562,7 +574,7 @@ module OpenEHR
|
|
562
574
|
path = node.path + id.value
|
563
575
|
elsif node.id
|
564
576
|
path = node.path + "[#{node.id}]/" + id.value
|
565
|
-
|
577
|
+
else
|
566
578
|
path = node.path + '/' + id.value
|
567
579
|
end
|
568
580
|
OpenEHR::AM::Archetype::ConstraintModel::CMultipleAttribute.new(
|
@@ -578,7 +590,7 @@ module OpenEHR
|
|
578
590
|
path = node.path + id.value
|
579
591
|
elsif node.id
|
580
592
|
path = node.path + "[#{node.id}]/" + id.value
|
581
|
-
|
593
|
+
else
|
582
594
|
path = node.path + '/' + id.value
|
583
595
|
end
|
584
596
|
OpenEHR::AM::Archetype::ConstraintModel::CSingleAttribute.new(
|
@@ -2880,6 +2892,10 @@ module OpenEHR
|
|
2880
2892
|
[a-zA-Z0-9]
|
2881
2893
|
end
|
2882
2894
|
|
2895
|
+
rule HEXADECIMAL
|
2896
|
+
[a-fA-F0-9]
|
2897
|
+
end
|
2898
|
+
|
2883
2899
|
rule IDCHAR
|
2884
2900
|
[a-zA-Z0-9_]
|
2885
2901
|
end
|
@@ -3144,6 +3160,10 @@ module OpenEHR
|
|
3144
3160
|
[Aa] [Dd] [Ll] '_' [Vv] [Ee] [Rr] [Ss] [Ii] [Oo] [Nn] space
|
3145
3161
|
end
|
3146
3162
|
|
3163
|
+
rule SYM_UID
|
3164
|
+
[Uu] [Ii] [Dd] space
|
3165
|
+
end
|
3166
|
+
|
3147
3167
|
rule SYM_IS_CONTROLLED
|
3148
3168
|
[Cc] [Oo] [Nn] [Tt] [Rr] [Oo] [Ll] [Ll] [Ee] [Dd] space
|
3149
3169
|
end
|
@@ -3208,6 +3228,14 @@ module OpenEHR
|
|
3208
3228
|
}
|
3209
3229
|
end
|
3210
3230
|
|
3231
|
+
rule V_HIER_OBJECT
|
3232
|
+
HEXADECIMAL 8..8 '-' (HEXADECIMAL 4..4 '-') 3..3 HEXADECIMAL 12..12 {
|
3233
|
+
def value
|
3234
|
+
text_value
|
3235
|
+
end
|
3236
|
+
}
|
3237
|
+
end
|
3238
|
+
|
3211
3239
|
rule V_URI
|
3212
3240
|
[a-z]+ '://' [^<>|\\{}^~"\[\] ]* {
|
3213
3241
|
def value
|
@@ -3353,7 +3381,7 @@ module OpenEHR
|
|
3353
3381
|
end
|
3354
3382
|
}
|
3355
3383
|
end
|
3356
|
-
|
3384
|
+
|
3357
3385
|
rule V_CHAR
|
3358
3386
|
[^\\\n\"] {
|
3359
3387
|
def value
|
@@ -25,7 +25,7 @@ module OpenEHR
|
|
25
25
|
|
26
26
|
def parsed_data
|
27
27
|
filestream = File.open(@filename, 'rb:bom|utf-8')
|
28
|
-
@parsed_data ||= adl_grammar_parser.parse(filestream.read)
|
28
|
+
@parsed_data ||= adl_grammar_parser.parse(filestream.read.scrub)
|
29
29
|
filestream.close
|
30
30
|
unless @parsed_data
|
31
31
|
puts adl_grammar_parser.failure_reason
|
@@ -59,6 +59,10 @@ module OpenEHR
|
|
59
59
|
parsed_data.adl_version
|
60
60
|
end
|
61
61
|
|
62
|
+
def uid
|
63
|
+
OpenEHR::RM::Support::Identification::HierObjectID.new(value: parsed_data.uid) if parsed_data.uid
|
64
|
+
end
|
65
|
+
|
62
66
|
def concept
|
63
67
|
parsed_data.concept
|
64
68
|
end
|
@@ -78,6 +82,7 @@ module OpenEHR
|
|
78
82
|
def archetype
|
79
83
|
OpenEHR::AM::Archetype::Archetype.new(:archetype_id => archetype_id,
|
80
84
|
:adl_version => adl_version,
|
85
|
+
:uid => uid,
|
81
86
|
:concept => concept,
|
82
87
|
:original_language => original_language,
|
83
88
|
:translations => translations,
|
@@ -27,6 +27,8 @@ module OpenEHR
|
|
27
27
|
'/template/description/details/misuse'
|
28
28
|
DESC_DETAILS_COPYRIGHT_PATH =
|
29
29
|
'/template/description/details/copyright'
|
30
|
+
DESC_OTHER_DETAILS_PATH =
|
31
|
+
'/template/description/other_details'
|
30
32
|
DEFINITION_PATH = '/template/definition'
|
31
33
|
OCCURRENCE_PATH = '/occurrences'
|
32
34
|
|
@@ -59,7 +61,7 @@ module OpenEHR
|
|
59
61
|
def description
|
60
62
|
original_author = text_on_path(@opt, DESC_ORIGINAL_AUTHOR_PATH)
|
61
63
|
lifecycle_state = text_on_path(@opt, DESC_LIFECYCLE_STATE_PATH)
|
62
|
-
OpenEHR::RM::Common::Resource::ResourceDescription.new(original_author: original_author, lifecycle_state: lifecycle_state, details: [description_details])
|
64
|
+
OpenEHR::RM::Common::Resource::ResourceDescription.new(original_author: original_author, lifecycle_state: lifecycle_state, details: [description_details], other_details: description_other_details)
|
63
65
|
end
|
64
66
|
|
65
67
|
def description_details
|
@@ -73,15 +75,15 @@ module OpenEHR
|
|
73
75
|
OpenEHR::RM::Common::Resource::ResourceDescriptionItem.new(language: language, purpose: purpose, keywords: keywords, use: use, misuse: misuse, copyright: copyright)
|
74
76
|
end
|
75
77
|
|
78
|
+
def description_other_details
|
79
|
+
@opt.xpath(DESC_OTHER_DETAILS_PATH).inject({}) do |hash, detail|
|
80
|
+
hash[detail.attributes['id'].value] = detail.text
|
81
|
+
hash
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
76
85
|
def definition
|
77
|
-
|
78
|
-
root_node = Node.new
|
79
|
-
root_node.id = text_on_path(@opt, DEFINITION_PATH + '/node_id')
|
80
|
-
root_occurrences = occurrences(@opt.xpath(DEFINITION_PATH + OCCURRENCE_PATH))
|
81
|
-
root_archetype_id = OpenEHR::RM::Support::Identification::ArchetypeID.new(value: text_on_path(@opt, DEFINITION_PATH+'/archetype_id/value'))
|
82
|
-
root_node.path = "/[#{root_archetype_id.value}]"
|
83
|
-
component_terminologies(root_archetype_id, @opt.xpath(DEFINITION_PATH))
|
84
|
-
OpenEHR::AM::Archetype::ConstraintModel::CArchetypeRoot.new(rm_type_name: root_rm_type, node_id: root_node.id, path: root_node.path, occurrences: root_occurrences, archetype_id: root_archetype_id, attributes: attributes(@opt.xpath(DEFINITION_PATH+'/attributes'), root_node))
|
86
|
+
c_archetype_root @opt.xpath(DEFINITION_PATH)
|
85
87
|
end
|
86
88
|
|
87
89
|
def component_terminologies(archetype_id, nodes)
|
@@ -111,12 +113,6 @@ module OpenEHR
|
|
111
113
|
{ language.code_string => term_items }
|
112
114
|
end
|
113
115
|
|
114
|
-
def children(children_xml, node)
|
115
|
-
children_xml.map do |child|
|
116
|
-
send child.attributes['type'].text.downcase, child, node
|
117
|
-
end
|
118
|
-
end
|
119
|
-
|
120
116
|
def c_archetype_root(xml, node = Node.new)
|
121
117
|
rm_type_name = text_on_path(xml, './rm_type_name')
|
122
118
|
id = text_on_path(xml, './node_id')
|
@@ -124,9 +120,9 @@ module OpenEHR
|
|
124
120
|
occurrences = occurrences(xml.xpath('./occurrences'))
|
125
121
|
archetype_id = OpenEHR::RM::Support::Identification::ArchetypeID.new(value: text_on_path(xml, './archetype_id/value'))
|
126
122
|
if node.root? or node.id.nil?
|
127
|
-
node.path = "/
|
128
|
-
else
|
129
|
-
|
123
|
+
node.path = "/"
|
124
|
+
# else
|
125
|
+
# node.path += "/" #"/[#{archetype_id.value}]"
|
130
126
|
end
|
131
127
|
component_terminologies(archetype_id, xml)
|
132
128
|
OpenEHR::AM::Archetype::ConstraintModel::CArchetypeRoot.new(rm_type_name: rm_type_name, node_id: node.id, path: node.path, occurrences: occurrences, archetype_id: archetype_id, attributes: attributes(xml.xpath('./attributes'), node))
|
@@ -137,55 +133,51 @@ module OpenEHR
|
|
137
133
|
node_id = xml.xpath('./node_id').text
|
138
134
|
unless node_id.nil? or node_id.empty?
|
139
135
|
node.id = node_id
|
140
|
-
node.path
|
136
|
+
node.path = "#{node.path}[#{node.id}]"
|
141
137
|
end
|
142
138
|
OpenEHR::AM::Archetype::ConstraintModel::CComplexObject.new(rm_type_name: rm_type_name, node_id: node.id, path: node.path, occurrences: occurrences(xml.xpath('./occurrences')), attributes: attributes(xml.xpath('./attributes'), node))
|
143
139
|
end
|
144
140
|
|
145
141
|
def attributes(attributes_xml, node)
|
146
142
|
attributes_xml.map do |attr|
|
147
|
-
|
143
|
+
rm_attribute_name = attr.at('rm_attribute_name').text
|
144
|
+
if node.root?
|
145
|
+
path = "/#{rm_attribute_name}"
|
146
|
+
# elsif node.id
|
147
|
+
# path = "#{node.path}[#{node.id}]/#{rm_attribute_name}"
|
148
|
+
else
|
149
|
+
path = "#{node.path}/#{rm_attribute_name}"
|
150
|
+
end
|
151
|
+
child_node = Node.new(node)
|
152
|
+
child_node.path = path
|
153
|
+
child_node.id = node.id
|
154
|
+
send attr.attributes['type'].text.downcase, attr, child_node
|
155
|
+
end
|
156
|
+
end
|
157
|
+
|
158
|
+
def children(children_xml, node)
|
159
|
+
children_xml.map do |child|
|
160
|
+
send child.attributes['type'].text.downcase, child, node
|
148
161
|
end
|
149
162
|
end
|
150
163
|
|
151
164
|
def c_single_attribute(attr_xml, node)
|
152
165
|
rm_attribute_name = attr_xml.at('rm_attribute_name').text
|
153
166
|
existence = occurrences(attr_xml.at('existence'))
|
154
|
-
|
155
|
-
path = "/#{rm_attribute_name}"
|
156
|
-
elsif node.id
|
157
|
-
path = "#{node.path}[#{node.id}]/#{rm_attribute_name}"
|
158
|
-
else
|
159
|
-
path = "#{node.path}/#{rm_attribute_name}"
|
160
|
-
end
|
161
|
-
child_node = Node.new(node)
|
162
|
-
child_node.path = node.path
|
163
|
-
child_node.id = node.id
|
164
|
-
OpenEHR::AM::Archetype::ConstraintModel::CSingleAttribute.new(rm_attribute_name: rm_attribute_name, existence: existence, path: path, children: children(attr_xml.xpath('./children'), child_node))
|
167
|
+
OpenEHR::AM::Archetype::ConstraintModel::CSingleAttribute.new(rm_attribute_name: rm_attribute_name, existence: existence, path: node.path, children: children(attr_xml.xpath('./children'), node))
|
165
168
|
end
|
166
169
|
|
167
170
|
def c_multiple_attribute(attr_xml, node)
|
168
171
|
rm_attribute_name = attr_xml.at('rm_attribute_name').text
|
169
172
|
existence = occurrences(attr_xml.at('existence'))
|
170
|
-
|
171
|
-
path = "/#{rm_attribute_name}"
|
172
|
-
elsif node.id
|
173
|
-
path = "#{node.path}[#{node.id}]/#{rm_attribute_name}"
|
174
|
-
else
|
175
|
-
path = "#{node.path}/#{rm_attribute_name}"
|
176
|
-
end
|
177
|
-
child_node = Node.new(node)
|
178
|
-
child_node.path = node.path
|
179
|
-
child_node.id = node.id
|
180
|
-
OpenEHR::AM::Archetype::ConstraintModel::CMultipleAttribute.new(rm_attribute_name: rm_attribute_name, existence: existence, path: path, children: children(attr_xml.xpath('./children'), child_node))
|
173
|
+
OpenEHR::AM::Archetype::ConstraintModel::CMultipleAttribute.new(rm_attribute_name: rm_attribute_name, existence: existence, path: node.path, cardinality: cardinality(attr_xml), children: children(attr_xml.xpath('./children'), node))
|
181
174
|
end
|
182
175
|
|
183
176
|
def c_code_phrase(attr_xml, node)
|
184
177
|
terminology_id = OpenEHR::RM::Support::Identification::TerminologyID.new(value: attr_xml.at('terminology_id/value').text.strip)
|
185
|
-
path = node.path
|
186
178
|
code_list = attr_xml.xpath('code_list').text.strip
|
187
179
|
occurrences = occurrences(attr_xml.at('occurrences'))
|
188
|
-
OpenEHR::AM::OpenEHRProfile::DataTypes::Text::CCodePhrase.new(terminology_id: terminology_id, code_list: [code_list], path: path, occurrences: occurrences, rm_type_name: 'CodePhrase')
|
180
|
+
OpenEHR::AM::OpenEHRProfile::DataTypes::Text::CCodePhrase.new(terminology_id: terminology_id, code_list: [code_list], path: node.path, occurrences: occurrences, rm_type_name: 'CodePhrase')
|
189
181
|
end
|
190
182
|
|
191
183
|
def archetype_slot(attr_xml,node)
|
@@ -210,6 +202,13 @@ module OpenEHR
|
|
210
202
|
OpenEHR::AssumedLibraryTypes::Interval.new(lower: lower, upper: upper, lower_included: lower_included, upper_included: upper_included)
|
211
203
|
end
|
212
204
|
|
205
|
+
def cardinality(xml)
|
206
|
+
order = to_bool(xml.at('is_ordered').text)
|
207
|
+
unique = to_bool(xml.at('is_unique').text)
|
208
|
+
interval = occurrences(xml)
|
209
|
+
OpenEHR::AM::Archetype::ConstraintModel::Cardinality.new(is_ordered: order, is_unique: unique, interval: interval)
|
210
|
+
end
|
211
|
+
|
213
212
|
def constraint_ref(attr_xml, node)
|
214
213
|
rm_type_name = attr_xml.at('rm_type_name').text
|
215
214
|
reference = attr_xml.at('reference').text
|
@@ -248,12 +247,19 @@ module OpenEHR
|
|
248
247
|
def c_primitive_object(attr_xml, node)
|
249
248
|
rm_type_name = attr_xml.at('rm_type_name').text
|
250
249
|
occurrences = occurrences(attr_xml.at('occurrences'))
|
251
|
-
|
250
|
+
item = send attr_xml.at('item')['type'].downcase, attr_xml.at('item')
|
251
|
+
OpenEHR::AM::Archetype::ConstraintModel::CPrimitiveObject.new(rm_type_name: rm_type_name, occurrences: occurrences, node_id: node.id, item: item)
|
252
252
|
end
|
253
|
-
|
253
|
+
|
254
254
|
def c_string(attr_xml)
|
255
|
-
|
256
|
-
|
255
|
+
if attr_xml.at('pattern')
|
256
|
+
OpenEHR::AM::Archetype::ConstraintModel::Primitive::CString.new(pattern: attr_xml.at('pattern').text)
|
257
|
+
else
|
258
|
+
list = attr_xml.xpath('.//list').map do |str|
|
259
|
+
str.text
|
260
|
+
end
|
261
|
+
OpenEHR::AM::Archetype::ConstraintModel::Primitive::CString.new(list: list)
|
262
|
+
end
|
257
263
|
end
|
258
264
|
|
259
265
|
def c_dv_quantity(attr_xml, node)
|
@@ -271,6 +277,21 @@ module OpenEHR
|
|
271
277
|
OpenEHR::AM::OpenEHRProfile::DataTypes::Quantity::CDvQuantity.new(rm_type_name: rm_type_name, occurrences: occurrences, list: list, property: property)
|
272
278
|
end
|
273
279
|
|
280
|
+
def c_date(xml)
|
281
|
+
|
282
|
+
end
|
283
|
+
|
284
|
+
def c_date_time(xml)
|
285
|
+
|
286
|
+
end
|
287
|
+
|
288
|
+
def c_integer(xml)
|
289
|
+
|
290
|
+
end
|
291
|
+
|
292
|
+
def c_boolean(xml)
|
293
|
+
end
|
294
|
+
|
274
295
|
def string(attr_xml)
|
275
296
|
attr_xml.text
|
276
297
|
end
|
@@ -288,9 +309,9 @@ module OpenEHR
|
|
288
309
|
end
|
289
310
|
|
290
311
|
def to_bool(str)
|
291
|
-
if
|
312
|
+
if /true/i =~ str
|
292
313
|
return true
|
293
|
-
elsif
|
314
|
+
elsif /false/i =~ str
|
294
315
|
return false
|
295
316
|
end
|
296
317
|
return nil
|
data/lib/openehr/rm.rb
CHANGED
@@ -31,9 +31,13 @@ module OpenEHR
|
|
31
31
|
|
32
32
|
def value=(value)
|
33
33
|
raise ArgumentError, "value must not be nil" if value.nil?
|
34
|
-
if value == true
|
34
|
+
if value == true
|
35
35
|
@value = true
|
36
|
-
|
36
|
+
elsif value == false
|
37
|
+
@value = false
|
38
|
+
elsif /TRUE/i =~ value
|
39
|
+
@value = true
|
40
|
+
elsif /FALSE/i =~ value
|
37
41
|
@value = false
|
38
42
|
end
|
39
43
|
end
|
data/lib/openehr/rm/factory.rb
CHANGED
@@ -3,9 +3,40 @@ require 'active_support/inflector'
|
|
3
3
|
module OpenEHR
|
4
4
|
module RM
|
5
5
|
class Factory
|
6
|
-
def
|
7
|
-
|
8
|
-
|
6
|
+
def initialize(cobject)
|
7
|
+
@cobject = cobject
|
8
|
+
end
|
9
|
+
|
10
|
+
class << self
|
11
|
+
def create(type, *param)
|
12
|
+
type = type.downcase.camelize if type.include? '_'
|
13
|
+
class_eval("#{type}Factory").create(*param)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
def build
|
18
|
+
Factory.create(type, params)
|
19
|
+
end
|
20
|
+
|
21
|
+
private
|
22
|
+
def type
|
23
|
+
@cobject.rm_type_name
|
24
|
+
end
|
25
|
+
|
26
|
+
def name
|
27
|
+
OpenEHR::RM::DataTypes::Text::DvText.new(value: ' ')
|
28
|
+
end
|
29
|
+
|
30
|
+
def params
|
31
|
+
@cobject.attributes.inject({}) do |hash, attribute|
|
32
|
+
if attribute.children
|
33
|
+
hash[attribute.rm_attribute_name.to_sym] =
|
34
|
+
attribute.children.map { |child| Factory.new(child).build }
|
35
|
+
end
|
36
|
+
hash
|
37
|
+
end.merge(
|
38
|
+
{ archetype_node_id: @cobject.node_id,
|
39
|
+
occurrences: @cobject.occurrences })
|
9
40
|
end
|
10
41
|
end
|
11
42
|
|
@@ -182,5 +213,17 @@ module OpenEHR
|
|
182
213
|
Composition::Content::Entry::Observation.new(*param)
|
183
214
|
end
|
184
215
|
end
|
216
|
+
|
217
|
+
class SECTIONFactory
|
218
|
+
def self.create(*param)
|
219
|
+
Composition::Content::Navigation::Section.new(*param)
|
220
|
+
end
|
221
|
+
end
|
222
|
+
|
223
|
+
class CLUSTERFactory
|
224
|
+
def self.create(*param)
|
225
|
+
DataStructures::ItemStructure::Representation::Cluster.new(*param)
|
226
|
+
end
|
227
|
+
end
|
185
228
|
end
|
186
229
|
end
|
data/lib/openehr/serializer.rb
CHANGED
@@ -14,6 +14,10 @@ module OpenEHR
|
|
14
14
|
def serialize
|
15
15
|
return self.merge
|
16
16
|
end
|
17
|
+
|
18
|
+
private
|
19
|
+
def merge
|
20
|
+
end
|
17
21
|
end
|
18
22
|
|
19
23
|
class ADLSerializer < BaseSerializer
|
@@ -249,6 +253,22 @@ module OpenEHR
|
|
249
253
|
return archetype
|
250
254
|
end
|
251
255
|
end
|
256
|
+
|
257
|
+
class OPTSerializer < BaseSerializer
|
258
|
+
def initialize(opt, format:)
|
259
|
+
@opt = OpenEHR::Parser::OPTParser.new(opt).parse
|
260
|
+
end
|
261
|
+
|
262
|
+
def name
|
263
|
+
@opt.definition.archetype_id.concept_name
|
264
|
+
end
|
265
|
+
|
266
|
+
def header
|
267
|
+
|
268
|
+
end
|
269
|
+
|
270
|
+
|
271
|
+
end
|
252
272
|
end
|
253
273
|
end
|
254
274
|
|
data/lib/openehr/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: openehr
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.999999
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Shinji KOBAYASHI
|
@@ -12,7 +12,7 @@ authors:
|
|
12
12
|
autorequire:
|
13
13
|
bindir: bin
|
14
14
|
cert_chain: []
|
15
|
-
date:
|
15
|
+
date: 2020-09-27 00:00:00.000000000 Z
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
18
|
name: rake
|
@@ -211,7 +211,7 @@ dependencies:
|
|
211
211
|
- !ruby/object:Gem::Version
|
212
212
|
version: '0'
|
213
213
|
- !ruby/object:Gem::Dependency
|
214
|
-
name:
|
214
|
+
name: simplecov
|
215
215
|
requirement: !ruby/object:Gem::Requirement
|
216
216
|
requirements:
|
217
217
|
- - ">="
|
@@ -225,7 +225,7 @@ dependencies:
|
|
225
225
|
- !ruby/object:Gem::Version
|
226
226
|
version: '0'
|
227
227
|
- !ruby/object:Gem::Dependency
|
228
|
-
name:
|
228
|
+
name: libnotify
|
229
229
|
requirement: !ruby/object:Gem::Requirement
|
230
230
|
requirements:
|
231
231
|
- - ">="
|
@@ -239,7 +239,35 @@ dependencies:
|
|
239
239
|
- !ruby/object:Gem::Version
|
240
240
|
version: '0'
|
241
241
|
- !ruby/object:Gem::Dependency
|
242
|
-
name:
|
242
|
+
name: rubocop
|
243
|
+
requirement: !ruby/object:Gem::Requirement
|
244
|
+
requirements:
|
245
|
+
- - ">="
|
246
|
+
- !ruby/object:Gem::Version
|
247
|
+
version: '0'
|
248
|
+
type: :development
|
249
|
+
prerelease: false
|
250
|
+
version_requirements: !ruby/object:Gem::Requirement
|
251
|
+
requirements:
|
252
|
+
- - ">="
|
253
|
+
- !ruby/object:Gem::Version
|
254
|
+
version: '0'
|
255
|
+
- !ruby/object:Gem::Dependency
|
256
|
+
name: meowcop
|
257
|
+
requirement: !ruby/object:Gem::Requirement
|
258
|
+
requirements:
|
259
|
+
- - ">="
|
260
|
+
- !ruby/object:Gem::Version
|
261
|
+
version: '0'
|
262
|
+
type: :development
|
263
|
+
prerelease: false
|
264
|
+
version_requirements: !ruby/object:Gem::Requirement
|
265
|
+
requirements:
|
266
|
+
- - ">="
|
267
|
+
- !ruby/object:Gem::Version
|
268
|
+
version: '0'
|
269
|
+
- !ruby/object:Gem::Dependency
|
270
|
+
name: better_errors
|
243
271
|
requirement: !ruby/object:Gem::Requirement
|
244
272
|
requirements:
|
245
273
|
- - ">="
|
@@ -334,8 +362,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
334
362
|
- !ruby/object:Gem::Version
|
335
363
|
version: '0'
|
336
364
|
requirements: []
|
337
|
-
|
338
|
-
rubygems_version: 2.4.8
|
365
|
+
rubygems_version: 3.1.2
|
339
366
|
signing_key:
|
340
367
|
specification_version: 4
|
341
368
|
summary: Ruby implementation of the openEHR specification
|