ccls-ccls_engine 3.11.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +182 -0
- data/app/models/abstract.rb +181 -0
- data/app/models/abstract_search.rb +50 -0
- data/app/models/abstract_validations.rb +324 -0
- data/app/models/address.rb +70 -0
- data/app/models/address_type.rb +15 -0
- data/app/models/addressing.rb +147 -0
- data/app/models/aliquot.rb +44 -0
- data/app/models/aliquot_sample_format.rb +13 -0
- data/app/models/analysis.rb +14 -0
- data/app/models/bc_request.rb +20 -0
- data/app/models/candidate_control.rb +101 -0
- data/app/models/context.rb +23 -0
- data/app/models/context_data_source.rb +4 -0
- data/app/models/county.rb +16 -0
- data/app/models/data_source.rb +24 -0
- data/app/models/diagnosis.rb +23 -0
- data/app/models/document_type.rb +16 -0
- data/app/models/document_version.rb +27 -0
- data/app/models/enrollment.rb +78 -0
- data/app/models/enrollment_validations.rb +167 -0
- data/app/models/follow_up.rb +16 -0
- data/app/models/follow_up_type.rb +18 -0
- data/app/models/gift_card.rb +22 -0
- data/app/models/gift_card_search.rb +137 -0
- data/app/models/home_exposure_response.rb +24 -0
- data/app/models/homex_outcome.rb +75 -0
- data/app/models/hospital.rb +22 -0
- data/app/models/icf_master_id.rb +30 -0
- data/app/models/icf_master_tracker.rb +217 -0
- data/app/models/icf_master_tracker_change.rb +9 -0
- data/app/models/icf_master_tracker_update.rb +50 -0
- data/app/models/ineligible_reason.rb +26 -0
- data/app/models/instrument.rb +26 -0
- data/app/models/instrument_type.rb +17 -0
- data/app/models/instrument_version.rb +28 -0
- data/app/models/interview.rb +122 -0
- data/app/models/interview_method.rb +17 -0
- data/app/models/interview_outcome.rb +16 -0
- data/app/models/language.rb +28 -0
- data/app/models/live_birth_data_update.rb +142 -0
- data/app/models/operational_event.rb +99 -0
- data/app/models/operational_event_type.rb +31 -0
- data/app/models/organization.rb +28 -0
- data/app/models/patient.rb +63 -0
- data/app/models/patient_validations.rb +118 -0
- data/app/models/person.rb +28 -0
- data/app/models/phone_number.rb +105 -0
- data/app/models/phone_type.rb +15 -0
- data/app/models/project.rb +39 -0
- data/app/models/project_outcome.rb +19 -0
- data/app/models/race.rb +31 -0
- data/app/models/refusal_reason.rb +23 -0
- data/app/models/sample.rb +168 -0
- data/app/models/sample_kit.rb +14 -0
- data/app/models/sample_outcome.rb +16 -0
- data/app/models/sample_temperature.rb +14 -0
- data/app/models/sample_type.rb +37 -0
- data/app/models/search.rb +195 -0
- data/app/models/section.rb +18 -0
- data/app/models/state.rb +25 -0
- data/app/models/study_subject.rb +237 -0
- data/app/models/study_subject_abstracts.rb +47 -0
- data/app/models/study_subject_addresses.rb +34 -0
- data/app/models/study_subject_associations.rb +38 -0
- data/app/models/study_subject_duplicates.rb +111 -0
- data/app/models/study_subject_enrollments.rb +17 -0
- data/app/models/study_subject_homex_outcome.rb +22 -0
- data/app/models/study_subject_identifier.rb +153 -0
- data/app/models/study_subject_interviews.rb +25 -0
- data/app/models/study_subject_languages.rb +21 -0
- data/app/models/study_subject_operational_events.rb +66 -0
- data/app/models/study_subject_patient.rb +177 -0
- data/app/models/study_subject_pii.rb +74 -0
- data/app/models/study_subject_races.rb +25 -0
- data/app/models/study_subject_search.rb +260 -0
- data/app/models/study_subject_validations.rb +116 -0
- data/app/models/subject_language.rb +11 -0
- data/app/models/subject_race.rb +11 -0
- data/app/models/subject_relationship.rb +21 -0
- data/app/models/subject_type.rb +22 -0
- data/app/models/tracing_status.rb +20 -0
- data/app/models/transfer.rb +40 -0
- data/app/models/unit.rb +14 -0
- data/app/models/vital_status.rb +19 -0
- data/app/models/zip_code.rb +36 -0
- data/config/abstract_fields.yml +1038 -0
- data/config/abstract_sections.yml +77 -0
- data/config/home_exposure_response_fields.yml +583 -0
- data/config/icf_master_tracker_update.yml +56 -0
- data/config/live_birth_data_update.yml +56 -0
- data/config/shared_use_db.yml +4 -0
- data/generators/ccls_engine/USAGE +2 -0
- data/generators/ccls_engine/ccls_engine_generator.rb +123 -0
- data/generators/ccls_engine/templates/autotest_ccls_engine.rb +3 -0
- data/generators/ccls_engine/templates/ccls_engine.rake +12 -0
- data/generators/ccls_engine/templates/fixtures/address_types.yml +30 -0
- data/generators/ccls_engine/templates/fixtures/context_data_sources.yml +54 -0
- data/generators/ccls_engine/templates/fixtures/contexts.yml +19 -0
- data/generators/ccls_engine/templates/fixtures/data_sources.yml +40 -0
- data/generators/ccls_engine/templates/fixtures/diagnoses.yml +40 -0
- data/generators/ccls_engine/templates/fixtures/document_types.yml +65 -0
- data/generators/ccls_engine/templates/fixtures/document_versions.csv +155 -0
- data/generators/ccls_engine/templates/fixtures/follow_up_types.yml +16 -0
- data/generators/ccls_engine/templates/fixtures/hospitals.yml +114 -0
- data/generators/ccls_engine/templates/fixtures/ineligible_reasons.yml +35 -0
- data/generators/ccls_engine/templates/fixtures/instrument_types.yml +26 -0
- data/generators/ccls_engine/templates/fixtures/instrument_versions.yml +22 -0
- data/generators/ccls_engine/templates/fixtures/instruments.yml +22 -0
- data/generators/ccls_engine/templates/fixtures/interview_methods.yml +30 -0
- data/generators/ccls_engine/templates/fixtures/interview_outcomes.yml +31 -0
- data/generators/ccls_engine/templates/fixtures/languages.yml +34 -0
- data/generators/ccls_engine/templates/fixtures/operational_event_types.yml +141 -0
- data/generators/ccls_engine/templates/fixtures/organizations.yml +198 -0
- data/generators/ccls_engine/templates/fixtures/people.yml +130 -0
- data/generators/ccls_engine/templates/fixtures/phone_types.yml +30 -0
- data/generators/ccls_engine/templates/fixtures/project_outcomes.yml +25 -0
- data/generators/ccls_engine/templates/fixtures/projects.yml +59 -0
- data/generators/ccls_engine/templates/fixtures/races.yml +52 -0
- data/generators/ccls_engine/templates/fixtures/refusal_reasons.yml +55 -0
- data/generators/ccls_engine/templates/fixtures/sample_outcomes.yml +36 -0
- data/generators/ccls_engine/templates/fixtures/sample_temperatures.yml +16 -0
- data/generators/ccls_engine/templates/fixtures/sample_types.yml +147 -0
- data/generators/ccls_engine/templates/fixtures/sections.yml +31 -0
- data/generators/ccls_engine/templates/fixtures/states.yml +363 -0
- data/generators/ccls_engine/templates/fixtures/subject_relationships.yml +46 -0
- data/generators/ccls_engine/templates/fixtures/subject_types.yml +30 -0
- data/generators/ccls_engine/templates/fixtures/tracing_statuses.yml +30 -0
- data/generators/ccls_engine/templates/fixtures/units.yml +13 -0
- data/generators/ccls_engine/templates/fixtures/vital_statuses.yml +28 -0
- data/generators/ccls_engine/templates/functional/roles_controller_test.rb +142 -0
- data/generators/ccls_engine/templates/functional/sessions_controller_test.rb +19 -0
- data/generators/ccls_engine/templates/functional/users_controller_test.rb +94 -0
- data/generators/ccls_engine/templates/images/sort_down.png +0 -0
- data/generators/ccls_engine/templates/images/sort_up.png +0 -0
- data/generators/ccls_engine/templates/initializer.rb +28 -0
- data/generators/ccls_engine/templates/javascripts/ccls_engine.js +24 -0
- data/generators/ccls_engine/templates/javascripts/jquery-ui.js +763 -0
- data/generators/ccls_engine/templates/javascripts/jquery.js +154 -0
- data/generators/ccls_engine/templates/javascripts/jrails.js +1 -0
- data/generators/ccls_engine/templates/migrations/create_user_invitations.rb +18 -0
- data/generators/ccls_engine/templates/migrations/create_users.rb +33 -0
- data/generators/ccls_engine/templates/migrations/drop_user_invitations.rb +18 -0
- data/generators/ccls_engine/templates/stylesheets/ccls_engine.css +180 -0
- data/generators/ccls_engine/templates/stylesheets/user.css +35 -0
- data/generators/ccls_engine/templates/stylesheets/users.css +23 -0
- data/generators/ccls_engine/templates/unit/core_extension_test.rb +18 -0
- data/generators/ccls_engine/templates/unit/role_test.rb +30 -0
- data/generators/ccls_engine/templates/unit/user_test.rb +321 -0
- data/lib/ccls-ccls_engine.rb +1 -0
- data/lib/ccls_engine.rb +135 -0
- data/lib/ccls_engine/action_view_extension.rb +3 -0
- data/lib/ccls_engine/action_view_extension/base.rb +53 -0
- data/lib/ccls_engine/action_view_extension/form_builder.rb +39 -0
- data/lib/ccls_engine/active_record_extension.rb +2 -0
- data/lib/ccls_engine/active_record_extension/base.rb +70 -0
- data/lib/ccls_engine/active_record_shared.rb +8 -0
- data/lib/ccls_engine/assertions.rb +69 -0
- data/lib/ccls_engine/autotest.rb +54 -0
- data/lib/ccls_engine/ccls_user.rb +117 -0
- data/lib/ccls_engine/core_extension.rb +14 -0
- data/lib/ccls_engine/date_and_time_formats.rb +30 -0
- data/lib/ccls_engine/factories.rb +880 -0
- data/lib/ccls_engine/factory_test_helper.rb +276 -0
- data/lib/ccls_engine/helper.rb +112 -0
- data/lib/ccls_engine/icf_master_tracker_update_test_helper.rb +121 -0
- data/lib/ccls_engine/live_birth_data_update_test_helper.rb +110 -0
- data/lib/ccls_engine/package_test_helper.rb +49 -0
- data/lib/ccls_engine/shared_database.rb +20 -0
- data/lib/ccls_engine/tasks.rb +1 -0
- data/lib/ccls_engine/test_tasks.rb +52 -0
- data/lib/ccls_engine/translation_table.rb +86 -0
- data/lib/shared_migration.rb +5 -0
- data/lib/surveyor/survey_extensions.rb +125 -0
- data/lib/tasks/application.rake +286 -0
- data/lib/tasks/calnet_authenticated.rake +6 -0
- data/lib/tasks/common_lib.rake +7 -0
- data/lib/tasks/database.rake +288 -0
- data/lib/tasks/documentation.rake +71 -0
- data/lib/tasks/homex_import.rake +723 -0
- data/lib/tasks/odms_import.rake +1116 -0
- data/lib/tasks/simply_authorized.rake +6 -0
- data/lib/tasks/ucb_ccls_engine_tasks.rake +4 -0
- data/lib/tasks/use_db.rake +4 -0
- data/rails/init.rb +4 -0
- data/test/unit/ccls/abstract_search_test.rb +150 -0
- data/test/unit/ccls/abstract_test.rb +674 -0
- data/test/unit/ccls/address_test.rb +155 -0
- data/test/unit/ccls/address_type_test.rb +25 -0
- data/test/unit/ccls/addressing_test.rb +466 -0
- data/test/unit/ccls/aliquot_sample_format_test.rb +20 -0
- data/test/unit/ccls/aliquot_test.rb +156 -0
- data/test/unit/ccls/analysis_test.rb +31 -0
- data/test/unit/ccls/bc_request_test.rb +43 -0
- data/test/unit/ccls/candidate_control_test.rb +712 -0
- data/test/unit/ccls/context_data_source_test.rb +26 -0
- data/test/unit/ccls/context_test.rb +40 -0
- data/test/unit/ccls/core_extension_test.rb +17 -0
- data/test/unit/ccls/county_test.rb +34 -0
- data/test/unit/ccls/data_source_test.rb +41 -0
- data/test/unit/ccls/diagnosis_test.rb +51 -0
- data/test/unit/ccls/document_type_test.rb +35 -0
- data/test/unit/ccls/document_version_test.rb +68 -0
- data/test/unit/ccls/enrollment_test.rb +575 -0
- data/test/unit/ccls/follow_up_test.rb +23 -0
- data/test/unit/ccls/follow_up_type_test.rb +34 -0
- data/test/unit/ccls/gift_card_search_test.rb +153 -0
- data/test/unit/ccls/gift_card_test.rb +40 -0
- data/test/unit/ccls/home_exposure_response_test.rb +83 -0
- data/test/unit/ccls/homex_outcome_test.rb +199 -0
- data/test/unit/ccls/hospital_test.rb +102 -0
- data/test/unit/ccls/icf_master_id_test.rb +30 -0
- data/test/unit/ccls/icf_master_tracker_change_test.rb +14 -0
- data/test/unit/ccls/icf_master_tracker_test.rb +132 -0
- data/test/unit/ccls/icf_master_tracker_update_test.rb +176 -0
- data/test/unit/ccls/ineligible_reason_test.rb +48 -0
- data/test/unit/ccls/instrument_test.rb +62 -0
- data/test/unit/ccls/instrument_type_test.rb +39 -0
- data/test/unit/ccls/instrument_version_test.rb +71 -0
- data/test/unit/ccls/interview_method_test.rb +44 -0
- data/test/unit/ccls/interview_outcome_test.rb +34 -0
- data/test/unit/ccls/interview_test.rb +298 -0
- data/test/unit/ccls/language_test.rb +47 -0
- data/test/unit/ccls/live_birth_data_update_test.rb +358 -0
- data/test/unit/ccls/operational_event_test.rb +187 -0
- data/test/unit/ccls/operational_event_type_test.rb +51 -0
- data/test/unit/ccls/organization_test.rb +64 -0
- data/test/unit/ccls/patient_test.rb +538 -0
- data/test/unit/ccls/person_test.rb +55 -0
- data/test/unit/ccls/phone_number_test.rb +244 -0
- data/test/unit/ccls/phone_type_test.rb +32 -0
- data/test/unit/ccls/project_outcome_test.rb +34 -0
- data/test/unit/ccls/project_test.rb +60 -0
- data/test/unit/ccls/race_test.rb +37 -0
- data/test/unit/ccls/refusal_reason_test.rb +52 -0
- data/test/unit/ccls/role_test.rb +26 -0
- data/test/unit/ccls/sample_kit_test.rb +35 -0
- data/test/unit/ccls/sample_outcome_test.rb +34 -0
- data/test/unit/ccls/sample_temperature_test.rb +25 -0
- data/test/unit/ccls/sample_test.rb +363 -0
- data/test/unit/ccls/sample_type_test.rb +58 -0
- data/test/unit/ccls/section_test.rb +34 -0
- data/test/unit/ccls/state_test.rb +31 -0
- data/test/unit/ccls/study_subject_abstracts_test.rb +115 -0
- data/test/unit/ccls/study_subject_addresses_test.rb +93 -0
- data/test/unit/ccls/study_subject_duplicates_test.rb +407 -0
- data/test/unit/ccls/study_subject_enrollments_test.rb +65 -0
- data/test/unit/ccls/study_subject_homex_outcome_test.rb +64 -0
- data/test/unit/ccls/study_subject_identifier_test.rb +439 -0
- data/test/unit/ccls/study_subject_interviews_test.rb +26 -0
- data/test/unit/ccls/study_subject_languages_test.rb +142 -0
- data/test/unit/ccls/study_subject_operational_events_test.rb +53 -0
- data/test/unit/ccls/study_subject_patient_test.rb +249 -0
- data/test/unit/ccls/study_subject_pii_test.rb +278 -0
- data/test/unit/ccls/study_subject_races_test.rb +203 -0
- data/test/unit/ccls/study_subject_search_test.rb +704 -0
- data/test/unit/ccls/study_subject_test.rb +770 -0
- data/test/unit/ccls/subject_language_test.rb +43 -0
- data/test/unit/ccls/subject_race_test.rb +35 -0
- data/test/unit/ccls/subject_relationship_test.rb +43 -0
- data/test/unit/ccls/subject_type_test.rb +40 -0
- data/test/unit/ccls/tracing_status_test.rb +32 -0
- data/test/unit/ccls/transfer_test.rb +81 -0
- data/test/unit/ccls/translation_table_test.rb +40 -0
- data/test/unit/ccls/unit_test.rb +21 -0
- data/test/unit/ccls/user_test.rb +156 -0
- data/test/unit/ccls/vital_status_test.rb +36 -0
- data/test/unit/ccls/zip_code_test.rb +55 -0
- metadata +633 -0
@@ -0,0 +1,71 @@
|
|
1
|
+
#
|
2
|
+
# This file has been copied from rails
|
3
|
+
# .../rails-2.3.5/lib/tasks/documentation.rake
|
4
|
+
# so that parts of it could be modified.
|
5
|
+
|
6
|
+
namespace :doc do |doc|
|
7
|
+
|
8
|
+
# Rake::RDocTask.new("app") { |rdoc|
|
9
|
+
#
|
10
|
+
# We cannot overwrite or override an RDoc rake task.
|
11
|
+
# Redefining it here actually creates another
|
12
|
+
# of the same name and both are run when
|
13
|
+
# `rake doc:app` is called. The Rakefile
|
14
|
+
# is modified to handle the modifications.
|
15
|
+
#
|
16
|
+
# Actually, that's not entirely true. This would
|
17
|
+
# add another task, but you can remove and override
|
18
|
+
# a task. The rdoc_rails plugin was overriding my
|
19
|
+
# override, which caused all the frustration!!!
|
20
|
+
#
|
21
|
+
# }
|
22
|
+
|
23
|
+
plugins = FileList['vendor/plugins/**'].collect { |plugin|
|
24
|
+
File.basename(plugin) }
|
25
|
+
|
26
|
+
namespace :plugins do
|
27
|
+
# Define doc tasks for each plugin
|
28
|
+
plugins.each do |plugin|
|
29
|
+
|
30
|
+
# clear rails' Rake::Task of the same name
|
31
|
+
Rake::Task[plugin].clear_actions
|
32
|
+
Rake::Task[plugin].clear_prerequisites
|
33
|
+
|
34
|
+
Rake::RDocTask.new(plugin) { |rdoc|
|
35
|
+
plugin_base = "vendor/plugins/#{plugin}"
|
36
|
+
# newer versions of rdoc have problems with rdoc_rails so
|
37
|
+
# until then, comment this out.
|
38
|
+
# ENV['format'] ||= 'railsfish'
|
39
|
+
rdoc.rdoc_dir = "doc/plugins/#{plugin}"
|
40
|
+
rdoc.template = ENV['template'] if ENV['template']
|
41
|
+
rdoc.title = "#{plugin.titlecase} Plugin Documentation"
|
42
|
+
rdoc.options << '--line-numbers'
|
43
|
+
# rdoc.options << '--inline-source'
|
44
|
+
rdoc.options << '--charset' << 'utf-8'
|
45
|
+
# rdoc.options << '--format' << ENV['format']
|
46
|
+
rdoc.rdoc_files.include("#{plugin_base}/lib/**/*.rb")
|
47
|
+
rdoc.rdoc_files.include("#{plugin_base}/app/**/*.rb")
|
48
|
+
|
49
|
+
%w( README README.rdoc ).each do |readme|
|
50
|
+
if File.exist?("#{plugin_base}/#{readme}")
|
51
|
+
rdoc.main = "#{plugin_base}/#{readme}"
|
52
|
+
break
|
53
|
+
end
|
54
|
+
end
|
55
|
+
%w( TODO.org MIT-LICENSE LICENSE CHANGELOG README README.rdoc ).each do |possible_file|
|
56
|
+
if File.exist?("#{plugin_base}/#{possible_file}")
|
57
|
+
rdoc.rdoc_files.include("#{plugin_base}/#{possible_file}")
|
58
|
+
end
|
59
|
+
end
|
60
|
+
}
|
61
|
+
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
task :parse_readme => :environment do
|
66
|
+
require 'rdoc/markup/to_html'
|
67
|
+
h = RDoc::Markup::ToHtml.new
|
68
|
+
puts h.convert( File.read('README.rdoc') )
|
69
|
+
end
|
70
|
+
|
71
|
+
end
|
@@ -0,0 +1,723 @@
|
|
1
|
+
|
2
|
+
|
3
|
+
# 20110214 - Commented out these taks as are destructive
|
4
|
+
# and should never be run anymore.
|
5
|
+
|
6
|
+
# require 'fastercsv'
|
7
|
+
# require 'chronic'
|
8
|
+
#
|
9
|
+
# #BASEDIR = "/Volumes/BUF-Fileshare/SharedFiles/SoftwareDevelopment\(TBD\)/GrantApp/Database/DataLists/jake/"
|
10
|
+
# #BASEDIR = "/Volumes/BUF-Fileshare/RestrictedData/StaffFolders/WendtJake/HomeExposuresImport_20110504/"
|
11
|
+
# BASEDIR = "/Volumes/BUF-Fileshare/SharedFiles/SoftwareDevelopment\(TBD\)/GrantApp/Database/DataLists/HomeExposuresImport_20110504/"
|
12
|
+
#
|
13
|
+
# namespace :homex_destroy do
|
14
|
+
#
|
15
|
+
# desc "Destroy subject and address data"
|
16
|
+
# task :homex_csv_data => :environment do
|
17
|
+
# puts "Destroying existing data"
|
18
|
+
# StudySubject.destroy_all
|
19
|
+
# Enrollment.destroy_all
|
20
|
+
# Addressing.destroy_all
|
21
|
+
# Address.destroy_all
|
22
|
+
# PhoneNumber.destroy_all
|
23
|
+
# Interview.destroy_all
|
24
|
+
# Identifier.destroy_all
|
25
|
+
# Patient.destroy_all
|
26
|
+
# Pii.destroy_all
|
27
|
+
# Sample.destroy_all
|
28
|
+
# SampleKit.destroy_all
|
29
|
+
# Package.destroy_all
|
30
|
+
# HomexOutcome.destroy_all
|
31
|
+
# HomeExposureResponse.destroy_all
|
32
|
+
# end
|
33
|
+
#
|
34
|
+
# end
|
35
|
+
#
|
36
|
+
#
|
37
|
+
# namespace :homex_import do
|
38
|
+
#
|
39
|
+
# desc "Import subject and address data from CSV files"
|
40
|
+
# task :homex_csv_data => [
|
41
|
+
# 'homex_destroy:homex_csv_data',
|
42
|
+
# 'homex_import:homex_identifiers',
|
43
|
+
# 'homex_import:homex_subjects',
|
44
|
+
# 'homex_import:homex_piis',
|
45
|
+
# 'homex_import:homex_enrollments',
|
46
|
+
# 'homex_import:homex_addresses',
|
47
|
+
# 'homex_import:homex_interviews',
|
48
|
+
# 'homex_import:homex_outcomes'
|
49
|
+
# # 'import:subjects',
|
50
|
+
# # 'import:identifiers'
|
51
|
+
# # 'import:piis',
|
52
|
+
# # 'import:enrollments',
|
53
|
+
# # 'import:contacts'
|
54
|
+
# ]
|
55
|
+
#
|
56
|
+
# desc "Import data from homex_identifiers.csv file"
|
57
|
+
# task :homex_identifiers => :environment do
|
58
|
+
# puts "Importing homex_identifiers"
|
59
|
+
#
|
60
|
+
# error_file = File.open('homex_identifiers_errors.txt','w')
|
61
|
+
#
|
62
|
+
# # DO NOT COMMENT OUT THE HEADER LINE OR IT RAISES CRYPTIC ERROR
|
63
|
+
# (f=FasterCSV.open("#{BASEDIR}/homex_identifiers.csv", 'rb',{
|
64
|
+
# :headers => true })).each do |line|
|
65
|
+
# puts "Processing line #{f.lineno}"
|
66
|
+
# puts line
|
67
|
+
#
|
68
|
+
# # "childIDWho","childID","subjectID","familyid","matchingid","PatID",
|
69
|
+
# # "case_control_type","OrderNo","StudyID","newID","subjectType","GBID",
|
70
|
+
# # "lab_no","lab_no_wiemels","IDNO_wiemels","accession_no","state_id_no",
|
71
|
+
# # "studyID_noHyphen","studyID_intOnly_noHyphen","icf_master_id","hospital_no"
|
72
|
+
#
|
73
|
+
# # case_control_type and subjectType are the same
|
74
|
+
#
|
75
|
+
# attributes = {
|
76
|
+
# :childidwho => line['childIDWho'],
|
77
|
+
# :childid => line['childID'],
|
78
|
+
# :subjectid => line['subjectID'],
|
79
|
+
# :familyid => line['familyid'],
|
80
|
+
# :matchingid => line['matchingid'],
|
81
|
+
# :patid => line['PatID'],
|
82
|
+
# :case_control_type => line['case_control_type'],
|
83
|
+
# :orderno => line['OrderNo'],
|
84
|
+
# :studyid => line['StudyID'],
|
85
|
+
# :newid => line['newID'],
|
86
|
+
# :gbid => line['GBID'],
|
87
|
+
# :lab_no => line['lab_no'],
|
88
|
+
# :lab_no_wiemels => line['lab_no_wiemels'],
|
89
|
+
# :idno_wiemels => line['IDNO_wiemels'],
|
90
|
+
# :accession_no => line['accession_no'],
|
91
|
+
# :state_id_no => line['state_id_no'],
|
92
|
+
# :studyid_nohyphen => line['studyID_noHyphen'],
|
93
|
+
# :studyid_intonly_nohyphen => line['studyID_intOnly_noHyphen'],
|
94
|
+
# :icf_master_id => line['icf_master_id']
|
95
|
+
# #
|
96
|
+
# # hospital_no is now in the Patient model
|
97
|
+
# #
|
98
|
+
# # :hospital_no => line['hospital_no']
|
99
|
+
# }
|
100
|
+
# Identifier.create!(attributes)
|
101
|
+
#
|
102
|
+
# # identifier = Identifier.create(attributes)
|
103
|
+
# # if identifier.new_record?
|
104
|
+
# # error_file.puts line
|
105
|
+
# # error_file.puts identifier.errors.full_messages.to_sentence
|
106
|
+
# # error_file.puts
|
107
|
+
# # end
|
108
|
+
#
|
109
|
+
# end # FasterCSV.open
|
110
|
+
# error_file.close
|
111
|
+
# end # task :homex_identifiers => :environment do
|
112
|
+
#
|
113
|
+
#
|
114
|
+
# desc "Import data from homex_subjects.csv file"
|
115
|
+
# task :homex_subjects => :environment do
|
116
|
+
# puts "Importing homex_subjects"
|
117
|
+
#
|
118
|
+
# error_file = File.open('homex_subjects_errors.txt','w')
|
119
|
+
#
|
120
|
+
# # DO NOT COMMENT OUT THE HEADER LINE OR IT RAISES CRYPTIC ERROR
|
121
|
+
# (f=FasterCSV.open("#{BASEDIR}/homex_subjects.csv", 'rb',{
|
122
|
+
# :headers => true })).each do |line|
|
123
|
+
# puts "Processing line #{f.lineno}"
|
124
|
+
# puts line
|
125
|
+
#
|
126
|
+
# # "ChildId","subjectID","reference_date","sex","created_at",
|
127
|
+
# # "vital_status_id","subject_type_id","race_id","DoNotContact"
|
128
|
+
#
|
129
|
+
# created_at = (line['created_at'].blank?) ? nil : Time.parse(line['created_at'])
|
130
|
+
# reference_date = (line['reference_date'].blank?) ? nil : Time.parse(line['reference_date'])
|
131
|
+
# attributes = {
|
132
|
+
# :reference_date => reference_date,
|
133
|
+
# :sex => line['sex'],
|
134
|
+
# :created_at => created_at,
|
135
|
+
# :vital_status_id => line['vital_status_id'],
|
136
|
+
# :subject_type_id => line['subject_type_id'],
|
137
|
+
# :do_not_contact => line['DoNotContact']
|
138
|
+
# }
|
139
|
+
# study_subject = StudySubject.create!(attributes)
|
140
|
+
#
|
141
|
+
# # identifier = Identifier.find_by_childid(line['ChildId'])
|
142
|
+
# identifier = Identifier.find_by_subjectid(sprintf("%06d",line['subjectID'].to_i))
|
143
|
+
# unless identifier
|
144
|
+
# error_file.puts line
|
145
|
+
# error_file.puts "No identifier found with subjectID = #{line['subjectID']}"
|
146
|
+
# error_file.puts
|
147
|
+
# else
|
148
|
+
# identifier.study_subject = study_subject
|
149
|
+
# identifier.save!
|
150
|
+
# end
|
151
|
+
#
|
152
|
+
# end # FasterCSV.open
|
153
|
+
# error_file.close
|
154
|
+
# end # task :homex_subjects => :environment do
|
155
|
+
#
|
156
|
+
#
|
157
|
+
# desc "Import data from homex_piis.csv file"
|
158
|
+
# task :homex_piis => :environment do
|
159
|
+
# puts "Importing homex_piis"
|
160
|
+
#
|
161
|
+
# error_file = File.open('homex_piis_errors.txt','w')
|
162
|
+
#
|
163
|
+
# # DO NOT COMMENT OUT THE HEADER LINE OR IT RAISES CRYPTIC ERROR
|
164
|
+
# (f=FasterCSV.open("#{BASEDIR}/homex_piis.csv", 'rb',{
|
165
|
+
# :headers => true })).each do |line|
|
166
|
+
# puts "Processing line #{f.lineno}"
|
167
|
+
# puts line
|
168
|
+
#
|
169
|
+
# # "childID","subjectID","study_subject_id","first_name","middle_name",
|
170
|
+
# # "last_name","dob","died_on","state_id_no","mother_first_name",
|
171
|
+
# # "mother_middle_name","mother_last_name","mother_maiden_name",
|
172
|
+
# # "father_first_name","father_middle_name","father_last_name","email"
|
173
|
+
#
|
174
|
+
# dob = (line['dob'].blank?) ? nil : Time.parse(line['dob'])
|
175
|
+
# died_on = (line['died_on'].blank?) ? nil : Time.parse(line['died_on'])
|
176
|
+
# attributes = {
|
177
|
+
# :dob => dob,
|
178
|
+
# :died_on => died_on,
|
179
|
+
# :first_name => line['first_name'],
|
180
|
+
# :middle_name => line['middle_name'],
|
181
|
+
# :last_name => line['last_name'],
|
182
|
+
# :mother_first_name => line['mother_first_name'],
|
183
|
+
# :mother_middle_name => line['mother_middle_name'],
|
184
|
+
# :mother_last_name => line['mother_last_name'],
|
185
|
+
# :mother_maiden_name => line['mother_maiden_name'],
|
186
|
+
# :father_first_name => line['father_first_name'],
|
187
|
+
# :father_middle_name => line['father_middle_name'],
|
188
|
+
# :father_last_name => line['father_last_name'],
|
189
|
+
# :email => line['email'],
|
190
|
+
# }
|
191
|
+
# pii = Pii.create!(attributes)
|
192
|
+
#
|
193
|
+
# # identifier = Identifier.find_by_childid(line['childID'])
|
194
|
+
# identifier = Identifier.find_by_subjectid(sprintf("%06d",line['subjectID'].to_i))
|
195
|
+
# unless identifier
|
196
|
+
# error_file.puts line
|
197
|
+
# error_file.puts "No identifier found with subjectID = #{line['subjectID']}"
|
198
|
+
# error_file.puts
|
199
|
+
# else
|
200
|
+
# pii.study_subject = identifier.study_subject
|
201
|
+
# pii.save!
|
202
|
+
# end
|
203
|
+
#
|
204
|
+
# end # FasterCSV.open
|
205
|
+
# error_file.close
|
206
|
+
# end # task :homex_piis => :environment do
|
207
|
+
#
|
208
|
+
#
|
209
|
+
#
|
210
|
+
# desc "Import data from homex_enrollments.csv file"
|
211
|
+
# task :homex_enrollments => :environment do
|
212
|
+
# puts "Importing homex_enrollments"
|
213
|
+
#
|
214
|
+
# error_file = File.open('homex_enrollments_errors.txt','w')
|
215
|
+
#
|
216
|
+
# # DO NOT COMMENT OUT THE HEADER LINE OR IT RAISES CRYPTIC ERROR
|
217
|
+
# (f=FasterCSV.open("#{BASEDIR}/homex_enrollments.csv", 'rb',{
|
218
|
+
# :headers => true })).each do |line|
|
219
|
+
# puts "Processing line #{f.lineno}"
|
220
|
+
# puts line
|
221
|
+
#
|
222
|
+
# # "id","study_subject_id","project_id","recruitment_priority","able_to_locate",
|
223
|
+
# # "is_candidate","is_eligible","ineligible_reason_id","ineligible_reason_specify",
|
224
|
+
# # "consented","consented_on","refusal_reason_id","other_refusal_reason","is_chosen",
|
225
|
+
# # "reason_not_chosen","terminated_participation","terminated_reason","is_complete",
|
226
|
+
# # "completed_on","is_closed","reason_closed","notes","created_at","updated_at",
|
227
|
+
# # "document_version_id","project_outcome_id","project_outcome_on",
|
228
|
+
# # "childID-deleteme","problem","search_outcome","letter_outcome"
|
229
|
+
#
|
230
|
+
# consented_on = (line['consented_on'].blank?) ?
|
231
|
+
# nil : Time.parse(line['consented_on'])
|
232
|
+
# completed_on = (line['completed_on'].blank?) ?
|
233
|
+
# nil : Time.parse(line['completed_on'])
|
234
|
+
# project_outcome_on = (line['project_outcome_on'].blank?) ?
|
235
|
+
# nil : Time.parse(line['project_outcome_on'])
|
236
|
+
# attributes = {
|
237
|
+
# :project_id => line['project_id'],
|
238
|
+
# :recruitment_priority => line['recruitment_priority'],
|
239
|
+
# :able_to_locate => line['able_to_locate'],
|
240
|
+
# :is_candidate => line['is_candidate'],
|
241
|
+
# :is_eligible => line['is_eligible'],
|
242
|
+
# :ineligible_reason_id => line['ineligible_reason_id'],
|
243
|
+
# :ineligible_reason_specify => line['ineligible_reason_specify'],
|
244
|
+
# :consented => line['consented'],
|
245
|
+
# :consented_on => consented_on,
|
246
|
+
# :refusal_reason_id => line['refusal_reason_id'],
|
247
|
+
# :other_refusal_reason => line['other_refusal_reason'],
|
248
|
+
# :is_chosen => line['is_chosen'].try(:gsub,/^-/,''), # were -1
|
249
|
+
# :reason_not_chosen => line['reason_not_chosen'],
|
250
|
+
# :terminated_participation => line['terminated_participation'],
|
251
|
+
# :terminated_reason => line['terminated_reason'],
|
252
|
+
# :is_complete => line['is_complete'],
|
253
|
+
# :completed_on => completed_on,
|
254
|
+
# :is_closed => line['is_closed'],
|
255
|
+
# :reason_closed => line['reason_closed'],
|
256
|
+
# :notes => line['notes'],
|
257
|
+
# :document_version_id => line['document_version_id'],
|
258
|
+
# :project_outcome_id => line['project_outcome_id'],
|
259
|
+
# :project_outcome_on => project_outcome_on
|
260
|
+
# # "childID-deleteme","problem","search_outcome","letter_outcome"
|
261
|
+
# }
|
262
|
+
# if attributes[:is_complete] && attributes[:completed_on].blank?
|
263
|
+
# attributes[:completed_on] = Chronic.parse("01/01/1900")
|
264
|
+
# end
|
265
|
+
# # if attributes[:consented] && attributes[:consented_on].blank?
|
266
|
+
# # attributes[:consented_on] = Date.today
|
267
|
+
# # end
|
268
|
+
# # if attributes[:is_eligible] == '2' && attributes[:ineligible_reason_id].blank?
|
269
|
+
# # attributes[:ineligible_reason_id] = IneligibleReason['legacy'].id
|
270
|
+
# #puts "Manually setting ineligible reason"
|
271
|
+
# #puts IneligibleReason['legacy'].inspect
|
272
|
+
# # end
|
273
|
+
# # if attributes[:consented] == '2' && attributes[:refusal_reason_id].blank?
|
274
|
+
# # attributes[:refusal_reason_id] = RefusalReason['other'].id
|
275
|
+
# # end
|
276
|
+
# if attributes[:refusal_reason_id] == '7' && attributes[:other_refusal_reason].blank?
|
277
|
+
# attributes[:other_refusal_reason] = "unknown at legacy data import"
|
278
|
+
# end
|
279
|
+
#
|
280
|
+
# identifier = Identifier.find_by_subjectid(sprintf("%06d",line['subjectID'].to_i))
|
281
|
+
# unless identifier
|
282
|
+
# error_file.puts line
|
283
|
+
# error_file.puts "No identifier found with subjectID = #{line['subjectID']}"
|
284
|
+
# error_file.puts "Enrollment creation not attempted"
|
285
|
+
# error_file.puts
|
286
|
+
# else
|
287
|
+
# enrollment = identifier.study_subject.enrollments.create!(attributes)
|
288
|
+
# # enrollment = identifier.study_subject.enrollments.new(attributes)
|
289
|
+
# # many won't be valid, so skip validations
|
290
|
+
# # enrollment.save(false)
|
291
|
+
# end
|
292
|
+
# end # FasterCSV.open
|
293
|
+
# error_file.close
|
294
|
+
# end # task :homex_enrollments => :environment do
|
295
|
+
#
|
296
|
+
#
|
297
|
+
# desc "Import data from homex_addresses.csv file"
|
298
|
+
# task :homex_addresses => :environment do
|
299
|
+
# puts "Importing homex_addresses"
|
300
|
+
#
|
301
|
+
# error_file = File.open('homex_addresses_errors.txt','w')
|
302
|
+
#
|
303
|
+
# # DO NOT COMMENT OUT THE HEADER LINE OR IT RAISES CRYPTIC ERROR
|
304
|
+
# (f=FasterCSV.open("#{BASEDIR}/homex_addresses.csv", 'rb',{
|
305
|
+
# :headers => true })).each do |line|
|
306
|
+
# puts "Processing line #{f.lineno}"
|
307
|
+
# puts line
|
308
|
+
#
|
309
|
+
# # "ID","Review","ReviewNotes","DataSource","AddressType","ChildID","Street","City",
|
310
|
+
# # "State","Zipcode","FIPSCountyCode","County","Original","Interview","IsCurrent",
|
311
|
+
# # "StartDate","EndDate","EntryDate","T2KAddressID","childID-deleteme","study_subject_id"
|
312
|
+
#
|
313
|
+
# valid_from = (line['StartDate'].blank?) ?
|
314
|
+
# nil : Time.parse(line['StartDate'])
|
315
|
+
# valid_to = (line['EndDate'].blank?) ?
|
316
|
+
# nil : Time.parse(line['EndDate'])
|
317
|
+
#
|
318
|
+
# attributes = {
|
319
|
+
# # "ID","Review","ReviewNotes","DataSource",
|
320
|
+
# # "FIPSCountyCode","Original","Interview",
|
321
|
+
# # "EntryDate","T2KAddressID"
|
322
|
+
# :address_attributes => {
|
323
|
+
# :address_type_id => AddressType[line['AddressType'].downcase].id,
|
324
|
+
# :line_1 => line['Street'],
|
325
|
+
# :city => line['City'],
|
326
|
+
# :state => line['State'],
|
327
|
+
# :zip => line['Zipcode'],
|
328
|
+
# :county => line['County'],
|
329
|
+
# },
|
330
|
+
# :current_address => line['IsCurrent'],
|
331
|
+
# :valid_from => valid_from,
|
332
|
+
# :valid_to => valid_to
|
333
|
+
# }
|
334
|
+
#
|
335
|
+
# # if attributes[:address_attributes][:city].blank?
|
336
|
+
# # attributes[:address_attributes][:city] = "NoneGiven"
|
337
|
+
# # end
|
338
|
+
# # if attributes[:address_attributes][:state].blank?
|
339
|
+
# # attributes[:address_attributes][:state] = "NoneGiven"
|
340
|
+
# # end
|
341
|
+
# # if attributes[:address_attributes][:zip].blank?
|
342
|
+
# # attributes[:address_attributes][:zip] = "00000"
|
343
|
+
# # end
|
344
|
+
#
|
345
|
+
# identifier = Identifier.find_by_childid(line['ChildID'])
|
346
|
+
# unless identifier
|
347
|
+
# error_file.puts line
|
348
|
+
# error_file.puts "No identifier found with childid = #{line['ChildID']}"
|
349
|
+
# error_file.puts "Addressing creation not attempted"
|
350
|
+
# error_file.puts
|
351
|
+
# else
|
352
|
+
# # addressing = identifier.study_subject.addressings.create!(attributes)
|
353
|
+
# addressing = identifier.study_subject.addressings.new(attributes)
|
354
|
+
# # one won't be valid, so skip validations for all
|
355
|
+
# addressing.save(false)
|
356
|
+
# end
|
357
|
+
# end # FasterCSV.open
|
358
|
+
# error_file.close
|
359
|
+
# end # task :homex_addresses => :environment do
|
360
|
+
#
|
361
|
+
#
|
362
|
+
#
|
363
|
+
# desc "Import data from homex_interviews.csv file"
|
364
|
+
# task :homex_interviews => :environment do
|
365
|
+
# puts "Importing homex_interviews"
|
366
|
+
#
|
367
|
+
# error_file = File.open('homex_interviews_errors.txt','w')
|
368
|
+
#
|
369
|
+
# # DO NOT COMMENT OUT THE HEADER LINE OR IT RAISES CRYPTIC ERROR
|
370
|
+
# (f=FasterCSV.open("#{BASEDIR}/homex_interviews.csv", 'rb',{
|
371
|
+
# :headers => true })).each do |line|
|
372
|
+
# puts "Processing line #{f.lineno}"
|
373
|
+
# puts line
|
374
|
+
#
|
375
|
+
# # "subjectID","Questionnaire","began_on","ended_on","consented_on",
|
376
|
+
# # "intro letter sent","instrument_version_id","interview_method_id"
|
377
|
+
#
|
378
|
+
# began_on = (line['began_on'].blank?) ?
|
379
|
+
# nil : Time.parse(line['began_on'])
|
380
|
+
# ended_on = (line['ended_on'].blank?) ?
|
381
|
+
# nil : Time.parse(line['ended_on'])
|
382
|
+
# consented_on = (line['consented_on'].blank?) ?
|
383
|
+
# nil : Time.parse(line['consented_on'])
|
384
|
+
# letter_sent_on = (line['intro letter sent'].blank?) ?
|
385
|
+
# nil : Time.parse(line['intro letter sent'])
|
386
|
+
#
|
387
|
+
# attributes = {
|
388
|
+
# :began_on => began_on,
|
389
|
+
# :ended_on => ended_on,
|
390
|
+
# # :consented_on => consented_on,
|
391
|
+
# :intro_letter_sent_on => letter_sent_on,
|
392
|
+
# :instrument_version_id => line['instrument_version_id'],
|
393
|
+
# :interview_method_id => line['interview_method_id']
|
394
|
+
# }
|
395
|
+
#
|
396
|
+
# identifier = Identifier.find_by_subjectid(sprintf("%06d",line['subjectID'].to_i))
|
397
|
+
# unless identifier
|
398
|
+
# error_file.puts line
|
399
|
+
# error_file.puts "No identifier found with subjectid = #{line['subjectID']}"
|
400
|
+
# error_file.puts
|
401
|
+
# else
|
402
|
+
# identifier.study_subject.interviews.create!(attributes)
|
403
|
+
# end
|
404
|
+
# end # FasterCSV.open
|
405
|
+
# error_file.close
|
406
|
+
# end # task :homex_interviews => :environment do
|
407
|
+
#
|
408
|
+
#
|
409
|
+
# desc "Import data from homex_outcomes.csv file"
|
410
|
+
# task :homex_outcomes => :environment do
|
411
|
+
# puts "Importing homex_outcomes"
|
412
|
+
#
|
413
|
+
# error_file = File.open('homex_outcomes_errors.txt','w')
|
414
|
+
#
|
415
|
+
# # DO NOT COMMENT OUT THE HEADER LINE OR IT RAISES CRYPTIC ERROR
|
416
|
+
# (f=FasterCSV.open("#{BASEDIR}/homex_outcomes.csv", 'rb',{
|
417
|
+
# :headers => true })).each do |line|
|
418
|
+
# puts "Processing line #{f.lineno}"
|
419
|
+
# puts line
|
420
|
+
#
|
421
|
+
# # "id","position","childID","subjectid","sample_outcome_id","sample_outcome_on",
|
422
|
+
# # "interview_outcome_id","interview_outcome_on","created_at","updated_at"
|
423
|
+
# sample_outcome_on = (line['sample_outcome_on'].blank?) ?
|
424
|
+
# nil : Time.parse(line['sample_outcome_on'])
|
425
|
+
# interview_outcome_on = (line['interview_outcome_on'].blank?) ?
|
426
|
+
# nil : Time.parse(line['interview_outcome_on'])
|
427
|
+
#
|
428
|
+
# attributes = {
|
429
|
+
# :sample_outcome_id => line['sample_outcome_id'],
|
430
|
+
# :sample_outcome_on => sample_outcome_on,
|
431
|
+
# :interview_outcome_id => line['interview_outcome_id'],
|
432
|
+
# :interview_outcome_on => interview_outcome_on
|
433
|
+
# }
|
434
|
+
#
|
435
|
+
# identifier = Identifier.find_by_subjectid(sprintf("%06d",line['subjectid'].to_i))
|
436
|
+
# unless identifier
|
437
|
+
# error_file.puts line
|
438
|
+
# error_file.puts "No identifier found with subjectid = #{line['subjectid']}"
|
439
|
+
# error_file.puts
|
440
|
+
# else
|
441
|
+
# identifier.study_subject.create_homex_outcome(attributes) or raise "homex_outcome create failed"
|
442
|
+
# end
|
443
|
+
# end # FasterCSV.open
|
444
|
+
# error_file.close
|
445
|
+
# end # task :homex_outcomes => :environment do
|
446
|
+
#
|
447
|
+
#
|
448
|
+
#
|
449
|
+
#
|
450
|
+
#
|
451
|
+
#
|
452
|
+
#
|
453
|
+
#
|
454
|
+
#
|
455
|
+
#
|
456
|
+
#
|
457
|
+
#
|
458
|
+
#
|
459
|
+
#
|
460
|
+
#
|
461
|
+
#
|
462
|
+
#
|
463
|
+
#
|
464
|
+
#
|
465
|
+
#
|
466
|
+
#
|
467
|
+
#
|
468
|
+
#
|
469
|
+
#
|
470
|
+
#
|
471
|
+
#
|
472
|
+
#
|
473
|
+
#
|
474
|
+
#
|
475
|
+
#
|
476
|
+
#
|
477
|
+
#
|
478
|
+
#
|
479
|
+
#
|
480
|
+
#
|
481
|
+
#
|
482
|
+
#
|
483
|
+
# ######################################################################
|
484
|
+
# #
|
485
|
+
# # desc "Import data from contacts.csv file"
|
486
|
+
# # task :contacts => :environment do
|
487
|
+
# # puts "Importing contacts"
|
488
|
+
# #
|
489
|
+
# # error_file = File.open('contacts_errors.txt','w')
|
490
|
+
# #
|
491
|
+
# # # DO NOT COMMENT OUT THE HEADER LINE OR IT RAISES CRYPTIC ERROR
|
492
|
+
# # (f=FasterCSV.open("#{BASEDIR}/contacts.csv", 'rb',{
|
493
|
+
# # :headers => true })).each do |line|
|
494
|
+
# # puts "Processing line #{f.lineno}"
|
495
|
+
# # puts line
|
496
|
+
# #
|
497
|
+
# # # "ID","Review","ReviewNotes","DataSource","AddressType","ChildID","Street","City",
|
498
|
+
# # # "State","Zipcode","FIPSCountyCode","County","Original","Interview","IsCurrent",
|
499
|
+
# # # "StartDate","EndDate","EntryDate","T2KAddressID","childID-deleteme",
|
500
|
+
# # # "study_subject_id","t2k_primary_phone","t2k_alt_phone","src_primary_phone",
|
501
|
+
# # # "src_alt_phone_1","src_alt_phone_2","src_alt_phone_3"
|
502
|
+
# #
|
503
|
+
# #
|
504
|
+
# # end # FasterCSV.open
|
505
|
+
# # error_file.close
|
506
|
+
# # end # task :contacts => :environment do
|
507
|
+
# #
|
508
|
+
# #
|
509
|
+
# # desc "Import data from subjects.csv file"
|
510
|
+
# # task :subjects => :environment do
|
511
|
+
# # puts "Importing subjects"
|
512
|
+
# #
|
513
|
+
# # error_file = File.open('subjects_errors.txt','w')
|
514
|
+
# #
|
515
|
+
# # # DO NOT COMMENT OUT THE HEADER LINE OR IT RAISES CRYPTIC ERROR
|
516
|
+
# # (f=FasterCSV.open("#{BASEDIR}/subjects.csv", 'rb',{
|
517
|
+
# # :headers => true })).each do |line|
|
518
|
+
# # puts "Processing line #{f.lineno}"
|
519
|
+
# # puts line
|
520
|
+
# #
|
521
|
+
# # # "study_subject_id","newID","subjectID","childID","Who","subjectType","relatedPatID",
|
522
|
+
# # # "matchingID","familyID","relatedChildID","T2K_subjectsTableID"
|
523
|
+
# #
|
524
|
+
# # attributes = {
|
525
|
+
# # :identifier_attributes => {
|
526
|
+
# # :childid => line['childID'],
|
527
|
+
# # :subjectid => line['subjectID'],
|
528
|
+
# # :matchingid => line['matchingID'],
|
529
|
+
# # :familyid => line['familyID'],
|
530
|
+
# # :case_control_type => line['subjectType'],
|
531
|
+
# # :related_childid => line['relatedChildID']
|
532
|
+
# # }
|
533
|
+
# # }
|
534
|
+
# # StudySubject.create!(attributes)
|
535
|
+
# #
|
536
|
+
# #
|
537
|
+
# # end # FasterCSV.open
|
538
|
+
# # error_file.close
|
539
|
+
# # end # task :subjects => :environment do
|
540
|
+
# #
|
541
|
+
# #
|
542
|
+
# # desc "Import data from piis.csv file"
|
543
|
+
# # task :piis => :environment do
|
544
|
+
# # puts "Importing piis"
|
545
|
+
# #
|
546
|
+
# # error_file = File.open('piis_errors.txt','w')
|
547
|
+
# #
|
548
|
+
# # # DO NOT COMMENT OUT THE HEADER LINE OR IT RAISES CRYPTIC ERROR
|
549
|
+
# # (f=FasterCSV.open("#{BASEDIR}/piis.csv", 'rb',{
|
550
|
+
# # :headers => true })).each do |line|
|
551
|
+
# # puts "Processing line #{f.lineno}"
|
552
|
+
# # puts line
|
553
|
+
# #
|
554
|
+
# # # "study_subject_id","childID","subjectID","first_name","middle_name","last_name",
|
555
|
+
# # # "dob","died_on","state_id_no","mother_first_name","mother_middle_name",
|
556
|
+
# # # "mother_last_name","mother_maiden_name","father_first_name","father_middle_name",
|
557
|
+
# # # "father_last_name","email"
|
558
|
+
# #
|
559
|
+
# # dob = (line['dob'].blank?) ? Chronic.parse('10 years ago') : Time.parse(line['dob'])
|
560
|
+
# ##
|
561
|
+
# ## convert dob back to this format to ensure it is the same
|
562
|
+
# ##
|
563
|
+
# # died_on = (line['died_on'].blank?) ? '' : Time.parse(line['died_on'])
|
564
|
+
# ##
|
565
|
+
# ## convert died_on back to this format to ensure it is the same
|
566
|
+
# ##
|
567
|
+
# # attributes = {
|
568
|
+
# # :study_subject_id => line['study_subject_id'],
|
569
|
+
# # :first_name => line['first_name'],
|
570
|
+
# # :middle_name => line['middle_name'],
|
571
|
+
# # :last_name => line['last_name'],
|
572
|
+
# # :dob => dob,
|
573
|
+
# # :died_on => died_on,
|
574
|
+
# # :mother_first_name => line['mother_first_name'],
|
575
|
+
# # :mother_middle_name => line['mother_middle_name'],
|
576
|
+
# # :mother_last_name => line['mother_last_name'],
|
577
|
+
# # :mother_maiden_name => line['mother_maiden_name'],
|
578
|
+
# # :father_first_name => line['father_first_name'],
|
579
|
+
# # :father_middle_name => line['father_middle_name'],
|
580
|
+
# # :father_last_name => line['father_last_name']
|
581
|
+
# # }
|
582
|
+
# # Pii.create!(attributes)
|
583
|
+
# ## pii = Pii.create(attributes)
|
584
|
+
# ## if pii.new_record?
|
585
|
+
# ## error_file.puts line
|
586
|
+
# ## error_file.puts pii.errors.full_messages.to_sentence
|
587
|
+
# ## error_file.puts
|
588
|
+
# ## end
|
589
|
+
# #
|
590
|
+
# # end # FasterCSV.open
|
591
|
+
# #
|
592
|
+
# # error_file.close
|
593
|
+
# #
|
594
|
+
# # end # task :piis => :environment do
|
595
|
+
# #
|
596
|
+
# # desc "Import data from identifiers.csv file"
|
597
|
+
# # task :identifiers => :environment do
|
598
|
+
# # puts "Importing identifiers"
|
599
|
+
# #
|
600
|
+
# # error_file = File.open('identifiers_errors.txt','w')
|
601
|
+
# #
|
602
|
+
# # # DO NOT COMMENT OUT THE HEADER LINE OR IT RAISES CRYPTIC ERROR
|
603
|
+
# # (f=FasterCSV.open("#{BASEDIR}/identifiers.csv", 'rb',{
|
604
|
+
# # :headers => true })).each do |line|
|
605
|
+
# # puts "Processing line #{f.lineno}"
|
606
|
+
# # puts line
|
607
|
+
# #
|
608
|
+
# # # "study_subject_id","childID","subjectID","childIDWho","PatID","CaCoType",
|
609
|
+
# # # "OrderNo","StudyID","newID","GBID","LabNo-CCLS","LabNo-Wiemels","IDNO-Wiemels",
|
610
|
+
# # # "AccessionNo","StateIDNo","StudyID-noHyphen","StudyID-IntegerOnly-noHyphen",
|
611
|
+
# # # "ICFMasterID","HospitalIDNo"
|
612
|
+
# #
|
613
|
+
# # attributes = {
|
614
|
+
# # :study_subject_id => line['study_subject_id'],
|
615
|
+
# # :childid => line['childID'],
|
616
|
+
# # :subjectid => line['subjectID'],
|
617
|
+
# # :patid => line['PatID'] || f.lineno, # TODO
|
618
|
+
# # :case_control_type => line['CaCoType'] || 'X', # TODO
|
619
|
+
# # :orderno => line['OrderNo'] || f.lineno, # TODO
|
620
|
+
# # :state_id_no => sprintf("%s %d",line['StateIDNo'], f.lineno),
|
621
|
+
# #
|
622
|
+
# #
|
623
|
+
# # hospital_no is now in the Patient model
|
624
|
+
# #
|
625
|
+
# # :hospital_no => line['HospitalIDNo']
|
626
|
+
# #
|
627
|
+
# # }
|
628
|
+
# # Identifier.create!(attributes)
|
629
|
+
# #
|
630
|
+
# ## identifier = Identifier.create(attributes)
|
631
|
+
# ## if identifier.new_record?
|
632
|
+
# ## error_file.puts line
|
633
|
+
# ## error_file.puts identifier.errors.full_messages.to_sentence
|
634
|
+
# ## error_file.puts
|
635
|
+
# ## end
|
636
|
+
# #
|
637
|
+
# # end # FasterCSV.open
|
638
|
+
# #
|
639
|
+
# # error_file.close
|
640
|
+
# #
|
641
|
+
# # end # task :identifiers => :environment do
|
642
|
+
# #
|
643
|
+
# # desc "Import data from enrollments.csv file"
|
644
|
+
# # task :enrollments => :environment do
|
645
|
+
# # puts "Importing enrollments"
|
646
|
+
# #
|
647
|
+
# # error_file = File.open('enrollments_errors.txt','w')
|
648
|
+
# #
|
649
|
+
# # # DO NOT COMMENT OUT THE HEADER LINE OR IT RAISES CRYPTIC ERROR
|
650
|
+
# # (f=FasterCSV.open("#{BASEDIR}/enrollments.csv", 'rb',{
|
651
|
+
# # :headers => true })).each do |line|
|
652
|
+
# # puts "Processing line #{f.lineno}"
|
653
|
+
# # puts line
|
654
|
+
# #
|
655
|
+
# # # "study_subject_id","project_id","recruitment_priority","able_to_locate",
|
656
|
+
# # # "is_candidate","is_eligible","ineligible_reason_id","ineligible_reason_specify",
|
657
|
+
# # # "consented","consented_on","refusal_reason_id","other_refusal_reason",
|
658
|
+
# # # "is_chosen","reason_not_chosen","terminated_participation","terminated_reason",
|
659
|
+
# # # "is_complete","completed_on","is_closed","reason_closed","notes","created_at",
|
660
|
+
# # # "updated_at","document_version_id","project_outcome_id","project_outcome_on",
|
661
|
+
# # # "problem","search_outcome","letter_outcome","FinalHomexEnrollmentsID"
|
662
|
+
# #
|
663
|
+
# # attributes = {
|
664
|
+
# # :study_subject_id => line['study_subject_id'],
|
665
|
+
# # :project_id => line['project_id'],
|
666
|
+
# # :recruitment_priority => line['recruitment_priority'],
|
667
|
+
# # :able_to_locate => line['able_to_locate'],
|
668
|
+
# # :is_candidate => line['is_candidate'],
|
669
|
+
# # :is_eligible => line['is_eligible'],
|
670
|
+
# # :ineligible_reason_id => line['ineligible_reason_id'],
|
671
|
+
# # :ineligible_reason_specify => line['ineligible_reason_specify'],
|
672
|
+
# # :consented => line['consented'],
|
673
|
+
# # :consented_on => line['consented_on'],
|
674
|
+
# # :refusal_reason_id => line['refusal_reason_id'],
|
675
|
+
# # :other_refusal_reason => line['other_refusal_reason'],
|
676
|
+
# # :is_chosen => line['is_chosen'],
|
677
|
+
# # :reason_not_chosen => line['reason_not_chosen'],
|
678
|
+
# # :terminated_participation => line['terminated_participation'],
|
679
|
+
# # :terminated_reason => line['terminated_reason'],
|
680
|
+
# # :is_complete => line['is_complete'],
|
681
|
+
# # :completed_on => line['completed_on'],
|
682
|
+
# # :is_closed => line['is_closed'],
|
683
|
+
# # :reason_closed => line['reason_closed'],
|
684
|
+
# # :notes => line['notes'],
|
685
|
+
# # :document_version_id => line['document_version_id'],
|
686
|
+
# # :project_outcome_id => line['project_outcome_id'],
|
687
|
+
# # :project_outcome_on => line['project_outcome_on']
|
688
|
+
# # }
|
689
|
+
# #
|
690
|
+
# ##puts attributes.inspect
|
691
|
+
# ## Forcing things
|
692
|
+
# ## if attributes[:is_complete] && attributes[:completed_on].blank?
|
693
|
+
# ## attributes[:completed_on] = Date.today
|
694
|
+
# ## end
|
695
|
+
# ## if attributes[:consented] && attributes[:consented_on].blank?
|
696
|
+
# ## attributes[:consented_on] = Date.today
|
697
|
+
# ## end
|
698
|
+
# ## if attributes[:is_eligible] == '2' && attributes[:ineligible_reason_id].blank?
|
699
|
+
# ## attributes[:ineligible_reason_id] = IneligibleReason['moved'].id
|
700
|
+
# ## end
|
701
|
+
# ## if attributes[:consented] == '2' && attributes[:refusal_reason_id].blank?
|
702
|
+
# ## attributes[:refusal_reason_id] = RefusalReason['busy'].id
|
703
|
+
# ## end
|
704
|
+
# ## if attributes[:refusal_reason_id] == '7' && attributes[:other_refusal_reason].blank?
|
705
|
+
# ## attributes[:other_refusal_reason] = "unknown"
|
706
|
+
# ## end
|
707
|
+
# ##puts attributes.inspect
|
708
|
+
# ## Enrollment.create!(attributes)
|
709
|
+
# #
|
710
|
+
# # enrollment = Enrollment.create(attributes)
|
711
|
+
# # if enrollment.new_record?
|
712
|
+
# # error_file.puts line
|
713
|
+
# # error_file.puts enrollment.errors.full_messages.to_sentence
|
714
|
+
# # error_file.puts
|
715
|
+
# # end
|
716
|
+
# #
|
717
|
+
# # end # FasterCSV.open
|
718
|
+
# #
|
719
|
+
# # error_file.close
|
720
|
+
# #
|
721
|
+
# # end # task :enrollments => :environment do
|
722
|
+
#
|
723
|
+
# end
|