openehr-rails 0.0.2 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.rdoc +13 -0
- data/Rakefile +1 -16
- data/lib/generators/openehr/assets/assets_generator.rb +28 -0
- data/lib/generators/openehr/assets/templates/javascript.js +1 -0
- data/lib/generators/openehr/assets/templates/stylesheet.css.scss +3 -0
- data/lib/generators/openehr/controller/controller_generator.rb +10 -9
- data/lib/generators/openehr/controller/templates/controller.rb +71 -10
- data/lib/generators/openehr/helper/helper_generator.rb +17 -0
- data/lib/generators/openehr/helper/templates/helper.rb +2 -0
- data/lib/generators/openehr/i18n/i18n_generator.rb +29 -33
- data/lib/generators/openehr/i18n/templates/i18n.rb +3 -3
- data/lib/generators/openehr/i18n/templates/language.yml +8 -3
- data/lib/generators/openehr/install/install_generator.rb +6 -9
- data/lib/generators/openehr/migration/migration_generator.rb +24 -9
- data/lib/generators/openehr/migration/templates/archetypes.rb +10 -0
- data/lib/generators/openehr/migration/templates/rms.rb +16 -0
- data/lib/generators/openehr/model/model_generator.rb +108 -7
- data/lib/generators/openehr/model/templates/activemodel.rb +71 -0
- data/lib/generators/openehr/model/templates/archetype.rb +3 -0
- data/lib/generators/openehr/model/templates/rm.rb +3 -0
- data/lib/generators/openehr/scaffold/scaffold_generator.rb +182 -109
- data/lib/generators/openehr/scaffold/templates/_form.html.erb +1 -1
- data/lib/generators/openehr/scaffold/templates/application.html.erb +14 -0
- data/lib/generators/openehr/scaffold/templates/application_controller.rb +1 -0
- data/lib/generators/openehr/scaffold/templates/edit.html.erb +3 -3
- data/lib/generators/openehr/scaffold/templates/index.html.erb +4 -4
- data/lib/generators/openehr/scaffold/templates/inflections.rb +3 -0
- data/lib/generators/openehr/scaffold/templates/layout.css.scss +4 -0
- data/lib/generators/openehr/scaffold/templates/new.html.erb +5 -0
- data/lib/generators/openehr/scaffold/templates/show.html.erb +2 -2
- data/lib/generators/openehr.rb +67 -49
- data/lib/openehr-rails/version.rb +1 -1
- data/lib/openehr-rails.rb +1 -1
- data/openehr-rails.gemspec +1 -5
- data/spec/generator_helper.rb +3 -0
- data/spec/generators/openehr/archetyped_base_spec.rb +53 -35
- data/spec/generators/openehr/assets/assets_generator_spec.rb +37 -0
- data/spec/generators/openehr/controller/controller_generator_spec.rb +20 -4
- data/spec/generators/openehr/helper/helper_generator_spec.rb +23 -0
- data/spec/generators/openehr/i18n/i18n_generator_spec.rb +49 -50
- data/spec/generators/openehr/install/install_generator_spec.rb +3 -3
- data/spec/generators/openehr/migration/migration_generator_spec.rb +18 -7
- data/spec/generators/openehr/model/model_generator_spec.rb +54 -0
- data/spec/generators/openehr/scaffold/scaffold_generator_spec.rb +121 -48
- data/spec/spec_helper.rb +6 -6
- metadata +26 -68
- data/Guardfile +0 -15
- data/db/seeds.rb +0 -7
- data/lib/assets/.gitkeep +0 -0
@@ -2,148 +2,221 @@ require 'openehr/rm'
|
|
2
2
|
require 'openehr/am'
|
3
3
|
require 'openehr/parser'
|
4
4
|
require 'generators/openehr'
|
5
|
+
require 'generators/openehr/assets/assets_generator'
|
6
|
+
require 'generators/openehr/model/model_generator'
|
7
|
+
require 'generators/openehr/migration/migration_generator'
|
8
|
+
require 'generators/openehr/controller/controller_generator'
|
9
|
+
require 'generators/openehr/helper/helper_generator'
|
10
|
+
require 'generators/openehr/i18n/i18n_generator'
|
11
|
+
require 'rails/generators'
|
12
|
+
|
13
|
+
module Openehr
|
14
|
+
module Generators
|
15
|
+
class ScaffoldGenerator < ArchetypedBase
|
16
|
+
source_root File.expand_path("../templates", __FILE__)
|
17
|
+
|
18
|
+
def create_root_folder
|
19
|
+
empty_directory File.join("app/views", controller_file_path)
|
20
|
+
end
|
21
|
+
|
22
|
+
def generate_index
|
23
|
+
generate_view "index.html.erb"
|
24
|
+
end
|
5
25
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
class ScaffoldGenerator < ArchetypedBase
|
10
|
-
source_root File.expand_path("../templates", __FILE__)
|
26
|
+
def generate_show
|
27
|
+
generate_view "show.html.erb"
|
28
|
+
end
|
11
29
|
|
12
|
-
|
13
|
-
|
14
|
-
|
30
|
+
def generate_edit
|
31
|
+
generate_view "edit.html.erb"
|
32
|
+
end
|
15
33
|
|
16
|
-
|
17
|
-
|
18
|
-
|
34
|
+
def generate_new
|
35
|
+
generate_view 'new.html.erb'
|
36
|
+
end
|
37
|
+
def generate_form
|
38
|
+
generate_view "_form.html.erb"
|
39
|
+
end
|
19
40
|
|
20
|
-
|
21
|
-
|
41
|
+
invoke Openehr::Generators::MigrationGenerator
|
42
|
+
invoke Openehr::Generators::ModelGenerator, @archetype
|
43
|
+
invoke Openehr::Generators::ControllerGenerator, @archetype
|
44
|
+
invoke Openehr::Generators::HelperGenerator, @archetype
|
45
|
+
invoke Openehr::Generators::AssetsGenerator, @archetype
|
46
|
+
invoke Openehr::Generators::I18nGenerator, @archetype
|
47
|
+
|
48
|
+
def append_locale_route
|
49
|
+
unless File.exist? 'config/routes.rb'
|
50
|
+
template 'routes.rb', File.join("config", 'routes.rb')
|
22
51
|
end
|
52
|
+
inject_into_file 'config/routes.rb',
|
53
|
+
" resources :#{controller_file_path}\n",
|
54
|
+
:after => "Application.routes.draw do\n"
|
55
|
+
end
|
23
56
|
|
24
|
-
|
25
|
-
|
57
|
+
def insert_locale_swither
|
58
|
+
unless File.exist? 'app/views/layouts/application.html.erb'
|
59
|
+
template 'application.html.erb', File.join('app/views/layouts', 'application.html.erb')
|
26
60
|
end
|
61
|
+
inject_into_file 'app/views/layouts/application.html.erb', <<SWITCHER, :after => "<body>\n"
|
62
|
+
<div id="banner">
|
63
|
+
<%= form_tag '', :method => 'get', class: 'locale' do %>
|
64
|
+
<%= select_tag 'locale',
|
65
|
+
options_for_select(LANGUAGES, I18n.locale.to_s),
|
66
|
+
onchange: 'this.form.submit()' %>
|
67
|
+
<% end %>
|
68
|
+
</div>
|
69
|
+
SWITCHER
|
70
|
+
end
|
71
|
+
|
72
|
+
def generate_layout_stylesheet
|
73
|
+
template 'layout.css.scss', File.join('app/assets/stylesheets', 'layout.css.scss')
|
74
|
+
end
|
27
75
|
|
28
|
-
|
29
|
-
|
76
|
+
def insert_uncountable_inflection
|
77
|
+
inflections_file_path = 'config/initializers/inflections.rb'
|
78
|
+
unless File.exist? inflections_file_path
|
79
|
+
empty_directory File.join('config/initializers')
|
80
|
+
template 'inflections.rb', File.join('config/initializers', 'inflections.rb')
|
81
|
+
else
|
82
|
+
append_to_file inflections_file_path, <<INFLECTION
|
83
|
+
ActiveSupport::Inflector.inflections(:en) do |inflect|
|
84
|
+
inflect.uncountable %w( )
|
85
|
+
end
|
86
|
+
INFLECTION
|
30
87
|
end
|
88
|
+
insert_into_file inflections_file_path, model_name, :after => "inflect.uncountable %w( "
|
89
|
+
end
|
31
90
|
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
end
|
36
|
-
inject_into_file 'config/routes.rb', <<LOCALE, :after => "Application.routes.draw do\n"
|
37
|
-
scope "/:locale" do
|
38
|
-
resources :#{controller_file_path}
|
39
|
-
end
|
40
|
-
LOCALE
|
91
|
+
def append_set_locale
|
92
|
+
unless File.exist? 'app/controllers/application_controller.rb'
|
93
|
+
template 'application_controller.rb', File.join("app/controllers", 'application_controller.rb')
|
41
94
|
end
|
42
|
-
|
43
|
-
unless File.exist? 'app/controllers/application_controller.rb'
|
44
|
-
template 'application_controller.rb', File.join("app/controllers", 'application_controller.rb')
|
45
|
-
end
|
46
|
-
inject_into_file 'app/controllers/application_controller.rb', <<LOCALE, :after => "class ApplicationController < ActionController::Base\n"
|
95
|
+
inject_into_file 'app/controllers/application_controller.rb', <<LOCALE, :after => "class ApplicationController < ActionController::Base\n"
|
47
96
|
before_action :set_locale
|
48
97
|
|
49
98
|
def set_locale
|
50
|
-
I18n.locale = params[:locale] || I18n.default_locale
|
99
|
+
I18n.locale = params[:locale] || session[:locale] || I18n.default_locale
|
100
|
+
session[:locale] = I18n.locale
|
51
101
|
end
|
52
102
|
LOCALE
|
53
|
-
|
103
|
+
end
|
54
104
|
|
55
|
-
|
105
|
+
protected
|
56
106
|
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
def show_format(cobj)
|
62
|
-
h = case cobj.rm_type_name
|
63
|
-
when 'ELEMENT'
|
64
|
-
show_element cobj
|
65
|
-
when 'INTERVAL_EVENT'
|
66
|
-
show_element cobj
|
67
|
-
when 'OBSERVATION'
|
68
|
-
show_component cobj
|
69
|
-
when 'ACTION'
|
70
|
-
show_component cobj
|
71
|
-
else
|
72
|
-
show_component cobj
|
73
|
-
end
|
74
|
-
h
|
75
|
-
end
|
107
|
+
def generate_view(filename)
|
108
|
+
template filename, File.join("app/views", controller_file_path, filename)
|
109
|
+
end
|
76
110
|
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
111
|
+
def show_format(cobj)
|
112
|
+
h = case cobj.rm_type_name
|
113
|
+
when 'ELEMENT'
|
114
|
+
show_element cobj
|
115
|
+
when 'EVENT'
|
116
|
+
show_component cobj
|
117
|
+
when 'INTERVAL_EVENT'
|
118
|
+
show_component cobj
|
119
|
+
when 'OBSERVATION'
|
120
|
+
show_component cobj
|
121
|
+
when 'ACTION'
|
122
|
+
show_component cobj
|
123
|
+
else
|
124
|
+
show_component cobj
|
86
125
|
end
|
126
|
+
h
|
127
|
+
end
|
128
|
+
|
129
|
+
def show_component(cobj)
|
130
|
+
html = ''# "<strong>#{cobj.rm_type_name.humanize} t(\".#{cobj.node_id}\")</strong>:<br/>\n"
|
131
|
+
unless cobj.respond_to? :attributes
|
132
|
+
html += "#{cobj.rm_type_name}\n"
|
133
|
+
else
|
134
|
+
html += cobj.attributes.inject("") do |form, attr|
|
135
|
+
form += "<p><strong>#{attr.rm_attribute_name.humanize}:</strong>"
|
136
|
+
form += attr.children.inject("") {|h,c| h += show_format c; h}
|
137
|
+
form += "</p>\n"
|
87
138
|
end
|
88
|
-
return html
|
89
139
|
end
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
140
|
+
html
|
141
|
+
end
|
142
|
+
|
143
|
+
def show_element(cobj)
|
144
|
+
html = "<strong><%= t('.#{cobj.node_id}') %></strong>: "
|
145
|
+
value = cobj.attributes[0].children[0]
|
146
|
+
case value.rm_type_name
|
147
|
+
when 'DV_CODED_TEXT', 'DvCodedText'
|
148
|
+
html += "<%= @#{model_name}.#{cobj.node_id} %><br/>\n"
|
149
|
+
when 'DvQuantity', 'DV_QUANTITY'
|
150
|
+
html += "<%= @#{model_name}.#{cobj.node_id} %>#{value.list[0].units}<br/>\n"
|
151
|
+
else
|
152
|
+
html += "<%= @#{model_name}.#{cobj.node_id} %><br/>\n"
|
95
153
|
end
|
154
|
+
html
|
155
|
+
end
|
96
156
|
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
157
|
+
def form_format(cobj)
|
158
|
+
html = case cobj.rm_type_name
|
159
|
+
when 'ELEMENT'
|
160
|
+
form_element cobj
|
161
|
+
when 'EVENT'
|
162
|
+
"<strong><%= t('.#{cobj.node_id}') %></strong>: <%= f.text_field :#{cobj.node_id} %><br/>\n" +
|
163
|
+
form_component(cobj)
|
164
|
+
when 'INTERVAL_EVENT'
|
165
|
+
"<strong><%= t('.#{cobj.node_id}') %></strong>: <%= f.text_field :#{cobj.node_id} %><br/>\n"
|
166
|
+
else
|
167
|
+
form_component cobj
|
168
|
+
end
|
169
|
+
return html
|
170
|
+
end
|
108
171
|
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
end
|
172
|
+
def form_component(cobj)
|
173
|
+
html = '' #"<strong>#{cobj.rm_type_name.humanize} <%= t('.#{cobj.node_id}') %></strong>:<br/>\n"
|
174
|
+
unless cobj.respond_to? :attributes
|
175
|
+
html += "#{cobj.rm_type_name}<br/>\n"
|
176
|
+
else
|
177
|
+
html += cobj.attributes.inject("") do |form, attr|
|
178
|
+
form += "<p><strong><%= t('.#{cobj.node_id}') %></strong>:"
|
179
|
+
form += attr.children.inject('') {|h,c| h += form_format c}
|
180
|
+
form += "</p>\n"
|
119
181
|
end
|
120
|
-
html
|
121
182
|
end
|
183
|
+
html
|
184
|
+
end
|
122
185
|
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
186
|
+
def form_element(cobj)
|
187
|
+
html = ''
|
188
|
+
if cobj.respond_to? :attributes
|
189
|
+
cobj.attributes.each do |attr|
|
190
|
+
unless attr.nil?
|
191
|
+
html = "<strong><%= t('.#{cobj.node_id}') %></strong>: "
|
192
|
+
html += form_field attr.children[0], cobj.node_id
|
193
|
+
end
|
129
194
|
end
|
130
|
-
html
|
131
195
|
end
|
196
|
+
html
|
197
|
+
end
|
198
|
+
|
199
|
+
def form_field(cobj, label)
|
200
|
+
form = case cobj.rm_type_name
|
201
|
+
when 'DV_TEXT', 'DvText'
|
202
|
+
"<%= f.text_field :#{label} %><br/>\n"
|
203
|
+
when 'DV_CODED_TEXT', 'DvCodedText'
|
204
|
+
"<%= f.select :#{label}, #{code_list_to_hash(cobj.attributes[0].children[0].code_list)} %><br/>\n"
|
205
|
+
when 'DV_QUANTITY', 'DvQuantity'
|
206
|
+
"<%= f.number_field :#{label} %> #{cobj.list[0].units}<br/>\n"
|
207
|
+
else
|
208
|
+
"<%= f.text_field :#{label} %><br/>\n"
|
209
|
+
end
|
210
|
+
form
|
211
|
+
end
|
132
212
|
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
"<%= f.text_field :#{label} %>\n"
|
137
|
-
when 'DV_CODED_TEXT'
|
138
|
-
"<%= f.select :#{label}, #{cobj.attributes[0].children[0].code_list.to_s}\n"
|
139
|
-
when 'DV_QUANTITY'
|
140
|
-
"<%= f.text_field :#{label} %>\n"
|
141
|
-
else
|
142
|
-
"<%= f.text_field :#{label} %>\n"
|
143
|
-
end
|
144
|
-
form
|
213
|
+
def code_list_to_hash(code_list)
|
214
|
+
html = code_list.inject('') do |form, item|
|
215
|
+
form += "t('.#{item}') => '#{item}', "
|
145
216
|
end
|
217
|
+
html[0..-3] unless html.nil?
|
146
218
|
end
|
147
219
|
end
|
148
220
|
end
|
149
221
|
end
|
222
|
+
|
@@ -1,7 +1,7 @@
|
|
1
1
|
<%%= form_for(@<%= model_name %>) do |f| %>
|
2
2
|
<%% if @<%= model_name %>.errors.any? %>
|
3
3
|
<div id="error_explanation">
|
4
|
-
<h2
|
4
|
+
<h2> <%%= pluralize(@<%= model_name %>.errors.count, "error") %> prohibited this <%= model_name %> from being saved:</h2>
|
5
5
|
|
6
6
|
<ul>
|
7
7
|
<%% @<%= model_name %>.errors.full_messages.each do |msg| %>
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title><%= concept %></title>
|
5
|
+
<%%= stylesheet_link_tag "application", media: "all", "data-turbolinks-track" => true %>
|
6
|
+
<%%= javascript_include_tag "application", "data-turbolinks-track" => true %>
|
7
|
+
<%%= csrf_meta_tags %>
|
8
|
+
</head>
|
9
|
+
<body>
|
10
|
+
|
11
|
+
<%%= yield %>
|
12
|
+
|
13
|
+
</body>
|
14
|
+
</html>
|
@@ -1,6 +1,6 @@
|
|
1
|
-
<h1>Editing <%%= t(
|
1
|
+
<h1>Editing <%%= t('.<%= concept %>') %></h1>
|
2
2
|
|
3
3
|
<%%= render 'form' %>
|
4
4
|
|
5
|
-
<%%= link_to 'Show', @<%= model_name
|
6
|
-
<%%= link_to 'Back', <%=
|
5
|
+
<%%= link_to 'Show', <%= controller_name %>_path(id: @<%= model_name %>.id) %> |
|
6
|
+
<%%= link_to 'Back', <%= controller_name %>_index_path %>
|
@@ -14,9 +14,9 @@
|
|
14
14
|
<% index_data.each do |atcode| -%>
|
15
15
|
<td><%%= <%= model_name %>.<%= atcode %> %></td>
|
16
16
|
<% end -%>
|
17
|
-
<td><%%= link_to 'Show', <%=
|
18
|
-
<td><%%= link_to 'Edit', edit_<%=
|
19
|
-
<td><%%= link_to 'Destroy', <%= model_name
|
17
|
+
<td><%%= link_to 'Show', <%= controller_name %>_path(id: <%= model_name %>.id) %></td>
|
18
|
+
<td><%%= link_to 'Edit', edit_<%= controller_name %>_path(id: <%= model_name %>.id) %></td>
|
19
|
+
<td><%%= link_to 'Destroy', <%= controller_name %>_path(id: <%= model_name %>.id), method: :delete, data: { confirm: 'Are you sure?' } %></td>
|
20
20
|
</tr>
|
21
21
|
<%% end %>
|
22
22
|
|
@@ -25,4 +25,4 @@
|
|
25
25
|
|
26
26
|
<br>
|
27
27
|
|
28
|
-
<%%= link_to
|
28
|
+
<%%= link_to "New <%= archetype.archetype_id.concept_name %>", new_<%= controller_file_path %>_path %>
|
@@ -2,5 +2,5 @@
|
|
2
2
|
|
3
3
|
<%= show_format(archetype.definition) %>
|
4
4
|
|
5
|
-
<%%= link_to 'Edit', edit_<%=
|
6
|
-
<%%= link_to 'Back', <%=
|
5
|
+
<%%= link_to 'Edit', edit_<%= controller_name %>_path(id: @<%= model_name %>.id) %> |
|
6
|
+
<%%= link_to 'Back', <%= controller_name %>_index_path %>
|
data/lib/generators/openehr.rb
CHANGED
@@ -1,70 +1,88 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
argument :archetype_name
|
1
|
+
require 'openehr/am'
|
2
|
+
require 'openehr/rm'
|
3
|
+
require 'openehr/parser'
|
4
|
+
require 'openehr/ckm_client'
|
6
5
|
|
7
|
-
|
8
|
-
|
9
|
-
|
6
|
+
module Openehr
|
7
|
+
module Generators
|
8
|
+
class ArchetypedBase < ::Rails::Generators::Base
|
9
|
+
def initialize(args, *options)
|
10
|
+
if args[0].class == OpenEHR::AM::Archetype::Archetype
|
11
|
+
@archetype = args[0]
|
12
|
+
else
|
13
|
+
@adl_file = args[0]
|
10
14
|
end
|
15
|
+
super
|
16
|
+
end
|
11
17
|
|
12
|
-
|
13
|
-
|
14
|
-
|
18
|
+
protected
|
19
|
+
def archetype
|
20
|
+
@archetype ||= OpenEHR::Parser::ADLParser.new(@adl_file).parse
|
21
|
+
end
|
22
|
+
|
23
|
+
def archetype_path
|
24
|
+
'app/archetypes'
|
25
|
+
end
|
15
26
|
|
16
|
-
|
17
|
-
|
18
|
-
|
27
|
+
def archetype_file
|
28
|
+
@adl_file
|
29
|
+
end
|
19
30
|
|
20
|
-
|
21
|
-
|
22
|
-
|
31
|
+
def archetype_name
|
32
|
+
archetype.archetype_id.value
|
33
|
+
end
|
23
34
|
|
24
|
-
|
25
|
-
|
26
|
-
|
35
|
+
def controller_name
|
36
|
+
archetype_name.underscore.tr '.', '_'
|
37
|
+
end
|
27
38
|
|
28
|
-
|
29
|
-
|
30
|
-
|
39
|
+
def controller_file_path
|
40
|
+
controller_name
|
41
|
+
end
|
31
42
|
|
32
|
-
|
33
|
-
|
34
|
-
|
43
|
+
def model_name
|
44
|
+
controller_name
|
45
|
+
end
|
35
46
|
|
36
|
-
|
37
|
-
|
38
|
-
|
47
|
+
def concept
|
48
|
+
archetype.concept
|
49
|
+
end
|
39
50
|
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
51
|
+
def model_class_name
|
52
|
+
model_name.camelize
|
53
|
+
end
|
54
|
+
|
55
|
+
def controller_class_name
|
56
|
+
model_class_name + 'Controller'
|
57
|
+
end
|
58
|
+
|
59
|
+
def data_tree
|
60
|
+
archetype.definition.attributes.each do |attribute|
|
61
|
+
return attribute if attribute.rm_attribute_name == "data"
|
44
62
|
end
|
63
|
+
end
|
45
64
|
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
end
|
65
|
+
def index_data(tree = data_tree)
|
66
|
+
data = []
|
67
|
+
if tree.has_children?
|
68
|
+
data = tree.children.inject([]) do |values, child|
|
69
|
+
if child.respond_to? :attributes
|
70
|
+
child.attributes.each do |attribute|
|
71
|
+
if attribute.rm_attribute_name == 'value'
|
72
|
+
values << child.node_id unless child.node_id.nil?
|
73
|
+
end
|
74
|
+
if attribute.has_children?
|
75
|
+
values.concat index_data(attribute)
|
58
76
|
end
|
59
77
|
end
|
60
|
-
values
|
61
78
|
end
|
79
|
+
values
|
62
80
|
end
|
63
|
-
data
|
64
81
|
end
|
82
|
+
data
|
83
|
+
end
|
65
84
|
|
66
|
-
|
67
|
-
end
|
85
|
+
def show_data(tree = archetype.definition)
|
68
86
|
end
|
69
87
|
end
|
70
88
|
end
|
data/lib/openehr-rails.rb
CHANGED
data/openehr-rails.gemspec
CHANGED
@@ -22,15 +22,11 @@ Gem::Specification.new do |gem|
|
|
22
22
|
gem.require_paths = ["lib"]
|
23
23
|
gem.add_dependency('openehr', '1.2.14')
|
24
24
|
gem.add_dependency('rails', '~> 4.0.0')
|
25
|
+
gem.add_dependency('ckm_client')
|
25
26
|
|
26
27
|
gem.add_development_dependency('rake')
|
27
28
|
gem.add_development_dependency('ammeter')
|
28
29
|
gem.add_development_dependency('rspec')
|
29
30
|
gem.add_development_dependency('rspec-rails')
|
30
|
-
gem.add_development_dependency('guard')
|
31
|
-
gem.add_development_dependency('guard-rspec')
|
32
|
-
gem.add_development_dependency('guard-spork')
|
33
31
|
gem.add_development_dependency('simplecov')
|
34
|
-
gem.add_development_dependency('listen', '0.6')
|
35
|
-
gem.add_development_dependency('libnotify')
|
36
32
|
end
|