ccls-ccls_engine 3.11.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (269) hide show
  1. data/README.rdoc +182 -0
  2. data/app/models/abstract.rb +181 -0
  3. data/app/models/abstract_search.rb +50 -0
  4. data/app/models/abstract_validations.rb +324 -0
  5. data/app/models/address.rb +70 -0
  6. data/app/models/address_type.rb +15 -0
  7. data/app/models/addressing.rb +147 -0
  8. data/app/models/aliquot.rb +44 -0
  9. data/app/models/aliquot_sample_format.rb +13 -0
  10. data/app/models/analysis.rb +14 -0
  11. data/app/models/bc_request.rb +20 -0
  12. data/app/models/candidate_control.rb +101 -0
  13. data/app/models/context.rb +23 -0
  14. data/app/models/context_data_source.rb +4 -0
  15. data/app/models/county.rb +16 -0
  16. data/app/models/data_source.rb +24 -0
  17. data/app/models/diagnosis.rb +23 -0
  18. data/app/models/document_type.rb +16 -0
  19. data/app/models/document_version.rb +27 -0
  20. data/app/models/enrollment.rb +78 -0
  21. data/app/models/enrollment_validations.rb +167 -0
  22. data/app/models/follow_up.rb +16 -0
  23. data/app/models/follow_up_type.rb +18 -0
  24. data/app/models/gift_card.rb +22 -0
  25. data/app/models/gift_card_search.rb +137 -0
  26. data/app/models/home_exposure_response.rb +24 -0
  27. data/app/models/homex_outcome.rb +75 -0
  28. data/app/models/hospital.rb +22 -0
  29. data/app/models/icf_master_id.rb +30 -0
  30. data/app/models/icf_master_tracker.rb +217 -0
  31. data/app/models/icf_master_tracker_change.rb +9 -0
  32. data/app/models/icf_master_tracker_update.rb +50 -0
  33. data/app/models/ineligible_reason.rb +26 -0
  34. data/app/models/instrument.rb +26 -0
  35. data/app/models/instrument_type.rb +17 -0
  36. data/app/models/instrument_version.rb +28 -0
  37. data/app/models/interview.rb +122 -0
  38. data/app/models/interview_method.rb +17 -0
  39. data/app/models/interview_outcome.rb +16 -0
  40. data/app/models/language.rb +28 -0
  41. data/app/models/live_birth_data_update.rb +142 -0
  42. data/app/models/operational_event.rb +99 -0
  43. data/app/models/operational_event_type.rb +31 -0
  44. data/app/models/organization.rb +28 -0
  45. data/app/models/patient.rb +63 -0
  46. data/app/models/patient_validations.rb +118 -0
  47. data/app/models/person.rb +28 -0
  48. data/app/models/phone_number.rb +105 -0
  49. data/app/models/phone_type.rb +15 -0
  50. data/app/models/project.rb +39 -0
  51. data/app/models/project_outcome.rb +19 -0
  52. data/app/models/race.rb +31 -0
  53. data/app/models/refusal_reason.rb +23 -0
  54. data/app/models/sample.rb +168 -0
  55. data/app/models/sample_kit.rb +14 -0
  56. data/app/models/sample_outcome.rb +16 -0
  57. data/app/models/sample_temperature.rb +14 -0
  58. data/app/models/sample_type.rb +37 -0
  59. data/app/models/search.rb +195 -0
  60. data/app/models/section.rb +18 -0
  61. data/app/models/state.rb +25 -0
  62. data/app/models/study_subject.rb +237 -0
  63. data/app/models/study_subject_abstracts.rb +47 -0
  64. data/app/models/study_subject_addresses.rb +34 -0
  65. data/app/models/study_subject_associations.rb +38 -0
  66. data/app/models/study_subject_duplicates.rb +111 -0
  67. data/app/models/study_subject_enrollments.rb +17 -0
  68. data/app/models/study_subject_homex_outcome.rb +22 -0
  69. data/app/models/study_subject_identifier.rb +153 -0
  70. data/app/models/study_subject_interviews.rb +25 -0
  71. data/app/models/study_subject_languages.rb +21 -0
  72. data/app/models/study_subject_operational_events.rb +66 -0
  73. data/app/models/study_subject_patient.rb +177 -0
  74. data/app/models/study_subject_pii.rb +74 -0
  75. data/app/models/study_subject_races.rb +25 -0
  76. data/app/models/study_subject_search.rb +260 -0
  77. data/app/models/study_subject_validations.rb +116 -0
  78. data/app/models/subject_language.rb +11 -0
  79. data/app/models/subject_race.rb +11 -0
  80. data/app/models/subject_relationship.rb +21 -0
  81. data/app/models/subject_type.rb +22 -0
  82. data/app/models/tracing_status.rb +20 -0
  83. data/app/models/transfer.rb +40 -0
  84. data/app/models/unit.rb +14 -0
  85. data/app/models/vital_status.rb +19 -0
  86. data/app/models/zip_code.rb +36 -0
  87. data/config/abstract_fields.yml +1038 -0
  88. data/config/abstract_sections.yml +77 -0
  89. data/config/home_exposure_response_fields.yml +583 -0
  90. data/config/icf_master_tracker_update.yml +56 -0
  91. data/config/live_birth_data_update.yml +56 -0
  92. data/config/shared_use_db.yml +4 -0
  93. data/generators/ccls_engine/USAGE +2 -0
  94. data/generators/ccls_engine/ccls_engine_generator.rb +123 -0
  95. data/generators/ccls_engine/templates/autotest_ccls_engine.rb +3 -0
  96. data/generators/ccls_engine/templates/ccls_engine.rake +12 -0
  97. data/generators/ccls_engine/templates/fixtures/address_types.yml +30 -0
  98. data/generators/ccls_engine/templates/fixtures/context_data_sources.yml +54 -0
  99. data/generators/ccls_engine/templates/fixtures/contexts.yml +19 -0
  100. data/generators/ccls_engine/templates/fixtures/data_sources.yml +40 -0
  101. data/generators/ccls_engine/templates/fixtures/diagnoses.yml +40 -0
  102. data/generators/ccls_engine/templates/fixtures/document_types.yml +65 -0
  103. data/generators/ccls_engine/templates/fixtures/document_versions.csv +155 -0
  104. data/generators/ccls_engine/templates/fixtures/follow_up_types.yml +16 -0
  105. data/generators/ccls_engine/templates/fixtures/hospitals.yml +114 -0
  106. data/generators/ccls_engine/templates/fixtures/ineligible_reasons.yml +35 -0
  107. data/generators/ccls_engine/templates/fixtures/instrument_types.yml +26 -0
  108. data/generators/ccls_engine/templates/fixtures/instrument_versions.yml +22 -0
  109. data/generators/ccls_engine/templates/fixtures/instruments.yml +22 -0
  110. data/generators/ccls_engine/templates/fixtures/interview_methods.yml +30 -0
  111. data/generators/ccls_engine/templates/fixtures/interview_outcomes.yml +31 -0
  112. data/generators/ccls_engine/templates/fixtures/languages.yml +34 -0
  113. data/generators/ccls_engine/templates/fixtures/operational_event_types.yml +141 -0
  114. data/generators/ccls_engine/templates/fixtures/organizations.yml +198 -0
  115. data/generators/ccls_engine/templates/fixtures/people.yml +130 -0
  116. data/generators/ccls_engine/templates/fixtures/phone_types.yml +30 -0
  117. data/generators/ccls_engine/templates/fixtures/project_outcomes.yml +25 -0
  118. data/generators/ccls_engine/templates/fixtures/projects.yml +59 -0
  119. data/generators/ccls_engine/templates/fixtures/races.yml +52 -0
  120. data/generators/ccls_engine/templates/fixtures/refusal_reasons.yml +55 -0
  121. data/generators/ccls_engine/templates/fixtures/sample_outcomes.yml +36 -0
  122. data/generators/ccls_engine/templates/fixtures/sample_temperatures.yml +16 -0
  123. data/generators/ccls_engine/templates/fixtures/sample_types.yml +147 -0
  124. data/generators/ccls_engine/templates/fixtures/sections.yml +31 -0
  125. data/generators/ccls_engine/templates/fixtures/states.yml +363 -0
  126. data/generators/ccls_engine/templates/fixtures/subject_relationships.yml +46 -0
  127. data/generators/ccls_engine/templates/fixtures/subject_types.yml +30 -0
  128. data/generators/ccls_engine/templates/fixtures/tracing_statuses.yml +30 -0
  129. data/generators/ccls_engine/templates/fixtures/units.yml +13 -0
  130. data/generators/ccls_engine/templates/fixtures/vital_statuses.yml +28 -0
  131. data/generators/ccls_engine/templates/functional/roles_controller_test.rb +142 -0
  132. data/generators/ccls_engine/templates/functional/sessions_controller_test.rb +19 -0
  133. data/generators/ccls_engine/templates/functional/users_controller_test.rb +94 -0
  134. data/generators/ccls_engine/templates/images/sort_down.png +0 -0
  135. data/generators/ccls_engine/templates/images/sort_up.png +0 -0
  136. data/generators/ccls_engine/templates/initializer.rb +28 -0
  137. data/generators/ccls_engine/templates/javascripts/ccls_engine.js +24 -0
  138. data/generators/ccls_engine/templates/javascripts/jquery-ui.js +763 -0
  139. data/generators/ccls_engine/templates/javascripts/jquery.js +154 -0
  140. data/generators/ccls_engine/templates/javascripts/jrails.js +1 -0
  141. data/generators/ccls_engine/templates/migrations/create_user_invitations.rb +18 -0
  142. data/generators/ccls_engine/templates/migrations/create_users.rb +33 -0
  143. data/generators/ccls_engine/templates/migrations/drop_user_invitations.rb +18 -0
  144. data/generators/ccls_engine/templates/stylesheets/ccls_engine.css +180 -0
  145. data/generators/ccls_engine/templates/stylesheets/user.css +35 -0
  146. data/generators/ccls_engine/templates/stylesheets/users.css +23 -0
  147. data/generators/ccls_engine/templates/unit/core_extension_test.rb +18 -0
  148. data/generators/ccls_engine/templates/unit/role_test.rb +30 -0
  149. data/generators/ccls_engine/templates/unit/user_test.rb +321 -0
  150. data/lib/ccls-ccls_engine.rb +1 -0
  151. data/lib/ccls_engine.rb +135 -0
  152. data/lib/ccls_engine/action_view_extension.rb +3 -0
  153. data/lib/ccls_engine/action_view_extension/base.rb +53 -0
  154. data/lib/ccls_engine/action_view_extension/form_builder.rb +39 -0
  155. data/lib/ccls_engine/active_record_extension.rb +2 -0
  156. data/lib/ccls_engine/active_record_extension/base.rb +70 -0
  157. data/lib/ccls_engine/active_record_shared.rb +8 -0
  158. data/lib/ccls_engine/assertions.rb +69 -0
  159. data/lib/ccls_engine/autotest.rb +54 -0
  160. data/lib/ccls_engine/ccls_user.rb +117 -0
  161. data/lib/ccls_engine/core_extension.rb +14 -0
  162. data/lib/ccls_engine/date_and_time_formats.rb +30 -0
  163. data/lib/ccls_engine/factories.rb +880 -0
  164. data/lib/ccls_engine/factory_test_helper.rb +276 -0
  165. data/lib/ccls_engine/helper.rb +112 -0
  166. data/lib/ccls_engine/icf_master_tracker_update_test_helper.rb +121 -0
  167. data/lib/ccls_engine/live_birth_data_update_test_helper.rb +110 -0
  168. data/lib/ccls_engine/package_test_helper.rb +49 -0
  169. data/lib/ccls_engine/shared_database.rb +20 -0
  170. data/lib/ccls_engine/tasks.rb +1 -0
  171. data/lib/ccls_engine/test_tasks.rb +52 -0
  172. data/lib/ccls_engine/translation_table.rb +86 -0
  173. data/lib/shared_migration.rb +5 -0
  174. data/lib/surveyor/survey_extensions.rb +125 -0
  175. data/lib/tasks/application.rake +286 -0
  176. data/lib/tasks/calnet_authenticated.rake +6 -0
  177. data/lib/tasks/common_lib.rake +7 -0
  178. data/lib/tasks/database.rake +288 -0
  179. data/lib/tasks/documentation.rake +71 -0
  180. data/lib/tasks/homex_import.rake +723 -0
  181. data/lib/tasks/odms_import.rake +1116 -0
  182. data/lib/tasks/simply_authorized.rake +6 -0
  183. data/lib/tasks/ucb_ccls_engine_tasks.rake +4 -0
  184. data/lib/tasks/use_db.rake +4 -0
  185. data/rails/init.rb +4 -0
  186. data/test/unit/ccls/abstract_search_test.rb +150 -0
  187. data/test/unit/ccls/abstract_test.rb +674 -0
  188. data/test/unit/ccls/address_test.rb +155 -0
  189. data/test/unit/ccls/address_type_test.rb +25 -0
  190. data/test/unit/ccls/addressing_test.rb +466 -0
  191. data/test/unit/ccls/aliquot_sample_format_test.rb +20 -0
  192. data/test/unit/ccls/aliquot_test.rb +156 -0
  193. data/test/unit/ccls/analysis_test.rb +31 -0
  194. data/test/unit/ccls/bc_request_test.rb +43 -0
  195. data/test/unit/ccls/candidate_control_test.rb +712 -0
  196. data/test/unit/ccls/context_data_source_test.rb +26 -0
  197. data/test/unit/ccls/context_test.rb +40 -0
  198. data/test/unit/ccls/core_extension_test.rb +17 -0
  199. data/test/unit/ccls/county_test.rb +34 -0
  200. data/test/unit/ccls/data_source_test.rb +41 -0
  201. data/test/unit/ccls/diagnosis_test.rb +51 -0
  202. data/test/unit/ccls/document_type_test.rb +35 -0
  203. data/test/unit/ccls/document_version_test.rb +68 -0
  204. data/test/unit/ccls/enrollment_test.rb +575 -0
  205. data/test/unit/ccls/follow_up_test.rb +23 -0
  206. data/test/unit/ccls/follow_up_type_test.rb +34 -0
  207. data/test/unit/ccls/gift_card_search_test.rb +153 -0
  208. data/test/unit/ccls/gift_card_test.rb +40 -0
  209. data/test/unit/ccls/home_exposure_response_test.rb +83 -0
  210. data/test/unit/ccls/homex_outcome_test.rb +199 -0
  211. data/test/unit/ccls/hospital_test.rb +102 -0
  212. data/test/unit/ccls/icf_master_id_test.rb +30 -0
  213. data/test/unit/ccls/icf_master_tracker_change_test.rb +14 -0
  214. data/test/unit/ccls/icf_master_tracker_test.rb +132 -0
  215. data/test/unit/ccls/icf_master_tracker_update_test.rb +176 -0
  216. data/test/unit/ccls/ineligible_reason_test.rb +48 -0
  217. data/test/unit/ccls/instrument_test.rb +62 -0
  218. data/test/unit/ccls/instrument_type_test.rb +39 -0
  219. data/test/unit/ccls/instrument_version_test.rb +71 -0
  220. data/test/unit/ccls/interview_method_test.rb +44 -0
  221. data/test/unit/ccls/interview_outcome_test.rb +34 -0
  222. data/test/unit/ccls/interview_test.rb +298 -0
  223. data/test/unit/ccls/language_test.rb +47 -0
  224. data/test/unit/ccls/live_birth_data_update_test.rb +358 -0
  225. data/test/unit/ccls/operational_event_test.rb +187 -0
  226. data/test/unit/ccls/operational_event_type_test.rb +51 -0
  227. data/test/unit/ccls/organization_test.rb +64 -0
  228. data/test/unit/ccls/patient_test.rb +538 -0
  229. data/test/unit/ccls/person_test.rb +55 -0
  230. data/test/unit/ccls/phone_number_test.rb +244 -0
  231. data/test/unit/ccls/phone_type_test.rb +32 -0
  232. data/test/unit/ccls/project_outcome_test.rb +34 -0
  233. data/test/unit/ccls/project_test.rb +60 -0
  234. data/test/unit/ccls/race_test.rb +37 -0
  235. data/test/unit/ccls/refusal_reason_test.rb +52 -0
  236. data/test/unit/ccls/role_test.rb +26 -0
  237. data/test/unit/ccls/sample_kit_test.rb +35 -0
  238. data/test/unit/ccls/sample_outcome_test.rb +34 -0
  239. data/test/unit/ccls/sample_temperature_test.rb +25 -0
  240. data/test/unit/ccls/sample_test.rb +363 -0
  241. data/test/unit/ccls/sample_type_test.rb +58 -0
  242. data/test/unit/ccls/section_test.rb +34 -0
  243. data/test/unit/ccls/state_test.rb +31 -0
  244. data/test/unit/ccls/study_subject_abstracts_test.rb +115 -0
  245. data/test/unit/ccls/study_subject_addresses_test.rb +93 -0
  246. data/test/unit/ccls/study_subject_duplicates_test.rb +407 -0
  247. data/test/unit/ccls/study_subject_enrollments_test.rb +65 -0
  248. data/test/unit/ccls/study_subject_homex_outcome_test.rb +64 -0
  249. data/test/unit/ccls/study_subject_identifier_test.rb +439 -0
  250. data/test/unit/ccls/study_subject_interviews_test.rb +26 -0
  251. data/test/unit/ccls/study_subject_languages_test.rb +142 -0
  252. data/test/unit/ccls/study_subject_operational_events_test.rb +53 -0
  253. data/test/unit/ccls/study_subject_patient_test.rb +249 -0
  254. data/test/unit/ccls/study_subject_pii_test.rb +278 -0
  255. data/test/unit/ccls/study_subject_races_test.rb +203 -0
  256. data/test/unit/ccls/study_subject_search_test.rb +704 -0
  257. data/test/unit/ccls/study_subject_test.rb +770 -0
  258. data/test/unit/ccls/subject_language_test.rb +43 -0
  259. data/test/unit/ccls/subject_race_test.rb +35 -0
  260. data/test/unit/ccls/subject_relationship_test.rb +43 -0
  261. data/test/unit/ccls/subject_type_test.rb +40 -0
  262. data/test/unit/ccls/tracing_status_test.rb +32 -0
  263. data/test/unit/ccls/transfer_test.rb +81 -0
  264. data/test/unit/ccls/translation_table_test.rb +40 -0
  265. data/test/unit/ccls/unit_test.rb +21 -0
  266. data/test/unit/ccls/user_test.rb +156 -0
  267. data/test/unit/ccls/vital_status_test.rb +36 -0
  268. data/test/unit/ccls/zip_code_test.rb +55 -0
  269. metadata +633 -0
@@ -0,0 +1,182 @@
1
+ = CCLS Engine
2
+
3
+ This is a gem, basic rails app and plugin/engine (GRAPE).
4
+ As a gem, it shares functionality and access to the shared database.
5
+ As an app, it is used to manage the migrations of the shared database.
6
+ It is no longer really used as a plugin, but does contain the
7
+ relevant features of an 'engine' including models, controllers,
8
+ views and routes to the aforementioned resources.
9
+
10
+
11
+ == Development Notes
12
+
13
+ As this code is stored in publicly accessible repositories,
14
+ DO NOT UNDER ANY CIRCUMSTANCES PUT ANY REAL SUBJECT DATA IN THE CODE!
15
+
16
+ The models in this gem are stored in a shared database, therefore, the migrations
17
+ that create and modify it, as well as the ActiveRecord models that use it must
18
+ reflect this. Currently, the models which are normally subclasses of ActiveRecord::Base
19
+ need to now by subclasses of ActiveRecordShared. The migrations, normally subclasses
20
+ of ActiveRecord::Migration, need to be subclasses of SharedMigration.
21
+
22
+
23
+
24
+ Several errors I get on my MacBook when running rake test:coverage that I don't get running autotest,
25
+ I also don't get these on my Mac Pro ???
26
+
27
+ (See full trace by running task with --trace)
28
+ jake@mbp-3 : ccls_engine 555> ruby -v
29
+ ruby 1.8.7 (2010-08-16 patchlevel 302) [i686-darwin9.8.0]
30
+
31
+ ArgumentError: wrong number of arguments (1 for 0)
32
+ app/models/search.rb:183:in `flatten'
33
+ app/models/search.rb:183:in `having_options'
34
+ app/models/search.rb:175:in `having'
35
+ app/models/study_subject_search.rb:46:in `study_subjects'
36
+
37
+ ArgumentError: odd number of arguments for Hash
38
+ app/models/abstract.rb:301:in `[]'
39
+ app/models/abstract.rb:301:in `comparable_attributes'
40
+ app/models/abstract.rb:309:in `diff'
41
+ app/models/abstract.rb:305:in `is_the_same_as?'
42
+
43
+ Ccls/Pii should return join of mother's name: .
44
+ DEPRECATION WARNING: String#chars has been deprecated in favor of String#mb_chars. (called from initials at /Users/jake/github_repo/ccls/ccls_engine/app/models/pii.rb:57)
45
+
46
+ test_@@_should_get_new_with_superuser_login(Ccls::RefusalReasonsControllerTest):
47
+ ActionView::TemplateError: undefined method `find_index' for [:code]:Array
48
+ On line #4 of app/views/refusal_reasons/_form.html.erb
49
+
50
+
51
+
52
+ ===Some general ActiveRecord model notes:
53
+
54
+ Don't have validations that could raise errors that the user can't do anything about.
55
+
56
+ When using validates_presence_of, use allow_blank => true on other validations to avoid multiple errors if blank.
57
+
58
+ When validating the presence of associations, validate on foreign key rather than association so that the error shows up correctly in view. Unfortunately, this will not guarantee that an association actually exists with that id as it would if the validation was on the association.
59
+
60
+ validates_presence_of :project ( will not raise error on project_id so in the view, the project_id selector won't have an error and so won't be highlighted like other errors will be.)
61
+ validates_presence_of :project_id ( will not ensure that an actual project for the given id exists, but will show the error correctly in the view. )
62
+
63
+ I would like to have a validation that ensures that the _id is legitimate. I do not think that validates_associated is what I want. Having the both does what I want, but then the view will show "Project is blank" twice.
64
+
65
+
66
+ This seems to work ...
67
+ validates_presence_of :project, :if => :project_id
68
+ validates_presence_of :project_id
69
+ ... but is a bit of a misnomer. The association validation will raise a 'blank' error, rather than a more appropriate 'non-existant' error, although the message could be altered.
70
+
71
+
72
+ Still some models and associations may need done due to priorities and the fact that some never end up in a view and the association may be problematic. (Aliquot,HomexOutcome,Patient)
73
+
74
+
75
+ ===Some general ActiveSupport::TestCase unit test notes:
76
+
77
+ Most, if not all, of the 'class level' assertions are defined in ccls-common_lib.
78
+ They call 'create_object', which, unless explicitly defined, is handled in a
79
+ method_missing handler which extracts the model name from the testing class
80
+ and uses the factory of the same name. (ie. AbstractTest -> Factory(:abstract) )
81
+ In addition, this same method missing handler is used for handling undefined
82
+ methods like 'create_abstract'. The handler takes this method which
83
+ matches /create_(.*)/ and calls a Factory($1)
84
+
85
+ Also note, create_object only works in unit tests as they are generally associated
86
+ with a particular model. Controllers, on the other hand, do not share this
87
+ privilege as they are not. The create_MODEL_NAME technique does still work.
88
+
89
+ These create_* methods call Factory.build and then save.
90
+ This is predominantly because by default Factory uses create! which raises
91
+ errors rather than returning false which makes testing the error difficult.
92
+ I think that there is a way to set the "default_strategy" for factory_girl,
93
+ but I've yet to figure that out.
94
+
95
+
96
+
97
+ == Required Gem Sources
98
+
99
+ gem sources -a http://rubygems.org
100
+ gem sources -a http://gems.github.com
101
+
102
+ == Required Gems
103
+
104
+ * rails ~> 2
105
+ * jrails
106
+ * chronic # trying to remove
107
+ * ruby-hmac
108
+ * ssl_requirement
109
+ * ryanb-acts-as-list
110
+ * RedCloth # may not use this anymore
111
+ * {ccls-common_lib}[http://github.com/ccls/common_lib]
112
+ * {ccls-calnet_authenticated}[http://github.com/ccls/calnet_authenticated]
113
+ * {ccls-simply_authorized}[http://github.com/ccls/simply_authorized]
114
+ * {ccls-use_db}[http://github.com/ccls/use_db]
115
+
116
+ == Installation (as a gem/plugin/engine)
117
+
118
+ In your config/environment.rb
119
+
120
+ config.gem 'ccls-ccls_engine'
121
+
122
+
123
+ Generate an initializer and copy in some files.
124
+
125
+ script/generate ccls_engine
126
+
127
+ ( why don't I copy in these yml files, or at least their examples? )
128
+
129
+
130
+ Also need to manually add a shared_database.yml with matching configuration.
131
+
132
+ cp config/shared_database.yml.example config/shared_database.yml
133
+
134
+
135
+ == Production Installation
136
+
137
+ Initial database setup (should already be done so don't do this)
138
+
139
+ drop the shared production database
140
+ create the shared production database
141
+ rake db:migrate RAILS_ENV=production
142
+
143
+ # import all the test AND production fixtures
144
+ rake ccls:full_update RAILS_ENV=production
145
+
146
+ # DESTRUCTIVE. Destroy existing data and parse the csv
147
+ # files on the "S Drive". These tasks should be
148
+ # commented out to prevent this from happening.
149
+ rake odms_import:csv_data
150
+
151
+
152
+
153
+ == Production Updating
154
+
155
+ git pull
156
+ # No longer uses the Gemfile as it meddled with the gem creation.
157
+ # Should link the Gemfile.tmp to Gemfile in home dir.
158
+ bundle update
159
+ rake db:migrate RAILS_ENV=production
160
+
161
+
162
+ == Testing
163
+
164
+ rake db:migrate
165
+ rake test and/or autotest
166
+
167
+
168
+ == Gemified with Jeweler
169
+
170
+ vi Rakefile
171
+ rake version:write
172
+
173
+ rake version:bump:patch
174
+ rake version:bump:minor
175
+ rake version:bump:major
176
+
177
+ rake gemspec
178
+
179
+ rake install
180
+ rake release
181
+
182
+ Copyright (c) 2010 [Jake Wendt], released under the MIT license
@@ -0,0 +1,181 @@
1
+ # Abstract model
2
+ class Abstract < ActiveRecordShared
3
+
4
+ belongs_to :study_subject, :counter_cache => true
5
+
6
+ with_options :class_name => 'User', :primary_key => 'uid' do |u|
7
+ u.belongs_to :entry_1_by, :foreign_key => 'entry_1_by_uid'
8
+ u.belongs_to :entry_2_by, :foreign_key => 'entry_2_by_uid'
9
+ u.belongs_to :merged_by, :foreign_key => 'merged_by_uid'
10
+ end
11
+
12
+ include AbstractValidations
13
+
14
+ attr_protected :study_subject_id, :study_subject
15
+ attr_protected :entry_1_by_uid
16
+ attr_protected :entry_2_by_uid
17
+ attr_protected :merged_by_uid
18
+
19
+ attr_accessor :current_user
20
+ attr_accessor :weight_units, :height_units
21
+ attr_accessor :merging # flag to be used to skip 2 abstract limitation
22
+
23
+ # The :on => :create doesn't seem to work as described
24
+ # validate_on_create is technically deprecated, but still works
25
+ validate_on_create :subject_has_less_than_three_abstracts #, :on => :create
26
+ validate_on_create :subject_has_no_merged_abstract #, :on => :create
27
+
28
+ before_create :set_user
29
+ after_create :delete_unmerged
30
+ before_save :convert_height_to_cm
31
+ before_save :convert_weight_to_kg
32
+ before_save :set_days_since_fields
33
+
34
+ def self.fields
35
+ # db: db field name
36
+ # human: humanized field
37
+ @@fields ||= YAML::load( ERB.new( IO.read(
38
+ File.join(File.dirname(__FILE__),'../../config/abstract_fields.yml')
39
+ )).result)
40
+ end
41
+
42
+ def fields
43
+ Abstract.fields
44
+ end
45
+
46
+ def self.db_fields
47
+ # @db_fields ||= fields.collect{|f|f[:db]}
48
+ Abstract.fields.collect{|f|f[:db]}
49
+ end
50
+
51
+ def db_fields
52
+ Abstract.db_fields
53
+ end
54
+
55
+ def comparable_attributes
56
+ HashWithIndifferentAccess[attributes.select {|k,v| db_fields.include?(k)}]
57
+ end
58
+
59
+ def is_the_same_as?(another_abstract)
60
+ self.diff(another_abstract).blank?
61
+ end
62
+
63
+ def diff(another_abstract)
64
+ a1 = self.comparable_attributes
65
+ a2 = Abstract.find(another_abstract).comparable_attributes
66
+ HashWithIndifferentAccess[a1.select{|k,v| a2[k] != v unless( a2[k].blank? && v.blank? ) }]
67
+ end
68
+
69
+ # include AbstractSearch
70
+ def self.search(params={})
71
+ # TODO stop using this. Now that study subjects and abstracts are in
72
+ # the same database, this should be simplified. Particularly since
73
+ # the only searching is really on the study subject and not the abstract.
74
+ AbstractSearch.new(params).abstracts
75
+ end
76
+
77
+ def self.sections
78
+ # :label: Cytogenetics
79
+ # :controller: CytogeneticsController
80
+ # :edit: :edit_abstract_cytogenetic_path
81
+ # :show: :abstract_cytogenetic_path
82
+ @@sections ||= YAML::load(ERB.new( IO.read(
83
+ File.join(File.dirname(__FILE__),'../../config/abstract_sections.yml')
84
+ )).result)
85
+ end
86
+
87
+ def merged?
88
+ !merged_by_uid.blank?
89
+ end
90
+
91
+ protected
92
+
93
+ def set_days_since_fields
94
+ # must explicitly convert these DateTimes to Date so that the
95
+ # difference is in days and not seconds
96
+ # I really only need to do this if something changes,
97
+ # but for now, just do it and make sure that
98
+ # it is tested. Optimize and refactor later.
99
+ unless diagnosed_on.nil?
100
+ self.response_day_7_days_since_diagnosis = (
101
+ response_report_on_day_7.to_date - diagnosed_on.to_date
102
+ ) unless response_report_on_day_7.nil?
103
+ self.response_day_14_days_since_diagnosis = (
104
+ response_report_on_day_14.to_date - diagnosed_on.to_date
105
+ ) unless response_report_on_day_14.nil?
106
+ self.response_day_28_days_since_diagnosis = (
107
+ response_report_on_day_28.to_date - diagnosed_on.to_date
108
+ ) unless response_report_on_day_28.nil?
109
+ end
110
+ unless treatment_began_on.nil?
111
+ self.response_day_7_days_since_treatment_began = (
112
+ response_report_on_day_7.to_date - treatment_began_on.to_date
113
+ ) unless response_report_on_day_7.nil?
114
+ self.response_day_14_days_since_treatment_began = (
115
+ response_report_on_day_14.to_date - treatment_began_on.to_date
116
+ ) unless response_report_on_day_14.nil?
117
+ self.response_day_28_days_since_treatment_began = (
118
+ response_report_on_day_28.to_date - treatment_began_on.to_date
119
+ ) unless response_report_on_day_28.nil?
120
+ end
121
+ end
122
+
123
+ def convert_height_to_cm
124
+ if( !height_units.nil? && height_units.match(/in/i) )
125
+ self.height_units = nil
126
+ self.height_at_diagnosis *= 2.54
127
+ end
128
+ end
129
+
130
+ def convert_weight_to_kg
131
+ if( !weight_units.nil? && weight_units.match(/lb/i) )
132
+ self.weight_units = nil
133
+ self.weight_at_diagnosis /= 2.2046
134
+ end
135
+ end
136
+
137
+ # Set user if given
138
+ def set_user
139
+ if study_subject
140
+ # because it is possible to create the first, then the second
141
+ # and then delete the first, and create another, first and
142
+ # second kinda lose their meaning until the merge, so set them
143
+ # both as the same until the merge
144
+ case study_subject.abstracts_count
145
+ when 0
146
+ self.entry_1_by_uid = current_user.try(:uid)||0
147
+ self.entry_2_by_uid = current_user.try(:uid)||0
148
+ when 1
149
+ self.entry_1_by_uid = current_user.try(:uid)||0
150
+ self.entry_2_by_uid = current_user.try(:uid)||0
151
+ when 2
152
+ abs = study_subject.abstracts
153
+ # compact just in case a nil crept in
154
+ self.entry_1_by_uid = [abs[0].entry_1_by_uid,abs[0].entry_2_by_uid].compact.first
155
+ self.entry_2_by_uid = [abs[1].entry_1_by_uid,abs[1].entry_2_by_uid].compact.first
156
+ self.merged_by_uid = current_user.try(:uid)||0
157
+ end
158
+ end
159
+ end
160
+
161
+ def delete_unmerged
162
+ if study_subject and !merged_by_uid.blank?
163
+ # use delete and not destroy to preserve the abstracts_count
164
+ study_subject.unmerged_abstracts.each{|a|a.delete}
165
+ end
166
+ end
167
+
168
+ def subject_has_less_than_three_abstracts
169
+ # because this abstract hasn't been created yet, we're comparing to 2, not 3
170
+ if study_subject and study_subject.abstracts_count >= 2
171
+ errors.add(:study_subject_id,"Study Subject can only have 2 abstracts." ) unless merging
172
+ end
173
+ end
174
+
175
+ def subject_has_no_merged_abstract
176
+ if study_subject and study_subject.merged_abstract
177
+ errors.add(:study_subject_id,"Study Subject already has a merged abstract." )
178
+ end
179
+ end
180
+
181
+ end
@@ -0,0 +1,50 @@
1
+
2
+ # This is only used in the Abstract app and only seems to use :merged
3
+ # Everything else is unused.
4
+
5
+ class AbstractSearch < Search
6
+
7
+ self.searchable_attributes += [ :q, :merged ]
8
+
9
+ self.valid_orders = self.valid_orders.merge({
10
+ :id => 'abstracts.id'
11
+ })
12
+
13
+ def abstracts
14
+ @abstracts ||= Abstract.send(
15
+ (paginate?)?'paginate':'all',{
16
+ :order => search_order,
17
+ :joins => joins,
18
+ :conditions => conditions
19
+ }.merge(
20
+ (paginate?)?{
21
+ :per_page => per_page||25,
22
+ :page => page||1
23
+ }:{}
24
+ )
25
+ )
26
+ end
27
+
28
+ private # THIS IS REQUIRED
29
+
30
+ def merged_conditions
31
+ # TODO what if merged is false?
32
+ ['abstracts.merged_by_uid IS NOT NULL'] unless merged.blank?
33
+ end
34
+
35
+ # Certainly not the fastest way, but quite possibly the only way
36
+ # to search against study_subjects being in a separate database.
37
+ #
38
+ # TODO StudySubjects are now in the same database as the Abstracts so
39
+ # this unnecessarily complicated searching should be removed.
40
+ #
41
+ def study_subjects_conditions
42
+ unless q.blank?
43
+ study_subjects = StudySubject.search(:q => q, :paginate => false)
44
+ study_subject_ids = study_subjects.collect(&:id)
45
+ ['abstracts.study_subject_id IN (:study_subject_ids)',
46
+ { :study_subject_ids => study_subject_ids } ]
47
+ end
48
+ end
49
+
50
+ end
@@ -0,0 +1,324 @@
1
+ #
2
+ # Simply extracted some code to clean up model.
3
+ # I'd like to do this to all of the really big classes
4
+ # but let's see how this goes first.
5
+ #
6
+ module AbstractValidations
7
+ def self.included(base)
8
+ # Must delay the calls to these ActiveRecord methods
9
+ # or it will raise many "undefined method"s.
10
+ base.class_eval do
11
+
12
+ with_options :allow_blank => true do |b|
13
+ b.with_options :maximum => 2 do |o|
14
+ o.validates_length_of( :response_classification_day_14 )
15
+ o.validates_length_of( :response_classification_day_28 )
16
+ o.validates_length_of( :response_classification_day_7 )
17
+ end
18
+ b.with_options :maximum => 3 do |o|
19
+ o.validates_length_of( :cytogen_chromosome_number )
20
+ end
21
+ b.with_options :maximum => 4 do |o|
22
+ o.validates_length_of( :flow_cyto_other_marker_1 )
23
+ o.validates_length_of( :flow_cyto_other_marker_2 )
24
+ o.validates_length_of( :flow_cyto_other_marker_3 )
25
+ o.validates_length_of( :flow_cyto_other_marker_4 )
26
+ o.validates_length_of( :flow_cyto_other_marker_5 )
27
+ o.validates_length_of( :response_other1_value_day_14 )
28
+ o.validates_length_of( :response_other1_value_day_7 )
29
+ o.validates_length_of( :response_other2_value_day_14 )
30
+ o.validates_length_of( :response_other2_value_day_7 )
31
+ o.validates_length_of( :response_other3_value_day_14 )
32
+ o.validates_length_of( :response_other4_value_day_14 )
33
+ o.validates_length_of( :response_other5_value_day_14 )
34
+ end
35
+ b.with_options :maximum => 5 do |o|
36
+ o.validates_length_of( :normal_cytogen )
37
+ o.validates_length_of( :is_cytogen_hosp_fish_t1221_done )
38
+ o.validates_length_of( :is_karyotype_normal )
39
+ o.validates_length_of( :physical_neuro )
40
+ o.validates_length_of( :physical_other_soft_2 )
41
+ o.validates_length_of( :physical_gingival )
42
+ o.validates_length_of( :physical_leukemic_skin )
43
+ o.validates_length_of( :physical_lymph )
44
+ o.validates_length_of( :physical_spleen )
45
+ o.validates_length_of( :physical_testicle )
46
+ o.validates_length_of( :physical_other_soft )
47
+ o.validates_length_of( :is_hypodiploid )
48
+ o.validates_length_of( :is_hyperdiploid )
49
+ o.validates_length_of( :is_diploid )
50
+ o.validates_length_of( :dna_index )
51
+ o.validates_length_of( :cytogen_is_hyperdiploidy )
52
+ end
53
+ b.with_options :maximum => 9 do |o|
54
+ o.validates_length_of( :cytogen_t1221 )
55
+ o.validates_length_of( :cytogen_inv16 )
56
+ o.validates_length_of( :cytogen_t119 )
57
+ o.validates_length_of( :cytogen_t821 )
58
+ o.validates_length_of( :cytogen_t1517 )
59
+ end
60
+ b.with_options :maximum => 10 do |o|
61
+ o.validates_length_of( :response_cd10_day_14 )
62
+ o.validates_length_of( :response_cd10_day_7 )
63
+ o.validates_length_of( :response_cd13_day_14 )
64
+ o.validates_length_of( :response_cd13_day_7 )
65
+ o.validates_length_of( :response_cd14_day_14 )
66
+ o.validates_length_of( :response_cd14_day_7 )
67
+ o.validates_length_of( :response_cd15_day_14 )
68
+ o.validates_length_of( :response_cd15_day_7 )
69
+ o.validates_length_of( :response_cd19_day_14 )
70
+ o.validates_length_of( :response_cd19_day_7 )
71
+ o.validates_length_of( :response_cd19cd10_day_14 )
72
+ o.validates_length_of( :response_cd19cd10_day_7 )
73
+ o.validates_length_of( :response_cd1a_day_14 )
74
+ o.validates_length_of( :response_cd2a_day_14 )
75
+ o.validates_length_of( :response_cd20_day_14 )
76
+ o.validates_length_of( :response_cd20_day_7 )
77
+ o.validates_length_of( :response_cd3a_day_14 )
78
+ o.validates_length_of( :response_cd3_day_7 )
79
+ o.validates_length_of( :response_cd33_day_14 )
80
+ o.validates_length_of( :response_cd33_day_7 )
81
+ o.validates_length_of( :response_cd34_day_14 )
82
+ o.validates_length_of( :response_cd34_day_7 )
83
+ o.validates_length_of( :response_cd4a_day_14 )
84
+ o.validates_length_of( :response_cd5a_day_14 )
85
+ o.validates_length_of( :response_cd56_day_14 )
86
+ o.validates_length_of( :response_cd61_day_14 )
87
+ o.validates_length_of( :response_cd7a_day_14 )
88
+ o.validates_length_of( :response_cd8a_day_14 )
89
+ o.validates_length_of( :flow_cyto_cd10 )
90
+ o.validates_length_of( :flow_cyto_igm )
91
+ o.validates_length_of( :flow_cyto_bm_kappa )
92
+ o.validates_length_of( :flow_cyto_bm_lambda )
93
+ o.validates_length_of( :flow_cyto_cd10_19 )
94
+ o.validates_length_of( :flow_cyto_cd19 )
95
+ o.validates_length_of( :flow_cyto_cd20 )
96
+ o.validates_length_of( :flow_cyto_cd21 )
97
+ o.validates_length_of( :flow_cyto_cd22 )
98
+ o.validates_length_of( :flow_cyto_cd23 )
99
+ o.validates_length_of( :flow_cyto_cd24 )
100
+ o.validates_length_of( :flow_cyto_cd40 )
101
+ o.validates_length_of( :flow_cyto_surface_ig )
102
+ o.validates_length_of( :flow_cyto_cd1a )
103
+ o.validates_length_of( :flow_cyto_cd2 )
104
+ o.validates_length_of( :flow_cyto_cd3 )
105
+ o.validates_length_of( :flow_cyto_cd4 )
106
+ o.validates_length_of( :flow_cyto_cd5 )
107
+ o.validates_length_of( :flow_cyto_cd7 )
108
+ o.validates_length_of( :flow_cyto_cd8 )
109
+ o.validates_length_of( :flow_cyto_cd3_cd4 )
110
+ o.validates_length_of( :flow_cyto_cd3_cd8 )
111
+ o.validates_length_of( :flow_cyto_cd11b )
112
+ o.validates_length_of( :flow_cyto_cd11c )
113
+ o.validates_length_of( :flow_cyto_cd13 )
114
+ o.validates_length_of( :flow_cyto_cd15 )
115
+ o.validates_length_of( :flow_cyto_cd33 )
116
+ o.validates_length_of( :flow_cyto_cd41 )
117
+ o.validates_length_of( :flow_cyto_cdw65 )
118
+ o.validates_length_of( :flow_cyto_cd34 )
119
+ o.validates_length_of( :flow_cyto_cd61 )
120
+ o.validates_length_of( :flow_cyto_cd14 )
121
+ o.validates_length_of( :flow_cyto_glycoa )
122
+ o.validates_length_of( :flow_cyto_cd16 )
123
+ o.validates_length_of( :flow_cyto_cd56 )
124
+ o.validates_length_of( :flow_cyto_cd57 )
125
+ o.validates_length_of( :flow_cyto_cd9 )
126
+ o.validates_length_of( :flow_cyto_cd25 )
127
+ o.validates_length_of( :flow_cyto_cd38 )
128
+ o.validates_length_of( :flow_cyto_cd45 )
129
+ o.validates_length_of( :flow_cyto_cd71 )
130
+ o.validates_length_of( :flow_cyto_tdt )
131
+ o.validates_length_of( :flow_cyto_hladr )
132
+ o.validates_length_of( :response_hladr_day_14 )
133
+ o.validates_length_of( :response_hladr_day_7 )
134
+ o.validates_length_of( :response_tdt_day_14 )
135
+ o.validates_length_of( :response_tdt_day_7 )
136
+ end
137
+ b.with_options :maximum => 15 do |o|
138
+ o.validates_length_of( :response_blasts_units_day_14 )
139
+ o.validates_length_of( :response_blasts_units_day_28 )
140
+ o.validates_length_of( :response_blasts_units_day_7 )
141
+ o.validates_length_of( :other_dna_measure )
142
+ o.validates_length_of( :response_fab_subtype )
143
+ end
144
+ b.with_options :maximum => 20 do |o|
145
+ o.validates_length_of( :flow_cyto_other_marker_1_name )
146
+ o.validates_length_of( :flow_cyto_other_marker_2_name )
147
+ o.validates_length_of( :flow_cyto_other_marker_3_name )
148
+ o.validates_length_of( :flow_cyto_other_marker_4_name )
149
+ o.validates_length_of( :flow_cyto_other_marker_5_name )
150
+ end
151
+ b.with_options :maximum => 25 do |o|
152
+ o.validates_length_of( :response_other1_name_day_14 )
153
+ o.validates_length_of( :response_other1_name_day_7 )
154
+ o.validates_length_of( :response_other2_name_day_14 )
155
+ o.validates_length_of( :response_other2_name_day_7 )
156
+ o.validates_length_of( :response_other3_name_day_14 )
157
+ o.validates_length_of( :response_other4_name_day_14 )
158
+ o.validates_length_of( :response_other5_name_day_14 )
159
+ end
160
+ b.with_options :maximum => 35 do |o|
161
+ o.validates_length_of( :cytogen_other_trans_1 )
162
+ o.validates_length_of( :cytogen_other_trans_2 )
163
+ o.validates_length_of( :cytogen_other_trans_3 )
164
+ o.validates_length_of( :cytogen_other_trans_4 )
165
+ o.validates_length_of( :cytogen_other_trans_5 )
166
+ o.validates_length_of( :cytogen_other_trans_6 )
167
+ o.validates_length_of( :cytogen_other_trans_7 )
168
+ o.validates_length_of( :cytogen_other_trans_8 )
169
+ o.validates_length_of( :cytogen_other_trans_9 )
170
+ o.validates_length_of( :cytogen_other_trans_10 )
171
+ end
172
+ b.with_options :maximum => 50 do |o|
173
+ o.validates_length_of( :flow_cyto_igm_text )
174
+ o.validates_length_of( :flow_cyto_bm_kappa_text )
175
+ o.validates_length_of( :flow_cyto_bm_lambda_text )
176
+ o.validates_length_of( :flow_cyto_cd10_19_text )
177
+ o.validates_length_of( :flow_cyto_cd10_text )
178
+ o.validates_length_of( :flow_cyto_cd19_text )
179
+ o.validates_length_of( :flow_cyto_cd20_text )
180
+ o.validates_length_of( :flow_cyto_cd21_text )
181
+ o.validates_length_of( :flow_cyto_cd22_text )
182
+ o.validates_length_of( :flow_cyto_cd23_text )
183
+ o.validates_length_of( :flow_cyto_cd24_text )
184
+ o.validates_length_of( :flow_cyto_cd40_text )
185
+ o.validates_length_of( :flow_cyto_surface_ig_text )
186
+ o.validates_length_of( :flow_cyto_cd1a_text )
187
+ o.validates_length_of( :flow_cyto_cd2_text )
188
+ o.validates_length_of( :flow_cyto_cd3_text )
189
+ o.validates_length_of( :flow_cyto_cd4_text )
190
+ o.validates_length_of( :flow_cyto_cd5_text )
191
+ o.validates_length_of( :flow_cyto_cd7_text )
192
+ o.validates_length_of( :flow_cyto_cd8_text )
193
+ o.validates_length_of( :flow_cyto_cd3_cd4_text )
194
+ o.validates_length_of( :flow_cyto_cd3_cd8_text )
195
+ o.validates_length_of( :flow_cyto_cd11b_text )
196
+ o.validates_length_of( :flow_cyto_cd11c_text )
197
+ o.validates_length_of( :flow_cyto_cd13_text )
198
+ o.validates_length_of( :flow_cyto_cd15_text )
199
+ o.validates_length_of( :flow_cyto_cd33_text )
200
+ o.validates_length_of( :flow_cyto_cd41_text )
201
+ o.validates_length_of( :flow_cyto_cdw65_text )
202
+ o.validates_length_of( :flow_cyto_cd34_text )
203
+ o.validates_length_of( :flow_cyto_cd61_text )
204
+ o.validates_length_of( :flow_cyto_cd14_text )
205
+ o.validates_length_of( :flow_cyto_glycoa_text )
206
+ o.validates_length_of( :flow_cyto_cd16_text )
207
+ o.validates_length_of( :flow_cyto_cd56_text )
208
+ o.validates_length_of( :flow_cyto_cd57_text )
209
+ o.validates_length_of( :flow_cyto_cd9_text )
210
+ o.validates_length_of( :flow_cyto_cd25_text )
211
+ o.validates_length_of( :flow_cyto_cd38_text )
212
+ o.validates_length_of( :flow_cyto_cd45_text )
213
+ o.validates_length_of( :flow_cyto_cd71_text )
214
+ o.validates_length_of( :flow_cyto_tdt_text )
215
+ o.validates_length_of( :flow_cyto_hladr_text )
216
+ o.validates_length_of( :flow_cyto_other_marker_1_text )
217
+ o.validates_length_of( :flow_cyto_other_marker_2_text )
218
+ o.validates_length_of( :flow_cyto_other_marker_3_text )
219
+ o.validates_length_of( :flow_cyto_other_marker_4_text )
220
+ o.validates_length_of( :flow_cyto_other_marker_5_text )
221
+ o.validates_length_of( :ucb_fish_results )
222
+ o.validates_length_of( :fab_classification )
223
+ o.validates_length_of( :diagnosis_icdo_number )
224
+ o.validates_length_of( :cytogen_t922 )
225
+ end
226
+ b.with_options :maximum => 55 do |o|
227
+ o.validates_length_of( :diagnosis_icdo_description )
228
+ end
229
+ b.with_options :maximum => 100 do |o|
230
+ o.validates_length_of( :ploidy_comment )
231
+ end
232
+ b.with_options :maximum => 250 do |o|
233
+ o.validates_length_of( :csf_red_blood_count_text )
234
+ o.validates_length_of( :blasts_are_present )
235
+ o.validates_length_of( :peripheral_blood_in_csf )
236
+ o.validates_length_of( :chemo_protocol_report_found )
237
+ o.validates_length_of( :chemo_protocol_name )
238
+ o.validates_length_of( :conventional_karyotype_results )
239
+ o.validates_length_of( :hospital_fish_results )
240
+ o.validates_length_of( :hyperdiploidy_by )
241
+ end
242
+ b.with_options :maximum => 65000 do |o|
243
+ o.validates_length_of( :marrow_biopsy_diagnosis )
244
+ o.validates_length_of( :marrow_aspirate_diagnosis )
245
+ o.validates_length_of( :csf_white_blood_count_text )
246
+ o.validates_length_of( :csf_comment )
247
+ o.validates_length_of( :chemo_protocol_agent_description )
248
+ o.validates_length_of( :chest_imaging_comment )
249
+ o.validates_length_of( :cytogen_comment )
250
+ o.validates_length_of( :discharge_summary )
251
+ o.validates_length_of( :flow_cyto_remarks )
252
+ o.validates_length_of( :response_comment_day_7 )
253
+ o.validates_length_of( :response_comment_day_14 )
254
+ o.validates_length_of( :histo_report_results )
255
+ o.validates_length_of( :response_comment )
256
+ end
257
+ end
258
+
259
+ validates_inclusion_of(
260
+ :cbc_report_found,
261
+ :cerebrospinal_fluid_report_found,
262
+ :chemo_protocol_report_found,
263
+ :chest_ct_medmass_present,
264
+ :chest_imaging_report_found,
265
+ :cytogen_hospital_fish_done,
266
+ :cytogen_karyotype_done,
267
+ :cytogen_report_found,
268
+ :cytogen_trisomy4,
269
+ :cytogen_trisomy5,
270
+ :cytogen_trisomy10,
271
+ :cytogen_trisomy17,
272
+ :cytogen_trisomy21,
273
+ :cytogen_ucb_fish_done,
274
+ :diagnosis_is_all,
275
+ :diagnosis_is_aml,
276
+ :diagnosis_is_b_all,
277
+ :diagnosis_is_cll,
278
+ :diagnosis_is_cml,
279
+ :diagnosis_is_other,
280
+ :diagnosis_is_t_all,
281
+ :discharge_summary_found,
282
+ :flow_cyto_num_results_available,
283
+ :flow_cyto_report_found,
284
+ :h_and_p_reports_found,
285
+ :hepatomegaly_present,
286
+ :histo_report_found,
287
+ :is_down_syndrome_phenotype,
288
+ :marrow_aspirate_report_found,
289
+ :marrow_biopsy_report_found,
290
+ :mediastinal_mass_present,
291
+ :patient_on_chemo_protocol,
292
+ :ploidy_report_found,
293
+ :received_bone_marrow_aspirate,
294
+ :received_bone_marrow_biopsy,
295
+ :received_cbc,
296
+ :received_chemo_protocol,
297
+ :received_chest_ct,
298
+ :received_chest_xray,
299
+ :received_csf,
300
+ :received_cytogenetics,
301
+ :received_discharge_summary,
302
+ :received_flow_cytometry,
303
+ :received_hla_typing,
304
+ :received_h_and_p,
305
+ :received_other_reports,
306
+ :received_ploidy,
307
+ :received_resp_to_therapy,
308
+ :response_day14or28_flag,
309
+ :response_day30_is_in_remission,
310
+ :response_is_inconclusive_day_7,
311
+ :response_is_inconclusive_day_14,
312
+ :response_is_inconclusive_day_21,
313
+ :response_is_inconclusive_day_28,
314
+ :response_report_found_day_7,
315
+ :response_report_found_day_14,
316
+ :response_report_found_day_28,
317
+ :splenomegaly_present,
318
+ :tdt_often_found_flow_cytometry,
319
+ :tdt_report_found,
320
+ :in => YNDK.valid_values, :allow_nil => true )
321
+
322
+ end # class_eval
323
+ end # included
324
+ end # AbstractValidations