· 6 years ago · Mar 19, 2020, 03:36 AM
1-- ----------------------------------------- --
2-- REDCap Installation SQL --
3-- ----------------------------------------- --
4USE `redcap`;
5-- ----------------------------------------- --
6CREATE TABLE `redcap_actions` (
7`action_id` int(10) NOT NULL AUTO_INCREMENT,
8`project_id` int(10) DEFAULT NULL,
9`survey_id` int(10) DEFAULT NULL,
10`action_trigger` enum('MANUAL','ENDOFSURVEY','SURVEYQUESTION') COLLATE utf8mb4_unicode_ci DEFAULT NULL,
11`action_response` enum('NONE','EMAIL_PRIMARY','EMAIL_SECONDARY','EMAIL_TERTIARY','STOPSURVEY','PROMPT') COLLATE utf8mb4_unicode_ci DEFAULT NULL,
12`custom_text` text COLLATE utf8mb4_unicode_ci DEFAULT NULL,
13`recipient_id` int(10) DEFAULT NULL COMMENT 'FK user_information',
14PRIMARY KEY (`action_id`),
15UNIQUE KEY `survey_recipient_id` (`survey_id`,`recipient_id`),
16KEY `project_id` (`project_id`),
17KEY `recipient_id` (`recipient_id`)
18) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
19
20CREATE TABLE `redcap_alerts` (
21`alert_id` int(10) NOT NULL AUTO_INCREMENT,
22`project_id` int(10) DEFAULT NULL,
23`alert_title` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
24`alert_type` enum('EMAIL','SMS','VOICE_CALL') COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'EMAIL',
25`alert_stop_type` enum('RECORD','RECORD_EVENT','RECORD_EVENT_INSTRUMENT','RECORD_INSTRUMENT','RECORD_EVENT_INSTRUMENT_INSTANCE') COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'RECORD_EVENT_INSTRUMENT_INSTANCE',
26`email_deleted` tinyint(1) NOT NULL DEFAULT '0',
27`alert_expiration` datetime DEFAULT NULL,
28`form_name` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Instrument Name',
29`form_name_event` int(10) DEFAULT NULL COMMENT 'Event ID',
30`alert_condition` text COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Conditional logic',
31`ensure_logic_still_true` tinyint(1) NOT NULL DEFAULT '0',
32`prevent_piping_identifiers` tinyint(1) NOT NULL DEFAULT '1',
33`email_incomplete` tinyint(1) DEFAULT '0' COMMENT 'Send alert for any form status?',
34`email_from` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Email From',
35`email_from_display` varchar(150) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Email sender display name',
36`email_to` text COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Email To',
37`phone_number_to` text COLLATE utf8mb4_unicode_ci DEFAULT NULL,
38`email_cc` text COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Email CC',
39`email_bcc` text COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Email BCC',
40`email_subject` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Subject',
41`alert_message` text COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Message',
42`email_failed` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
43`email_attachment_variable` text COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'REDCap file variables',
44`email_attachment1` int(10) DEFAULT NULL,
45`email_attachment2` int(10) DEFAULT NULL,
46`email_attachment3` int(10) DEFAULT NULL,
47`email_attachment4` int(10) DEFAULT NULL,
48`email_attachment5` int(10) DEFAULT NULL,
49`email_repetitive` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'Re-send alert on form re-save?',
50`email_repetitive_change` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'Re-send alert on form re-save if data has been added or modified?',
51`email_repetitive_change_calcs` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'Include calc fields for email_repetitive_change?',
52`cron_send_email_on` enum('now','date','time_lag','next_occurrence') COLLATE utf8mb4_unicode_ci DEFAULT 'now' COMMENT 'When to send alert',
53`cron_send_email_on_date` datetime DEFAULT NULL COMMENT 'Exact time to send',
54`cron_send_email_on_time_lag_days` int(4) DEFAULT NULL,
55`cron_send_email_on_time_lag_hours` int(3) DEFAULT NULL,
56`cron_send_email_on_time_lag_minutes` int(3) DEFAULT NULL,
57`cron_send_email_on_next_day_type` enum('DAY','WEEKDAY','WEEKENDDAY','SUNDAY','MONDAY','TUESDAY','WEDNESDAY','THURSDAY','FRIDAY','SATURDAY') COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'DAY',
58`cron_send_email_on_next_time` time DEFAULT NULL,
59`cron_repeat_for` smallint(4) NOT NULL DEFAULT '0' COMMENT 'Repeat every # of days',
60`cron_repeat_for_units` enum('DAYS','HOURS','MINUTES') COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'DAYS',
61`cron_repeat_for_max` smallint(4) DEFAULT NULL,
62`email_timestamp_sent` datetime DEFAULT NULL COMMENT 'Time last alert was sent',
63`email_sent` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'Has at least one alert been sent?',
64PRIMARY KEY (`alert_id`),
65KEY `alert_expiration` (`alert_expiration`),
66KEY `email_attachment1` (`email_attachment1`),
67KEY `email_attachment2` (`email_attachment2`),
68KEY `email_attachment3` (`email_attachment3`),
69KEY `email_attachment4` (`email_attachment4`),
70KEY `email_attachment5` (`email_attachment5`),
71KEY `form_name_event` (`form_name_event`),
72KEY `project_id` (`project_id`)
73) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
74
75CREATE TABLE `redcap_alerts_recurrence` (
76`aq_id` int(10) NOT NULL AUTO_INCREMENT,
77`alert_id` int(10) DEFAULT NULL,
78`creation_date` datetime DEFAULT NULL,
79`record` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
80`event_id` int(10) DEFAULT NULL,
81`instrument` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
82`instance` smallint(4) DEFAULT NULL,
83`send_option` enum('now','date','time_lag','next_occurrence') COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'now',
84`times_sent` smallint(4) DEFAULT NULL,
85`last_sent` datetime DEFAULT NULL,
86`status` enum('IDLE','QUEUED','SENDING') COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'IDLE',
87`first_send_time` datetime DEFAULT NULL,
88`next_send_time` datetime DEFAULT NULL,
89PRIMARY KEY (`aq_id`),
90UNIQUE KEY `alert_id_record_instrument_instance` (`alert_id`,`record`,`event_id`,`instrument`,`instance`),
91KEY `alert_id_status_times_sent` (`status`,`alert_id`,`times_sent`),
92KEY `creation_date` (`creation_date`),
93KEY `event_id` (`event_id`),
94KEY `first_send_time` (`first_send_time`),
95KEY `last_sent` (`last_sent`),
96KEY `next_send_time_alert_id_status` (`next_send_time`,`alert_id`,`status`),
97KEY `send_option` (`send_option`)
98) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
99
100CREATE TABLE `redcap_alerts_sent` (
101`alert_sent_id` int(10) NOT NULL AUTO_INCREMENT,
102`alert_id` int(10) NOT NULL,
103`record` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
104`event_id` int(10) DEFAULT NULL,
105`instrument` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
106`instance` smallint(4) DEFAULT '1',
107`last_sent` datetime DEFAULT NULL,
108PRIMARY KEY (`alert_sent_id`),
109UNIQUE KEY `alert_id_record_event_instrument_instance` (`alert_id`,`record`,`event_id`,`instrument`,`instance`),
110KEY `event_id_record_alert_id` (`event_id`,`record`,`alert_id`),
111KEY `last_sent` (`last_sent`)
112) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
113
114CREATE TABLE `redcap_alerts_sent_log` (
115`alert_sent_log_id` int(10) NOT NULL AUTO_INCREMENT,
116`alert_sent_id` int(10) DEFAULT NULL,
117`alert_type` enum('EMAIL','SMS','VOICE_CALL') COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'EMAIL',
118`time_sent` datetime DEFAULT NULL,
119`email_from` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
120`email_to` text COLLATE utf8mb4_unicode_ci DEFAULT NULL,
121`phone_number_to` text COLLATE utf8mb4_unicode_ci DEFAULT NULL,
122`email_cc` text COLLATE utf8mb4_unicode_ci DEFAULT NULL,
123`email_bcc` text COLLATE utf8mb4_unicode_ci DEFAULT NULL,
124`subject` text COLLATE utf8mb4_unicode_ci DEFAULT NULL,
125`message` text COLLATE utf8mb4_unicode_ci DEFAULT NULL,
126`attachment_names` text COLLATE utf8mb4_unicode_ci DEFAULT NULL,
127PRIMARY KEY (`alert_sent_log_id`),
128KEY `alert_sent_id_time_sent` (`alert_sent_id`,`time_sent`),
129KEY `email_from` (`email_from`),
130KEY `time_sent` (`time_sent`)
131) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
132
133CREATE TABLE `redcap_auth` (
134`username` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
135`password` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Hash of user''s password',
136`password_salt` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Unique random salt for password',
137`legacy_hash` int(1) NOT NULL DEFAULT '0' COMMENT 'Using older legacy hash for password storage?',
138`temp_pwd` int(1) NOT NULL DEFAULT '0' COMMENT 'Flag to force user to re-enter password',
139`password_question` int(10) DEFAULT NULL COMMENT 'PK of question',
140`password_answer` text COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Hashed answer to password recovery question',
141`password_question_reminder` datetime DEFAULT NULL COMMENT 'When to prompt user to set up security question',
142`password_reset_key` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
143PRIMARY KEY (`username`),
144UNIQUE KEY `password_reset_key` (`password_reset_key`),
145KEY `password_question` (`password_question`)
146) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
147
148CREATE TABLE `redcap_auth_history` (
149`username` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
150`password` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
151`timestamp` datetime DEFAULT NULL,
152KEY `username_password` (`username`(191),`password`(191))
153) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Stores last 5 passwords';
154
155CREATE TABLE `redcap_auth_questions` (
156`qid` int(10) NOT NULL AUTO_INCREMENT,
157`question` text COLLATE utf8mb4_unicode_ci DEFAULT NULL,
158PRIMARY KEY (`qid`)
159) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
160
161CREATE TABLE `redcap_config` (
162`field_name` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
163`value` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
164PRIMARY KEY (`field_name`)
165) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Stores global settings';
166
167CREATE TABLE `redcap_crons` (
168`cron_id` int(10) NOT NULL AUTO_INCREMENT,
169`cron_name` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Unique name for each job',
170`external_module_id` int(11) DEFAULT NULL,
171`cron_description` text COLLATE utf8mb4_unicode_ci DEFAULT NULL,
172`cron_enabled` enum('ENABLED','DISABLED') COLLATE utf8mb4_unicode_ci DEFAULT 'ENABLED',
173`cron_frequency` int(10) DEFAULT NULL COMMENT 'seconds',
174`cron_max_run_time` int(10) DEFAULT NULL COMMENT 'max # seconds a cron should run',
175`cron_instances_max` int(2) NOT NULL DEFAULT '1' COMMENT 'Number of instances that can run simultaneously',
176`cron_instances_current` int(2) NOT NULL DEFAULT '0' COMMENT 'Current number of instances running',
177`cron_last_run_start` datetime DEFAULT NULL,
178`cron_last_run_end` datetime DEFAULT NULL,
179`cron_times_failed` int(2) NOT NULL DEFAULT '0' COMMENT 'After X failures, set as Disabled',
180`cron_external_url` text COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'URL to call for custom jobs not defined by REDCap',
181PRIMARY KEY (`cron_id`),
182UNIQUE KEY `cron_name_module_id` (`cron_name`,`external_module_id`),
183KEY `external_module_id` (`external_module_id`)
184) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='List of all jobs to be run by universal cron job';
185
186CREATE TABLE `redcap_crons_history` (
187`ch_id` int(10) NOT NULL AUTO_INCREMENT,
188`cron_id` int(10) DEFAULT NULL,
189`cron_run_start` datetime DEFAULT NULL,
190`cron_run_end` datetime DEFAULT NULL,
191`cron_run_status` enum('PROCESSING','COMPLETED','FAILED') COLLATE utf8mb4_unicode_ci DEFAULT NULL,
192`cron_info` text COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Any pertinent info that might be logged',
193PRIMARY KEY (`ch_id`),
194KEY `cron_id` (`cron_id`),
195KEY `cron_run_end` (`cron_run_end`),
196KEY `cron_run_start` (`cron_run_start`)
197) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='History of all jobs run by universal cron job';
198
199CREATE TABLE `redcap_dashboard_ip_location_cache` (
200`ip` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL,
201`latitude` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
202`longitude` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
203`city` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
204`region` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
205`country` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
206PRIMARY KEY (`ip`)
207) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
208
209CREATE TABLE `redcap_data` (
210`project_id` int(10) NOT NULL DEFAULT '0',
211`event_id` int(10) DEFAULT NULL,
212`record` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
213`field_name` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
214`value` text COLLATE utf8mb4_unicode_ci DEFAULT NULL,
215`instance` smallint(4) DEFAULT NULL,
216KEY `event_id_instance` (`event_id`,`instance`),
217KEY `proj_record_field` (`project_id`,`record`,`field_name`),
218KEY `project_field` (`project_id`,`field_name`)
219) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
220
221CREATE TABLE `redcap_data_access_groups` (
222`group_id` int(10) NOT NULL AUTO_INCREMENT,
223`project_id` int(10) DEFAULT NULL,
224`group_name` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
225PRIMARY KEY (`group_id`),
226KEY `project_id` (`project_id`)
227) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
228
229CREATE TABLE `redcap_data_dictionaries` (
230`dd_id` int(10) NOT NULL AUTO_INCREMENT,
231`project_id` int(10) DEFAULT NULL,
232`doc_id` int(10) DEFAULT NULL,
233`ui_id` int(10) DEFAULT NULL,
234PRIMARY KEY (`dd_id`),
235KEY `doc_id` (`doc_id`),
236KEY `project_id` (`project_id`),
237KEY `ui_id` (`ui_id`)
238) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
239
240CREATE TABLE `redcap_data_quality_resolutions` (
241`res_id` int(10) NOT NULL AUTO_INCREMENT,
242`status_id` int(10) DEFAULT NULL COMMENT 'FK from data_quality_status',
243`ts` datetime DEFAULT NULL COMMENT 'Date/time added',
244`user_id` int(10) DEFAULT NULL COMMENT 'Current user',
245`response_requested` int(1) NOT NULL DEFAULT '0' COMMENT 'Is a response requested?',
246`response` enum('DATA_MISSING','TYPOGRAPHICAL_ERROR','CONFIRMED_CORRECT','WRONG_SOURCE','OTHER') COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Response category if user responded to query',
247`comment` text COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Text for comment',
248`current_query_status` enum('OPEN','CLOSED','VERIFIED','DEVERIFIED') COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Current query status of thread',
249`upload_doc_id` int(10) DEFAULT NULL COMMENT 'FK of uploaded document',
250`field_comment_edited` int(1) NOT NULL DEFAULT '0' COMMENT 'Denote if field comment was edited',
251PRIMARY KEY (`res_id`),
252KEY `doc_id` (`upload_doc_id`),
253KEY `status_id` (`status_id`),
254KEY `user_id` (`user_id`)
255) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
256
257CREATE TABLE `redcap_data_quality_rules` (
258`rule_id` int(10) NOT NULL AUTO_INCREMENT,
259`project_id` int(10) DEFAULT NULL,
260`rule_order` int(3) DEFAULT '1',
261`rule_name` text COLLATE utf8mb4_unicode_ci DEFAULT NULL,
262`rule_logic` text COLLATE utf8mb4_unicode_ci DEFAULT NULL,
263`real_time_execute` int(1) NOT NULL DEFAULT '0' COMMENT 'Run in real-time on data entry forms?',
264PRIMARY KEY (`rule_id`),
265KEY `project_id` (`project_id`)
266) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
267
268CREATE TABLE `redcap_data_quality_status` (
269`status_id` int(10) NOT NULL AUTO_INCREMENT,
270`rule_id` int(10) DEFAULT NULL COMMENT 'FK from data_quality_rules table',
271`pd_rule_id` int(2) DEFAULT NULL COMMENT 'Name of pre-defined rules',
272`non_rule` int(1) DEFAULT NULL COMMENT '1 for non-rule, else NULL',
273`project_id` int(11) DEFAULT NULL,
274`record` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
275`event_id` int(10) DEFAULT NULL,
276`field_name` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Only used if field-level is required',
277`repeat_instrument` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
278`instance` smallint(4) NOT NULL DEFAULT '1',
279`status` int(2) DEFAULT NULL COMMENT 'Current status of discrepancy',
280`exclude` int(1) NOT NULL DEFAULT '0' COMMENT 'Hide from results',
281`query_status` enum('OPEN','CLOSED','VERIFIED','DEVERIFIED') COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Status of data query',
282`assigned_user_id` int(10) DEFAULT NULL COMMENT 'UI ID of user assigned to query',
283PRIMARY KEY (`status_id`),
284UNIQUE KEY `nonrule_proj_record_event_field` (`non_rule`,`project_id`,`record`,`event_id`,`field_name`,`instance`),
285UNIQUE KEY `pd_rule_proj_record_event_field` (`pd_rule_id`,`record`,`event_id`,`field_name`,`project_id`,`instance`),
286UNIQUE KEY `rule_record_event` (`rule_id`,`record`,`event_id`,`instance`),
287KEY `assigned_user_id` (`assigned_user_id`),
288KEY `event_record` (`event_id`,`record`),
289KEY `pd_rule_proj_record_event` (`pd_rule_id`,`record`,`event_id`,`project_id`,`instance`),
290KEY `project_query_status` (`project_id`,`query_status`)
291) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
292
293CREATE TABLE `redcap_ddp_log_view` (
294`ml_id` int(10) NOT NULL AUTO_INCREMENT,
295`time_viewed` datetime DEFAULT NULL COMMENT 'Time the data was displayed to the user',
296`user_id` int(10) DEFAULT NULL COMMENT 'PK from user_information table',
297`project_id` int(10) DEFAULT NULL,
298`source_id` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'ID value from source system (e.g. MRN)',
299PRIMARY KEY (`ml_id`),
300KEY `project_id` (`project_id`),
301KEY `source_id` (`source_id`(191)),
302KEY `time_viewed` (`time_viewed`),
303KEY `user_project` (`user_id`,`project_id`)
304) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
305
306CREATE TABLE `redcap_ddp_log_view_data` (
307`ml_id` int(10) DEFAULT NULL COMMENT 'PK from ddp_log_view table',
308`source_field` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Field name from source system',
309`source_timestamp` datetime DEFAULT NULL COMMENT 'Date of service from source system',
310`md_id` int(10) DEFAULT NULL COMMENT 'PK from ddp_records_data table',
311KEY `md_id` (`md_id`),
312KEY `ml_id` (`ml_id`),
313KEY `source_field` (`source_field`),
314KEY `source_timestamp` (`source_timestamp`)
315) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
316
317CREATE TABLE `redcap_ddp_mapping` (
318`map_id` int(10) NOT NULL AUTO_INCREMENT,
319`external_source_field_name` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Unique name of field mapped from external data source',
320`is_record_identifier` int(1) DEFAULT NULL COMMENT '1=Yes, Null=No',
321`project_id` int(10) DEFAULT NULL,
322`event_id` int(10) DEFAULT NULL,
323`field_name` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
324`temporal_field` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'REDCap date field',
325`preselect` enum('MIN','MAX','FIRST','LAST','NEAR') COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Preselect a source value for temporal fields only',
326PRIMARY KEY (`map_id`),
327UNIQUE KEY `project_field_event_source` (`project_id`,`event_id`,`field_name`,`external_source_field_name`),
328UNIQUE KEY `project_identifier` (`project_id`,`is_record_identifier`),
329KEY `event_id` (`event_id`),
330KEY `external_source_field_name` (`external_source_field_name`),
331KEY `field_name` (`field_name`),
332KEY `temporal_field` (`temporal_field`)
333) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
334
335CREATE TABLE `redcap_ddp_preview_fields` (
336`project_id` int(10) NOT NULL,
337`field1` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
338`field2` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
339`field3` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
340`field4` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
341`field5` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
342PRIMARY KEY (`project_id`)
343) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
344
345CREATE TABLE `redcap_ddp_records` (
346`mr_id` int(10) NOT NULL AUTO_INCREMENT,
347`project_id` int(10) DEFAULT NULL,
348`record` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
349`updated_at` datetime DEFAULT NULL COMMENT 'Time of last data fetch',
350`item_count` int(10) DEFAULT NULL COMMENT 'New item count (as of last viewing)',
351`fetch_status` enum('QUEUED','FETCHING') COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Current status of data fetch for this record',
352`future_date_count` int(10) NOT NULL DEFAULT '0' COMMENT 'Count of datetime reference fields with values in the future',
353PRIMARY KEY (`mr_id`),
354UNIQUE KEY `project_record` (`project_id`,`record`),
355KEY `project_id_fetch_status` (`fetch_status`,`project_id`),
356KEY `project_updated_at` (`updated_at`,`project_id`)
357) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
358
359CREATE TABLE `redcap_ddp_records_data` (
360`md_id` int(10) NOT NULL AUTO_INCREMENT,
361`map_id` int(10) NOT NULL COMMENT 'PK from ddp_mapping table',
362`mr_id` int(10) DEFAULT NULL COMMENT 'PK from ddp_records table',
363`source_timestamp` datetime DEFAULT NULL COMMENT 'Date of service from source system',
364`source_value` text COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Encrypted data value from source system',
365`source_value2` text COLLATE utf8mb4_unicode_ci DEFAULT NULL,
366`adjudicated` int(1) NOT NULL DEFAULT '0' COMMENT 'Has source value been adjudicated?',
367`exclude` int(1) NOT NULL DEFAULT '0' COMMENT 'Has source value been excluded?',
368PRIMARY KEY (`md_id`),
369KEY `map_id_mr_id_timestamp_value` (`map_id`,`mr_id`,`source_timestamp`,`source_value2`(128)),
370KEY `map_id_timestamp` (`map_id`,`source_timestamp`),
371KEY `mr_id_adjudicated` (`mr_id`,`adjudicated`),
372KEY `mr_id_exclude` (`mr_id`,`exclude`)
373) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Cached data values from web service';
374
375CREATE TABLE `redcap_docs` (
376`docs_id` int(11) NOT NULL AUTO_INCREMENT,
377`project_id` int(10) NOT NULL DEFAULT '0',
378`docs_date` date DEFAULT NULL,
379`docs_name` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
380`docs_size` double DEFAULT NULL,
381`docs_type` text COLLATE utf8mb4_unicode_ci DEFAULT NULL,
382`docs_file` longblob DEFAULT NULL,
383`docs_comment` text COLLATE utf8mb4_unicode_ci DEFAULT NULL,
384`docs_rights` text COLLATE utf8mb4_unicode_ci DEFAULT NULL,
385`export_file` int(1) NOT NULL DEFAULT '0',
386`temp` int(1) NOT NULL DEFAULT '0' COMMENT 'Is file only a temp file?',
387PRIMARY KEY (`docs_id`),
388KEY `docs_name` (`docs_name`(191)),
389KEY `project_id_comment` (`project_id`,`docs_comment`(190)),
390KEY `project_id_export_file_temp` (`project_id`,`export_file`,`temp`)
391) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
392
393CREATE TABLE `redcap_docs_to_edocs` (
394`docs_id` int(11) NOT NULL COMMENT 'PK redcap_docs',
395`doc_id` int(11) NOT NULL COMMENT 'PK redcap_edocs_metadata',
396PRIMARY KEY (`docs_id`,`doc_id`),
397KEY `doc_id` (`doc_id`)
398) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
399
400CREATE TABLE `redcap_edocs_metadata` (
401`doc_id` int(10) NOT NULL AUTO_INCREMENT,
402`stored_name` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'stored name',
403`mime_type` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
404`doc_name` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
405`doc_size` int(10) DEFAULT NULL,
406`file_extension` varchar(20) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
407`gzipped` int(1) NOT NULL DEFAULT '0' COMMENT 'Is file gzip compressed?',
408`project_id` int(10) DEFAULT NULL,
409`stored_date` datetime DEFAULT NULL COMMENT 'stored date',
410`delete_date` datetime DEFAULT NULL COMMENT 'date deleted',
411`date_deleted_server` datetime DEFAULT NULL COMMENT 'When really deleted from server',
412PRIMARY KEY (`doc_id`),
413KEY `date_deleted` (`delete_date`,`date_deleted_server`),
414KEY `project_id` (`project_id`)
415) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
416
417CREATE TABLE `redcap_ehr_access_tokens` (
418`patient` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
419`mrn` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'If different from patient id',
420`token_owner` int(11) DEFAULT NULL COMMENT 'REDCap User ID',
421`expiration` datetime DEFAULT NULL,
422`access_token` text COLLATE utf8mb4_unicode_ci DEFAULT NULL,
423`refresh_token` text COLLATE utf8mb4_unicode_ci DEFAULT NULL,
424`permission_Patient` tinyint(1) DEFAULT NULL,
425`permission_Observation` tinyint(1) DEFAULT NULL,
426`permission_Condition` tinyint(1) DEFAULT NULL,
427`permission_MedicationOrder` tinyint(1) DEFAULT NULL,
428`permission_AllergyIntolerance` tinyint(1) DEFAULT NULL,
429UNIQUE KEY `token_owner_mrn` (`token_owner`,`mrn`),
430UNIQUE KEY `token_owner_patient` (`token_owner`,`patient`),
431KEY `access_token` (`access_token`(190)),
432KEY `expiration` (`expiration`),
433KEY `mrn` (`mrn`),
434KEY `patient` (`patient`)
435) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
436
437CREATE TABLE `redcap_ehr_datamart_revisions` (
438`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
439`project_id` int(11) DEFAULT NULL,
440`request_id` int(11) DEFAULT NULL,
441`user_id` int(11) DEFAULT NULL,
442`mrns` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
443`date_min` date DEFAULT NULL,
444`date_max` date DEFAULT NULL,
445`fields` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
446`approved` tinyint(1) NOT NULL DEFAULT '0',
447`is_deleted` tinyint(1) NOT NULL DEFAULT '0',
448`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
449`executed_at` timestamp NULL DEFAULT NULL,
450PRIMARY KEY (`id`),
451UNIQUE KEY `request_id` (`request_id`),
452KEY `project_id` (`project_id`),
453KEY `user_id` (`user_id`)
454) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
455
456CREATE TABLE `redcap_ehr_import_counts` (
457`id` int(11) NOT NULL AUTO_INCREMENT,
458`ts` datetime DEFAULT NULL,
459`type` enum('CDP','CDM') COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'CDP',
460`adjudicated` tinyint(1) NOT NULL DEFAULT '0',
461`project_id` int(11) DEFAULT NULL,
462`record` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
463`counts_Patient` mediumint(7) DEFAULT NULL,
464`counts_Observation` mediumint(7) DEFAULT NULL,
465`counts_Condition` mediumint(7) DEFAULT NULL,
466`counts_MedicationOrder` mediumint(7) DEFAULT NULL,
467`counts_AllergyIntolerance` mediumint(7) DEFAULT NULL,
468PRIMARY KEY (`id`),
469KEY `project_record` (`project_id`,`record`),
470KEY `ts_project_adjud` (`ts`,`project_id`,`adjudicated`),
471KEY `type_adjud_project_record` (`type`,`adjudicated`,`project_id`,`record`),
472KEY `type_project_record` (`type`,`project_id`,`record`)
473) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
474
475CREATE TABLE `redcap_ehr_user_map` (
476`ehr_username` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
477`redcap_userid` int(11) DEFAULT NULL,
478UNIQUE KEY `ehr_username` (`ehr_username`),
479UNIQUE KEY `redcap_userid` (`redcap_userid`)
480) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
481
482CREATE TABLE `redcap_ehr_user_projects` (
483`project_id` int(11) DEFAULT NULL,
484`redcap_userid` int(11) DEFAULT NULL,
485UNIQUE KEY `project_id_userid` (`project_id`,`redcap_userid`),
486KEY `redcap_userid` (`redcap_userid`)
487) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
488
489CREATE TABLE `redcap_esignatures` (
490`esign_id` int(11) NOT NULL AUTO_INCREMENT,
491`project_id` int(10) DEFAULT NULL,
492`record` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
493`event_id` int(10) DEFAULT NULL,
494`form_name` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
495`instance` smallint(4) NOT NULL DEFAULT '1',
496`username` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
497`timestamp` datetime DEFAULT NULL,
498PRIMARY KEY (`esign_id`),
499UNIQUE KEY `proj_rec_event_form_instance` (`project_id`,`record`,`event_id`,`form_name`,`instance`),
500KEY `event_id` (`event_id`),
501KEY `username` (`username`(191))
502) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
503
504CREATE TABLE `redcap_events_arms` (
505`arm_id` int(10) NOT NULL AUTO_INCREMENT,
506`project_id` int(10) NOT NULL DEFAULT '0',
507`arm_num` int(2) NOT NULL DEFAULT '1',
508`arm_name` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'Arm 1',
509PRIMARY KEY (`arm_id`),
510UNIQUE KEY `proj_arm_num` (`project_id`,`arm_num`)
511) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
512
513CREATE TABLE `redcap_events_calendar` (
514`cal_id` int(10) NOT NULL AUTO_INCREMENT,
515`record` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
516`project_id` int(10) DEFAULT NULL,
517`event_id` int(10) DEFAULT NULL,
518`baseline_date` date DEFAULT NULL,
519`group_id` int(10) DEFAULT NULL,
520`event_date` date DEFAULT NULL,
521`event_time` varchar(5) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'HH:MM',
522`event_status` int(2) DEFAULT NULL COMMENT 'NULL=Ad Hoc, 0=Due Date, 1=Scheduled, 2=Confirmed, 3=Cancelled, 4=No Show',
523`note_type` int(2) DEFAULT NULL,
524`notes` text COLLATE utf8mb4_unicode_ci DEFAULT NULL,
525`extra_notes` text COLLATE utf8mb4_unicode_ci DEFAULT NULL,
526PRIMARY KEY (`cal_id`),
527KEY `event_id` (`event_id`),
528KEY `group_id` (`group_id`),
529KEY `project_date` (`project_id`,`event_date`),
530KEY `project_record` (`project_id`,`record`)
531) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Calendar Data';
532
533CREATE TABLE `redcap_events_forms` (
534`event_id` int(10) NOT NULL DEFAULT '0',
535`form_name` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
536UNIQUE KEY `event_form` (`event_id`,`form_name`)
537) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
538
539CREATE TABLE `redcap_events_metadata` (
540`event_id` int(10) NOT NULL AUTO_INCREMENT,
541`arm_id` int(10) NOT NULL DEFAULT '0' COMMENT 'FK for events_arms',
542`day_offset` float NOT NULL DEFAULT '0' COMMENT 'Days from Start Date',
543`offset_min` float NOT NULL DEFAULT '0',
544`offset_max` float NOT NULL DEFAULT '0',
545`descrip` varchar(64) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'Event 1' COMMENT 'Event Name',
546`external_id` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
547`custom_event_label` text COLLATE utf8mb4_unicode_ci DEFAULT NULL,
548PRIMARY KEY (`event_id`),
549KEY `arm_dayoffset_descrip` (`arm_id`,`day_offset`,`descrip`),
550KEY `day_offset` (`day_offset`),
551KEY `descrip` (`descrip`),
552KEY `external_id` (`external_id`(191))
553) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
554
555CREATE TABLE `redcap_events_repeat` (
556`event_id` int(10) DEFAULT NULL,
557`form_name` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
558`custom_repeat_form_label` text COLLATE utf8mb4_unicode_ci DEFAULT NULL,
559UNIQUE KEY `event_id_form` (`event_id`,`form_name`)
560) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
561
562CREATE TABLE `redcap_external_links` (
563`ext_id` int(10) NOT NULL AUTO_INCREMENT,
564`project_id` int(10) DEFAULT NULL,
565`link_order` int(5) NOT NULL DEFAULT '1',
566`link_url` text COLLATE utf8mb4_unicode_ci DEFAULT NULL,
567`link_label` text COLLATE utf8mb4_unicode_ci DEFAULT NULL,
568`open_new_window` int(10) NOT NULL DEFAULT '0',
569`link_type` enum('LINK','POST_AUTHKEY','REDCAP_PROJECT') COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'LINK',
570`user_access` enum('ALL','DAG','SELECTED') COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'ALL',
571`append_record_info` int(1) NOT NULL DEFAULT '0' COMMENT 'Append record and event to URL',
572`append_pid` int(1) NOT NULL DEFAULT '0' COMMENT 'Append project_id to URL',
573`link_to_project_id` int(10) DEFAULT NULL,
574PRIMARY KEY (`ext_id`),
575KEY `link_to_project_id` (`link_to_project_id`),
576KEY `project_id` (`project_id`)
577) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
578
579CREATE TABLE `redcap_external_links_dags` (
580`ext_id` int(11) NOT NULL AUTO_INCREMENT,
581`group_id` int(10) NOT NULL DEFAULT '0',
582PRIMARY KEY (`ext_id`,`group_id`),
583KEY `group_id` (`group_id`)
584) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
585
586CREATE TABLE `redcap_external_links_exclude_projects` (
587`ext_id` int(11) NOT NULL AUTO_INCREMENT,
588`project_id` int(10) NOT NULL DEFAULT '0',
589PRIMARY KEY (`ext_id`,`project_id`),
590KEY `project_id` (`project_id`)
591) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Projects to exclude for global external links';
592
593CREATE TABLE `redcap_external_links_users` (
594`ext_id` int(11) NOT NULL AUTO_INCREMENT,
595`username` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
596PRIMARY KEY (`ext_id`,`username`),
597KEY `username` (`username`)
598) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
599
600CREATE TABLE `redcap_external_module_settings` (
601`external_module_id` int(11) NOT NULL,
602`project_id` int(11) DEFAULT NULL,
603`key` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
604`type` varchar(12) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'string',
605`value` mediumtext COLLATE utf8mb4_unicode_ci NOT NULL,
606KEY `external_module_id` (`external_module_id`),
607KEY `key` (`key`(191)),
608KEY `project_id` (`project_id`),
609KEY `value` (`value`(190))
610) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
611
612CREATE TABLE `redcap_external_modules` (
613`external_module_id` int(11) NOT NULL AUTO_INCREMENT,
614`directory_prefix` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
615PRIMARY KEY (`external_module_id`),
616UNIQUE KEY `directory_prefix` (`directory_prefix`)
617) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
618
619CREATE TABLE `redcap_external_modules_downloads` (
620`module_name` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
621`module_id` int(11) DEFAULT NULL,
622`time_downloaded` datetime DEFAULT NULL,
623`time_deleted` datetime DEFAULT NULL,
624PRIMARY KEY (`module_name`),
625UNIQUE KEY `module_id` (`module_id`),
626KEY `time_deleted` (`time_deleted`),
627KEY `time_downloaded` (`time_downloaded`)
628) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Modules downloaded from the external modules repository';
629
630CREATE TABLE `redcap_external_modules_log` (
631`log_id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
632`timestamp` datetime NOT NULL,
633`ui_id` int(11) DEFAULT NULL,
634`ip` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
635`external_module_id` int(11) DEFAULT NULL,
636`project_id` int(11) DEFAULT NULL,
637`record` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
638`message` mediumtext COLLATE utf8mb4_unicode_ci NOT NULL,
639PRIMARY KEY (`log_id`),
640KEY `external_module_id` (`external_module_id`),
641KEY `message` (`message`(190)),
642KEY `record` (`record`),
643KEY `redcap_log_redcap_projects_record` (`project_id`,`record`),
644KEY `timestamp` (`timestamp`),
645KEY `ui_id` (`ui_id`)
646) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
647
648CREATE TABLE `redcap_external_modules_log_parameters` (
649`log_id` bigint(20) unsigned NOT NULL,
650`name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
651`value` mediumtext COLLATE utf8mb4_unicode_ci NOT NULL,
652PRIMARY KEY (`log_id`,`name`(191)),
653KEY `name` (`name`(191)),
654KEY `value` (`value`(190))
655) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
656
657CREATE TABLE `redcap_folders` (
658`folder_id` int(10) NOT NULL AUTO_INCREMENT,
659`ui_id` int(10) DEFAULT NULL,
660`name` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
661`position` int(10) DEFAULT NULL,
662`foreground` varchar(6) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
663`background` varchar(6) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
664`collapsed` tinyint(1) NOT NULL DEFAULT '0',
665PRIMARY KEY (`folder_id`),
666UNIQUE KEY `ui_id_name_uniq` (`ui_id`,`name`)
667) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
668
669CREATE TABLE `redcap_folders_projects` (
670`ui_id` int(10) DEFAULT NULL,
671`project_id` int(10) DEFAULT NULL,
672`folder_id` int(10) DEFAULT NULL,
673UNIQUE KEY `ui_id_project_folder` (`ui_id`,`project_id`,`folder_id`),
674KEY `folder_id` (`folder_id`),
675KEY `project_id` (`project_id`)
676) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
677
678CREATE TABLE `redcap_history_size` (
679`date` date NOT NULL DEFAULT '1000-01-01',
680`size_db` float DEFAULT NULL COMMENT 'MB',
681`size_files` float DEFAULT NULL COMMENT 'MB',
682PRIMARY KEY (`date`)
683) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Space usage of REDCap database and uploaded files.';
684
685CREATE TABLE `redcap_history_version` (
686`date` date NOT NULL DEFAULT '1000-01-01',
687`redcap_version` varchar(10) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
688PRIMARY KEY (`date`)
689) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='History of REDCap versions installed on this server.';
690
691CREATE TABLE `redcap_instrument_zip` (
692`iza_id` int(10) NOT NULL DEFAULT '0',
693`instrument_id` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
694`upload_count` smallint(5) NOT NULL DEFAULT '1',
695PRIMARY KEY (`iza_id`,`instrument_id`),
696KEY `instrument_id` (`instrument_id`)
697) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
698
699CREATE TABLE `redcap_instrument_zip_authors` (
700`iza_id` int(10) NOT NULL AUTO_INCREMENT,
701`author_name` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
702PRIMARY KEY (`iza_id`),
703UNIQUE KEY `author_name` (`author_name`)
704) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
705
706CREATE TABLE `redcap_instrument_zip_origins` (
707`server_name` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
708`upload_count` smallint(5) NOT NULL DEFAULT '1',
709PRIMARY KEY (`server_name`)
710) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
711
712CREATE TABLE `redcap_ip_banned` (
713`ip` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL,
714`time_of_ban` timestamp NULL DEFAULT NULL,
715PRIMARY KEY (`ip`)
716) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
717
718CREATE TABLE `redcap_ip_cache` (
719`ip_hash` varchar(32) COLLATE utf8mb4_unicode_ci NOT NULL,
720`timestamp` timestamp NULL DEFAULT NULL,
721KEY `ip_hash` (`ip_hash`),
722KEY `timestamp` (`timestamp`)
723) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
724
725CREATE TABLE `redcap_library_map` (
726`project_id` int(10) NOT NULL DEFAULT '0',
727`form_name` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
728`type` int(11) NOT NULL DEFAULT '0' COMMENT '1 = Downloaded; 2 = Uploaded',
729`library_id` int(10) NOT NULL DEFAULT '0',
730`upload_timestamp` datetime DEFAULT NULL,
731`acknowledgement` text COLLATE utf8mb4_unicode_ci DEFAULT NULL,
732`acknowledgement_cache` datetime DEFAULT NULL,
733`promis_key` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'PROMIS instrument key',
734`scoring_type` enum('EACH_ITEM','END_ONLY') COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'If has scoring, what type?',
735`battery` tinyint(1) NOT NULL DEFAULT '0',
736`promis_battery_key` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'PROMIS battery key',
737PRIMARY KEY (`project_id`,`form_name`,`type`,`library_id`),
738KEY `form_name` (`form_name`),
739KEY `library_id` (`library_id`),
740KEY `type` (`type`)
741) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
742
743CREATE TABLE `redcap_locking_data` (
744`ld_id` int(11) NOT NULL AUTO_INCREMENT,
745`project_id` int(10) DEFAULT NULL,
746`record` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
747`event_id` int(10) DEFAULT NULL,
748`form_name` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
749`instance` smallint(4) NOT NULL DEFAULT '1',
750`username` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
751`timestamp` datetime DEFAULT NULL,
752PRIMARY KEY (`ld_id`),
753UNIQUE KEY `proj_rec_event_form_instance` (`project_id`,`record`,`event_id`,`form_name`,`instance`),
754KEY `event_id` (`event_id`),
755KEY `username` (`username`)
756) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
757
758CREATE TABLE `redcap_locking_labels` (
759`ll_id` int(11) NOT NULL AUTO_INCREMENT,
760`project_id` int(11) DEFAULT NULL,
761`form_name` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
762`label` text COLLATE utf8mb4_unicode_ci DEFAULT NULL,
763`display` int(1) NOT NULL DEFAULT '1',
764`display_esignature` int(1) NOT NULL DEFAULT '0',
765PRIMARY KEY (`ll_id`),
766UNIQUE KEY `project_form` (`project_id`,`form_name`)
767) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
768
769CREATE TABLE `redcap_log_event` (
770`log_event_id` int(11) NOT NULL AUTO_INCREMENT,
771`project_id` int(10) NOT NULL DEFAULT '0',
772`ts` bigint(14) DEFAULT NULL,
773`user` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
774`ip` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
775`page` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
776`event` enum('UPDATE','INSERT','DELETE','SELECT','ERROR','LOGIN','LOGOUT','OTHER','DATA_EXPORT','DOC_UPLOAD','DOC_DELETE','MANAGE','LOCK_RECORD','ESIGNATURE') COLLATE utf8mb4_unicode_ci DEFAULT NULL,
777`object_type` varchar(128) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
778`sql_log` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
779`pk` varchar(200) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
780`event_id` int(10) DEFAULT NULL,
781`data_values` text COLLATE utf8mb4_unicode_ci DEFAULT NULL,
782`description` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
783`legacy` int(1) NOT NULL DEFAULT '0',
784`change_reason` text COLLATE utf8mb4_unicode_ci DEFAULT NULL,
785PRIMARY KEY (`log_event_id`),
786KEY `description` (`description`),
787KEY `event_project` (`event`,`project_id`),
788KEY `object_type` (`object_type`),
789KEY `pk` (`pk`(191)),
790KEY `ts` (`ts`),
791KEY `user` (`user`(191)),
792KEY `user_project` (`project_id`,`user`(191))
793) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
794
795CREATE TABLE `redcap_log_event2` (
796`log_event_id` int(11) NOT NULL AUTO_INCREMENT,
797`project_id` int(10) NOT NULL DEFAULT '0',
798`ts` bigint(14) DEFAULT NULL,
799`user` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
800`ip` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
801`page` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
802`event` enum('UPDATE','INSERT','DELETE','SELECT','ERROR','LOGIN','LOGOUT','OTHER','DATA_EXPORT','DOC_UPLOAD','DOC_DELETE','MANAGE','LOCK_RECORD','ESIGNATURE') COLLATE utf8mb4_unicode_ci DEFAULT NULL,
803`object_type` varchar(128) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
804`sql_log` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
805`pk` varchar(200) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
806`event_id` int(10) DEFAULT NULL,
807`data_values` text COLLATE utf8mb4_unicode_ci DEFAULT NULL,
808`description` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
809`legacy` int(1) NOT NULL DEFAULT '0',
810`change_reason` text COLLATE utf8mb4_unicode_ci DEFAULT NULL,
811PRIMARY KEY (`log_event_id`),
812KEY `description_project` (`description`,`project_id`),
813KEY `event_project` (`event`,`project_id`),
814KEY `object_type` (`object_type`),
815KEY `page_project` (`page`(191),`project_id`),
816KEY `pk_project` (`pk`(191),`project_id`),
817KEY `project_user` (`project_id`,`user`(191)),
818KEY `ts_project` (`ts`,`project_id`),
819KEY `user_project` (`user`(191),`project_id`)
820) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
821
822CREATE TABLE `redcap_log_event3` (
823`log_event_id` int(11) NOT NULL AUTO_INCREMENT,
824`project_id` int(10) NOT NULL DEFAULT '0',
825`ts` bigint(14) DEFAULT NULL,
826`user` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
827`ip` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
828`page` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
829`event` enum('UPDATE','INSERT','DELETE','SELECT','ERROR','LOGIN','LOGOUT','OTHER','DATA_EXPORT','DOC_UPLOAD','DOC_DELETE','MANAGE','LOCK_RECORD','ESIGNATURE') COLLATE utf8mb4_unicode_ci DEFAULT NULL,
830`object_type` varchar(128) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
831`sql_log` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
832`pk` varchar(200) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
833`event_id` int(10) DEFAULT NULL,
834`data_values` text COLLATE utf8mb4_unicode_ci DEFAULT NULL,
835`description` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
836`legacy` int(1) NOT NULL DEFAULT '0',
837`change_reason` text COLLATE utf8mb4_unicode_ci DEFAULT NULL,
838PRIMARY KEY (`log_event_id`),
839KEY `description_project` (`description`,`project_id`),
840KEY `event_project` (`event`,`project_id`),
841KEY `object_type` (`object_type`),
842KEY `page_project` (`page`(191),`project_id`),
843KEY `pk_project` (`pk`(191),`project_id`),
844KEY `project_user` (`project_id`,`user`(191)),
845KEY `ts_project` (`ts`,`project_id`),
846KEY `user_project` (`user`(191),`project_id`)
847) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
848
849CREATE TABLE `redcap_log_event4` (
850`log_event_id` int(11) NOT NULL AUTO_INCREMENT,
851`project_id` int(10) NOT NULL DEFAULT '0',
852`ts` bigint(14) DEFAULT NULL,
853`user` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
854`ip` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
855`page` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
856`event` enum('UPDATE','INSERT','DELETE','SELECT','ERROR','LOGIN','LOGOUT','OTHER','DATA_EXPORT','DOC_UPLOAD','DOC_DELETE','MANAGE','LOCK_RECORD','ESIGNATURE') COLLATE utf8mb4_unicode_ci DEFAULT NULL,
857`object_type` varchar(128) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
858`sql_log` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
859`pk` varchar(200) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
860`event_id` int(10) DEFAULT NULL,
861`data_values` text COLLATE utf8mb4_unicode_ci DEFAULT NULL,
862`description` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
863`legacy` int(1) NOT NULL DEFAULT '0',
864`change_reason` text COLLATE utf8mb4_unicode_ci DEFAULT NULL,
865PRIMARY KEY (`log_event_id`),
866KEY `description_project` (`description`,`project_id`),
867KEY `event_project` (`event`,`project_id`),
868KEY `object_type` (`object_type`),
869KEY `page_project` (`page`(191),`project_id`),
870KEY `pk_project` (`pk`(191),`project_id`),
871KEY `project_user` (`project_id`,`user`(191)),
872KEY `ts_project` (`ts`,`project_id`),
873KEY `user_project` (`user`(191),`project_id`)
874) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
875
876CREATE TABLE `redcap_log_event5` (
877`log_event_id` int(11) NOT NULL AUTO_INCREMENT,
878`project_id` int(10) NOT NULL DEFAULT '0',
879`ts` bigint(14) DEFAULT NULL,
880`user` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
881`ip` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
882`page` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
883`event` enum('UPDATE','INSERT','DELETE','SELECT','ERROR','LOGIN','LOGOUT','OTHER','DATA_EXPORT','DOC_UPLOAD','DOC_DELETE','MANAGE','LOCK_RECORD','ESIGNATURE') COLLATE utf8mb4_unicode_ci DEFAULT NULL,
884`object_type` varchar(128) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
885`sql_log` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
886`pk` varchar(200) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
887`event_id` int(10) DEFAULT NULL,
888`data_values` text COLLATE utf8mb4_unicode_ci DEFAULT NULL,
889`description` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
890`legacy` int(1) NOT NULL DEFAULT '0',
891`change_reason` text COLLATE utf8mb4_unicode_ci DEFAULT NULL,
892PRIMARY KEY (`log_event_id`),
893KEY `description_project` (`description`,`project_id`),
894KEY `event_project` (`event`,`project_id`),
895KEY `object_type` (`object_type`),
896KEY `page_project` (`page`(191),`project_id`),
897KEY `pk_project` (`pk`(191),`project_id`),
898KEY `project_user` (`project_id`,`user`(191)),
899KEY `ts_project` (`ts`,`project_id`),
900KEY `user_project` (`user`(191),`project_id`)
901) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
902
903CREATE TABLE `redcap_log_view` (
904`log_view_id` int(11) NOT NULL AUTO_INCREMENT,
905`ts` timestamp NULL DEFAULT NULL,
906`user` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
907`event` enum('LOGIN_SUCCESS','LOGIN_FAIL','LOGOUT','PAGE_VIEW') COLLATE utf8mb4_unicode_ci DEFAULT NULL,
908`ip` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
909`browser_name` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
910`browser_version` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
911`full_url` text COLLATE utf8mb4_unicode_ci DEFAULT NULL,
912`page` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
913`project_id` int(10) DEFAULT NULL,
914`event_id` int(10) DEFAULT NULL,
915`record` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
916`form_name` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
917`miscellaneous` text COLLATE utf8mb4_unicode_ci DEFAULT NULL,
918`session_id` varchar(32) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
919PRIMARY KEY (`log_view_id`),
920KEY `browser_name` (`browser_name`(191)),
921KEY `browser_version` (`browser_version`(191)),
922KEY `event` (`event`),
923KEY `ip` (`ip`),
924KEY `page` (`page`(191)),
925KEY `project_event_record` (`project_id`,`event_id`,`record`(191)),
926KEY `session_id` (`session_id`),
927KEY `ts` (`ts`),
928KEY `user_project` (`user`(191),`project_id`)
929) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
930
931CREATE TABLE `redcap_log_view_requests` (
932`lvr_id` int(10) NOT NULL AUTO_INCREMENT,
933`log_view_id` int(10) DEFAULT NULL COMMENT 'FK from redcap_log_view',
934`mysql_process_id` int(10) DEFAULT NULL COMMENT 'Process ID for MySQL',
935`php_process_id` int(10) DEFAULT NULL COMMENT 'Process ID for PHP',
936`script_execution_time` float DEFAULT NULL COMMENT 'Total PHP script execution time (seconds)',
937`is_ajax` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'Is request an AJAX request?',
938`ui_id` int(11) DEFAULT NULL COMMENT 'FK from redcap_user_information',
939PRIMARY KEY (`lvr_id`),
940UNIQUE KEY `log_view_id` (`log_view_id`),
941UNIQUE KEY `log_view_id_time_ui_id` (`log_view_id`,`script_execution_time`,`ui_id`),
942KEY `mysql_process_id` (`mysql_process_id`),
943KEY `php_process_id` (`php_process_id`),
944KEY `ui_id` (`ui_id`)
945) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
946
947CREATE TABLE `redcap_messages` (
948`message_id` int(10) NOT NULL AUTO_INCREMENT,
949`thread_id` int(10) DEFAULT NULL COMMENT 'Thread that message belongs to (FK from redcap_messages_threads)',
950`sent_time` datetime DEFAULT NULL COMMENT 'Time message was sent',
951`author_user_id` int(10) DEFAULT NULL COMMENT 'Author of message (FK from redcap_user_information)',
952`message_body` text COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'The message itself',
953`attachment_doc_id` int(10) DEFAULT NULL COMMENT 'doc_id if there is an attachment (FK from redcap_edocs_metadata)',
954`stored_url` varchar(256) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
955PRIMARY KEY (`message_id`),
956KEY `attachment_doc_id` (`attachment_doc_id`),
957KEY `author_user_id` (`author_user_id`),
958KEY `message_body` (`message_body`(190)),
959KEY `sent_time` (`sent_time`),
960KEY `thread_id` (`thread_id`)
961) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
962
963CREATE TABLE `redcap_messages_recipients` (
964`recipient_id` int(10) NOT NULL AUTO_INCREMENT,
965`thread_id` int(10) DEFAULT NULL COMMENT 'Thread that recipient belongs to (FK from redcap_messages_threads)',
966`recipient_user_id` int(10) DEFAULT NULL COMMENT 'Individual recipient in thread (FK from redcap_user_information)',
967`all_users` tinyint(1) DEFAULT '0' COMMENT 'Set if recipients = ALL USERS',
968`prioritize` tinyint(1) NOT NULL DEFAULT '0',
969`conv_leader` tinyint(1) NOT NULL DEFAULT '0',
970PRIMARY KEY (`recipient_id`),
971UNIQUE KEY `recipient_user_thread_id` (`recipient_user_id`,`thread_id`),
972KEY `thread_id_users` (`thread_id`,`all_users`)
973) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
974
975CREATE TABLE `redcap_messages_status` (
976`status_id` int(10) NOT NULL AUTO_INCREMENT,
977`message_id` int(10) DEFAULT NULL COMMENT 'FK from redcap_messages',
978`recipient_id` int(10) DEFAULT NULL COMMENT 'Individual recipient in thread (FK from redcap_messages_recipients)',
979`recipient_user_id` int(10) DEFAULT NULL COMMENT 'Individual recipient in thread (FK from redcap_user_information)',
980`urgent` tinyint(1) NOT NULL DEFAULT '0',
981PRIMARY KEY (`status_id`),
982KEY `message_id` (`message_id`),
983KEY `recipient_id` (`recipient_id`),
984KEY `recipient_user_id` (`recipient_user_id`)
985) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
986
987CREATE TABLE `redcap_messages_threads` (
988`thread_id` int(10) NOT NULL AUTO_INCREMENT,
989`type` enum('CHANNEL','NOTIFICATION','CONVERSATION') COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Type of entity',
990`channel_name` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Only for channels',
991`invisible` tinyint(1) NOT NULL DEFAULT '0',
992`archived` tinyint(1) NOT NULL DEFAULT '0',
993`project_id` int(11) DEFAULT NULL COMMENT 'Associated project',
994PRIMARY KEY (`thread_id`),
995KEY `project_id` (`project_id`),
996KEY `type_channel` (`type`,`channel_name`)
997) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
998
999CREATE TABLE `redcap_metadata` (
1000`project_id` int(10) NOT NULL DEFAULT '0',
1001`field_name` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
1002`field_phi` varchar(5) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1003`form_name` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1004`form_menu_description` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1005`field_order` float DEFAULT NULL,
1006`field_units` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1007`element_preceding_header` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1008`element_type` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1009`element_label` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1010`element_enum` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1011`element_note` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1012`element_validation_type` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1013`element_validation_min` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1014`element_validation_max` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1015`element_validation_checktype` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1016`branching_logic` text COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1017`field_req` int(1) NOT NULL DEFAULT '0',
1018`edoc_id` int(10) DEFAULT NULL COMMENT 'image/file attachment',
1019`edoc_display_img` int(1) NOT NULL DEFAULT '0',
1020`custom_alignment` enum('LH','LV','RH','RV') COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'RV = NULL = default',
1021`stop_actions` text COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1022`question_num` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1023`grid_name` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Unique name of grid group',
1024`grid_rank` int(1) NOT NULL DEFAULT '0',
1025`misc` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Miscellaneous field attributes',
1026`video_url` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1027`video_display_inline` tinyint(1) NOT NULL DEFAULT '0',
1028PRIMARY KEY (`project_id`,`field_name`),
1029KEY `edoc_id` (`edoc_id`),
1030KEY `field_name` (`field_name`),
1031KEY `project_id_fieldorder` (`project_id`,`field_order`),
1032KEY `project_id_form` (`project_id`,`form_name`)
1033) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1034
1035CREATE TABLE `redcap_metadata_archive` (
1036`project_id` int(10) NOT NULL DEFAULT '0',
1037`field_name` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
1038`field_phi` varchar(5) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1039`form_name` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1040`form_menu_description` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1041`field_order` float DEFAULT NULL,
1042`field_units` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1043`element_preceding_header` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1044`element_type` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1045`element_label` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1046`element_enum` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1047`element_note` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1048`element_validation_type` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1049`element_validation_min` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1050`element_validation_max` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1051`element_validation_checktype` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1052`branching_logic` text COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1053`field_req` int(1) NOT NULL DEFAULT '0',
1054`edoc_id` int(10) DEFAULT NULL COMMENT 'image/file attachment',
1055`edoc_display_img` int(1) NOT NULL DEFAULT '0',
1056`custom_alignment` enum('LH','LV','RH','RV') COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'RV = NULL = default',
1057`stop_actions` text COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1058`question_num` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1059`grid_name` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Unique name of grid group',
1060`grid_rank` int(1) NOT NULL DEFAULT '0',
1061`misc` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Miscellaneous field attributes',
1062`video_url` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1063`video_display_inline` tinyint(1) NOT NULL DEFAULT '0',
1064`pr_id` int(10) DEFAULT NULL,
1065UNIQUE KEY `project_field_prid` (`project_id`,`field_name`,`pr_id`),
1066KEY `edoc_id` (`edoc_id`),
1067KEY `field_name` (`field_name`),
1068KEY `pr_id` (`pr_id`),
1069KEY `project_id_form` (`project_id`,`form_name`)
1070) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1071
1072CREATE TABLE `redcap_metadata_prod_revisions` (
1073`pr_id` int(10) NOT NULL AUTO_INCREMENT,
1074`project_id` int(10) NOT NULL DEFAULT '0',
1075`ui_id_requester` int(10) DEFAULT NULL,
1076`ui_id_approver` int(10) DEFAULT NULL,
1077`ts_req_approval` datetime DEFAULT NULL,
1078`ts_approved` datetime DEFAULT NULL,
1079PRIMARY KEY (`pr_id`),
1080KEY `project_approved` (`project_id`,`ts_approved`),
1081KEY `project_user` (`project_id`,`ui_id_requester`),
1082KEY `ui_id_approver` (`ui_id_approver`),
1083KEY `ui_id_requester` (`ui_id_requester`)
1084) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1085
1086CREATE TABLE `redcap_metadata_temp` (
1087`project_id` int(10) NOT NULL DEFAULT '0',
1088`field_name` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
1089`field_phi` varchar(5) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1090`form_name` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1091`form_menu_description` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1092`field_order` float DEFAULT NULL,
1093`field_units` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1094`element_preceding_header` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1095`element_type` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1096`element_label` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1097`element_enum` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1098`element_note` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1099`element_validation_type` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1100`element_validation_min` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1101`element_validation_max` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1102`element_validation_checktype` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1103`branching_logic` text COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1104`field_req` int(1) NOT NULL DEFAULT '0',
1105`edoc_id` int(10) DEFAULT NULL COMMENT 'image/file attachment',
1106`edoc_display_img` int(1) NOT NULL DEFAULT '0',
1107`custom_alignment` enum('LH','LV','RH','RV') COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'RV = NULL = default',
1108`stop_actions` text COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1109`question_num` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1110`grid_name` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Unique name of grid group',
1111`grid_rank` int(1) NOT NULL DEFAULT '0',
1112`misc` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Miscellaneous field attributes',
1113`video_url` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1114`video_display_inline` tinyint(1) NOT NULL DEFAULT '0',
1115PRIMARY KEY (`project_id`,`field_name`),
1116KEY `edoc_id` (`edoc_id`),
1117KEY `field_name` (`field_name`),
1118KEY `project_id_form` (`project_id`,`form_name`)
1119) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1120
1121CREATE TABLE `redcap_mobile_app_devices` (
1122`device_id` int(10) NOT NULL AUTO_INCREMENT,
1123`uuid` varchar(128) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1124`project_id` int(10) DEFAULT NULL,
1125`nickname` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1126`revoked` tinyint(4) NOT NULL DEFAULT '0',
1127PRIMARY KEY (`device_id`),
1128UNIQUE KEY `uuid_project_id` (`uuid`,`project_id`),
1129KEY `project_id` (`project_id`)
1130) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1131
1132CREATE TABLE `redcap_mobile_app_files` (
1133`af_id` int(10) NOT NULL AUTO_INCREMENT,
1134`doc_id` int(10) NOT NULL,
1135`type` enum('ESCAPE_HATCH','LOGGING') COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1136`user_id` int(10) DEFAULT NULL,
1137`device_id` int(10) DEFAULT NULL,
1138PRIMARY KEY (`af_id`),
1139KEY `device_id` (`device_id`),
1140KEY `doc_id` (`doc_id`),
1141KEY `user_id` (`user_id`)
1142) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1143
1144CREATE TABLE `redcap_mobile_app_log` (
1145`mal_id` int(10) NOT NULL AUTO_INCREMENT,
1146`project_id` int(10) DEFAULT NULL,
1147`ui_id` int(11) DEFAULT NULL,
1148`log_event_id` int(10) DEFAULT NULL,
1149`device_id` int(10) DEFAULT NULL,
1150`event` enum('INIT_PROJECT','INIT_DOWNLOAD_DATA','INIT_DOWNLOAD_DATA_PARTIAL','REINIT_PROJECT','REINIT_DOWNLOAD_DATA','REINIT_DOWNLOAD_DATA_PARTIAL','SYNC_DATA') COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1151`details` text COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1152`longitude` double DEFAULT NULL,
1153`latitude` double DEFAULT NULL,
1154PRIMARY KEY (`mal_id`),
1155KEY `device_id` (`device_id`),
1156KEY `log_event_id` (`log_event_id`),
1157KEY `project_id_event` (`project_id`,`event`),
1158KEY `ui_id` (`ui_id`)
1159) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1160
1161CREATE TABLE `redcap_new_record_cache` (
1162`project_id` int(10) NOT NULL DEFAULT '0',
1163`event_id` int(10) DEFAULT NULL,
1164`arm_id` int(11) DEFAULT NULL,
1165`record` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1166`creation_time` datetime DEFAULT NULL,
1167UNIQUE KEY `proj_record_event` (`project_id`,`record`,`event_id`),
1168UNIQUE KEY `record_arm` (`record`,`arm_id`),
1169KEY `arm_id` (`arm_id`),
1170KEY `creation_time` (`creation_time`),
1171KEY `event_id` (`event_id`)
1172) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Save new record names to prevent record duplication';
1173
1174CREATE TABLE `redcap_page_hits` (
1175`date` date NOT NULL,
1176`page_name` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1177`page_hits` float NOT NULL DEFAULT '1',
1178UNIQUE KEY `date` (`date`,`page_name`),
1179KEY `page_name` (`page_name`)
1180) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1181
1182CREATE TABLE `redcap_project_checklist` (
1183`list_id` int(11) NOT NULL AUTO_INCREMENT,
1184`project_id` int(10) DEFAULT NULL,
1185`name` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1186PRIMARY KEY (`list_id`),
1187UNIQUE KEY `project_name` (`project_id`,`name`)
1188) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1189
1190CREATE TABLE `redcap_projects` (
1191`project_id` int(10) NOT NULL AUTO_INCREMENT,
1192`project_name` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1193`app_title` text COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1194`status` int(1) NOT NULL DEFAULT '0',
1195`creation_time` datetime DEFAULT NULL,
1196`production_time` datetime DEFAULT NULL,
1197`inactive_time` datetime DEFAULT NULL,
1198`log_event_table` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'redcap_log_event' COMMENT 'Project redcap_log_event table',
1199`created_by` int(10) DEFAULT NULL COMMENT 'FK from User Info',
1200`draft_mode` int(1) NOT NULL DEFAULT '0',
1201`surveys_enabled` int(1) NOT NULL DEFAULT '0' COMMENT '0 = forms only, 1 = survey+forms, 2 = single survey only',
1202`repeatforms` int(1) NOT NULL DEFAULT '0',
1203`scheduling` int(1) NOT NULL DEFAULT '0',
1204`purpose` int(2) DEFAULT NULL,
1205`purpose_other` text COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1206`show_which_records` int(1) NOT NULL DEFAULT '0',
1207`__SALT__` varchar(10) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Alphanumeric hash unique to each project',
1208`count_project` int(1) NOT NULL DEFAULT '1',
1209`investigators` text COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1210`project_note` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1211`online_offline` int(1) NOT NULL DEFAULT '1',
1212`auth_meth` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1213`double_data_entry` int(1) NOT NULL DEFAULT '0',
1214`project_language` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'English',
1215`project_encoding` enum('japanese_sjis','chinese_utf8','chinese_utf8_traditional') COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Encoding to be used for various exported files',
1216`is_child_of` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1217`date_shift_max` int(10) NOT NULL DEFAULT '364',
1218`institution` text COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1219`site_org_type` text COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1220`grant_cite` text COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1221`project_contact_name` text COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1222`project_contact_email` text COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1223`headerlogo` text COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1224`auto_inc_set` int(1) NOT NULL DEFAULT '0',
1225`custom_data_entry_note` text COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1226`custom_index_page_note` text COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1227`order_id_by` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1228`custom_reports` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Legacy report builder',
1229`report_builder` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1230`disable_data_entry` int(1) NOT NULL DEFAULT '0',
1231`google_translate_default` varchar(10) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1232`require_change_reason` int(1) NOT NULL DEFAULT '0',
1233`dts_enabled` int(1) NOT NULL DEFAULT '0',
1234`project_pi_firstname` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1235`project_pi_mi` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1236`project_pi_lastname` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1237`project_pi_email` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1238`project_pi_alias` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1239`project_pi_username` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1240`project_pi_pub_exclude` int(1) DEFAULT NULL,
1241`project_pub_matching_institution` text COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1242`project_irb_number` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1243`project_grant_number` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1244`history_widget_enabled` int(1) NOT NULL DEFAULT '1',
1245`secondary_pk` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'field_name of seconary identifier',
1246`secondary_pk_display_value` tinyint(1) NOT NULL DEFAULT '1',
1247`secondary_pk_display_label` tinyint(1) NOT NULL DEFAULT '1',
1248`custom_record_label` text COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1249`display_project_logo_institution` int(1) NOT NULL DEFAULT '1',
1250`imported_from_rs` int(1) NOT NULL DEFAULT '0' COMMENT 'If imported from REDCap Survey',
1251`display_today_now_button` int(1) NOT NULL DEFAULT '1',
1252`auto_variable_naming` int(1) NOT NULL DEFAULT '0',
1253`randomization` int(1) NOT NULL DEFAULT '0',
1254`enable_participant_identifiers` int(1) NOT NULL DEFAULT '0',
1255`survey_email_participant_field` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Field name that stores participant email',
1256`survey_phone_participant_field` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Field name that stores participant phone number',
1257`data_entry_trigger_url` text COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'URL for sending Post request when a record is created or modified',
1258`template_id` int(10) DEFAULT NULL COMMENT 'If created from a project template, the project_id of the template',
1259`date_deleted` datetime DEFAULT NULL COMMENT 'Time that project was flagged for deletion',
1260`data_resolution_enabled` int(1) NOT NULL DEFAULT '1' COMMENT '0=Disabled, 1=Field comment log, 2=Data Quality resolution workflow',
1261`field_comment_edit_delete` int(1) NOT NULL DEFAULT '1' COMMENT 'Allow users to edit or delete Field Comments',
1262`realtime_webservice_enabled` int(1) NOT NULL DEFAULT '0' COMMENT 'Is real-time web service enabled for external data import?',
1263`realtime_webservice_type` enum('CUSTOM','FHIR') COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'CUSTOM',
1264`realtime_webservice_offset_days` float NOT NULL DEFAULT '7' COMMENT 'Default value of days offset',
1265`realtime_webservice_offset_plusminus` enum('+','-','+-') COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '+-' COMMENT 'Default value of plus-minus range for days offset',
1266`last_logged_event` datetime DEFAULT NULL,
1267`survey_queue_custom_text` text COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1268`survey_auth_enabled` int(1) NOT NULL DEFAULT '0',
1269`survey_auth_field1` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1270`survey_auth_event_id1` int(10) DEFAULT NULL,
1271`survey_auth_field2` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1272`survey_auth_event_id2` int(10) DEFAULT NULL,
1273`survey_auth_field3` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1274`survey_auth_event_id3` int(10) DEFAULT NULL,
1275`survey_auth_min_fields` enum('1','2','3') COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1276`survey_auth_apply_all_surveys` int(1) NOT NULL DEFAULT '1',
1277`survey_auth_custom_message` text COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1278`survey_auth_fail_limit` int(2) DEFAULT NULL,
1279`survey_auth_fail_window` int(3) DEFAULT NULL,
1280`twilio_enabled` int(1) NOT NULL DEFAULT '0',
1281`twilio_modules_enabled` enum('SURVEYS','ALERTS','SURVEYS_ALERTS') COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'SURVEYS',
1282`twilio_account_sid` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1283`twilio_auth_token` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1284`twilio_from_number` bigint(16) DEFAULT NULL,
1285`twilio_voice_language` varchar(5) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'en',
1286`twilio_option_voice_initiate` tinyint(1) NOT NULL DEFAULT '0',
1287`twilio_option_sms_initiate` tinyint(1) NOT NULL DEFAULT '0',
1288`twilio_option_sms_invite_make_call` tinyint(1) NOT NULL DEFAULT '0',
1289`twilio_option_sms_invite_receive_call` tinyint(1) NOT NULL DEFAULT '0',
1290`twilio_option_sms_invite_web` tinyint(1) NOT NULL DEFAULT '0',
1291`twilio_default_delivery_preference` enum('EMAIL','VOICE_INITIATE','SMS_INITIATE','SMS_INVITE_MAKE_CALL','SMS_INVITE_RECEIVE_CALL','SMS_INVITE_WEB') COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'EMAIL',
1292`twilio_request_inspector_checked` datetime DEFAULT NULL,
1293`twilio_request_inspector_enabled` int(1) NOT NULL DEFAULT '1',
1294`twilio_append_response_instructions` int(1) NOT NULL DEFAULT '1',
1295`twilio_multiple_sms_behavior` enum('OVERWRITE','CHOICE','FIRST') COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'CHOICE',
1296`two_factor_exempt_project` tinyint(1) NOT NULL DEFAULT '0',
1297`two_factor_force_project` tinyint(1) NOT NULL DEFAULT '0',
1298`disable_autocalcs` tinyint(1) NOT NULL DEFAULT '0',
1299`custom_public_survey_links` text COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1300`pdf_custom_header_text` text COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1301`pdf_show_logo_url` tinyint(1) NOT NULL DEFAULT '1',
1302`pdf_hide_secondary_field` tinyint(1) NOT NULL DEFAULT '0',
1303`shared_library_enabled` tinyint(1) NOT NULL DEFAULT '1',
1304`allow_delete_record_from_log` tinyint(1) NOT NULL DEFAULT '0',
1305`delete_file_repository_export_files` int(3) NOT NULL DEFAULT '0' COMMENT 'Will auto-delete files after X days',
1306`custom_project_footer_text` text COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1307`custom_project_footer_text_link` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1308`google_recaptcha_enabled` tinyint(1) NOT NULL DEFAULT '0',
1309`datamart_allow_repeat_revision` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'If true, a normal user can run a revision multiple times',
1310`datamart_allow_create_revision` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'If true, a normal user can request a new revision',
1311`datamart_enabled` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'Is project a Clinical Data Mart project?',
1312`datamart_cron_enabled` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'If true, the cron job will pull data automatically for all records at a specified interval X times per day.',
1313`file_upload_vault_enabled` tinyint(1) NOT NULL DEFAULT '0',
1314`file_upload_versioning_enabled` tinyint(1) NOT NULL DEFAULT '1',
1315`missing_data_codes` text COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1316PRIMARY KEY (`project_id`),
1317UNIQUE KEY `project_name` (`project_name`),
1318UNIQUE KEY `twilio_from_number` (`twilio_from_number`),
1319KEY `app_title` (`app_title`(190)),
1320KEY `auth_meth` (`auth_meth`),
1321KEY `created_by` (`created_by`),
1322KEY `date_deleted` (`date_deleted`),
1323KEY `delete_file_repository_export_files` (`delete_file_repository_export_files`),
1324KEY `last_logged_event` (`last_logged_event`),
1325KEY `project_note` (`project_note`(190)),
1326KEY `survey_auth_event_id1` (`survey_auth_event_id1`),
1327KEY `survey_auth_event_id2` (`survey_auth_event_id2`),
1328KEY `survey_auth_event_id3` (`survey_auth_event_id3`),
1329KEY `template_id` (`template_id`),
1330KEY `twilio_account_sid` (`twilio_account_sid`)
1331) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Stores project-level values';
1332
1333CREATE TABLE `redcap_projects_external` (
1334`project_id` varchar(32) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'Brief user-defined project identifier unique within custom_type',
1335`custom_type` varchar(32) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'Brief user-defined name for the resource/category/bucket under which the project falls',
1336`app_title` text COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1337`creation_time` datetime DEFAULT NULL,
1338`project_pi_firstname` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1339`project_pi_mi` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1340`project_pi_lastname` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1341`project_pi_email` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1342`project_pi_alias` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1343`project_pi_pub_exclude` int(1) DEFAULT NULL,
1344`project_pub_matching_institution` text COLLATE utf8mb4_unicode_ci NOT NULL,
1345PRIMARY KEY (`project_id`,`custom_type`)
1346) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1347
1348CREATE TABLE `redcap_projects_templates` (
1349`project_id` int(10) NOT NULL DEFAULT '0',
1350`title` text COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1351`description` text COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1352`enabled` int(1) NOT NULL DEFAULT '0' COMMENT 'If enabled, template is visible to users in list.',
1353PRIMARY KEY (`project_id`)
1354) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Info about which projects are used as templates';
1355
1356CREATE TABLE `redcap_projects_user_hidden` (
1357`project_id` int(10) NOT NULL,
1358`ui_id` int(10) NOT NULL,
1359PRIMARY KEY (`project_id`,`ui_id`),
1360KEY `ui_id` (`ui_id`)
1361) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
1362
1363CREATE TABLE `redcap_pub_articles` (
1364`article_id` int(10) NOT NULL AUTO_INCREMENT,
1365`pubsrc_id` int(10) NOT NULL,
1366`pub_id` varchar(16) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'The publication source''s ID for the article (e.g., a PMID in the case of PubMed)',
1367`title` text COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1368`volume` varchar(16) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1369`issue` varchar(16) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1370`pages` varchar(16) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1371`journal` text COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1372`journal_abbrev` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1373`pub_date` date DEFAULT NULL,
1374`epub_date` date DEFAULT NULL,
1375PRIMARY KEY (`article_id`),
1376UNIQUE KEY `pubsrc_id` (`pubsrc_id`,`pub_id`)
1377) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Articles pulled from a publication source (e.g., PubMed)';
1378
1379CREATE TABLE `redcap_pub_authors` (
1380`author_id` int(10) NOT NULL AUTO_INCREMENT,
1381`article_id` int(10) DEFAULT NULL,
1382`author` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1383PRIMARY KEY (`author_id`),
1384KEY `article_id` (`article_id`),
1385KEY `author` (`author`)
1386) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1387
1388CREATE TABLE `redcap_pub_matches` (
1389`match_id` int(11) NOT NULL AUTO_INCREMENT,
1390`article_id` int(11) NOT NULL,
1391`project_id` int(11) DEFAULT NULL,
1392`external_project_id` varchar(32) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'FK 1/2 referencing redcap_projects_external (not explicitly defined as FK to allow redcap_projects_external to be blown away)',
1393`external_custom_type` varchar(32) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'FK 2/2 referencing redcap_projects_external (not explicitly defined as FK to allow redcap_projects_external to be blown away)',
1394`search_term` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
1395`matched` int(1) DEFAULT NULL,
1396`matched_time` datetime DEFAULT NULL,
1397`email_count` int(11) NOT NULL DEFAULT '0',
1398`email_time` datetime DEFAULT NULL,
1399`unique_hash` varchar(32) COLLATE utf8mb4_unicode_ci NOT NULL,
1400PRIMARY KEY (`match_id`),
1401UNIQUE KEY `unique_hash` (`unique_hash`),
1402KEY `article_id` (`article_id`),
1403KEY `external_custom_type` (`external_custom_type`),
1404KEY `external_project_id` (`external_project_id`),
1405KEY `project_id` (`project_id`)
1406) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1407
1408CREATE TABLE `redcap_pub_mesh_terms` (
1409`mesh_id` int(10) NOT NULL AUTO_INCREMENT,
1410`article_id` int(10) DEFAULT NULL,
1411`mesh_term` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1412PRIMARY KEY (`mesh_id`),
1413KEY `article_id` (`article_id`),
1414KEY `mesh_term` (`mesh_term`(191))
1415) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1416
1417CREATE TABLE `redcap_pub_sources` (
1418`pubsrc_id` int(11) NOT NULL,
1419`pubsrc_name` varchar(32) COLLATE utf8mb4_unicode_ci NOT NULL,
1420`pubsrc_last_crawl_time` datetime DEFAULT NULL,
1421PRIMARY KEY (`pubsrc_id`)
1422) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='The different places where we grab publications from';
1423
1424CREATE TABLE `redcap_randomization` (
1425`rid` int(10) NOT NULL AUTO_INCREMENT,
1426`project_id` int(10) DEFAULT NULL,
1427`stratified` int(1) NOT NULL DEFAULT '1' COMMENT '1=Stratified, 0=Block',
1428`group_by` enum('DAG','FIELD') COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Randomize by group?',
1429`target_field` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1430`target_event` int(10) DEFAULT NULL,
1431`source_field1` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1432`source_event1` int(10) DEFAULT NULL,
1433`source_field2` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1434`source_event2` int(10) DEFAULT NULL,
1435`source_field3` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1436`source_event3` int(10) DEFAULT NULL,
1437`source_field4` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1438`source_event4` int(10) DEFAULT NULL,
1439`source_field5` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1440`source_event5` int(10) DEFAULT NULL,
1441`source_field6` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1442`source_event6` int(10) DEFAULT NULL,
1443`source_field7` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1444`source_event7` int(10) DEFAULT NULL,
1445`source_field8` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1446`source_event8` int(10) DEFAULT NULL,
1447`source_field9` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1448`source_event9` int(10) DEFAULT NULL,
1449`source_field10` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1450`source_event10` int(10) DEFAULT NULL,
1451`source_field11` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1452`source_event11` int(10) DEFAULT NULL,
1453`source_field12` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1454`source_event12` int(10) DEFAULT NULL,
1455`source_field13` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1456`source_event13` int(10) DEFAULT NULL,
1457`source_field14` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1458`source_event14` int(10) DEFAULT NULL,
1459`source_field15` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1460`source_event15` int(10) DEFAULT NULL,
1461PRIMARY KEY (`rid`),
1462UNIQUE KEY `project_id` (`project_id`),
1463KEY `source_event1` (`source_event1`),
1464KEY `source_event10` (`source_event10`),
1465KEY `source_event11` (`source_event11`),
1466KEY `source_event12` (`source_event12`),
1467KEY `source_event13` (`source_event13`),
1468KEY `source_event14` (`source_event14`),
1469KEY `source_event15` (`source_event15`),
1470KEY `source_event2` (`source_event2`),
1471KEY `source_event3` (`source_event3`),
1472KEY `source_event4` (`source_event4`),
1473KEY `source_event5` (`source_event5`),
1474KEY `source_event6` (`source_event6`),
1475KEY `source_event7` (`source_event7`),
1476KEY `source_event8` (`source_event8`),
1477KEY `source_event9` (`source_event9`),
1478KEY `target_event` (`target_event`)
1479) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1480
1481CREATE TABLE `redcap_randomization_allocation` (
1482`aid` int(10) NOT NULL AUTO_INCREMENT,
1483`rid` int(10) NOT NULL DEFAULT '0',
1484`project_status` int(1) NOT NULL DEFAULT '0' COMMENT 'Used in dev or prod status',
1485`is_used_by` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Used by a record?',
1486`group_id` int(10) DEFAULT NULL COMMENT 'DAG',
1487`target_field` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Data value',
1488`source_field1` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Data value',
1489`source_field2` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Data value',
1490`source_field3` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Data value',
1491`source_field4` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Data value',
1492`source_field5` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Data value',
1493`source_field6` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Data value',
1494`source_field7` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Data value',
1495`source_field8` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Data value',
1496`source_field9` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Data value',
1497`source_field10` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Data value',
1498`source_field11` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Data value',
1499`source_field12` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Data value',
1500`source_field13` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Data value',
1501`source_field14` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Data value',
1502`source_field15` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Data value',
1503PRIMARY KEY (`aid`),
1504UNIQUE KEY `rid_status_usedby` (`rid`,`project_status`,`is_used_by`),
1505KEY `group_id` (`group_id`)
1506) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1507
1508CREATE TABLE `redcap_record_counts` (
1509`project_id` int(11) NOT NULL,
1510`record_count` int(11) DEFAULT NULL,
1511`time_of_count` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
1512`record_list_status` enum('NOT_STARTED','PROCESSING','COMPLETE','FIX_SORT') COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'NOT_STARTED',
1513`time_of_list_cache` timestamp NULL DEFAULT NULL,
1514PRIMARY KEY (`project_id`),
1515KEY `time_of_count` (`time_of_count`),
1516KEY `time_of_list_cache` (`time_of_list_cache`)
1517) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1518
1519CREATE TABLE `redcap_record_dashboards` (
1520`rd_id` int(11) NOT NULL AUTO_INCREMENT,
1521`project_id` int(11) DEFAULT NULL,
1522`title` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1523`description` text COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1524`filter_logic` text COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1525`orientation` enum('V','H') COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'H',
1526`group_by` enum('form','event') COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'event',
1527`selected_forms_events` text COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1528`arm` tinyint(2) DEFAULT NULL,
1529`sort_event_id` int(11) DEFAULT NULL,
1530`sort_field_name` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1531`sort_order` enum('ASC','DESC') COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'ASC',
1532PRIMARY KEY (`rd_id`),
1533KEY `project_id` (`project_id`),
1534KEY `sort_event_id` (`sort_event_id`)
1535) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1536
1537CREATE TABLE `redcap_record_list` (
1538`project_id` int(10) NOT NULL,
1539`arm` tinyint(2) NOT NULL,
1540`record` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL,
1541`dag_id` int(10) DEFAULT NULL,
1542`sort` mediumint(7) DEFAULT NULL,
1543PRIMARY KEY (`project_id`,`arm`,`record`),
1544KEY `dag_project_arm` (`dag_id`,`project_id`,`arm`),
1545KEY `project_record` (`project_id`,`record`),
1546KEY `sort_project_arm` (`sort`,`project_id`,`arm`)
1547) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1548
1549CREATE TABLE `redcap_reports` (
1550`report_id` int(10) NOT NULL AUTO_INCREMENT,
1551`project_id` int(10) NOT NULL,
1552`title` text COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1553`report_order` int(3) DEFAULT NULL,
1554`user_access` enum('ALL','SELECTED') COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'ALL',
1555`user_edit_access` enum('ALL','SELECTED') COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'ALL',
1556`description` text COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1557`combine_checkbox_values` tinyint(1) NOT NULL DEFAULT '0',
1558`output_dags` int(1) NOT NULL DEFAULT '0',
1559`output_survey_fields` int(1) NOT NULL DEFAULT '0',
1560`output_missing_data_codes` int(1) NOT NULL DEFAULT '0',
1561`remove_line_breaks_in_values` int(1) NOT NULL DEFAULT '1',
1562`orderby_field1` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1563`orderby_sort1` enum('ASC','DESC') COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1564`orderby_field2` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1565`orderby_sort2` enum('ASC','DESC') COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1566`orderby_field3` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1567`orderby_sort3` enum('ASC','DESC') COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1568`advanced_logic` text COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1569`filter_type` enum('RECORD','EVENT') COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'EVENT',
1570`dynamic_filter1` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1571`dynamic_filter2` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1572`dynamic_filter3` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1573PRIMARY KEY (`report_id`),
1574UNIQUE KEY `project_report_order` (`project_id`,`report_order`),
1575KEY `project_id` (`project_id`)
1576) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1577
1578CREATE TABLE `redcap_reports_access_dags` (
1579`report_id` int(10) NOT NULL AUTO_INCREMENT,
1580`group_id` int(10) NOT NULL DEFAULT '0',
1581PRIMARY KEY (`report_id`,`group_id`),
1582KEY `group_id` (`group_id`)
1583) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1584
1585CREATE TABLE `redcap_reports_access_roles` (
1586`report_id` int(10) NOT NULL DEFAULT '0',
1587`role_id` int(10) NOT NULL DEFAULT '0',
1588PRIMARY KEY (`report_id`,`role_id`),
1589KEY `role_id` (`role_id`)
1590) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1591
1592CREATE TABLE `redcap_reports_access_users` (
1593`report_id` int(10) NOT NULL AUTO_INCREMENT,
1594`username` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
1595PRIMARY KEY (`report_id`,`username`),
1596KEY `username` (`username`)
1597) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1598
1599CREATE TABLE `redcap_reports_edit_access_dags` (
1600`report_id` int(10) NOT NULL AUTO_INCREMENT,
1601`group_id` int(10) NOT NULL DEFAULT '0',
1602PRIMARY KEY (`report_id`,`group_id`),
1603KEY `group_id` (`group_id`)
1604) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1605
1606CREATE TABLE `redcap_reports_edit_access_roles` (
1607`report_id` int(10) NOT NULL DEFAULT '0',
1608`role_id` int(10) NOT NULL DEFAULT '0',
1609PRIMARY KEY (`report_id`,`role_id`),
1610KEY `role_id` (`role_id`)
1611) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1612
1613CREATE TABLE `redcap_reports_edit_access_users` (
1614`report_id` int(10) NOT NULL AUTO_INCREMENT,
1615`username` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
1616PRIMARY KEY (`report_id`,`username`),
1617KEY `username` (`username`)
1618) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1619
1620CREATE TABLE `redcap_reports_fields` (
1621`report_id` int(10) DEFAULT NULL,
1622`field_name` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1623`field_order` int(3) DEFAULT NULL,
1624`limiter_group_operator` enum('AND','OR') COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1625`limiter_event_id` int(10) DEFAULT NULL,
1626`limiter_operator` enum('E','NE','GT','GTE','LT','LTE','CHECKED','UNCHECKED','CONTAINS','NOT_CONTAIN','STARTS_WITH','ENDS_WITH') COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1627`limiter_value` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1628UNIQUE KEY `report_id_field_name_order` (`report_id`,`field_name`,`field_order`),
1629KEY `field_name` (`field_name`),
1630KEY `limiter_event_id` (`limiter_event_id`),
1631KEY `report_id_field_order` (`report_id`,`field_order`)
1632) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1633
1634CREATE TABLE `redcap_reports_filter_dags` (
1635`report_id` int(10) NOT NULL AUTO_INCREMENT,
1636`group_id` int(10) NOT NULL DEFAULT '0',
1637PRIMARY KEY (`report_id`,`group_id`),
1638KEY `group_id` (`group_id`)
1639) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1640
1641CREATE TABLE `redcap_reports_filter_events` (
1642`report_id` int(10) NOT NULL AUTO_INCREMENT,
1643`event_id` int(10) NOT NULL DEFAULT '0',
1644PRIMARY KEY (`report_id`,`event_id`),
1645KEY `event_id` (`event_id`)
1646) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1647
1648CREATE TABLE `redcap_reports_folders` (
1649`folder_id` int(10) NOT NULL AUTO_INCREMENT,
1650`project_id` int(10) DEFAULT NULL,
1651`name` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1652`position` smallint(4) DEFAULT NULL,
1653PRIMARY KEY (`folder_id`),
1654UNIQUE KEY `position_project_id` (`position`,`project_id`),
1655KEY `project_id` (`project_id`)
1656) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1657
1658CREATE TABLE `redcap_reports_folders_items` (
1659`folder_id` int(10) DEFAULT NULL,
1660`report_id` int(10) DEFAULT NULL,
1661UNIQUE KEY `folder_id_report_id` (`folder_id`,`report_id`),
1662KEY `report_id` (`report_id`)
1663) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1664
1665CREATE TABLE `redcap_sendit_docs` (
1666`document_id` int(11) NOT NULL AUTO_INCREMENT,
1667`doc_name` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1668`doc_orig_name` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1669`doc_type` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1670`doc_size` int(11) DEFAULT NULL,
1671`send_confirmation` int(1) NOT NULL DEFAULT '0',
1672`expire_date` datetime DEFAULT NULL,
1673`username` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1674`location` int(1) NOT NULL DEFAULT '0' COMMENT '1 = Home page; 2 = File Repository; 3 = Form',
1675`docs_id` int(11) NOT NULL DEFAULT '0',
1676`date_added` datetime DEFAULT NULL,
1677`date_deleted` datetime DEFAULT NULL COMMENT 'When really deleted from server (only applicable for location=1)',
1678PRIMARY KEY (`document_id`),
1679KEY `date_added` (`date_added`),
1680KEY `docs_id_location` (`location`,`docs_id`),
1681KEY `expire_location_deleted` (`expire_date`,`location`,`date_deleted`),
1682KEY `user_id` (`username`(191))
1683) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1684
1685CREATE TABLE `redcap_sendit_recipients` (
1686`recipient_id` int(11) NOT NULL AUTO_INCREMENT,
1687`email_address` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1688`sent_confirmation` int(1) NOT NULL DEFAULT '0',
1689`download_date` datetime DEFAULT NULL,
1690`download_count` int(11) NOT NULL DEFAULT '0',
1691`document_id` int(11) NOT NULL DEFAULT '0' COMMENT 'FK from redcap_sendit_docs',
1692`guid` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1693`pwd` varchar(32) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1694PRIMARY KEY (`recipient_id`),
1695KEY `document_id` (`document_id`),
1696KEY `email_address` (`email_address`(191)),
1697KEY `guid` (`guid`)
1698) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1699
1700CREATE TABLE `redcap_sessions` (
1701`session_id` varchar(32) COLLATE utf8mb4_unicode_ci NOT NULL,
1702`session_data` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1703`session_expiration` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
1704PRIMARY KEY (`session_id`),
1705KEY `session_expiration` (`session_expiration`)
1706) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Stores user authentication session data';
1707
1708CREATE TABLE `redcap_surveys` (
1709`survey_id` int(10) NOT NULL AUTO_INCREMENT,
1710`project_id` int(10) DEFAULT NULL,
1711`form_name` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'NULL = assume first form',
1712`title` text COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Survey title',
1713`instructions` text COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Survey instructions',
1714`acknowledgement` text COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Survey acknowledgement',
1715`question_by_section` int(1) NOT NULL DEFAULT '0' COMMENT '0 = one-page survey',
1716`display_page_number` int(1) NOT NULL DEFAULT '1',
1717`question_auto_numbering` int(1) NOT NULL DEFAULT '1',
1718`survey_enabled` int(1) NOT NULL DEFAULT '1',
1719`save_and_return` int(1) NOT NULL DEFAULT '0',
1720`save_and_return_code_bypass` tinyint(1) NOT NULL DEFAULT '0',
1721`logo` int(10) DEFAULT NULL COMMENT 'FK for redcap_edocs_metadata',
1722`hide_title` int(1) NOT NULL DEFAULT '0',
1723`view_results` int(1) NOT NULL DEFAULT '0',
1724`min_responses_view_results` int(5) NOT NULL DEFAULT '10',
1725`check_diversity_view_results` int(1) NOT NULL DEFAULT '0',
1726`end_survey_redirect_url` text COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'URL to redirect to after completing survey',
1727`survey_expiration` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Timestamp when survey expires',
1728`promis_skip_question` int(1) NOT NULL DEFAULT '0' COMMENT 'Allow participants to skip questions on PROMIS CATs',
1729`survey_auth_enabled_single` int(1) NOT NULL DEFAULT '0' COMMENT 'Enable Survey Login for this single survey?',
1730`edit_completed_response` int(1) NOT NULL DEFAULT '0' COMMENT 'Allow respondents to return and edit a completed response?',
1731`hide_back_button` tinyint(1) NOT NULL DEFAULT '0',
1732`show_required_field_text` tinyint(1) NOT NULL DEFAULT '1',
1733`confirmation_email_subject` text COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1734`confirmation_email_content` text COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1735`confirmation_email_from` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1736`confirmation_email_from_display` varchar(150) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Email sender display name',
1737`confirmation_email_attach_pdf` tinyint(1) DEFAULT '0',
1738`confirmation_email_attachment` int(10) DEFAULT NULL COMMENT 'FK for redcap_edocs_metadata',
1739`text_to_speech` int(1) NOT NULL DEFAULT '0',
1740`text_to_speech_language` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'en',
1741`end_survey_redirect_next_survey` tinyint(1) NOT NULL DEFAULT '0',
1742`theme` int(10) DEFAULT NULL,
1743`text_size` tinyint(2) DEFAULT NULL,
1744`font_family` tinyint(2) DEFAULT NULL,
1745`theme_text_buttons` varchar(6) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1746`theme_bg_page` varchar(6) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1747`theme_text_title` varchar(6) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1748`theme_bg_title` varchar(6) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1749`theme_text_sectionheader` varchar(6) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1750`theme_bg_sectionheader` varchar(6) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1751`theme_text_question` varchar(6) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1752`theme_bg_question` varchar(6) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1753`enhanced_choices` smallint(1) NOT NULL DEFAULT '0',
1754`repeat_survey_enabled` tinyint(1) NOT NULL DEFAULT '0',
1755`repeat_survey_btn_text` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1756`repeat_survey_btn_location` enum('BEFORE_SUBMIT','AFTER_SUBMIT') COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'BEFORE_SUBMIT',
1757`response_limit` int(7) DEFAULT NULL,
1758`response_limit_include_partials` tinyint(1) NOT NULL DEFAULT '1',
1759`response_limit_custom_text` text COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1760`survey_time_limit_days` smallint(3) DEFAULT NULL,
1761`survey_time_limit_hours` tinyint(2) DEFAULT NULL,
1762`survey_time_limit_minutes` tinyint(2) DEFAULT NULL,
1763`email_participant_field` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1764`end_of_survey_pdf_download` tinyint(4) NOT NULL DEFAULT '0',
1765`pdf_auto_archive` tinyint(1) NOT NULL DEFAULT '0' COMMENT '0=Disabled, 1=Normal, 2=eConsent',
1766`pdf_econsent_version` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1767`pdf_econsent_type` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1768`pdf_econsent_firstname_field` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1769`pdf_econsent_firstname_event_id` int(11) DEFAULT NULL,
1770`pdf_econsent_lastname_field` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1771`pdf_econsent_lastname_event_id` int(11) DEFAULT NULL,
1772`pdf_econsent_dob_field` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1773`pdf_econsent_dob_event_id` int(11) DEFAULT NULL,
1774`pdf_econsent_allow_edit` tinyint(1) NOT NULL DEFAULT '0',
1775`pdf_econsent_signature_field1` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1776`pdf_econsent_signature_field2` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1777`pdf_econsent_signature_field3` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1778`pdf_econsent_signature_field4` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1779`pdf_econsent_signature_field5` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1780PRIMARY KEY (`survey_id`),
1781UNIQUE KEY `logo` (`logo`),
1782UNIQUE KEY `project_form` (`project_id`,`form_name`),
1783KEY `confirmation_email_attachment` (`confirmation_email_attachment`),
1784KEY `pdf_econsent_dob_event_id` (`pdf_econsent_dob_event_id`),
1785KEY `pdf_econsent_firstname_event_id` (`pdf_econsent_firstname_event_id`),
1786KEY `pdf_econsent_lastname_event_id` (`pdf_econsent_lastname_event_id`),
1787KEY `survey_expiration_enabled` (`survey_expiration`,`survey_enabled`),
1788KEY `theme` (`theme`)
1789) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Table for survey data';
1790
1791CREATE TABLE `redcap_surveys_emails` (
1792`email_id` int(10) NOT NULL AUTO_INCREMENT,
1793`survey_id` int(10) DEFAULT NULL,
1794`email_subject` text COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1795`email_content` text COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1796`email_sender` int(10) DEFAULT NULL COMMENT 'FK ui_id from redcap_user_information',
1797`email_sender_display` varchar(150) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Email sender display name',
1798`email_account` enum('1','2','3') COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Sender''s account (1=Primary, 2=Secondary, 3=Tertiary)',
1799`email_static` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Sender''s static email address (only for scheduled invitations)',
1800`email_sent` datetime DEFAULT NULL COMMENT 'Null=Not sent yet (scheduled)',
1801`delivery_type` enum('PARTICIPANT_PREF','EMAIL','VOICE_INITIATE','SMS_INITIATE','SMS_INVITE_MAKE_CALL','SMS_INVITE_RECEIVE_CALL','SMS_INVITE_WEB') COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'EMAIL',
1802`append_survey_link` tinyint(1) NOT NULL DEFAULT '1',
1803PRIMARY KEY (`email_id`),
1804KEY `email_sender` (`email_sender`),
1805KEY `email_sent` (`email_sent`),
1806KEY `survey_id_email_sent` (`survey_id`,`email_sent`)
1807) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Track emails sent out';
1808
1809CREATE TABLE `redcap_surveys_emails_recipients` (
1810`email_recip_id` int(10) NOT NULL AUTO_INCREMENT,
1811`email_id` int(10) DEFAULT NULL COMMENT 'FK redcap_surveys_emails',
1812`participant_id` int(10) DEFAULT NULL COMMENT 'FK redcap_surveys_participants',
1813`static_email` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Static email address of recipient (used when participant has no email)',
1814`static_phone` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Static phone number of recipient (used when participant has no phone number)',
1815`delivery_type` enum('EMAIL','VOICE_INITIATE','SMS_INITIATE','SMS_INVITE_MAKE_CALL','SMS_INVITE_RECEIVE_CALL','SMS_INVITE_WEB') COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'EMAIL',
1816PRIMARY KEY (`email_recip_id`),
1817KEY `emt_id` (`email_id`),
1818KEY `participant_id` (`participant_id`)
1819) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Track email recipients';
1820
1821CREATE TABLE `redcap_surveys_emails_send_rate` (
1822`esr_id` int(10) NOT NULL AUTO_INCREMENT,
1823`sent_begin_time` datetime DEFAULT NULL COMMENT 'Time email batch was sent',
1824`emails_per_batch` int(10) DEFAULT NULL COMMENT 'Number of emails sent in this batch',
1825`emails_per_minute` int(6) DEFAULT NULL COMMENT 'Number of emails sent per minute for this batch',
1826PRIMARY KEY (`esr_id`),
1827KEY `sent_begin_time` (`sent_begin_time`)
1828) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Capture the rate that emails are sent per minute by REDCap';
1829
1830CREATE TABLE `redcap_surveys_erase_twilio_log` (
1831`tl_id` int(10) NOT NULL AUTO_INCREMENT,
1832`project_id` int(10) DEFAULT NULL,
1833`ts` datetime DEFAULT NULL,
1834`sid` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1835`sid_hash` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1836PRIMARY KEY (`tl_id`),
1837UNIQUE KEY `sid` (`sid`),
1838UNIQUE KEY `sid_hash` (`sid_hash`),
1839KEY `project_id` (`project_id`),
1840KEY `ts` (`ts`)
1841) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Temporary storage of Twilio logs to be deleted';
1842
1843CREATE TABLE `redcap_surveys_login` (
1844`ts` datetime DEFAULT NULL,
1845`response_id` int(10) DEFAULT NULL,
1846`login_success` tinyint(1) NOT NULL DEFAULT '1',
1847KEY `response_id` (`response_id`),
1848KEY `ts_response_id_success` (`ts`,`response_id`,`login_success`)
1849) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1850
1851CREATE TABLE `redcap_surveys_participants` (
1852`participant_id` int(10) NOT NULL AUTO_INCREMENT,
1853`survey_id` int(10) DEFAULT NULL,
1854`event_id` int(10) DEFAULT NULL,
1855`hash` varchar(10) CHARACTER SET latin1 COLLATE latin1_general_cs DEFAULT NULL,
1856`legacy_hash` varchar(32) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Migrated from RS',
1857`access_code` varchar(9) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1858`access_code_numeral` varchar(10) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1859`participant_email` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'NULL if public survey',
1860`participant_identifier` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1861`participant_phone` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1862`delivery_preference` enum('EMAIL','VOICE_INITIATE','SMS_INITIATE','SMS_INVITE_MAKE_CALL','SMS_INVITE_RECEIVE_CALL','SMS_INVITE_WEB') COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1863`link_expiration` datetime DEFAULT NULL,
1864`link_expiration_override` tinyint(1) NOT NULL DEFAULT '0',
1865PRIMARY KEY (`participant_id`),
1866UNIQUE KEY `access_code` (`access_code`),
1867UNIQUE KEY `access_code_numeral` (`access_code_numeral`),
1868UNIQUE KEY `hash` (`hash`),
1869UNIQUE KEY `legacy_hash` (`legacy_hash`),
1870KEY `event_id` (`event_id`),
1871KEY `participant_email_phone` (`participant_email`(191),`participant_phone`),
1872KEY `survey_event_email` (`survey_id`,`event_id`,`participant_email`(191))
1873) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Table for survey data';
1874
1875CREATE TABLE `redcap_surveys_pdf_archive` (
1876`doc_id` int(10) DEFAULT NULL,
1877`record` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1878`event_id` int(10) DEFAULT NULL,
1879`survey_id` int(10) DEFAULT NULL,
1880`instance` smallint(4) NOT NULL DEFAULT '1',
1881`identifier` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1882`version` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1883`type` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1884`ip` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1885UNIQUE KEY `doc_id` (`doc_id`),
1886UNIQUE KEY `record_event_survey_instance` (`record`,`event_id`,`survey_id`,`instance`),
1887KEY `event_id` (`event_id`),
1888KEY `survey_id` (`survey_id`)
1889) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1890
1891CREATE TABLE `redcap_surveys_phone_codes` (
1892`pc_id` int(10) NOT NULL AUTO_INCREMENT,
1893`phone_number` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
1894`twilio_number` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
1895`access_code` varchar(12) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1896`project_id` int(10) DEFAULT NULL,
1897PRIMARY KEY (`pc_id`),
1898KEY `participant_twilio_phone` (`phone_number`,`twilio_number`),
1899KEY `project_id` (`project_id`)
1900) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1901
1902CREATE TABLE `redcap_surveys_queue` (
1903`sq_id` int(10) NOT NULL AUTO_INCREMENT,
1904`survey_id` int(10) DEFAULT NULL,
1905`event_id` int(10) DEFAULT NULL,
1906`active` int(1) NOT NULL DEFAULT '1' COMMENT 'Is it currently active?',
1907`auto_start` int(1) NOT NULL DEFAULT '0' COMMENT 'Automatically start if next after survey completion',
1908`condition_surveycomplete_survey_id` int(10) DEFAULT NULL COMMENT 'survey_id of trigger',
1909`condition_surveycomplete_event_id` int(10) DEFAULT NULL COMMENT 'event_id of trigger',
1910`condition_andor` enum('AND','OR') COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Include survey complete AND/OR logic',
1911`condition_logic` text COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Logic using field values',
1912PRIMARY KEY (`sq_id`),
1913UNIQUE KEY `survey_event` (`survey_id`,`event_id`),
1914KEY `condition_surveycomplete_event_id` (`condition_surveycomplete_event_id`),
1915KEY `condition_surveycomplete_survey_event` (`condition_surveycomplete_survey_id`,`condition_surveycomplete_event_id`),
1916KEY `event_id` (`event_id`)
1917) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1918
1919CREATE TABLE `redcap_surveys_queue_hashes` (
1920`project_id` int(10) NOT NULL DEFAULT '0',
1921`record` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
1922`hash` varchar(10) CHARACTER SET latin1 COLLATE latin1_general_cs DEFAULT NULL,
1923PRIMARY KEY (`project_id`,`record`),
1924UNIQUE KEY `hash` (`hash`)
1925) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1926
1927CREATE TABLE `redcap_surveys_response` (
1928`response_id` int(11) NOT NULL AUTO_INCREMENT,
1929`participant_id` int(10) DEFAULT NULL,
1930`record` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1931`instance` smallint(4) NOT NULL DEFAULT '1',
1932`start_time` datetime DEFAULT NULL,
1933`first_submit_time` datetime DEFAULT NULL,
1934`completion_time` datetime DEFAULT NULL,
1935`return_code` varchar(8) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1936`results_code` varchar(8) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
1937PRIMARY KEY (`response_id`),
1938UNIQUE KEY `participant_record` (`participant_id`,`record`,`instance`),
1939KEY `completion_time` (`completion_time`),
1940KEY `first_submit_time` (`first_submit_time`),
1941KEY `record_participant` (`record`,`participant_id`,`instance`),
1942KEY `results_code` (`results_code`),
1943KEY `return_code` (`return_code`),
1944KEY `start_time` (`start_time`)
1945) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1946
1947CREATE TABLE `redcap_surveys_scheduler` (
1948`ss_id` int(10) NOT NULL AUTO_INCREMENT,
1949`survey_id` int(10) DEFAULT NULL,
1950`event_id` int(10) DEFAULT NULL,
1951`instance` enum('FIRST','AFTER_FIRST') COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'FIRST' COMMENT 'survey instance being triggered',
1952`active` int(1) NOT NULL DEFAULT '1' COMMENT 'Is it currently active?',
1953`email_subject` text COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Survey invitation subject',
1954`email_content` text COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Survey invitation text',
1955`email_sender` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Static email address of sender',
1956`email_sender_display` varchar(150) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Email sender display name',
1957`condition_surveycomplete_survey_id` int(10) DEFAULT NULL COMMENT 'survey_id of trigger',
1958`condition_surveycomplete_event_id` int(10) DEFAULT NULL COMMENT 'event_id of trigger',
1959`condition_surveycomplete_instance` enum('FIRST','PREVIOUS') COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'FIRST' COMMENT 'instance of trigger',
1960`condition_andor` enum('AND','OR') COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Include survey complete AND/OR logic',
1961`condition_logic` text COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Logic using field values',
1962`condition_send_time_option` enum('IMMEDIATELY','TIME_LAG','NEXT_OCCURRENCE','EXACT_TIME') COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'When to send invites after condition is met',
1963`condition_send_time_lag_days` int(4) DEFAULT NULL COMMENT 'Wait X days to send invites after condition is met',
1964`condition_send_time_lag_hours` int(2) DEFAULT NULL COMMENT 'Wait X hours to send invites after condition is met',
1965`condition_send_time_lag_minutes` int(2) DEFAULT NULL COMMENT 'Wait X seconds to send invites after condition is met',
1966`condition_send_next_day_type` enum('DAY','WEEKDAY','WEEKENDDAY','SUNDAY','MONDAY','TUESDAY','WEDNESDAY','THURSDAY','FRIDAY','SATURDAY') COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Wait till specific day/time to send invites after condition is met',
1967`condition_send_next_time` time DEFAULT NULL COMMENT 'Wait till specific day/time to send invites after condition is met',
1968`condition_send_time_exact` datetime DEFAULT NULL COMMENT 'Wait till exact date/time to send invites after condition is met',
1969`delivery_type` enum('EMAIL','VOICE_INITIATE','SMS_INITIATE','SMS_INVITE_MAKE_CALL','SMS_INVITE_RECEIVE_CALL','PARTICIPANT_PREF','SMS_INVITE_WEB') COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'EMAIL',
1970`reminder_type` enum('TIME_LAG','NEXT_OCCURRENCE','EXACT_TIME') COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'When to send reminders after original invite is sent',
1971`reminder_timelag_days` int(3) DEFAULT NULL COMMENT 'Wait X days to send reminders',
1972`reminder_timelag_hours` int(2) DEFAULT NULL COMMENT 'Wait X hours to send reminders',
1973`reminder_timelag_minutes` int(2) DEFAULT NULL COMMENT 'Wait X seconds to send reminders',
1974`reminder_nextday_type` enum('DAY','WEEKDAY','WEEKENDDAY','SUNDAY','MONDAY','TUESDAY','WEDNESDAY','THURSDAY','FRIDAY','SATURDAY') COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Wait till specific day/time to send reminders',
1975`reminder_nexttime` time DEFAULT NULL COMMENT 'Wait till specific day/time to send reminders',
1976`reminder_exact_time` datetime DEFAULT NULL COMMENT 'Wait till exact date/time to send reminders',
1977`reminder_num` int(3) NOT NULL DEFAULT '0' COMMENT 'Reminder recurrence',
1978`reeval_before_send` int(1) NOT NULL DEFAULT '0',
1979PRIMARY KEY (`ss_id`),
1980UNIQUE KEY `survey_event_instance` (`survey_id`,`event_id`,`instance`),
1981KEY `condition_surveycomplete_event_id` (`condition_surveycomplete_event_id`),
1982KEY `condition_surveycomplete_survey_event` (`condition_surveycomplete_survey_id`,`condition_surveycomplete_event_id`),
1983KEY `event_id` (`event_id`)
1984) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1985
1986CREATE TABLE `redcap_surveys_scheduler_queue` (
1987`ssq_id` int(10) NOT NULL AUTO_INCREMENT,
1988`ss_id` int(10) DEFAULT NULL COMMENT 'FK for surveys_scheduler table',
1989`email_recip_id` int(10) DEFAULT NULL COMMENT 'FK for redcap_surveys_emails_recipients table',
1990`reminder_num` int(3) NOT NULL DEFAULT '0' COMMENT 'Email reminder instance (0 = original invitation)',
1991`record` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'NULL if record not created yet',
1992`instance` smallint(4) NOT NULL DEFAULT '1',
1993`scheduled_time_to_send` datetime DEFAULT NULL COMMENT 'Time invitation will be sent',
1994`status` enum('QUEUED','SENDING','SENT','DID NOT SEND','DELETED') COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'QUEUED' COMMENT 'Survey invitation status (default=QUEUED)',
1995`time_sent` datetime DEFAULT NULL COMMENT 'Actual time invitation was sent',
1996`reason_not_sent` enum('EMAIL ADDRESS NOT FOUND','PHONE NUMBER NOT FOUND','EMAIL ATTEMPT FAILED','UNKNOWN','SURVEY ALREADY COMPLETED','VOICE/SMS SETTING DISABLED','ERROR SENDING SMS','ERROR MAKING VOICE CALL','LINK HAD ALREADY EXPIRED') COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Explanation of why invitation did not send, if applicable',
1997PRIMARY KEY (`ssq_id`),
1998UNIQUE KEY `email_recip_id_record` (`email_recip_id`,`record`,`reminder_num`,`instance`),
1999UNIQUE KEY `ss_id_record` (`ss_id`,`record`,`reminder_num`,`instance`),
2000KEY `send_sent_status` (`scheduled_time_to_send`,`time_sent`,`status`),
2001KEY `status` (`status`),
2002KEY `time_sent` (`time_sent`)
2003) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2004
2005CREATE TABLE `redcap_surveys_short_codes` (
2006`ts` datetime DEFAULT NULL,
2007`participant_id` int(10) DEFAULT NULL,
2008`code` varchar(6) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
2009UNIQUE KEY `code` (`code`),
2010KEY `participant_id_ts` (`participant_id`,`ts`)
2011) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2012
2013CREATE TABLE `redcap_surveys_themes` (
2014`theme_id` int(10) NOT NULL AUTO_INCREMENT,
2015`theme_name` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
2016`ui_id` int(10) DEFAULT NULL COMMENT 'NULL = Theme is available to all users',
2017`theme_text_buttons` varchar(6) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
2018`theme_bg_page` varchar(6) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
2019`theme_text_title` varchar(6) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
2020`theme_bg_title` varchar(6) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
2021`theme_text_sectionheader` varchar(6) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
2022`theme_bg_sectionheader` varchar(6) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
2023`theme_text_question` varchar(6) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
2024`theme_bg_question` varchar(6) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
2025PRIMARY KEY (`theme_id`),
2026KEY `theme_name` (`theme_name`),
2027KEY `ui_id` (`ui_id`)
2028) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2029
2030CREATE TABLE `redcap_todo_list` (
2031`request_id` int(11) NOT NULL AUTO_INCREMENT,
2032`request_from` int(11) DEFAULT NULL,
2033`request_to` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
2034`todo_type` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
2035`action_url` text COLLATE utf8mb4_unicode_ci DEFAULT NULL,
2036`status` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
2037`request_time` datetime DEFAULT NULL,
2038`project_id` int(10) DEFAULT NULL,
2039`request_completion_time` datetime DEFAULT NULL,
2040`request_completion_userid` int(11) DEFAULT NULL,
2041`comment` text COLLATE utf8mb4_unicode_ci DEFAULT NULL,
2042PRIMARY KEY (`request_id`),
2043KEY `project_id` (`project_id`),
2044KEY `request_completion_userid` (`request_completion_userid`),
2045KEY `request_from` (`request_from`),
2046KEY `request_time` (`request_time`),
2047KEY `status` (`status`),
2048KEY `todo_type` (`todo_type`)
2049) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2050
2051CREATE TABLE `redcap_two_factor_response` (
2052`tf_id` int(10) NOT NULL AUTO_INCREMENT,
2053`user_id` int(10) DEFAULT NULL,
2054`time_sent` datetime DEFAULT NULL,
2055`phone_number` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
2056`verified` tinyint(1) NOT NULL DEFAULT '0',
2057PRIMARY KEY (`tf_id`),
2058KEY `phone_number` (`phone_number`),
2059KEY `time_sent` (`time_sent`),
2060KEY `user_id` (`user_id`)
2061) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2062
2063CREATE TABLE `redcap_user_information` (
2064`ui_id` int(10) NOT NULL AUTO_INCREMENT,
2065`username` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
2066`user_email` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Primary email',
2067`user_email2` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Secondary email',
2068`user_email3` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Tertiary email',
2069`user_phone` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
2070`user_phone_sms` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
2071`user_firstname` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
2072`user_lastname` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
2073`user_inst_id` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
2074`super_user` int(1) NOT NULL DEFAULT '0',
2075`account_manager` int(1) NOT NULL DEFAULT '0',
2076`user_creation` datetime DEFAULT NULL COMMENT 'Time user account was created',
2077`user_firstvisit` datetime DEFAULT NULL,
2078`user_firstactivity` datetime DEFAULT NULL,
2079`user_lastactivity` datetime DEFAULT NULL,
2080`user_lastlogin` datetime DEFAULT NULL,
2081`user_suspended_time` datetime DEFAULT NULL,
2082`user_expiration` datetime DEFAULT NULL COMMENT 'Time at which the user will be automatically suspended from REDCap',
2083`user_access_dashboard_view` datetime DEFAULT NULL,
2084`user_access_dashboard_email_queued` enum('QUEUED','SENDING') COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Tracks status of email reminder for User Access Dashboard',
2085`user_sponsor` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Username of user''s sponsor or contact person',
2086`user_comments` text COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Miscellaneous comments about user',
2087`allow_create_db` int(1) NOT NULL DEFAULT '1',
2088`email_verify_code` varchar(20) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Primary email verification code',
2089`email2_verify_code` varchar(20) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Secondary email verification code',
2090`email3_verify_code` varchar(20) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Tertiary email verification code',
2091`datetime_format` enum('M-D-Y_24','M-D-Y_12','M/D/Y_24','M/D/Y_12','M.D.Y_24','M.D.Y_12','D-M-Y_24','D-M-Y_12','D/M/Y_24','D/M/Y_12','D.M.Y_24','D.M.Y_12','Y-M-D_24','Y-M-D_12','Y/M/D_24','Y/M/D_12','Y.M.D_24','Y.M.D_12') COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'M/D/Y_12' COMMENT 'User''s preferred datetime viewing format',
2092`number_format_decimal` enum('.',',') COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '.' COMMENT 'User''s preferred decimal format',
2093`number_format_thousands_sep` enum(',','.','','SPACE','''') COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ',' COMMENT 'User''s preferred thousands separator',
2094`two_factor_auth_secret` varchar(20) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
2095`display_on_email_users` int(1) NOT NULL DEFAULT '1',
2096`two_factor_auth_twilio_prompt_phone` tinyint(1) NOT NULL DEFAULT '1',
2097`two_factor_auth_code_expiration` int(3) NOT NULL DEFAULT '2',
2098`api_token` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
2099`messaging_email_preference` enum('NONE','2_HOURS','4_HOURS','6_HOURS','8_HOURS','12_HOURS','DAILY') COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '4_HOURS',
2100`messaging_email_urgent_all` tinyint(1) NOT NULL DEFAULT '1',
2101`messaging_email_ts` datetime DEFAULT NULL,
2102`ui_state` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
2103`api_token_auto_request` tinyint(1) NOT NULL DEFAULT '0',
2104`fhir_data_mart_create_project` tinyint(1) NOT NULL DEFAULT '0',
2105PRIMARY KEY (`ui_id`),
2106UNIQUE KEY `api_token` (`api_token`),
2107UNIQUE KEY `email2_verify_code` (`email2_verify_code`),
2108UNIQUE KEY `email3_verify_code` (`email3_verify_code`),
2109UNIQUE KEY `email_verify_code` (`email_verify_code`),
2110UNIQUE KEY `username` (`username`),
2111KEY `two_factor_auth_secret` (`two_factor_auth_secret`),
2112KEY `user_access_dashboard_email_queued` (`user_access_dashboard_email_queued`),
2113KEY `user_access_dashboard_view` (`user_access_dashboard_view`),
2114KEY `user_comments` (`user_comments`(190)),
2115KEY `user_creation` (`user_creation`),
2116KEY `user_email` (`user_email`(191)),
2117KEY `user_expiration` (`user_expiration`),
2118KEY `user_firstactivity` (`user_firstactivity`),
2119KEY `user_firstname` (`user_firstname`(191)),
2120KEY `user_firstvisit` (`user_firstvisit`),
2121KEY `user_inst_id` (`user_inst_id`(191)),
2122KEY `user_lastactivity` (`user_lastactivity`),
2123KEY `user_lastlogin` (`user_lastlogin`),
2124KEY `user_lastname` (`user_lastname`(191)),
2125KEY `user_sponsor` (`user_sponsor`(191)),
2126KEY `user_suspended_time` (`user_suspended_time`)
2127) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2128
2129CREATE TABLE `redcap_user_rights` (
2130`project_id` int(10) NOT NULL DEFAULT '0',
2131`username` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
2132`expiration` date DEFAULT NULL,
2133`role_id` int(10) DEFAULT NULL,
2134`group_id` int(10) DEFAULT NULL,
2135`lock_record` int(1) NOT NULL DEFAULT '0',
2136`lock_record_multiform` int(1) NOT NULL DEFAULT '0',
2137`lock_record_customize` int(1) NOT NULL DEFAULT '0',
2138`data_export_tool` int(1) NOT NULL DEFAULT '1',
2139`data_import_tool` int(1) NOT NULL DEFAULT '1',
2140`data_comparison_tool` int(1) NOT NULL DEFAULT '1',
2141`data_logging` int(1) NOT NULL DEFAULT '1',
2142`file_repository` int(1) NOT NULL DEFAULT '1',
2143`double_data` int(1) NOT NULL DEFAULT '0',
2144`user_rights` int(1) NOT NULL DEFAULT '1',
2145`data_access_groups` int(1) NOT NULL DEFAULT '1',
2146`graphical` int(1) NOT NULL DEFAULT '1',
2147`reports` int(1) NOT NULL DEFAULT '1',
2148`design` int(1) NOT NULL DEFAULT '0',
2149`calendar` int(1) NOT NULL DEFAULT '1',
2150`data_entry` text COLLATE utf8mb4_unicode_ci DEFAULT NULL,
2151`api_token` varchar(32) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
2152`api_export` int(1) NOT NULL DEFAULT '0',
2153`api_import` int(1) NOT NULL DEFAULT '0',
2154`mobile_app` int(1) NOT NULL DEFAULT '0',
2155`mobile_app_download_data` int(1) NOT NULL DEFAULT '0',
2156`record_create` int(1) NOT NULL DEFAULT '1',
2157`record_rename` int(1) NOT NULL DEFAULT '0',
2158`record_delete` int(1) NOT NULL DEFAULT '0',
2159`dts` int(1) NOT NULL DEFAULT '0' COMMENT 'DTS adjudication page',
2160`participants` int(1) NOT NULL DEFAULT '1',
2161`data_quality_design` int(1) NOT NULL DEFAULT '0',
2162`data_quality_execute` int(1) NOT NULL DEFAULT '0',
2163`data_quality_resolution` int(1) NOT NULL DEFAULT '0' COMMENT '0=No access, 1=View only, 2=Respond, 3=Open, close, respond, 4=Open only, 5=Open and respond',
2164`random_setup` int(1) NOT NULL DEFAULT '0',
2165`random_dashboard` int(1) NOT NULL DEFAULT '0',
2166`random_perform` int(1) NOT NULL DEFAULT '0',
2167`realtime_webservice_mapping` int(1) NOT NULL DEFAULT '0' COMMENT 'User can map fields for RTWS',
2168`realtime_webservice_adjudicate` int(1) NOT NULL DEFAULT '0' COMMENT 'User can adjudicate data for RTWS',
2169`external_module_config` text COLLATE utf8mb4_unicode_ci DEFAULT NULL,
2170PRIMARY KEY (`project_id`,`username`),
2171UNIQUE KEY `api_token` (`api_token`),
2172KEY `group_id` (`group_id`),
2173KEY `project_id` (`project_id`),
2174KEY `role_id` (`role_id`),
2175KEY `username` (`username`)
2176) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2177
2178CREATE TABLE `redcap_user_roles` (
2179`role_id` int(10) NOT NULL AUTO_INCREMENT,
2180`project_id` int(10) DEFAULT NULL,
2181`role_name` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Name of user role',
2182`lock_record` int(1) NOT NULL DEFAULT '0',
2183`lock_record_multiform` int(1) NOT NULL DEFAULT '0',
2184`lock_record_customize` int(1) NOT NULL DEFAULT '0',
2185`data_export_tool` int(1) NOT NULL DEFAULT '1',
2186`data_import_tool` int(1) NOT NULL DEFAULT '1',
2187`data_comparison_tool` int(1) NOT NULL DEFAULT '1',
2188`data_logging` int(1) NOT NULL DEFAULT '1',
2189`file_repository` int(1) NOT NULL DEFAULT '1',
2190`double_data` int(1) NOT NULL DEFAULT '0',
2191`user_rights` int(1) NOT NULL DEFAULT '1',
2192`data_access_groups` int(1) NOT NULL DEFAULT '1',
2193`graphical` int(1) NOT NULL DEFAULT '1',
2194`reports` int(1) NOT NULL DEFAULT '1',
2195`design` int(1) NOT NULL DEFAULT '0',
2196`calendar` int(1) NOT NULL DEFAULT '1',
2197`data_entry` text COLLATE utf8mb4_unicode_ci DEFAULT NULL,
2198`api_export` int(1) NOT NULL DEFAULT '0',
2199`api_import` int(1) NOT NULL DEFAULT '0',
2200`mobile_app` int(1) NOT NULL DEFAULT '0',
2201`mobile_app_download_data` int(1) NOT NULL DEFAULT '0',
2202`record_create` int(1) NOT NULL DEFAULT '1',
2203`record_rename` int(1) NOT NULL DEFAULT '0',
2204`record_delete` int(1) NOT NULL DEFAULT '0',
2205`dts` int(1) NOT NULL DEFAULT '0' COMMENT 'DTS adjudication page',
2206`participants` int(1) NOT NULL DEFAULT '1',
2207`data_quality_design` int(1) NOT NULL DEFAULT '0',
2208`data_quality_execute` int(1) NOT NULL DEFAULT '0',
2209`data_quality_resolution` int(1) NOT NULL DEFAULT '0' COMMENT '0=No access, 1=View only, 2=Respond, 3=Open, close, respond',
2210`random_setup` int(1) NOT NULL DEFAULT '0',
2211`random_dashboard` int(1) NOT NULL DEFAULT '0',
2212`random_perform` int(1) NOT NULL DEFAULT '0',
2213`realtime_webservice_mapping` int(1) NOT NULL DEFAULT '0' COMMENT 'User can map fields for RTWS',
2214`realtime_webservice_adjudicate` int(1) NOT NULL DEFAULT '0' COMMENT 'User can adjudicate data for RTWS',
2215`external_module_config` text COLLATE utf8mb4_unicode_ci DEFAULT NULL,
2216PRIMARY KEY (`role_id`),
2217KEY `project_id` (`project_id`)
2218) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2219
2220CREATE TABLE `redcap_user_whitelist` (
2221`username` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
2222PRIMARY KEY (`username`)
2223) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2224
2225CREATE TABLE `redcap_validation_types` (
2226`validation_name` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'Unique name for Data Dictionary',
2227`validation_label` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Label in Online Designer',
2228`regex_js` text COLLATE utf8mb4_unicode_ci DEFAULT NULL,
2229`regex_php` text COLLATE utf8mb4_unicode_ci DEFAULT NULL,
2230`data_type` enum('date','datetime','datetime_seconds','email','integer','mrn','number','number_comma_decimal','phone','postal_code','ssn','text','time','char') COLLATE utf8mb4_unicode_ci DEFAULT NULL,
2231`legacy_value` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
2232`visible` int(1) NOT NULL DEFAULT '1' COMMENT 'Show in Online Designer?',
2233UNIQUE KEY `validation_name` (`validation_name`),
2234KEY `data_type` (`data_type`)
2235) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2236
2237CREATE TABLE `redcap_web_service_cache` (
2238`cache_id` int(10) NOT NULL AUTO_INCREMENT,
2239`project_id` int(10) DEFAULT NULL,
2240`service` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
2241`category` varchar(150) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
2242`value` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
2243`label` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
2244PRIMARY KEY (`cache_id`),
2245UNIQUE KEY `project_service_cat_value` (`project_id`,`service`,`category`,`value`),
2246KEY `category` (`category`)
2247) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2248
2249ALTER TABLE `redcap_actions`
2250ADD FOREIGN KEY (`project_id`) REFERENCES `redcap_projects` (`project_id`) ON DELETE CASCADE ON UPDATE CASCADE,
2251ADD FOREIGN KEY (`recipient_id`) REFERENCES `redcap_user_information` (`ui_id`) ON DELETE CASCADE ON UPDATE CASCADE,
2252ADD FOREIGN KEY (`survey_id`) REFERENCES `redcap_surveys` (`survey_id`) ON DELETE CASCADE ON UPDATE CASCADE;
2253
2254ALTER TABLE `redcap_alerts`
2255ADD FOREIGN KEY (`email_attachment1`) REFERENCES `redcap_edocs_metadata` (`doc_id`) ON DELETE CASCADE ON UPDATE CASCADE,
2256ADD FOREIGN KEY (`email_attachment2`) REFERENCES `redcap_edocs_metadata` (`doc_id`) ON DELETE CASCADE ON UPDATE CASCADE,
2257ADD FOREIGN KEY (`email_attachment3`) REFERENCES `redcap_edocs_metadata` (`doc_id`) ON DELETE CASCADE ON UPDATE CASCADE,
2258ADD FOREIGN KEY (`email_attachment4`) REFERENCES `redcap_edocs_metadata` (`doc_id`) ON DELETE CASCADE ON UPDATE CASCADE,
2259ADD FOREIGN KEY (`email_attachment5`) REFERENCES `redcap_edocs_metadata` (`doc_id`) ON DELETE CASCADE ON UPDATE CASCADE,
2260ADD FOREIGN KEY (`form_name_event`) REFERENCES `redcap_events_metadata` (`event_id`),
2261ADD FOREIGN KEY (`project_id`) REFERENCES `redcap_projects` (`project_id`) ON DELETE CASCADE ON UPDATE CASCADE;
2262
2263ALTER TABLE `redcap_alerts_recurrence`
2264ADD FOREIGN KEY (`alert_id`) REFERENCES `redcap_alerts` (`alert_id`) ON DELETE CASCADE ON UPDATE CASCADE,
2265ADD FOREIGN KEY (`event_id`) REFERENCES `redcap_events_metadata` (`event_id`);
2266
2267ALTER TABLE `redcap_alerts_sent`
2268ADD FOREIGN KEY (`alert_id`) REFERENCES `redcap_alerts` (`alert_id`) ON DELETE CASCADE ON UPDATE CASCADE,
2269ADD FOREIGN KEY (`event_id`) REFERENCES `redcap_events_metadata` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE;
2270
2271ALTER TABLE `redcap_alerts_sent_log`
2272ADD FOREIGN KEY (`alert_sent_id`) REFERENCES `redcap_alerts_sent` (`alert_sent_id`) ON DELETE CASCADE ON UPDATE CASCADE;
2273
2274ALTER TABLE `redcap_auth`
2275ADD FOREIGN KEY (`password_question`) REFERENCES `redcap_auth_questions` (`qid`) ON DELETE SET NULL ON UPDATE CASCADE;
2276
2277ALTER TABLE `redcap_crons`
2278ADD FOREIGN KEY (`external_module_id`) REFERENCES `redcap_external_modules` (`external_module_id`) ON DELETE CASCADE ON UPDATE CASCADE;
2279
2280ALTER TABLE `redcap_crons_history`
2281ADD FOREIGN KEY (`cron_id`) REFERENCES `redcap_crons` (`cron_id`) ON DELETE SET NULL ON UPDATE CASCADE;
2282
2283ALTER TABLE `redcap_data_access_groups`
2284ADD FOREIGN KEY (`project_id`) REFERENCES `redcap_projects` (`project_id`) ON DELETE CASCADE ON UPDATE CASCADE;
2285
2286ALTER TABLE `redcap_data_dictionaries`
2287ADD FOREIGN KEY (`doc_id`) REFERENCES `redcap_edocs_metadata` (`doc_id`) ON DELETE CASCADE ON UPDATE CASCADE,
2288ADD FOREIGN KEY (`project_id`) REFERENCES `redcap_projects` (`project_id`) ON DELETE CASCADE ON UPDATE CASCADE,
2289ADD FOREIGN KEY (`ui_id`) REFERENCES `redcap_user_information` (`ui_id`) ON DELETE SET NULL ON UPDATE CASCADE;
2290
2291ALTER TABLE `redcap_data_quality_resolutions`
2292ADD FOREIGN KEY (`status_id`) REFERENCES `redcap_data_quality_status` (`status_id`) ON DELETE CASCADE ON UPDATE CASCADE,
2293ADD FOREIGN KEY (`upload_doc_id`) REFERENCES `redcap_edocs_metadata` (`doc_id`) ON DELETE SET NULL ON UPDATE CASCADE,
2294ADD FOREIGN KEY (`user_id`) REFERENCES `redcap_user_information` (`ui_id`) ON DELETE SET NULL ON UPDATE CASCADE;
2295
2296ALTER TABLE `redcap_data_quality_rules`
2297ADD FOREIGN KEY (`project_id`) REFERENCES `redcap_projects` (`project_id`) ON DELETE CASCADE ON UPDATE CASCADE;
2298
2299ALTER TABLE `redcap_data_quality_status`
2300ADD FOREIGN KEY (`assigned_user_id`) REFERENCES `redcap_user_information` (`ui_id`) ON DELETE SET NULL ON UPDATE CASCADE,
2301ADD FOREIGN KEY (`event_id`) REFERENCES `redcap_events_metadata` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE,
2302ADD FOREIGN KEY (`project_id`) REFERENCES `redcap_projects` (`project_id`) ON DELETE CASCADE ON UPDATE CASCADE,
2303ADD FOREIGN KEY (`rule_id`) REFERENCES `redcap_data_quality_rules` (`rule_id`) ON DELETE CASCADE ON UPDATE CASCADE;
2304
2305ALTER TABLE `redcap_ddp_log_view`
2306ADD FOREIGN KEY (`project_id`) REFERENCES `redcap_projects` (`project_id`) ON DELETE CASCADE ON UPDATE CASCADE,
2307ADD FOREIGN KEY (`user_id`) REFERENCES `redcap_user_information` (`ui_id`) ON DELETE SET NULL ON UPDATE CASCADE;
2308
2309ALTER TABLE `redcap_ddp_log_view_data`
2310ADD FOREIGN KEY (`md_id`) REFERENCES `redcap_ddp_records_data` (`md_id`) ON DELETE SET NULL ON UPDATE CASCADE,
2311ADD FOREIGN KEY (`ml_id`) REFERENCES `redcap_ddp_log_view` (`ml_id`) ON DELETE CASCADE ON UPDATE CASCADE;
2312
2313ALTER TABLE `redcap_ddp_mapping`
2314ADD FOREIGN KEY (`event_id`) REFERENCES `redcap_events_metadata` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE,
2315ADD FOREIGN KEY (`project_id`) REFERENCES `redcap_projects` (`project_id`) ON DELETE CASCADE ON UPDATE CASCADE;
2316
2317ALTER TABLE `redcap_ddp_preview_fields`
2318ADD FOREIGN KEY (`project_id`) REFERENCES `redcap_projects` (`project_id`) ON DELETE CASCADE ON UPDATE CASCADE;
2319
2320ALTER TABLE `redcap_ddp_records`
2321ADD FOREIGN KEY (`project_id`) REFERENCES `redcap_projects` (`project_id`) ON DELETE CASCADE ON UPDATE CASCADE;
2322
2323ALTER TABLE `redcap_ddp_records_data`
2324ADD FOREIGN KEY (`map_id`) REFERENCES `redcap_ddp_mapping` (`map_id`) ON DELETE CASCADE ON UPDATE CASCADE,
2325ADD FOREIGN KEY (`mr_id`) REFERENCES `redcap_ddp_records` (`mr_id`) ON DELETE CASCADE ON UPDATE CASCADE;
2326
2327ALTER TABLE `redcap_docs`
2328ADD FOREIGN KEY (`project_id`) REFERENCES `redcap_projects` (`project_id`) ON DELETE CASCADE ON UPDATE CASCADE;
2329
2330ALTER TABLE `redcap_docs_to_edocs`
2331ADD FOREIGN KEY (`doc_id`) REFERENCES `redcap_edocs_metadata` (`doc_id`) ON DELETE CASCADE ON UPDATE CASCADE,
2332ADD FOREIGN KEY (`docs_id`) REFERENCES `redcap_docs` (`docs_id`) ON DELETE CASCADE ON UPDATE CASCADE;
2333
2334ALTER TABLE `redcap_edocs_metadata`
2335ADD FOREIGN KEY (`project_id`) REFERENCES `redcap_projects` (`project_id`) ON DELETE SET NULL ON UPDATE CASCADE;
2336
2337ALTER TABLE `redcap_ehr_access_tokens`
2338ADD FOREIGN KEY (`token_owner`) REFERENCES `redcap_user_information` (`ui_id`) ON DELETE CASCADE ON UPDATE CASCADE;
2339
2340ALTER TABLE `redcap_ehr_datamart_revisions`
2341ADD FOREIGN KEY (`project_id`) REFERENCES `redcap_projects` (`project_id`) ON DELETE CASCADE ON UPDATE CASCADE,
2342ADD FOREIGN KEY (`request_id`) REFERENCES `redcap_todo_list` (`request_id`) ON DELETE CASCADE ON UPDATE CASCADE,
2343ADD FOREIGN KEY (`user_id`) REFERENCES `redcap_user_information` (`ui_id`) ON DELETE CASCADE ON UPDATE CASCADE;
2344
2345ALTER TABLE `redcap_ehr_import_counts`
2346ADD FOREIGN KEY (`project_id`) REFERENCES `redcap_projects` (`project_id`) ON DELETE CASCADE ON UPDATE CASCADE;
2347
2348ALTER TABLE `redcap_ehr_user_map`
2349ADD FOREIGN KEY (`redcap_userid`) REFERENCES `redcap_user_information` (`ui_id`) ON DELETE CASCADE ON UPDATE CASCADE;
2350
2351ALTER TABLE `redcap_ehr_user_projects`
2352ADD FOREIGN KEY (`project_id`) REFERENCES `redcap_projects` (`project_id`) ON DELETE CASCADE ON UPDATE CASCADE,
2353ADD FOREIGN KEY (`redcap_userid`) REFERENCES `redcap_user_information` (`ui_id`) ON DELETE CASCADE ON UPDATE CASCADE;
2354
2355ALTER TABLE `redcap_esignatures`
2356ADD FOREIGN KEY (`event_id`) REFERENCES `redcap_events_metadata` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE,
2357ADD FOREIGN KEY (`project_id`) REFERENCES `redcap_projects` (`project_id`) ON DELETE CASCADE ON UPDATE CASCADE;
2358
2359ALTER TABLE `redcap_events_arms`
2360ADD FOREIGN KEY (`project_id`) REFERENCES `redcap_projects` (`project_id`) ON DELETE CASCADE ON UPDATE CASCADE;
2361
2362ALTER TABLE `redcap_events_calendar`
2363ADD FOREIGN KEY (`event_id`) REFERENCES `redcap_events_metadata` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE,
2364ADD FOREIGN KEY (`group_id`) REFERENCES `redcap_data_access_groups` (`group_id`) ON DELETE SET NULL ON UPDATE CASCADE,
2365ADD FOREIGN KEY (`project_id`) REFERENCES `redcap_projects` (`project_id`) ON DELETE CASCADE ON UPDATE CASCADE;
2366
2367ALTER TABLE `redcap_events_forms`
2368ADD FOREIGN KEY (`event_id`) REFERENCES `redcap_events_metadata` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE;
2369
2370ALTER TABLE `redcap_events_metadata`
2371ADD FOREIGN KEY (`arm_id`) REFERENCES `redcap_events_arms` (`arm_id`) ON DELETE CASCADE ON UPDATE CASCADE;
2372
2373ALTER TABLE `redcap_events_repeat`
2374ADD FOREIGN KEY (`event_id`) REFERENCES `redcap_events_metadata` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE;
2375
2376ALTER TABLE `redcap_external_links`
2377ADD FOREIGN KEY (`link_to_project_id`) REFERENCES `redcap_projects` (`project_id`) ON DELETE CASCADE ON UPDATE CASCADE,
2378ADD FOREIGN KEY (`project_id`) REFERENCES `redcap_projects` (`project_id`) ON DELETE CASCADE ON UPDATE CASCADE;
2379
2380ALTER TABLE `redcap_external_links_dags`
2381ADD FOREIGN KEY (`ext_id`) REFERENCES `redcap_external_links` (`ext_id`) ON DELETE CASCADE ON UPDATE CASCADE,
2382ADD FOREIGN KEY (`group_id`) REFERENCES `redcap_data_access_groups` (`group_id`) ON DELETE CASCADE ON UPDATE CASCADE;
2383
2384ALTER TABLE `redcap_external_links_exclude_projects`
2385ADD FOREIGN KEY (`ext_id`) REFERENCES `redcap_external_links` (`ext_id`) ON DELETE CASCADE ON UPDATE CASCADE,
2386ADD FOREIGN KEY (`project_id`) REFERENCES `redcap_projects` (`project_id`) ON DELETE CASCADE ON UPDATE CASCADE;
2387
2388ALTER TABLE `redcap_external_links_users`
2389ADD FOREIGN KEY (`ext_id`) REFERENCES `redcap_external_links` (`ext_id`) ON DELETE CASCADE ON UPDATE CASCADE;
2390
2391ALTER TABLE `redcap_external_module_settings`
2392ADD FOREIGN KEY (`external_module_id`) REFERENCES `redcap_external_modules` (`external_module_id`) ON DELETE CASCADE ON UPDATE CASCADE,
2393ADD FOREIGN KEY (`project_id`) REFERENCES `redcap_projects` (`project_id`) ON DELETE CASCADE ON UPDATE CASCADE;
2394
2395ALTER TABLE `redcap_external_modules_log_parameters`
2396ADD FOREIGN KEY (`log_id`) REFERENCES `redcap_external_modules_log` (`log_id`) ON DELETE CASCADE ON UPDATE CASCADE;
2397
2398ALTER TABLE `redcap_folders`
2399ADD FOREIGN KEY (`ui_id`) REFERENCES `redcap_user_information` (`ui_id`) ON DELETE CASCADE ON UPDATE CASCADE;
2400
2401ALTER TABLE `redcap_folders_projects`
2402ADD FOREIGN KEY (`folder_id`) REFERENCES `redcap_folders` (`folder_id`) ON DELETE CASCADE ON UPDATE CASCADE,
2403ADD FOREIGN KEY (`project_id`) REFERENCES `redcap_projects` (`project_id`) ON DELETE CASCADE ON UPDATE CASCADE,
2404ADD FOREIGN KEY (`ui_id`) REFERENCES `redcap_user_information` (`ui_id`) ON DELETE CASCADE ON UPDATE CASCADE;
2405
2406ALTER TABLE `redcap_instrument_zip`
2407ADD FOREIGN KEY (`iza_id`) REFERENCES `redcap_instrument_zip_authors` (`iza_id`) ON DELETE CASCADE ON UPDATE CASCADE;
2408
2409ALTER TABLE `redcap_library_map`
2410ADD FOREIGN KEY (`project_id`) REFERENCES `redcap_projects` (`project_id`) ON DELETE CASCADE ON UPDATE CASCADE;
2411
2412ALTER TABLE `redcap_locking_data`
2413ADD FOREIGN KEY (`event_id`) REFERENCES `redcap_events_metadata` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE,
2414ADD FOREIGN KEY (`project_id`) REFERENCES `redcap_projects` (`project_id`) ON DELETE CASCADE ON UPDATE CASCADE;
2415
2416ALTER TABLE `redcap_locking_labels`
2417ADD FOREIGN KEY (`project_id`) REFERENCES `redcap_projects` (`project_id`) ON DELETE CASCADE ON UPDATE CASCADE;
2418
2419ALTER TABLE `redcap_log_view_requests`
2420ADD FOREIGN KEY (`log_view_id`) REFERENCES `redcap_log_view` (`log_view_id`) ON DELETE CASCADE ON UPDATE CASCADE,
2421ADD FOREIGN KEY (`ui_id`) REFERENCES `redcap_user_information` (`ui_id`) ON DELETE SET NULL ON UPDATE CASCADE;
2422
2423ALTER TABLE `redcap_messages`
2424ADD FOREIGN KEY (`attachment_doc_id`) REFERENCES `redcap_edocs_metadata` (`doc_id`) ON DELETE CASCADE ON UPDATE CASCADE,
2425ADD FOREIGN KEY (`author_user_id`) REFERENCES `redcap_user_information` (`ui_id`) ON DELETE CASCADE ON UPDATE CASCADE,
2426ADD FOREIGN KEY (`thread_id`) REFERENCES `redcap_messages_threads` (`thread_id`) ON DELETE CASCADE ON UPDATE CASCADE;
2427
2428ALTER TABLE `redcap_messages_recipients`
2429ADD FOREIGN KEY (`recipient_user_id`) REFERENCES `redcap_user_information` (`ui_id`) ON DELETE CASCADE ON UPDATE CASCADE,
2430ADD FOREIGN KEY (`thread_id`) REFERENCES `redcap_messages_threads` (`thread_id`) ON DELETE CASCADE ON UPDATE CASCADE;
2431
2432ALTER TABLE `redcap_messages_status`
2433ADD FOREIGN KEY (`message_id`) REFERENCES `redcap_messages` (`message_id`) ON DELETE CASCADE ON UPDATE CASCADE,
2434ADD FOREIGN KEY (`recipient_id`) REFERENCES `redcap_messages_recipients` (`recipient_id`) ON DELETE CASCADE ON UPDATE CASCADE,
2435ADD FOREIGN KEY (`recipient_user_id`) REFERENCES `redcap_user_information` (`ui_id`) ON DELETE CASCADE ON UPDATE CASCADE;
2436
2437ALTER TABLE `redcap_messages_threads`
2438ADD FOREIGN KEY (`project_id`) REFERENCES `redcap_projects` (`project_id`) ON DELETE SET NULL ON UPDATE CASCADE;
2439
2440ALTER TABLE `redcap_metadata`
2441ADD FOREIGN KEY (`edoc_id`) REFERENCES `redcap_edocs_metadata` (`doc_id`) ON DELETE SET NULL ON UPDATE CASCADE,
2442ADD FOREIGN KEY (`project_id`) REFERENCES `redcap_projects` (`project_id`) ON DELETE CASCADE ON UPDATE CASCADE;
2443
2444ALTER TABLE `redcap_metadata_archive`
2445ADD FOREIGN KEY (`edoc_id`) REFERENCES `redcap_edocs_metadata` (`doc_id`) ON DELETE SET NULL ON UPDATE CASCADE,
2446ADD FOREIGN KEY (`pr_id`) REFERENCES `redcap_metadata_prod_revisions` (`pr_id`) ON DELETE SET NULL ON UPDATE CASCADE,
2447ADD FOREIGN KEY (`project_id`) REFERENCES `redcap_projects` (`project_id`) ON DELETE CASCADE ON UPDATE CASCADE;
2448
2449ALTER TABLE `redcap_metadata_prod_revisions`
2450ADD FOREIGN KEY (`project_id`) REFERENCES `redcap_projects` (`project_id`) ON DELETE CASCADE ON UPDATE CASCADE,
2451ADD FOREIGN KEY (`ui_id_approver`) REFERENCES `redcap_user_information` (`ui_id`) ON DELETE SET NULL ON UPDATE CASCADE,
2452ADD FOREIGN KEY (`ui_id_requester`) REFERENCES `redcap_user_information` (`ui_id`) ON DELETE SET NULL ON UPDATE CASCADE;
2453
2454ALTER TABLE `redcap_metadata_temp`
2455ADD FOREIGN KEY (`edoc_id`) REFERENCES `redcap_edocs_metadata` (`doc_id`) ON DELETE SET NULL ON UPDATE CASCADE,
2456ADD FOREIGN KEY (`project_id`) REFERENCES `redcap_projects` (`project_id`) ON DELETE CASCADE ON UPDATE CASCADE;
2457
2458ALTER TABLE `redcap_mobile_app_devices`
2459ADD FOREIGN KEY (`project_id`) REFERENCES `redcap_projects` (`project_id`) ON DELETE CASCADE ON UPDATE CASCADE;
2460
2461ALTER TABLE `redcap_mobile_app_files`
2462ADD FOREIGN KEY (`device_id`) REFERENCES `redcap_mobile_app_devices` (`device_id`) ON DELETE SET NULL ON UPDATE CASCADE,
2463ADD FOREIGN KEY (`doc_id`) REFERENCES `redcap_edocs_metadata` (`doc_id`) ON DELETE CASCADE ON UPDATE CASCADE,
2464ADD FOREIGN KEY (`user_id`) REFERENCES `redcap_user_information` (`ui_id`) ON DELETE SET NULL ON UPDATE CASCADE;
2465
2466ALTER TABLE `redcap_mobile_app_log`
2467ADD FOREIGN KEY (`device_id`) REFERENCES `redcap_mobile_app_devices` (`device_id`) ON DELETE SET NULL ON UPDATE CASCADE,
2468ADD FOREIGN KEY (`project_id`) REFERENCES `redcap_projects` (`project_id`) ON DELETE CASCADE ON UPDATE CASCADE,
2469ADD FOREIGN KEY (`ui_id`) REFERENCES `redcap_user_information` (`ui_id`) ON DELETE SET NULL ON UPDATE CASCADE;
2470
2471ALTER TABLE `redcap_new_record_cache`
2472ADD FOREIGN KEY (`arm_id`) REFERENCES `redcap_events_arms` (`arm_id`) ON DELETE CASCADE ON UPDATE CASCADE,
2473ADD FOREIGN KEY (`event_id`) REFERENCES `redcap_events_metadata` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE,
2474ADD FOREIGN KEY (`project_id`) REFERENCES `redcap_projects` (`project_id`) ON DELETE CASCADE ON UPDATE CASCADE;
2475
2476ALTER TABLE `redcap_project_checklist`
2477ADD FOREIGN KEY (`project_id`) REFERENCES `redcap_projects` (`project_id`) ON DELETE CASCADE ON UPDATE CASCADE;
2478
2479ALTER TABLE `redcap_projects`
2480ADD FOREIGN KEY (`created_by`) REFERENCES `redcap_user_information` (`ui_id`) ON DELETE SET NULL ON UPDATE CASCADE,
2481ADD FOREIGN KEY (`survey_auth_event_id1`) REFERENCES `redcap_events_metadata` (`event_id`) ON DELETE SET NULL ON UPDATE CASCADE,
2482ADD FOREIGN KEY (`survey_auth_event_id2`) REFERENCES `redcap_events_metadata` (`event_id`) ON DELETE SET NULL ON UPDATE CASCADE,
2483ADD FOREIGN KEY (`survey_auth_event_id3`) REFERENCES `redcap_events_metadata` (`event_id`) ON DELETE SET NULL ON UPDATE CASCADE,
2484ADD FOREIGN KEY (`template_id`) REFERENCES `redcap_projects` (`project_id`) ON DELETE SET NULL ON UPDATE CASCADE;
2485
2486ALTER TABLE `redcap_projects_templates`
2487ADD FOREIGN KEY (`project_id`) REFERENCES `redcap_projects` (`project_id`) ON DELETE CASCADE ON UPDATE CASCADE;
2488
2489ALTER TABLE `redcap_projects_user_hidden`
2490ADD FOREIGN KEY (`project_id`) REFERENCES `redcap_projects` (`project_id`) ON DELETE CASCADE ON UPDATE CASCADE,
2491ADD FOREIGN KEY (`ui_id`) REFERENCES `redcap_user_information` (`ui_id`) ON DELETE CASCADE ON UPDATE CASCADE;
2492
2493ALTER TABLE `redcap_pub_articles`
2494ADD FOREIGN KEY (`pubsrc_id`) REFERENCES `redcap_pub_sources` (`pubsrc_id`);
2495
2496ALTER TABLE `redcap_pub_authors`
2497ADD FOREIGN KEY (`article_id`) REFERENCES `redcap_pub_articles` (`article_id`) ON DELETE CASCADE ON UPDATE CASCADE;
2498
2499ALTER TABLE `redcap_pub_matches`
2500ADD FOREIGN KEY (`article_id`) REFERENCES `redcap_pub_articles` (`article_id`) ON UPDATE CASCADE,
2501ADD FOREIGN KEY (`project_id`) REFERENCES `redcap_projects` (`project_id`) ON UPDATE CASCADE;
2502
2503ALTER TABLE `redcap_pub_mesh_terms`
2504ADD FOREIGN KEY (`article_id`) REFERENCES `redcap_pub_articles` (`article_id`) ON DELETE CASCADE ON UPDATE CASCADE;
2505
2506ALTER TABLE `redcap_randomization`
2507ADD FOREIGN KEY (`project_id`) REFERENCES `redcap_projects` (`project_id`) ON DELETE CASCADE ON UPDATE CASCADE,
2508ADD FOREIGN KEY (`source_event1`) REFERENCES `redcap_events_metadata` (`event_id`) ON DELETE SET NULL ON UPDATE CASCADE,
2509ADD FOREIGN KEY (`source_event10`) REFERENCES `redcap_events_metadata` (`event_id`) ON DELETE SET NULL ON UPDATE CASCADE,
2510ADD FOREIGN KEY (`source_event11`) REFERENCES `redcap_events_metadata` (`event_id`) ON DELETE SET NULL ON UPDATE CASCADE,
2511ADD FOREIGN KEY (`source_event12`) REFERENCES `redcap_events_metadata` (`event_id`) ON DELETE SET NULL ON UPDATE CASCADE,
2512ADD FOREIGN KEY (`source_event13`) REFERENCES `redcap_events_metadata` (`event_id`) ON DELETE SET NULL ON UPDATE CASCADE,
2513ADD FOREIGN KEY (`source_event14`) REFERENCES `redcap_events_metadata` (`event_id`) ON DELETE SET NULL ON UPDATE CASCADE,
2514ADD FOREIGN KEY (`source_event15`) REFERENCES `redcap_events_metadata` (`event_id`) ON DELETE SET NULL ON UPDATE CASCADE,
2515ADD FOREIGN KEY (`source_event2`) REFERENCES `redcap_events_metadata` (`event_id`) ON DELETE SET NULL ON UPDATE CASCADE,
2516ADD FOREIGN KEY (`source_event3`) REFERENCES `redcap_events_metadata` (`event_id`) ON DELETE SET NULL ON UPDATE CASCADE,
2517ADD FOREIGN KEY (`source_event4`) REFERENCES `redcap_events_metadata` (`event_id`) ON DELETE SET NULL ON UPDATE CASCADE,
2518ADD FOREIGN KEY (`source_event5`) REFERENCES `redcap_events_metadata` (`event_id`) ON DELETE SET NULL ON UPDATE CASCADE,
2519ADD FOREIGN KEY (`source_event6`) REFERENCES `redcap_events_metadata` (`event_id`) ON DELETE SET NULL ON UPDATE CASCADE,
2520ADD FOREIGN KEY (`source_event7`) REFERENCES `redcap_events_metadata` (`event_id`) ON DELETE SET NULL ON UPDATE CASCADE,
2521ADD FOREIGN KEY (`source_event8`) REFERENCES `redcap_events_metadata` (`event_id`) ON DELETE SET NULL ON UPDATE CASCADE,
2522ADD FOREIGN KEY (`source_event9`) REFERENCES `redcap_events_metadata` (`event_id`) ON DELETE SET NULL ON UPDATE CASCADE,
2523ADD FOREIGN KEY (`target_event`) REFERENCES `redcap_events_metadata` (`event_id`) ON DELETE SET NULL ON UPDATE CASCADE;
2524
2525ALTER TABLE `redcap_randomization_allocation`
2526ADD FOREIGN KEY (`group_id`) REFERENCES `redcap_data_access_groups` (`group_id`) ON DELETE SET NULL ON UPDATE CASCADE,
2527ADD FOREIGN KEY (`rid`) REFERENCES `redcap_randomization` (`rid`) ON DELETE CASCADE ON UPDATE CASCADE;
2528
2529ALTER TABLE `redcap_record_counts`
2530ADD FOREIGN KEY (`project_id`) REFERENCES `redcap_projects` (`project_id`) ON DELETE CASCADE ON UPDATE CASCADE;
2531
2532ALTER TABLE `redcap_record_dashboards`
2533ADD FOREIGN KEY (`project_id`) REFERENCES `redcap_projects` (`project_id`) ON DELETE CASCADE ON UPDATE CASCADE,
2534ADD FOREIGN KEY (`sort_event_id`) REFERENCES `redcap_events_metadata` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE;
2535
2536ALTER TABLE `redcap_record_list`
2537ADD FOREIGN KEY (`dag_id`) REFERENCES `redcap_data_access_groups` (`group_id`) ON DELETE CASCADE ON UPDATE CASCADE,
2538ADD FOREIGN KEY (`project_id`) REFERENCES `redcap_projects` (`project_id`) ON DELETE CASCADE ON UPDATE CASCADE;
2539
2540ALTER TABLE `redcap_reports`
2541ADD FOREIGN KEY (`project_id`) REFERENCES `redcap_projects` (`project_id`) ON DELETE CASCADE ON UPDATE CASCADE;
2542
2543ALTER TABLE `redcap_reports_access_dags`
2544ADD FOREIGN KEY (`group_id`) REFERENCES `redcap_data_access_groups` (`group_id`) ON DELETE CASCADE ON UPDATE CASCADE,
2545ADD FOREIGN KEY (`report_id`) REFERENCES `redcap_reports` (`report_id`) ON DELETE CASCADE ON UPDATE CASCADE;
2546
2547ALTER TABLE `redcap_reports_access_roles`
2548ADD FOREIGN KEY (`report_id`) REFERENCES `redcap_reports` (`report_id`) ON DELETE CASCADE ON UPDATE CASCADE,
2549ADD FOREIGN KEY (`role_id`) REFERENCES `redcap_user_roles` (`role_id`) ON DELETE CASCADE ON UPDATE CASCADE;
2550
2551ALTER TABLE `redcap_reports_access_users`
2552ADD FOREIGN KEY (`report_id`) REFERENCES `redcap_reports` (`report_id`) ON DELETE CASCADE ON UPDATE CASCADE;
2553
2554ALTER TABLE `redcap_reports_edit_access_dags`
2555ADD FOREIGN KEY (`group_id`) REFERENCES `redcap_data_access_groups` (`group_id`) ON DELETE CASCADE ON UPDATE CASCADE,
2556ADD FOREIGN KEY (`report_id`) REFERENCES `redcap_reports` (`report_id`) ON DELETE CASCADE ON UPDATE CASCADE;
2557
2558ALTER TABLE `redcap_reports_edit_access_roles`
2559ADD FOREIGN KEY (`report_id`) REFERENCES `redcap_reports` (`report_id`) ON DELETE CASCADE ON UPDATE CASCADE,
2560ADD FOREIGN KEY (`role_id`) REFERENCES `redcap_user_roles` (`role_id`) ON DELETE CASCADE ON UPDATE CASCADE;
2561
2562ALTER TABLE `redcap_reports_edit_access_users`
2563ADD FOREIGN KEY (`report_id`) REFERENCES `redcap_reports` (`report_id`) ON DELETE CASCADE ON UPDATE CASCADE;
2564
2565ALTER TABLE `redcap_reports_fields`
2566ADD FOREIGN KEY (`limiter_event_id`) REFERENCES `redcap_events_metadata` (`event_id`) ON DELETE SET NULL ON UPDATE CASCADE,
2567ADD FOREIGN KEY (`report_id`) REFERENCES `redcap_reports` (`report_id`) ON DELETE CASCADE ON UPDATE CASCADE;
2568
2569ALTER TABLE `redcap_reports_filter_dags`
2570ADD FOREIGN KEY (`group_id`) REFERENCES `redcap_data_access_groups` (`group_id`) ON DELETE CASCADE ON UPDATE CASCADE,
2571ADD FOREIGN KEY (`report_id`) REFERENCES `redcap_reports` (`report_id`) ON DELETE CASCADE ON UPDATE CASCADE;
2572
2573ALTER TABLE `redcap_reports_filter_events`
2574ADD FOREIGN KEY (`event_id`) REFERENCES `redcap_events_metadata` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE,
2575ADD FOREIGN KEY (`report_id`) REFERENCES `redcap_reports` (`report_id`) ON DELETE CASCADE ON UPDATE CASCADE;
2576
2577ALTER TABLE `redcap_reports_folders`
2578ADD FOREIGN KEY (`project_id`) REFERENCES `redcap_projects` (`project_id`) ON DELETE CASCADE ON UPDATE CASCADE;
2579
2580ALTER TABLE `redcap_reports_folders_items`
2581ADD FOREIGN KEY (`folder_id`) REFERENCES `redcap_reports_folders` (`folder_id`) ON DELETE CASCADE ON UPDATE CASCADE,
2582ADD FOREIGN KEY (`report_id`) REFERENCES `redcap_reports` (`report_id`) ON DELETE CASCADE ON UPDATE CASCADE;
2583
2584ALTER TABLE `redcap_sendit_recipients`
2585ADD FOREIGN KEY (`document_id`) REFERENCES `redcap_sendit_docs` (`document_id`) ON DELETE CASCADE ON UPDATE CASCADE;
2586
2587ALTER TABLE `redcap_surveys`
2588ADD FOREIGN KEY (`confirmation_email_attachment`) REFERENCES `redcap_edocs_metadata` (`doc_id`) ON DELETE SET NULL ON UPDATE CASCADE,
2589ADD FOREIGN KEY (`logo`) REFERENCES `redcap_edocs_metadata` (`doc_id`) ON DELETE SET NULL ON UPDATE CASCADE,
2590ADD FOREIGN KEY (`pdf_econsent_dob_event_id`) REFERENCES `redcap_events_metadata` (`event_id`) ON DELETE SET NULL ON UPDATE CASCADE,
2591ADD FOREIGN KEY (`pdf_econsent_firstname_event_id`) REFERENCES `redcap_events_metadata` (`event_id`) ON DELETE SET NULL ON UPDATE CASCADE,
2592ADD FOREIGN KEY (`pdf_econsent_lastname_event_id`) REFERENCES `redcap_events_metadata` (`event_id`) ON DELETE SET NULL ON UPDATE CASCADE,
2593ADD FOREIGN KEY (`project_id`) REFERENCES `redcap_projects` (`project_id`) ON DELETE CASCADE ON UPDATE CASCADE,
2594ADD FOREIGN KEY (`theme`) REFERENCES `redcap_surveys_themes` (`theme_id`) ON DELETE SET NULL ON UPDATE CASCADE;
2595
2596ALTER TABLE `redcap_surveys_emails`
2597ADD FOREIGN KEY (`email_sender`) REFERENCES `redcap_user_information` (`ui_id`) ON DELETE SET NULL ON UPDATE SET NULL,
2598ADD FOREIGN KEY (`survey_id`) REFERENCES `redcap_surveys` (`survey_id`) ON DELETE CASCADE ON UPDATE CASCADE;
2599
2600ALTER TABLE `redcap_surveys_emails_recipients`
2601ADD FOREIGN KEY (`email_id`) REFERENCES `redcap_surveys_emails` (`email_id`) ON DELETE CASCADE ON UPDATE CASCADE,
2602ADD FOREIGN KEY (`participant_id`) REFERENCES `redcap_surveys_participants` (`participant_id`) ON DELETE CASCADE ON UPDATE CASCADE;
2603
2604ALTER TABLE `redcap_surveys_erase_twilio_log`
2605ADD FOREIGN KEY (`project_id`) REFERENCES `redcap_projects` (`project_id`) ON DELETE CASCADE ON UPDATE CASCADE;
2606
2607ALTER TABLE `redcap_surveys_login`
2608ADD FOREIGN KEY (`response_id`) REFERENCES `redcap_surveys_response` (`response_id`) ON DELETE CASCADE ON UPDATE CASCADE;
2609
2610ALTER TABLE `redcap_surveys_participants`
2611ADD FOREIGN KEY (`event_id`) REFERENCES `redcap_events_metadata` (`event_id`) ON DELETE SET NULL ON UPDATE CASCADE,
2612ADD FOREIGN KEY (`survey_id`) REFERENCES `redcap_surveys` (`survey_id`) ON DELETE CASCADE ON UPDATE CASCADE;
2613
2614ALTER TABLE `redcap_surveys_pdf_archive`
2615ADD FOREIGN KEY (`doc_id`) REFERENCES `redcap_edocs_metadata` (`doc_id`) ON DELETE CASCADE ON UPDATE CASCADE,
2616ADD FOREIGN KEY (`event_id`) REFERENCES `redcap_events_metadata` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE,
2617ADD FOREIGN KEY (`survey_id`) REFERENCES `redcap_surveys` (`survey_id`) ON DELETE CASCADE ON UPDATE CASCADE;
2618
2619ALTER TABLE `redcap_surveys_phone_codes`
2620ADD FOREIGN KEY (`project_id`) REFERENCES `redcap_projects` (`project_id`) ON DELETE CASCADE ON UPDATE CASCADE;
2621
2622ALTER TABLE `redcap_surveys_queue`
2623ADD FOREIGN KEY (`condition_surveycomplete_event_id`) REFERENCES `redcap_events_metadata` (`event_id`) ON DELETE SET NULL ON UPDATE CASCADE,
2624ADD FOREIGN KEY (`condition_surveycomplete_survey_id`) REFERENCES `redcap_surveys` (`survey_id`) ON DELETE SET NULL ON UPDATE CASCADE,
2625ADD FOREIGN KEY (`event_id`) REFERENCES `redcap_events_metadata` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE,
2626ADD FOREIGN KEY (`survey_id`) REFERENCES `redcap_surveys` (`survey_id`) ON DELETE CASCADE ON UPDATE CASCADE;
2627
2628ALTER TABLE `redcap_surveys_queue_hashes`
2629ADD FOREIGN KEY (`project_id`) REFERENCES `redcap_projects` (`project_id`) ON DELETE CASCADE ON UPDATE CASCADE;
2630
2631ALTER TABLE `redcap_surveys_response`
2632ADD FOREIGN KEY (`participant_id`) REFERENCES `redcap_surveys_participants` (`participant_id`) ON DELETE CASCADE ON UPDATE CASCADE;
2633
2634ALTER TABLE `redcap_surveys_scheduler`
2635ADD FOREIGN KEY (`condition_surveycomplete_event_id`) REFERENCES `redcap_events_metadata` (`event_id`) ON DELETE SET NULL ON UPDATE CASCADE,
2636ADD FOREIGN KEY (`condition_surveycomplete_survey_id`) REFERENCES `redcap_surveys` (`survey_id`) ON DELETE SET NULL ON UPDATE CASCADE,
2637ADD FOREIGN KEY (`event_id`) REFERENCES `redcap_events_metadata` (`event_id`) ON DELETE CASCADE ON UPDATE CASCADE,
2638ADD FOREIGN KEY (`survey_id`) REFERENCES `redcap_surveys` (`survey_id`) ON DELETE CASCADE ON UPDATE CASCADE;
2639
2640ALTER TABLE `redcap_surveys_scheduler_queue`
2641ADD FOREIGN KEY (`email_recip_id`) REFERENCES `redcap_surveys_emails_recipients` (`email_recip_id`) ON DELETE CASCADE ON UPDATE CASCADE,
2642ADD FOREIGN KEY (`ss_id`) REFERENCES `redcap_surveys_scheduler` (`ss_id`) ON DELETE SET NULL ON UPDATE CASCADE;
2643
2644ALTER TABLE `redcap_surveys_short_codes`
2645ADD FOREIGN KEY (`participant_id`) REFERENCES `redcap_surveys_participants` (`participant_id`) ON DELETE CASCADE ON UPDATE CASCADE;
2646
2647ALTER TABLE `redcap_surveys_themes`
2648ADD FOREIGN KEY (`ui_id`) REFERENCES `redcap_user_information` (`ui_id`) ON DELETE CASCADE ON UPDATE CASCADE;
2649
2650ALTER TABLE `redcap_todo_list`
2651ADD FOREIGN KEY (`project_id`) REFERENCES `redcap_projects` (`project_id`) ON DELETE SET NULL ON UPDATE CASCADE,
2652ADD FOREIGN KEY (`request_completion_userid`) REFERENCES `redcap_user_information` (`ui_id`) ON DELETE SET NULL,
2653ADD FOREIGN KEY (`request_from`) REFERENCES `redcap_user_information` (`ui_id`) ON DELETE SET NULL ON UPDATE CASCADE;
2654
2655ALTER TABLE `redcap_two_factor_response`
2656ADD FOREIGN KEY (`user_id`) REFERENCES `redcap_user_information` (`ui_id`) ON DELETE CASCADE ON UPDATE CASCADE;
2657
2658ALTER TABLE `redcap_user_rights`
2659ADD FOREIGN KEY (`group_id`) REFERENCES `redcap_data_access_groups` (`group_id`) ON DELETE SET NULL ON UPDATE CASCADE,
2660ADD FOREIGN KEY (`project_id`) REFERENCES `redcap_projects` (`project_id`) ON DELETE CASCADE ON UPDATE CASCADE,
2661ADD FOREIGN KEY (`role_id`) REFERENCES `redcap_user_roles` (`role_id`) ON DELETE SET NULL ON UPDATE CASCADE;
2662
2663ALTER TABLE `redcap_user_roles`
2664ADD FOREIGN KEY (`project_id`) REFERENCES `redcap_projects` (`project_id`) ON DELETE CASCADE ON UPDATE CASCADE;
2665
2666ALTER TABLE `redcap_web_service_cache`
2667ADD FOREIGN KEY (`project_id`) REFERENCES `redcap_projects` (`project_id`) ON DELETE CASCADE ON UPDATE CASCADE;
2668-- REDCAP INSTALLATION INITIAL DATA --
2669
2670INSERT INTO redcap_user_information (username, user_email, user_firstname, user_lastname, super_user, user_firstvisit) VALUES
2671('site_admin', 'joe.user@projectredcap.org', 'Joe', 'User', 1, now());
2672
2673INSERT INTO redcap_crons (cron_name, cron_description, cron_enabled, cron_frequency, cron_max_run_time, cron_instances_max, cron_instances_current, cron_last_run_end, cron_times_failed, cron_external_url) VALUES
2674('PubMed', 'Query the PubMed API to find publications associated with PIs in REDCap, and store publication attributes and PI/project info. Emails will then be sent to any PIs that have been found to have publications in PubMed, and (if applicable) will be asked to associate their publication to a REDCap project.', 'DISABLED', 86400, 7200, 1, 0, NULL, 0, NULL),
2675('RemoveTempAndDeletedFiles', 'Delete all files from the REDCap temp directory, and delete all edoc and Send-It files marked for deletion.', 'ENABLED', 120, 600, 1, 0, NULL, 0, NULL),
2676('ExpireSurveys', 'For any surveys where an expiration timestamp is set, if the timestamp <= NOW, then make the survey inactive.', 'ENABLED', 120, 600, 1, 0, NULL, 0, NULL),
2677('SurveyInvitationEmailer', 'Mailer that sends any survey invitations that have been scheduled.', 'ENABLED', 60, 1800, 5, 0, NULL, 0, NULL),
2678('DeleteProjects', 'Delete all projects that are scheduled for permanent deletion', 'ENABLED', 300, 1200, 1, 0, NULL, 0, NULL),
2679('ClearIPCache', 'Clear all IP addresses older than X minutes from the redcap_ip_cache table.', 'ENABLED', 180, 60, 1, 0, NULL , 0, NULL),
2680('ExpireUsers', 'For any users whose expiration timestamp is set, if the timestamp <= NOW, then suspend the user''s account and set expiration time back to NULL.', 'ENABLED', 120, 600, 1, 0, NULL, 0, NULL),
2681('WarnUsersAccountExpiration', 'For any users whose expiration timestamp is set, if the expiration time is less than X days from now, then email the user to warn them of their impending account expiration.', 'ENABLED', 86400, 600, 1, 0, NULL, 0, NULL),
2682('SuspendInactiveUsers', 'For any users whose last login time exceeds the defined max days of inactivity, auto-suspend their account (if setting enabled).', 'ENABLED', 86400, 600, 1, 0, NULL, 0, NULL),
2683('ReminderUserAccessDashboard', 'At a regular interval, email all users to remind them to visit the User Access Dashboard page. Enables the ReminderUserAccessDashboardEmail cron job.', 'ENABLED', 86400, 600, 1, 0, NULL, 0, NULL),
2684('ReminderUserAccessDashboardEmail', 'Email all users in batches to remind them to visit the User Access Dashboard page. Will disable itself when done.', 'DISABLED', 60, 1800, 5, 0, NULL, 0, NULL),
2685('DDPQueueRecordsAllProjects', 'Queue records that are ready to be fetched from the external source system via the DDP service.', 'ENABLED', 300, 600, 1, 0, NULL, 0, NULL),
2686('DDPFetchRecordsAllProjects', 'Fetch data from the external source system for records already queued by the DDP service.', 'ENABLED', 60, 1800, 5, 0, NULL, 0, NULL),
2687('PurgeCronHistory', 'Purges all rows from the crons history table that are older than one week.', 'ENABLED', 86400, 600, 1, 0, NULL, 0, NULL),
2688('UpdateUserPasswordAlgo', 'Send email to all Table-based users telling them to log in for the purpose of upgrading their password security (one time only)', 'DISABLED', 86400, 7200, 1, 0, NULL, 0, NULL),
2689('AutomatedSurveyInvitationsDatediffChecker', 'Check all conditional logic in Automated Surveys Invitations that uses "today" inside datediff() function', 'DISABLED', 43200, 7200, 1, 0, NULL, 0, NULL),
2690('AutomatedSurveyInvitationsDatediffChecker2', 'Check all conditional logic in Automated Surveys Invitations that uses "today" inside datediff() function - replacement for AutomatedSurveyInvitationsDatediffChecker', 'ENABLED', 14400, 7200, 1, 0, NULL, 0, NULL),
2691('ClearSurveyShortCodes', 'Clear all survey short codes older than X minutes.', 'ENABLED', 300, 60, 1, 0, NULL , 0, NULL),
2692('ClearLogViewRequests', 'Clear all items from redcap_log_view_requests table older than X hours.', 'ENABLED', 1800, 300, 1, 0, NULL , 0, NULL),
2693('EraseTwilioLog', 'Clear all items from redcap_surveys_erase_twilio_log table.', 'ENABLED', 120, 300, 1, 0, NULL , 0, NULL),
2694('ClearNewRecordCache', 'Clear all items from redcap_new_record_cache table older than X hours.', 'ENABLED', 10800, 300, 1, 0, NULL , 0, NULL),
2695('FixStuckSurveyInvitations', 'Reset any survey invitations stuck in SENDING status for than X hours back to QUEUED status.', 'ENABLED', 3600, 300, 1, 0, NULL , 0, NULL),
2696('DbUsage', 'Record the daily space usage of the database tables and the uploaded files stored on the server.', 'ENABLED', 86400, 600, 1, 0, NULL, 0, NULL),
2697('RemoveOutdatedRecordCounts', 'Delete all rows from the record counts table older than X days.', 'ENABLED', 3600, 60, 1, 0, NULL, 0, NULL),
2698('DDPReencryptData', 'Re-encrypt all DDP data from the external source system.', 'ENABLED', 60, 1800, 10, 0, NULL, 0, NULL),
2699('UserMessagingEmailNotifications', 'Send notification emails to users who are logged out but have received a user message or notification.', 'ENABLED', 60, 600, 1, 0, NULL, 0, NULL),
2700('CacheStatsReportingUrl', 'Generate the stats reporting URL and store it in the config table.', 'ENABLED', 10800, 1200, 1, 0, NULL, 0, NULL),
2701('ExternalModuleValidation', 'Perform various validation checks on External Modules that are installed.', 'ENABLED', 1800, 300, 1, 0, NULL, 0, NULL),
2702('CheckREDCapRepoUpdates', 'Check if any installed External Modules have updates available on the REDCap Repo.', 'ENABLED', 10800, 300, 1, 0, NULL, 0, NULL),
2703('CheckREDCapVersionUpdates', 'Check if there is a newer REDCap version available', 'ENABLED', 10800, 300, 1, 0, NULL, 0, NULL),
2704('DeleteFileRepositoryExportFiles', 'For projects with this feature enabled, delete all archived data export files older than X days.', 'ENABLED', 43200, 300, 1, 0, NULL, 0, NULL),
2705('AlertsNotificationsSender', 'Sends notifications for Alerts', 'ENABLED', 60, 1800, 5, 0, NULL, 0, NULL),
2706('AlertsNotificationsDatediffChecker', 'Check all conditional logic in Alerts that uses "today" inside datediff() function', 'ENABLED', 14400, 7200, 1, 0, NULL, 0, NULL),
2707('ClinicalDataMartDataFetch', 'Fetches EHR data for all Clinical Data Mart projects', 'ENABLED', 43200, 3600, 1, 0, NULL, 0, NULL);
2708
2709INSERT INTO redcap_auth_questions (qid, question) VALUES
2710(1, 'What was your childhood nickname?'),
2711(2, 'In what city did you meet your spouse/significant other?'),
2712(3, 'What is the name of your favorite childhood friend?'),
2713(4, 'What street did you live on in third grade?'),
2714(5, 'What is your oldest sibling''s birthday month and year? (e.g., January 1900)'),
2715(6, 'What is the middle name of your oldest child?'),
2716(7, 'What is your oldest sibling''s middle name?'),
2717(8, 'What school did you attend for sixth grade?'),
2718(9, 'What was your childhood phone number including area code? (e.g., 000-000-0000)'),
2719(10, 'What is your oldest cousin''s first and last name?'),
2720(11, 'What was the name of your first stuffed animal?'),
2721(12, 'In what city or town did your mother and father meet?'),
2722(13, 'Where were you when you had your first kiss?'),
2723(14, 'What is the first name of the boy or girl that you first kissed?'),
2724(15, 'What was the last name of your third grade teacher?'),
2725(16, 'In what city does your nearest sibling live?'),
2726(17, 'What is your oldest brother''s birthday month and year? (e.g., January 1900)'),
2727(18, 'What is your maternal grandmother''s maiden name?'),
2728(19, 'In what city or town was your first job?'),
2729(20, 'What is the name of the place your wedding reception was held?'),
2730(21, 'What is the name of a college you applied to but didn''t attend?');
2731
2732INSERT INTO redcap_config (field_name, value) VALUES
2733('survey_pid_create_project', ''),
2734('survey_pid_move_to_prod_status', ''),
2735('survey_pid_move_to_analysis_status', ''),
2736('survey_pid_mark_completed', ''),
2737('email_alerts_converter_enabled', '0'),
2738('use_email_display_name', '1'),
2739('alerts_allow_phone_variables', '1'),
2740('alerts_allow_phone_freeform', '1'),
2741('fhir_standalone_authentication_flow', 'standalone_launch'),
2742('external_modules_allow_activation_user_request', '1'),
2743('dkim_private_key', ''),
2744('enable_url_shortener_redcap', '1'),
2745('from_email_domain_exclude', ''),
2746('fhir_include_email_address', '0'),
2747('file_upload_vault_filesystem_type', ''),
2748('file_upload_vault_filesystem_host', ''),
2749('file_upload_vault_filesystem_username', ''),
2750('file_upload_vault_filesystem_password', ''),
2751('file_upload_vault_filesystem_path', ''),
2752('file_upload_vault_filesystem_private_key_path', ''),
2753('file_upload_versioning_enabled', '1'),
2754('file_upload_versioning_global_enabled', '1'),
2755('allow_outbound_http', '1'),
2756('drw_upload_option_enabled', '1'),
2757('pdf_econsent_system_custom_text', ''),
2758('alerts_email_freeform_domain_whitelist', ''),
2759('alerts_allow_email_variables', '1'),
2760('alerts_allow_email_freeform', '1'),
2761('azure_quickstart', '0'),
2762('google_recaptcha_site_key', ''),
2763('google_recaptcha_secret_key', ''),
2764('aws_quickstart', '0'),
2765('user_messaging_prevent_admin_messaging', '0'),
2766('homepage_announcement_login', '1'),
2767('azure_app_name', ''),
2768('azure_app_secret', ''),
2769('azure_container', ''),
2770('redcap_updates_community_user', ''),
2771('redcap_updates_community_password', ''),
2772('redcap_updates_user', ''),
2773('redcap_updates_password', ''),
2774('redcap_updates_password_encrypted', '1'),
2775('redcap_updates_available', ''),
2776('redcap_updates_available_last_check', ''),
2777('realtime_webservice_convert_timestamp_from_gmt', '0'),
2778('fhir_convert_timestamp_from_gmt', '0'),
2779('db_collation', 'utf8mb4_unicode_ci'),
2780('db_character_set', 'utf8mb4'),
2781('external_modules_updates_available', ''),
2782('external_modules_updates_available_last_check', ''),
2783('pdf_econsent_system_ip', '1'),
2784('pdf_econsent_filesystem_type', ''),
2785('pdf_econsent_filesystem_host', ''),
2786('pdf_econsent_filesystem_username', ''),
2787('pdf_econsent_filesystem_password', ''),
2788('pdf_econsent_filesystem_path', ''),
2789('pdf_econsent_filesystem_private_key_path', ''),
2790('pdf_econsent_system_enabled', '1'),
2791('enable_edit_prod_repeating_setup', '1'),
2792('user_sponsor_set_expiration_days', '365'),
2793('user_sponsor_dashboard_enable', '1'),
2794('clickjacking_prevention', '0'),
2795('external_module_alt_paths', ''),
2796('aafAccessUrl', ''),
2797('aafAllowLocalsCreateDB', ''),
2798('aafAud', ''),
2799('aafDisplayOnEmailUsers', ''),
2800('aafIss', ''),
2801('aafPrimaryField', ''),
2802('aafScopeTarget', ''),
2803('external_modules_project_custom_text', ''),
2804('is_development_server', '0'),
2805('fhir_data_mart_create_project', '0'),
2806('fhir_data_fetch_interval', '24'),
2807('fhir_url_user_access', ''),
2808('fhir_custom_text', ''),
2809('fhir_display_info_project_setup', '1'),
2810('fhir_source_system_custom_name', 'EHR'),
2811('fhir_user_rights_super_users_only', '1'),
2812('fhir_stop_fetch_inactivity_days', '7'),
2813('fhir_ddp_enabled', '0'),
2814('api_token_request_type', 'admin_approve'),
2815('fhir_endpoint_authorize_url', ''),
2816('fhir_endpoint_token_url', ''),
2817('fhir_ehr_mrn_identifier', ''),
2818('fhir_client_id', ''),
2819('fhir_client_secret', ''),
2820('fhir_endpoint_base_url', ''),
2821('report_stats_url', ''),
2822('user_messaging_enabled', '1'),
2823('auto_prod_changes_check_identifiers', '0'),
2824('bioportal_api_url', 'https://data.bioontology.org/'),
2825('send_emails_admin_tasks', '1'),
2826('display_project_xml_backup_option', '1'),
2827('cross_domain_access_control', ''),
2828('google_cloud_storage_edocs_bucket', ''),
2829('google_cloud_storage_temp_bucket', ''),
2830('amazon_s3_endpoint', ''),
2831('proxy_username_password', ''),
2832('homepage_contact_url', ''),
2833('bioportal_api_token', ''),
2834('two_factor_auth_ip_range_alt', ''),
2835('two_factor_auth_trust_period_days_alt', '0'),
2836('two_factor_auth_trust_period_days', '0'),
2837('two_factor_auth_email_enabled', '1'),
2838('two_factor_auth_authenticator_enabled', '1'),
2839('two_factor_auth_ip_check_enabled', '0'),
2840('two_factor_auth_ip_range', ''),
2841('two_factor_auth_ip_range_include_private', '0'),
2842('two_factor_auth_duo_enabled', '0'),
2843('two_factor_auth_duo_ikey', ''),
2844('two_factor_auth_duo_skey', ''),
2845('two_factor_auth_duo_hostname', ''),
2846('bioportal_ontology_list_cache_time', ''),
2847('bioportal_ontology_list', ''),
2848('redcap_survey_base_url', ''),
2849('enable_ontology_auto_suggest', '1'),
2850('enable_survey_text_to_speech', '1'),
2851('enable_field_attachment_video_url', '1'),
2852('google_oauth2_client_id', ''),
2853('google_oauth2_client_secret', ''),
2854('two_factor_auth_twilio_enabled', '0'),
2855('two_factor_auth_twilio_account_sid', ''),
2856('two_factor_auth_twilio_auth_token', ''),
2857('two_factor_auth_twilio_from_number', ''),
2858('two_factor_auth_enabled', '0'),
2859('allow_kill_mysql_process', '0'),
2860('mobile_app_enabled', '1'),
2861('twilio_display_info_project_setup', '0'),
2862('twilio_enabled_global', '1'),
2863('twilio_enabled_by_super_users_only', '0'),
2864('field_comment_log_enabled_default', '1'),
2865('from_email', ''),
2866('promis_enabled', '1'),
2867('promis_api_base_url', 'https://www.redcap-cats.org/promis_api/'),
2868('sams_logout', ''),
2869('promis_registration_id', ''),
2870('promis_token', ''),
2871('hook_functions_file', ''),
2872('project_encoding', ''),
2873('default_datetime_format', 'M/D/Y_12'),
2874('default_number_format_decimal', '.'),
2875('default_number_format_thousands_sep', ','),
2876('homepage_announcement', ''),
2877('password_algo', 'md5'),
2878('password_recovery_custom_text', ''),
2879('user_access_dashboard_enable', '1'),
2880('user_access_dashboard_custom_notification', ''),
2881('suspend_users_inactive_send_email', 1),
2882('suspend_users_inactive_days', 180),
2883('suspend_users_inactive_type', ''),
2884('page_hit_threshold_per_minute', '600'),
2885('enable_http_compression', '1'),
2886('realtime_webservice_data_fetch_interval', '24'),
2887('realtime_webservice_url_metadata', ''),
2888('realtime_webservice_url_data', ''),
2889('realtime_webservice_url_user_access', ''),
2890('realtime_webservice_global_enabled', '0'),
2891('realtime_webservice_custom_text', ''),
2892('realtime_webservice_display_info_project_setup', '1'),
2893('realtime_webservice_source_system_custom_name', ''),
2894('realtime_webservice_user_rights_super_users_only', '1'),
2895('realtime_webservice_stop_fetch_inactivity_days', '7'),
2896('amazon_s3_key', ''),
2897('amazon_s3_secret', ''),
2898('amazon_s3_bucket', ''),
2899('system_offline_message', ''),
2900('openid_provider_url', ''),
2901('openid_provider_name', ''),
2902('file_attachment_upload_max', ''),
2903('data_entry_trigger_enabled', '1'),
2904('redcap_base_url_display_error_on_mismatch', '1'),
2905('email_domain_whitelist', ''),
2906('helpfaq_custom_text', ''),
2907('randomization_global', '1'),
2908('login_custom_text', ''),
2909('auto_prod_changes', '4'),
2910('enable_edit_prod_events', '1'),
2911('allow_create_db_default', '1'),
2912('api_enabled', '1'),
2913('auth_meth_global', 'none'),
2914('auto_report_stats', '1'),
2915('auto_report_stats_last_sent', '2000-01-01'),
2916('autologout_timer', '30'),
2917('certify_text_create', ''),
2918('certify_text_prod', ''),
2919('homepage_custom_text', ''),
2920('dts_enabled_global', '0'),
2921('display_nonauth_projects', '1'),
2922('display_project_logo_institution', '0'),
2923('display_today_now_button', '1'),
2924('edoc_field_option_enabled', '1'),
2925('edoc_upload_max', ''),
2926('edoc_storage_option', '0'),
2927('file_repository_upload_max', ''),
2928('file_repository_enabled', '1'),
2929('temp_files_last_delete', now()),
2930('edoc_path', ''),
2931('enable_edit_survey_response', '1'),
2932('enable_plotting', '2'),
2933('enable_plotting_survey_results', '1'),
2934('enable_projecttype_singlesurvey', '1'),
2935('enable_projecttype_forms', '1'),
2936('enable_projecttype_singlesurveyforms', '1'),
2937('enable_url_shortener', '1'),
2938('enable_user_whitelist', '0'),
2939('logout_fail_limit', '5'),
2940('logout_fail_window', '15'),
2941('footer_links', ''),
2942('footer_text', ''),
2943('google_translate_enabled', '0'),
2944('googlemap_key',''),
2945('grant_cite', ''),
2946('headerlogo', ''),
2947('homepage_contact', ''),
2948('homepage_contact_email', ''),
2949('homepage_grant_cite', ''),
2950('identifier_keywords', 'name, street, address, city, county, precinct, zip, postal, date, phone, fax, mail, ssn, social security, mrn, dob, dod, medical, record, id, age'),
2951('institution', ''),
2952('language_global','English'),
2953('login_autocomplete_disable', '0'),
2954('login_logo', ''),
2955('my_profile_enable_edit','1'),
2956('password_history_limit','0'),
2957('password_reset_duration','0'),
2958('project_contact_email', ''),
2959('project_contact_name', ''),
2960('project_language', 'English'),
2961('proxy_hostname', ''),
2962('pub_matching_enabled', '0'),
2963('redcap_base_url', ''),
2964('pub_matching_emails', '0'),
2965('pub_matching_email_days', '7'),
2966('pub_matching_email_limit', '3'),
2967('pub_matching_email_text', ''),
2968('pub_matching_email_subject', ''),
2969('pub_matching_institution', 'Vanderbilt\nMeharry'),
2970('redcap_last_install_date', CURRENT_DATE),
2971('redcap_version', '4.0.0'),
2972('sendit_enabled', '1'),
2973('sendit_upload_max', ''),
2974('shared_library_enabled', '1'),
2975('shibboleth_logout', ''),
2976('shibboleth_username_field', 'none'),
2977('site_org_type', ''),
2978('superusers_only_create_project', '0'),
2979('superusers_only_move_to_prod', '1'),
2980('system_offline', '0');
2981
2982INSERT INTO `redcap_pub_sources` (`pubsrc_id`, `pubsrc_name`, `pubsrc_last_crawl_time`) VALUES
2983(1, 'PubMed', NULL);
2984
2985INSERT INTO `redcap_validation_types` (`validation_name`, `validation_label`, `regex_js`, `regex_php`, `data_type`, `legacy_value`, `visible`) VALUES
2986('alpha_only', 'Letters only', '/^[a-z]+$/i', '/^[a-z]+$/i', 'text', NULL, 0),
2987('date_dmy', 'Date (D-M-Y)', '/^((29([-\\/])02\\3(\\d{2}([13579][26]|[2468][048]|04|08)|(1600|2[048]00)))|((((0[1-9]|1\\d|2[0-8])([-\\/])(0[1-9]|1[012]))|((29|30)([-\\/])(0[13-9]|1[012]))|(31([-\\/])(0[13578]|1[02])))(\\11|\\15|\\18)\\d{4}))$/', '/^((29([-\\/])02\\3(\\d{2}([13579][26]|[2468][048]|04|08)|(1600|2[048]00)))|((((0[1-9]|1\\d|2[0-8])([-\\/])(0[1-9]|1[012]))|((29|30)([-\\/])(0[13-9]|1[012]))|(31([-\\/])(0[13578]|1[02])))(\\11|\\15|\\18)\\d{4}))$/', 'date', NULL, 1),
2988('date_mdy', 'Date (M-D-Y)', '/^((02([-\\/])29\\3(\\d{2}([13579][26]|[2468][048]|04|08)|(1600|2[048]00)))|((((0[1-9]|1[012])([-\\/])(0[1-9]|1\\d|2[0-8]))|((0[13-9]|1[012])([-\\/])(29|30))|((0[13578]|1[02])([-\\/])31))(\\11|\\15|\\19)\\d{4}))$/', '/^((02([-\\/])29\\3(\\d{2}([13579][26]|[2468][048]|04|08)|(1600|2[048]00)))|((((0[1-9]|1[012])([-\\/])(0[1-9]|1\\d|2[0-8]))|((0[13-9]|1[012])([-\\/])(29|30))|((0[13578]|1[02])([-\\/])31))(\\11|\\15|\\19)\\d{4}))$/', 'date', NULL, 1),
2989('date_ymd', 'Date (Y-M-D)', '/^(((\\d{2}([13579][26]|[2468][048]|04|08)|(1600|2[048]00))([-\\/])02(\\6)29)|(\\d{4}([-\\/])((0[1-9]|1[012])(\\9)(0[1-9]|1\\d|2[0-8])|((0[13-9]|1[012])(\\9)(29|30))|((0[13578]|1[02])(\\9)31))))$/', '/^(((\\d{2}([13579][26]|[2468][048]|04|08)|(1600|2[048]00))([-\\/])02(\\6)29)|(\\d{4}([-\\/])((0[1-9]|1[012])(\\9)(0[1-9]|1\\d|2[0-8])|((0[13-9]|1[012])(\\9)(29|30))|((0[13578]|1[02])(\\9)31))))$/', 'date', 'date', 1),
2990('datetime_dmy', 'Datetime (D-M-Y H:M)', '/^((29([-\\/])02\\3(\\d{2}([13579][26]|[2468][048]|04|08)|(1600|2[048]00)))|((((0[1-9]|1\\d|2[0-8])([-\\/])(0[1-9]|1[012]))|((29|30)([-\\/])(0[13-9]|1[012]))|(31([-\\/])(0[13578]|1[02])))(\\11|\\15|\\18)\\d{4})) (\\d|[0-1]\\d|[2][0-3]):[0-5]\\d$/', '/^((29([-\\/])02\\3(\\d{2}([13579][26]|[2468][048]|04|08)|(1600|2[048]00)))|((((0[1-9]|1\\d|2[0-8])([-\\/])(0[1-9]|1[012]))|((29|30)([-\\/])(0[13-9]|1[012]))|(31([-\\/])(0[13578]|1[02])))(\\11|\\15|\\18)\\d{4})) (\\d|[0-1]\\d|[2][0-3]):[0-5]\\d$/', 'datetime', NULL, 1),
2991('datetime_mdy', 'Datetime (M-D-Y H:M)', '/^((02([-\\/])29\\3(\\d{2}([13579][26]|[2468][048]|04|08)|(1600|2[048]00)))|((((0[1-9]|1[012])([-\\/])(0[1-9]|1\\d|2[0-8]))|((0[13-9]|1[012])([-\\/])(29|30))|((0[13578]|1[02])([-\\/])31))(\\11|\\15|\\19)\\d{4})) (\\d|[0-1]\\d|[2][0-3]):[0-5]\\d$/', '/^((02([-\\/])29\\3(\\d{2}([13579][26]|[2468][048]|04|08)|(1600|2[048]00)))|((((0[1-9]|1[012])([-\\/])(0[1-9]|1\\d|2[0-8]))|((0[13-9]|1[012])([-\\/])(29|30))|((0[13578]|1[02])([-\\/])31))(\\11|\\15|\\19)\\d{4})) (\\d|[0-1]\\d|[2][0-3]):[0-5]\\d$/', 'datetime', NULL, 1),
2992('datetime_seconds_dmy', 'Datetime w/ seconds (D-M-Y H:M:S)', '/^((29([-\\/])02\\3(\\d{2}([13579][26]|[2468][048]|04|08)|(1600|2[048]00)))|((((0[1-9]|1\\d|2[0-8])([-\\/])(0[1-9]|1[012]))|((29|30)([-\\/])(0[13-9]|1[012]))|(31([-\\/])(0[13578]|1[02])))(\\11|\\15|\\18)\\d{4})) (\\d|[0-1]\\d|[2][0-3])(:[0-5]\\d){2}$/', '/^((29([-\\/])02\\3(\\d{2}([13579][26]|[2468][048]|04|08)|(1600|2[048]00)))|((((0[1-9]|1\\d|2[0-8])([-\\/])(0[1-9]|1[012]))|((29|30)([-\\/])(0[13-9]|1[012]))|(31([-\\/])(0[13578]|1[02])))(\\11|\\15|\\18)\\d{4})) (\\d|[0-1]\\d|[2][0-3])(:[0-5]\\d){2}$/', 'datetime_seconds', NULL, 1),
2993('datetime_seconds_mdy', 'Datetime w/ seconds (M-D-Y H:M:S)', '/^((02([-\\/])29\\3(\\d{2}([13579][26]|[2468][048]|04|08)|(1600|2[048]00)))|((((0[1-9]|1[012])([-\\/])(0[1-9]|1\\d|2[0-8]))|((0[13-9]|1[012])([-\\/])(29|30))|((0[13578]|1[02])([-\\/])31))(\\11|\\15|\\19)\\d{4})) (\\d|[0-1]\\d|[2][0-3])(:[0-5]\\d){2}$/', '/^((02([-\\/])29\\3(\\d{2}([13579][26]|[2468][048]|04|08)|(1600|2[048]00)))|((((0[1-9]|1[012])([-\\/])(0[1-9]|1\\d|2[0-8]))|((0[13-9]|1[012])([-\\/])(29|30))|((0[13578]|1[02])([-\\/])31))(\\11|\\15|\\19)\\d{4})) (\\d|[0-1]\\d|[2][0-3])(:[0-5]\\d){2}$/', 'datetime_seconds', NULL, 1),
2994('datetime_seconds_ymd', 'Datetime w/ seconds (Y-M-D H:M:S)', '/^(((\\d{2}([13579][26]|[2468][048]|04|08)|(1600|2[048]00))([-\\/])02(\\6)29)|(\\d{4}([-\\/])((0[1-9]|1[012])(\\9)(0[1-9]|1\\d|2[0-8])|((0[13-9]|1[012])(\\9)(29|30))|((0[13578]|1[02])(\\9)31)))) (\\d|[0-1]\\d|[2][0-3])(:[0-5]\\d){2}$/', '/^(((\\d{2}([13579][26]|[2468][048]|04|08)|(1600|2[048]00))([-\\/])02(\\6)29)|(\\d{4}([-\\/])((0[1-9]|1[012])(\\9)(0[1-9]|1\\d|2[0-8])|((0[13-9]|1[012])(\\9)(29|30))|((0[13578]|1[02])(\\9)31)))) (\\d|[0-1]\\d|[2][0-3])(:[0-5]\\d){2}$/', 'datetime_seconds', 'datetime_seconds', 1),
2995('datetime_ymd', 'Datetime (Y-M-D H:M)', '/^(((\\d{2}([13579][26]|[2468][048]|04|08)|(1600|2[048]00))([-\\/])02(\\6)29)|(\\d{4}([-\\/])((0[1-9]|1[012])(\\9)(0[1-9]|1\\d|2[0-8])|((0[13-9]|1[012])(\\9)(29|30))|((0[13578]|1[02])(\\9)31)))) (\\d|[0-1]\\d|[2][0-3]):[0-5]\\d$/', '/^(((\\d{2}([13579][26]|[2468][048]|04|08)|(1600|2[048]00))([-\\/])02(\\6)29)|(\\d{4}([-\\/])((0[1-9]|1[012])(\\9)(0[1-9]|1\\d|2[0-8])|((0[13-9]|1[012])(\\9)(29|30))|((0[13578]|1[02])(\\9)31)))) (\\d|[0-1]\\d|[2][0-3]):[0-5]\\d$/', 'datetime', 'datetime', 1),
2996('email', 'Email', '/^(?!\\.)((?!.*\\.{2})[a-zA-Z0-9\\u0080-\\u00FF\\u0100-\\u017F\\u0180-\\u024F\\u0250-\\u02AF\\u0300-\\u036F\\u0370-\\u03FF\\u0400-\\u04FF\\u0500-\\u052F\\u0530-\\u058F\\u0590-\\u05FF\\u0600-\\u06FF\\u0700-\\u074F\\u0750-\\u077F\\u0780-\\u07BF\\u07C0-\\u07FF\\u0900-\\u097F\\u0980-\\u09FF\\u0A00-\\u0A7F\\u0A80-\\u0AFF\\u0B00-\\u0B7F\\u0B80-\\u0BFF\\u0C00-\\u0C7F\\u0C80-\\u0CFF\\u0D00-\\u0D7F\\u0D80-\\u0DFF\\u0E00-\\u0E7F\\u0E80-\\u0EFF\\u0F00-\\u0FFF\\u1000-\\u109F\\u10A0-\\u10FF\\u1100-\\u11FF\\u1200-\\u137F\\u1380-\\u139F\\u13A0-\\u13FF\\u1400-\\u167F\\u1680-\\u169F\\u16A0-\\u16FF\\u1700-\\u171F\\u1720-\\u173F\\u1740-\\u175F\\u1760-\\u177F\\u1780-\\u17FF\\u1800-\\u18AF\\u1900-\\u194F\\u1950-\\u197F\\u1980-\\u19DF\\u19E0-\\u19FF\\u1A00-\\u1A1F\\u1B00-\\u1B7F\\u1D00-\\u1D7F\\u1D80-\\u1DBF\\u1DC0-\\u1DFF\\u1E00-\\u1EFF\\u1F00-\\u1FFF\\u20D0-\\u20FF\\u2100-\\u214F\\u2C00-\\u2C5F\\u2C60-\\u2C7F\\u2C80-\\u2CFF\\u2D00-\\u2D2F\\u2D30-\\u2D7F\\u2D80-\\u2DDF\\u2F00-\\u2FDF\\u2FF0-\\u2FFF\\u3040-\\u309F\\u30A0-\\u30FF\\u3100-\\u312F\\u3130-\\u318F\\u3190-\\u319F\\u31C0-\\u31EF\\u31F0-\\u31FF\\u3200-\\u32FF\\u3300-\\u33FF\\u3400-\\u4DBF\\u4DC0-\\u4DFF\\u4E00-\\u9FFF\\uA000-\\uA48F\\uA490-\\uA4CF\\uA700-\\uA71F\\uA800-\\uA82F\\uA840-\\uA87F\\uAC00-\\uD7AF\\uF900-\\uFAFF\\.!#$%&\'*+-/=?^_`{|}~\\-\\d]+)@(?!\\.)([a-zA-Z0-9\\u0080-\\u00FF\\u0100-\\u017F\\u0180-\\u024F\\u0250-\\u02AF\\u0300-\\u036F\\u0370-\\u03FF\\u0400-\\u04FF\\u0500-\\u052F\\u0530-\\u058F\\u0590-\\u05FF\\u0600-\\u06FF\\u0700-\\u074F\\u0750-\\u077F\\u0780-\\u07BF\\u07C0-\\u07FF\\u0900-\\u097F\\u0980-\\u09FF\\u0A00-\\u0A7F\\u0A80-\\u0AFF\\u0B00-\\u0B7F\\u0B80-\\u0BFF\\u0C00-\\u0C7F\\u0C80-\\u0CFF\\u0D00-\\u0D7F\\u0D80-\\u0DFF\\u0E00-\\u0E7F\\u0E80-\\u0EFF\\u0F00-\\u0FFF\\u1000-\\u109F\\u10A0-\\u10FF\\u1100-\\u11FF\\u1200-\\u137F\\u1380-\\u139F\\u13A0-\\u13FF\\u1400-\\u167F\\u1680-\\u169F\\u16A0-\\u16FF\\u1700-\\u171F\\u1720-\\u173F\\u1740-\\u175F\\u1760-\\u177F\\u1780-\\u17FF\\u1800-\\u18AF\\u1900-\\u194F\\u1950-\\u197F\\u1980-\\u19DF\\u19E0-\\u19FF\\u1A00-\\u1A1F\\u1B00-\\u1B7F\\u1D00-\\u1D7F\\u1D80-\\u1DBF\\u1DC0-\\u1DFF\\u1E00-\\u1EFF\\u1F00-\\u1FFF\\u20D0-\\u20FF\\u2100-\\u214F\\u2C00-\\u2C5F\\u2C60-\\u2C7F\\u2C80-\\u2CFF\\u2D00-\\u2D2F\\u2D30-\\u2D7F\\u2D80-\\u2DDF\\u2F00-\\u2FDF\\u2FF0-\\u2FFF\\u3040-\\u309F\\u30A0-\\u30FF\\u3100-\\u312F\\u3130-\\u318F\\u3190-\\u319F\\u31C0-\\u31EF\\u31F0-\\u31FF\\u3200-\\u32FF\\u3300-\\u33FF\\u3400-\\u4DBF\\u4DC0-\\u4DFF\\u4E00-\\u9FFF\\uA000-\\uA48F\\uA490-\\uA4CF\\uA700-\\uA71F\\uA800-\\uA82F\\uA840-\\uA87F\\uAC00-\\uD7AF\\uF900-\\uFAFF\\-\\.\\d]+)((\\.([a-zA-Z\\u0080-\\u00FF\\u0100-\\u017F\\u0180-\\u024F\\u0250-\\u02AF\\u0300-\\u036F\\u0370-\\u03FF\\u0400-\\u04FF\\u0500-\\u052F\\u0530-\\u058F\\u0590-\\u05FF\\u0600-\\u06FF\\u0700-\\u074F\\u0750-\\u077F\\u0780-\\u07BF\\u07C0-\\u07FF\\u0900-\\u097F\\u0980-\\u09FF\\u0A00-\\u0A7F\\u0A80-\\u0AFF\\u0B00-\\u0B7F\\u0B80-\\u0BFF\\u0C00-\\u0C7F\\u0C80-\\u0CFF\\u0D00-\\u0D7F\\u0D80-\\u0DFF\\u0E00-\\u0E7F\\u0E80-\\u0EFF\\u0F00-\\u0FFF\\u1000-\\u109F\\u10A0-\\u10FF\\u1100-\\u11FF\\u1200-\\u137F\\u1380-\\u139F\\u13A0-\\u13FF\\u1400-\\u167F\\u1680-\\u169F\\u16A0-\\u16FF\\u1700-\\u171F\\u1720-\\u173F\\u1740-\\u175F\\u1760-\\u177F\\u1780-\\u17FF\\u1800-\\u18AF\\u1900-\\u194F\\u1950-\\u197F\\u1980-\\u19DF\\u19E0-\\u19FF\\u1A00-\\u1A1F\\u1B00-\\u1B7F\\u1D00-\\u1D7F\\u1D80-\\u1DBF\\u1DC0-\\u1DFF\\u1E00-\\u1EFF\\u1F00-\\u1FFF\\u20D0-\\u20FF\\u2100-\\u214F\\u2C00-\\u2C5F\\u2C60-\\u2C7F\\u2C80-\\u2CFF\\u2D00-\\u2D2F\\u2D30-\\u2D7F\\u2D80-\\u2DDF\\u2F00-\\u2FDF\\u2FF0-\\u2FFF\\u3040-\\u309F\\u30A0-\\u30FF\\u3100-\\u312F\\u3130-\\u318F\\u3190-\\u319F\\u31C0-\\u31EF\\u31F0-\\u31FF\\u3200-\\u32FF\\u3300-\\u33FF\\u3400-\\u4DBF\\u4DC0-\\u4DFF\\u4E00-\\u9FFF\\uA000-\\uA48F\\uA490-\\uA4CF\\uA700-\\uA71F\\uA800-\\uA82F\\uA840-\\uA87F\\uAC00-\\uD7AF\\uF900-\\uFAFF]){2,63})+)$/i', '/^(?!\\.)((?!.*\\.{2})[a-zA-Z0-9\\x{0080}-\\x{00FF}\\x{0100}-\\x{017F}\\x{0180}-\\x{024F}\\x{0250}-\\x{02AF}\\x{0300}-\\x{036F}\\x{0370}-\\x{03FF}\\x{0400}-\\x{04FF}\\x{0500}-\\x{052F}\\x{0530}-\\x{058F}\\x{0590}-\\x{05FF}\\x{0600}-\\x{06FF}\\x{0700}-\\x{074F}\\x{0750}-\\x{077F}\\x{0780}-\\x{07BF}\\x{07C0}-\\x{07FF}\\x{0900}-\\x{097F}\\x{0980}-\\x{09FF}\\x{0A00}-\\x{0A7F}\\x{0A80}-\\x{0AFF}\\x{0B00}-\\x{0B7F}\\x{0B80}-\\x{0BFF}\\x{0C00}-\\x{0C7F}\\x{0C80}-\\x{0CFF}\\x{0D00}-\\x{0D7F}\\x{0D80}-\\x{0DFF}\\x{0E00}-\\x{0E7F}\\x{0E80}-\\x{0EFF}\\x{0F00}-\\x{0FFF}\\x{1000}-\\x{109F}\\x{10A0}-\\x{10FF}\\x{1100}-\\x{11FF}\\x{1200}-\\x{137F}\\x{1380}-\\x{139F}\\x{13A0}-\\x{13FF}\\x{1400}-\\x{167F}\\x{1680}-\\x{169F}\\x{16A0}-\\x{16FF}\\x{1700}-\\x{171F}\\x{1720}-\\x{173F}\\x{1740}-\\x{175F}\\x{1760}-\\x{177F}\\x{1780}-\\x{17FF}\\x{1800}-\\x{18AF}\\x{1900}-\\x{194F}\\x{1950}-\\x{197F}\\x{1980}-\\x{19DF}\\x{19E0}-\\x{19FF}\\x{1A00}-\\x{1A1F}\\x{1B00}-\\x{1B7F}\\x{1D00}-\\x{1D7F}\\x{1D80}-\\x{1DBF}\\x{1DC0}-\\x{1DFF}\\x{1E00}-\\x{1EFF}\\x{1F00}-\\x{1FFF}\\x{20D0}-\\x{20FF}\\x{2100}-\\x{214F}\\x{2C00}-\\x{2C5F}\\x{2C60}-\\x{2C7F}\\x{2C80}-\\x{2CFF}\\x{2D00}-\\x{2D2F}\\x{2D30}-\\x{2D7F}\\x{2D80}-\\x{2DDF}\\x{2F00}-\\x{2FDF}\\x{2FF0}-\\x{2FFF}\\x{3040}-\\x{309F}\\x{30A0}-\\x{30FF}\\x{3100}-\\x{312F}\\x{3130}-\\x{318F}\\x{3190}-\\x{319F}\\x{31C0}-\\x{31EF}\\x{31F0}-\\x{31FF}\\x{3200}-\\x{32FF}\\x{3300}-\\x{33FF}\\x{3400}-\\x{4DBF}\\x{4DC0}-\\x{4DFF}\\x{4E00}-\\x{9FFF}\\x{A000}-\\x{A48F}\\x{A490}-\\x{A4CF}\\x{A700}-\\x{A71F}\\x{A800}-\\x{A82F}\\x{A840}-\\x{A87F}\\x{AC00}-\\x{D7AF}\\x{F900}-\\x{FAFF}\\.!#$%&\'*+-\\/=?^_`{|}~\\-\\d]+)@(?!\\.)([a-zA-Z0-9\\x{0080}-\\x{00FF}\\x{0100}-\\x{017F}\\x{0180}-\\x{024F}\\x{0250}-\\x{02AF}\\x{0300}-\\x{036F}\\x{0370}-\\x{03FF}\\x{0400}-\\x{04FF}\\x{0500}-\\x{052F}\\x{0530}-\\x{058F}\\x{0590}-\\x{05FF}\\x{0600}-\\x{06FF}\\x{0700}-\\x{074F}\\x{0750}-\\x{077F}\\x{0780}-\\x{07BF}\\x{07C0}-\\x{07FF}\\x{0900}-\\x{097F}\\x{0980}-\\x{09FF}\\x{0A00}-\\x{0A7F}\\x{0A80}-\\x{0AFF}\\x{0B00}-\\x{0B7F}\\x{0B80}-\\x{0BFF}\\x{0C00}-\\x{0C7F}\\x{0C80}-\\x{0CFF}\\x{0D00}-\\x{0D7F}\\x{0D80}-\\x{0DFF}\\x{0E00}-\\x{0E7F}\\x{0E80}-\\x{0EFF}\\x{0F00}-\\x{0FFF}\\x{1000}-\\x{109F}\\x{10A0}-\\x{10FF}\\x{1100}-\\x{11FF}\\x{1200}-\\x{137F}\\x{1380}-\\x{139F}\\x{13A0}-\\x{13FF}\\x{1400}-\\x{167F}\\x{1680}-\\x{169F}\\x{16A0}-\\x{16FF}\\x{1700}-\\x{171F}\\x{1720}-\\x{173F}\\x{1740}-\\x{175F}\\x{1760}-\\x{177F}\\x{1780}-\\x{17FF}\\x{1800}-\\x{18AF}\\x{1900}-\\x{194F}\\x{1950}-\\x{197F}\\x{1980}-\\x{19DF}\\x{19E0}-\\x{19FF}\\x{1A00}-\\x{1A1F}\\x{1B00}-\\x{1B7F}\\x{1D00}-\\x{1D7F}\\x{1D80}-\\x{1DBF}\\x{1DC0}-\\x{1DFF}\\x{1E00}-\\x{1EFF}\\x{1F00}-\\x{1FFF}\\x{20D0}-\\x{20FF}\\x{2100}-\\x{214F}\\x{2C00}-\\x{2C5F}\\x{2C60}-\\x{2C7F}\\x{2C80}-\\x{2CFF}\\x{2D00}-\\x{2D2F}\\x{2D30}-\\x{2D7F}\\x{2D80}-\\x{2DDF}\\x{2F00}-\\x{2FDF}\\x{2FF0}-\\x{2FFF}\\x{3040}-\\x{309F}\\x{30A0}-\\x{30FF}\\x{3100}-\\x{312F}\\x{3130}-\\x{318F}\\x{3190}-\\x{319F}\\x{31C0}-\\x{31EF}\\x{31F0}-\\x{31FF}\\x{3200}-\\x{32FF}\\x{3300}-\\x{33FF}\\x{3400}-\\x{4DBF}\\x{4DC0}-\\x{4DFF}\\x{4E00}-\\x{9FFF}\\x{A000}-\\x{A48F}\\x{A490}-\\x{A4CF}\\x{A700}-\\x{A71F}\\x{A800}-\\x{A82F}\\x{A840}-\\x{A87F}\\x{AC00}-\\x{D7AF}\\x{F900}-\\x{FAFF}\\-\\.\\d]+)((\\.([a-zA-Z\\x{0080}-\\x{00FF}\\x{0100}-\\x{017F}\\x{0180}-\\x{024F}\\x{0250}-\\x{02AF}\\x{0300}-\\x{036F}\\x{0370}-\\x{03FF}\\x{0400}-\\x{04FF}\\x{0500}-\\x{052F}\\x{0530}-\\x{058F}\\x{0590}-\\x{05FF}\\x{0600}-\\x{06FF}\\x{0700}-\\x{074F}\\x{0750}-\\x{077F}\\x{0780}-\\x{07BF}\\x{07C0}-\\x{07FF}\\x{0900}-\\x{097F}\\x{0980}-\\x{09FF}\\x{0A00}-\\x{0A7F}\\x{0A80}-\\x{0AFF}\\x{0B00}-\\x{0B7F}\\x{0B80}-\\x{0BFF}\\x{0C00}-\\x{0C7F}\\x{0C80}-\\x{0CFF}\\x{0D00}-\\x{0D7F}\\x{0D80}-\\x{0DFF}\\x{0E00}-\\x{0E7F}\\x{0E80}-\\x{0EFF}\\x{0F00}-\\x{0FFF}\\x{1000}-\\x{109F}\\x{10A0}-\\x{10FF}\\x{1100}-\\x{11FF}\\x{1200}-\\x{137F}\\x{1380}-\\x{139F}\\x{13A0}-\\x{13FF}\\x{1400}-\\x{167F}\\x{1680}-\\x{169F}\\x{16A0}-\\x{16FF}\\x{1700}-\\x{171F}\\x{1720}-\\x{173F}\\x{1740}-\\x{175F}\\x{1760}-\\x{177F}\\x{1780}-\\x{17FF}\\x{1800}-\\x{18AF}\\x{1900}-\\x{194F}\\x{1950}-\\x{197F}\\x{1980}-\\x{19DF}\\x{19E0}-\\x{19FF}\\x{1A00}-\\x{1A1F}\\x{1B00}-\\x{1B7F}\\x{1D00}-\\x{1D7F}\\x{1D80}-\\x{1DBF}\\x{1DC0}-\\x{1DFF}\\x{1E00}-\\x{1EFF}\\x{1F00}-\\x{1FFF}\\x{20D0}-\\x{20FF}\\x{2100}-\\x{214F}\\x{2C00}-\\x{2C5F}\\x{2C60}-\\x{2C7F}\\x{2C80}-\\x{2CFF}\\x{2D00}-\\x{2D2F}\\x{2D30}-\\x{2D7F}\\x{2D80}-\\x{2DDF}\\x{2F00}-\\x{2FDF}\\x{2FF0}-\\x{2FFF}\\x{3040}-\\x{309F}\\x{30A0}-\\x{30FF}\\x{3100}-\\x{312F}\\x{3130}-\\x{318F}\\x{3190}-\\x{319F}\\x{31C0}-\\x{31EF}\\x{31F0}-\\x{31FF}\\x{3200}-\\x{32FF}\\x{3300}-\\x{33FF}\\x{3400}-\\x{4DBF}\\x{4DC0}-\\x{4DFF}\\x{4E00}-\\x{9FFF}\\x{A000}-\\x{A48F}\\x{A490}-\\x{A4CF}\\x{A700}-\\x{A71F}\\x{A800}-\\x{A82F}\\x{A840}-\\x{A87F}\\x{AC00}-\\x{D7AF}\\x{F900}-\\x{FAFF}]){2,63})+)$/u', 'email', NULL, 1),
2997('integer', 'Integer', '/^[-+]?\\b\\d+\\b$/', '/^[-+]?\\b\\d+\\b$/', 'integer', 'int', 1),
2998('mrn_10d', 'MRN (10 digits)', '/^\\d{10}$/', '/^\\d{10}$/', 'mrn', NULL, 0),
2999('mrn_generic', 'MRN (generic)', '/^[a-z0-9-_]+$/i', '/^[a-z0-9-_]+$/i', 'mrn', NULL, 0),
3000('number', 'Number', '/^[-+]?[0-9]*\\.?[0-9]+([eE][-+]?[0-9]+)?$/', '/^[-+]?[0-9]*\\.?[0-9]+([eE][-+]?[0-9]+)?$/', 'number', 'float', 1),
3001('number_1dp', 'Number (1 decimal place)', '/^-?\\d+\\.\\d$/', '/^-?\\d+\\.\\d$/', 'number', NULL, 0),
3002('number_2dp', 'Number (2 decimal places)', '/^-?\\d+\\.\\d{2}$/', '/^-?\\d+\\.\\d{2}$/', 'number', NULL, 0),
3003('number_3dp', 'Number (3 decimal places)', '/^-?\\d+\\.\\d{3}$/', '/^-?\\d+\\.\\d{3}$/', 'number', NULL, 0),
3004('number_4dp', 'Number (4 decimal places)', '/^-?\\d+\\.\\d{4}$/', '/^-?\\d+\\.\\d{4}$/', 'number', NULL, 0),
3005('phone', 'Phone (North America)', '/^(?:\\(?([2-9]0[1-9]|[2-9]1[02-9]|[2-9][2-9][0-9])\\)?)\\s*(?:[.-]\\s*)?([2-9]\\d{2})\\s*(?:[.-]\\s*)?(\\d{4})(?:\\s*(?:#|x\\.?|ext\\.?|extension)\\s*(\\d+))?$/', '/^(?:\\(?([2-9]0[1-9]|[2-9]1[02-9]|[2-9][2-9][0-9])\\)?)\\s*(?:[.-]\\s*)?([2-9]\\d{2})\\s*(?:[.-]\\s*)?(\\d{4})(?:\\s*(?:#|x\\.?|ext\\.?|extension)\\s*(\\d+))?$/', 'phone', NULL, 1),
3006('phone_australia', 'Phone (Australia)', '/^(\\(0[2-8]\\)|0[2-8])\\s*\\d{4}\\s*\\d{4}$/', '/^(\\(0[2-8]\\)|0[2-8])\\s*\\d{4}\\s*\\d{4}$/', 'phone', NULL, 0),
3007('postalcode_australia', 'Postal Code (Australia)', '/^\\d{4}$/', '/^\\d{4}$/', 'postal_code', NULL, 0),
3008('postalcode_canada', 'Postal Code (Canada)', '/^[ABCEGHJKLMNPRSTVXY]{1}\\d{1}[A-Z]{1}\\s*\\d{1}[A-Z]{1}\\d{1}$/i', '/^[ABCEGHJKLMNPRSTVXY]{1}\\d{1}[A-Z]{1}\\s*\\d{1}[A-Z]{1}\\d{1}$/i', 'postal_code', NULL, 0),
3009('ssn', 'Social Security Number (U.S.)', '/^\\d{3}-\\d\\d-\\d{4}$/', '/^\\d{3}-\\d\\d-\\d{4}$/', 'ssn', NULL, 0),
3010('time', 'Time (HH:MM)', '/^([0-9]|[0-1][0-9]|[2][0-3]):([0-5][0-9])$/', '/^([0-9]|[0-1][0-9]|[2][0-3]):([0-5][0-9])$/', 'time', NULL, 1),
3011('time_mm_ss', 'Time (MM:SS)', '/^[0-5]\\d:[0-5]\\d$/', '/^[0-5]\\d:[0-5]\\d$/', 'time', NULL, 0),
3012('vmrn', 'Vanderbilt MRN', '/^[0-9]{4,9}$/', '/^[0-9]{4,9}$/', 'mrn', NULL, 0),
3013('zipcode', 'Zipcode (U.S.)', '/^\\d{5}(-\\d{4})?$/', '/^\\d{5}(-\\d{4})?$/', 'postal_code', NULL, 1),
3014('number_comma_decimal', 'Number (comma as decimal)', '/^[-+]?[0-9]*,?[0-9]+([eE][-+]?[0-9]+)?$/', '/^[-+]?[0-9]*,?[0-9]+([eE][-+]?[0-9]+)?$/', 'number_comma_decimal', NULL, 0),
3015('number_1dp_comma_decimal', 'Number (1 decimal place - comma as decimal)', '/^-?\\d+,\\d$/', '/^-?\\d+,\\d$/', 'number_comma_decimal', NULL , '0'),
3016('number_2dp_comma_decimal', 'Number (2 decimal places - comma as decimal)', '/^-?\\d+,\\d{2}$/', '/^-?\\d+,\\d{2}$/', 'number_comma_decimal', NULL , '0'),
3017('number_3dp_comma_decimal', 'Number (3 decimal places - comma as decimal)', '/^-?\\d+,\\d{3}$/', '/^-?\\d+,\\d{3}$/', 'number_comma_decimal', NULL , '0'),
3018('number_4dp_comma_decimal', 'Number (4 decimal places - comma as decimal)', '/^-?\\d+,\\d{4}$/', '/^-?\\d+,\\d{4}$/', 'number_comma_decimal', NULL , '0'),
3019('postalcode_germany', 'Postal Code (Germany)', '/^(0[1-9]|[1-9]\\d)\\d{3}$/', '/^(0[1-9]|[1-9]\\d)\\d{3}$/', 'postal_code', NULL, 0),
3020('postalcode_french', 'Code Postal 5 caracteres (France)', '/^((0?[1-9])|([1-8][0-9])|(9[0-8]))[0-9]{3}$/', '/^((0?[1-9])|([1-8][0-9])|(9[0-8]))[0-9]{3}$/', 'postal_code', NULL, 0);
3021
3022INSERT INTO redcap_surveys_themes (theme_name, ui_id, theme_text_buttons, theme_bg_page, theme_text_title, theme_bg_title, theme_text_sectionheader, theme_bg_sectionheader, theme_text_question, theme_bg_question) VALUES
3023('Flat White', NULL, '000000', 'eeeeee', '000000', 'FFFFFF', 'FFFFFF', '444444', '000000', 'FFFFFF'),
3024('Slate and Khaki', NULL, '000000', 'EBE8D9', '000000', 'c5d5cb', 'FFFFFF', '909A94', '000000', 'f3f3f3'),
3025('Colorful Pastel', NULL, '000', 'f1fafc', '274e13', 'e9f1e3', '660000', 'F6C2C2', '660000', 'f7f8d7'),
3026('Blue Skies', NULL, '0C74A9', 'cfe2f3', '0b5394', 'FFFFFF', 'FFFFFF', '0b5394', '0b5394', 'ffffff'),
3027('Cappucino', NULL, '7d4627', '783f04', '7d4627', 'fff', 'FFFFFF', 'b18b64', '783f04', 'fce5cd'),
3028('Red Brick', NULL, '000000', '660000', 'ffffff', '990000', 'ffffff', '000000', '000000', 'ffffff'),
3029('Grayscale', NULL, '30231d', '000000', 'ffffff', '666666', 'ffffff', '444444', '000000', 'eeeeee'),
3030('Plum', NULL, '000000', '351c75', '000000', 'd9d2e9', 'FFFFFF', '8e7cc3', '000000', 'd9d2e9'),
3031('Forest Green', NULL, '7f6000', '274e13', 'ffffff', '6aa84f', 'ffffff', '38761d', '7f6000', 'd9ead3'),
3032('Sunny Day', NULL, 'B2400E', 'FFFF80', 'B2400E', 'FFFFFF', 'FFFFFF', 'f67719', 'b85b16', 'FEFFD3');
3033
3034INSERT INTO redcap_messages_threads (thread_id, type, channel_name, invisible, archived) VALUES
3035(1, 'NOTIFICATION', 'What''s new', 0, 0),
3036(2, 'NOTIFICATION', NULL, 0, 0),
3037(3, 'NOTIFICATION', 'Notifications', 0, 0);
3038
3039INSERT INTO redcap_messages_recipients (recipient_id, thread_id, all_users) VALUES
3040(1, 1, 1),
3041(2, 2, 1),
3042(3, 3, 1);
3043
3044
3045-- Add custom site configuration values --
3046UPDATE redcap_config SET value = 'sha512' WHERE field_name = 'password_algo';
3047UPDATE redcap_config SET value = '' WHERE field_name = 'redcap_csrf_token';
3048UPDATE redcap_config SET value = '0' WHERE field_name = 'superusers_only_create_project';
3049UPDATE redcap_config SET value = '1' WHERE field_name = 'superusers_only_move_to_prod';
3050UPDATE redcap_config SET value = '1' WHERE field_name = 'auto_report_stats';
3051UPDATE redcap_config SET value = '' WHERE field_name = 'bioportal_api_token';
3052UPDATE redcap_config SET value = 'http://203.129.24.221:443/redcap/' WHERE field_name = 'redcap_base_url';
3053UPDATE redcap_config SET value = 'D/M/Y_12' WHERE field_name = 'default_datetime_format';
3054UPDATE redcap_config SET value = '.' WHERE field_name = 'default_number_format_decimal';
3055UPDATE redcap_config SET value = '' WHERE field_name = 'default_number_format_thousands_sep';
3056UPDATE redcap_config SET value = 'REDCap Administrator ' WHERE field_name = 'homepage_contact';
3057UPDATE redcap_config SET value = 'danielpincock@gmail.com' WHERE field_name = 'homepage_contact_email';
3058UPDATE redcap_config SET value = 'REDCap Administrator' WHERE field_name = 'project_contact_name';
3059UPDATE redcap_config SET value = 'danielpincock@gmail.com' WHERE field_name = 'project_contact_email';
3060UPDATE redcap_config SET value = 'Medical Deans Australia and New Zealand' WHERE field_name = 'institution';
3061UPDATE redcap_config SET value = '' WHERE field_name = 'site_org_type';
3062UPDATE redcap_config SET value = 'C:\\wamp64\\www\\redcap\\hook_functions.php' WHERE field_name = 'hook_functions_file';
3063UPDATE redcap_config SET value = '9.7.8' WHERE field_name = 'redcap_version';
3064
3065-- SQL TO CREATE A REDCAP DEMO PROJECT --
3066set @project_title = 'Classic Database';
3067
3068
3069-- Obtain default values --
3070set @institution = (select value from redcap_config where field_name = 'institution' limit 1);
3071set @site_org_type = (select value from redcap_config where field_name = 'site_org_type' limit 1);
3072set @grant_cite = (select value from redcap_config where field_name = 'grant_cite' limit 1);
3073set @project_contact_name = (select value from redcap_config where field_name = 'project_contact_name' limit 1);
3074set @project_contact_email = (select value from redcap_config where field_name = 'project_contact_email' limit 1);
3075set @headerlogo = (select value from redcap_config where field_name = 'headerlogo' limit 1);
3076set @auth_meth = (select value from redcap_config where field_name = 'auth_meth_global' limit 1);
3077-- Create project --
3078INSERT INTO `redcap_projects`
3079(project_name, app_title, status, count_project, auth_meth, creation_time, production_time, institution, site_org_type, grant_cite, project_contact_name, project_contact_email, headerlogo, display_project_logo_institution, auto_inc_set) VALUES
3080(concat('redcap_demo_',LEFT(sha1(rand()),6)), @project_title, 1, 0, @auth_meth, now(), now(), @institution, @site_org_type, @grant_cite, @project_contact_name, @project_contact_email, @headerlogo, 0, 1);
3081set @project_id = LAST_INSERT_ID();
3082-- User rights --
3083INSERT INTO `redcap_user_rights` (`project_id`, `username`, `expiration`, `group_id`, `lock_record`, `data_export_tool`, `data_import_tool`, `data_comparison_tool`, `data_logging`, `file_repository`, `double_data`, `user_rights`, `data_access_groups`, `graphical`, `reports`, `design`, `calendar`, `data_entry`, `data_quality_execute`) VALUES
3084(@project_id, 'site_admin', NULL, NULL, 0, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 0, 1, '', 1);
3085-- Create single arm --
3086INSERT INTO redcap_events_arms (project_id, arm_num, arm_name) VALUES (@project_id, 1, 'Arm 1');
3087set @arm_id = LAST_INSERT_ID();
3088-- Create single event --
3089INSERT INTO redcap_events_metadata (arm_id, day_offset, offset_min, offset_max, descrip) VALUES (@arm_id, 0, 0, 0, 'Event 1');
3090set @event_id = LAST_INSERT_ID();
3091-- Insert into redcap_metadata --
3092
3093INSERT INTO redcap_metadata (project_id, field_name, field_phi, form_name, form_menu_description, field_order, field_units, element_preceding_header, element_type, element_label, element_enum, element_note, element_validation_type, element_validation_min, element_validation_max, element_validation_checktype, branching_logic, field_req, edoc_id, edoc_display_img, custom_alignment, stop_actions, question_num) VALUES
3094(@project_id, 'study_id', NULL, 'demographics', 'Demographics', 1, NULL, NULL, 'text', 'Study ID', NULL, NULL, NULL, NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3095(@project_id, 'date_enrolled', NULL, 'demographics', NULL, 2, NULL, 'Consent Information', 'text', 'Date subject signed consent', NULL, 'YYYY-MM-DD', 'date_ymd', NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3096(@project_id, 'patient_document', NULL, 'demographics', NULL, 2.1, NULL, NULL, 'file', 'Upload the patient''s consent form', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
3097(@project_id, 'first_name', '1', 'demographics', NULL, 3, NULL, 'Contact Information', 'text', 'First Name', NULL, NULL, NULL, NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3098(@project_id, 'last_name', '1', 'demographics', NULL, 4, NULL, NULL, 'text', 'Last Name', NULL, NULL, NULL, NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3099(@project_id, 'address', '1', 'demographics', NULL, 5, NULL, NULL, 'textarea', 'Street, City, State, ZIP', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
3100(@project_id, 'telephone_1', '1', 'demographics', NULL, 6, NULL, NULL, 'text', 'Phone number', NULL, 'Include Area Code', 'phone', NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3101(@project_id, 'email', '1', 'demographics', NULL, 8, NULL, NULL, 'text', 'E-mail', NULL, NULL, 'email', NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3102(@project_id, 'dob', '1', 'demographics', NULL, 8.1, NULL, NULL, 'text', 'Date of birth', NULL, NULL, 'date_ymd', NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3103(@project_id, 'age', NULL, 'demographics', NULL, 8.2, NULL, NULL, 'calc', 'Age (years)', 'rounddown(datediff([dob],''today'',''y''))', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
3104(@project_id, 'ethnicity', NULL, 'demographics', NULL, 9, NULL, NULL, 'radio', 'Ethnicity', '0, Hispanic or Latino \\n 1, NOT Hispanic or Latino \\n 2, Unknown / Not Reported', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, 'LH', NULL, NULL),
3105(@project_id, 'race', NULL, 'demographics', NULL, 10, NULL, NULL, 'select', 'Race', '0, American Indian/Alaska Native \\n 1, Asian \\n 2, Native Hawaiian or Other Pacific Islander \\n 3, Black or African American \\n 4, White \\n 5, More Than One Race \\n 6, Unknown / Not Reported', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
3106(@project_id, 'gender', NULL, 'demographics', NULL, 11, NULL, NULL, 'radio', 'Gender', '0, Female \\n 1, Male \\n 2, Other \\n 3, Prefer not to say', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
3107(@project_id, 'given_birth', NULL, 'demographics', NULL, 12, NULL, NULL, 'yesno', 'Has the patient given birth before?', NULL, NULL, NULL, NULL, NULL, NULL, '[gender] = "0"', 0, NULL, 0, NULL, NULL, NULL),
3108(@project_id, 'num_children', NULL, 'demographics', NULL, 13, NULL, NULL, 'text', 'How many times has the patient given birth?', NULL, NULL, 'int', '0', NULL, 'soft_typed', '[gender] = "0" and [given_birth] = "1"', 0, NULL, 0, NULL, NULL, NULL);
3109
3110INSERT INTO redcap_metadata (project_id, field_name, field_phi, form_name, form_menu_description, field_order, field_units, element_preceding_header, element_type, element_label, element_enum, element_note, element_validation_type, element_validation_min, element_validation_max, element_validation_checktype, branching_logic, field_req, edoc_id, edoc_display_img, custom_alignment, stop_actions, question_num, grid_name, misc) VALUES
3111(@project_id, 'gym', NULL, 'demographics', NULL, 14, NULL, 'Please provide the patient''s weekly schedule for the activities below.', 'checkbox', 'Gym (Weight Training)', '0, Monday \\n 1, Tuesday \\n 2, Wednesday \\n 3, Thursday \\n 4, Friday', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL, 'weekly_schedule', NULL),
3112(@project_id, 'aerobics', NULL, 'demographics', NULL, 15, NULL, NULL, 'checkbox', 'Aerobics', '0, Monday \\n 1, Tuesday \\n 2, Wednesday \\n 3, Thursday \\n 4, Friday', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL, 'weekly_schedule', NULL),
3113(@project_id, 'eat', NULL, 'demographics', NULL, 16, NULL, NULL, 'checkbox', 'Eat Out (Dinner/Lunch)', '0, Monday \\n 1, Tuesday \\n 2, Wednesday \\n 3, Thursday \\n 4, Friday', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL, 'weekly_schedule', NULL),
3114(@project_id, 'drink', NULL, 'demographics', NULL, 17, NULL, NULL, 'checkbox', 'Drink (Alcoholic Beverages)', '0, Monday \\n 1, Tuesday \\n 2, Wednesday \\n 3, Thursday \\n 4, Friday', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL, 'weekly_schedule', NULL);
3115
3116INSERT INTO redcap_metadata (project_id, field_name, field_phi, form_name, form_menu_description, field_order, field_units, element_preceding_header, element_type, element_label, element_enum, element_note, element_validation_type, element_validation_min, element_validation_max, element_validation_checktype, branching_logic, field_req, edoc_id, edoc_display_img, custom_alignment, stop_actions, question_num) VALUES
3117(@project_id, 'specify_mood', NULL, 'demographics', NULL, 17.1, NULL, 'Other information', 'slider', 'Specify the patient''s mood', 'Very sad | Indifferent | Very happy', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
3118(@project_id, 'meds', NULL, 'demographics', NULL, 17.3, NULL, NULL, 'checkbox', 'Is patient taking any of the following medications? (check all that apply)', '1, Lexapro \\n 2, Celexa \\n 3, Prozac \\n 4, Paxil \\n 5, Zoloft', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
3119(@project_id, 'height', NULL, 'demographics', NULL, 19, 'cm', NULL, 'text', 'Height (cm)', NULL, NULL, 'float', '130', '215', 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3120(@project_id, 'weight', NULL, 'demographics', NULL, 20, 'kilograms', NULL, 'text', 'Weight (kilograms)', NULL, NULL, 'int', '35', '200', 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3121(@project_id, 'bmi', NULL, 'demographics', NULL, 21, 'kilograms', NULL, 'calc', 'BMI', 'round(([weight]*10000)/(([height])^(2)),1)', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
3122(@project_id, 'comments', NULL, 'demographics', NULL, 22, NULL, 'General Comments', 'textarea', 'Comments', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
3123(@project_id, 'demographics_complete', NULL, 'demographics', NULL, 23, NULL, 'Form Status', 'select', 'Complete?', '0, Incomplete \\n 1, Unverified \\n 2, Complete', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
3124(@project_id, 'date_visit_b', NULL, 'baseline_data', 'Baseline Data', 24, NULL, 'Baseline Measurements', 'text', 'Date of baseline visit', NULL, NULL, 'date_ymd', NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3125(@project_id, 'date_blood_b', NULL, 'baseline_data', NULL, 25, NULL, NULL, 'text', 'Date blood was drawn', NULL, NULL, 'date_ymd', NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3126(@project_id, 'alb_b', NULL, 'baseline_data', NULL, 26, 'g/dL', NULL, 'text', 'Serum Albumin (g/dL)', NULL, NULL, 'int', '3', '5', 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3127(@project_id, 'prealb_b', NULL, 'baseline_data', NULL, 27, 'mg/dL', NULL, 'text', 'Serum Prealbumin (mg/dL)', NULL, NULL, 'float', '10', '40', 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3128(@project_id, 'creat_b', NULL, 'baseline_data', NULL, 28, 'mg/dL', NULL, 'text', 'Creatinine (mg/dL)', NULL, NULL, 'float', '0.5', '20', 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3129(@project_id, 'npcr_b', NULL, 'baseline_data', NULL, 29, 'g/kg/d', NULL, 'text', 'Normalized Protein Catabolic Rate (g/kg/d)', NULL, NULL, 'float', '0.5', '2', 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3130(@project_id, 'chol_b', NULL, 'baseline_data', NULL, 30, 'mg/dL', NULL, 'text', 'Cholesterol (mg/dL)', NULL, NULL, 'float', '100', '300', 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3131(@project_id, 'transferrin_b', NULL, 'baseline_data', NULL, 31, 'mg/dL', NULL, 'text', 'Transferrin (mg/dL)', NULL, NULL, 'float', '100', '300', 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3132(@project_id, 'kt_v_b', NULL, 'baseline_data', NULL, 32, NULL, NULL, 'text', 'Kt/V', NULL, NULL, 'float', '0.9', '3', 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3133(@project_id, 'drywt_b', NULL, 'baseline_data', NULL, 33, 'kilograms', NULL, 'text', 'Dry weight (kilograms)', NULL, NULL, 'float', '35', '200', 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3134(@project_id, 'plasma1_b', NULL, 'baseline_data', NULL, 34, NULL, NULL, 'select', 'Collected Plasma 1?', '0, No \\n 1, Yes', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
3135(@project_id, 'plasma2_b', NULL, 'baseline_data', NULL, 35, NULL, NULL, 'select', 'Collected Plasma 2?', '0, No \\n 1, Yes', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
3136(@project_id, 'plasma3_b', NULL, 'baseline_data', NULL, 36, NULL, NULL, 'select', 'Collected Plasma 3?', '0, No \\n 1, Yes', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
3137(@project_id, 'serum1_b', NULL, 'baseline_data', NULL, 37, NULL, NULL, 'select', 'Collected Serum 1?', '0, No \\n 1, Yes', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
3138(@project_id, 'serum2_b', NULL, 'baseline_data', NULL, 38, NULL, NULL, 'select', 'Collected Serum 2?', '0, No \\n 1, Yes', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
3139(@project_id, 'serum3_b', NULL, 'baseline_data', NULL, 39, NULL, NULL, 'select', 'Collected Serum 3?', '0, No \\n 1, Yes', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
3140(@project_id, 'sga_b', NULL, 'baseline_data', NULL, 40, NULL, NULL, 'text', 'Subject Global Assessment (score = 1-7)', NULL, NULL, 'float', '0.9', '7.1', 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3141(@project_id, 'date_supplement_dispensed', NULL, 'baseline_data', NULL, 41, NULL, NULL, 'text', 'Date patient begins supplement', NULL, NULL, 'date_ymd', NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3142(@project_id, 'baseline_data_complete', NULL, 'baseline_data', NULL, 42, NULL, 'Form Status', 'select', 'Complete?', '0, Incomplete \\n 1, Unverified \\n 2, Complete', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
3143(@project_id, 'date_visit_1', NULL, 'month_1_data', 'Month 1 Data', 43, NULL, 'Month 1', 'text', 'Date of Month 1 visit', NULL, NULL, 'date_ymd', NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3144(@project_id, 'alb_1', NULL, 'month_1_data', NULL, 44, 'g/dL', NULL, 'text', 'Serum Albumin (g/dL)', NULL, NULL, 'float', '3', '5', 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3145(@project_id, 'prealb_1', NULL, 'month_1_data', NULL, 45, 'mg/dL', NULL, 'text', 'Serum Prealbumin (mg/dL)', NULL, NULL, 'float', '10', '40', 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3146(@project_id, 'creat_1', NULL, 'month_1_data', NULL, 46, 'mg/dL', NULL, 'text', 'Creatinine (mg/dL)', NULL, NULL, 'float', '0.5', '20', 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3147(@project_id, 'npcr_1', NULL, 'month_1_data', NULL, 47, 'g/kg/d', NULL, 'text', 'Normalized Protein Catabolic Rate (g/kg/d)', NULL, NULL, 'float', '0.5', '2', 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3148(@project_id, 'chol_1', NULL, 'month_1_data', NULL, 48, 'mg/dL', NULL, 'text', 'Cholesterol (mg/dL)', NULL, NULL, 'float', '100', '300', 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3149(@project_id, 'transferrin_1', NULL, 'month_1_data', NULL, 49, 'mg/dL', NULL, 'text', 'Transferrin (mg/dL)', NULL, NULL, 'float', '100', '300', 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3150(@project_id, 'kt_v_1', NULL, 'month_1_data', NULL, 50, NULL, NULL, 'text', 'Kt/V', NULL, NULL, 'float', '0.9', '3', 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3151(@project_id, 'drywt_1', NULL, 'month_1_data', NULL, 51, 'kilograms', NULL, 'text', 'Dry weight (kilograms)', NULL, NULL, 'float', '35', '200', 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3152(@project_id, 'no_show_1', NULL, 'month_1_data', NULL, 52, NULL, NULL, 'text', 'Number of treatments missed', NULL, NULL, 'float', '0', '7', 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3153(@project_id, 'compliance_1', NULL, 'month_1_data', NULL, 53, NULL, NULL, 'select', 'How compliant was the patient in drinking the supplement?', '0, 100 percent \\n 1, 99-75 percent \\n 2, 74-50 percent \\n 3, 49-25 percent \\n 4, 0-24 percent', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
3154(@project_id, 'hospit_1', NULL, 'month_1_data', NULL, 54, NULL, 'Hospitalization Data', 'select', 'Was patient hospitalized since last visit?', '0, No \\n 1, Yes', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
3155(@project_id, 'cause_hosp_1', NULL, 'month_1_data', NULL, 55, NULL, NULL, 'select', 'What was the cause of hospitalization?', '1, Vascular access related events \\n 2, CVD events \\n 3, Other', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
3156(@project_id, 'admission_date_1', NULL, 'month_1_data', NULL, 56, NULL, NULL, 'text', 'Date of hospital admission', NULL, NULL, 'date_ymd', NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3157(@project_id, 'discharge_date_1', NULL, 'month_1_data', NULL, 57, NULL, NULL, 'text', 'Date of hospital discharge', NULL, NULL, 'date_ymd', NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3158(@project_id, 'discharge_summary_1', NULL, 'month_1_data', NULL, 58, NULL, NULL, 'select', 'Discharge summary in patients binder?', '0, No \\n 1, Yes', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
3159(@project_id, 'death_1', NULL, 'month_1_data', NULL, 59, NULL, 'Mortality Data', 'select', 'Has patient died since last visit?', '0, No \\n 1, Yes', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
3160(@project_id, 'date_death_1', NULL, 'month_1_data', NULL, 60, NULL, NULL, 'text', 'Date of death', NULL, NULL, 'date_ymd', NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3161(@project_id, 'cause_death_1', NULL, 'month_1_data', NULL, 61, NULL, NULL, 'select', 'What was the cause of death?', '1, All-cause \\n 2, Cardiovascular', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
3162(@project_id, 'month_1_data_complete', NULL, 'month_1_data', NULL, 62, NULL, 'Form Status', 'select', 'Complete?', '0, Incomplete \\n 1, Unverified \\n 2, Complete', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
3163(@project_id, 'date_visit_2', NULL, 'month_2_data', 'Month 2 Data', 63, NULL, 'Month 2', 'text', 'Date of Month 2 visit', NULL, NULL, 'date_ymd', NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3164(@project_id, 'alb_2', NULL, 'month_2_data', NULL, 64, 'g/dL', NULL, 'text', 'Serum Albumin (g/dL)', NULL, NULL, 'float', '3', '5', 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3165(@project_id, 'prealb_2', NULL, 'month_2_data', NULL, 65, 'mg/dL', NULL, 'text', 'Serum Prealbumin (mg/dL)', NULL, NULL, 'float', '10', '40', 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3166(@project_id, 'creat_2', NULL, 'month_2_data', NULL, 66, 'mg/dL', NULL, 'text', 'Creatinine (mg/dL)', NULL, NULL, 'float', '0.5', '20', 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3167(@project_id, 'npcr_2', NULL, 'month_2_data', NULL, 67, 'g/kg/d', NULL, 'text', 'Normalized Protein Catabolic Rate (g/kg/d)', NULL, NULL, 'float', '0.5', '2', 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3168(@project_id, 'chol_2', NULL, 'month_2_data', NULL, 68, 'mg/dL', NULL, 'text', 'Cholesterol (mg/dL)', NULL, NULL, 'float', '100', '300', 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3169(@project_id, 'transferrin_2', NULL, 'month_2_data', NULL, 69, 'mg/dL', NULL, 'text', 'Transferrin (mg/dL)', NULL, NULL, 'float', '100', '300', 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3170(@project_id, 'kt_v_2', NULL, 'month_2_data', NULL, 70, NULL, NULL, 'text', 'Kt/V', NULL, NULL, 'float', '0.9', '3', 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3171(@project_id, 'drywt_2', NULL, 'month_2_data', NULL, 71, 'kilograms', NULL, 'text', 'Dry weight (kilograms)', NULL, NULL, 'float', '35', '200', 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3172(@project_id, 'no_show_2', NULL, 'month_2_data', NULL, 72, NULL, NULL, 'text', 'Number of treatments missed', NULL, NULL, 'float', '0', '7', 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3173(@project_id, 'compliance_2', NULL, 'month_2_data', NULL, 73, NULL, NULL, 'select', 'How compliant was the patient in drinking the supplement?', '0, 100 percent \\n 1, 99-75 percent \\n 2, 74-50 percent \\n 3, 49-25 percent \\n 4, 0-24 percent', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
3174(@project_id, 'hospit_2', NULL, 'month_2_data', NULL, 74, NULL, 'Hospitalization Data', 'select', 'Was patient hospitalized since last visit?', '0, No \\n 1, Yes', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
3175(@project_id, 'cause_hosp_2', NULL, 'month_2_data', NULL, 75, NULL, NULL, 'select', 'What was the cause of hospitalization?', '1, Vascular access related events \\n 2, CVD events \\n 3, Other', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
3176(@project_id, 'admission_date_2', NULL, 'month_2_data', NULL, 76, NULL, NULL, 'text', 'Date of hospital admission', NULL, NULL, 'date_ymd', NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3177(@project_id, 'discharge_date_2', NULL, 'month_2_data', NULL, 77, NULL, NULL, 'text', 'Date of hospital discharge', NULL, NULL, 'date_ymd', NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3178(@project_id, 'discharge_summary_2', NULL, 'month_2_data', NULL, 78, NULL, NULL, 'select', 'Discharge summary in patients binder?', '0, No \\n 1, Yes', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
3179(@project_id, 'death_2', NULL, 'month_2_data', NULL, 79, NULL, 'Mortality Data', 'select', 'Has patient died since last visit?', '0, No \\n 1, Yes', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
3180(@project_id, 'date_death_2', NULL, 'month_2_data', NULL, 80, NULL, NULL, 'text', 'Date of death', NULL, NULL, 'date_ymd', NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3181(@project_id, 'cause_death_2', NULL, 'month_2_data', NULL, 81, NULL, NULL, 'select', 'What was the cause of death?', '1, All-cause \\n 2, Cardiovascular', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
3182(@project_id, 'month_2_data_complete', NULL, 'month_2_data', NULL, 82, NULL, 'Form Status', 'select', 'Complete?', '0, Incomplete \\n 1, Unverified \\n 2, Complete', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
3183(@project_id, 'date_visit_3', NULL, 'month_3_data', 'Month 3 Data', 83, NULL, 'Month 3', 'text', 'Date of Month 3 visit', NULL, NULL, 'date_ymd', NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3184(@project_id, 'date_blood_3', NULL, 'month_3_data', NULL, 84, NULL, NULL, 'text', 'Date blood was drawn', NULL, NULL, 'date_ymd', NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3185(@project_id, 'alb_3', NULL, 'month_3_data', NULL, 85, 'g/dL', NULL, 'text', 'Serum Albumin (g/dL)', NULL, NULL, 'float', '3', '5', 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3186(@project_id, 'prealb_3', NULL, 'month_3_data', NULL, 86, 'mg/dL', NULL, 'text', 'Serum Prealbumin (mg/dL)', NULL, NULL, 'float', '10', '40', 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3187(@project_id, 'creat_3', NULL, 'month_3_data', NULL, 87, 'mg/dL', NULL, 'text', 'Creatinine (mg/dL)', NULL, NULL, 'float', '0.5', '20', 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3188(@project_id, 'npcr_3', NULL, 'month_3_data', NULL, 88, 'g/kg/d', NULL, 'text', 'Normalized Protein Catabolic Rate (g/kg/d)', NULL, NULL, 'float', '0.5', '2', 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3189(@project_id, 'chol_3', NULL, 'month_3_data', NULL, 89, 'mg/dL', NULL, 'text', 'Cholesterol (mg/dL)', NULL, NULL, 'float', '100', '300', 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3190(@project_id, 'transferrin_3', NULL, 'month_3_data', NULL, 90, 'mg/dL', NULL, 'text', 'Transferrin (mg/dL)', NULL, NULL, 'float', '100', '300', 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3191(@project_id, 'kt_v_3', NULL, 'month_3_data', NULL, 91, NULL, NULL, 'text', 'Kt/V', NULL, NULL, 'float', '0.9', '3', 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3192(@project_id, 'drywt_3', NULL, 'month_3_data', NULL, 92, 'kilograms', NULL, 'text', 'Dry weight (kilograms)', NULL, NULL, 'float', '35', '200', 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3193(@project_id, 'plasma1_3', NULL, 'month_3_data', NULL, 93, NULL, NULL, 'select', 'Collected Plasma 1?', '0, No \\n 1, Yes', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
3194(@project_id, 'plasma2_3', NULL, 'month_3_data', NULL, 94, NULL, NULL, 'select', 'Collected Plasma 2?', '0, No \\n 1, Yes', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
3195(@project_id, 'plasma3_3', NULL, 'month_3_data', NULL, 95, NULL, NULL, 'select', 'Collected Plasma 3?', '0, No \\n 1, Yes', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
3196(@project_id, 'serum1_3', NULL, 'month_3_data', NULL, 96, NULL, NULL, 'select', 'Collected Serum 1?', '0, No \\n 1, Yes', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
3197(@project_id, 'serum2_3', NULL, 'month_3_data', NULL, 97, NULL, NULL, 'select', 'Collected Serum 2?', '0, No \\n 1, Yes', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
3198(@project_id, 'serum3_3', NULL, 'month_3_data', NULL, 98, NULL, NULL, 'select', 'Collected Serum 3?', '0, No \\n 1, Yes', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
3199(@project_id, 'sga_3', NULL, 'month_3_data', NULL, 99, NULL, NULL, 'text', 'Subject Global Assessment (score = 1-7)', NULL, NULL, 'float', '0.9', '7.1', 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3200(@project_id, 'no_show_3', NULL, 'month_3_data', NULL, 100, NULL, NULL, 'text', 'Number of treatments missed', NULL, NULL, 'float', '0', '7', 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3201(@project_id, 'compliance_3', NULL, 'month_3_data', NULL, 101, NULL, NULL, 'select', 'How compliant was the patient in drinking the supplement?', '0, 100 percent \\n 1, 99-75 percent \\n 2, 74-50 percent \\n 3, 49-25 percent \\n 4, 0-24 percent', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
3202(@project_id, 'hospit_3', NULL, 'month_3_data', NULL, 102, NULL, 'Hospitalization Data', 'select', 'Was patient hospitalized since last visit?', '0, No \\n 1, Yes', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
3203(@project_id, 'cause_hosp_3', NULL, 'month_3_data', NULL, 103, NULL, NULL, 'select', 'What was the cause of hospitalization?', '1, Vascular access related events \\n 2, CVD events \\n 3, Other', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
3204(@project_id, 'admission_date_3', NULL, 'month_3_data', NULL, 104, NULL, NULL, 'text', 'Date of hospital admission', NULL, NULL, 'date_ymd', NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3205(@project_id, 'discharge_date_3', NULL, 'month_3_data', NULL, 105, NULL, NULL, 'text', 'Date of hospital discharge', NULL, NULL, 'date_ymd', NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3206(@project_id, 'discharge_summary_3', NULL, 'month_3_data', NULL, 106, NULL, NULL, 'select', 'Discharge summary in patients binder?', '0, No \\n 1, Yes', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
3207(@project_id, 'death_3', NULL, 'month_3_data', NULL, 107, NULL, 'Mortality Data', 'select', 'Has patient died since last visit?', '0, No \\n 1, Yes', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
3208(@project_id, 'date_death_3', NULL, 'month_3_data', NULL, 108, NULL, NULL, 'text', 'Date of death', NULL, NULL, 'date_ymd', NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3209(@project_id, 'cause_death_3', NULL, 'month_3_data', NULL, 109, NULL, NULL, 'select', 'What was the cause of death?', '1, All-cause \\n 2, Cardiovascular', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
3210(@project_id, 'month_3_data_complete', NULL, 'month_3_data', NULL, 110, NULL, 'Form Status', 'select', 'Complete?', '0, Incomplete \\n 1, Unverified \\n 2, Complete', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
3211(@project_id, 'complete_study', NULL, 'completion_data', 'Completion Data', 111, NULL, 'Study Completion Information', 'select', 'Has patient completed study?', '0, No \\n 1, Yes', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
3212(@project_id, 'withdraw_date', NULL, 'completion_data', NULL, 112, NULL, NULL, 'text', 'Put a date if patient withdrew study', NULL, NULL, 'date_ymd', NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3213(@project_id, 'withdraw_reason', NULL, 'completion_data', NULL, 113, NULL, NULL, 'select', 'Reason patient withdrew from study', '0, Non-compliance \\n 1, Did not wish to continue in study \\n 2, Could not tolerate the supplement \\n 3, Hospitalization \\n 4, Other', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
3214(@project_id, 'complete_study_date', NULL, 'completion_data', NULL, 114, NULL, NULL, 'text', 'Date of study completion', NULL, NULL, 'date_ymd', NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3215(@project_id, 'study_comments', NULL, 'completion_data', NULL, 115, NULL, 'General Comments', 'textarea', 'Comments', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
3216(@project_id, 'completion_data_complete', NULL, 'completion_data', NULL, 116, NULL, 'Form Status', 'select', 'Complete?', '0, Incomplete \\n 1, Unverified \\n 2, Complete', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL);
3217
3218INSERT INTO `redcap_projects_templates` (`project_id`, `title`, `description`, `enabled`)
3219 VALUES (@project_id, @project_title, 'Contains six data entry forms, including forms for demography and baseline data, three monthly data forms, and concludes with a completion data form.', '1');
3220-- SQL TO CREATE A REDCAP DEMO PROJECT --
3221set @project_title = 'Longitudinal Database (1 arm)';
3222
3223
3224-- Obtain default values --
3225set @institution = (select value from redcap_config where field_name = 'institution' limit 1);
3226set @site_org_type = (select value from redcap_config where field_name = 'site_org_type' limit 1);
3227set @grant_cite = (select value from redcap_config where field_name = 'grant_cite' limit 1);
3228set @project_contact_name = (select value from redcap_config where field_name = 'project_contact_name' limit 1);
3229set @project_contact_email = (select value from redcap_config where field_name = 'project_contact_email' limit 1);
3230set @headerlogo = (select value from redcap_config where field_name = 'headerlogo' limit 1);
3231set @auth_meth = (select value from redcap_config where field_name = 'auth_meth_global' limit 1);
3232-- Create project --
3233INSERT INTO `redcap_projects`
3234(project_name, app_title, repeatforms, status, count_project, auth_meth, creation_time, production_time, institution, site_org_type, grant_cite, project_contact_name, project_contact_email, headerlogo, display_project_logo_institution, auto_inc_set) VALUES
3235(concat('redcap_demo_',LEFT(sha1(rand()),6)), @project_title, 1, 1, 0, @auth_meth, now(), now(), @institution, @site_org_type, @grant_cite, @project_contact_name, @project_contact_email, @headerlogo, 0, 1);
3236set @project_id = LAST_INSERT_ID();
3237-- User rights --
3238INSERT INTO redcap_user_rights (project_id, username, expiration, group_id, lock_record, data_export_tool, data_import_tool, data_comparison_tool, data_logging, file_repository, double_data, user_rights, data_access_groups, graphical, reports, design, calendar, data_entry, `data_quality_execute`) VALUES
3239(@project_id, 'site_admin', NULL, NULL, 0, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 0, 1, '', 1);
3240-- Create arms --
3241INSERT INTO redcap_events_arms (project_id, arm_num, arm_name) VALUES(@project_id, 1, 'Drug A');
3242set @arm_id1 = LAST_INSERT_ID();
3243-- Create events --
3244INSERT INTO redcap_events_metadata (arm_id, day_offset, offset_min, offset_max, descrip) VALUES(@arm_id1, 0, 0, 0, 'Enrollment');
3245set @event_id = LAST_INSERT_ID();
3246INSERT INTO redcap_events_forms (event_id, form_name) VALUES(@event_id, 'baseline_data');
3247INSERT INTO redcap_events_forms (event_id, form_name) VALUES(@event_id, 'demographics');
3248INSERT INTO redcap_events_metadata (arm_id, day_offset, offset_min, offset_max, descrip) VALUES(@arm_id1, 1, 0, 0, 'Dose 1');
3249set @event_id = LAST_INSERT_ID();
3250INSERT INTO redcap_events_forms (event_id, form_name) VALUES(@event_id, 'patient_morale_questionnaire');
3251INSERT INTO redcap_events_metadata (arm_id, day_offset, offset_min, offset_max, descrip) VALUES(@arm_id1, 3, 0, 0, 'Visit 1');
3252set @event_id = LAST_INSERT_ID();
3253INSERT INTO redcap_events_forms (event_id, form_name) VALUES(@event_id, 'patient_morale_questionnaire');
3254INSERT INTO redcap_events_forms (event_id, form_name) VALUES(@event_id, 'visit_blood_workup');
3255INSERT INTO redcap_events_forms (event_id, form_name) VALUES(@event_id, 'visit_lab_data');
3256INSERT INTO redcap_events_forms (event_id, form_name) VALUES(@event_id, 'visit_observed_behavior');
3257INSERT INTO redcap_events_metadata (arm_id, day_offset, offset_min, offset_max, descrip) VALUES(@arm_id1, 8, 0, 0, 'Dose 2');
3258set @event_id = LAST_INSERT_ID();
3259INSERT INTO redcap_events_forms (event_id, form_name) VALUES(@event_id, 'patient_morale_questionnaire');
3260INSERT INTO redcap_events_metadata (arm_id, day_offset, offset_min, offset_max, descrip) VALUES(@arm_id1, 10, 0, 0, 'Visit 2');
3261set @event_id = LAST_INSERT_ID();
3262INSERT INTO redcap_events_forms (event_id, form_name) VALUES(@event_id, 'patient_morale_questionnaire');
3263INSERT INTO redcap_events_forms (event_id, form_name) VALUES(@event_id, 'visit_blood_workup');
3264INSERT INTO redcap_events_forms (event_id, form_name) VALUES(@event_id, 'visit_lab_data');
3265INSERT INTO redcap_events_forms (event_id, form_name) VALUES(@event_id, 'visit_observed_behavior');
3266INSERT INTO redcap_events_metadata (arm_id, day_offset, offset_min, offset_max, descrip) VALUES(@arm_id1, 15, 0, 0, 'Dose 3');
3267set @event_id = LAST_INSERT_ID();
3268INSERT INTO redcap_events_forms (event_id, form_name) VALUES(@event_id, 'patient_morale_questionnaire');
3269INSERT INTO redcap_events_metadata (arm_id, day_offset, offset_min, offset_max, descrip) VALUES(@arm_id1, 17, 0, 0, 'Visit 3');
3270set @event_id = LAST_INSERT_ID();
3271INSERT INTO redcap_events_forms (event_id, form_name) VALUES(@event_id, 'patient_morale_questionnaire');
3272INSERT INTO redcap_events_forms (event_id, form_name) VALUES(@event_id, 'visit_blood_workup');
3273INSERT INTO redcap_events_forms (event_id, form_name) VALUES(@event_id, 'visit_lab_data');
3274INSERT INTO redcap_events_forms (event_id, form_name) VALUES(@event_id, 'visit_observed_behavior');
3275INSERT INTO redcap_events_metadata (arm_id, day_offset, offset_min, offset_max, descrip) VALUES(@arm_id1, 30, 0, 0, 'Final visit');
3276set @event_id = LAST_INSERT_ID();
3277INSERT INTO redcap_events_forms (event_id, form_name) VALUES(@event_id, 'completion_data');
3278INSERT INTO redcap_events_forms (event_id, form_name) VALUES(@event_id, 'completion_project_questionnaire');
3279INSERT INTO redcap_events_forms (event_id, form_name) VALUES(@event_id, 'patient_morale_questionnaire');
3280INSERT INTO redcap_events_forms (event_id, form_name) VALUES(@event_id, 'visit_blood_workup');
3281INSERT INTO redcap_events_forms (event_id, form_name) VALUES(@event_id, 'visit_observed_behavior');
3282-- Insert into redcap_metadata --
3283
3284INSERT INTO redcap_metadata (project_id, field_name, field_phi, form_name, form_menu_description, field_order, field_units, element_preceding_header, element_type, element_label, element_enum, element_note, element_validation_type, element_validation_min, element_validation_max, element_validation_checktype, branching_logic, field_req, edoc_id, edoc_display_img, custom_alignment, stop_actions, question_num) VALUES
3285(@project_id, 'study_id', NULL, 'demographics', 'Demographics', 1, NULL, NULL, 'text', 'Study ID', NULL, NULL, NULL, NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3286(@project_id, 'date_enrolled', NULL, 'demographics', NULL, 2, NULL, 'Consent Information', 'text', 'Date subject signed consent', NULL, 'YYYY-MM-DD', 'date_ymd', NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3287(@project_id, 'patient_document', NULL, 'demographics', NULL, 2.1, NULL, NULL, 'file', 'Upload the patient''s consent form', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
3288(@project_id, 'first_name', '1', 'demographics', NULL, 3, NULL, 'Contact Information', 'text', 'First Name', NULL, NULL, NULL, NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3289(@project_id, 'last_name', '1', 'demographics', NULL, 4, NULL, NULL, 'text', 'Last Name', NULL, NULL, NULL, NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3290(@project_id, 'address', '1', 'demographics', NULL, 5, NULL, NULL, 'textarea', 'Street, City, State, ZIP', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
3291(@project_id, 'telephone_1', '1', 'demographics', NULL, 6, NULL, NULL, 'text', 'Phone number', NULL, 'Include Area Code', 'phone', NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3292(@project_id, 'email', '1', 'demographics', NULL, 8, NULL, NULL, 'text', 'E-mail', NULL, NULL, 'email', NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3293(@project_id, 'dob', '1', 'demographics', NULL, 8.1, NULL, NULL, 'text', 'Date of birth', NULL, NULL, 'date_ymd', NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3294(@project_id, 'age', NULL, 'demographics', NULL, 8.2, NULL, NULL, 'calc', 'Age (years)', 'rounddown(datediff([dob],''today'',''y''))', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
3295(@project_id, 'ethnicity', NULL, 'demographics', NULL, 9, NULL, NULL, 'radio', 'Ethnicity', '0, Hispanic or Latino \\n 1, NOT Hispanic or Latino \\n 2, Unknown / Not Reported', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, 'LH', NULL, NULL),
3296(@project_id, 'race', NULL, 'demographics', NULL, 10, NULL, NULL, 'select', 'Race', '0, American Indian/Alaska Native \\n 1, Asian \\n 2, Native Hawaiian or Other Pacific Islander \\n 3, Black or African American \\n 4, White \\n 5, More Than One Race \\n 6, Unknown / Not Reported', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
3297(@project_id, 'gender', NULL, 'demographics', NULL, 11, NULL, NULL, 'radio', 'Gender', '0, Female \\n 1, Male \\n 2, Other \\n 3, Prefer not to say', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
3298(@project_id, 'given_birth', NULL, 'demographics', NULL, 12, NULL, NULL, 'yesno', 'Has the patient given birth before?', NULL, NULL, NULL, NULL, NULL, NULL, '[gender] = "0"', 0, NULL, 0, NULL, NULL, NULL),
3299(@project_id, 'num_children', NULL, 'demographics', NULL, 13, NULL, NULL, 'text', 'How many times has the patient given birth?', NULL, NULL, 'int', '0', NULL, 'soft_typed', '[gender] = "0" and [given_birth] = "1"', 0, NULL, 0, NULL, NULL, NULL);
3300
3301INSERT INTO redcap_metadata (project_id, field_name, field_phi, form_name, form_menu_description, field_order, field_units, element_preceding_header, element_type, element_label, element_enum, element_note, element_validation_type, element_validation_min, element_validation_max, element_validation_checktype, branching_logic, field_req, edoc_id, edoc_display_img, custom_alignment, stop_actions, question_num, grid_name, misc) VALUES
3302(@project_id, 'gym', NULL, 'demographics', NULL, 14, NULL, 'Please provide the patient''s weekly schedule for the activities below.', 'checkbox', 'Gym (Weight Training)', '0, Monday \\n 1, Tuesday \\n 2, Wednesday \\n 3, Thursday \\n 4, Friday', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL, 'weekly_schedule', NULL),
3303(@project_id, 'aerobics', NULL, 'demographics', NULL, 15, NULL, NULL, 'checkbox', 'Aerobics', '0, Monday \\n 1, Tuesday \\n 2, Wednesday \\n 3, Thursday \\n 4, Friday', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL, 'weekly_schedule', NULL),
3304(@project_id, 'eat', NULL, 'demographics', NULL, 16, NULL, NULL, 'checkbox', 'Eat Out (Dinner/Lunch)', '0, Monday \\n 1, Tuesday \\n 2, Wednesday \\n 3, Thursday \\n 4, Friday', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL, 'weekly_schedule', NULL),
3305(@project_id, 'drink', NULL, 'demographics', NULL, 17, NULL, NULL, 'checkbox', 'Drink (Alcoholic Beverages)', '0, Monday \\n 1, Tuesday \\n 2, Wednesday \\n 3, Thursday \\n 4, Friday', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL, 'weekly_schedule', NULL);
3306
3307INSERT INTO redcap_metadata (project_id, field_name, field_phi, form_name, form_menu_description, field_order, field_units, element_preceding_header, element_type, element_label, element_enum, element_note, element_validation_type, element_validation_min, element_validation_max, element_validation_checktype, branching_logic, field_req, edoc_id, edoc_display_img, custom_alignment, stop_actions, question_num) VALUES
3308(@project_id, 'specify_mood', NULL, 'demographics', NULL, 17.1, NULL, 'Other information', 'slider', 'Specify the patient''s mood', 'Very sad | Indifferent | Very happy', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
3309(@project_id, 'meds', NULL, 'demographics', NULL, 17.3, NULL, NULL, 'checkbox', 'Is patient taking any of the following medications? (check all that apply)', '1, Lexapro \\n 2, Celexa \\n 3, Prozac \\n 4, Paxil \\n 5, Zoloft', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
3310(@project_id, 'height', NULL, 'demographics', NULL, 19, 'cm', NULL, 'text', 'Height (cm)', NULL, NULL, 'float', '130', '215', 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3311(@project_id, 'weight', NULL, 'demographics', NULL, 20, 'kilograms', NULL, 'text', 'Weight (kilograms)', NULL, NULL, 'int', '35', '200', 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3312(@project_id, 'bmi', NULL, 'demographics', NULL, 21, 'kilograms', NULL, 'calc', 'BMI', 'round(([weight]*10000)/(([height])^(2)),1)', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
3313(@project_id, 'comments', NULL, 'demographics', NULL, 22, NULL, 'General Comments', 'textarea', 'Comments', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
3314(@project_id, 'demographics_complete', NULL, 'demographics', NULL, 23, NULL, 'Form Status', 'select', 'Complete?', '0, Incomplete \\n 1, Unverified \\n 2, Complete', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
3315(@project_id, 'height2', NULL, 'baseline_data', 'Baseline Data', 31, NULL, NULL, 'text', 'Height (cm)', NULL, NULL, 'float', NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3316(@project_id, 'weight2', NULL, 'baseline_data', NULL, 32, NULL, NULL, 'text', 'Weight (kilograms)', NULL, NULL, 'int', NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3317(@project_id, 'bmi2', NULL, 'baseline_data', NULL, 33, NULL, NULL, 'calc', 'BMI', 'round(([weight2]*10000)/(([height2])^(2)),1)', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
3318(@project_id, 'prealb_b', NULL, 'baseline_data', NULL, 34, NULL, NULL, 'text', 'Serum Prealbumin (mg/dL)', NULL, NULL, 'float', NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3319(@project_id, 'creat_b', NULL, 'baseline_data', NULL, 35, NULL, NULL, 'text', 'Creatinine (mg/dL)', NULL, NULL, 'float', NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3320(@project_id, 'npcr_b', NULL, 'baseline_data', NULL, 36, NULL, NULL, 'text', 'Normalized Protein Catabolic Rate (g/kg/d)', NULL, NULL, 'float', NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3321(@project_id, 'chol_b', NULL, 'baseline_data', NULL, 37, NULL, NULL, 'text', 'Cholesterol (mg/dL)', NULL, NULL, 'float', NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3322(@project_id, 'transferrin_b', NULL, 'baseline_data', NULL, 38, NULL, NULL, 'text', 'Transferrin (mg/dL)', NULL, NULL, 'float', NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3323(@project_id, 'baseline_data_complete', NULL, 'baseline_data', NULL, 39, NULL, 'Form Status', 'select', 'Complete?', '0, Incomplete \\n 1, Unverified \\n 2, Complete', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
3324(@project_id, 'vld1', NULL, 'visit_lab_data', 'Visit Lab Data', 40, NULL, NULL, 'text', 'Serum Prealbumin (mg/dL)', NULL, NULL, 'float', NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3325(@project_id, 'vld2', NULL, 'visit_lab_data', NULL, 41, NULL, NULL, 'text', 'Creatinine (mg/dL)', NULL, NULL, 'float', NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3326(@project_id, 'vld3', NULL, 'visit_lab_data', NULL, 42, NULL, NULL, 'text', 'Normalized Protein Catabolic Rate (g/kg/d)', NULL, NULL, 'float', NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3327(@project_id, 'vld4', NULL, 'visit_lab_data', NULL, 43, NULL, NULL, 'text', 'Cholesterol (mg/dL)', NULL, NULL, 'float', NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3328(@project_id, 'vld5', NULL, 'visit_lab_data', NULL, 44, NULL, NULL, 'text', 'Transferrin (mg/dL)', NULL, NULL, 'float', NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3329(@project_id, 'visit_lab_data_complete', NULL, 'visit_lab_data', NULL, 45, NULL, 'Form Status', 'select', 'Complete?', '0, Incomplete \\n 1, Unverified \\n 2, Complete', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
3330(@project_id, 'pmq1', NULL, 'patient_morale_questionnaire', 'Patient Morale Questionnaire', 46, NULL, NULL, 'select', 'On average, how many pills did you take each day last week?', '0, less than 5 \\n 1, 5-10 \\n 2, 6-15 \\n 3, over 15', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
3331(@project_id, 'pmq2', NULL, 'patient_morale_questionnaire', NULL, 47, NULL, NULL, 'select', 'Using the handout, which level of dependence do you feel you are currently at?', '0, 0 \\n 1, 1 \\n 2, 2 \\n 3, 3 \\n 4, 4 \\n 5, 5', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
3332(@project_id, 'pmq3', NULL, 'patient_morale_questionnaire', NULL, 48, NULL, NULL, 'radio', 'Would you be willing to discuss your experiences with a psychiatrist?', '0, No \\n 1, Yes', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
3333(@project_id, 'pmq4', NULL, 'patient_morale_questionnaire', NULL, 49, NULL, NULL, 'select', 'How open are you to further testing?', '0, not open \\n 1, undecided \\n 2, very open', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
3334(@project_id, 'patient_morale_questionnaire_complete', NULL, 'patient_morale_questionnaire', NULL, 50, NULL, 'Form Status', 'select', 'Complete?', '0, Incomplete \\n 1, Unverified \\n 2, Complete', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
3335(@project_id, 'vbw1', NULL, 'visit_blood_workup', 'Visit Blood Workup', 51, NULL, NULL, 'text', 'Serum Prealbumin (mg/dL)', NULL, NULL, 'float', NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3336(@project_id, 'vbw2', NULL, 'visit_blood_workup', NULL, 52, NULL, NULL, 'text', 'Creatinine (mg/dL)', NULL, NULL, 'float', NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3337(@project_id, 'vbw3', NULL, 'visit_blood_workup', NULL, 53, NULL, NULL, 'text', 'Normalized Protein Catabolic Rate (g/kg/d)', NULL, NULL, 'float', NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3338(@project_id, 'vbw4', NULL, 'visit_blood_workup', NULL, 54, NULL, NULL, 'text', 'Cholesterol (mg/dL)', NULL, NULL, 'float', NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3339(@project_id, 'vbw5', NULL, 'visit_blood_workup', NULL, 55, NULL, NULL, 'text', 'Transferrin (mg/dL)', NULL, NULL, 'float', NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3340(@project_id, 'vbw6', NULL, 'visit_blood_workup', NULL, 56, NULL, NULL, 'radio', 'Blood draw shift?', '0, AM \\n 1, PM', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
3341(@project_id, 'vbw7', NULL, 'visit_blood_workup', NULL, 57, NULL, NULL, 'radio', 'Blood draw by', '0, RN \\n 1, LPN \\n 2, nurse assistant \\n 3, doctor', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
3342(@project_id, 'vbw8', NULL, 'visit_blood_workup', NULL, 58, NULL, NULL, 'select', 'Level of patient anxiety', '0, not anxious \\n 1, undecided \\n 2, very anxious', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
3343(@project_id, 'vbw9', NULL, 'visit_blood_workup', NULL, 59, NULL, NULL, 'select', 'Patient scheduled for future draws?', '0, No \\n 1, Yes', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
3344(@project_id, 'visit_blood_workup_complete', NULL, 'visit_blood_workup', NULL, 60, NULL, 'Form Status', 'select', 'Complete?', '0, Incomplete \\n 1, Unverified \\n 2, Complete', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
3345(@project_id, 'vob1', NULL, 'visit_observed_behavior', 'Visit Observed Behavior', 61, NULL, 'Was the patient...', 'radio', 'nervous?', '0, No \\n 1, Yes', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
3346(@project_id, 'vob2', NULL, 'visit_observed_behavior', NULL, 62, NULL, NULL, 'radio', 'worried?', '0, No \\n 1, Yes', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
3347(@project_id, 'vob3', NULL, 'visit_observed_behavior', NULL, 63, NULL, NULL, 'radio', 'scared?', '0, No \\n 1, Yes', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
3348(@project_id, 'vob4', NULL, 'visit_observed_behavior', NULL, 64, NULL, NULL, 'radio', 'fidgety?', '0, No \\n 1, Yes', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
3349(@project_id, 'vob5', NULL, 'visit_observed_behavior', NULL, 65, NULL, NULL, 'radio', 'crying?', '0, No \\n 1, Yes', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
3350(@project_id, 'vob6', NULL, 'visit_observed_behavior', NULL, 66, NULL, NULL, 'radio', 'screaming?', '0, No \\n 1, Yes', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
3351(@project_id, 'vob7', NULL, 'visit_observed_behavior', NULL, 67, NULL, NULL, 'textarea', 'other', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
3352(@project_id, 'vob8', NULL, 'visit_observed_behavior', NULL, 68, NULL, 'Were you...', 'radio', 'nervous?', '0, No \\n 1, Yes', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
3353(@project_id, 'vob9', NULL, 'visit_observed_behavior', NULL, 69, NULL, NULL, 'radio', 'worried?', '0, No \\n 1, Yes', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
3354(@project_id, 'vob10', NULL, 'visit_observed_behavior', NULL, 70, NULL, NULL, 'radio', 'scared?', '0, No \\n 1, Yes', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
3355(@project_id, 'vob11', NULL, 'visit_observed_behavior', NULL, 71, NULL, NULL, 'radio', 'fidgety?', '0, No \\n 1, Yes', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
3356(@project_id, 'vob12', NULL, 'visit_observed_behavior', NULL, 72, NULL, NULL, 'radio', 'crying?', '0, No \\n 1, Yes', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
3357(@project_id, 'vob13', NULL, 'visit_observed_behavior', NULL, 73, NULL, NULL, 'radio', 'screaming?', '0, No \\n 1, Yes', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
3358(@project_id, 'vob14', NULL, 'visit_observed_behavior', NULL, 74, NULL, NULL, 'textarea', 'other', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
3359(@project_id, 'visit_observed_behavior_complete', NULL, 'visit_observed_behavior', NULL, 75, NULL, 'Form Status', 'select', 'Complete?', '0, Incomplete \\n 1, Unverified \\n 2, Complete', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
3360(@project_id, 'study_comments', NULL, 'completion_data', 'Completion Data', 76, NULL, NULL, 'textarea', 'Comments', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
3361(@project_id, 'complete_study', NULL, 'completion_data', NULL, 77, NULL, NULL, 'select', 'Has patient completed study?', '0, No \\n 1, Yes', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
3362(@project_id, 'withdraw_date', NULL, 'completion_data', NULL, 78, NULL, NULL, 'text', 'Put a date if patient withdrew study', NULL, NULL, 'date_ymd', NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3363(@project_id, 'date_visit_4', NULL, 'completion_data', NULL, 79, NULL, NULL, 'text', 'Date of last visit', NULL, NULL, 'date_ymd', NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3364(@project_id, 'alb_4', NULL, 'completion_data', NULL, 80, NULL, NULL, 'text', 'Serum Albumin (g/dL)', NULL, NULL, 'float', NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3365(@project_id, 'prealb_4', NULL, 'completion_data', NULL, 81, NULL, NULL, 'text', 'Serum Prealbumin (mg/dL)', NULL, NULL, 'float', NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3366(@project_id, 'creat_4', NULL, 'completion_data', NULL, 82, NULL, NULL, 'text', 'Creatinine (mg/dL)', NULL, NULL, 'date_ymd', NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3367(@project_id, 'discharge_date_4', NULL, 'completion_data', NULL, 83, NULL, NULL, 'text', 'Date of hospital discharge', NULL, NULL, 'date_ymd', NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3368(@project_id, 'discharge_summary_4', NULL, 'completion_data', NULL, 84, NULL, NULL, 'select', 'Discharge summary in patients binder?', '0, No \\n 1, Yes', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
3369(@project_id, 'npcr_4', NULL, 'completion_data', NULL, 85, NULL, NULL, 'text', 'Normalized Protein Catabolic Rate (g/kg/d)', NULL, NULL, 'int', NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3370(@project_id, 'chol_4', NULL, 'completion_data', NULL, 86, NULL, NULL, 'text', 'Cholesterol (mg/dL)', NULL, NULL, 'int', NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3371(@project_id, 'withdraw_reason', NULL, 'completion_data', NULL, 87, NULL, NULL, 'select', 'Reason patient withdrew from study', '0, Non-compliance \\n 1, Did not wish to continue in study \\n 2, Could not tolerate the supplement \\n 3, Hospitalization \\n 4, Other', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
3372(@project_id, 'completion_data_complete', NULL, 'completion_data', NULL, 88, NULL, 'Form Status', 'select', 'Complete?', '0, Incomplete \\n 1, Unverified \\n 2, Complete', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
3373(@project_id, 'cpq1', NULL, 'completion_project_questionnaire', 'Completion Project Questionnaire', 89, NULL, NULL, 'text', 'Date of study completion', NULL, NULL, 'date_ymd', NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3374(@project_id, 'cpq2', NULL, 'completion_project_questionnaire', NULL, 90, NULL, NULL, 'text', 'Transferrin (mg/dL)', NULL, NULL, 'int', NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3375(@project_id, 'cpq3', NULL, 'completion_project_questionnaire', NULL, 91, NULL, NULL, 'text', 'Kt/V', NULL, NULL, 'int', NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3376(@project_id, 'cpq4', NULL, 'completion_project_questionnaire', NULL, 92, NULL, NULL, 'text', 'Dry weight (kilograms)', NULL, NULL, 'int', NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3377(@project_id, 'cpq5', NULL, 'completion_project_questionnaire', NULL, 93, NULL, NULL, 'text', 'Number of treatments missed', NULL, NULL, 'int', NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3378(@project_id, 'cpq6', NULL, 'completion_project_questionnaire', NULL, 94, NULL, NULL, 'select', 'How compliant was the patient in drinking the supplement?', '0, 100 percent \\n 1, 99-75 percent \\n 2, 74-50 percent \\n 3, 49-25 percent \\n 4, 0-24 percent', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
3379(@project_id, 'cpq7', NULL, 'completion_project_questionnaire', NULL, 95, NULL, NULL, 'select', 'Was patient hospitalized since last visit?', '0, No \\n 1, Yes', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
3380(@project_id, 'cpq8', NULL, 'completion_project_questionnaire', NULL, 96, NULL, NULL, 'select', 'What was the cause of hospitalization?', '1, Vascular access related events \\n 2, CVD events \\n 3, Other', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
3381(@project_id, 'cpq9', NULL, 'completion_project_questionnaire', NULL, 97, NULL, NULL, 'text', 'Date of hospital admission', NULL, NULL, 'date_ymd', NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3382(@project_id, 'cpq10', NULL, 'completion_project_questionnaire', NULL, 98, NULL, NULL, 'select', 'On average, how many pills did you take each day last week?', '0, less than 5 \\n 1, 5-10 \\n 2, 6-15 \\n 3, over 15', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
3383(@project_id, 'cpq11', NULL, 'completion_project_questionnaire', NULL, 99, NULL, NULL, 'select', 'Using the handout, which level of dependence do you feel you are currently at?', '0, 0 \\n 1, 1 \\n 2, 2 \\n 3, 3 \\n 4, 4 \\n 5, 5', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
3384(@project_id, 'cpq12', NULL, 'completion_project_questionnaire', NULL, 100, NULL, NULL, 'radio', 'Would you be willing to discuss your experiences with a psychiatrist?', '0, No \\n 1, Yes', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
3385(@project_id, 'cpq13', NULL, 'completion_project_questionnaire', NULL, 101, NULL, NULL, 'select', 'How open are you to further testing?', '0, not open \\n 1, undecided \\n 2, very open', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
3386(@project_id, 'completion_project_questionnaire_complete', NULL, 'completion_project_questionnaire', NULL, 102, NULL, 'Form Status', 'select', 'Complete?', '0, Incomplete \\n 1, Unverified \\n 2, Complete', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL);
3387
3388INSERT INTO `redcap_projects_templates` (`project_id`, `title`, `description`, `enabled`)
3389 VALUES (@project_id, @project_title, 'Contains nine data entry forms (beginning with a demography form) for collecting data longitudinally over eight different events.', '1');
3390-- SQL TO CREATE A REDCAP DEMO PROJECT --
3391set @project_title = 'Longitudinal Database (2 arms)';
3392
3393
3394-- Obtain default values --
3395set @institution = (select value from redcap_config where field_name = 'institution' limit 1);
3396set @site_org_type = (select value from redcap_config where field_name = 'site_org_type' limit 1);
3397set @grant_cite = (select value from redcap_config where field_name = 'grant_cite' limit 1);
3398set @project_contact_name = (select value from redcap_config where field_name = 'project_contact_name' limit 1);
3399set @project_contact_email = (select value from redcap_config where field_name = 'project_contact_email' limit 1);
3400set @headerlogo = (select value from redcap_config where field_name = 'headerlogo' limit 1);
3401set @auth_meth = (select value from redcap_config where field_name = 'auth_meth_global' limit 1);
3402-- Create project --
3403INSERT INTO `redcap_projects`
3404(project_name, app_title, repeatforms, status, count_project, auth_meth, creation_time, production_time, institution, site_org_type, grant_cite, project_contact_name, project_contact_email, headerlogo, display_project_logo_institution, auto_inc_set) VALUES
3405(concat('redcap_demo_',LEFT(sha1(rand()),6)), @project_title, 1, 1, 0, @auth_meth, now(), now(), @institution, @site_org_type, @grant_cite, @project_contact_name, @project_contact_email, @headerlogo, 0, 1);
3406set @project_id = LAST_INSERT_ID();
3407-- User rights --
3408INSERT INTO redcap_user_rights (project_id, username, expiration, group_id, lock_record, data_export_tool, data_import_tool, data_comparison_tool, data_logging, file_repository, double_data, user_rights, data_access_groups, graphical, reports, design, calendar, data_entry, `data_quality_execute`) VALUES
3409(@project_id, 'site_admin', NULL, NULL, 0, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 0, 1, '', 1);
3410-- Create arms --
3411INSERT INTO redcap_events_arms (project_id, arm_num, arm_name) VALUES(@project_id, 1, 'Drug A');
3412set @arm_id1 = LAST_INSERT_ID();
3413INSERT INTO redcap_events_arms (project_id, arm_num, arm_name) VALUES(@project_id, 2, 'Drug B');
3414set @arm_id2 = LAST_INSERT_ID();
3415-- Create events --
3416INSERT INTO redcap_events_metadata (arm_id, day_offset, offset_min, offset_max, descrip) VALUES(@arm_id1, 0, 0, 0, 'Enrollment');
3417set @event_id = LAST_INSERT_ID();
3418INSERT INTO redcap_events_forms (event_id, form_name) VALUES(@event_id, 'baseline_data');
3419INSERT INTO redcap_events_forms (event_id, form_name) VALUES(@event_id, 'demographics');
3420INSERT INTO redcap_events_metadata (arm_id, day_offset, offset_min, offset_max, descrip) VALUES(@arm_id1, 1, 0, 0, 'Dose 1');
3421set @event_id = LAST_INSERT_ID();
3422INSERT INTO redcap_events_forms (event_id, form_name) VALUES(@event_id, 'patient_morale_questionnaire');
3423INSERT INTO redcap_events_metadata (arm_id, day_offset, offset_min, offset_max, descrip) VALUES(@arm_id1, 3, 0, 0, 'Visit 1');
3424set @event_id = LAST_INSERT_ID();
3425INSERT INTO redcap_events_forms (event_id, form_name) VALUES(@event_id, 'patient_morale_questionnaire');
3426INSERT INTO redcap_events_forms (event_id, form_name) VALUES(@event_id, 'visit_blood_workup');
3427INSERT INTO redcap_events_forms (event_id, form_name) VALUES(@event_id, 'visit_lab_data');
3428INSERT INTO redcap_events_forms (event_id, form_name) VALUES(@event_id, 'visit_observed_behavior');
3429INSERT INTO redcap_events_metadata (arm_id, day_offset, offset_min, offset_max, descrip) VALUES(@arm_id1, 8, 0, 0, 'Dose 2');
3430set @event_id = LAST_INSERT_ID();
3431INSERT INTO redcap_events_forms (event_id, form_name) VALUES(@event_id, 'patient_morale_questionnaire');
3432INSERT INTO redcap_events_metadata (arm_id, day_offset, offset_min, offset_max, descrip) VALUES(@arm_id1, 10, 0, 0, 'Visit 2');
3433set @event_id = LAST_INSERT_ID();
3434INSERT INTO redcap_events_forms (event_id, form_name) VALUES(@event_id, 'patient_morale_questionnaire');
3435INSERT INTO redcap_events_forms (event_id, form_name) VALUES(@event_id, 'visit_blood_workup');
3436INSERT INTO redcap_events_forms (event_id, form_name) VALUES(@event_id, 'visit_lab_data');
3437INSERT INTO redcap_events_forms (event_id, form_name) VALUES(@event_id, 'visit_observed_behavior');
3438INSERT INTO redcap_events_metadata (arm_id, day_offset, offset_min, offset_max, descrip) VALUES(@arm_id1, 15, 0, 0, 'Dose 3');
3439set @event_id = LAST_INSERT_ID();
3440INSERT INTO redcap_events_forms (event_id, form_name) VALUES(@event_id, 'patient_morale_questionnaire');
3441INSERT INTO redcap_events_metadata (arm_id, day_offset, offset_min, offset_max, descrip) VALUES(@arm_id1, 17, 0, 0, 'Visit 3');
3442set @event_id = LAST_INSERT_ID();
3443INSERT INTO redcap_events_forms (event_id, form_name) VALUES(@event_id, 'patient_morale_questionnaire');
3444INSERT INTO redcap_events_forms (event_id, form_name) VALUES(@event_id, 'visit_blood_workup');
3445INSERT INTO redcap_events_forms (event_id, form_name) VALUES(@event_id, 'visit_lab_data');
3446INSERT INTO redcap_events_forms (event_id, form_name) VALUES(@event_id, 'visit_observed_behavior');
3447INSERT INTO redcap_events_metadata (arm_id, day_offset, offset_min, offset_max, descrip) VALUES(@arm_id1, 30, 0, 0, 'Final visit');
3448set @event_id = LAST_INSERT_ID();
3449INSERT INTO redcap_events_forms (event_id, form_name) VALUES(@event_id, 'completion_data');
3450INSERT INTO redcap_events_forms (event_id, form_name) VALUES(@event_id, 'completion_project_questionnaire');
3451INSERT INTO redcap_events_forms (event_id, form_name) VALUES(@event_id, 'patient_morale_questionnaire');
3452INSERT INTO redcap_events_forms (event_id, form_name) VALUES(@event_id, 'visit_blood_workup');
3453INSERT INTO redcap_events_forms (event_id, form_name) VALUES(@event_id, 'visit_observed_behavior');
3454INSERT INTO redcap_events_metadata (arm_id, day_offset, offset_min, offset_max, descrip) VALUES(@arm_id2, 0, 0, 0, 'Enrollment');
3455set @event_id = LAST_INSERT_ID();
3456INSERT INTO redcap_events_forms (event_id, form_name) VALUES(@event_id, 'baseline_data');
3457INSERT INTO redcap_events_forms (event_id, form_name) VALUES(@event_id, 'demographics');
3458INSERT INTO redcap_events_metadata (arm_id, day_offset, offset_min, offset_max, descrip) VALUES(@arm_id2, 5, 0, 0, 'Deadline to opt out of study');
3459set @event_id = LAST_INSERT_ID();
3460INSERT INTO redcap_events_metadata (arm_id, day_offset, offset_min, offset_max, descrip) VALUES(@arm_id2, 7, 0, 0, 'First dose');
3461set @event_id = LAST_INSERT_ID();
3462INSERT INTO redcap_events_forms (event_id, form_name) VALUES(@event_id, 'patient_morale_questionnaire');
3463INSERT INTO redcap_events_metadata (arm_id, day_offset, offset_min, offset_max, descrip) VALUES(@arm_id2, 10, 2, 2, 'First visit');
3464set @event_id = LAST_INSERT_ID();
3465INSERT INTO redcap_events_forms (event_id, form_name) VALUES(@event_id, 'patient_morale_questionnaire');
3466INSERT INTO redcap_events_forms (event_id, form_name) VALUES(@event_id, 'visit_blood_workup');
3467INSERT INTO redcap_events_forms (event_id, form_name) VALUES(@event_id, 'visit_lab_data');
3468INSERT INTO redcap_events_forms (event_id, form_name) VALUES(@event_id, 'visit_observed_behavior');
3469INSERT INTO redcap_events_metadata (arm_id, day_offset, offset_min, offset_max, descrip) VALUES(@arm_id2, 13, 0, 0, 'Second dose');
3470set @event_id = LAST_INSERT_ID();
3471INSERT INTO redcap_events_forms (event_id, form_name) VALUES(@event_id, 'patient_morale_questionnaire');
3472INSERT INTO redcap_events_metadata (arm_id, day_offset, offset_min, offset_max, descrip) VALUES(@arm_id2, 15, 2, 2, 'Second visit');
3473set @event_id = LAST_INSERT_ID();
3474INSERT INTO redcap_events_forms (event_id, form_name) VALUES(@event_id, 'patient_morale_questionnaire');
3475INSERT INTO redcap_events_forms (event_id, form_name) VALUES(@event_id, 'visit_blood_workup');
3476INSERT INTO redcap_events_forms (event_id, form_name) VALUES(@event_id, 'visit_lab_data');
3477INSERT INTO redcap_events_forms (event_id, form_name) VALUES(@event_id, 'visit_observed_behavior');
3478INSERT INTO redcap_events_metadata (arm_id, day_offset, offset_min, offset_max, descrip) VALUES(@arm_id2, 20, 2, 2, 'Final visit');
3479set @event_id = LAST_INSERT_ID();
3480INSERT INTO redcap_events_forms (event_id, form_name) VALUES(@event_id, 'completion_data');
3481INSERT INTO redcap_events_forms (event_id, form_name) VALUES(@event_id, 'completion_project_questionnaire');
3482INSERT INTO redcap_events_forms (event_id, form_name) VALUES(@event_id, 'patient_morale_questionnaire');
3483INSERT INTO redcap_events_forms (event_id, form_name) VALUES(@event_id, 'visit_blood_workup');
3484INSERT INTO redcap_events_forms (event_id, form_name) VALUES(@event_id, 'visit_lab_data');
3485INSERT INTO redcap_events_forms (event_id, form_name) VALUES(@event_id, 'visit_observed_behavior');
3486INSERT INTO redcap_events_metadata (arm_id, day_offset, offset_min, offset_max, descrip) VALUES(@arm_id2, 30, 0, 0, 'Deadline to return feedback');
3487set @event_id = LAST_INSERT_ID();
3488-- Insert into redcap_metadata --
3489
3490INSERT INTO redcap_metadata (project_id, field_name, field_phi, form_name, form_menu_description, field_order, field_units, element_preceding_header, element_type, element_label, element_enum, element_note, element_validation_type, element_validation_min, element_validation_max, element_validation_checktype, branching_logic, field_req, edoc_id, edoc_display_img, custom_alignment, stop_actions, question_num) VALUES
3491(@project_id, 'study_id', NULL, 'demographics', 'Demographics', 1, NULL, NULL, 'text', 'Study ID', NULL, NULL, NULL, NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3492(@project_id, 'date_enrolled', NULL, 'demographics', NULL, 2, NULL, 'Consent Information', 'text', 'Date subject signed consent', NULL, 'YYYY-MM-DD', 'date_ymd', NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3493(@project_id, 'patient_document', NULL, 'demographics', NULL, 2.1, NULL, NULL, 'file', 'Upload the patient''s consent form', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
3494(@project_id, 'first_name', '1', 'demographics', NULL, 3, NULL, 'Contact Information', 'text', 'First Name', NULL, NULL, NULL, NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3495(@project_id, 'last_name', '1', 'demographics', NULL, 4, NULL, NULL, 'text', 'Last Name', NULL, NULL, NULL, NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3496(@project_id, 'address', '1', 'demographics', NULL, 5, NULL, NULL, 'textarea', 'Street, City, State, ZIP', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
3497(@project_id, 'telephone_1', '1', 'demographics', NULL, 6, NULL, NULL, 'text', 'Phone number', NULL, 'Include Area Code', 'phone', NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3498(@project_id, 'email', '1', 'demographics', NULL, 8, NULL, NULL, 'text', 'E-mail', NULL, NULL, 'email', NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3499(@project_id, 'dob', '1', 'demographics', NULL, 8.1, NULL, NULL, 'text', 'Date of birth', NULL, NULL, 'date_ymd', NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3500(@project_id, 'age', NULL, 'demographics', NULL, 8.2, NULL, NULL, 'calc', 'Age (years)', 'rounddown(datediff([dob],''today'',''y''))', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
3501(@project_id, 'ethnicity', NULL, 'demographics', NULL, 9, NULL, NULL, 'radio', 'Ethnicity', '0, Hispanic or Latino \\n 1, NOT Hispanic or Latino \\n 2, Unknown / Not Reported', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, 'LH', NULL, NULL),
3502(@project_id, 'race', NULL, 'demographics', NULL, 10, NULL, NULL, 'select', 'Race', '0, American Indian/Alaska Native \\n 1, Asian \\n 2, Native Hawaiian or Other Pacific Islander \\n 3, Black or African American \\n 4, White \\n 5, More Than One Race \\n 6, Unknown / Not Reported', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
3503(@project_id, 'gender', NULL, 'demographics', NULL, 11, NULL, NULL, 'radio', 'Gender', '0, Female \\n 1, Male \\n 2, Other \\n 3, Prefer not to say', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
3504(@project_id, 'given_birth', NULL, 'demographics', NULL, 12, NULL, NULL, 'yesno', 'Has the patient given birth before?', NULL, NULL, NULL, NULL, NULL, NULL, '[gender] = "0"', 0, NULL, 0, NULL, NULL, NULL),
3505(@project_id, 'num_children', NULL, 'demographics', NULL, 13, NULL, NULL, 'text', 'How many times has the patient given birth?', NULL, NULL, 'int', '0', NULL, 'soft_typed', '[gender] = "0" and [given_birth] = "1"', 0, NULL, 0, NULL, NULL, NULL);
3506
3507INSERT INTO redcap_metadata (project_id, field_name, field_phi, form_name, form_menu_description, field_order, field_units, element_preceding_header, element_type, element_label, element_enum, element_note, element_validation_type, element_validation_min, element_validation_max, element_validation_checktype, branching_logic, field_req, edoc_id, edoc_display_img, custom_alignment, stop_actions, question_num, grid_name, misc) VALUES
3508(@project_id, 'gym', NULL, 'demographics', NULL, 14, NULL, 'Please provide the patient''s weekly schedule for the activities below.', 'checkbox', 'Gym (Weight Training)', '0, Monday \\n 1, Tuesday \\n 2, Wednesday \\n 3, Thursday \\n 4, Friday', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL, 'weekly_schedule', NULL),
3509(@project_id, 'aerobics', NULL, 'demographics', NULL, 15, NULL, NULL, 'checkbox', 'Aerobics', '0, Monday \\n 1, Tuesday \\n 2, Wednesday \\n 3, Thursday \\n 4, Friday', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL, 'weekly_schedule', NULL),
3510(@project_id, 'eat', NULL, 'demographics', NULL, 16, NULL, NULL, 'checkbox', 'Eat Out (Dinner/Lunch)', '0, Monday \\n 1, Tuesday \\n 2, Wednesday \\n 3, Thursday \\n 4, Friday', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL, 'weekly_schedule', NULL),
3511(@project_id, 'drink', NULL, 'demographics', NULL, 17, NULL, NULL, 'checkbox', 'Drink (Alcoholic Beverages)', '0, Monday \\n 1, Tuesday \\n 2, Wednesday \\n 3, Thursday \\n 4, Friday', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL, 'weekly_schedule', NULL);
3512
3513INSERT INTO redcap_metadata (project_id, field_name, field_phi, form_name, form_menu_description, field_order, field_units, element_preceding_header, element_type, element_label, element_enum, element_note, element_validation_type, element_validation_min, element_validation_max, element_validation_checktype, branching_logic, field_req, edoc_id, edoc_display_img, custom_alignment, stop_actions, question_num) VALUES
3514(@project_id, 'specify_mood', NULL, 'demographics', NULL, 17.1, NULL, 'Other information', 'slider', 'Specify the patient''s mood', 'Very sad | Indifferent | Very happy', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
3515(@project_id, 'meds', NULL, 'demographics', NULL, 17.3, NULL, NULL, 'checkbox', 'Is patient taking any of the following medications? (check all that apply)', '1, Lexapro \\n 2, Celexa \\n 3, Prozac \\n 4, Paxil \\n 5, Zoloft', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
3516(@project_id, 'height', NULL, 'demographics', NULL, 19, 'cm', NULL, 'text', 'Height (cm)', NULL, NULL, 'float', '130', '215', 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3517(@project_id, 'weight', NULL, 'demographics', NULL, 20, 'kilograms', NULL, 'text', 'Weight (kilograms)', NULL, NULL, 'int', '35', '200', 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3518(@project_id, 'bmi', NULL, 'demographics', NULL, 21, 'kilograms', NULL, 'calc', 'BMI', 'round(([weight]*10000)/(([height])^(2)),1)', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
3519(@project_id, 'comments', NULL, 'demographics', NULL, 22, NULL, 'General Comments', 'textarea', 'Comments', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
3520(@project_id, 'demographics_complete', NULL, 'demographics', NULL, 23, NULL, 'Form Status', 'select', 'Complete?', '0, Incomplete \\n 1, Unverified \\n 2, Complete', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
3521(@project_id, 'height2', NULL, 'baseline_data', 'Baseline Data', 31, NULL, NULL, 'text', 'Height (cm)', NULL, NULL, 'float', NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3522(@project_id, 'weight2', NULL, 'baseline_data', NULL, 32, NULL, NULL, 'text', 'Weight (kilograms)', NULL, NULL, 'int', NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3523(@project_id, 'bmi2', NULL, 'baseline_data', NULL, 33, NULL, NULL, 'calc', 'BMI', 'round(([weight2]*10000)/(([height2])^(2)),1)', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
3524(@project_id, 'prealb_b', NULL, 'baseline_data', NULL, 34, NULL, NULL, 'text', 'Serum Prealbumin (mg/dL)', NULL, NULL, 'float', NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3525(@project_id, 'creat_b', NULL, 'baseline_data', NULL, 35, NULL, NULL, 'text', 'Creatinine (mg/dL)', NULL, NULL, 'float', NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3526(@project_id, 'npcr_b', NULL, 'baseline_data', NULL, 36, NULL, NULL, 'text', 'Normalized Protein Catabolic Rate (g/kg/d)', NULL, NULL, 'float', NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3527(@project_id, 'chol_b', NULL, 'baseline_data', NULL, 37, NULL, NULL, 'text', 'Cholesterol (mg/dL)', NULL, NULL, 'float', NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3528(@project_id, 'transferrin_b', NULL, 'baseline_data', NULL, 38, NULL, NULL, 'text', 'Transferrin (mg/dL)', NULL, NULL, 'float', NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3529(@project_id, 'baseline_data_complete', NULL, 'baseline_data', NULL, 39, NULL, 'Form Status', 'select', 'Complete?', '0, Incomplete \\n 1, Unverified \\n 2, Complete', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
3530(@project_id, 'vld1', NULL, 'visit_lab_data', 'Visit Lab Data', 40, NULL, NULL, 'text', 'Serum Prealbumin (mg/dL)', NULL, NULL, 'float', NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3531(@project_id, 'vld2', NULL, 'visit_lab_data', NULL, 41, NULL, NULL, 'text', 'Creatinine (mg/dL)', NULL, NULL, 'float', NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3532(@project_id, 'vld3', NULL, 'visit_lab_data', NULL, 42, NULL, NULL, 'text', 'Normalized Protein Catabolic Rate (g/kg/d)', NULL, NULL, 'float', NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3533(@project_id, 'vld4', NULL, 'visit_lab_data', NULL, 43, NULL, NULL, 'text', 'Cholesterol (mg/dL)', NULL, NULL, 'float', NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3534(@project_id, 'vld5', NULL, 'visit_lab_data', NULL, 44, NULL, NULL, 'text', 'Transferrin (mg/dL)', NULL, NULL, 'float', NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3535(@project_id, 'visit_lab_data_complete', NULL, 'visit_lab_data', NULL, 45, NULL, 'Form Status', 'select', 'Complete?', '0, Incomplete \\n 1, Unverified \\n 2, Complete', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
3536(@project_id, 'pmq1', NULL, 'patient_morale_questionnaire', 'Patient Morale Questionnaire', 46, NULL, NULL, 'select', 'On average, how many pills did you take each day last week?', '0, less than 5 \\n 1, 5-10 \\n 2, 6-15 \\n 3, over 15', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
3537(@project_id, 'pmq2', NULL, 'patient_morale_questionnaire', NULL, 47, NULL, NULL, 'select', 'Using the handout, which level of dependence do you feel you are currently at?', '0, 0 \\n 1, 1 \\n 2, 2 \\n 3, 3 \\n 4, 4 \\n 5, 5', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
3538(@project_id, 'pmq3', NULL, 'patient_morale_questionnaire', NULL, 48, NULL, NULL, 'radio', 'Would you be willing to discuss your experiences with a psychiatrist?', '0, No \\n 1, Yes', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
3539(@project_id, 'pmq4', NULL, 'patient_morale_questionnaire', NULL, 49, NULL, NULL, 'select', 'How open are you to further testing?', '0, not open \\n 1, undecided \\n 2, very open', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
3540(@project_id, 'patient_morale_questionnaire_complete', NULL, 'patient_morale_questionnaire', NULL, 50, NULL, 'Form Status', 'select', 'Complete?', '0, Incomplete \\n 1, Unverified \\n 2, Complete', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
3541(@project_id, 'vbw1', NULL, 'visit_blood_workup', 'Visit Blood Workup', 51, NULL, NULL, 'text', 'Serum Prealbumin (mg/dL)', NULL, NULL, 'float', NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3542(@project_id, 'vbw2', NULL, 'visit_blood_workup', NULL, 52, NULL, NULL, 'text', 'Creatinine (mg/dL)', NULL, NULL, 'float', NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3543(@project_id, 'vbw3', NULL, 'visit_blood_workup', NULL, 53, NULL, NULL, 'text', 'Normalized Protein Catabolic Rate (g/kg/d)', NULL, NULL, 'float', NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3544(@project_id, 'vbw4', NULL, 'visit_blood_workup', NULL, 54, NULL, NULL, 'text', 'Cholesterol (mg/dL)', NULL, NULL, 'float', NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3545(@project_id, 'vbw5', NULL, 'visit_blood_workup', NULL, 55, NULL, NULL, 'text', 'Transferrin (mg/dL)', NULL, NULL, 'float', NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3546(@project_id, 'vbw6', NULL, 'visit_blood_workup', NULL, 56, NULL, NULL, 'radio', 'Blood draw shift?', '0, AM \\n 1, PM', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
3547(@project_id, 'vbw7', NULL, 'visit_blood_workup', NULL, 57, NULL, NULL, 'radio', 'Blood draw by', '0, RN \\n 1, LPN \\n 2, nurse assistant \\n 3, doctor', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
3548(@project_id, 'vbw8', NULL, 'visit_blood_workup', NULL, 58, NULL, NULL, 'select', 'Level of patient anxiety', '0, not anxious \\n 1, undecided \\n 2, very anxious', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
3549(@project_id, 'vbw9', NULL, 'visit_blood_workup', NULL, 59, NULL, NULL, 'select', 'Patient scheduled for future draws?', '0, No \\n 1, Yes', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
3550(@project_id, 'visit_blood_workup_complete', NULL, 'visit_blood_workup', NULL, 60, NULL, 'Form Status', 'select', 'Complete?', '0, Incomplete \\n 1, Unverified \\n 2, Complete', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
3551(@project_id, 'vob1', NULL, 'visit_observed_behavior', 'Visit Observed Behavior', 61, NULL, 'Was the patient...', 'radio', 'nervous?', '0, No \\n 1, Yes', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
3552(@project_id, 'vob2', NULL, 'visit_observed_behavior', NULL, 62, NULL, NULL, 'radio', 'worried?', '0, No \\n 1, Yes', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
3553(@project_id, 'vob3', NULL, 'visit_observed_behavior', NULL, 63, NULL, NULL, 'radio', 'scared?', '0, No \\n 1, Yes', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
3554(@project_id, 'vob4', NULL, 'visit_observed_behavior', NULL, 64, NULL, NULL, 'radio', 'fidgety?', '0, No \\n 1, Yes', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
3555(@project_id, 'vob5', NULL, 'visit_observed_behavior', NULL, 65, NULL, NULL, 'radio', 'crying?', '0, No \\n 1, Yes', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
3556(@project_id, 'vob6', NULL, 'visit_observed_behavior', NULL, 66, NULL, NULL, 'radio', 'screaming?', '0, No \\n 1, Yes', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
3557(@project_id, 'vob7', NULL, 'visit_observed_behavior', NULL, 67, NULL, NULL, 'textarea', 'other', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
3558(@project_id, 'vob8', NULL, 'visit_observed_behavior', NULL, 68, NULL, 'Were you...', 'radio', 'nervous?', '0, No \\n 1, Yes', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
3559(@project_id, 'vob9', NULL, 'visit_observed_behavior', NULL, 69, NULL, NULL, 'radio', 'worried?', '0, No \\n 1, Yes', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
3560(@project_id, 'vob10', NULL, 'visit_observed_behavior', NULL, 70, NULL, NULL, 'radio', 'scared?', '0, No \\n 1, Yes', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
3561(@project_id, 'vob11', NULL, 'visit_observed_behavior', NULL, 71, NULL, NULL, 'radio', 'fidgety?', '0, No \\n 1, Yes', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
3562(@project_id, 'vob12', NULL, 'visit_observed_behavior', NULL, 72, NULL, NULL, 'radio', 'crying?', '0, No \\n 1, Yes', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
3563(@project_id, 'vob13', NULL, 'visit_observed_behavior', NULL, 73, NULL, NULL, 'radio', 'screaming?', '0, No \\n 1, Yes', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
3564(@project_id, 'vob14', NULL, 'visit_observed_behavior', NULL, 74, NULL, NULL, 'textarea', 'other', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
3565(@project_id, 'visit_observed_behavior_complete', NULL, 'visit_observed_behavior', NULL, 75, NULL, 'Form Status', 'select', 'Complete?', '0, Incomplete \\n 1, Unverified \\n 2, Complete', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
3566(@project_id, 'study_comments', NULL, 'completion_data', 'Completion Data', 76, NULL, NULL, 'textarea', 'Comments', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
3567(@project_id, 'complete_study', NULL, 'completion_data', NULL, 77, NULL, NULL, 'select', 'Has patient completed study?', '0, No \\n 1, Yes', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
3568(@project_id, 'withdraw_date', NULL, 'completion_data', NULL, 78, NULL, NULL, 'text', 'Put a date if patient withdrew study', NULL, NULL, 'date_ymd', NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3569(@project_id, 'date_visit_4', NULL, 'completion_data', NULL, 79, NULL, NULL, 'text', 'Date of last visit', NULL, NULL, 'date_ymd', NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3570(@project_id, 'alb_4', NULL, 'completion_data', NULL, 80, NULL, NULL, 'text', 'Serum Albumin (g/dL)', NULL, NULL, 'float', NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3571(@project_id, 'prealb_4', NULL, 'completion_data', NULL, 81, NULL, NULL, 'text', 'Serum Prealbumin (mg/dL)', NULL, NULL, 'float', NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3572(@project_id, 'creat_4', NULL, 'completion_data', NULL, 82, NULL, NULL, 'text', 'Creatinine (mg/dL)', NULL, NULL, 'date_ymd', NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3573(@project_id, 'discharge_date_4', NULL, 'completion_data', NULL, 83, NULL, NULL, 'text', 'Date of hospital discharge', NULL, NULL, 'date_ymd', NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3574(@project_id, 'discharge_summary_4', NULL, 'completion_data', NULL, 84, NULL, NULL, 'select', 'Discharge summary in patients binder?', '0, No \\n 1, Yes', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
3575(@project_id, 'npcr_4', NULL, 'completion_data', NULL, 85, NULL, NULL, 'text', 'Normalized Protein Catabolic Rate (g/kg/d)', NULL, NULL, 'int', NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3576(@project_id, 'chol_4', NULL, 'completion_data', NULL, 86, NULL, NULL, 'text', 'Cholesterol (mg/dL)', NULL, NULL, 'int', NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3577(@project_id, 'withdraw_reason', NULL, 'completion_data', NULL, 87, NULL, NULL, 'select', 'Reason patient withdrew from study', '0, Non-compliance \\n 1, Did not wish to continue in study \\n 2, Could not tolerate the supplement \\n 3, Hospitalization \\n 4, Other', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
3578(@project_id, 'completion_data_complete', NULL, 'completion_data', NULL, 88, NULL, 'Form Status', 'select', 'Complete?', '0, Incomplete \\n 1, Unverified \\n 2, Complete', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
3579(@project_id, 'cpq1', NULL, 'completion_project_questionnaire', 'Completion Project Questionnaire', 89, NULL, NULL, 'text', 'Date of study completion', NULL, NULL, 'date_ymd', NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3580(@project_id, 'cpq2', NULL, 'completion_project_questionnaire', NULL, 90, NULL, NULL, 'text', 'Transferrin (mg/dL)', NULL, NULL, 'int', NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3581(@project_id, 'cpq3', NULL, 'completion_project_questionnaire', NULL, 91, NULL, NULL, 'text', 'Kt/V', NULL, NULL, 'int', NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3582(@project_id, 'cpq4', NULL, 'completion_project_questionnaire', NULL, 92, NULL, NULL, 'text', 'Dry weight (kilograms)', NULL, NULL, 'int', NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3583(@project_id, 'cpq5', NULL, 'completion_project_questionnaire', NULL, 93, NULL, NULL, 'text', 'Number of treatments missed', NULL, NULL, 'int', NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3584(@project_id, 'cpq6', NULL, 'completion_project_questionnaire', NULL, 94, NULL, NULL, 'select', 'How compliant was the patient in drinking the supplement?', '0, 100 percent \\n 1, 99-75 percent \\n 2, 74-50 percent \\n 3, 49-25 percent \\n 4, 0-24 percent', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
3585(@project_id, 'cpq7', NULL, 'completion_project_questionnaire', NULL, 95, NULL, NULL, 'select', 'Was patient hospitalized since last visit?', '0, No \\n 1, Yes', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
3586(@project_id, 'cpq8', NULL, 'completion_project_questionnaire', NULL, 96, NULL, NULL, 'select', 'What was the cause of hospitalization?', '1, Vascular access related events \\n 2, CVD events \\n 3, Other', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
3587(@project_id, 'cpq9', NULL, 'completion_project_questionnaire', NULL, 97, NULL, NULL, 'text', 'Date of hospital admission', NULL, NULL, 'date_ymd', NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3588(@project_id, 'cpq10', NULL, 'completion_project_questionnaire', NULL, 98, NULL, NULL, 'select', 'On average, how many pills did you take each day last week?', '0, less than 5 \\n 1, 5-10 \\n 2, 6-15 \\n 3, over 15', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
3589(@project_id, 'cpq11', NULL, 'completion_project_questionnaire', NULL, 99, NULL, NULL, 'select', 'Using the handout, which level of dependence do you feel you are currently at?', '0, 0 \\n 1, 1 \\n 2, 2 \\n 3, 3 \\n 4, 4 \\n 5, 5', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
3590(@project_id, 'cpq12', NULL, 'completion_project_questionnaire', NULL, 100, NULL, NULL, 'radio', 'Would you be willing to discuss your experiences with a psychiatrist?', '0, No \\n 1, Yes', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
3591(@project_id, 'cpq13', NULL, 'completion_project_questionnaire', NULL, 101, NULL, NULL, 'select', 'How open are you to further testing?', '0, not open \\n 1, undecided \\n 2, very open', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
3592(@project_id, 'completion_project_questionnaire_complete', NULL, 'completion_project_questionnaire', NULL, 102, NULL, 'Form Status', 'select', 'Complete?', '0, Incomplete \\n 1, Unverified \\n 2, Complete', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL);
3593
3594INSERT INTO `redcap_projects_templates` (`project_id`, `title`, `description`, `enabled`)
3595 VALUES (@project_id, @project_title, 'Contains nine data entry forms (beginning with a demography form) for collecting data on two different arms (Drug A and Drug B) with each arm containing eight different events.', '1');
3596-- SQL TO CREATE A REDCAP DEMO PROJECT --
3597set @project_title = 'Single Survey';
3598-- Obtain default values --
3599set @institution = (select value from redcap_config where field_name = 'institution' limit 1);
3600set @site_org_type = (select value from redcap_config where field_name = 'site_org_type' limit 1);
3601set @grant_cite = (select value from redcap_config where field_name = 'grant_cite' limit 1);
3602set @project_contact_name = (select value from redcap_config where field_name = 'project_contact_name' limit 1);
3603set @project_contact_email = (select value from redcap_config where field_name = 'project_contact_email' limit 1);
3604set @headerlogo = (select value from redcap_config where field_name = 'headerlogo' limit 1);
3605set @auth_meth = (select value from redcap_config where field_name = 'auth_meth_global' limit 1);
3606-- Create project --
3607INSERT INTO `redcap_projects`
3608(project_name, app_title, status, count_project, auth_meth, creation_time, production_time, institution, site_org_type, grant_cite, project_contact_name, project_contact_email, headerlogo, surveys_enabled, auto_inc_set, display_project_logo_institution) VALUES
3609(concat('redcap_demo_',LEFT(sha1(rand()),6)), @project_title, 1, 0, @auth_meth, now(), now(), @institution, @site_org_type, @grant_cite, @project_contact_name, @project_contact_email, @headerlogo, 1, 1, 0);
3610set @project_id = LAST_INSERT_ID();
3611-- User rights --
3612INSERT INTO `redcap_user_rights` (`project_id`, `username`, `expiration`, `group_id`, `lock_record`, `data_export_tool`, `data_import_tool`,
3613`data_comparison_tool`, `data_logging`, `file_repository`, `double_data`, `user_rights`, `data_access_groups`, `graphical`, `reports`, `design`,
3614`calendar`, `data_entry`, `participants`, `data_quality_execute`) VALUES
3615(@project_id, 'site_admin', NULL, NULL, 0, 1, 0, 1, 1, 1, 0, 0, 0, 1, 1, 0, 1, '', 0, 1);
3616-- Create single arm --
3617INSERT INTO redcap_events_arms (project_id, arm_num, arm_name) VALUES (@project_id, 1, 'Arm 1');
3618set @arm_id = LAST_INSERT_ID();
3619-- Create single event --
3620INSERT INTO redcap_events_metadata (arm_id, day_offset, offset_min, offset_max, descrip) VALUES (@arm_id, 0, 0, 0, 'Event 1');
3621set @event_id = LAST_INSERT_ID();
3622-- Insert into redcap_surveys
3623INSERT INTO redcap_surveys (project_id, font_family, form_name, title, instructions, acknowledgement, question_by_section, question_auto_numbering, survey_enabled, save_and_return, logo, hide_title) VALUES
3624(@project_id, '16', 'survey', 'Example Survey', '<p style="margin-top: 10px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; font-family: Arial, Verdana, Helvetica, sans-serif; font-size: 12px; text-align: left; line-height: 1.5em; max-width: 700px; clear: both; padding: 0px;">These are your survey instructions that you would enter for your survey participants. You may put whatever text you like here, which may include information about the purpose of the survey, who is taking the survey, or how to take the survey.</p><br><p style="margin-top: 10px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; font-family: Arial, Verdana, Helvetica, sans-serif; font-size: 12px; text-align: left; line-height: 1.5em; max-width: 700px; clear: both; padding: 0px;">Surveys can use a single survey link for all respondents, which can be posted on a webpage or emailed out from your email application of choice. <strong>By default, all survey responses are collected anonymously</strong> (that is, unless your survey asks for name, email, or other identifying information). If you wish to track individuals who have taken your survey, you may upload a list of email addresses into a Participant List within REDCap, in which you can have REDCap send them an email invitation, which will track if they have taken the survey and when it was taken. This method still collects responses anonymously, but if you wish to identify an individual respondent\'s answers, you may do so by also providing an Identifier in your Participant List. Of course, in that case you may want to inform your respondents in your survey\'s instructions that their responses are not being collected anonymously and can thus be traced back to them.</p>', '<p><strong>Thank you for taking the survey.</strong></p><br><p>Have a nice day!</p>', 0, 0, 1, 1, NULL, 0);
3625-- Insert into redcap_metadata --
3626INSERT INTO redcap_metadata (project_id, field_name, field_phi, form_name, form_menu_description, field_order, field_units, element_preceding_header, element_type, element_label, element_enum, element_note, element_validation_type, element_validation_min, element_validation_max, element_validation_checktype, branching_logic, field_req, edoc_id, edoc_display_img, custom_alignment, stop_actions, question_num) VALUES
3627(@project_id, 'participant_id', NULL, 'survey', 'Example Survey', 1, NULL, NULL, 'text', 'Participant ID', NULL, NULL, NULL, NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3628(@project_id, 'radio', NULL, 'survey', NULL, 2, NULL, 'Section 1 (This is a section header with descriptive text. It only provides informational text and is used to divide the survey into sections for organization. If the survey is set to be displayed as "one section per page", then these section headers will begin each new page of the survey.)', 'radio', 'You may create MULTIPLE CHOICE questions and set the answer choices for them. You can have as many answer choices as you need. This multiple choice question is rendered as RADIO buttons.', '1, Choice One \\n 2, Choice Two \\n 3, Choice Three \\n 4, Etc.', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
3629(@project_id, 'dropdown', NULL, 'survey', NULL, 3, NULL, NULL, 'select', 'You may also set multiple choice questions as DROP-DOWN MENUs.', '1, Choice One \\n 2, Choice Two \\n 3, Choice Three \\n 4, Etc.', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
3630(@project_id, 'textbox', NULL, 'survey', NULL, 4, NULL, NULL, 'text', 'This is a TEXT BOX, which allows respondents to enter a small amount of text. A Text Box can be validated, if needed, as a number, integer, phone number, email, or zipcode. If validated as a number or integer, you may also set the minimum and/or maximum allowable values.\n\nThis question has "number" validation set with a minimum of 1 and a maximum of 10. ', NULL, NULL, 'float', '1', '10', 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3631(@project_id, 'ma', NULL, 'survey', NULL, 5, NULL, NULL, 'checkbox', 'This type of multiple choice question, known as CHECKBOXES, allows for more than one answer choice to be selected, whereas radio buttons and drop-downs only allow for one choice.', '1, Choice One \\n 2, Choice Two \\n 3, Choice Three \\n 4, Select as many as you like', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
3632(@project_id, 'yn', NULL, 'survey', NULL, 6, NULL, NULL, 'yesno', 'You can create YES-NO questions.<br><br>This question has vertical alignment of choices on the right.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
3633(@project_id, 'tf', NULL, 'survey', NULL, 7, NULL, NULL, 'truefalse', 'And you can also create TRUE-FALSE questions.<br><br>This question has horizontal alignment.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, 'RH', NULL, NULL),
3634(@project_id, 'date_ymd', NULL, 'survey', NULL, 8, NULL, NULL, 'text', 'DATE questions are also an option. If you click the calendar icon on the right, a pop-up calendar will appear, thus allowing the respondent to easily select a date. Or it can be simply typed in.', NULL, NULL, 'date_ymd', NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3635(@project_id, 'file', NULL, 'survey', NULL, 9, NULL, NULL, 'file', 'The FILE UPLOAD question type allows respondents to upload any type of document to the survey that you may afterward download and open when viewing your survey results.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
3636(@project_id, 'slider', NULL, 'survey', NULL, 10, NULL, NULL, 'slider', 'A SLIDER is a question type that allows the respondent to choose an answer along a continuum. The respondent''s answer is saved as an integer between 0 (far left) and 100 (far right) with a step of 1.', 'You can provide labels above the slider | Middle label | Right-hand label', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
3637(@project_id, 'descriptive', NULL, 'survey', NULL, 11, NULL, NULL, 'descriptive', 'You may also use DESCRIPTIVE TEXT to provide informational text within a survey section. ', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL);
3638
3639INSERT INTO redcap_metadata (project_id, field_name, field_phi, form_name, form_menu_description, field_order, field_units, element_preceding_header, element_type, element_label, element_enum, element_note, element_validation_type, element_validation_min, element_validation_max, element_validation_checktype, branching_logic, field_req, edoc_id, edoc_display_img, custom_alignment, stop_actions, question_num, grid_name, misc) VALUES
3640(@project_id, 'gym', NULL, 'survey', NULL, 11.1, NULL, 'Below is a matrix of checkbox fields. A matrix can also be displayed as radio button fields.', 'checkbox', 'Gym (Weight Training)', '0, Monday \\n 1, Tuesday \\n 2, Wednesday \\n 3, Thursday \\n 4, Friday', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL, 'weekly_schedule', NULL),
3641(@project_id, 'aerobics', NULL, 'survey', NULL, 11.2, NULL, NULL, 'checkbox', 'Aerobics', '0, Monday \\n 1, Tuesday \\n 2, Wednesday \\n 3, Thursday \\n 4, Friday', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL, 'weekly_schedule', NULL),
3642(@project_id, 'eat', NULL, 'survey', NULL, 11.3, NULL, NULL, 'checkbox', 'Eat Out (Dinner/Lunch)', '0, Monday \\n 1, Tuesday \\n 2, Wednesday \\n 3, Thursday \\n 4, Friday', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL, 'weekly_schedule', NULL),
3643(@project_id, 'drink', NULL, 'survey', NULL, 11.4, NULL, NULL, 'checkbox', 'Drink (Alcoholic Beverages)', '0, Monday \\n 1, Tuesday \\n 2, Wednesday \\n 3, Thursday \\n 4, Friday', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL, 'weekly_schedule', NULL);
3644
3645INSERT INTO redcap_metadata (project_id, field_name, field_phi, form_name, form_menu_description, field_order, field_units, element_preceding_header, element_type, element_label, element_enum, element_note, element_validation_type, element_validation_min, element_validation_max, element_validation_checktype, branching_logic, field_req, edoc_id, edoc_display_img, custom_alignment, stop_actions, question_num) VALUES
3646(@project_id, 'radio_branch', NULL, 'survey', NULL, 12, NULL, 'ADVANCED FEATURES: The questions below will illustrate how some advanced survey features are used.', 'radio', 'BRANCHING LOGIC: The question immediately following this one is using branching logic, which means that the question will stay hidden until defined criteria are specified.\n\nFor example, the following question has been set NOT to appear until the respondent selects the second option to the right. ', '1, This option does nothing. \\n 2, Clicking this option will trigger the branching logic to reveal the next question. \\n 3, This option also does nothing.', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
3647(@project_id, 'hidden_branch', NULL, 'survey', NULL, 13, NULL, NULL, 'text', 'HIDDEN QUESTION: This question will only appear when you select the second option of the question immediately above.', NULL, NULL, NULL, 'undefined', 'undefined', 'soft_typed', '[radio_branch] = "2"', 0, NULL, 0, NULL, NULL, NULL),
3648(@project_id, 'stop_actions', NULL, 'survey', NULL, 14, NULL, NULL, 'checkbox', 'STOP ACTIONS may be used with any multiple choice question. Stop actions can be applied to any (or all) answer choices. When that answer choice is selected by a respondent, their survey responses are then saved, and the survey is immediately ended.\n\nThe third option to the right has a stop action.', '1, This option does nothing. \\n 2, This option also does nothing. \\n 3, Click here to trigger the stop action and end the survey.', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, '3', NULL),
3649(@project_id, 'comment_box', NULL, 'survey', NULL, 15, NULL, NULL, 'textarea', 'If you need the respondent to enter a large amount of text, you may use a NOTES BOX.<br><br>This question has also been set as a REQUIRED QUESTION, so the respondent cannot fully submit the survey until this question has been answered. ANY question type can be set to be required.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, 'LH', NULL, NULL),
3650(@project_id, 'survey_complete', NULL, 'survey', NULL, 16, NULL, 'Form Status', 'select', 'Complete?', '0, Incomplete \\n 1, Unverified \\n 2, Complete', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL);
3651
3652INSERT INTO `redcap_projects_templates` (`project_id`, `title`, `description`, `enabled`)
3653 VALUES (@project_id, @project_title, 'Contains a single data collection instrument enabled as a survey, which contains questions to demonstrate all the different field types.', '1');
3654-- SQL TO CREATE A REDCAP DEMO PROJECT --
3655set @project_title = 'Basic Demography';
3656
3657
3658-- Obtain default values --
3659set @institution = (select value from redcap_config where field_name = 'institution' limit 1);
3660set @site_org_type = (select value from redcap_config where field_name = 'site_org_type' limit 1);
3661set @grant_cite = (select value from redcap_config where field_name = 'grant_cite' limit 1);
3662set @project_contact_name = (select value from redcap_config where field_name = 'project_contact_name' limit 1);
3663set @project_contact_email = (select value from redcap_config where field_name = 'project_contact_email' limit 1);
3664set @headerlogo = (select value from redcap_config where field_name = 'headerlogo' limit 1);
3665set @auth_meth = (select value from redcap_config where field_name = 'auth_meth_global' limit 1);
3666-- Create project --
3667INSERT INTO `redcap_projects`
3668(project_name, app_title, status, count_project, auth_meth, creation_time, production_time, institution, site_org_type, grant_cite, project_contact_name, project_contact_email, headerlogo, display_project_logo_institution, auto_inc_set) VALUES
3669(concat('redcap_demo_',LEFT(sha1(rand()),6)), @project_title, 1, 0, @auth_meth, now(), now(), @institution, @site_org_type, @grant_cite, @project_contact_name, @project_contact_email, @headerlogo, 0, 1);
3670set @project_id = LAST_INSERT_ID();
3671-- User rights --
3672INSERT INTO `redcap_user_rights` (`project_id`, `username`, `expiration`, `group_id`, `lock_record`, `data_export_tool`, `data_import_tool`, `data_comparison_tool`, `data_logging`, `file_repository`, `double_data`, `user_rights`, `data_access_groups`, `graphical`, `reports`, `design`, `calendar`, `data_entry`, `data_quality_execute`) VALUES
3673(@project_id, 'site_admin', NULL, NULL, 0, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 0, 1, '', 1);
3674-- Create single arm --
3675INSERT INTO redcap_events_arms (project_id, arm_num, arm_name) VALUES (@project_id, 1, 'Arm 1');
3676set @arm_id = LAST_INSERT_ID();
3677-- Create single event --
3678INSERT INTO redcap_events_metadata (arm_id, day_offset, offset_min, offset_max, descrip) VALUES (@arm_id, 0, 0, 0, 'Event 1');
3679set @event_id = LAST_INSERT_ID();
3680-- Insert into redcap_metadata --
3681INSERT INTO redcap_metadata (project_id, field_name, field_phi, form_name, form_menu_description, field_order, field_units, element_preceding_header, element_type, element_label, element_enum, element_note, element_validation_type, element_validation_min, element_validation_max, element_validation_checktype, branching_logic, field_req, edoc_id, edoc_display_img, custom_alignment, stop_actions, question_num) VALUES
3682(@project_id, 'record_id', NULL, 'demographics', 'Basic Demography Form', 1, NULL, NULL, 'text', 'Study ID', NULL, NULL, NULL, NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3683(@project_id, 'first_name', '1', 'demographics', NULL, 3, NULL, 'Contact Information', 'text', 'First Name', NULL, NULL, NULL, NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3684(@project_id, 'last_name', '1', 'demographics', NULL, 4, NULL, NULL, 'text', 'Last Name', NULL, NULL, NULL, NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3685(@project_id, 'address', '1', 'demographics', NULL, 5, NULL, NULL, 'textarea', 'Street, City, State, ZIP', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
3686(@project_id, 'telephone', '1', 'demographics', NULL, 6, NULL, NULL, 'text', 'Phone number', NULL, 'Include Area Code', 'phone', NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3687(@project_id, 'email', '1', 'demographics', NULL, 8, NULL, NULL, 'text', 'E-mail', NULL, NULL, 'email', NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3688(@project_id, 'dob', '1', 'demographics', NULL, 8.1, NULL, NULL, 'text', 'Date of birth', NULL, NULL, 'date_ymd', NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3689(@project_id, 'age', NULL, 'demographics', NULL, 8.2, NULL, NULL, 'calc', 'Age (years)', 'rounddown(datediff([dob],''today'',''y''))', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
3690(@project_id, 'ethnicity', NULL, 'demographics', NULL, 9, NULL, NULL, 'radio', 'Ethnicity', '0, Hispanic or Latino \\n 1, NOT Hispanic or Latino \\n 2, Unknown / Not Reported', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, 'LH', NULL, NULL),
3691(@project_id, 'race', NULL, 'demographics', NULL, 10, NULL, NULL, 'select', 'Race', '0, American Indian/Alaska Native \\n 1, Asian \\n 2, Native Hawaiian or Other Pacific Islander \\n 3, Black or African American \\n 4, White \\n 5, More Than One Race \\n 6, Unknown / Not Reported', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
3692(@project_id, 'gender', NULL, 'demographics', NULL, 11, NULL, NULL, 'radio', 'Gender', '0, Female \\n 1, Male \\n 2, Other \\n 3, Prefer not to say', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
3693(@project_id, 'height', NULL, 'demographics', NULL, 19, 'cm', NULL, 'text', 'Height (cm)', NULL, NULL, 'float', '130', '215', 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3694(@project_id, 'weight', NULL, 'demographics', NULL, 20, 'kilograms', NULL, 'text', 'Weight (kilograms)', NULL, NULL, 'int', '35', '200', 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3695(@project_id, 'bmi', NULL, 'demographics', NULL, 21, 'kilograms', NULL, 'calc', 'BMI', 'round(([weight]*10000)/(([height])^(2)),1)', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
3696(@project_id, 'comments', NULL, 'demographics', NULL, 22, NULL, 'General Comments', 'textarea', 'Comments', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
3697(@project_id, 'demographics_complete', NULL, 'demographics', NULL, 23, NULL, 'Form Status', 'select', 'Complete?', '0, Incomplete \\n 1, Unverified \\n 2, Complete', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL);
3698
3699INSERT INTO `redcap_projects_templates` (`project_id`, `title`, `description`, `enabled`)
3700 VALUES (@project_id, @project_title, 'Contains a single data collection instrument to capture basic demographic information.', '1');
3701-- SQL TO CREATE A REDCAP DEMO PROJECT --
3702set @project_title = 'Project Tracking Database';
3703
3704
3705-- Obtain default values --
3706set @institution = (select value from redcap_config where field_name = 'institution' limit 1);
3707set @site_org_type = (select value from redcap_config where field_name = 'site_org_type' limit 1);
3708set @grant_cite = (select value from redcap_config where field_name = 'grant_cite' limit 1);
3709set @project_contact_name = (select value from redcap_config where field_name = 'project_contact_name' limit 1);
3710set @project_contact_email = (select value from redcap_config where field_name = 'project_contact_email' limit 1);
3711set @headerlogo = (select value from redcap_config where field_name = 'headerlogo' limit 1);
3712set @auth_meth = (select value from redcap_config where field_name = 'auth_meth_global' limit 1);
3713-- Create project --
3714INSERT INTO `redcap_projects`
3715(project_name, app_title, status, count_project, auth_meth, creation_time, production_time, institution, site_org_type, grant_cite, project_contact_name, project_contact_email, headerlogo, display_project_logo_institution, auto_inc_set) VALUES
3716(concat('redcap_demo_',LEFT(sha1(rand()),6)), @project_title, 1, 0, @auth_meth, now(), now(), @institution, @site_org_type, @grant_cite, @project_contact_name, @project_contact_email, @headerlogo, 0, 1);
3717set @project_id = LAST_INSERT_ID();
3718-- User rights --
3719INSERT INTO `redcap_user_rights` (`project_id`, `username`, `expiration`, `group_id`, `lock_record`, `data_export_tool`, `data_import_tool`, `data_comparison_tool`, `data_logging`, `file_repository`, `double_data`, `user_rights`, `data_access_groups`, `graphical`, `reports`, `design`, `calendar`, `data_entry`, `data_quality_execute`) VALUES
3720(@project_id, 'site_admin', NULL, NULL, 0, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 0, 1, '', 1);
3721-- Create single arm --
3722INSERT INTO redcap_events_arms (project_id, arm_num, arm_name) VALUES (@project_id, 1, 'Arm 1');
3723set @arm_id = LAST_INSERT_ID();
3724-- Create single event --
3725INSERT INTO redcap_events_metadata (arm_id, day_offset, offset_min, offset_max, descrip) VALUES (@arm_id, 0, 0, 0, 'Event 1');
3726set @event_id = LAST_INSERT_ID();
3727-- Insert into redcap_metadata --
3728INSERT INTO redcap_metadata (project_id, field_name, field_phi, form_name, form_menu_description, field_order, field_units, element_preceding_header, element_type, element_label, element_enum, element_note, element_validation_type, element_validation_min, element_validation_max, element_validation_checktype, branching_logic, field_req, edoc_id, edoc_display_img, custom_alignment, stop_actions, question_num, grid_name, misc) VALUES
3729(@project_id, 'proj_id', NULL, 'project', 'Project', 1, NULL, NULL, 'text', 'Project ID', NULL, NULL, NULL, NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
3730(@project_id, 'title', NULL, 'project', NULL, 2, NULL, 'Demographic Characteristics', 'textarea', 'Project Title', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
3731(@project_id, 'pi_firstname', NULL, 'project', NULL, 3, NULL, NULL, 'text', 'PI First Name', NULL, NULL, NULL, NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
3732(@project_id, 'pi_lastname', NULL, 'project', NULL, 4, NULL, NULL, 'text', 'PI Last Name', NULL, NULL, NULL, NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
3733(@project_id, 'pi_vunetid', NULL, 'project', NULL, 5, NULL, NULL, 'text', 'PI VUnetID', NULL, NULL, NULL, NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
3734(@project_id, 'project_type', NULL, 'project', NULL, 6, NULL, NULL, 'select', 'Project Type', '1, Expedited \\n 2, Full Committee \\n 3, Industry only', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
3735(@project_id, 'irb_number', NULL, 'project', NULL, 7, NULL, NULL, 'text', 'IRB Number', NULL, NULL, NULL, NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
3736(@project_id, 'amendment_status', NULL, 'project', NULL, 8, NULL, 'Amendment Information', 'radio', 'Amendment?', '0, No \\n 1, Yes', '', NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
3737(@project_id, 'amendment_number', NULL, 'project', NULL, 9, NULL, NULL, 'select', 'Amendment Number', '0 \\n 1 \\n 2 \\n 3 \\n 4 \\n 5 \\n 6 \\n 7 \\n 8 \\n 9 \\n 10 \\n 11 \\n 12 \\n 13 \\n 14 \\n 15 \\n 16 \\n 17 \\n 18 \\n 19 \\n 20', '', NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
3738(@project_id, 'crc_type', NULL, 'project', NULL, 10, NULL, 'CRC Legacy System Data', 'select', 'CRC Type', 'A \\n B \\n C \\n D', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
3739(@project_id, 'crc_webcamp_import', NULL, 'project', NULL, 11, NULL, NULL, 'select', 'CRC WebCamp Project Import?', '0, No \\n 1, Yes', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
3740(@project_id, 'crc_original_review', NULL, 'project', NULL, 12, NULL, NULL, 'select', 'CRC Original Review?', '0, No \\n 1, Yes', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
3741(@project_id, 'file_proposal', NULL, 'project', NULL, 13, NULL, 'Project Files', 'file', 'Research Proposal', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
3742(@project_id, 'file_budget', NULL, 'project', NULL, 14, NULL, NULL, 'file', 'Budget', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
3743(@project_id, 'file_biosketch1', NULL, 'project', NULL, 15, NULL, NULL, 'file', 'Biosketch(1)', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
3744(@project_id, 'file_biosketch2', NULL, 'project', NULL, 16, NULL, NULL, 'file', 'Biosketch(2)', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
3745(@project_id, 'file_biosketch3', NULL, 'project', NULL, 17, NULL, NULL, 'file', 'Biosketch(3)', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
3746(@project_id, 'file_crc', NULL, 'project', NULL, 18, NULL, NULL, 'file', 'CRC Resources', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
3747(@project_id, 'file_other1', NULL, 'project', NULL, 19, NULL, NULL, 'file', 'Other(1)', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
3748(@project_id, 'file_other2', NULL, 'project', NULL, 20, NULL, NULL, 'file', 'Other(2)', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
3749(@project_id, 'file_other3', NULL, 'project', NULL, 21, NULL, NULL, 'file', 'Other(3)', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
3750(@project_id, 'project_complete', NULL, 'project', NULL, 22, NULL, 'Form Status', 'select', 'Complete?', '0, Incomplete \\n 1, Unverified \\n 2, Complete', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
3751(@project_id, 'date_receipt', NULL, 'workflow', 'Workflow', 23, NULL, 'Pre-Pre-Review Information', 'text', 'Project Receipt Date', NULL, NULL, 'date_ymd', NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
3752(@project_id, 'date_start_preprereview', NULL, 'workflow', NULL, 24, NULL, NULL, 'text', 'Pre-Pre-Review - Start Date', NULL, NULL, 'date_ymd', NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
3753(@project_id, 'date_stop_preprereview', NULL, 'workflow', NULL, 25, NULL, NULL, 'text', 'Pre-Pre-Review - Stop Date', NULL, NULL, 'date_ymd', NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
3754(@project_id, 'comments_preprereview', NULL, 'workflow', NULL, 26, NULL, NULL, 'textarea', 'Comments - Pre-Pre-Review', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
3755(@project_id, 'owner_prepreview', NULL, 'workflow', NULL, 27, NULL, NULL, 'select', 'Owner (Liaison)', '0, Shraddha \\n 1, Jennifer \\n 2, Terri \\n 3, Cheryl \\n 4, Lynda', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
3756(@project_id, 'date_start_prereview', NULL, 'workflow', NULL, 28, NULL, 'Pre-Review Information', 'text', 'Pre-Review Notification Date', NULL, NULL, 'date_ymd', NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
3757(@project_id, 'date_stop_prereview', NULL, 'workflow', NULL, 29, NULL, NULL, 'text', 'Pre-Review Completion Date', NULL, NULL, 'date_ymd', NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
3758(@project_id, 'comments_prereview', NULL, 'workflow', NULL, 30, NULL, NULL, 'textarea', 'Comments - Pre-Review', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
3759(@project_id, 'date_pi_notification', NULL, 'workflow', NULL, 31, NULL, 'PI Notification Information', 'text', 'PI Notification Date', NULL, NULL, 'date_ymd', NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
3760(@project_id, 'date_pi_response', NULL, 'workflow', NULL, 32, NULL, NULL, 'text', 'PI Response Date', NULL, NULL, 'date_ymd', NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
3761(@project_id, 'comments_pi_response', NULL, 'workflow', NULL, 33, NULL, NULL, 'textarea', 'Comments - PI Process', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
3762(@project_id, 'file_pi_comments', NULL, 'workflow', NULL, 34, NULL, NULL, 'file', 'PI response', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
3763(@project_id, 'date_agenda', NULL, 'workflow', NULL, 35, NULL, 'Agenda Information', 'text', 'Agenda Date', NULL, NULL, 'date_ymd', NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
3764(@project_id, 'rev1_name', NULL, 'workflow', NULL, 36, NULL, NULL, 'text', 'Reviewer 1', NULL, NULL, NULL, NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
3765(@project_id, 'rev2_name', NULL, 'workflow', NULL, 37, NULL, NULL, 'text', 'Reviewer 2', NULL, NULL, NULL, NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
3766(@project_id, 'rev_notification_date', NULL, 'workflow', NULL, 38, NULL, NULL, 'text', 'Date - Sent to Reviewers', NULL, NULL, 'date_ymd', NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
3767(@project_id, 'src_notification_date', NULL, 'workflow', NULL, 39, NULL, NULL, 'text', 'Date- Sent to SRC', NULL, NULL, 'date_ymd', NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
3768(@project_id, 'status_src_award', NULL, 'workflow', NULL, 40, NULL, NULL, 'select', 'SRC Award Status', '0, Approved \\n 1, Pending \\n 2, Deferred (Studio) \\n 3, Disapproved \\n 4, Tabled \\n 5, Withdrawn', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
3769(@project_id, 'src_priority_score', NULL, 'workflow', NULL, 41, NULL, NULL, 'text', 'SRC Priority Score', NULL, NULL, 'float', NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
3770(@project_id, 'workflow_complete', NULL, 'workflow', NULL, 42, NULL, 'Form Status', 'select', 'Complete?', '0, Incomplete \\n 1, Unverified \\n 2, Complete', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
3771(@project_id, 'needs_administrative', NULL, 'prereview_administrative', 'Pre-Review Administrative', 43, NULL, NULL, 'select', 'Requires Administrative?', '0, Yes \\n 1, No', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
3772(@project_id, 'prereview_administrative', NULL, 'prereview_administrative', NULL, 44, NULL, 'Enter PI Pre-Review Notes Or Attach File', 'textarea', 'Notes', NULL, NULL, NULL, NULL, NULL, NULL, '[needs_administrative] = "0"', 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
3773(@project_id, 'prereview_administrative_doc', NULL, 'prereview_administrative', NULL, 45, NULL, NULL, 'file', 'OR File<br><font size=1>(NOTE: If file will not open, then Save it to your computer and then Open it.)</font>', NULL, NULL, NULL, NULL, NULL, NULL, '[needs_administrative] = "0"', 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
3774(@project_id, 'prereview_administrative_date_sent', NULL, 'prereview_administrative', NULL, 46, NULL, NULL, 'text', 'Date Sent for pre-review', NULL, NULL, 'date_ymd', NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
3775(@project_id, 'prereview_administrative_date_received', NULL, 'prereview_administrative', NULL, 47, NULL, NULL, 'text', 'Date received', NULL, NULL, 'date_ymd', NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
3776(@project_id, 'prereview_administrative_complete', NULL, 'prereview_administrative', NULL, 48, NULL, 'Form Status', 'select', 'Complete?', '0, Incomplete \\n 1, Unverified \\n 2, Complete', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
3777(@project_id, 'needs_biostatistics', NULL, 'prereview_biostatistics', 'Pre-Review Biostatistics', 49, NULL, NULL, 'select', 'Requires Biostatistics?', '0, Yes \\n 1, No', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
3778(@project_id, 'prereview_biostatistics', NULL, 'prereview_biostatistics', NULL, 50, NULL, 'Enter Pre-Review Notes Or Attach File', 'textarea', 'PI Suggestions', NULL, NULL, NULL, NULL, NULL, NULL, '[needs_biostatistics] = "0"', 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
3779(@project_id, 'prereview_biostatistics_doc', NULL, 'prereview_biostatistics', NULL, 51, NULL, NULL, 'file', 'OR File<br><font size=1>(NOTE: If file will not open, then Save it to your computer and then Open it.)</font>', NULL, NULL, NULL, NULL, NULL, NULL, '[needs_biostatistics] = "0"', 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
3780(@project_id, 'prereview_biostatistics_date_sent', NULL, 'prereview_biostatistics', NULL, 52, NULL, NULL, 'text', 'Date Sent for pre-review', NULL, NULL, 'date_ymd', NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
3781(@project_id, 'prereview_biostatistics_date_received', NULL, 'prereview_biostatistics', NULL, 53, NULL, NULL, 'text', 'Date received', NULL, NULL, 'date_ymd', NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
3782(@project_id, 'prereview_biostatistics_hours_awarded', NULL, 'prereview_biostatistics', NULL, 54, NULL, 'Biostatistics Award', 'text', 'Consultation Hours Awarded', NULL, NULL, 'float', '0', '5000', 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
3783(@project_id, 'prereview_biostatistics_complete', NULL, 'prereview_biostatistics', NULL, 55, NULL, 'Form Status', 'select', 'Complete?', '0, Incomplete \\n 1, Unverified \\n 2, Complete', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
3784(@project_id, 'needs_scientific', NULL, 'prereview_scientific', 'Pre-Review Scientific', 56, NULL, NULL, 'select', 'Requires Scientific?', '0, Yes \\n 1, No', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
3785(@project_id, 'prereview_scientific', NULL, 'prereview_scientific', NULL, 57, NULL, 'Enter Pre-Review Notes Or Attach File', 'textarea', 'PI Suggestions', NULL, NULL, NULL, NULL, NULL, NULL, '[needs_scientific] = "0"', 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
3786(@project_id, 'prereview_scientific_doc', NULL, 'prereview_scientific', NULL, 58, NULL, NULL, 'file', 'OR File<br><font size=1>(NOTE: If file will not open, then Save it to your computer and then Open it.)</font>', NULL, NULL, NULL, NULL, NULL, NULL, '[needs_scientific] = "0"', 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
3787(@project_id, 'prereview_scientific_date_sent', NULL, 'prereview_scientific', NULL, 59, NULL, NULL, 'text', 'Date Sent for pre-review', NULL, NULL, 'date_ymd', NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
3788(@project_id, 'prereview_scientific_date_received', NULL, 'prereview_scientific', NULL, 60, NULL, NULL, 'text', 'Date received', NULL, NULL, 'date_ymd', NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
3789(@project_id, 'prereview_scientific_complete', NULL, 'prereview_scientific', NULL, 61, NULL, 'Form Status', 'select', 'Complete?', '0, Incomplete \\n 1, Unverified \\n 2, Complete', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
3790(@project_id, 'needs_participant', NULL, 'prereview_participant', 'Pre-Review Participant', 62, NULL, NULL, 'select', 'Requires Participant?', '0, Yes \\n 1, No', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
3791(@project_id, 'prereview_participant', NULL, 'prereview_participant', NULL, 63, NULL, 'Enter Pre-Review Notes Or Attach File', 'textarea', 'PI Suggestions', NULL, NULL, NULL, NULL, NULL, NULL, '[needs_participant] = "0"', 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
3792(@project_id, 'prereview_participant_doc', NULL, 'prereview_participant', NULL, 64, NULL, NULL, 'file', 'OR File<br><font size=1>(NOTE: If file will not open, then Save it to your computer and then Open it.)</font>', NULL, NULL, NULL, NULL, NULL, NULL, '[needs_participant] = "0"', 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
3793(@project_id, 'prereview_participant_date_sent', NULL, 'prereview_participant', NULL, 65, NULL, NULL, 'text', 'Date Sent for pre-review', NULL, NULL, 'date_ymd', NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
3794(@project_id, 'prereview_participant_date_received', NULL, 'prereview_participant', NULL, 66, NULL, NULL, 'text', 'Date received', NULL, NULL, 'date_ymd', NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
3795(@project_id, 'prereview_participant_complete', NULL, 'prereview_participant', NULL, 67, NULL, 'Form Status', 'select', 'Complete?', '0, Incomplete \\n 1, Unverified \\n 2, Complete', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
3796(@project_id, 'needs_budget', NULL, 'prereview_budget', 'Pre-Review Budget', 68, NULL, NULL, 'select', 'Requires Budget?', '0, Yes \\n 1, No', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
3797(@project_id, 'prereview_budget', NULL, 'prereview_budget', NULL, 69, NULL, 'Enter Pre-Review Notes Or Attach File', 'textarea', 'PI Suggestions', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
3798(@project_id, 'prereview_budget_doc', NULL, 'prereview_budget', NULL, 70, NULL, NULL, 'file', 'OR File<br><font size=1>(NOTE: If file will not open, then Save it to your computer and then Open it.)</font>', NULL, NULL, NULL, NULL, NULL, NULL, '[needs_budget] = "0"', 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
3799(@project_id, 'prereview_budget_date_sent', NULL, 'prereview_budget', NULL, 71, NULL, NULL, 'text', 'Date Sent for pre-review', NULL, NULL, 'date_ymd', NULL, NULL, 'soft_typed', '[needs_budget] = "0"', 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
3800(@project_id, 'prereview_budget_date_received', NULL, 'prereview_budget', NULL, 72, NULL, NULL, 'text', 'Date received', NULL, NULL, 'date_ymd', NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
3801(@project_id, 'prereview_budget_complete', NULL, 'prereview_budget', NULL, 73, NULL, 'Form Status', 'select', 'Complete?', '0, Incomplete \\n 1, Unverified \\n 2, Complete', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
3802(@project_id, 'needs_nursing', NULL, 'prereview_nursing', 'Pre-Review Nursing', 74, NULL, NULL, 'select', 'Requires Nursing?', '0, Yes \\n 1, No', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
3803(@project_id, 'prereview_nursing', NULL, 'prereview_nursing', NULL, 75, NULL, 'Enter Pre-Review Notes Or Attach File', 'textarea', 'PI Suggestions', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
3804(@project_id, 'prereview_nursing_doc', NULL, 'prereview_nursing', NULL, 76, NULL, NULL, 'file', 'OR File<br><font size=1>(NOTE: If file will not open, then Save it to your computer and then Open it.)</font>', NULL, NULL, NULL, NULL, NULL, NULL, '[needs_nursing] = "0"', 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
3805(@project_id, 'prereview_nursing_date_sent', NULL, 'prereview_nursing', NULL, 77, NULL, NULL, 'text', 'Date Sent for pre-review', NULL, NULL, 'date_ymd', NULL, NULL, 'soft_typed', '[needs_nursing] = "0"', 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
3806(@project_id, 'prereview_nursing_date_received', NULL, 'prereview_nursing', NULL, 78, NULL, NULL, 'text', 'Date received', NULL, NULL, 'date_ymd', NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
3807(@project_id, 'prereview_nursing_complete', NULL, 'prereview_nursing', NULL, 79, NULL, 'Form Status', 'select', 'Complete?', '0, Incomplete \\n 1, Unverified \\n 2, Complete', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
3808(@project_id, 'needs_cores', NULL, 'prereview_cores', 'Pre-Review Cores', 80, NULL, NULL, 'select', 'Requires Cores?', '0, Yes \\n 1, No', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
3809(@project_id, 'prereview_cores', NULL, 'prereview_cores', NULL, 81, NULL, 'Enter Pre-Review Notes Or Attach File', 'textarea', 'PI Suggestions', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
3810(@project_id, 'prereview_cores_doc', NULL, 'prereview_cores', NULL, 82, NULL, NULL, 'file', 'OR File<br><font size=1>(NOTE: If file will not open, then Save it to your computer and then Open it.)</font>', NULL, NULL, NULL, NULL, NULL, NULL, '[needs_cores] = "0"', 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
3811(@project_id, 'prereview_cores_date_sent', NULL, 'prereview_cores', NULL, 83, NULL, NULL, 'text', 'Date Sent for pre-review', NULL, NULL, 'date_ymd', NULL, NULL, 'soft_typed', '[needs_cores] = "0"', 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
3812(@project_id, 'prereview_cores_date_received', NULL, 'prereview_cores', NULL, 84, NULL, NULL, 'text', 'Date received', NULL, NULL, 'date_ymd', NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
3813(@project_id, 'prereview_cores_complete', NULL, 'prereview_cores', NULL, 85, NULL, 'Form Status', 'select', 'Complete?', '0, Incomplete \\n 1, Unverified \\n 2, Complete', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
3814(@project_id, 'needs_sleep', NULL, 'prereview_sleep', 'Pre-Review Sleep', 86, NULL, NULL, 'select', 'Requires Sleep?', '0, Yes \\n 1, No', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
3815(@project_id, 'prereview_sleep', NULL, 'prereview_sleep', NULL, 87, NULL, 'Enter Pre-Review Notes Or Attach File', 'textarea', 'PI Suggestions', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
3816(@project_id, 'prereview_sleep_doc', NULL, 'prereview_sleep', NULL, 88, NULL, NULL, 'file', 'OR File<br><font size=1>(NOTE: If file will not open, then Save it to your computer and then Open it.)</font>', NULL, NULL, NULL, NULL, NULL, NULL, '[needs_sleep] = "0"', 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
3817(@project_id, 'prereview_sleep_date_sent', NULL, 'prereview_sleep', NULL, 89, NULL, NULL, 'text', 'Date Sent for pre-review', NULL, NULL, 'date_ymd', NULL, NULL, 'soft_typed', '[needs_sleep] = "0"', 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
3818(@project_id, 'prereview_sleep_date_received', NULL, 'prereview_sleep', NULL, 90, NULL, NULL, 'text', 'Date received', NULL, NULL, 'date_ymd', NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
3819(@project_id, 'prereview_sleep_complete', NULL, 'prereview_sleep', NULL, 91, NULL, 'Form Status', 'select', 'Complete?', '0, Incomplete \\n 1, Unverified \\n 2, Complete', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
3820(@project_id, 'needs_nutrition', NULL, 'prereview_nutrition', 'Pre-Review Nutrition', 92, NULL, NULL, 'select', 'Requires Nutrition?', '0, Yes \\n 1, No', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
3821(@project_id, 'prereview_nutrition', NULL, 'prereview_nutrition', NULL, 93, NULL, 'Enter Pre-Review Notes Or Attach File', 'textarea', 'PI Suggestions', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
3822(@project_id, 'prereview_nutrition_doc', NULL, 'prereview_nutrition', NULL, 94, NULL, NULL, 'file', 'OR File<br><font size=1>(NOTE: If file will not open, then Save it to your computer and then Open it.)</font>', NULL, NULL, NULL, NULL, NULL, NULL, '[needs_nutrition] = "0"', 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
3823(@project_id, 'prereview_nutrition_date_sent', NULL, 'prereview_nutrition', NULL, 95, NULL, NULL, 'text', 'Date Sent for pre-review', NULL, NULL, 'date_ymd', NULL, NULL, 'soft_typed', '[needs_nutrition] = "0"', 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
3824(@project_id, 'prereview_nutrition_date_received', NULL, 'prereview_nutrition', NULL, 96, NULL, NULL, 'text', 'Date received', NULL, NULL, 'date_ymd', NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
3825(@project_id, 'prereview_nutrition_complete', NULL, 'prereview_nutrition', NULL, 97, NULL, 'Form Status', 'select', 'Complete?', '0, Incomplete \\n 1, Unverified \\n 2, Complete', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
3826(@project_id, 'needs_community', NULL, 'prereview_community', 'Pre-Review Community', 98, NULL, NULL, 'select', 'Requires Community?', '0, Yes \\n 1, No', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
3827(@project_id, 'prereview_community', NULL, 'prereview_community', NULL, 99, NULL, 'Enter Pre-Review Notes Or Attach File', 'textarea', 'PI Suggestions', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
3828(@project_id, 'prereview_community_doc', NULL, 'prereview_community', NULL, 100, NULL, NULL, 'file', 'OR File<br><font size=1>(NOTE: If file will not open, then Save it to your computer and then Open it.)</font>', NULL, NULL, NULL, NULL, NULL, NULL, '[needs_community] = "0"', 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
3829(@project_id, 'prereview_community_date_sent', NULL, 'prereview_community', NULL, 101, NULL, NULL, 'text', 'Date Sent for pre-review', NULL, NULL, 'date_ymd', NULL, NULL, 'soft_typed', '[needs_community] = "0"', 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
3830(@project_id, 'prereview_community_date_received', NULL, 'prereview_community', NULL, 102, NULL, NULL, 'text', 'Date received', NULL, NULL, 'date_ymd', NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
3831(@project_id, 'prereview_community_complete', NULL, 'prereview_community', NULL, 103, NULL, 'Form Status', 'select', 'Complete?', '0, Incomplete \\n 1, Unverified \\n 2, Complete', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
3832(@project_id, 'needs_other', NULL, 'prereview_ctc', 'Pre-Review CTC', 104, NULL, NULL, 'select', 'Requires Other?', '0, Yes \\n 1, No', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
3833(@project_id, 'prereview_other', NULL, 'prereview_ctc', NULL, 105, NULL, 'Enter Pre-Review Notes Or Attach File', 'textarea', 'PI Suggestions', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
3834(@project_id, 'prereview_other_doc', NULL, 'prereview_ctc', NULL, 106, NULL, NULL, 'file', 'OR File<br><font size=1>(NOTE: If file will not open, then Save it to your computer and then Open it.)</font>', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
3835(@project_id, 'prereview_other_date_sent', NULL, 'prereview_ctc', NULL, 107, NULL, NULL, 'text', 'Date Sent for pre-review', NULL, NULL, 'date_ymd', NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
3836(@project_id, 'prereview_other_date_received', NULL, 'prereview_ctc', NULL, 108, NULL, NULL, 'text', 'Date received', NULL, NULL, 'date_ymd', NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
3837(@project_id, 'prereview_ctc_complete', NULL, 'prereview_ctc', NULL, 109, NULL, 'Form Status', 'select', 'Complete?', '0, Incomplete \\n 1, Unverified \\n 2, Complete', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
3838(@project_id, 'needs_pi_response', NULL, 'prereview_pi_response', 'Pre-Review PI Response', 110, NULL, NULL, 'select', 'Requires PI Response?', '0, Yes \\n 1, No', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
3839(@project_id, 'prereview_pi_response', NULL, 'prereview_pi_response', NULL, 111, NULL, 'Enter Pre-Review Notes Or Attach File', 'textarea', 'PI response', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
3840(@project_id, 'prereview_pi_response_doc', NULL, 'prereview_pi_response', NULL, 112, NULL, NULL, 'file', 'OR File<br><font size=1>(NOTE: If file will not open, then Save it to your computer and then Open it.)</font>', NULL, NULL, NULL, NULL, NULL, NULL, '[needs_pi_response] = "0"', 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
3841(@project_id, 'prereview_pi_response_date_sent', NULL, 'prereview_pi_response', NULL, 113, NULL, NULL, 'text', 'Date Sent for pre-review', NULL, NULL, 'date_ymd', NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
3842(@project_id, 'prereview_pi_response_date_received', NULL, 'prereview_pi_response', NULL, 114, NULL, NULL, 'text', 'Date received', NULL, NULL, 'date_ymd', NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
3843(@project_id, 'prereview_pi_response_complete', NULL, 'prereview_pi_response', NULL, 115, NULL, 'Form Status', 'select', 'Complete?', '0, Incomplete \\n 1, Unverified \\n 2, Complete', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
3844(@project_id, 'src_percent_funded', NULL, 'post_award_administration', 'Post-Award Administration', 116, NULL, 'Post-Award Administration', 'text', 'Percent of request funded (%)', NULL, NULL, 'float', NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
3845(@project_id, 'src_total_award_amount', NULL, 'post_award_administration', NULL, 117, NULL, NULL, 'text', 'SRC Total Award Amount ($)', NULL, NULL, 'float', NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
3846(@project_id, 'src_letter_date', NULL, 'post_award_administration', NULL, 118, NULL, NULL, 'text', 'SRC letter sent', NULL, NULL, 'date_ymd', NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
3847(@project_id, 'src_letter_document', NULL, 'post_award_administration', NULL, 119, NULL, NULL, 'file', 'SRC letter', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
3848(@project_id, 'src_project_ending', NULL, 'post_award_administration', NULL, 120, NULL, NULL, 'text', 'SRC project ending date', NULL, NULL, 'date_ymd', NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
3849(@project_id, 'src_full_project_period', NULL, 'post_award_administration', NULL, 121, NULL, NULL, 'text', 'SRC full project period', NULL, NULL, 'date_ymd', NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
3850(@project_id, 'src_center_number', NULL, 'post_award_administration', NULL, 122, NULL, NULL, 'text', 'SRC Center Number - Institutional', NULL, NULL, NULL, NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
3851(@project_id, 'src_center_number_ctsa', NULL, 'post_award_administration', NULL, 123, NULL, NULL, 'text', 'SRC Center Number - CTSA', NULL, NULL, NULL, NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
3852(@project_id, 'src_center_number_crc', NULL, 'post_award_administration', NULL, 124, NULL, NULL, 'text', 'SRC Center Number - CRC', NULL, NULL, NULL, NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
3853(@project_id, 'src_center_number_dh', NULL, 'post_award_administration', NULL, 125, NULL, NULL, 'text', 'D & H Number', NULL, NULL, NULL, NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
3854(@project_id, 'comments_src', NULL, 'post_award_administration', NULL, 126, NULL, NULL, 'textarea', 'Comments - SRC Award', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
3855(@project_id, 'crc_facilities', NULL, 'post_award_administration', NULL, 127, NULL, NULL, 'text', 'CRC Facilities ($)', NULL, NULL, 'float', NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
3856(@project_id, 'crc_personnel', NULL, 'post_award_administration', NULL, 128, NULL, NULL, 'text', 'CRC Nursing ($)', NULL, NULL, 'float', NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
3857(@project_id, 'crc_cores', NULL, 'post_award_administration', NULL, 129, NULL, NULL, 'text', 'CRC Cores ($)', NULL, NULL, 'float', NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
3858(@project_id, 'sleep_cores', NULL, 'post_award_administration', NULL, 130, NULL, NULL, 'text', 'Sleep Core ($)', NULL, NULL, 'float', NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
3859(@project_id, 'vumc_core_facilities', NULL, 'post_award_administration', NULL, 131, NULL, NULL, 'text', 'VUMC Core Facilities ($)', NULL, NULL, 'float', NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
3860(@project_id, 'personnel', NULL, 'post_award_administration', NULL, 132, NULL, NULL, 'text', 'Personnel ($)', NULL, NULL, 'float', NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
3861(@project_id, 'equipment', NULL, 'post_award_administration', NULL, 133, NULL, NULL, 'text', 'Equipment ($)', NULL, NULL, 'float', NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
3862(@project_id, 'misc_services', NULL, 'post_award_administration', NULL, 134, NULL, NULL, 'text', 'Misc. Services ($)', NULL, NULL, 'float', NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
3863(@project_id, 'hospital_ancillaries', NULL, 'post_award_administration', NULL, 135, NULL, NULL, 'text', 'Hospital Ancillaries ($)', NULL, NULL, 'float', NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
3864(@project_id, 'victr_status', NULL, 'post_award_administration', NULL, 136, NULL, NULL, 'radio', 'VICTR Status', '0, Inactive \\n 1, Active', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
3865(@project_id, 'src_project_completion', NULL, 'post_award_administration', NULL, 137, NULL, NULL, 'text', 'SRC completion date', NULL, NULL, 'date_ymd', NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
3866(@project_id, 'post_award_administration_complete', NULL, 'post_award_administration', NULL, 138, NULL, 'Form Status', 'select', 'Complete?', '0, Incomplete \\n 1, Unverified \\n 2, Complete', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL);
3867
3868INSERT INTO `redcap_projects_templates` (`project_id`, `title`, `description`, `enabled`)
3869 VALUES (@project_id, @project_title, 'Contains fifteen data entry forms dedicated to recording the attributes of and tracking and progress of projects/studies.', '1');
3870-- SQL TO CREATE A REDCAP DEMO PROJECT --
3871set @project_title = 'Randomized Clinical Trial';
3872
3873
3874-- Obtain default values --
3875set @institution = (select value from redcap_config where field_name = 'institution' limit 1);
3876set @site_org_type = (select value from redcap_config where field_name = 'site_org_type' limit 1);
3877set @grant_cite = (select value from redcap_config where field_name = 'grant_cite' limit 1);
3878set @project_contact_name = (select value from redcap_config where field_name = 'project_contact_name' limit 1);
3879set @project_contact_email = (select value from redcap_config where field_name = 'project_contact_email' limit 1);
3880set @headerlogo = (select value from redcap_config where field_name = 'headerlogo' limit 1);
3881set @auth_meth = (select value from redcap_config where field_name = 'auth_meth_global' limit 1);
3882-- Create project --
3883INSERT INTO `redcap_projects`
3884(project_name, app_title, status, count_project, auth_meth, creation_time, production_time, institution, site_org_type, grant_cite, project_contact_name, project_contact_email, headerlogo, display_project_logo_institution, randomization, auto_inc_set) VALUES
3885(concat('redcap_demo_',LEFT(sha1(rand()),6)), @project_title, 1, 0, @auth_meth, now(), now(), @institution, @site_org_type, @grant_cite, @project_contact_name, @project_contact_email, @headerlogo, 0, 1, 1);
3886set @project_id = LAST_INSERT_ID();
3887-- User rights --
3888INSERT INTO `redcap_user_rights` (`project_id`, `username`, `expiration`, `group_id`, `lock_record`, `data_export_tool`, `data_import_tool`, `data_comparison_tool`, `data_logging`, `file_repository`, `double_data`, `user_rights`, `data_access_groups`, `graphical`, `reports`, `design`, `calendar`, `data_entry`, `data_quality_execute`, random_setup, random_dashboard, random_perform) VALUES
3889(@project_id, 'site_admin', NULL, NULL, 0, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 0, 1, '', 1, 1, 1, 1);
3890-- Create single arm --
3891INSERT INTO redcap_events_arms (project_id, arm_num, arm_name) VALUES (@project_id, 1, 'Arm 1');
3892set @arm_id = LAST_INSERT_ID();
3893-- Create single event --
3894INSERT INTO redcap_events_metadata (arm_id, day_offset, offset_min, offset_max, descrip) VALUES (@arm_id, 0, 0, 0, 'Event 1');
3895set @event_id = LAST_INSERT_ID();
3896-- Insert randomization row
3897INSERT INTO redcap_randomization (project_id, stratified, group_by, target_field, target_event, source_field1, source_event1, source_field2, source_event2, source_field3, source_event3, source_field4, source_event4, source_field5, source_event5, source_field6, source_event6, source_field7, source_event7, source_field8, source_event8, source_field9, source_event9, source_field10, source_event10, source_field11, source_event11, source_field12, source_event12, source_field13, source_event13, source_field14, source_event14, source_field15, source_event15) VALUES
3898(@project_id, 1, NULL, 'randomization_group', NULL, 'race', @event_id, 'gender', @event_id, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
3899-- Insert into redcap_metadata --
3900INSERT INTO redcap_metadata (project_id, field_name, field_phi, form_name, form_menu_description, field_order, field_units, element_preceding_header, element_type, element_label, element_enum, element_note, element_validation_type, element_validation_min, element_validation_max, element_validation_checktype, branching_logic, field_req, edoc_id, edoc_display_img, custom_alignment, stop_actions, question_num) VALUES
3901(@project_id, 'study_id', NULL, 'demographics', 'Demographics', 1, NULL, NULL, 'text', 'Study ID', NULL, NULL, NULL, NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3902(@project_id, 'date_enrolled', NULL, 'demographics', NULL, 2, NULL, 'Consent Information', 'text', 'Date subject signed consent', NULL, 'YYYY-MM-DD', 'date_ymd', NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3903(@project_id, 'first_name', '1', 'demographics', NULL, 3, NULL, 'Contact Information', 'text', 'First Name', NULL, NULL, NULL, NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3904(@project_id, 'last_name', '1', 'demographics', NULL, 4, NULL, NULL, 'text', 'Last Name', NULL, NULL, NULL, NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3905(@project_id, 'dob', '1', 'demographics', NULL, 8.1, NULL, NULL, 'text', 'Date of birth', NULL, NULL, 'date_ymd', NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3906(@project_id, 'ethnicity', NULL, 'demographics', NULL, 9, NULL, NULL, 'radio', 'Ethnicity', '0, Hispanic or Latino \\n 1, NOT Hispanic or Latino \\n 2, Unknown / Not Reported', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, 'LH', NULL, NULL),
3907(@project_id, 'race', NULL, 'demographics', NULL, 10, NULL, NULL, 'select', 'Race', '0, American Indian/Alaska Native \\n 1, Asian \\n 2, Native Hawaiian or Other Pacific Islander \\n 3, Black or African American \\n 4, White \\n 5, More Than One Race \\n 6, Unknown / Not Reported', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
3908(@project_id, 'gender', NULL, 'demographics', NULL, 11, NULL, NULL, 'radio', 'Gender', '0, Female \\n 1, Male \\n 2, Other \\n 3, Prefer not to say', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
3909(@project_id, 'demographics_complete', NULL, 'demographics', NULL, 23, NULL, 'Form Status', 'select', 'Complete?', '0, Incomplete \\n 1, Unverified \\n 2, Complete', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
3910
3911(@project_id, 'randomization_group', NULL, 'randomization_form', 'Randomization Form', 23.1, NULL, 'General Comments', 'select', 'Randomization Group', '0, Drug A \\n 1, Drug B \\n 2, Drug C', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
3912(@project_id, 'randomization_form_complete', NULL, 'randomization_form', NULL, 23.2, NULL, 'Form Status', 'select', 'Complete?', '0, Incomplete \\n 1, Unverified \\n 2, Complete', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
3913
3914
3915(@project_id, 'date_visit_b', NULL, 'baseline_data', 'Baseline Data', 24, NULL, 'Baseline Measurements', 'text', 'Date of baseline visit', NULL, NULL, 'date_ymd', NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3916(@project_id, 'date_blood_b', NULL, 'baseline_data', NULL, 25, NULL, NULL, 'text', 'Date blood was drawn', NULL, NULL, 'date_ymd', NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3917(@project_id, 'alb_b', NULL, 'baseline_data', NULL, 26, 'g/dL', NULL, 'text', 'Serum Albumin (g/dL)', NULL, NULL, 'int', '3', '5', 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3918(@project_id, 'prealb_b', NULL, 'baseline_data', NULL, 27, 'mg/dL', NULL, 'text', 'Serum Prealbumin (mg/dL)', NULL, NULL, 'float', '10', '40', 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3919(@project_id, 'creat_b', NULL, 'baseline_data', NULL, 28, 'mg/dL', NULL, 'text', 'Creatinine (mg/dL)', NULL, NULL, 'float', '0.5', '20', 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3920(@project_id, 'npcr_b', NULL, 'baseline_data', NULL, 29, 'g/kg/d', NULL, 'text', 'Normalized Protein Catabolic Rate (g/kg/d)', NULL, NULL, 'float', '0.5', '2', 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3921(@project_id, 'chol_b', NULL, 'baseline_data', NULL, 30, 'mg/dL', NULL, 'text', 'Cholesterol (mg/dL)', NULL, NULL, 'float', '100', '300', 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3922(@project_id, 'transferrin_b', NULL, 'baseline_data', NULL, 31, 'mg/dL', NULL, 'text', 'Transferrin (mg/dL)', NULL, NULL, 'float', '100', '300', 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3923(@project_id, 'kt_v_b', NULL, 'baseline_data', NULL, 32, NULL, NULL, 'text', 'Kt/V', NULL, NULL, 'float', '0.9', '3', 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3924(@project_id, 'drywt_b', NULL, 'baseline_data', NULL, 33, 'kilograms', NULL, 'text', 'Dry weight (kilograms)', NULL, NULL, 'float', '35', '200', 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3925(@project_id, 'plasma1_b', NULL, 'baseline_data', NULL, 34, NULL, NULL, 'select', 'Collected Plasma 1?', '0, No \\n 1, Yes', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
3926(@project_id, 'plasma2_b', NULL, 'baseline_data', NULL, 35, NULL, NULL, 'select', 'Collected Plasma 2?', '0, No \\n 1, Yes', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
3927(@project_id, 'plasma3_b', NULL, 'baseline_data', NULL, 36, NULL, NULL, 'select', 'Collected Plasma 3?', '0, No \\n 1, Yes', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
3928(@project_id, 'serum1_b', NULL, 'baseline_data', NULL, 37, NULL, NULL, 'select', 'Collected Serum 1?', '0, No \\n 1, Yes', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
3929(@project_id, 'serum2_b', NULL, 'baseline_data', NULL, 38, NULL, NULL, 'select', 'Collected Serum 2?', '0, No \\n 1, Yes', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
3930(@project_id, 'serum3_b', NULL, 'baseline_data', NULL, 39, NULL, NULL, 'select', 'Collected Serum 3?', '0, No \\n 1, Yes', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
3931(@project_id, 'sga_b', NULL, 'baseline_data', NULL, 40, NULL, NULL, 'text', 'Subject Global Assessment (score = 1-7)', NULL, NULL, 'float', '0.9', '7.1', 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3932(@project_id, 'date_supplement_dispensed', NULL, 'baseline_data', NULL, 41, NULL, NULL, 'text', 'Date patient begins supplement', NULL, NULL, 'date_ymd', NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3933(@project_id, 'baseline_data_complete', NULL, 'baseline_data', NULL, 42, NULL, 'Form Status', 'select', 'Complete?', '0, Incomplete \\n 1, Unverified \\n 2, Complete', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
3934(@project_id, 'date_visit_1', NULL, 'month_1_data', 'Month 1 Data', 43, NULL, 'Month 1', 'text', 'Date of Month 1 visit', NULL, NULL, 'date_ymd', NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3935(@project_id, 'alb_1', NULL, 'month_1_data', NULL, 44, 'g/dL', NULL, 'text', 'Serum Albumin (g/dL)', NULL, NULL, 'float', '3', '5', 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3936(@project_id, 'prealb_1', NULL, 'month_1_data', NULL, 45, 'mg/dL', NULL, 'text', 'Serum Prealbumin (mg/dL)', NULL, NULL, 'float', '10', '40', 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3937(@project_id, 'creat_1', NULL, 'month_1_data', NULL, 46, 'mg/dL', NULL, 'text', 'Creatinine (mg/dL)', NULL, NULL, 'float', '0.5', '20', 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3938(@project_id, 'npcr_1', NULL, 'month_1_data', NULL, 47, 'g/kg/d', NULL, 'text', 'Normalized Protein Catabolic Rate (g/kg/d)', NULL, NULL, 'float', '0.5', '2', 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3939(@project_id, 'chol_1', NULL, 'month_1_data', NULL, 48, 'mg/dL', NULL, 'text', 'Cholesterol (mg/dL)', NULL, NULL, 'float', '100', '300', 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3940(@project_id, 'transferrin_1', NULL, 'month_1_data', NULL, 49, 'mg/dL', NULL, 'text', 'Transferrin (mg/dL)', NULL, NULL, 'float', '100', '300', 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3941(@project_id, 'kt_v_1', NULL, 'month_1_data', NULL, 50, NULL, NULL, 'text', 'Kt/V', NULL, NULL, 'float', '0.9', '3', 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3942(@project_id, 'drywt_1', NULL, 'month_1_data', NULL, 51, 'kilograms', NULL, 'text', 'Dry weight (kilograms)', NULL, NULL, 'float', '35', '200', 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3943(@project_id, 'no_show_1', NULL, 'month_1_data', NULL, 52, NULL, NULL, 'text', 'Number of treatments missed', NULL, NULL, 'float', '0', '7', 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3944(@project_id, 'compliance_1', NULL, 'month_1_data', NULL, 53, NULL, NULL, 'select', 'How compliant was the patient in drinking the supplement?', '0, 100 percent \\n 1, 99-75 percent \\n 2, 74-50 percent \\n 3, 49-25 percent \\n 4, 0-24 percent', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
3945(@project_id, 'hospit_1', NULL, 'month_1_data', NULL, 54, NULL, 'Hospitalization Data', 'select', 'Was patient hospitalized since last visit?', '0, No \\n 1, Yes', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
3946(@project_id, 'cause_hosp_1', NULL, 'month_1_data', NULL, 55, NULL, NULL, 'select', 'What was the cause of hospitalization?', '1, Vascular access related events \\n 2, CVD events \\n 3, Other', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
3947(@project_id, 'admission_date_1', NULL, 'month_1_data', NULL, 56, NULL, NULL, 'text', 'Date of hospital admission', NULL, NULL, 'date_ymd', NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3948(@project_id, 'discharge_date_1', NULL, 'month_1_data', NULL, 57, NULL, NULL, 'text', 'Date of hospital discharge', NULL, NULL, 'date_ymd', NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3949(@project_id, 'discharge_summary_1', NULL, 'month_1_data', NULL, 58, NULL, NULL, 'select', 'Discharge summary in patients binder?', '0, No \\n 1, Yes', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
3950(@project_id, 'death_1', NULL, 'month_1_data', NULL, 59, NULL, 'Mortality Data', 'select', 'Has patient died since last visit?', '0, No \\n 1, Yes', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
3951(@project_id, 'date_death_1', NULL, 'month_1_data', NULL, 60, NULL, NULL, 'text', 'Date of death', NULL, NULL, 'date_ymd', NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3952(@project_id, 'cause_death_1', NULL, 'month_1_data', NULL, 61, NULL, NULL, 'select', 'What was the cause of death?', '1, All-cause \\n 2, Cardiovascular', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
3953(@project_id, 'month_1_data_complete', NULL, 'month_1_data', NULL, 62, NULL, 'Form Status', 'select', 'Complete?', '0, Incomplete \\n 1, Unverified \\n 2, Complete', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
3954(@project_id, 'date_visit_2', NULL, 'month_2_data', 'Month 2 Data', 63, NULL, 'Month 2', 'text', 'Date of Month 2 visit', NULL, NULL, 'date_ymd', NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3955(@project_id, 'alb_2', NULL, 'month_2_data', NULL, 64, 'g/dL', NULL, 'text', 'Serum Albumin (g/dL)', NULL, NULL, 'float', '3', '5', 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3956(@project_id, 'prealb_2', NULL, 'month_2_data', NULL, 65, 'mg/dL', NULL, 'text', 'Serum Prealbumin (mg/dL)', NULL, NULL, 'float', '10', '40', 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3957(@project_id, 'creat_2', NULL, 'month_2_data', NULL, 66, 'mg/dL', NULL, 'text', 'Creatinine (mg/dL)', NULL, NULL, 'float', '0.5', '20', 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3958(@project_id, 'npcr_2', NULL, 'month_2_data', NULL, 67, 'g/kg/d', NULL, 'text', 'Normalized Protein Catabolic Rate (g/kg/d)', NULL, NULL, 'float', '0.5', '2', 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3959(@project_id, 'chol_2', NULL, 'month_2_data', NULL, 68, 'mg/dL', NULL, 'text', 'Cholesterol (mg/dL)', NULL, NULL, 'float', '100', '300', 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3960(@project_id, 'transferrin_2', NULL, 'month_2_data', NULL, 69, 'mg/dL', NULL, 'text', 'Transferrin (mg/dL)', NULL, NULL, 'float', '100', '300', 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3961(@project_id, 'kt_v_2', NULL, 'month_2_data', NULL, 70, NULL, NULL, 'text', 'Kt/V', NULL, NULL, 'float', '0.9', '3', 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3962(@project_id, 'drywt_2', NULL, 'month_2_data', NULL, 71, 'kilograms', NULL, 'text', 'Dry weight (kilograms)', NULL, NULL, 'float', '35', '200', 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3963(@project_id, 'no_show_2', NULL, 'month_2_data', NULL, 72, NULL, NULL, 'text', 'Number of treatments missed', NULL, NULL, 'float', '0', '7', 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3964(@project_id, 'compliance_2', NULL, 'month_2_data', NULL, 73, NULL, NULL, 'select', 'How compliant was the patient in drinking the supplement?', '0, 100 percent \\n 1, 99-75 percent \\n 2, 74-50 percent \\n 3, 49-25 percent \\n 4, 0-24 percent', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
3965(@project_id, 'hospit_2', NULL, 'month_2_data', NULL, 74, NULL, 'Hospitalization Data', 'select', 'Was patient hospitalized since last visit?', '0, No \\n 1, Yes', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
3966(@project_id, 'cause_hosp_2', NULL, 'month_2_data', NULL, 75, NULL, NULL, 'select', 'What was the cause of hospitalization?', '1, Vascular access related events \\n 2, CVD events \\n 3, Other', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
3967(@project_id, 'admission_date_2', NULL, 'month_2_data', NULL, 76, NULL, NULL, 'text', 'Date of hospital admission', NULL, NULL, 'date_ymd', NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3968(@project_id, 'discharge_date_2', NULL, 'month_2_data', NULL, 77, NULL, NULL, 'text', 'Date of hospital discharge', NULL, NULL, 'date_ymd', NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3969(@project_id, 'discharge_summary_2', NULL, 'month_2_data', NULL, 78, NULL, NULL, 'select', 'Discharge summary in patients binder?', '0, No \\n 1, Yes', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
3970(@project_id, 'death_2', NULL, 'month_2_data', NULL, 79, NULL, 'Mortality Data', 'select', 'Has patient died since last visit?', '0, No \\n 1, Yes', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
3971(@project_id, 'date_death_2', NULL, 'month_2_data', NULL, 80, NULL, NULL, 'text', 'Date of death', NULL, NULL, 'date_ymd', NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3972(@project_id, 'cause_death_2', NULL, 'month_2_data', NULL, 81, NULL, NULL, 'select', 'What was the cause of death?', '1, All-cause \\n 2, Cardiovascular', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
3973(@project_id, 'month_2_data_complete', NULL, 'month_2_data', NULL, 82, NULL, 'Form Status', 'select', 'Complete?', '0, Incomplete \\n 1, Unverified \\n 2, Complete', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
3974(@project_id, 'date_visit_3', NULL, 'month_3_data', 'Month 3 Data', 83, NULL, 'Month 3', 'text', 'Date of Month 3 visit', NULL, NULL, 'date_ymd', NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3975(@project_id, 'date_blood_3', NULL, 'month_3_data', NULL, 84, NULL, NULL, 'text', 'Date blood was drawn', NULL, NULL, 'date_ymd', NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3976(@project_id, 'alb_3', NULL, 'month_3_data', NULL, 85, 'g/dL', NULL, 'text', 'Serum Albumin (g/dL)', NULL, NULL, 'float', '3', '5', 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3977(@project_id, 'prealb_3', NULL, 'month_3_data', NULL, 86, 'mg/dL', NULL, 'text', 'Serum Prealbumin (mg/dL)', NULL, NULL, 'float', '10', '40', 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3978(@project_id, 'creat_3', NULL, 'month_3_data', NULL, 87, 'mg/dL', NULL, 'text', 'Creatinine (mg/dL)', NULL, NULL, 'float', '0.5', '20', 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3979(@project_id, 'npcr_3', NULL, 'month_3_data', NULL, 88, 'g/kg/d', NULL, 'text', 'Normalized Protein Catabolic Rate (g/kg/d)', NULL, NULL, 'float', '0.5', '2', 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3980(@project_id, 'chol_3', NULL, 'month_3_data', NULL, 89, 'mg/dL', NULL, 'text', 'Cholesterol (mg/dL)', NULL, NULL, 'float', '100', '300', 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3981(@project_id, 'transferrin_3', NULL, 'month_3_data', NULL, 90, 'mg/dL', NULL, 'text', 'Transferrin (mg/dL)', NULL, NULL, 'float', '100', '300', 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3982(@project_id, 'kt_v_3', NULL, 'month_3_data', NULL, 91, NULL, NULL, 'text', 'Kt/V', NULL, NULL, 'float', '0.9', '3', 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3983(@project_id, 'drywt_3', NULL, 'month_3_data', NULL, 92, 'kilograms', NULL, 'text', 'Dry weight (kilograms)', NULL, NULL, 'float', '35', '200', 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3984(@project_id, 'plasma1_3', NULL, 'month_3_data', NULL, 93, NULL, NULL, 'select', 'Collected Plasma 1?', '0, No \\n 1, Yes', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
3985(@project_id, 'plasma2_3', NULL, 'month_3_data', NULL, 94, NULL, NULL, 'select', 'Collected Plasma 2?', '0, No \\n 1, Yes', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
3986(@project_id, 'plasma3_3', NULL, 'month_3_data', NULL, 95, NULL, NULL, 'select', 'Collected Plasma 3?', '0, No \\n 1, Yes', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
3987(@project_id, 'serum1_3', NULL, 'month_3_data', NULL, 96, NULL, NULL, 'select', 'Collected Serum 1?', '0, No \\n 1, Yes', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
3988(@project_id, 'serum2_3', NULL, 'month_3_data', NULL, 97, NULL, NULL, 'select', 'Collected Serum 2?', '0, No \\n 1, Yes', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
3989(@project_id, 'serum3_3', NULL, 'month_3_data', NULL, 98, NULL, NULL, 'select', 'Collected Serum 3?', '0, No \\n 1, Yes', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
3990(@project_id, 'sga_3', NULL, 'month_3_data', NULL, 99, NULL, NULL, 'text', 'Subject Global Assessment (score = 1-7)', NULL, NULL, 'float', '0.9', '7.1', 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3991(@project_id, 'no_show_3', NULL, 'month_3_data', NULL, 100, NULL, NULL, 'text', 'Number of treatments missed', NULL, NULL, 'float', '0', '7', 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3992(@project_id, 'compliance_3', NULL, 'month_3_data', NULL, 101, NULL, NULL, 'select', 'How compliant was the patient in drinking the supplement?', '0, 100 percent \\n 1, 99-75 percent \\n 2, 74-50 percent \\n 3, 49-25 percent \\n 4, 0-24 percent', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
3993(@project_id, 'hospit_3', NULL, 'month_3_data', NULL, 102, NULL, 'Hospitalization Data', 'select', 'Was patient hospitalized since last visit?', '0, No \\n 1, Yes', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
3994(@project_id, 'cause_hosp_3', NULL, 'month_3_data', NULL, 103, NULL, NULL, 'select', 'What was the cause of hospitalization?', '1, Vascular access related events \\n 2, CVD events \\n 3, Other', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
3995(@project_id, 'admission_date_3', NULL, 'month_3_data', NULL, 104, NULL, NULL, 'text', 'Date of hospital admission', NULL, NULL, 'date_ymd', NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3996(@project_id, 'discharge_date_3', NULL, 'month_3_data', NULL, 105, NULL, NULL, 'text', 'Date of hospital discharge', NULL, NULL, 'date_ymd', NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
3997(@project_id, 'discharge_summary_3', NULL, 'month_3_data', NULL, 106, NULL, NULL, 'select', 'Discharge summary in patients binder?', '0, No \\n 1, Yes', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
3998(@project_id, 'death_3', NULL, 'month_3_data', NULL, 107, NULL, 'Mortality Data', 'select', 'Has patient died since last visit?', '0, No \\n 1, Yes', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
3999(@project_id, 'date_death_3', NULL, 'month_3_data', NULL, 108, NULL, NULL, 'text', 'Date of death', NULL, NULL, 'date_ymd', NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
4000(@project_id, 'cause_death_3', NULL, 'month_3_data', NULL, 109, NULL, NULL, 'select', 'What was the cause of death?', '1, All-cause \\n 2, Cardiovascular', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
4001(@project_id, 'month_3_data_complete', NULL, 'month_3_data', NULL, 110, NULL, 'Form Status', 'select', 'Complete?', '0, Incomplete \\n 1, Unverified \\n 2, Complete', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
4002(@project_id, 'complete_study', NULL, 'completion_data', 'Completion Data', 111, NULL, 'Study Completion Information', 'select', 'Has patient completed study?', '0, No \\n 1, Yes', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
4003(@project_id, 'withdraw_date', NULL, 'completion_data', NULL, 112, NULL, NULL, 'text', 'Put a date if patient withdrew study', NULL, NULL, 'date_ymd', NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
4004(@project_id, 'withdraw_reason', NULL, 'completion_data', NULL, 113, NULL, NULL, 'select', 'Reason patient withdrew from study', '0, Non-compliance \\n 1, Did not wish to continue in study \\n 2, Could not tolerate the supplement \\n 3, Hospitalization \\n 4, Other', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
4005(@project_id, 'complete_study_date', NULL, 'completion_data', NULL, 114, NULL, NULL, 'text', 'Date of study completion', NULL, NULL, 'date_ymd', NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL),
4006(@project_id, 'study_comments', NULL, 'completion_data', NULL, 115, NULL, 'General Comments', 'textarea', 'Comments', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL),
4007(@project_id, 'completion_data_complete', NULL, 'completion_data', NULL, 116, NULL, 'Form Status', 'select', 'Complete?', '0, Incomplete \\n 1, Unverified \\n 2, Complete', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL);
4008
4009INSERT INTO `redcap_projects_templates` (`project_id`, `title`, `description`, `enabled`)
4010 VALUES (@project_id, @project_title, 'Contains seven data entry forms for collecting data for a randomized clinical trial. Includes a short demographics form followed by a form where randomization is performed. An example randomization model has already been set up, although randomization allocation tables have not yet been created.', '1');
4011
4012-- Since project is in development, go ahead and pre-check items on Project Setup
4013INSERT INTO redcap_project_checklist (project_id, `name`) VALUES
4014(@project_id, 'design'),
4015(@project_id, 'modify_project'),
4016(@project_id, 'modules');
4017-- SQL TO CREATE A REDCAP DEMO PROJECT --
4018set @project_title = 'Human Cancer Tissue Biobank';
4019
4020
4021-- Obtain default values --
4022set @institution = (select value from redcap_config where field_name = 'institution' limit 1);
4023set @site_org_type = (select value from redcap_config where field_name = 'site_org_type' limit 1);
4024set @grant_cite = (select value from redcap_config where field_name = 'grant_cite' limit 1);
4025set @project_contact_name = (select value from redcap_config where field_name = 'project_contact_name' limit 1);
4026set @project_contact_email = (select value from redcap_config where field_name = 'project_contact_email' limit 1);
4027set @headerlogo = (select value from redcap_config where field_name = 'headerlogo' limit 1);
4028set @auth_meth = (select value from redcap_config where field_name = 'auth_meth_global' limit 1);
4029-- Create project --
4030INSERT INTO `redcap_projects`
4031(project_name, app_title, status, count_project, auth_meth, creation_time, production_time, institution, site_org_type, grant_cite, project_contact_name, project_contact_email, headerlogo, display_project_logo_institution, randomization, auto_inc_set) VALUES
4032(concat('redcap_demo_',LEFT(sha1(rand()),6)), @project_title, 1, 0, @auth_meth, now(), now(), @institution, @site_org_type, @grant_cite, @project_contact_name, @project_contact_email, @headerlogo, 0, 0, 1);
4033set @project_id = LAST_INSERT_ID();
4034-- User rights --
4035INSERT INTO `redcap_user_rights` (`project_id`, `username`, `expiration`, `group_id`, `lock_record`, `data_export_tool`, `data_import_tool`, `data_comparison_tool`, `data_logging`, `file_repository`, `double_data`, `user_rights`, `data_access_groups`, `graphical`, `reports`, `design`, `calendar`, `data_entry`, `data_quality_execute`, random_setup, random_dashboard, random_perform) VALUES
4036(@project_id, 'site_admin', NULL, NULL, 0, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 0, 1, '', 1, 0, 0, 0);
4037-- Create single arm --
4038INSERT INTO redcap_events_arms (project_id, arm_num, arm_name) VALUES (@project_id, 1, 'Arm 1');
4039set @arm_id = LAST_INSERT_ID();
4040-- Create single event --
4041INSERT INTO redcap_events_metadata (arm_id, day_offset, offset_min, offset_max, descrip) VALUES (@arm_id, 0, 0, 0, 'Event 1');
4042set @event_id = LAST_INSERT_ID();
4043-- Insert into redcap_metadata --
4044INSERT INTO redcap_metadata (project_id, field_name, field_phi, form_name, form_menu_description, field_order, field_units, element_preceding_header, element_type, element_label, element_enum, element_note, element_validation_type, element_validation_min, element_validation_max, element_validation_checktype, branching_logic, field_req, edoc_id, edoc_display_img, custom_alignment, stop_actions, question_num, grid_name, misc) VALUES
4045(@project_id, 'lab_id', '0', 'id_shipping', 'ID Shipping', 1, NULL, 'IDs', 'text', 'Lab ID', NULL, NULL, NULL, NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4046(@project_id, 'trc_id', NULL, 'id_shipping', NULL, 2, NULL, NULL, 'text', 'TRC ID', NULL, NULL, NULL, NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4047(@project_id, 'first_name', '1', 'id_shipping', NULL, 3, NULL, NULL, 'text', 'First Name', NULL, NULL, NULL, NULL, NULL, 'soft_typed', NULL, 1, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4048(@project_id, 'middle_name', NULL, 'id_shipping', NULL, 4, NULL, NULL, 'text', 'Middle Name', NULL, NULL, NULL, NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4049(@project_id, 'last_name', '1', 'id_shipping', NULL, 5, NULL, NULL, 'text', 'Last Name', NULL, NULL, NULL, NULL, NULL, 'soft_typed', NULL, 1, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4050(@project_id, 'suffix', NULL, 'id_shipping', NULL, 6, NULL, NULL, 'text', 'Suffix', NULL, NULL, NULL, NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4051(@project_id, 'date_of_birth', '1', 'id_shipping', NULL, 7, NULL, NULL, 'text', 'Date of Birth', NULL, NULL, 'date_mdy', NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4052(@project_id, 'age', NULL, 'id_shipping', NULL, 8, NULL, NULL, 'text', 'Age', NULL, 'Age at surgery, DOB not available', 'float', NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4053(@project_id, 'facility_name', NULL, 'id_shipping', NULL, 9, NULL, 'Shipping Information', 'text', 'Facility_Name', NULL, NULL, NULL, NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4054(@project_id, 'facility_city', NULL, 'id_shipping', NULL, 10, NULL, NULL, 'text', 'Facility_City', NULL, NULL, NULL, NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4055(@project_id, 'facility_state', NULL, 'id_shipping', NULL, 11, NULL, NULL, 'text', 'Facility_State', NULL, NULL, NULL, NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4056(@project_id, 'receivedate', '1', 'id_shipping', NULL, 12, NULL, NULL, 'text', 'ReceiveDate', NULL, NULL, 'date_mdy', NULL, NULL, 'soft_typed', NULL, 1, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4057(@project_id, 'shipmethod', NULL, 'id_shipping', NULL, 13, NULL, NULL, 'select', 'ShipMethod', '1, FedEx \\n 2, USPS \\n 3, UPS \\n 4, ByPerson \\n 5, Others', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4058(@project_id, 'trackingnumber', NULL, 'id_shipping', NULL, 14, NULL, NULL, 'text', 'ReceiveTracking', NULL, NULL, NULL, NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4059(@project_id, 'pathaccnumber', '1', 'id_shipping', NULL, 15, NULL, NULL, 'text', 'PathAccNumber', NULL, NULL, NULL, NULL, NULL, 'soft_typed', NULL, 1, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4060(@project_id, 'otheraccnumber2', NULL, 'id_shipping', NULL, 16, NULL, NULL, 'text', 'OtherAccNumber', NULL, NULL, NULL, NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4061(@project_id, 'blk_no_received', NULL, 'id_shipping', NULL, 17, NULL, NULL, 'text', 'Block_ Received', NULL, NULL, 'float', NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4062(@project_id, 'stainedslide_received', NULL, 'id_shipping', NULL, 18, NULL, NULL, 'text', 'StainedSlide_Received', NULL, NULL, 'float', NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4063(@project_id, 'unstainedslide_received', NULL, 'id_shipping', NULL, 19, NULL, NULL, 'text', 'UnstainedSlide_Received', NULL, NULL, 'float', NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4064(@project_id, 'return_needed', NULL, 'id_shipping', NULL, 20, NULL, NULL, 'yesno', 'Return_Needed?', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4065(@project_id, 'return_date', NULL, 'id_shipping', NULL, 21, NULL, NULL, 'text', 'ReturnDate', NULL, NULL, 'date_mdy', NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4066(@project_id, 'return_tracking', NULL, 'id_shipping', NULL, 22, NULL, NULL, 'text', 'ReturnTracking', NULL, NULL, NULL, NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4067(@project_id, 'labcirculation_time', NULL, 'id_shipping', NULL, 23, NULL, NULL, 'calc', 'LabCirculation_time', 'round(datediff([receivedate],[return_date],"d","mdy"))', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4068(@project_id, 'followup_note', NULL, 'id_shipping', NULL, 24, NULL, NULL, 'textarea', 'FollowUp_Note', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4069(@project_id, 'secondtime_getsample', NULL, 'id_shipping', NULL, 25, NULL, 'If Receive Sample 2nd Time', 'yesno', '2nd_Time_Receive', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4070(@project_id, 'follow_up_needed2', NULL, 'id_shipping', NULL, 26, NULL, NULL, 'yesno', 'Follow up needed?', NULL, NULL, NULL, NULL, NULL, NULL, '[secondtime_getsample] = ''1''', 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4071(@project_id, 'collection_note2', NULL, 'id_shipping', NULL, 27, NULL, NULL, 'textarea', 'FollowUp_Note2', NULL, NULL, NULL, NULL, NULL, NULL, '[follow_up_needed2] = ''1'' and [secondtime_getsample] = ''1''', 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4072(@project_id, 'samefacasbefore', NULL, 'id_shipping', NULL, 28, NULL, NULL, 'yesno', 'SameFacilityAsBefore?', NULL, NULL, NULL, NULL, NULL, NULL, '[secondtime_getsample] = ''1''', 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4073(@project_id, 'facility_name2', NULL, 'id_shipping', NULL, 29, NULL, NULL, 'text', 'Facility_Name2', NULL, NULL, NULL, NULL, NULL, 'soft_typed', '[samefacasbefore] = ''0'' and [secondtime_getsample] = ''1''', 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4074(@project_id, 'facility_city2', NULL, 'id_shipping', NULL, 30, NULL, NULL, 'text', 'Facility_City2', NULL, NULL, NULL, NULL, NULL, 'soft_typed', '[secondtime_getsample] = ''1'' and [samefacasbefore] = ''0''', 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4075(@project_id, 'facility_state2', NULL, 'id_shipping', NULL, 31, NULL, NULL, 'text', 'Facility_State2', NULL, NULL, NULL, NULL, NULL, 'soft_typed', '[secondtime_getsample] = ''1'' and [samefacasbefore] = ''0''', 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4076(@project_id, 'receivedate2', NULL, 'id_shipping', NULL, 32, NULL, NULL, 'text', 'ReceiveDate2', NULL, NULL, 'date_mdy', NULL, NULL, 'soft_typed', '[secondtime_getsample] = ''1''', 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4077(@project_id, 'shipmethod2', NULL, 'id_shipping', NULL, 33, NULL, NULL, 'select', 'ShipMethod2', '1, FedEx \\n 2, USPS \\n 3, UPS \\n 4, ByPerson \\n 5, Others', NULL, NULL, NULL, NULL, NULL, '[secondtime_getsample] = ''1''', 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4078(@project_id, 'receivetracking2', NULL, 'id_shipping', NULL, 34, NULL, NULL, 'text', 'ReceiveTracking2', NULL, NULL, NULL, NULL, NULL, 'soft_typed', '[secondtime_getsample] = ''1''', 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4079(@project_id, 'pathaccnumber2', NULL, 'id_shipping', NULL, 35, NULL, NULL, 'text', 'PathAccNumber', NULL, NULL, NULL, NULL, NULL, 'soft_typed', '[secondtime_getsample] = ''1''', 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4080(@project_id, 'otheraccnumber', NULL, 'id_shipping', NULL, 36, NULL, NULL, 'text', 'OtherAccNumber', NULL, NULL, NULL, NULL, NULL, 'soft_typed', '[secondtime_getsample] = ''1''', 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4081(@project_id, 'block_received2', NULL, 'id_shipping', NULL, 37, NULL, NULL, 'text', 'Block_ Received2', NULL, NULL, 'float', NULL, NULL, 'soft_typed', '[secondtime_getsample] = ''1''', 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4082(@project_id, 'stainedslide_received2', NULL, 'id_shipping', NULL, 38, NULL, NULL, 'text', 'StainedSlide_Received2', NULL, NULL, 'float', NULL, NULL, 'soft_typed', '[secondtime_getsample] = ''1''', 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4083(@project_id, 'unstainedslide_received2', NULL, 'id_shipping', NULL, 39, NULL, NULL, 'text', 'UnstainedSlide_Received2', NULL, NULL, 'float', NULL, NULL, 'soft_typed', '[secondtime_getsample] = ''1''', 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4084(@project_id, 'return_needed2', NULL, 'id_shipping', NULL, 40, NULL, NULL, 'yesno', 'Return_needed?', NULL, NULL, NULL, NULL, NULL, NULL, '[secondtime_getsample] = ''1''', 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4085(@project_id, 'returndate2', NULL, 'id_shipping', NULL, 41, NULL, NULL, 'text', 'ReturnDate2', NULL, NULL, 'date_mdy', NULL, NULL, 'soft_typed', '[return_needed2] = ''1'' and [secondtime_getsample] = ''1''', 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4086(@project_id, 'return_tracking2', NULL, 'id_shipping', NULL, 42, NULL, NULL, 'text', 'ReturnTracking2', NULL, NULL, NULL, NULL, NULL, 'soft_typed', '[return_needed2] = ''1'' and [secondtime_getsample] = ''1''', 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4087(@project_id, 'thirdtime_getsample', NULL, 'id_shipping', NULL, 43, NULL, 'If Receive Sample 3rd Time', 'yesno', '3rd_Time_Receive', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4088(@project_id, 'follow_up_needed3', NULL, 'id_shipping', NULL, 44, NULL, NULL, 'yesno', 'Follow up needed?', NULL, NULL, NULL, NULL, NULL, NULL, '[thirdtime_getsample] = ''1''', 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4089(@project_id, 'collection_note3', NULL, 'id_shipping', NULL, 45, NULL, NULL, 'textarea', 'FollowUp_Note', NULL, NULL, NULL, NULL, NULL, NULL, '[follow_up_needed3] = ''1'' and [thirdtime_getsample] = ''1''', 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4090(@project_id, 'samefacilityasbefore2', NULL, 'id_shipping', NULL, 46, NULL, NULL, 'yesno', 'SameFacilityAsBefore?', NULL, NULL, NULL, NULL, NULL, NULL, '[thirdtime_getsample] = ''1''', 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4091(@project_id, 'facility_name3', NULL, 'id_shipping', NULL, 47, NULL, NULL, 'text', 'Facility_Name3', NULL, NULL, NULL, NULL, NULL, 'soft_typed', '[samefacilityasbefore2] = ''0'' and [thirdtime_getsample] = ''1''', 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4092(@project_id, 'facility_city3', NULL, 'id_shipping', NULL, 48, NULL, NULL, 'text', 'Facility_City3', NULL, NULL, NULL, NULL, NULL, 'soft_typed', '[samefacilityasbefore2] = ''0'' and [thirdtime_getsample] = ''1''', 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4093(@project_id, 'facility_state3', NULL, 'id_shipping', NULL, 49, NULL, NULL, 'text', 'Facility_State3', NULL, NULL, NULL, NULL, NULL, 'soft_typed', '[samefacilityasbefore2] = ''0'' and [thirdtime_getsample] = ''1''', 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4094(@project_id, 'receivedate3', NULL, 'id_shipping', NULL, 50, NULL, NULL, 'text', 'ReceiveDate3', NULL, NULL, 'date_mdy', NULL, NULL, 'soft_typed', '[thirdtime_getsample] = ''1''', 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4095(@project_id, 'shipmethod3', NULL, 'id_shipping', NULL, 51, NULL, NULL, 'select', 'ShipMethod3', '1, FedEx \\n 2, USPS \\n 3, UPS \\n 4, ByPerson \\n 5, Others', NULL, NULL, NULL, NULL, NULL, '[thirdtime_getsample] = ''1''', 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4096(@project_id, 'receivetracking3', NULL, 'id_shipping', NULL, 52, NULL, NULL, 'text', 'ReceiveTracking3', NULL, NULL, NULL, NULL, NULL, 'soft_typed', '[thirdtime_getsample] = ''1''', 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4097(@project_id, 'pathaccnumber3', NULL, 'id_shipping', NULL, 53, NULL, NULL, 'text', 'PathAccNumber3', NULL, NULL, NULL, NULL, NULL, 'soft_typed', '[thirdtime_getsample] = ''1''', 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4098(@project_id, 'otheraccnumber3', NULL, 'id_shipping', NULL, 54, NULL, NULL, 'text', 'OtherAccNumber', NULL, NULL, NULL, NULL, NULL, 'soft_typed', '[thirdtime_getsample] = ''1''', 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4099(@project_id, 'block_received3', NULL, 'id_shipping', NULL, 55, NULL, NULL, 'text', 'Block_ Received3', NULL, NULL, 'float', NULL, NULL, 'soft_typed', '[thirdtime_getsample] = ''1''', 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4100(@project_id, 'stainedslide_received3', NULL, 'id_shipping', NULL, 56, NULL, NULL, 'text', 'StainedSlide_Received3', NULL, NULL, 'float', NULL, NULL, 'soft_typed', '[thirdtime_getsample] = ''1''', 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4101(@project_id, 'unstainedslide_received3', NULL, 'id_shipping', NULL, 57, NULL, NULL, 'text', 'UnstainedSlide_Received3', NULL, NULL, 'float', NULL, NULL, 'soft_typed', '[thirdtime_getsample] = ''1''', 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4102(@project_id, 'return_needed3', NULL, 'id_shipping', NULL, 58, NULL, NULL, 'yesno', 'Return_needed?', NULL, NULL, NULL, NULL, NULL, NULL, '[thirdtime_getsample] = ''1''', 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4103(@project_id, 'returndate3', NULL, 'id_shipping', NULL, 59, NULL, NULL, 'text', 'ReturnDate3', NULL, NULL, 'date_mdy', NULL, NULL, 'soft_typed', '[return_needed3] = ''1'' and [thirdtime_getsample] = ''1''', 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4104(@project_id, 'returntracking3', NULL, 'id_shipping', NULL, 60, NULL, NULL, 'text', 'ReturnTracking3', NULL, NULL, NULL, NULL, NULL, 'soft_typed', '[return_needed3] = ''1'' and [thirdtime_getsample] = ''1''', 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4105(@project_id, 'id_shipping_complete', NULL, 'id_shipping', NULL, 61, NULL, 'Form Status', 'select', 'Complete?', '0, Incomplete \\n 1, Unverified \\n 2, Complete', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4106(@project_id, 'tumor_origin', NULL, 'pathology_review', 'Pathology Review', 62, NULL, 'Tumor Origin and Location', 'select', 'Tumor_Origin', '1, Breast \\n 2, Prostate \\n 3, Colorectum \\n 4, Lung \\n 5, Others', NULL, NULL, NULL, NULL, NULL, NULL, 1, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4107(@project_id, 'specify_other_origin', NULL, 'pathology_review', NULL, 63, NULL, NULL, 'text', 'Specify_Other_Origin', NULL, NULL, NULL, NULL, NULL, 'soft_typed', '[tumor_origin] = ''5''', 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4108(@project_id, 'tumor_location', NULL, 'pathology_review', NULL, 64, NULL, NULL, 'select', 'Location_Breast_Prostate', '1, Left \\n 2, Right \\n 3, Bilateral \\n 4, Multiple \\n 5, Unclear', 'Multiple means 2 or more', NULL, NULL, NULL, NULL, '[tumor_origin] = ''1'' or [tumor_origin] = ''2''', 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4109(@project_id, 'tumor_location_colorectum', NULL, 'pathology_review', NULL, 65, NULL, NULL, 'select', 'Location_Colorectum', '1, Appendix \\n 2, Cecum \\n 3, Ascending \\n 4, Hepatic Flexure \\n 5, Transverse \\n 6, Splenic Flexure \\n 7, Descending \\n 8, Sigmoid \\n 9, Rectum \\n 10, Anus \\n 11, Left \\n 12, Right \\n 13, Unclear', NULL, NULL, NULL, NULL, NULL, '[tumor_origin] = ''3''', 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4110(@project_id, 'tumor_location_lung', NULL, 'pathology_review', NULL, 66, NULL, NULL, 'select', 'Location_Lung', '1, Right Upper Lobe \\n 2, Right Middle Lobe \\n 3, Right Lower Lobe \\n 4, Left Upper Lobe \\n 5, Left Lower Lobe \\n 6, Right Bronchus \\n 7, Left Bronchus \\n 8, Right \\n 9, Left \\n 10, Unclear \\n 11, Others (specify it)', NULL, NULL, NULL, NULL, NULL, '[tumor_origin] = ''4''', 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4111(@project_id, 'other_location_lung', NULL, 'pathology_review', NULL, 67, NULL, NULL, 'text', 'Other location_lung', NULL, NULL, NULL, NULL, NULL, 'soft_typed', '[tumor_origin] = ''4'' and [tumor_location_lung] = ''11''', 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4112(@project_id, 'specify_other_location', NULL, 'pathology_review', NULL, 68, NULL, NULL, 'text', 'Specify_Other_Location', NULL, NULL, NULL, NULL, NULL, 'soft_typed', '[tumor_origin] = ''5''', 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4113(@project_id, 'date_surgery', NULL, 'pathology_review', NULL, 69, NULL, 'Clinical Pathology Information', 'text', 'Date_Surgery', NULL, NULL, 'date_mdy', NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4114(@project_id, 'age_at_surgery', NULL, 'pathology_review', NULL, 70, NULL, NULL, 'calc', 'Age at Surgery', 'round(datediff([date_of_birth],[date_surgery],"y","mdy",true),0)', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4115(@project_id, 'gender', NULL, 'pathology_review', NULL, 71, NULL, NULL, 'select', 'Gender', '0, Female \\n 1, Male \\n 2, Other \\n 3, Prefer not to say', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4116(@project_id, 'pathol_acc_no', '1', 'pathology_review', NULL, 72, NULL, NULL, 'text', 'Pathol_Acc_No', NULL, NULL, NULL, NULL, NULL, 'soft_typed', NULL, 1, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4117(@project_id, 'other_acc_no', NULL, 'pathology_review', NULL, 73, NULL, NULL, 'text', 'Other_Acc_No', NULL, NULL, NULL, NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4118(@project_id, 'block_tumor', NULL, 'pathology_review', NULL, 74, NULL, NULL, 'text', 'BlockNum_Tumor', NULL, NULL, NULL, NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4119(@project_id, 'block_normal', NULL, 'pathology_review', NULL, 75, NULL, NULL, 'text', 'BlockNum_Normal', NULL, NULL, NULL, NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4120(@project_id, 'block_metastatic', NULL, 'pathology_review', NULL, 76, NULL, NULL, 'text', 'BlockNum_Metastatic', NULL, NULL, NULL, NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4121(@project_id, 'block_precancerous', NULL, 'pathology_review', NULL, 77, NULL, NULL, 'text', 'BlockNum_Precancerous', NULL, NULL, NULL, NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4122(@project_id, 'invitrosize1', NULL, 'pathology_review', NULL, 78, NULL, NULL, 'text', 'InvitroSize1', NULL, 'Maximum size in centimeter', 'float', NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4123(@project_id, 'invitrosize2', NULL, 'pathology_review', NULL, 79, NULL, NULL, 'text', 'InvitroSize2', NULL, 'In % of total tissue volume for prostate cancer', 'float', NULL, NULL, 'soft_typed', '[tumor_origin] = ''2''', 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4124(@project_id, 'invitrosize3', NULL, 'pathology_review', NULL, 80, NULL, NULL, 'text', 'InvitroSize3', NULL, 'The seceond largest tumor', NULL, NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4125(@project_id, 'perineuralinvasion', NULL, 'pathology_review', NULL, 81, NULL, NULL, 'select', 'PerineuralInvasion', '0, No \\n 1, Yes \\n 2, N/A', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4126(@project_id, 'vascular_invasion', NULL, 'pathology_review', NULL, 82, NULL, NULL, 'select', 'Vascular invasion present', '0, No \\n 1, Yes \\n 2, N/A', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4127(@project_id, 'surgical_margin_cancer_pre', NULL, 'pathology_review', NULL, 83, NULL, NULL, 'select', 'Surgical margin cancer present', '0, No \\n 1, Yes \\n 2, N/A', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4128(@project_id, 'clin_diagn_breast', NULL, 'pathology_review', NULL, 84, NULL, 'For Breast Cancer Samples', 'select', 'Clin_Diagn_Breast', '1, Noninvasive carcinoma (NOS) \\n 2, Ductal carcinoma in situ \\n 3, Lobular carcinoma in situ \\n 4, Paget disease without invasive carcinoma \\n 5, Invasive carcinoma (NOS) \\n 6, Invasive ductal carcinoma \\n 7, IDC with an extensive intraductal component \\n 8, IDC with Paget disease \\n 9, Invasive lobular \\n 10, Mucinous \\n 11, Medullary \\n 12, Papillary \\n 13, Tubular \\n 14, Adenoid cystic \\n 15, Secretory (juvenile) \\n 16, Apocrine \\n 17, Cribriform \\n 18, Carcinoma with squamous metaplasia \\n 19, Carcinoma with spindle cell metaplasia \\n 20, Carcinoma with cartilaginous/osseous metaplasia \\n 21, Carcinoma with metaplasia, mixed type \\n 22, Other(s) (specify) \\n 23, Not assessable \\n 24, No cancer tissue \\n 25, IDC+ILC (50 -90% each component)', NULL, NULL, NULL, NULL, NULL, '[tumor_origin] = ''1''', 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4129(@project_id, 'lab_diagn_breast', NULL, 'pathology_review', NULL, 85, NULL, NULL, 'select', 'Lab_Diagn_Breast', '1, Noninvasive carcinoma (NOS) \\n 2, Ductal carcinoma in situ \\n 3, Lobular carcinoma in situ \\n 4, Paget disease without invasive carcinoma \\n 5, Invasive carcinoma (NOS) \\n 6, Invasive ductal carcinoma \\n 7, IDC with an extensive intraductal component \\n 8, IDC with Paget disease \\n 9, Invasive lobular \\n 10, Mucinous \\n 11, Medullary \\n 12, Papillary \\n 13, Tubular \\n 14, Adenoid cystic \\n 15, Secretory (juvenile) \\n 16, Apocrine \\n 17, Cribriform \\n 18, Carcinoma with squamous metaplasia \\n 19, Carcinoma with spindle cell metaplasia \\n 20, Carcinoma with cartilaginous/osseous metaplasia \\n 21, Carcinoma with metaplasia, mixed type \\n 22, Other(s) (specify) \\n 23, Not assessable \\n 24, No cancer tissue \\n 25, IDC+ILC (50 -90% each component)', NULL, NULL, NULL, NULL, NULL, '[tumor_origin] = ''1''', 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4130(@project_id, 'if_ilc_subtype', NULL, 'pathology_review', NULL, 86, NULL, NULL, 'select', 'ILC_Subtype', '901, classical ILC \\n 902, solid ILC \\n 903, pleomorphic ILC \\n 904, alveolar ILC \\n 905, tubulolobular ILC \\n 906, mixed ILC \\n 907, signet ring cell ILC \\n 908, others', NULL, NULL, NULL, NULL, NULL, '[tumor_origin] = ''1'' and [lab_diagn_breast] = ''9''', 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4131(@project_id, 'specify_if_other_type_br', NULL, 'pathology_review', NULL, 87, NULL, NULL, 'text', 'Specify_If_Other_Type_Br', NULL, NULL, NULL, NULL, NULL, 'soft_typed', '[tumor_origin] = ''1''', 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4132(@project_id, 'clin_grade_breast', NULL, 'pathology_review', NULL, 88, NULL, NULL, 'select', 'Clin_Grade_Breast', '1, 1 \\n 2, 2 \\n 3, 3 \\n 4, 1~2 \\n 5, 2~3 \\n 6, N/A', NULL, NULL, NULL, NULL, NULL, '[tumor_origin] = ''1''', 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4133(@project_id, 'lab_grade_breast', NULL, 'pathology_review', NULL, 89, NULL, NULL, 'select', 'Lab_Grade_Breast', '1, 1 \\n 2, 2 \\n 3, 3 \\n 4, N/A', NULL, NULL, NULL, NULL, NULL, '[tumor_origin] = ''1''', 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4134(@project_id, 'estrogen_receptor', NULL, 'pathology_review', NULL, 90, NULL, NULL, 'select', 'Estrogen Receptor', '0, negative \\n 1, week (<1%) \\n 2, positive (>=1%) \\n 3, N/A', NULL, NULL, NULL, NULL, NULL, '[tumor_origin] = ''1''', 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4135(@project_id, 'progesterone_receptor', NULL, 'pathology_review', NULL, 91, NULL, NULL, 'select', 'Progesterone Receptor', '0, negative (0~2) \\n 1, week (3~4) \\n 2, intermediate (5~6) \\n 3, strong (7~8) \\n 4, N/A', 'Allred Score System 0-8', NULL, NULL, NULL, NULL, '[tumor_origin] = ''1''', 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4136(@project_id, 'her2_immunohistochemistry', NULL, 'pathology_review', NULL, 92, NULL, NULL, 'select', 'HER2_Immunohistochemistry', '0, 0 \\n 1, 1 (1~9% cells positivity) \\n 2, 2 (10-30% cells positivity) \\n 3, 3 (>30% cells positivity with strong color) \\n 4, N/A', NULL, NULL, NULL, NULL, NULL, '[tumor_origin] = ''1''', 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4137(@project_id, 'her2_fish', NULL, 'pathology_review', NULL, 93, NULL, NULL, 'select', 'HER2_FISH', '0, 0 (Non-Amplified, <1.8) \\n 1, 1 (Amplified, >2.2) \\n 2, 2 (Borderline, 1.8~2.2) \\n 3, N/A', NULL, NULL, NULL, NULL, NULL, '[tumor_origin] = ''1''', 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4138(@project_id, 'bc_molecularsubtype', NULL, 'pathology_review', NULL, 94, NULL, NULL, 'select', 'BC_MolecularSubtype', '1, Luminal A \\n 2, Luminal B \\n 3, HER2 \\n 4, Triple Negative \\n 5, N/A', NULL, NULL, NULL, NULL, NULL, '[tumor_origin] = ''1''', 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4139(@project_id, 'ki_67', NULL, 'pathology_review', NULL, 95, NULL, NULL, 'text', 'Ki-67', NULL, 'positive cells in percentage', 'float', NULL, NULL, 'soft_typed', '[tumor_origin] = ''1''', 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4140(@project_id, 'p53_ihc', NULL, 'pathology_review', NULL, 96, NULL, NULL, 'text', 'p53_IHC', NULL, 'positive cells in percentage', NULL, NULL, NULL, 'soft_typed', '[tumor_origin] = ''1''', 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4141(@project_id, 'dna_index', NULL, 'pathology_review', NULL, 97, NULL, NULL, 'text', 'DNA Index', NULL, 'Unfavorable: >1.1', NULL, NULL, NULL, 'soft_typed', '[tumor_origin] = ''1''', 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4142(@project_id, 'bc_precancerous', NULL, 'pathology_review', NULL, 98, NULL, NULL, 'select', 'BC_Precancerous', '1, Not seen \\n 2, DCIS \\n 3, LCIS \\n 4, DCIS+LCIS', NULL, NULL, NULL, NULL, NULL, '[tumor_origin] = ''1''', 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4143(@project_id, 'tnm_breast_tumor', NULL, 'pathology_review', NULL, 99, NULL, NULL, 'select', 'TNMbreast_PrimTum(T)', '1, TX:Primary tumor cannot be assessed \\n 2, T0:No evidence of primary tumor \\n 3, Tis:DCIS/LCIS/Paget''s dis w/o associated tumor \\n 4, T1mic:Microinvasion <=0.1 cm \\n 5, T1a:>0.1 but <=0.5 cm \\n 6, T1b:>0.5 cm but <=1.0 cm \\n 7, T1c:>1.0 cm but <=2.0 cm \\n 8, T2:Tumor >2.0 cm but <=5.0 cm \\n 9, T3:Tumor >5.0 cm \\n 10, T4a:Any size with direct extension to chest wall \\n 11, T4b:skin Edema/ulceration;satellite skin nodules \\n 12, T4c:Both of T4a and T4b \\n 13, T4d:Inflammatory carcinoma', NULL, NULL, NULL, NULL, NULL, '[tumor_origin] = ''1''', 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4144(@project_id, 'tnmbreast_ln_n', NULL, 'pathology_review', NULL, 100, NULL, NULL, 'select', 'TNMbreast_LN (N)', '1, NX: Regional LNs cannot be assessed \\n 2, N0: No regional LNs metastasis \\n 3, N1: Movable ipsilateral axillary LN(s) \\n 4, N2: Ipsilateral axillary LN(s) fixed \\n 5, N3: Ipsilateral internal mammary LN(s) \\n 6, pNX: Regional LNs cannot be assessed \\n 7, pN0: No regional LNs metastasis \\n 8, pN1: movable ipsilateral axillary LN(s) \\n 9, pN1a:Only micrometastasis <=0.2 cm \\n 10, pN1b: Metastasis any >0.2 cm \\n 11, pN1bi:1 to 3 LNs, any >0.2 cm and all <2.0 cm \\n 12, pN1bii: >=4 LN3, any >0.2 cm and all <2.0 cm \\n 13, pN1biii: beyond LN capsule,metastasis <2.0 cm \\n 14, pN1biv: Metastasis to a LN >=2.0 cm \\n 15, pN2: to ipsilateral axillaryLN(s) fixed \\n 16, pN3: to ipsilateral internal mammary LN(s) \\n 17, pN0(i+)', NULL, NULL, NULL, NULL, NULL, '[tumor_origin] = ''1''', 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4145(@project_id, 'tnmbreast_distantmetast_m', NULL, 'pathology_review', NULL, 101, NULL, NULL, 'select', 'TNMbreast_DistantMetast (M)', '1, MX: cannot be assessed \\n 2, M0: No distant metastasis \\n 3, M1: yes includes ipsilateral supraclavicular LNs', NULL, NULL, NULL, NULL, NULL, '[tumor_origin] = ''1''', 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4146(@project_id, 'clin_diagn_prostate', NULL, 'pathology_review', NULL, 102, NULL, 'For Prostate Cancer Samples', 'select', 'Clin_Diagn_Prostate', '1, Adenocarcinoma,NOS \\n 2, Prostatic duct adenocarcinoma \\n 3, Mucinous adenocarcinoma \\n 4, Signet-ring cell carcinoma \\n 5, Adenosquemous carcinoma \\n 6, Small cell carcinoma \\n 7, Sarcomatoid carcinoma \\n 8, Other (specifiy) \\n 9, Undifferentiated carcinoma, NOS \\n 10, Cannot be determined', NULL, NULL, NULL, NULL, NULL, '[tumor_origin] = ''2''', 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4147(@project_id, 'lab_diag_prostate', NULL, 'pathology_review', NULL, 103, NULL, NULL, 'select', 'Lab_Diag_Prostate', '1, Adenocarcinoma,NOS \\n 2, Prostatic duct adenocarcinoma \\n 3, Mucinous adenocarcinoma \\n 4, Signet-ring cell carcinoma \\n 5, Adenosquemous carcinoma \\n 6, Small cell carcinoma \\n 7, Sarcomatoid carcinoma \\n 8, Other (specifiy) \\n 9, Undifferentiated carcinoma, NOS \\n 10, Cannot be determined', NULL, NULL, NULL, NULL, NULL, '[tumor_origin] = ''2''', 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4148(@project_id, 'specify_if_other_type_pro', NULL, 'pathology_review', NULL, 104, NULL, NULL, 'text', 'Specify_If_Other_type_Pro', NULL, NULL, NULL, NULL, NULL, 'soft_typed', '[tumor_origin] = ''2''', 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4149(@project_id, 'clin_gleason_score', NULL, 'pathology_review', NULL, 105, NULL, NULL, 'text', 'Clin_Gleason_Score', NULL, NULL, NULL, NULL, NULL, 'soft_typed', '[tumor_origin] = ''2''', 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4150(@project_id, 'clin_grade_pro', NULL, 'pathology_review', NULL, 106, NULL, NULL, 'select', 'Clin_Grade_Pro', '1, Low(1-4) \\n 2, Intermediate(5-7) \\n 3, High(8-10)', 'Gleason Score System', NULL, NULL, NULL, NULL, '[tumor_origin] = ''2''', 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4151(@project_id, 'lab_gleason_score', NULL, 'pathology_review', NULL, 107, NULL, NULL, 'text', 'Lab_Gleason_Score', NULL, NULL, NULL, NULL, NULL, 'soft_typed', '[tumor_origin] = ''2''', 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4152(@project_id, 'lab_grade_pro', NULL, 'pathology_review', NULL, 108, NULL, NULL, 'select', 'Lab_Grade_Pro', '1, Low(1-4) \\n 2, Intermediate(5-7) \\n 3, High(8-10)', 'Gleason Score System (1-10)', NULL, NULL, NULL, NULL, '[tumor_origin] = ''2''', 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4153(@project_id, 'tnmprostate_t', NULL, 'pathology_review', NULL, 109, NULL, NULL, 'select', 'TNMprostate_T', '1, T1: Microscopic, DRE/Ultrasound undetectable \\n 2, T1a: <=5 percent \\n 3, T1b: >5 percent \\n 4, T1c: as F/U of screening w/ high PSA \\n 5, T2: within prost, DRE/ultrasound detectable \\n 6, T2a: >half of one lobe \\n 7, T2b: >half of one lobe,DRE detectable often \\n 8, T2c: involve both lobes \\n 9, T3: surrounding tissues or seminal vesicles \\n 10, T3a: outside prostate on one side \\n 11, T3b: outside prostate on both sides \\n 12, T3c: to one or both seminal tubes \\n 13, T4a: to bladder or rectum \\n 14, T4b: beyond prostate or levator muscles \\n 15, TX', NULL, NULL, NULL, NULL, NULL, '[tumor_origin] = ''2''', 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4154(@project_id, 'tnmprostate_n', NULL, 'pathology_review', NULL, 110, NULL, NULL, 'select', 'TNMprostate_N', '1, N0: not to pelvic LN \\n 2, N1: a single pelvic LN,<= 2 cm \\n 3, N2: a single pelvic LN,2-5cm \\n 4, N3: >5 cm in size \\n 5, NX', NULL, NULL, NULL, NULL, NULL, '[tumor_origin] = ''2''', 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4155(@project_id, 'tnmprostate_m', NULL, 'pathology_review', NULL, 111, NULL, NULL, 'select', 'TNMprostate_M', '1, M0: spread only regionally in pelvic area \\n 2, M1: spread beyond pelvic area \\n 3, MX', NULL, NULL, NULL, NULL, NULL, '[tumor_origin] = ''2''', 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4156(@project_id, 'psa_level', NULL, 'pathology_review', NULL, 112, NULL, NULL, 'text', 'PSA_Level', NULL, 'ng/mL', NULL, NULL, NULL, 'soft_typed', '[tumor_origin] = ''2''', 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4157(@project_id, 'seminalinvasion', NULL, 'pathology_review', NULL, 113, NULL, NULL, 'select', 'SeminalInvasion', '0, No \\n 1, Yes \\n 2, N/A', NULL, NULL, NULL, NULL, NULL, '[tumor_origin] = ''2''', 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4158(@project_id, 'extraprostate_extention', NULL, 'pathology_review', NULL, 114, NULL, NULL, 'select', 'ExtraProstate Extention', '0, No \\n 1, Yes \\n 2, N/A', NULL, NULL, NULL, NULL, NULL, '[tumor_origin] = ''2''', 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4159(@project_id, 'clin_giag_colon', NULL, 'pathology_review', NULL, 115, NULL, 'For Colon Cancer Samples', 'select', 'Clin_Diagn_Colon', '1, 1 Adenocarcinoma \\n 2, 2 Mucinous adenocarcinoma \\n 3, 3 Medullary carcinoma \\n 4, 4 Signet ring cell carcinoma \\n 5, 5 Small cell carcinoma \\n 6, 6 Squamous cell carcinoma \\n 7, 7 Adenosquamous carcinoma \\n 8, 8 Others \\n 9, 9 Adenoma', NULL, NULL, NULL, NULL, NULL, '[tumor_origin] = ''3''', 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4160(@project_id, 'specify_colon_clin', NULL, 'pathology_review', NULL, 116, NULL, NULL, 'text', 'If others_specify', NULL, NULL, NULL, NULL, NULL, 'soft_typed', '[tumor_origin] = ''3'' and [clin_giag_colon] = ''8''', 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4161(@project_id, 'lab_diagn_colon', NULL, 'pathology_review', NULL, 117, NULL, NULL, 'select', 'Lab_Diagn_Colon', '1, 1 Adenocarcinoma \\n 2, 2 Mucinous adenocarcinoma \\n 3, 3 Medullary carcinoma \\n 4, 4 Signet ring cell carcinoma \\n 5, 5 Small cell carcinoma \\n 6, 6 Squamous cell carcinoma \\n 7, 7 Adenosquamous carcinoma \\n 8, 8 Others \\n 9, 9 Adenoma', NULL, NULL, NULL, NULL, NULL, '[tumor_origin] = ''3''', 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4162(@project_id, 'specify_colon_lab', NULL, 'pathology_review', NULL, 118, NULL, NULL, 'text', 'If others_specify', NULL, NULL, NULL, NULL, NULL, 'soft_typed', '[tumor_origin] = ''3'' and [lab_diagn_colon] = ''8''', 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4163(@project_id, 'clin_grade_colon', NULL, 'pathology_review', NULL, 119, NULL, NULL, 'select', 'Clin_Grade_Colon', '1, Low \\n 2, Intermediate \\n 3, High \\n 4, N/A \\n 5, Low-Intermediate \\n 6, Intermediate-High', NULL, NULL, NULL, NULL, NULL, '[tumor_origin] = ''3''', 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4164(@project_id, 'lab_grade_colon', NULL, 'pathology_review', NULL, 120, NULL, NULL, 'select', 'Lab_Grade_Colon', '1, Low \\n 2, Intermediate \\n 3, High \\n 4, N/A', NULL, NULL, NULL, NULL, NULL, '[tumor_origin] = ''3''', 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4165(@project_id, 'tnmcolon_t', NULL, 'pathology_review', NULL, 121, NULL, NULL, 'select', 'TNMcolon_T', 'Tx, Tx \\n Tis, Tis earliest stage (in situ) involves only mucosa \\n T1, T1 through the muscularis mucosa \\n T2, T2 through submucosa into muscularis propria \\n T3, T3 through muscularis propria into outermost layers \\n T4a, T4a through serosa/visceral peritoneum \\n T4b, T4b through the wall attach/invade nearby tissues', NULL, NULL, NULL, NULL, NULL, '[tumor_origin] = ''3''', 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4166(@project_id, 'tnmcolon_n', NULL, 'pathology_review', NULL, 122, NULL, NULL, 'select', 'TNMcolon_N', 'Nx, Nx incomplete information. \\n N0, N0 No cancer in nearby LNs \\n N1a, N1a in 1 nearby LN \\n N1b, N1b in 2 to 3 nearby LNs \\n N1c, N1c cancer cells in areas of fat near LN, but not in LNs \\n N2a, N2a in 4 to 6 nearby LN \\n N2b, N2b in 7 or more nearby LNs', NULL, NULL, NULL, NULL, NULL, '[tumor_origin] = ''3''', 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4167(@project_id, 'tnmcolon_m', NULL, 'pathology_review', NULL, 123, NULL, NULL, 'select', 'TNMcolon_M', 'M0, M0 No distant spread \\n M1a, M1a to 1 distant organ or set of distant LNs \\n M1b, M1b to >1 or distant parts peritoneum \\n MX, MX', NULL, NULL, NULL, NULL, NULL, '[tumor_origin] = ''3''', 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4168(@project_id, 'pre_cancerous_colon', NULL, 'pathology_review', NULL, 124, NULL, NULL, 'textarea', 'Pre-cancerous_Colon', NULL, NULL, NULL, NULL, NULL, NULL, '[tumor_origin] = ''3''', 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4169(@project_id, 'clin_diagn_lung', NULL, 'pathology_review', NULL, 125, NULL, 'For Lung Cancer Samples', 'select', 'Clin_Diagn_Lung', '1, Squamous cell carcinoma 8070/3 \\n 2, Small cell carcinoma 8041/3 \\n 3, Adenocarcinoma 8140/3 \\n 4, Adenocarcinoma, mixed subtype 8255/3 \\n 5, Adenocarcinoma, Acinar 8550/3 \\n 6, Adenocarcinoma, Papillary 8260/3 \\n 7, Adenocarcinoma, Micropapillary \\n 8, Bronchioloalveolar carcinoma 8250/3 \\n 9, Solid adenocarcinoma with mucin 8230/3 \\n 10, Adenosquamous carcinoma 8560/3 \\n 11, Large cell carcinoma 8012/3 \\n 12, Sarcomatoid carcinoma 8033/3 \\n 13, Carcinoid tumour 8240/3 \\n 14, Mucoepidermoid carcinoma 8430/3 \\n 15, Epithelial-myoepithelial carcinoma 8562/3 \\n 16, Adenoid cystic carcinoma 8200/3 \\n 17, Unclassified carcinoma \\n 18, Others \\n 19, Large cell neuroendocrine carcinoma 8013/3', NULL, NULL, NULL, NULL, NULL, '[tumor_origin] = ''4''', 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4170(@project_id, 'lab_diagn_lung', NULL, 'pathology_review', NULL, 126, NULL, NULL, 'select', 'Lab_Diagn_Lung', '1, Squamous cell carcinoma 8070/3 \\n 2, Small cell carcinoma 8041/3 \\n 3, Adenocarcinoma 8140/3 \\n 4, Adenocarcinoma, mixed subtype 8255/3 \\n 5, Adenocarcinoma, Acinar 8550/3 \\n 6, Adenocarcinoma, Papillary 8260/3 \\n 7, Adenocarcinoma, Micropapillary \\n 8, Bronchioloalveolar carcinoma 8250/3 \\n 9, Solid adenocarcinoma with mucin 8230/3 \\n 10, Adenosquamous carcinoma 8560/3 \\n 11, Large cell carcinoma 8012/3 \\n 12, Sarcomatoid carcinoma 8033/3 \\n 13, Carcinoid tumour 8240/3 \\n 14, Mucoepidermoid carcinoma 8430/3 \\n 15, Epithelial-myoepithelial carcinoma 8562/3 \\n 16, Adenoid cystic carcinoma 8200/3 \\n 17, Unclassified carcinoma \\n 18, Others \\n 19, Large cell neuroendocrine carcinoma 8013/3', NULL, NULL, NULL, NULL, NULL, '[tumor_origin] = ''4''', 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4171(@project_id, 'if_others_specify', NULL, 'pathology_review', NULL, 127, NULL, NULL, 'text', 'If_Others_Specify', NULL, NULL, NULL, NULL, NULL, 'soft_typed', '[tumor_origin] = ''4'' and [lab_diagn_lung] = ''10''', 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4172(@project_id, 'clin_grade_lung', NULL, 'pathology_review', NULL, 128, NULL, NULL, 'select', 'Clin_Grade_Lung', '1, Low \\n 2, Intermediate \\n 3, High \\n 4, N/A \\n 5, Low-Intermediate \\n 6, Intermediate-High', NULL, NULL, NULL, NULL, NULL, '[tumor_origin] = ''4''', 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4173(@project_id, 'lab_grade_lung', NULL, 'pathology_review', NULL, 129, NULL, NULL, 'select', 'Lab_Grade_Lung', '1, Low \\n 2, Intermediate \\n 3, High \\n 4, N/A', NULL, NULL, NULL, NULL, NULL, '[tumor_origin] = ''4''', 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4174(@project_id, 'tnmlung_t', NULL, 'pathology_review', NULL, 130, NULL, NULL, 'select', 'TNMlung_T', '1, TX \\n 2, T0 No evidence of primary tumour \\n 3, Tis Carcinoma in situ \\n 4, T1 <= 3 cm, without invasion \\n 5, T2 > 3 cm; or involves main bronchus(>2 cm distal to carina)/visceral pleura; or Associated with atelectasis or obstructive pneumonitis that does not involve entire lung \\n 6, T3 any size that directly invades any of:chest wall, diaphragm, mediastinal pleura, parietal pericardium; or tumour in main bronchus < 2 cm distal to carina but without involvement of carina; or associated atelectasis or obstructive pneumonitis of entire lung \\n 7, T4 any size that invades any of: mediastinum, heart, great vessels, trachea, oesophagus, vertebral body, carina; separate tumour nodule(s) in same lobe; tumour with malignant pleural effusion', NULL, NULL, NULL, NULL, NULL, '[tumor_origin] = ''4''', 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4175(@project_id, 'tnmlung_n', NULL, 'pathology_review', NULL, 131, NULL, NULL, 'select', 'TNMlung_N', '8, NX \\n 9, N0 \\n 10, N1 Ipsilateral peribronchial/ipsilateral hilar LNs and intrapulmonary LNs \\n 11, N2 ipsilateral mediastinal/subcarinal LNs \\n 12, N3 contralateral mediastinal, contralateral hilar, ipsilateral or contralateral scalene, or supraclavicular LNs', NULL, NULL, NULL, NULL, NULL, '[tumor_origin] = ''4''', 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4176(@project_id, 'tnmlung_m', NULL, 'pathology_review', NULL, 132, NULL, NULL, 'select', 'TNMlung_M', '13, MX \\n 14, M0 \\n 15, M1 Distant metastasis, includes separate tumour nodule(s) in different lobe', NULL, NULL, NULL, NULL, NULL, '[tumor_origin] = ''4''', 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4177(@project_id, 'clin_diagn_others', NULL, 'pathology_review', NULL, 133, NULL, 'For Other Cancer Samples', 'text', 'Clin_Diagn_Others', NULL, NULL, NULL, NULL, NULL, 'soft_typed', '[tumor_origin] = ''5''', 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4178(@project_id, 'lab_diagn_others', NULL, 'pathology_review', NULL, 134, NULL, NULL, 'text', 'Lab_Diagn_Others', NULL, NULL, NULL, NULL, NULL, 'soft_typed', '[tumor_origin] = ''5''', 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4179(@project_id, 'clin_grade_others', NULL, 'pathology_review', NULL, 135, NULL, NULL, 'text', 'Clin_Grade_Others', NULL, NULL, NULL, NULL, NULL, 'soft_typed', '[tumor_origin] = ''5''', 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4180(@project_id, 'lab_grade_others', NULL, 'pathology_review', NULL, 136, NULL, NULL, 'text', 'Lab_Grade_Others', NULL, NULL, NULL, NULL, NULL, 'soft_typed', '[tumor_origin] = ''5''', 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4181(@project_id, 'tnm_stage', NULL, 'pathology_review', NULL, 137, NULL, NULL, 'text', 'TNM_Stage', NULL, NULL, NULL, NULL, NULL, 'soft_typed', '[tumor_origin] = ''5''', 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4182(@project_id, 'pathoireview_note', NULL, 'pathology_review', NULL, 138, NULL, NULL, 'textarea', 'PatholReview_Note', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4183(@project_id, 'pathology_review_complete', NULL, 'pathology_review', NULL, 139, NULL, 'Form Status', 'select', 'Complete?', '0, Incomplete \\n 1, Unverified \\n 2, Complete', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4184(@project_id, 'five_um_tumor_quant', NULL, 'slide_information', 'Slide Information', 140, NULL, NULL, 'text', '5um_Tumor_Quant', NULL, NULL, 'float', NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4185(@project_id, 'five_um_tumor_currquant', NULL, 'slide_information', NULL, 141, NULL, NULL, 'text', '5um_Tumor_CurrQuant', NULL, NULL, 'float', NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4186(@project_id, 'ten_um_tumor_quant', NULL, 'slide_information', NULL, 142, NULL, NULL, 'text', '10um_Tumor_Quant', NULL, NULL, 'float', NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4187(@project_id, 'ten_um_tumor_currquant', NULL, 'slide_information', NULL, 143, NULL, NULL, 'text', '10um_Tumor_CurrQuant', NULL, NULL, 'float', NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4188(@project_id, 'five_um_nor_quant', NULL, 'slide_information', NULL, 144, NULL, NULL, 'text', '5um_Nor_Quant', NULL, NULL, 'float', NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4189(@project_id, 'five_um_nor_currquant', NULL, 'slide_information', NULL, 145, NULL, NULL, 'text', '5um_Nor_CurrQuant', NULL, NULL, 'float', NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4190(@project_id, 'ten_um_nor_quant', NULL, 'slide_information', NULL, 146, NULL, NULL, 'text', '10um_Nor_Quant', NULL, NULL, 'float', NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4191(@project_id, 'ten_um_nor_currquant', NULL, 'slide_information', NULL, 147, NULL, NULL, 'text', '10um_Nor_CurrQuant', NULL, NULL, 'float', NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4192(@project_id, 'slideloc_1', NULL, 'slide_information', NULL, 148, NULL, NULL, 'text', 'SlideLoc_1', NULL, NULL, NULL, NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4193(@project_id, 'parapieceloc_1', NULL, 'slide_information', NULL, 149, NULL, NULL, 'text', 'ParaPieceLoc_1', NULL, NULL, NULL, NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4194(@project_id, 'is_there_another_accnumber', NULL, 'slide_information', NULL, 150, NULL, NULL, 'yesno', 'Is there another AccNumber?', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4195(@project_id, 'pathaccnum_2', NULL, 'slide_information', NULL, 151, NULL, NULL, 'text', 'PathAccNum_2', NULL, NULL, NULL, NULL, NULL, 'soft_typed', '[is_there_another_accnumber] = ''1''', 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4196(@project_id, 'five_um_tumor_quant2', NULL, 'slide_information', NULL, 152, NULL, NULL, 'text', '5um_Tumor_Quant2', NULL, NULL, 'float', NULL, NULL, 'soft_typed', '[is_there_another_accnumber] = ''1''', 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4197(@project_id, 'five_um_tumor_currquant2', NULL, 'slide_information', NULL, 153, NULL, NULL, 'text', '5um_Tumor_CurrQuant2', NULL, NULL, 'float', NULL, NULL, 'soft_typed', '[is_there_another_accnumber] = ''1''', 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4198(@project_id, 'ten_um_tumor_quant2', NULL, 'slide_information', NULL, 154, NULL, NULL, 'text', '10um_Tumor_Quant2', NULL, NULL, 'float', NULL, NULL, 'soft_typed', '[is_there_another_accnumber] = ''1''', 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4199(@project_id, 'ten_um_tumor_currquant2', NULL, 'slide_information', NULL, 155, NULL, NULL, 'text', '10um_Tumor_CurrQuant2', NULL, NULL, 'float', NULL, NULL, 'soft_typed', '[is_there_another_accnumber] = ''1''', 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4200(@project_id, 'five_um_nor_quant2', NULL, 'slide_information', NULL, 156, NULL, NULL, 'text', '5um_Nor_Quant2', NULL, NULL, 'float', NULL, NULL, 'soft_typed', '[is_there_another_accnumber] = ''1''', 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4201(@project_id, 'five_um_nor_currquant2', NULL, 'slide_information', NULL, 157, NULL, NULL, 'text', '5um_Nor_CurrQuant2', NULL, NULL, 'float', NULL, NULL, 'soft_typed', '[is_there_another_accnumber] = ''1''', 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4202(@project_id, 'ten_um_nor_quant2', NULL, 'slide_information', NULL, 158, NULL, NULL, 'text', '10um_Nor_Quant2', NULL, NULL, 'float', NULL, NULL, 'soft_typed', '[is_there_another_accnumber] = ''1''', 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4203(@project_id, 'ten_um_nor_currquant2', NULL, 'slide_information', NULL, 159, NULL, NULL, 'text', '10um_Nor_CurrQuant2', NULL, NULL, 'float', NULL, NULL, 'soft_typed', '[is_there_another_accnumber] = ''1''', 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4204(@project_id, 'same_slideloc', NULL, 'slide_information', NULL, 160, NULL, NULL, 'yesno', 'Same_SlideLoc?', NULL, NULL, NULL, NULL, NULL, NULL, '[is_there_another_accnumber] = ''1''', 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4205(@project_id, 'if_no_location2', NULL, 'slide_information', NULL, 161, NULL, NULL, 'text', 'If_No_Location2', NULL, NULL, NULL, NULL, NULL, 'soft_typed', '[same_slideloc] = ''0'' and [is_there_another_accnumber] = ''1''', 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4206(@project_id, 'parapieceloc_2', NULL, 'slide_information', NULL, 162, NULL, NULL, 'text', 'ParaPieceLoc_2', NULL, NULL, NULL, NULL, NULL, 'soft_typed', '[is_there_another_accnumber] = ''1''', 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4207(@project_id, 'is_there_metastatic_tumor', NULL, 'slide_information', NULL, 163, NULL, NULL, 'yesno', 'Is there Metastatic Tumor?', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4208(@project_id, 'metastatic_accnum', NULL, 'slide_information', NULL, 164, NULL, NULL, 'text', 'Metastatic_AccNum', NULL, NULL, NULL, NULL, NULL, 'soft_typed', '[is_there_metastatic_tumor] = ''1''', 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4209(@project_id, 'five_um_met_quant', NULL, 'slide_information', NULL, 165, NULL, NULL, 'text', '5um_Met_Quant', NULL, NULL, NULL, NULL, NULL, 'soft_typed', '[is_there_metastatic_tumor] = ''1''', 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4210(@project_id, 'five_um_met_currentquant', NULL, 'slide_information', NULL, 166, NULL, NULL, 'text', '5um_Met_CurrentQuant', NULL, NULL, NULL, NULL, NULL, 'soft_typed', '[is_there_metastatic_tumor] = ''1''', 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4211(@project_id, 'ten_um_met_quant', NULL, 'slide_information', NULL, 167, NULL, NULL, 'text', '10um_Met_Quant', NULL, NULL, NULL, NULL, NULL, 'soft_typed', '[is_there_metastatic_tumor] = ''1''', 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4212(@project_id, 'ten_um_met_currentquant', NULL, 'slide_information', NULL, 168, NULL, NULL, 'text', '10um_Met_CurrentQuant', NULL, NULL, NULL, NULL, NULL, 'soft_typed', '[is_there_metastatic_tumor] = ''1''', 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4213(@project_id, 'slideloc_metmetastatic', NULL, 'slide_information', NULL, 169, NULL, NULL, 'text', 'SlideLoc_Metmetastatic', NULL, NULL, NULL, NULL, NULL, 'soft_typed', '[is_there_metastatic_tumor] = ''1''', 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4214(@project_id, 'parapieceloc_metastatic', NULL, 'slide_information', NULL, 170, NULL, NULL, 'text', 'ParaPieceLoc_Metastatic', NULL, NULL, NULL, NULL, NULL, 'soft_typed', '[is_there_metastatic_tumor] = ''1''', 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4215(@project_id, 'is_there_precancer', NULL, 'slide_information', NULL, 171, NULL, NULL, 'yesno', 'Is There Precancer?', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4216(@project_id, 'precancer_accnum', NULL, 'slide_information', NULL, 172, NULL, NULL, 'text', 'PreCancer_AccNum', NULL, NULL, NULL, NULL, NULL, 'soft_typed', '[is_there_precancer] = ''1''', 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4217(@project_id, 'five_um_precancer_quant', NULL, 'slide_information', NULL, 173, NULL, NULL, 'text', '5um_Precancer_Quant', NULL, NULL, NULL, NULL, NULL, 'soft_typed', '[is_there_precancer] = ''1''', 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4218(@project_id, 'five_um_precancer_curquant', NULL, 'slide_information', NULL, 174, NULL, NULL, 'text', '5um_Precancer_CurrentQuant', NULL, NULL, NULL, NULL, NULL, 'soft_typed', '[is_there_precancer] = ''1''', 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4219(@project_id, 'ten_um_precancer_quant', NULL, 'slide_information', NULL, 175, NULL, NULL, 'text', '10um_Precancer_Quant', NULL, NULL, NULL, NULL, NULL, 'soft_typed', '[is_there_precancer] = ''1''', 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4220(@project_id, 'ten_um_precancer_curquant', NULL, 'slide_information', NULL, 176, NULL, NULL, 'text', '10um_Precancer_CurQuant', NULL, NULL, NULL, NULL, NULL, 'soft_typed', '[is_there_precancer] = ''1''', 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4221(@project_id, 'slideloc_precancer', NULL, 'slide_information', NULL, 177, NULL, NULL, 'text', 'SlideLoc_Precancer', NULL, NULL, NULL, NULL, NULL, 'soft_typed', '[is_there_precancer] = ''1''', 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4222(@project_id, 'parapieceloc_precancer', NULL, 'slide_information', NULL, 178, NULL, NULL, 'text', 'ParaPieceLoc_Precancer', NULL, NULL, NULL, NULL, NULL, 'soft_typed', '[is_there_precancer] = ''1''', 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4223(@project_id, 'slide_information_complete', NULL, 'slide_information', NULL, 179, NULL, 'Form Status', 'select', 'Complete?', '0, Incomplete \\n 1, Unverified \\n 2, Complete', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4224(@project_id, 'tma_ca_pos1', NULL, 'tma_information', 'TMA Information', 180, NULL, NULL, 'text', 'TMA_Ca_pos1', NULL, NULL, NULL, NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4225(@project_id, 'tma_ca_pos2', NULL, 'tma_information', NULL, 181, NULL, NULL, 'text', 'TMA_Ca_pos2', NULL, NULL, NULL, NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4226(@project_id, 'tma_nor_pos1', NULL, 'tma_information', NULL, 182, NULL, NULL, 'text', 'TMA_Nor_pos1', NULL, NULL, NULL, NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4227(@project_id, 'tma_nor_pos2', NULL, 'tma_information', NULL, 183, NULL, NULL, 'text', 'TMA_Nor_pos2', NULL, NULL, NULL, NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4228(@project_id, 'tma_preca_pos', NULL, 'tma_information', NULL, 184, NULL, NULL, 'text', 'TMA_ PreCa_pos1', NULL, NULL, NULL, NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4229(@project_id, 'tma_metastatic_pos', NULL, 'tma_information', NULL, 185, NULL, NULL, 'text', 'TMA Metastatic_pos1', NULL, NULL, NULL, NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL);
4230INSERT INTO redcap_metadata (project_id, field_name, field_phi, form_name, form_menu_description, field_order, field_units, element_preceding_header, element_type, element_label, element_enum, element_note, element_validation_type, element_validation_min, element_validation_max, element_validation_checktype, branching_logic, field_req, edoc_id, edoc_display_img, custom_alignment, stop_actions, question_num, grid_name, misc) VALUES
4231(@project_id, 'another_accnumber', NULL, 'tma_information', NULL, 186, NULL, NULL, 'yesno', 'Another_AccNumber?', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4232(@project_id, 'tma_ca_pos3', NULL, 'tma_information', NULL, 187, NULL, NULL, 'text', 'TMA_Ca_pos3', NULL, NULL, NULL, NULL, NULL, 'soft_typed', '[another_accnumber] = ''1''', 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4233(@project_id, 'tma_ca_pos4', NULL, 'tma_information', NULL, 188, NULL, NULL, 'text', 'TMA_Ca_pos4', NULL, NULL, NULL, NULL, NULL, 'soft_typed', '[another_accnumber] = ''1''', 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4234(@project_id, 'tma_nor_pos3', NULL, 'tma_information', NULL, 189, NULL, NULL, 'text', 'TMA_Nor_pos3', NULL, NULL, NULL, NULL, NULL, 'soft_typed', '[another_accnumber] = ''1''', 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4235(@project_id, 'tma_nor_pos4', NULL, 'tma_information', NULL, 190, NULL, NULL, 'text', 'TMA_Nor_pos4', NULL, NULL, NULL, NULL, NULL, 'soft_typed', '[another_accnumber] = ''1''', 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4236(@project_id, 'tma_preca_pos2', NULL, 'tma_information', NULL, 191, NULL, NULL, 'text', 'TMA_ PreCa_pos2', NULL, NULL, NULL, NULL, NULL, 'soft_typed', '[another_accnumber] = ''1''', 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4237(@project_id, 'tma_metastatic_pos2', NULL, 'tma_information', NULL, 192, NULL, NULL, 'text', 'TMA Metastatic_pos2', NULL, NULL, NULL, NULL, NULL, 'soft_typed', '[another_accnumber] = ''1''', 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4238(@project_id, 'tma_information_complete', NULL, 'tma_information', NULL, 193, NULL, 'Form Status', 'select', 'Complete?', '0, Incomplete \\n 1, Unverified \\n 2, Complete', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4239(@project_id, 'pulling_date1', NULL, 'slide_tracking', 'Slide Tracking', 194, NULL, NULL, 'text', 'Pulling_Date1', NULL, NULL, 'date_mdy', NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4240(@project_id, 'forwhoseproject', NULL, 'slide_tracking', NULL, 195, NULL, NULL, 'text', 'ForWhoseProject1', NULL, NULL, NULL, NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4241(@project_id, 'whichslidepulled1', NULL, 'slide_tracking', NULL, 196, NULL, NULL, 'text', 'WhichSlidePulled1', NULL, NULL, NULL, NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4242(@project_id, 'pulled_quant1', NULL, 'slide_tracking', NULL, 197, NULL, NULL, 'text', 'Pulled_Quant1', NULL, NULL, 'float', NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4243(@project_id, 'slide_tracking_complete', NULL, 'slide_tracking', NULL, 198, NULL, 'Form Status', 'select', 'Complete?', '0, Incomplete \\n 1, Unverified \\n 2, Complete', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL);
4244
4245INSERT INTO `redcap_projects_templates` (`project_id`, `title`, `description`, `enabled`)
4246 VALUES (@project_id, @project_title, 'Contains five data entry forms for collecting and tracking information for cancer tissue.', '1');
4247-- SQL TO CREATE A REDCAP DEMO PROJECT --
4248set @project_title = 'Multiple Surveys (classic)';
4249-- Obtain default values --
4250set @institution = (select value from redcap_config where field_name = 'institution' limit 1);
4251set @site_org_type = (select value from redcap_config where field_name = 'site_org_type' limit 1);
4252set @grant_cite = (select value from redcap_config where field_name = 'grant_cite' limit 1);
4253set @project_contact_name = (select value from redcap_config where field_name = 'project_contact_name' limit 1);
4254set @project_contact_email = (select value from redcap_config where field_name = 'project_contact_email' limit 1);
4255set @headerlogo = (select value from redcap_config where field_name = 'headerlogo' limit 1);
4256set @auth_meth = (select value from redcap_config where field_name = 'auth_meth_global' limit 1);
4257-- Create project --
4258INSERT INTO `redcap_projects`
4259(survey_email_participant_field, project_name, app_title, status, count_project, auth_meth, creation_time, production_time, institution, site_org_type, grant_cite, project_contact_name, project_contact_email, headerlogo, surveys_enabled, auto_inc_set, display_project_logo_institution) VALUES
4260('email',concat('redcap_demo_',LEFT(sha1(rand()),6)), @project_title, 1, 0, @auth_meth, now(), now(), @institution, @site_org_type, @grant_cite, @project_contact_name, @project_contact_email, @headerlogo, 1, 1, 0);
4261set @project_id = LAST_INSERT_ID();
4262-- User rights --
4263INSERT INTO `redcap_user_rights` (`project_id`, `username`, `expiration`, `group_id`, `lock_record`, `data_export_tool`, `data_import_tool`,
4264`data_comparison_tool`, `data_logging`, `file_repository`, `double_data`, `user_rights`, `data_access_groups`, `graphical`, `reports`, `design`,
4265`calendar`, `data_entry`, `participants`, `data_quality_execute`) VALUES
4266(@project_id, 'site_admin', NULL, NULL, 0, 1, 0, 1, 1, 1, 0, 0, 0, 1, 1, 0, 1, '', 0, 1);
4267-- Create single arm --
4268INSERT INTO redcap_events_arms (project_id, arm_num, arm_name) VALUES (@project_id, 1, 'Arm 1');
4269set @arm_id = LAST_INSERT_ID();
4270-- Create single event --
4271INSERT INTO redcap_events_metadata (arm_id, day_offset, offset_min, offset_max, descrip) VALUES (@arm_id, 0, 0, 0, 'Event 1');
4272set @event_id = LAST_INSERT_ID();
4273-- Insert into redcap_surveys
4274INSERT INTO redcap_surveys (project_id, font_family, form_name, title, instructions, acknowledgement, question_by_section, question_auto_numbering, survey_enabled, save_and_return, logo, hide_title, view_results, min_responses_view_results, check_diversity_view_results, end_survey_redirect_url, survey_expiration) VALUES
4275(@project_id, '16', 'participant_info_survey', 'Follow-Up Survey', '<p><strong>Please complete the survey below.</strong></p>\r\n<p>Thank you!</p>', '<p><strong>Thank you for taking the survey.</strong></p>\r\n<p>Have a nice day!</p>', 0, 1, 1, 1, NULL, 0, 0, 10, 0, NULL, NULL),
4276(@project_id, '16', 'participant_morale_questionnaire', 'Patient Morale Questionnaire', '<p><strong>Please complete the survey below.</strong></p>\r\n<p>Thank you!</p>', '<p><strong>Thank you for taking the survey.</strong></p>\r\n<p>Have a nice day!</p>', 0, 1, 1, 1, NULL, 0, 0, 10, 0, NULL, NULL),
4277(@project_id, '16', 'prescreening_survey', 'Pre-Screening Survey', '<p><strong>Please complete the survey below.</strong></p>\r\n<p>Thank you!</p>', '<p><strong>Thank you for taking the survey.</strong></p>\r\n<p>Have a nice day!</p>', 0, 1, 1, 0, NULL, 0, 0, 10, 0, NULL, NULL);
4278-- Insert into redcap_metadata --
4279INSERT INTO redcap_metadata (project_id, field_name, field_phi, form_name, form_menu_description, field_order, field_units, element_preceding_header, element_type, element_label, element_enum, element_note, element_validation_type, element_validation_min, element_validation_max, element_validation_checktype, branching_logic, field_req, edoc_id, edoc_display_img, custom_alignment, stop_actions, question_num, grid_name, misc) VALUES
4280(@project_id, 'participant_id', NULL, 'prescreening_survey', 'Pre-Screening Survey', 1, NULL, NULL, 'text', 'Participant ID', NULL, NULL, NULL, NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4281(@project_id, 'dob', NULL, 'prescreening_survey', NULL, 2, NULL, 'Please fill out the information below.', 'text', 'Date of birth', NULL, NULL, 'date_ymd', NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4282(@project_id, 'email', '1', 'prescreening_survey', NULL, 2.1, NULL, NULL, 'text', 'E-mail address', NULL, NULL, 'email', NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4283(@project_id, 'has_diabetes', NULL, 'prescreening_survey', NULL, 3, NULL, NULL, 'truefalse', 'I currently have Type 2 Diabetes', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4284(@project_id, 'consent', NULL, 'prescreening_survey', NULL, 4, NULL, NULL, 'checkbox', 'By checking this box, I certify that I am at least 18 years old and that I give my consent freely to participate in this study.', '1, I consent', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4285(@project_id, 'prescreening_survey_complete', NULL, 'prescreening_survey', NULL, 5, NULL, 'Form Status', 'select', 'Complete?', '0, Incomplete \\n 1, Unverified \\n 2, Complete', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4286(@project_id, 'first_name', '1', 'participant_info_survey', 'Participant Info Survey', 6, NULL, 'As a participant in this study, please answer the questions below. Thank you!', 'text', 'First Name', NULL, NULL, NULL, NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4287(@project_id, 'last_name', '1', 'participant_info_survey', NULL, 7, NULL, NULL, 'text', 'Last Name', NULL, NULL, NULL, NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4288(@project_id, 'address', '1', 'participant_info_survey', NULL, 8, NULL, NULL, 'textarea', 'Street, City, State, ZIP', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4289(@project_id, 'telephone_1', '1', 'participant_info_survey', NULL, 9, NULL, NULL, 'text', 'Phone number', NULL, 'Include Area Code', 'phone', NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4290(@project_id, 'ethnicity', NULL, 'participant_info_survey', NULL, 11, NULL, NULL, 'radio', 'Ethnicity', '0, Hispanic or Latino \\n 1, NOT Hispanic or Latino \\n 2, Unknown / Not Reported', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, 'LH', NULL, NULL, NULL, NULL),
4291(@project_id, 'race', NULL, 'participant_info_survey', NULL, 12, NULL, NULL, 'select', 'Race', '0, American Indian/Alaska Native \\n 1, Asian \\n 2, Native Hawaiian or Other Pacific Islander \\n 3, Black or African American \\n 4, White \\n 5, More Than One Race \\n 6, Unknown / Not Reported', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4292(@project_id, 'gender', NULL, 'participant_info_survey', NULL, 13, NULL, NULL, 'radio', 'Gender', '0, Female \\n 1, Male \\n 2, Other \\n 3, Prefer not to say', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4293(@project_id, 'height', NULL, 'participant_info_survey', NULL, 14, NULL, NULL, 'text', 'Height (cm)', NULL, NULL, 'float', '130', '215', 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4294(@project_id, 'weight', NULL, 'participant_info_survey', NULL, 15, NULL, NULL, 'text', 'Weight (kilograms)', NULL, NULL, 'int', '35', '200', 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4295(@project_id, 'participant_info_survey_complete', NULL, 'participant_info_survey', NULL, 16, NULL, 'Form Status', 'select', 'Complete?', '0, Incomplete \\n 1, Unverified \\n 2, Complete', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4296(@project_id, 'pmq1', NULL, 'participant_morale_questionnaire', 'Participant Morale Questionnaire', 17, NULL, 'As a participant in this study, please answer the questions below. Thank you!', 'select', 'On average, how many pills did you take each day last week?', '0, Less than 5 \\n 1, 5-10 \\n 2, 6-15 \\n 3, Over 15', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4297(@project_id, 'pmq2', NULL, 'participant_morale_questionnaire', NULL, 18, NULL, NULL, 'select', 'Using the handout, which level of dependence do you feel you are currently at?', '0, 0 \\n 1, 1 \\n 2, 2 \\n 3, 3 \\n 4, 4 \\n 5, 5', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4298(@project_id, 'pmq3', NULL, 'participant_morale_questionnaire', NULL, 19, NULL, NULL, 'yesno', 'Would you be willing to discuss your experiences with a psychiatrist?', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4299(@project_id, 'pmq4', NULL, 'participant_morale_questionnaire', NULL, 20, NULL, NULL, 'select', 'How open are you to further testing?', '0, Not open \\n 1, Undecided \\n 2, Very open', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4300(@project_id, 'participant_morale_questionnaire_complete', NULL, 'participant_morale_questionnaire', NULL, 21, NULL, 'Form Status', 'select', 'Complete?', '0, Incomplete \\n 1, Unverified \\n 2, Complete', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4301(@project_id, 'complete_study', NULL, 'completion_data', 'Completion Data (to be entered by study personnel only)', 22, NULL, 'This form is to be filled out by study personnel.', 'yesno', 'Has patient completed study?', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4302(@project_id, 'withdraw_date', NULL, 'completion_data', NULL, 23, NULL, NULL, 'text', 'Put a date if patient withdrew study', NULL, NULL, 'date_ymd', NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4303(@project_id, 'withdraw_reason', NULL, 'completion_data', NULL, 24, NULL, NULL, 'select', 'Reason patient withdrew from study', '0, Non-compliance \\n 1, Did not wish to continue in study \\n 2, Could not tolerate the supplement \\n 3, Hospitalization \\n 4, Other', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4304(@project_id, 'date_visit_4', NULL, 'completion_data', NULL, 25, NULL, NULL, 'text', 'Date of last visit', NULL, NULL, 'date_ymd', NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4305(@project_id, 'discharge_date_4', NULL, 'completion_data', NULL, 26, NULL, NULL, 'text', 'Date of hospital discharge', NULL, NULL, 'date_ymd', NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4306(@project_id, 'discharge_summary_4', NULL, 'completion_data', NULL, 27, NULL, NULL, 'select', 'Discharge summary in patients binder?', '0, No \\n 1, Yes', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4307(@project_id, 'study_comments', NULL, 'completion_data', NULL, 28, NULL, NULL, 'textarea', 'Comments', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4308(@project_id, 'completion_data_complete', NULL, 'completion_data', NULL, 29, NULL, 'Form Status', 'select', 'Complete?', '0, Incomplete \\n 1, Unverified \\n 2, Complete', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL);
4309
4310INSERT INTO `redcap_projects_templates` (`project_id`, `title`, `description`, `enabled`)
4311 VALUES (@project_id, @project_title, 'Contains three surveys and a data entry form. Includes a pre-screening survey followed by two follow-up surveys to capture information from the participant, and then a data entry form for final data to be entered by the study personnel. The project data is captured in classic data collection format.', '1');
4312-- SQL TO CREATE A REDCAP DEMO PROJECT --
4313set @project_title = 'Multiple Surveys (longitudinal)';
4314-- Obtain default values --
4315set @institution = (select value from redcap_config where field_name = 'institution' limit 1);
4316set @site_org_type = (select value from redcap_config where field_name = 'site_org_type' limit 1);
4317set @grant_cite = (select value from redcap_config where field_name = 'grant_cite' limit 1);
4318set @project_contact_name = (select value from redcap_config where field_name = 'project_contact_name' limit 1);
4319set @project_contact_email = (select value from redcap_config where field_name = 'project_contact_email' limit 1);
4320set @headerlogo = (select value from redcap_config where field_name = 'headerlogo' limit 1);
4321set @auth_meth = (select value from redcap_config where field_name = 'auth_meth_global' limit 1);
4322-- Create project --
4323INSERT INTO `redcap_projects`
4324(survey_email_participant_field,project_name, app_title, status, repeatforms, count_project, auth_meth, creation_time, production_time, institution, site_org_type, grant_cite, project_contact_name, project_contact_email, headerlogo, surveys_enabled, auto_inc_set, display_project_logo_institution) VALUES
4325('email',concat('redcap_demo_',LEFT(sha1(rand()),6)), @project_title, 1, 1, 0, @auth_meth, now(), now(), @institution, @site_org_type, @grant_cite, @project_contact_name, @project_contact_email, @headerlogo, 1, 1, 0);
4326set @project_id = LAST_INSERT_ID();
4327-- User rights --
4328INSERT INTO `redcap_user_rights` (`project_id`, `username`, `expiration`, `group_id`, `lock_record`, `data_export_tool`, `data_import_tool`,
4329`data_comparison_tool`, `data_logging`, `file_repository`, `double_data`, `user_rights`, `data_access_groups`, `graphical`, `reports`, `design`,
4330`calendar`, `data_entry`, `participants`, `data_quality_execute`) VALUES
4331(@project_id, 'site_admin', NULL, NULL, 0, 1, 0, 1, 1, 1, 0, 0, 0, 1, 1, 0, 1, '', 0, 1);
4332-- Create single arm --
4333INSERT INTO redcap_events_arms (project_id, arm_num, arm_name) VALUES (@project_id, 1, 'Arm 1');
4334set @arm_id = LAST_INSERT_ID();
4335-- Create events --
4336INSERT INTO redcap_events_metadata (arm_id, day_offset, offset_min, offset_max, descrip, external_id) VALUES(@arm_id, 0, 0, 0, 'Initial Data', NULL);
4337set @event_id = LAST_INSERT_ID();
4338INSERT INTO redcap_events_forms (event_id, form_name) VALUES(@event_id, 'prescreening_survey');
4339INSERT INTO redcap_events_forms (event_id, form_name) VALUES(@event_id, 'participant_info_survey');
4340INSERT INTO redcap_events_metadata (arm_id, day_offset, offset_min, offset_max, descrip, external_id) VALUES(@arm_id, 1, 0, 0, 'Week 1', NULL);
4341set @event_id = LAST_INSERT_ID();
4342INSERT INTO redcap_events_forms (event_id, form_name) VALUES(@event_id, 'participant_morale_questionnaire');
4343INSERT INTO redcap_events_metadata (arm_id, day_offset, offset_min, offset_max, descrip, external_id) VALUES(@arm_id, 8, 0, 0, 'Week 2', NULL);
4344set @event_id = LAST_INSERT_ID();
4345INSERT INTO redcap_events_forms (event_id, form_name) VALUES(@event_id, 'participant_morale_questionnaire');
4346INSERT INTO redcap_events_metadata (arm_id, day_offset, offset_min, offset_max, descrip, external_id) VALUES(@arm_id, 15, 0, 0, 'Week 3', NULL);
4347set @event_id = LAST_INSERT_ID();
4348INSERT INTO redcap_events_forms (event_id, form_name) VALUES(@event_id, 'participant_morale_questionnaire');
4349INSERT INTO redcap_events_metadata (arm_id, day_offset, offset_min, offset_max, descrip, external_id) VALUES(@arm_id, 22, 0, 0, 'Week 4', NULL);
4350set @event_id = LAST_INSERT_ID();
4351INSERT INTO redcap_events_forms (event_id, form_name) VALUES(@event_id, 'participant_morale_questionnaire');
4352INSERT INTO redcap_events_metadata (arm_id, day_offset, offset_min, offset_max, descrip, external_id) VALUES(@arm_id, 30, 0, 0, 'Final Data', NULL);
4353set @event_id = LAST_INSERT_ID();
4354INSERT INTO redcap_events_forms (event_id, form_name) VALUES(@event_id, 'completion_data');
4355-- Insert into redcap_surveys
4356INSERT INTO redcap_surveys (project_id, font_family, form_name, title, instructions, acknowledgement, question_by_section, question_auto_numbering, survey_enabled, save_and_return, logo, hide_title, view_results, min_responses_view_results, check_diversity_view_results, end_survey_redirect_url, survey_expiration) VALUES
4357(@project_id, '16', 'participant_info_survey', 'Follow-Up Survey', '<p><strong>Please complete the survey below.</strong></p>\r\n<p>Thank you!</p>', '<p><strong>Thank you for taking the survey.</strong></p>\r\n<p>Have a nice day!</p>', 0, 1, 1, 1, NULL, 0, 0, 10, 0, NULL, NULL),
4358(@project_id, '16', 'participant_morale_questionnaire', 'Patient Morale Questionnaire', '<p><strong>Please complete the survey below.</strong></p>\r\n<p>Thank you!</p>', '<p><strong>Thank you for taking the survey.</strong></p>\r\n<p>Have a nice day!</p>', 0, 1, 1, 1, NULL, 0, 0, 10, 0, NULL, NULL),
4359(@project_id, '16', 'prescreening_survey', 'Pre-Screening Survey', '<p><strong>Please complete the survey below.</strong></p>\r\n<p>Thank you!</p>', '<p><strong>Thank you for taking the survey.</strong></p>\r\n<p>Have a nice day!</p>', 0, 1, 1, 0, NULL, 0, 0, 10, 0, NULL, NULL);
4360-- Insert into redcap_metadata --
4361INSERT INTO redcap_metadata (project_id, field_name, field_phi, form_name, form_menu_description, field_order, field_units, element_preceding_header, element_type, element_label, element_enum, element_note, element_validation_type, element_validation_min, element_validation_max, element_validation_checktype, branching_logic, field_req, edoc_id, edoc_display_img, custom_alignment, stop_actions, question_num, grid_name, misc) VALUES
4362(@project_id, 'participant_id', NULL, 'prescreening_survey', 'Pre-Screening Survey', 1, NULL, NULL, 'text', 'Participant ID', NULL, NULL, NULL, NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4363(@project_id, 'dob', NULL, 'prescreening_survey', NULL, 2, NULL, 'Please fill out the information below.', 'text', 'Date of birth', NULL, NULL, 'date_ymd', NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4364(@project_id, 'email', '1', 'prescreening_survey', NULL, 2.1, NULL, NULL, 'text', 'E-mail address', NULL, NULL, 'email', NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4365(@project_id, 'has_diabetes', NULL, 'prescreening_survey', NULL, 3, NULL, NULL, 'truefalse', 'I currently have Type 2 Diabetes', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4366(@project_id, 'consent', NULL, 'prescreening_survey', NULL, 4, NULL, NULL, 'checkbox', 'By checking this box, I certify that I am at least 18 years old and that I give my consent freely to participate in this study.', '1, I consent', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4367(@project_id, 'prescreening_survey_complete', NULL, 'prescreening_survey', NULL, 5, NULL, 'Form Status', 'select', 'Complete?', '0, Incomplete \\n 1, Unverified \\n 2, Complete', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4368(@project_id, 'first_name', '1', 'participant_info_survey', 'Participant Info Survey', 6, NULL, 'As a participant in this study, please answer the questions below. Thank you!', 'text', 'First Name', NULL, NULL, NULL, NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4369(@project_id, 'last_name', '1', 'participant_info_survey', NULL, 7, NULL, NULL, 'text', 'Last Name', NULL, NULL, NULL, NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4370(@project_id, 'address', '1', 'participant_info_survey', NULL, 8, NULL, NULL, 'textarea', 'Street, City, State, ZIP', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4371(@project_id, 'telephone_1', '1', 'participant_info_survey', NULL, 9, NULL, NULL, 'text', 'Phone number', NULL, 'Include Area Code', 'phone', NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4372(@project_id, 'ethnicity', NULL, 'participant_info_survey', NULL, 11, NULL, NULL, 'radio', 'Ethnicity', '0, Hispanic or Latino \\n 1, NOT Hispanic or Latino \\n 2, Unknown / Not Reported', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, 'LH', NULL, NULL, NULL, NULL),
4373(@project_id, 'race', NULL, 'participant_info_survey', NULL, 12, NULL, NULL, 'select', 'Race', '0, American Indian/Alaska Native \\n 1, Asian \\n 2, Native Hawaiian or Other Pacific Islander \\n 3, Black or African American \\n 4, White \\n 5, More Than One Race \\n 6, Unknown / Not Reported', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4374(@project_id, 'gender', NULL, 'participant_info_survey', NULL, 13, NULL, NULL, 'radio', 'Gender', '0, Female \\n 1, Male \\n 2, Other \\n 3, Prefer not to say', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4375(@project_id, 'height', NULL, 'participant_info_survey', NULL, 14, NULL, NULL, 'text', 'Height (cm)', NULL, NULL, 'float', '130', '215', 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4376(@project_id, 'weight', NULL, 'participant_info_survey', NULL, 15, NULL, NULL, 'text', 'Weight (kilograms)', NULL, NULL, 'int', '35', '200', 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4377(@project_id, 'participant_info_survey_complete', NULL, 'participant_info_survey', NULL, 16, NULL, 'Form Status', 'select', 'Complete?', '0, Incomplete \\n 1, Unverified \\n 2, Complete', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4378(@project_id, 'pmq1', NULL, 'participant_morale_questionnaire', 'Participant Morale Questionnaire', 17, NULL, 'As a participant in this study, please answer the questions below concerning the PAST WEEK. Thank you!', 'select', 'On average, how many pills did you take each day last week?', '0, Less than 5 \\n 1, 5-10 \\n 2, 6-15 \\n 3, Over 15', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4379(@project_id, 'pmq2', NULL, 'participant_morale_questionnaire', NULL, 18, NULL, NULL, 'select', 'Using the handout, which level of dependence do you feel you are currently at?', '0, 0 \\n 1, 1 \\n 2, 2 \\n 3, 3 \\n 4, 4 \\n 5, 5', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4380(@project_id, 'choices', NULL, 'participant_morale_questionnaire', NULL, 19, NULL, 'Concerning the past week, how do you feel about ...', 'radio', 'The choices you made', '1, Not satisfied at all \\n 2, Somewhat dissatisfied \\n 3, Indifferent \\n 4, Somewhat satisfied \\n 5, Very satisfied', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL, 'feelings_matrix', NULL),
4381(@project_id, 'life', NULL, 'participant_morale_questionnaire', NULL, 20, NULL, NULL, 'radio', 'Your life overall', '1, Not satisfied at all \\n 2, Somewhat dissatisfied \\n 3, Indifferent \\n 4, Somewhat satisfied \\n 5, Very satisfied', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL, 'feelings_matrix', NULL),
4382(@project_id, 'job', NULL, 'participant_morale_questionnaire', NULL, 21, NULL, NULL, 'radio', 'Your job', '1, Not satisfied at all \\n 2, Somewhat dissatisfied \\n 3, Indifferent \\n 4, Somewhat satisfied \\n 5, Very satisfied', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL, 'feelings_matrix', NULL),
4383(@project_id, 'family', NULL, 'participant_morale_questionnaire', NULL, 22, NULL, NULL, 'radio', 'Your family life', '1, Not satisfied at all \\n 2, Somewhat dissatisfied \\n 3, Indifferent \\n 4, Somewhat satisfied \\n 5, Very satisfied', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL, 'feelings_matrix', NULL),
4384(@project_id, 'participant_morale_questionnaire_complete', NULL, 'participant_morale_questionnaire', NULL, 23, NULL, 'Form Status', 'select', 'Complete?', '0, Incomplete \\n 1, Unverified \\n 2, Complete', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4385(@project_id, 'complete_study', NULL, 'completion_data', 'Completion Data (to be entered by study personnel only)', 24, NULL, 'This form is to be filled out by study personnel.', 'yesno', 'Has patient completed study?', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4386(@project_id, 'withdraw_date', NULL, 'completion_data', NULL, 25, NULL, NULL, 'text', 'Put a date if patient withdrew study', NULL, NULL, 'date_ymd', NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4387(@project_id, 'withdraw_reason', NULL, 'completion_data', NULL, 26, NULL, NULL, 'select', 'Reason patient withdrew from study', '0, Non-compliance \\n 1, Did not wish to continue in study \\n 2, Could not tolerate the supplement \\n 3, Hospitalization \\n 4, Other', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4388(@project_id, 'date_visit_4', NULL, 'completion_data', NULL, 27, NULL, NULL, 'text', 'Date of last visit', NULL, NULL, 'date_ymd', NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4389(@project_id, 'discharge_date_4', NULL, 'completion_data', NULL, 28, NULL, NULL, 'text', 'Date of hospital discharge', NULL, NULL, 'date_ymd', NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4390(@project_id, 'discharge_summary_4', NULL, 'completion_data', NULL, 29, NULL, NULL, 'select', 'Discharge summary in patients binder?', '0, No \\n 1, Yes', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4391(@project_id, 'study_comments', NULL, 'completion_data', NULL, 30, NULL, NULL, 'textarea', 'Comments', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4392(@project_id, 'completion_data_complete', NULL, 'completion_data', NULL, 31, NULL, 'Form Status', 'select', 'Complete?', '0, Incomplete \\n 1, Unverified \\n 2, Complete', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL);
4393
4394INSERT INTO `redcap_projects_templates` (`project_id`, `title`, `description`, `enabled`)
4395 VALUES (@project_id, @project_title, 'Contains three surveys and a data entry form. Includes a pre-screening survey followed by two follow-up surveys, one of which is a questionnaire takenly weekly to capture participant information longitudinally over a period of one month. The surveys are followed by a data entry form for final data to be entered by the study personnel. The project data is captured in longitudinal data collection format.', '1');
4396-- SQL TO CREATE A REDCAP DEMO PROJECT --
4397set @project_title = 'Piping Example Project';
4398-- Obtain default values --
4399set @institution = (select value from redcap_config where field_name = 'institution' limit 1);
4400set @site_org_type = (select value from redcap_config where field_name = 'site_org_type' limit 1);
4401set @grant_cite = (select value from redcap_config where field_name = 'grant_cite' limit 1);
4402set @project_contact_name = (select value from redcap_config where field_name = 'project_contact_name' limit 1);
4403set @project_contact_email = (select value from redcap_config where field_name = 'project_contact_email' limit 1);
4404set @headerlogo = (select value from redcap_config where field_name = 'headerlogo' limit 1);
4405set @auth_meth = (select value from redcap_config where field_name = 'auth_meth_global' limit 1);
4406-- Create project --
4407INSERT INTO `redcap_projects`
4408(project_name, app_title, status, count_project, auth_meth, creation_time, production_time, institution, site_org_type, grant_cite, project_contact_name, project_contact_email, headerlogo, surveys_enabled, auto_inc_set, display_project_logo_institution) VALUES
4409(concat('redcap_demo_',LEFT(sha1(rand()),6)), @project_title, 1, 0, @auth_meth, now(), now(), @institution, @site_org_type, @grant_cite, @project_contact_name, @project_contact_email, @headerlogo, 1, 1, 0);
4410set @project_id = LAST_INSERT_ID();
4411-- User rights --
4412INSERT INTO `redcap_user_rights` (`project_id`, `username`, `expiration`, `group_id`, `lock_record`, `data_export_tool`, `data_import_tool`,
4413`data_comparison_tool`, `data_logging`, `file_repository`, `double_data`, `user_rights`, `data_access_groups`, `graphical`, `reports`, `design`,
4414`calendar`, `data_entry`, `participants`, `data_quality_execute`) VALUES
4415(@project_id, 'site_admin', NULL, NULL, 0, 1, 0, 1, 1, 1, 0, 0, 0, 1, 1, 0, 1, '', 0, 1);
4416-- Create single arm --
4417INSERT INTO redcap_events_arms (project_id, arm_num, arm_name) VALUES (@project_id, 1, 'Arm 1');
4418set @arm_id = LAST_INSERT_ID();
4419-- Create single event --
4420INSERT INTO redcap_events_metadata (arm_id, day_offset, offset_min, offset_max, descrip) VALUES (@arm_id, 0, 0, 0, 'Event 1');
4421set @event_id = LAST_INSERT_ID();
4422-- Insert into redcap_surveys
4423INSERT INTO redcap_surveys (project_id, form_name, title, instructions, acknowledgement, question_by_section, question_auto_numbering, survey_enabled, save_and_return, logo, hide_title) VALUES
4424(@project_id, 'survey', 'Example Survey to Demonstrate Piping', 'This survey will demonstrate some basic examples of the Piping feature in REDCap.', '<p style="font-size:14px;"><strong>[first_name], thank you for taking the survey.</strong></p><br><p>Have a nice day!</p>', 1, 0, 1, 0, NULL, 0);
4425-- Insert into redcap_metadata --
4426INSERT INTO `redcap_metadata` (`project_id`, `field_name`, `field_phi`, `form_name`, `form_menu_description`, `field_order`, `field_units`, `element_preceding_header`, `element_type`, `element_label`, `element_enum`, `element_note`, `element_validation_type`, `element_validation_min`, `element_validation_max`, `element_validation_checktype`, `branching_logic`, `field_req`, `edoc_id`, `edoc_display_img`, `custom_alignment`, `stop_actions`, `question_num`, `grid_name`, `misc`) VALUES
4427(@project_id, 'participant_id', NULL, 'survey', 'Example Survey', 1, NULL, NULL, 'text', 'Participant ID', NULL, NULL, NULL, NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4428(@project_id, 'first_name', NULL, 'survey', NULL, 2, NULL, 'Section 1', 'text', 'Your first name', NULL, NULL, NULL, NULL, NULL, 'soft_typed', NULL, 1, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4429(@project_id, 'last_name', NULL, 'survey', NULL, 3, NULL, NULL, 'text', 'Your last name', NULL, NULL, NULL, NULL, NULL, 'soft_typed', NULL, 1, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4430(@project_id, 'date_today', NULL, 'survey', NULL, 4, NULL, NULL, 'text', '[first_name], please enter today''s date?', NULL, NULL, 'date_mdy', NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4431(@project_id, 'ice_cream', NULL, 'survey', NULL, 5, NULL, NULL, 'radio', 'What is your favorite ice cream?', '1, Chocolate \\n 2, Vanilla \\n 3, Strawberry', NULL, NULL, NULL, NULL, NULL, NULL, 1, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4432(@project_id, 'slider', NULL, 'survey', NULL, 6, NULL, 'Section 2', 'slider', 'How much do you like [ice_cream] ice cream?', 'Hate it | Indifferent | I love [ice_cream]!', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4433(@project_id, 'number', NULL, 'survey', NULL, 7, NULL, NULL, 'text', 'Enter your favorite number', NULL, NULL, 'int', NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4434(@project_id, 'calc', NULL, 'survey', NULL, 8, NULL, NULL, 'calc', 'Your favorite number above multiplied by 4 is:', '[number]*4', '[number] x 4 = [calc]', NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4435(@project_id, 'confirm_name', NULL, 'survey', NULL, 9, NULL, NULL, 'radio', 'Please confirm your name', '0, [first_name] Harris \\n 1, [first_name] [last_name] \\n 2, [first_name] Taylor \\n 3, [first_name] deGrasse Tyson', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4436(@project_id, 'confirm_name_error', NULL, 'survey', NULL, 10, NULL, NULL, 'descriptive', '<div class="red" style="padding:30px;"><b>ERROR:</b> Please try again!</div>', NULL, NULL, NULL, NULL, NULL, NULL, '[confirm_name] != '''' and [confirm_name] != ''1''', 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4437(@project_id, 'review_answers', NULL, 'survey', NULL, 11, NULL, 'Review answers', 'descriptive', 'Review your answers below:\n\n<div style="font-size:14px;color:red;">Date: [date_today]\nName: [first_name] [last_name]\nFavorite ice cream: [ice_cream]\nFavorite number multiplied by 4: [calc]</div>\n\nIf all your responses look correct and you did not leave any blank, then click the Submit button below.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL),
4438(@project_id, 'survey_complete', NULL, 'survey', NULL, 12, NULL, 'Form Status', 'select', 'Complete?', '0, Incomplete \\n 1, Unverified \\n 2, Complete', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, NULL);
4439
4440INSERT INTO `redcap_projects_templates` (`project_id`, `title`, `description`, `enabled`)
4441 VALUES (@project_id, @project_title, 'Contains a single data collection instrument enabled as a survey, which contains questions to demonstrate the Piping feature.', '1');
4442-- SQL TO CREATE A REDCAP DEMO PROJECT --
4443set @project_title = 'Repeating Instruments';
4444
4445-- Obtain default values --
4446set @institution = (select value from redcap_config where field_name = 'institution' limit 1);
4447set @site_org_type = (select value from redcap_config where field_name = 'site_org_type' limit 1);
4448set @grant_cite = (select value from redcap_config where field_name = 'grant_cite' limit 1);
4449set @project_contact_name = (select value from redcap_config where field_name = 'project_contact_name' limit 1);
4450set @project_contact_email = (select value from redcap_config where field_name = 'project_contact_email' limit 1);
4451set @headerlogo = (select value from redcap_config where field_name = 'headerlogo' limit 1);
4452set @auth_meth = (select value from redcap_config where field_name = 'auth_meth_global' limit 1);
4453-- Create project --
4454INSERT INTO `redcap_projects`
4455(project_name, app_title, status, count_project, auth_meth, creation_time, production_time, institution, site_org_type, grant_cite, project_contact_name, project_contact_email, headerlogo, display_project_logo_institution, auto_inc_set) VALUES
4456(concat('redcap_demo_',LEFT(sha1(rand()),6)), @project_title, 1, 0, @auth_meth, now(), now(), @institution, @site_org_type, @grant_cite, @project_contact_name, @project_contact_email, @headerlogo, 0, 1);
4457set @project_id = LAST_INSERT_ID();
4458-- User rights --
4459INSERT INTO `redcap_user_rights` (`project_id`, `username`, `expiration`, `group_id`, `lock_record`, `data_export_tool`, `data_import_tool`, `data_comparison_tool`, `data_logging`, `file_repository`, `double_data`, `user_rights`, `data_access_groups`, `graphical`, `reports`, `design`, `calendar`, `data_entry`, `data_quality_execute`) VALUES
4460(@project_id, 'site_admin', NULL, NULL, 0, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 0, 1, '', 1);
4461-- Create single arm --
4462INSERT INTO redcap_events_arms (project_id, arm_num, arm_name) VALUES (@project_id, 1, 'Arm 1');
4463set @arm_id = LAST_INSERT_ID();
4464-- Create single event --
4465INSERT INTO redcap_events_metadata (arm_id, day_offset, offset_min, offset_max, descrip) VALUES (@arm_id, 0, 0, 0, 'Event 1');
4466set @event_id = LAST_INSERT_ID();
4467-- Insert into redcap_metadata --
4468INSERT INTO `redcap_metadata` (`project_id`, `field_name`, `field_phi`, `form_name`, `form_menu_description`, `field_order`, `field_units`, `element_preceding_header`, `element_type`, `element_label`, `element_enum`, `element_note`, `element_validation_type`, `element_validation_min`, `element_validation_max`, `element_validation_checktype`, `branching_logic`, `field_req`, `edoc_id`, `edoc_display_img`, `custom_alignment`, `stop_actions`, `question_num`, `grid_name`, `grid_rank`, `misc`, `video_url`, `video_display_inline`) VALUES
4469(@project_id, 'record_id', NULL, 'demographics', 'Demographics', 1, NULL, NULL, 'text', 'Study ID', NULL, NULL, NULL, NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, 0, NULL, NULL, 0),
4470(@project_id, 'first_name', '1', 'demographics', NULL, 2, NULL, NULL, 'text', 'First Name', NULL, NULL, NULL, NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, 0, NULL, NULL, 0),
4471(@project_id, 'last_name', '1', 'demographics', NULL, 3, NULL, NULL, 'text', 'Last Name', NULL, NULL, NULL, NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, 0, NULL, NULL, 0),
4472(@project_id, 'gender', NULL, 'demographics', NULL, 4, NULL, NULL, 'radio', 'Gender', '0, Female \\n 1, Male \\n 2, Other \\n 3, Prefer not to say', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, 0, NULL, NULL, 0),
4473(@project_id, 'notes', NULL, 'demographics', NULL, 5, NULL, NULL, 'textarea', 'Notes', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, 0, NULL, NULL, 0),
4474(@project_id, 'demographics_complete', NULL, 'demographics', NULL, 6, NULL, 'Form Status', 'select', 'Complete?', '0, Incomplete \\n 1, Unverified \\n 2, Complete', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, 0, NULL, NULL, 0),
4475(@project_id, 'medication_name', NULL, 'medications', 'Medications', 7, NULL, NULL, 'text', 'Medication name', NULL, NULL, NULL, NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, 0, NULL, NULL, 0),
4476(@project_id, 'dosage', NULL, 'medications', NULL, 8, NULL, NULL, 'text', 'Dosage', NULL, 'mg', 'float', NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, 0, NULL, NULL, 0),
4477(@project_id, 'medications_complete', NULL, 'medications', NULL, 9, NULL, 'Form Status', 'select', 'Complete?', '0, Incomplete \\n 1, Unverified \\n 2, Complete', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, 0, NULL, NULL, 0),
4478(@project_id, 'family_member', NULL, 'family_members', 'Family Members', 10, NULL, 'Family member information', 'text', 'Name of family member', NULL, NULL, NULL, NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, 0, NULL, NULL, 0),
4479(@project_id, 'relation_to_patient', NULL, 'family_members', NULL, 11, NULL, NULL, 'select', 'Relation to patient', '1, Sibling\\n2, Spouse\\n3, Parent\\n4, Child very long choice right here that is long\\n5, Other', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, 0, NULL, NULL, 0),
4480(@project_id, 'age_of_family_member', NULL, 'family_members', NULL, 12, NULL, NULL, 'text', 'Age of family member', NULL, NULL, 'int', NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, 0, NULL, NULL, 0),
4481(@project_id, 'family_members_complete', NULL, 'family_members', NULL, 13, NULL, 'Form Status', 'select', 'Complete?', '0, Incomplete \\n 1, Unverified \\n 2, Complete', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, 0, NULL, NULL, 0),
4482(@project_id, 'visit_date', NULL, 'visits', 'Visits', 14, NULL, NULL, 'text', 'Date', NULL, NULL, 'date_mdy', NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, 0, '@TODAY', NULL, 0),
4483(@project_id, 'weight', NULL, 'visits', NULL, 15, NULL, NULL, 'text', 'Weight', NULL, NULL, 'float', NULL, NULL, 'soft_typed', NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, 0, NULL, NULL, 0),
4484(@project_id, 'other_visit_data', NULL, 'visits', NULL, 16, NULL, NULL, 'textarea', 'Other data', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, 0, NULL, NULL, 0),
4485(@project_id, 'visits_complete', NULL, 'visits', NULL, 17, NULL, 'Form Status', 'select', 'Complete?', '0, Incomplete \\n 1, Unverified \\n 2, Complete', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, 0, NULL, NULL, 0),
4486(@project_id, 'aeyn', NULL, 'adverse_events', 'Adverse Events', 18, NULL, NULL, 'radio', 'Were any adverse events experienced?', '0, No\\n1, Yes', 'Indicate if the subject experienced any adverse events.', NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, 0, NULL, NULL, 0),
4487(@project_id, 'aespid', NULL, 'adverse_events', NULL, 19, NULL, NULL, 'text', 'AE Identifier', NULL, 'Record unique identifier for each adverse event for this subject.<br><br>Number sequence for all following forms should not duplicate existing numbers for the subject.', NULL, NULL, NULL, 'soft_typed', '[aeyn] = "1"', 0, NULL, 0, NULL, NULL, NULL, NULL, 0, NULL, NULL, 0),
4488(@project_id, 'aeterm', NULL, 'adverse_events', NULL, 20, NULL, NULL, 'text', 'What is the adverse event term?', NULL, 'Record only one diagnosis, sign or symptom per form (e.g., nausea and vomiting should not be recorded in the same entry, but as two separate entries). See eCRF completion instruction for more information.', NULL, NULL, NULL, 'soft_typed', '[aeyn] = "1"', 0, NULL, 0, NULL, NULL, NULL, NULL, 0, NULL, NULL, 0),
4489(@project_id, 'aeoccur', NULL, 'adverse_events', NULL, 21, NULL, NULL, 'radio', 'Does the subject have (specific adverse event)?', '0, No\\n1, Yes', 'Please indicate if (specific adverse event) has occurred /is occurring by checking Yes or No.', NULL, NULL, NULL, NULL, '[aeyn] = "1"', 0, NULL, 0, NULL, NULL, NULL, NULL, 0, NULL, NULL, 0),
4490(@project_id, 'aestdat', NULL, 'adverse_events', NULL, 22, NULL, NULL, 'text', 'What is the date the adverse event started?', NULL, 'Record the start date of the adverse event using the MM-DD-YYYY format.', 'date_mdy', NULL, NULL, 'soft_typed', '[aeyn] = "1"', 0, NULL, 0, NULL, NULL, NULL, NULL, 0, NULL, NULL, 0),
4491(@project_id, 'aesttim', NULL, 'adverse_events', NULL, 23, NULL, NULL, 'text', 'At what time did the adverse event start?', NULL, 'If appropriate, record the time the AE started using the HH:MM (24-hour clock) format.', 'time', NULL, NULL, 'soft_typed', '[aeyn] = "1"', 0, NULL, 0, NULL, NULL, NULL, NULL, 0, NULL, NULL, 0),
4492(@project_id, 'aeongo', NULL, 'adverse_events', NULL, 24, NULL, NULL, 'radio', 'Is the adverse event still ongoing?', '0, No\\n1, Yes', 'Select one.', NULL, NULL, NULL, NULL, '[aeyn] = "1"', 0, NULL, 0, NULL, NULL, NULL, NULL, 0, NULL, NULL, 0),
4493(@project_id, 'aeendat', NULL, 'adverse_events', NULL, 25, NULL, NULL, 'text', 'What date did the adverse event end?', NULL, 'Record the end date of the adverse event using the MM-DD-YYYY format.', 'date_mdy', NULL, NULL, 'soft_typed', '[aeongo] = "0"', 0, NULL, 0, NULL, NULL, NULL, NULL, 0, NULL, NULL, 0),
4494(@project_id, 'aeentim', NULL, 'adverse_events', NULL, 26, NULL, NULL, 'text', 'At what time did the adverse event end?', NULL, 'If appropriate, record the time the AE ended using the HH:MM (24-hour clock) format.', 'time', NULL, NULL, 'soft_typed', '[aeongo] = "0"', 0, NULL, 0, NULL, NULL, NULL, NULL, 0, NULL, NULL, 0),
4495(@project_id, 'aesev', NULL, 'adverse_events', NULL, 27, NULL, NULL, 'radio', 'What was the severity of the adverse event?', '1, Mild\\n2, Moderate\\n3, Severe', 'The reporting physician/healthcare professional will assess the severity of the event using the sponsor-defined categories. This assessment is subjective and the reporting physician/ healthcare professional should use medical judgment to compare the reported Adverse Event to similar type events observed in clinical practice. Severity is not equivalent to seriousness.', NULL, NULL, NULL, NULL, '[aeyn] = "1"', 0, NULL, 0, NULL, NULL, NULL, NULL, 0, NULL, NULL, 0),
4496(@project_id, 'aetoxgr', NULL, 'adverse_events', NULL, 28, NULL, NULL, 'radio', 'What is the toxicity grade of the adverse event?', '1, Grade 1\\n2, Grade 2\\n3, Grade 3\\n4, Grade 4\\n5, Grade 5', 'Severity CTCAE Grade<br><br>The reporting physician/healthcare professional will assess the severity of the adverse event using the toxicity grades.', NULL, NULL, NULL, NULL, '[aeyn] = "1"', 0, NULL, 0, NULL, NULL, NULL, NULL, 0, NULL, NULL, 0),
4497(@project_id, 'aeser', NULL, 'adverse_events', NULL, 29, NULL, NULL, 'radio', 'Is the adverse event serious?', '0, No\\n1, Yes', 'Assess if an adverse event should be classified as serious based on the serious criteria defined in the protocol.', NULL, NULL, NULL, NULL, '[aeyn] = "1"', 0, NULL, 0, NULL, NULL, NULL, NULL, 0, NULL, NULL, 0),
4498(@project_id, 'aescong', NULL, 'adverse_events', NULL, 30, NULL, NULL, 'radio', 'Is the adverse event associated with a congenital anomaly or birth defect?', '0, No\\n1, Yes', 'Record whether the serious adverse event was associated with congenital anomaly or birth defect.', NULL, NULL, NULL, NULL, '[aeser] = "1"', 0, NULL, 0, NULL, NULL, NULL, NULL, 0, NULL, NULL, 0),
4499(@project_id, 'aesdisab', NULL, 'adverse_events', NULL, 31, NULL, NULL, 'radio', 'Did the adverse event result in Persistent or significant disability or incapacity?', '0, No\\n1, Yes', 'Record whether the serious adverse event resulted in a persistent or significant disability or incapacity.', NULL, NULL, NULL, NULL, '[aeser] = "1"', 0, NULL, 0, NULL, NULL, NULL, NULL, 0, NULL, NULL, 0),
4500(@project_id, 'aesdth', NULL, 'adverse_events', NULL, 32, NULL, NULL, 'radio', 'Did the adverse event result in death?', '0, No\\n1, Yes', 'Record whether the serious adverse event resulted in death.', NULL, NULL, NULL, NULL, '[aeser] = "1"', 0, NULL, 0, NULL, NULL, NULL, NULL, 0, NULL, NULL, 0),
4501(@project_id, 'aeshosp', NULL, 'adverse_events', NULL, 33, NULL, NULL, 'radio', 'Did the adverse event result in initial or prolonged hospitalization for the subject?', '0, No\\n1, Yes', 'Record whether the serious adverse event resulted in an initial or prolonged hospitalization.', NULL, NULL, NULL, NULL, '[aeser] = "1"', 0, NULL, 0, NULL, NULL, NULL, NULL, 0, NULL, NULL, 0),
4502(@project_id, 'aeslife', NULL, 'adverse_events', NULL, 34, NULL, NULL, 'radio', 'Is the adverse event Life Threatening?', '0, No\\n1, Yes', 'Record whether the serious adverse event is life threatening.', NULL, NULL, NULL, NULL, '[aeser] = "1"', 0, NULL, 0, NULL, NULL, NULL, NULL, 0, NULL, NULL, 0),
4503(@project_id, 'aesmie', NULL, 'adverse_events', NULL, 35, NULL, NULL, 'radio', 'Is the adverse event a medically important event not covered by other ?serious? criteria?', '0, No\\n1, Yes', 'Record whether the serious adverse event is an important medical event, which may be defined in the protocol or in the Investigator Brochure.', NULL, NULL, NULL, NULL, '[aeser] = "1"', 0, NULL, 0, NULL, NULL, NULL, NULL, 0, NULL, NULL, 0),
4504(@project_id, 'aerel', NULL, 'adverse_events', NULL, 36, NULL, NULL, 'radio', 'Is this event related to study treatment?', '1, Definitely\\n2, Probably\\n3, Possibly\\n4, Not Related', 'Indicate if the cause of the adverse event is related to the study treatment and cannot be reasonably explained by other factors (e.g., subject\'s clinical state, concomitant therapy, and/or other interventions).', NULL, NULL, NULL, NULL, '[aeyn] = "1"', 0, NULL, 0, NULL, NULL, NULL, NULL, 0, NULL, NULL, 0),
4505(@project_id, 'aeacn', NULL, 'adverse_events', NULL, 37, NULL, NULL, 'radio', 'What action was taken with study treatment?', '1, Dose Increased\\n2, Dose Not Changed\\n3, Dose Reduced\\n4, Drug Interrupted\\n5, Drug Withdrawn\\n6, Not Applicable\\n99, Unknown', 'Record changes made to the study treatment resulting from the adverse event.', NULL, NULL, NULL, NULL, '[aeyn] = "1"', 0, NULL, 0, NULL, NULL, NULL, NULL, 0, NULL, NULL, 0),
4506(@project_id, 'aeacnoth', NULL, 'adverse_events', NULL, 38, NULL, NULL, 'textarea', 'What other action was taken in response to this adverse event?', NULL, 'Record all action(s) taken resulting from the adverse event.', NULL, NULL, NULL, NULL, '[aeyn] = "1"', 0, NULL, 0, NULL, NULL, NULL, NULL, 0, NULL, NULL, 0),
4507(@project_id, 'aeout', NULL, 'adverse_events', NULL, 39, NULL, NULL, 'radio', 'What was the outcome of this adverse event?', '1, Fatal\\n2, Not recovered / Not resolved\\n3, Recovered / Resolved\\n4, Recovered / Resolved with sequelae\\n5, Recovering / Resolving\\n99, Unknown', 'Record the appropriate outcome of the event in relation to the subject\'s status.', NULL, NULL, NULL, NULL, '[aeyn] = "1"', 0, NULL, 0, NULL, NULL, NULL, NULL, 0, NULL, NULL, 0),
4508(@project_id, 'aedis', NULL, 'adverse_events', NULL, 40, NULL, NULL, 'radio', 'Did the adverse event cause the subject to be discontinued from the study?', '0, No\\n1, Yes', 'Record if the AE caused the subject to discontinue from the study.', NULL, NULL, NULL, NULL, '[aeyn] = "1"', 0, NULL, 0, NULL, NULL, NULL, NULL, 0, NULL, NULL, 0),
4509(@project_id, 'adverse_events_complete', NULL, 'adverse_events', NULL, 41, NULL, 'Form Status', 'select', 'Complete?', '0, Incomplete \\n 1, Unverified \\n 2, Complete', NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL, NULL, 0, NULL, NULL, 0);
4510INSERT INTO `redcap_events_repeat` (`event_id`, `form_name`, `custom_repeat_form_label`) VALUES
4511(@event_id, 'adverse_events', NULL),
4512(@event_id, 'family_members', '[family_member]'),
4513(@event_id, 'medications', '[medication_name] [dosage]mg'),
4514(@event_id, 'visits', '[weight]kg ([visit_date])');
4515INSERT INTO `redcap_projects_templates` (`project_id`, `title`, `description`, `enabled`)
4516 VALUES (@project_id, @project_title, 'Example classic project showcasing the Repeating Instruments functionality.', '1');