discerner 1.1.18

Sign up to get free protection for your applications and to get access to all the features.
Files changed (167) hide show
  1. checksums.yaml +7 -0
  2. data/MIT-LICENSE +20 -0
  3. data/README.md +97 -0
  4. data/Rakefile +29 -0
  5. data/app/assets/images/discerner/add.png +0 -0
  6. data/app/assets/images/discerner/ajax-loader.gif +0 -0
  7. data/app/assets/images/discerner/bar.gif +0 -0
  8. data/app/assets/images/discerner/bullet_arrow_down.png +0 -0
  9. data/app/assets/images/discerner/bullet_arrow_up.png +0 -0
  10. data/app/assets/images/discerner/cog.png +0 -0
  11. data/app/assets/images/discerner/delete.png +0 -0
  12. data/app/assets/images/discerner/edit.png +0 -0
  13. data/app/assets/images/discerner/excel.png +0 -0
  14. data/app/assets/images/discerner/greencheck.gif +0 -0
  15. data/app/assets/images/discerner/rails.png +0 -0
  16. data/app/assets/images/discerner/show.png +0 -0
  17. data/app/assets/images/discerner/switch_minus.gif +0 -0
  18. data/app/assets/images/discerner/switch_plus.gif +0 -0
  19. data/app/assets/javascripts/discerner/application.js +20 -0
  20. data/app/assets/javascripts/discerner/combobox.js +301 -0
  21. data/app/assets/javascripts/discerner/discerner.js +19 -0
  22. data/app/assets/javascripts/discerner/export_parameters.js +13 -0
  23. data/app/assets/javascripts/discerner/jquery/jquery.blockUI.js +576 -0
  24. data/app/assets/javascripts/discerner/jquery/jquery.form.js +1074 -0
  25. data/app/assets/javascripts/discerner/nested_attributes.js +69 -0
  26. data/app/assets/javascripts/discerner/search_combinations.js +49 -0
  27. data/app/assets/javascripts/discerner/search_parameter.js +131 -0
  28. data/app/assets/javascripts/discerner/search_parameter_value.js +172 -0
  29. data/app/assets/javascripts/discerner/searches.js +93 -0
  30. data/app/assets/javascripts/discerner/url.js +42 -0
  31. data/app/assets/stylesheets/discerner/application.css +16 -0
  32. data/app/assets/stylesheets/discerner/buttons.sass +13 -0
  33. data/app/assets/stylesheets/discerner/categorized_autocompleter.sass +53 -0
  34. data/app/assets/stylesheets/discerner/discerner.sass +51 -0
  35. data/app/assets/stylesheets/discerner/export_parameters.sass +43 -0
  36. data/app/assets/stylesheets/discerner/links.sass +29 -0
  37. data/app/assets/stylesheets/discerner/searches.sass +205 -0
  38. data/app/assets/stylesheets/discerner/tables.sass +32 -0
  39. data/app/controllers/discerner/application_controller.rb +2 -0
  40. data/app/controllers/discerner/export_parameters_controller.rb +5 -0
  41. data/app/controllers/discerner/parameters_controller.rb +5 -0
  42. data/app/controllers/discerner/searches_controller.rb +5 -0
  43. data/app/helpers/discerner/application_helper.rb +4 -0
  44. data/app/helpers/discerner/parameters_helper.rb +5 -0
  45. data/app/helpers/discerner/searches_helper.rb +5 -0
  46. data/app/models/discerner/dictionary.rb +5 -0
  47. data/app/models/discerner/export_parameter.rb +5 -0
  48. data/app/models/discerner/operator.rb +5 -0
  49. data/app/models/discerner/parameter.rb +5 -0
  50. data/app/models/discerner/parameter_category.rb +5 -0
  51. data/app/models/discerner/parameter_type.rb +5 -0
  52. data/app/models/discerner/parameter_value.rb +5 -0
  53. data/app/models/discerner/parameter_value_categorization.rb +5 -0
  54. data/app/models/discerner/parameter_value_category.rb +5 -0
  55. data/app/models/discerner/search.rb +5 -0
  56. data/app/models/discerner/search_combination.rb +5 -0
  57. data/app/models/discerner/search_parameter.rb +5 -0
  58. data/app/models/discerner/search_parameter_value.rb +5 -0
  59. data/app/views/discerner/export_parameters/index.html.haml +55 -0
  60. data/app/views/discerner/parameters/_values_autocompleter.html.haml +49 -0
  61. data/app/views/discerner/parameters/values.html.haml +1 -0
  62. data/app/views/discerner/searches/_form.html.haml +21 -0
  63. data/app/views/discerner/searches/_form_combined_searches.html.haml +32 -0
  64. data/app/views/discerner/searches/_form_controls.html.haml +8 -0
  65. data/app/views/discerner/searches/_form_header.html.haml +39 -0
  66. data/app/views/discerner/searches/_form_search_parameters.html.haml +28 -0
  67. data/app/views/discerner/searches/_list.html.haml +17 -0
  68. data/app/views/discerner/searches/_search_combination_fields.html.haml +22 -0
  69. data/app/views/discerner/searches/_search_parameter_fields.html.haml +48 -0
  70. data/app/views/discerner/searches/_search_parameter_value_fields.html.haml +62 -0
  71. data/app/views/discerner/searches/_summary.html.haml +25 -0
  72. data/app/views/discerner/searches/edit.html.haml +8 -0
  73. data/app/views/discerner/searches/index.html.haml +13 -0
  74. data/app/views/discerner/searches/index.js.haml +1 -0
  75. data/app/views/discerner/searches/new.html.haml +3 -0
  76. data/app/views/discerner/searches/rename.html.haml +6 -0
  77. data/app/views/discerner/searches/update.js.haml +7 -0
  78. data/app/views/discerner/shared/_categorized_autocompleter_items.html.haml +15 -0
  79. data/app/views/discerner/shared/_error_messages.html.haml +5 -0
  80. data/app/views/layouts/discerner/searches.html.erb +17 -0
  81. data/config/cucumber.yml +8 -0
  82. data/config/routes.rb +17 -0
  83. data/db/migrate/20121004040716_create_discerner_dictionaries.rb +11 -0
  84. data/db/migrate/20121004153043_create_discerner_parameter_categories.rb +12 -0
  85. data/db/migrate/20121005194843_create_discerner_parameter_types.rb +11 -0
  86. data/db/migrate/20121005203223_create_discerner_parameters.rb +14 -0
  87. data/db/migrate/20121008154855_create_discerner_operators.rb +13 -0
  88. data/db/migrate/20121008160313_create_discerner_operators_parameter_types.rb +8 -0
  89. data/db/migrate/20121008161455_create_discerner_parameter_values.rb +13 -0
  90. data/db/migrate/20121008180829_create_discerner_searches.rb +11 -0
  91. data/db/migrate/20121008182443_create_discerner_search_parameters.rb +11 -0
  92. data/db/migrate/20121011205130_create_discerner_search_parameter_values.rb +15 -0
  93. data/db/migrate/20121211213215_add_dictionary_id_to_discerner_searches.rb +5 -0
  94. data/db/migrate/20130205193602_create_discerner_search_combinations.rb +12 -0
  95. data/db/migrate/20130211230636_create_discerner_export_parameters.rb +9 -0
  96. data/db/migrate/20130213185818_add_search_columns_to_discerner_parameters.rb +38 -0
  97. data/db/migrate/20130213205255_rename_database_name_to_search_value_in_discerner_parameter_values.rb +5 -0
  98. data/db/migrate/20130215165416_add_searchable_to_discerner_parameters.rb +5 -0
  99. data/db/migrate/20130218230257_add_exclusive_to_discerner_parameters.rb +5 -0
  100. data/db/migrate/20130220163015_replace_integer_type_with_numeric.rb +22 -0
  101. data/db/migrate/20130221172826_add_unique_identifier_to_discerner_parameters.rb +5 -0
  102. data/db/migrate/20130222052924_change_search_attribute_to_method.rb +29 -0
  103. data/db/migrate/20130222070959_add_export_columns_to_discerner_parameters.rb +6 -0
  104. data/db/migrate/20130227031747_add_unique_identifier_to_discerner_operators.rb +16 -0
  105. data/db/migrate/20130306015019_change_discerner_parameter_values_name.rb +9 -0
  106. data/db/migrate/20130306212430_add_deleted_at_to_discerner_search_parameters.rb +5 -0
  107. data/db/migrate/20130306212504_add_deleted_at_to_discerner_search_parameter_values.rb +5 -0
  108. data/db/migrate/20130306212527_add_deleted_at_to_discerner_search_combinations.rb +5 -0
  109. data/db/migrate/20130306212818_add_deleted_at_to_discerner_export_parameters.rb +5 -0
  110. data/db/migrate/20130311190717_add_operator_type_to_discerner_operators.rb +5 -0
  111. data/db/migrate/20131212175110_remove_extra_search_parameter_values.rb +10 -0
  112. data/db/migrate/20140204170625_create_discerner_parameter_value_categories.rb +16 -0
  113. data/db/migrate/20140204170646_create_discerner_parameter_value_categorizations.rb +12 -0
  114. data/db/migrate/20140227191827_remove_blank_parameter_values_from_export_parameters.rb +10 -0
  115. data/db/seeds.rb +0 -0
  116. data/lib/discerner/engine.rb +16 -0
  117. data/lib/discerner/methods/controllers/export_parameters_controller.rb +38 -0
  118. data/lib/discerner/methods/controllers/parameters_controller.rb +30 -0
  119. data/lib/discerner/methods/controllers/searches_controller.rb +204 -0
  120. data/lib/discerner/methods/helpers/searches_helper.rb +145 -0
  121. data/lib/discerner/methods/models/dictionary.rb +54 -0
  122. data/lib/discerner/methods/models/export_parameter.rb +35 -0
  123. data/lib/discerner/methods/models/operator.rb +42 -0
  124. data/lib/discerner/methods/models/parameter.rb +90 -0
  125. data/lib/discerner/methods/models/parameter_category.rb +60 -0
  126. data/lib/discerner/methods/models/parameter_type.rb +33 -0
  127. data/lib/discerner/methods/models/parameter_value.rb +87 -0
  128. data/lib/discerner/methods/models/parameter_value_categorization.rb +21 -0
  129. data/lib/discerner/methods/models/parameter_value_category.rb +45 -0
  130. data/lib/discerner/methods/models/search.rb +147 -0
  131. data/lib/discerner/methods/models/search_combination.rb +50 -0
  132. data/lib/discerner/methods/models/search_parameter.rb +128 -0
  133. data/lib/discerner/methods/models/search_parameter_value.rb +130 -0
  134. data/lib/discerner/methods/models/soft_delete.rb +35 -0
  135. data/lib/discerner/methods/models/warning.rb +15 -0
  136. data/lib/discerner/parser.rb +497 -0
  137. data/lib/discerner/version.rb +3 -0
  138. data/lib/discerner.rb +4 -0
  139. data/lib/generators/discerner/dictionary/dictionary_generator.rb +38 -0
  140. data/lib/generators/discerner/dictionary/templates/model.rb +15 -0
  141. data/lib/generators/discerner/dictionary/templates/show.xls.erb +37 -0
  142. data/lib/generators/discerner/dictionary/templates/view.html.haml +2 -0
  143. data/lib/generators/discerner/install/install_generator.rb +153 -0
  144. data/lib/generators/discerner/install/templates/controllers/export_parameters_controller.rb +20 -0
  145. data/lib/generators/discerner/install/templates/controllers/parameters_controller.rb +15 -0
  146. data/lib/generators/discerner/install/templates/controllers/searches_controller.rb +39 -0
  147. data/lib/generators/discerner/install/templates/dictionaries.yml +236 -0
  148. data/lib/generators/discerner/install/templates/helpers/searches_helper.rb +9 -0
  149. data/lib/generators/discerner/install/templates/models/book.rb +15 -0
  150. data/lib/generators/discerner/install/templates/models/dictionary.rb +9 -0
  151. data/lib/generators/discerner/install/templates/models/export_parameter.rb +9 -0
  152. data/lib/generators/discerner/install/templates/models/operator.rb +9 -0
  153. data/lib/generators/discerner/install/templates/models/parameter.rb +10 -0
  154. data/lib/generators/discerner/install/templates/models/parameter_category.rb +9 -0
  155. data/lib/generators/discerner/install/templates/models/parameter_type.rb +9 -0
  156. data/lib/generators/discerner/install/templates/models/parameter_value.rb +9 -0
  157. data/lib/generators/discerner/install/templates/models/parameter_value_categorization.rb +9 -0
  158. data/lib/generators/discerner/install/templates/models/parameter_value_category.rb +9 -0
  159. data/lib/generators/discerner/install/templates/models/search.rb +9 -0
  160. data/lib/generators/discerner/install/templates/models/search_combination.rb +9 -0
  161. data/lib/generators/discerner/install/templates/models/search_parameter.rb +9 -0
  162. data/lib/generators/discerner/install/templates/models/search_parameter_value.rb +9 -0
  163. data/lib/generators/discerner/install/templates/views/layouts/searches.html.erb +17 -0
  164. data/lib/setup/operators.yml +91 -0
  165. data/lib/tasks/cucumber.rake +65 -0
  166. data/lib/tasks/discerner_tasks.rake +30 -0
  167. metadata +531 -0
@@ -0,0 +1,153 @@
1
+ # encoding: UTF-8
2
+ require "rails/generators"
3
+
4
+ module Discerner
5
+ class InstallGenerator < Rails::Generators::Base
6
+ class_option "no-migrate", :type => :boolean
7
+ class_option "customize-all", :type => :boolean
8
+ class_option "customize-controllers", :type => :boolean
9
+ class_option "customize-models", :type => :boolean
10
+ class_option "customize-helpers", :type => :boolean
11
+ class_option "customize-layout", :type => :boolean
12
+ class_option "current-user-helper", :type => :string
13
+
14
+ def self.source_paths
15
+ paths = self.superclass.source_paths
16
+ paths << File.expand_path("../templates", __FILE__)
17
+ paths.flatten
18
+ end
19
+
20
+ desc "Used to install Discerner"
21
+
22
+ def install_migrations
23
+ puts "Copying over Discerner migrations..."
24
+ Dir.chdir(Rails.root) do
25
+ `rake discerner:install:migrations`
26
+ end
27
+ end
28
+
29
+ ## shameless steal from forem git://github.com/radar/forem.git
30
+ def add_discerner_user_method
31
+ current_user_helper = options["current-user-helper"].presence ||
32
+ ask("What is the current_user helper called in your app? [current_user]").presence ||
33
+ 'current_user if defined?(current_user)'
34
+ puts "Defining discerner_user method inside ApplicationController..."
35
+
36
+ discerner_user_method = %Q{
37
+ def discerner_user
38
+ #{current_user_helper}
39
+ end
40
+ helper_method :discerner_user
41
+ }
42
+ inject_into_file("#{Rails.root}/app/controllers/application_controller.rb",
43
+ discerner_user_method,
44
+ :after => "ActionController::Base\n", :force => false)
45
+ end
46
+
47
+ def add_discerner_view_helpers
48
+ puts "Defining discerner view helpers inside ApplicationHelper..."
49
+
50
+ discerner_helper_methods = %Q{
51
+ def export_discerner_results?
52
+ true
53
+ end
54
+
55
+ def show_discerner_results?
56
+ true
57
+ end
58
+
59
+ def enable_combined_searches?
60
+ true
61
+ end
62
+ }
63
+ inject_into_file("#{Rails.root}/app/helpers/application_helper.rb",
64
+ discerner_helper_methods,
65
+ :after => "ApplicationHelper\n")
66
+ end
67
+
68
+ def run_migrations
69
+ unless options["no-migrate"]
70
+ puts "Running rake db:migrate"
71
+ `rake db:migrate`
72
+ end
73
+ end
74
+
75
+ def seed_database_with_operators
76
+ unless options["no-migrate"]
77
+ puts "Running rake discerner:setup:operators"
78
+ `rake discerner:setup:operators`
79
+ end
80
+ end
81
+
82
+ def mount_engine
83
+ puts "Mounting Discerner::Engine at \"/\" in config/routes.rb..."
84
+ insert_into_file("#{Rails.root}/config/routes.rb", :after => /routes.draw.do\n/) do
85
+ %Q{ mount Discerner::Engine, :at => "/"\n}
86
+ end
87
+ end
88
+
89
+ def sample_dictionary
90
+ path = "#{Rails.root}/lib/setup"
91
+ empty_directory "#{path}"
92
+ copy_file "dictionaries.yml", "#{path}/dictionaries.yml"
93
+ end
94
+
95
+ def make_customizable
96
+ if options["customize-all"] || options["customize-controllers"]
97
+ path = "#{Rails.root}/app/controllers/discerner"
98
+ empty_directory path
99
+ copy_file "controllers/searches_controller.rb", "#{path}/searches_controller.rb"
100
+ copy_file "controllers/parameters_controller.rb", "#{path}/parameters_controller.rb"
101
+ copy_file "controllers/export_parameters_controller.rb", "#{path}/export_parameters_controller.rb"
102
+ end
103
+
104
+ if options["customize-all"] || options["customize-helpers"]
105
+ path = "#{Rails.root}/app/helpers/discerner"
106
+ empty_directory "#{path}"
107
+ copy_file "helpers/searches_helper.rb", "#{path}/searches_helper.rb"
108
+ end
109
+
110
+ if options["customize-all"] || options["customize-models"]
111
+ path = "#{Rails.root}/app/models/discerner"
112
+ empty_directory "#{path}"
113
+ copy_file "models/dictionary.rb", "#{path}/dictionary.rb"
114
+ copy_file "models/export_parameter.rb", "#{path}/export_parameter.rb"
115
+ copy_file "models/operator.rb", "#{path}/operator.rb"
116
+ copy_file "models/parameter_category.rb", "#{path}/parameter_category.rb"
117
+ copy_file "models/parameter_type.rb", "#{path}/parameter_type.rb"
118
+ copy_file "models/parameter_value.rb", "#{path}/parameter_value.rb"
119
+ copy_file "models/parameter.rb", "#{path}/parameter.rb"
120
+ copy_file "models/search_combination.rb", "#{path}/search_combination.rb"
121
+ copy_file "models/search_parameter_value.rb", "#{path}/search_parameter_value.rb"
122
+ copy_file "models/search_parameter.rb", "#{path}/search_parameter.rb"
123
+ copy_file "models/search.rb", "#{path}/search.rb"
124
+ end
125
+
126
+ if options["customize-all"] || options["customize-layout"]
127
+ path = "#{Rails.root}/app/views/layouts/discerner"
128
+ empty_directory "#{path}"
129
+ copy_file "views/layouts/searches.html.erb", "#{path}/searches.html.erb"
130
+ end
131
+ end
132
+
133
+ def finished
134
+ output = "\n\n" + ("*" * 53)
135
+ output += "\nDone! Discerner has been successfully installed. Here's what happened:\n\n"
136
+ output += "-- Discerner's migrations were copied over into db/migrate.\n"
137
+ output += "-- A new method called `discerner_user` was inserted into your ApplicationController. This lets Discerner know what the current user of your application is.\n"
138
+
139
+ unless options["no-migrate"]
140
+ output += "-- `rake db:migrate` was run, running all the migrations against your database.\n"
141
+ output += "-- Seed operators were loaded into your database.\n"
142
+ end
143
+ output += "-- The engine was mounted in your config/routes.rb file using this line:
144
+ mount Discerner::Engine, :at => \"/\""
145
+ output += "\nIf you want to change where the searches are located, just change the \"/searches\" path at the end of this line to whatever you want."
146
+ output += "\n-- Sample search dictionary was copied into lib/setup. If you want to try it out, run `rails generate discerner:dictionary lib/setup/dictionaries.yml`. This will:\n"
147
+ output += "\n-- parse dictionary definitions from lib/setup/dictionaries.yml into the database."
148
+ output += "\n-- create corresponsing classes"
149
+ output += "\n-- create corresponsing views for results display"
150
+ puts output
151
+ end
152
+ end
153
+ end
@@ -0,0 +1,20 @@
1
+ module Discerner
2
+ module ExportParametersControllerCustomMethods
3
+ def self.included(base)
4
+ base.send :layout, "search"
5
+ end
6
+
7
+ def index
8
+ super
9
+ end
10
+
11
+ def assign
12
+ super
13
+ end
14
+ end
15
+
16
+ class ExportParametersController < ApplicationController
17
+ include Discerner::Methods::Controllers::ExportParametersController
18
+ include Discerner::ExportParametersControllerCustomMethods
19
+ end
20
+ end
@@ -0,0 +1,15 @@
1
+ module Discerner
2
+ module ParametersControllerCustomMethods
3
+ def self.included(base)
4
+ end
5
+
6
+ def show
7
+ super
8
+ end
9
+ end
10
+
11
+ class ParametersController < ApplicationController
12
+ include Discerner::Methods::Controllers::ParametersController
13
+ include Discerner::ParametersControllerCustomMethods
14
+ end
15
+ end
@@ -0,0 +1,39 @@
1
+ module Discerner
2
+ module SearchesControllerCustomMethods
3
+ def self.included(base)
4
+ end
5
+
6
+ def new
7
+ super
8
+ end
9
+
10
+ def create
11
+ super
12
+ end
13
+
14
+ def edit
15
+ super
16
+ end
17
+
18
+ def update
19
+ super
20
+ end
21
+
22
+ def index
23
+ super
24
+ end
25
+
26
+ def destroy
27
+ super
28
+ end
29
+
30
+ def show
31
+ super
32
+ end
33
+ end
34
+
35
+ class SearchesController < ApplicationController
36
+ include Discerner::Methods::Controllers::SearchesController
37
+ include Discerner::SearchesControllerCustomMethods
38
+ end
39
+ end
@@ -0,0 +1,236 @@
1
+ # ---- General structure:
2
+ # :dictionaries:
3
+ # - :name: string # has to be unique within not-deleted dictionaries
4
+ # :parameter_categories:
5
+ # - :name: string # has to be unique within the dictionary
6
+ # :parameters:
7
+ # - :name: string # used for display
8
+ # :unique_identifier: # has to be unique within the dictionary
9
+ # :export:
10
+ # :model # name of the model to be used for exporting
11
+ # :method # name of the model method to be used for exporting
12
+ # :search: # parameter search model and method combination has to be unique within the category
13
+ # :model: string # name of the model to be used for searching
14
+ # :method: string # name of the model method to be used for searching
15
+ # :parameter_type: numeric/date/list/combobox/text/string # used to define applicable operators/display options. does not have to be restricted to the given list, but additional parameters will require adding operators to match
16
+ # :parameter_value_categories_source: # used to define parameter value categories
17
+ # :model: string # source model to be used to load parameter value categiories
18
+ # :method: string # method in the source model that returns parameter_value_categories in a form of [{:name => 'string, :unique_identifier => 'adventure', :display_order => 1, :collapse => true}]
19
+ # :parameter_value_categories: # used to define parameter value categories
20
+ # - :name: string
21
+ # :unique_identifier: string # has to be unique within parameter
22
+ # :collapse: boolean # used to define if parameter category should be collapsed in the list and its values hidden from the view
23
+ # :display_order: integer
24
+ # :allow_empty_values: boolean # default: true. If set to true, "none" value will be added to the list ov values
25
+ # :parameter_values: # needs to be defined for list/combobox parameters unless parameter values come from the model, see ':source'
26
+ # - :name: string # used for display, if not provided, 'search_value' will be used instead
27
+ # :search_value: string # has to be unique within parameter, intendend to be used as a database value while searching
28
+ # :parameter_value_category: string # used to define category for parameter value, should match one of parameter_value_categories unique_identifiers listed above
29
+ # :source:
30
+ # :model: string # source model to be used to load parameter values
31
+ # :method: string # method/method in the source model to be used to load parameter values
32
+
33
+ ---
34
+ :dictionaries:
35
+ - :name: Sample dictionary
36
+ :parameter_categories:
37
+ - :name: Demographic criteria
38
+ :parameters:
39
+ - :name: Age at case collection date
40
+ :unique_identifier: age_at_case_collect
41
+ :search:
42
+ :model: Patient
43
+ :method: age_at_case_collect
44
+ :parameter_type: numeric
45
+
46
+ - :name: Age based on current date
47
+ :unique_identifier: age_based_on_current_date
48
+ :export:
49
+ :model: Patient
50
+ :method: age_based_on_current_date
51
+
52
+ - :name: Date of birth
53
+ :unique_identifier: birth_dt_tm
54
+ :search:
55
+ :model: Patient
56
+ :method: birth_dt_tm
57
+ :parameter_type: date
58
+ :export:
59
+ :model: Patient
60
+ :method: age_based_on_current_date
61
+
62
+ - :name: Ethnic group
63
+ :unique_identifier: ethnic_grp
64
+ :search:
65
+ :model: Patient
66
+ :method: ethnic_grp
67
+ :parameter_type: combobox
68
+ :parameter_values:
69
+ - :name: Hispanic or Latino
70
+ :search_value: hisp_or_latino
71
+ - :name: NOT Hispanic or Latino
72
+ :search_value: not_hisp_or_latino
73
+ - :name: Unable to answer
74
+ :search_value: unknown
75
+ - :name: Declined to answer
76
+ :search_value: declined
77
+
78
+ - :name: Consented
79
+ :unique_identifier: surg_inpatient_mortality
80
+ :search:
81
+ :model: Surgery
82
+ :method: consented
83
+ :parameter_type: list
84
+ :parameter_values:
85
+ - :search_value: yes
86
+ - :search_value: no
87
+
88
+ - :name: Gender
89
+ :unique_identifier: sex
90
+ :search:
91
+ :model: Patient
92
+ :method: sex
93
+ :parameter_type: list
94
+ :parameter_values:
95
+ - :name: Male
96
+ :search_value: male
97
+ - :name: Female
98
+ :search_value: female
99
+ - :name: Indeterminent
100
+ :search_value: indeterminent
101
+ - :name: Unknown
102
+ :search_value: unknown
103
+ - :name: Unspecified
104
+ :search_value: uncpecified
105
+ :export:
106
+ :model: Patient
107
+ :method: gender
108
+
109
+ - :name: Race
110
+ :exclusive: false
111
+ :unique_identifier: race
112
+ :search:
113
+ :model: Patient
114
+ :method: race
115
+ :parameter_type: list
116
+ :parameter_values:
117
+ - :search_value: American Indian or Alaska Native
118
+ - :search_value: Asian
119
+ - :search_value: Black or African American
120
+ - :search_value: Hispanic or Latino
121
+ - :search_value: Native Hawaiian or Other Pacific Islander
122
+ - :search_value: White or Caucasian
123
+ - :search_value: Other
124
+ - :search_value: Declined to answer
125
+ - :search_value: Unable to answer
126
+ :export:
127
+ :model: Patient
128
+ :method: race
129
+
130
+ - :name: Case criteria
131
+ :parameters:
132
+ - :name: Accession date
133
+ :unique_identifier: accessioned_dt_tm
134
+ :search:
135
+ :model: Case
136
+ :method: accessioned_dt_tm
137
+ :parameter_type: date
138
+
139
+ - :name: Text search diagnosis
140
+ :exclusive: false
141
+ :unique_identifier: case_specimen_diagnosis
142
+ :search:
143
+ :model: Case
144
+ :method: case_specimen_diagnosis
145
+ :parameter_type: text
146
+
147
+ - :name: Librarian dictionary
148
+ :parameter_categories:
149
+ - :name: By author
150
+ :parameters:
151
+ - :name: "Last name"
152
+ :unique_identifier: autor_last_name
153
+ :search:
154
+ :model: Author
155
+ :method: autor_last_name
156
+ :parameter_type: string
157
+
158
+ - :name: "First name"
159
+ :unique_identifier: autor_first_name
160
+ :search:
161
+ :model: Author
162
+ :method: autor_first_name
163
+ :parameter_type: text
164
+
165
+ - :name: "Country"
166
+ :unique_identifier: country
167
+ :search:
168
+ :model: Author
169
+ :method: country
170
+ :parameter_type: text
171
+
172
+ - :name: "Type"
173
+ :unique_identifier: author_type
174
+ :search:
175
+ :model: Book
176
+ :method: type
177
+ :parameter_type: list
178
+ :parameter_values:
179
+ - :search_value: author
180
+ - :search_value: co-author
181
+ - :search_value: reviewer
182
+ - :name: Book criteria
183
+ :parameters:
184
+ - :name: "Type"
185
+ :unique_identifier: book_type
186
+ :search:
187
+ :model: Book
188
+ :method: type
189
+ :parameter_type: combobox
190
+ :parameter_values:
191
+ - :search_value: book
192
+ - :search_value: journal
193
+ - :search_value: article
194
+ - :search_value: electronic journal
195
+
196
+ - :name: "Genre"
197
+ :unique_identifier: book_genre
198
+ :search:
199
+ :model: Book
200
+ :method: Genre
201
+ :parameter_type: combobox
202
+ :parameter_value_categories:
203
+ - :name: Adventure
204
+ :unique_identifier: adventure
205
+ :collapse: true
206
+ :display_order: 1
207
+ - :name: Comic novel
208
+ :unique_identifier: comic
209
+ - :name: Historical
210
+ :unique_identifier: historical
211
+ :parameter_values:
212
+ - :search_value: "Robinsonade"
213
+ :parameter_value_category: adventure
214
+ - :search_value: "Black comedy"
215
+ :parameter_value_category: comic
216
+ - :search_value: "Parody"
217
+ :parameter_value_category: comic
218
+ - :search_value: "Lost World"
219
+ :parameter_value_category: adventure
220
+ - :search_value: "Brit lit"
221
+ - :search_value: "Pulp fiction"
222
+
223
+ - :name: "Title"
224
+ :unique_identifier: title
225
+ :search:
226
+ :model: Book
227
+ :method: title
228
+ :parameter_type: text
229
+
230
+ - :name: "Keyword"
231
+ :unique_identifier: text
232
+ :search:
233
+ :model: Book
234
+ :method: text
235
+ :parameter_type: text
236
+
@@ -0,0 +1,9 @@
1
+ module Discerner
2
+ module SearchesHelperCustomMethods
3
+ end
4
+
5
+ module SearchesHelper
6
+ include Discerner::Methods::Helpers::SearchesHelper
7
+ include Discerner::SearchesHelperCustomMethods
8
+ end
9
+ end
@@ -0,0 +1,15 @@
1
+ class Book
2
+ def self.genres
3
+ [
4
+ {:name => 'Adventure', :unique_identifier => 'adventure', :display_order => 1, :collapse => true},
5
+ {:name => 'Drama', :unique_identifier => 'drama', :display_order => 2, :collapse => false},
6
+ ]
7
+ end
8
+
9
+ def self.generes
10
+ [
11
+ {:name => 'Adventure', :display_order => 1, :collapse => true},
12
+ {:name => 'Drama', :unique_identifier => 'drama', :display_order => 2, :collapse => false},
13
+ ]
14
+ end
15
+ end
@@ -0,0 +1,9 @@
1
+ module Discerner
2
+ module DictionaryCustomMethods
3
+ end
4
+
5
+ class Dictionary < ActiveRecord::Base
6
+ include Discerner::Methods::Models::Dictionary
7
+ include Discerner::DictionaryCustomMethods
8
+ end
9
+ end
@@ -0,0 +1,9 @@
1
+ module Discerner
2
+ module ExportParameterCustomMethods
3
+ end
4
+
5
+ class ExportParameter < ActiveRecord::Base
6
+ include Discerner::Methods::Models::ExportParameter
7
+ include Discerner::ExportParameterCustomMethods
8
+ end
9
+ end
@@ -0,0 +1,9 @@
1
+ module Discerner
2
+ module OperatorCustomMethods
3
+ end
4
+
5
+ class Operator < ActiveRecord::Base
6
+ include Discerner::Methods::Models::Operator
7
+ include Discerner::OperatorCustomMethods
8
+ end
9
+ end
@@ -0,0 +1,10 @@
1
+ module Discerner
2
+ module ParameterCustomMethods
3
+ end
4
+
5
+ class Parameter < ActiveRecord::Base
6
+ include Discerner::Methods::Models::Parameter
7
+ include Discerner::ParameterCustomMethods
8
+ end
9
+ end
10
+
@@ -0,0 +1,9 @@
1
+ module Discerner
2
+ module ParameterCategoryCustomMethods
3
+ end
4
+
5
+ class ParameterCategory < ActiveRecord::Base
6
+ include Discerner::Methods::Models::ParameterCategory
7
+ include Discerner::ParameterCategoryCustomMethods
8
+ end
9
+ end
@@ -0,0 +1,9 @@
1
+ module Discerner
2
+ module ParameterTypeCustomMethods
3
+ end
4
+
5
+ class ParameterType < ActiveRecord::Base
6
+ include Discerner::Methods::Models::ParameterType
7
+ include Discerner::ParameterTypeCustomMethods
8
+ end
9
+ end
@@ -0,0 +1,9 @@
1
+ module Discerner
2
+ module ParameterValueCustomMethods
3
+ end
4
+
5
+ class ParameterValue < ActiveRecord::Base
6
+ include Discerner::Methods::Models::ParameterValue
7
+ include Discerner::ParameterValueCustomMethods
8
+ end
9
+ end
@@ -0,0 +1,9 @@
1
+ module Discerner
2
+ module ParameterValueCategorizationCustomMethods
3
+ end
4
+
5
+ class ParameterValueCategorization < ActiveRecord::Base
6
+ include Discerner::Methods::Models::ParameterValueCategorization
7
+ include Discerner::ParameterValueCategorizationCustomMethods
8
+ end
9
+ end
@@ -0,0 +1,9 @@
1
+ module Discerner
2
+ module ParameterValueCategoryCustomMethods
3
+ end
4
+
5
+ class ParameterValueCategory < ActiveRecord::Base
6
+ include Discerner::Methods::Models::ParameterValueCategory
7
+ include Discerner::ParameterValueCategoryCustomMethods
8
+ end
9
+ end
@@ -0,0 +1,9 @@
1
+ module Discerner
2
+ module SearchCustomMethods
3
+ end
4
+
5
+ class Search < ActiveRecord::Base
6
+ include Discerner::Methods::Models::Search
7
+ include Discerner::SearchCustomMethods
8
+ end
9
+ end
@@ -0,0 +1,9 @@
1
+ module Discerner
2
+ module SearchCombinationCustomMethods
3
+ end
4
+
5
+ class SearchCombination < ActiveRecord::Base
6
+ include Discerner::Methods::Models::SearchCombination
7
+ include Discerner::SearchCombinationCustomMethods
8
+ end
9
+ end
@@ -0,0 +1,9 @@
1
+ module Discerner
2
+ module SearchParameterCustomMethods
3
+ end
4
+
5
+ class SearchParameter < ActiveRecord::Base
6
+ include Discerner::Methods::Models::SearchParameter
7
+ include Discerner::SearchParameterCustomMethods
8
+ end
9
+ end
@@ -0,0 +1,9 @@
1
+ module Discerner
2
+ module SearchParameterValueCustomMethods
3
+ end
4
+
5
+ class SearchParameterValue < ActiveRecord::Base
6
+ include Discerner::Methods::Models::SearchParameterValue
7
+ include Discerner::SearchParameterValueCustomMethods
8
+ end
9
+ end
@@ -0,0 +1,17 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <%= yield :title %>
5
+ <%= stylesheet_link_tag "discerner/application", :media => "all" %>
6
+ <%= javascript_include_tag "discerner/application" %>
7
+ <%= csrf_meta_tags %>
8
+ </head>
9
+ <body class="discerner">
10
+ <% flash.each do |message_type, message| %>
11
+ <div class="message" id="<%= message_type %>">
12
+ <%= message %>
13
+ </div>
14
+ <% end %>
15
+ <%= yield %>
16
+ </body>
17
+ </html>