Class: OpenEHR::Serializer::XMLSerializer
Instance Method Summary
collapse
#initialize, #serialize
Instance Method Details
#definition ⇒ Object
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
|
# File 'lib/open_ehr/serializer.rb', line 198
def definition
definition = ''
ad = @archetype.definition
xml = Builder::XmlMarkup.new(:indent => 2, :target => definition)
xml.definition do
xml.rm_type_name ad.rm_type_name
xml.occurrence do
oc = ad.occurrences
xml.lower_included oc.lower_included? unless oc.lower_included?.nil?
xml.upper_included oc.upper_included? unless oc.upper_included?.nil?
xml.lower_unbounded oc.lower_unbounded?
xml.upper_unbounded oc.upper_unbounded?
xml.lower oc.lower
xml.upper oc.lower
end
xml.node_id ad.node_id
end
return definition
end
|
#description ⇒ Object
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
|
# File 'lib/open_ehr/serializer.rb', line 154
def description
desc = ''
xml = Builder::XmlMarkup.new(:indent => 2, :target => desc)
ad = @archetype.description
if ad
xml.description do
ad.original_author.each do |key,value|
xml.original_author(value,"id"=>key)
end
if ad.other_contributors
ad.other_contributors.each do |co|
xml.other_contributors co
end
end
xml.lifecycle_state ad.lifecycle_state
xml.details do
ad.details.each do |lang, item|
xml.language do
xml.terminology_id do
xml.value item.language.terminology_id.value
end
xml.code_string lang
end
xml.purpose item.purpose
if item.keywords then
item.keywords.each do |word|
xml.keywords word
end
end
xml.use item.use if item.use
xml.misuse item.misuse if item.misuse
xml.copyright item.copyright if item.copyright
if ad.other_details
ad.other_details.each do |key,value|
xml.other_details(value, "id"=>key)
end
end
end
end
end
end
return desc
end
|
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
|
# File 'lib/open_ehr/serializer.rb', line 138
def
= ''
xml = Builder::XmlMarkup.new(:indent => 2, :target => )
xml.archetype_id do
xml.value @archetype.archetype_id.value
end
xml.concept @archetype.concept
xml.original_language do
xml.terminology_id do
xml.value @archetype.original_language.terminology_id.value
end
xml.code_string @archetype.original_language.code_string
end
return
end
|
#merge ⇒ Object
245
246
247
248
249
250
251
|
# File 'lib/open_ehr/serializer.rb', line 245
def merge
archetype = "<?xml version='1.0' encoding='UTF-8'?>" + NL +
"<archetype xmlns=\"http://schemas.openehr.org/v1\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">" + NL +
+ description + definition +
ontology + '</archetype>'
return archetype
end
|
#ontology ⇒ Object
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
|
# File 'lib/open_ehr/serializer.rb', line 218
def ontology
ontology = ''
ao = @archetype.ontology
xml = Builder::XmlMarkup.new(:indent => 2, :target => ontology)
xml.ontology do
xml.specialisation_depth ao.specialisation_depth
xml.term_definitions do
ao.term_definitions.each do |lang, terms|
xml.language lang
xml.terms do
terms.each do |term|
xml.code term.code
xml.items do
term.items.each do |key, value|
xml.item do
xml.key key
xml.value value
end
end
end
end
end
end
end
end
end
|