{"action":"created","comment":{"url":"https://api.github.com/repos/aces/Loris/pulls/comments/170049066","pull_request_review_id":98675657,"id":170049066,"diff_hunk":"@@ -0,0 +1,41 @@\n+INSERT INTO ConfigSettings (Name, Description, Visible, AllowMultiple, DataType, Parent, Label, OrderNumber) SELECT 'useConsent', 'Enable if the study uses the loris architecture for consent', 1, 0, 'boolean', ID, 'Use consent', 15 FROM ConfigSettings WHERE Name='study';\n+INSERT INTO Config (ConfigID, Value) SELECT ID, 'false' FROM ConfigSettings WHERE Name='useConsent';\n+\n+CREATE TABLE `consent_type` (\n+  `ConsentTypeID` int(2) NOT NULL AUTO_INCREMENT,\n+  `Name` varchar(255) NOT NULL,\n+  `Label` varchar(255) NOT NULL,\n+  CONSTRAINT `PK_consent_type` PRIMARY KEY (`ConsentTypeID`),\n+  CONSTRAINT `UK_consent_type_Name` UNIQUE KEY `Name` (`Name`),\n+  CONSTRAINT `UK_consent_type_Label` UNIQUE KEY `Label` (`Label`)\n+) ENGINE=InnoDB DEFAULT CHARSET=utf8;\n+\n+CREATE TABLE `candidate_consent_type_rel` (\n+  `CandidateID` int(6) NOT NULL,\n+  `ConsentTypeID` int(2) NOT NULL,\n+  `Status` enum('yes', 'no', 'not_answered') NOT NULL,\n+  `DateGiven` date DEFAULT NULL,\n+  `DateWithdrawn` date DEFAULT NULL,\n+  CONSTRAINT `PK_candidate_consent_type_rel` PRIMARY KEY (`CandidateID`,`ConsentTypeID`),\n+  CONSTRAINT `FK_candidate_consent_type_rel_CandidateID` FOREIGN KEY (`CandidateID`)\n+      REFERENCES `candidate` (`CandID`)\n+      ON DELETE RESTRICT\n+      ON UPDATE RESTRICT,\n+  CONSTRAINT `FK_candidate_consent_type_rel_ConsentTypeID` FOREIGN KEY (`ConsentTypeID`)\n+      REFERENCES `consent_type` (`ConsentTypeID`)\n+      ON DELETE RESTRICT\n+      ON UPDATE RESTRICT\n+) ENGINE=InnoDB DEFAULT CHARSET=utf8;\n+\n+CREATE TABLE `candidate_consent_type_history` (\n+  `CandidateConsentHistoryID` int(10) unsigned NOT NULL AUTO_INCREMENT,\n+  `PSCID` varchar(255) NOT NULL,\n+  `ConsentName` varchar(255) NOT NULL,\n+  `ConsentLabel` varchar(255) NOT NULL,\n+  `Status` enum('yes','no','not_answered') NOT NULL,\n+  `DateGiven` date DEFAULT NULL,\n+  `DateWithdrawn` date DEFAULT NULL,\n+  `EntryDate` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,\n+  `EntryStaff` varchar(255) DEFAULT NULL,\n+  CONSTRAINT `PK_candidate_consent_type_history` PRIMARY KEY (`CandidateConsentHistoryID`)\n+) ENGINE=InnoDB DEFAULT CHARSET=utf8;","path":"SQL/Archive/2017-11-01-use_consent_to_database.sql","position":41,"original_position":41,"commit_id":"3b1a6fcae5eac7d0d43d2a143adfb86aa2f56cd4","original_commit_id":"3b1a6fcae5eac7d0d43d2a143adfb86aa2f56cd4","user":{"login":"PapillonMcGill","id":34311645,"avatar_url":"https://avatars0.githubusercontent.com/u/34311645?v=4","gravatar_id":"","url":"https://api.github.com/users/PapillonMcGill","html_url":"https://github.com/PapillonMcGill","followers_url":"https://api.github.com/users/PapillonMcGill/followers","following_url":"https://api.github.com/users/PapillonMcGill/following{/other_user}","gists_url":"https://api.github.com/users/PapillonMcGill/gists{/gist_id}","starred_url":"https://api.github.com/users/PapillonMcGill/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PapillonMcGill/subscriptions","organizations_url":"https://api.github.com/users/PapillonMcGill/orgs","repos_url":"https://api.github.com/users/PapillonMcGill/repos","events_url":"https://api.github.com/users/PapillonMcGill/events{/privacy}","received_events_url":"https://api.github.com/users/PapillonMcGill/received_events","type":"User","site_admin":false},"body":"still some varchar() before date and timestamp,\r\nNullable should be after not null","created_at":"2018-02-22T18:22:50Z","updated_at":"2018-02-22T18:22:50Z","html_url":"https://github.com/aces/Loris/pull/3504#discussion_r170049066","pull_request_url":"https://api.github.com/repos/aces/Loris/pulls/3504","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/aces/Loris/pulls/comments/170049066"},"html":{"href":"https://github.com/aces/Loris/pull/3504#discussion_r170049066"},"pull_request":{"href":"https://api.github.com/repos/aces/Loris/pulls/3504"}}},"pull_request":{"url":"https://api.github.com/repos/aces/Loris/pulls/3504","id":170292029,"html_url":"https://github.com/aces/Loris/pull/3504","diff_url":"https://github.com/aces/Loris/pull/3504.diff","patch_url":"https://github.com/aces/Loris/pull/3504.patch","issue_url":"https://api.github.com/repos/aces/Loris/issues/3504","number":3504,"state":"open","locked":false,"title":"[Candidate_parameters, Core] Normalizing Consent in LORIS","user":{"login":"zaliqarosli","id":17415878,"avatar_url":"https://avatars3.githubusercontent.com/u/17415878?v=4","gravatar_id":"","url":"https://api.github.com/users/zaliqarosli","html_url":"https://github.com/zaliqarosli","followers_url":"https://api.github.com/users/zaliqarosli/followers","following_url":"https://api.github.com/users/zaliqarosli/following{/other_user}","gists_url":"https://api.github.com/users/zaliqarosli/gists{/gist_id}","starred_url":"https://api.github.com/users/zaliqarosli/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zaliqarosli/subscriptions","organizations_url":"https://api.github.com/users/zaliqarosli/orgs","repos_url":"https://api.github.com/users/zaliqarosli/repos","events_url":"https://api.github.com/users/zaliqarosli/events{/privacy}","received_events_url":"https://api.github.com/users/zaliqarosli/received_events","type":"User","site_admin":false},"body":"This pull request transforms the current implementation of consent in LORIS into a normalized structure. Current behaviour on the front-end should not be changed.\r\n\r\nChanges targeted and made include:\r\n- [x] update schema\r\n- [x] patch to create new tables\r\n- [x] script to move data into new tables and delete old ones\r\n- [x] moving config settings from config.xml to DB / update all $config->getSetting calls\r\n- [x] update ajax scripts\r\n- [x] add helper functions to php/libraries/\r\n\r\nDiscussions required:\r\n- [ ] on options for statuses of consent\r\n- [ ] on default status and coalescing when querying consent in DQT \r\n\r\nMoving forward:\r\n\r\nThe ajax scripts are a little hacky in order to be compatible with changes in the back-end while keeping the front-end untouched. The next step would be to clean up how consent is used in the front-end and fix up the ajax scripts in parallel. https://github.com/aces/Loris/pull/3315 will also be implemented after discussion.\r\n\r\nWould love any and all feedback and discussion on this!\r\n\r\nSee also: https://github.com/aces/Loris/pull/3263\r\n","created_at":"2018-02-20T19:54:03Z","updated_at":"2018-02-22T18:22:50Z","closed_at":null,"merged_at":null,"merge_commit_sha":"208c4bd6581ebfc25ae7f8193da4648bb54cae4b","assignee":null,"assignees":[],"requested_reviewers":[{"login":"driusan","id":498329,"avatar_url":"https://avatars0.githubusercontent.com/u/498329?v=4","gravatar_id":"","url":"https://api.github.com/users/driusan","html_url":"https://github.com/driusan","followers_url":"https://api.github.com/users/driusan/followers","following_url":"https://api.github.com/users/driusan/following{/other_user}","gists_url":"https://api.github.com/users/driusan/gists{/gist_id}","starred_url":"https://api.github.com/users/driusan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/driusan/subscriptions","organizations_url":"https://api.github.com/users/driusan/orgs","repos_url":"https://api.github.com/users/driusan/repos","events_url":"https://api.github.com/users/driusan/events{/privacy}","received_events_url":"https://api.github.com/users/driusan/received_events","type":"User","site_admin":false}],"requested_teams":[],"labels":[{"id":152314516,"url":"https://api.github.com/repos/aces/Loris/labels/Cleanup","name":"Cleanup","color":"006b75","default":false},{"id":292439222,"url":"https://api.github.com/repos/aces/Loris/labels/Discussion%20Required","name":"Discussion Required","color":"ff99cc","default":false},{"id":153844577,"url":"https://api.github.com/repos/aces/Loris/labels/SQL","name":"SQL","color":"bfe5bf","default":false},{"id":708895955,"url":"https://api.github.com/repos/aces/Loris/labels/[branch]%20minor","name":"[branch] minor","color":"996633","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/aces/Loris/pulls/3504/commits","review_comments_url":"https://api.github.com/repos/aces/Loris/pulls/3504/comments","review_comment_url":"https://api.github.com/repos/aces/Loris/pulls/comments{/number}","comments_url":"https://api.github.com/repos/aces/Loris/issues/3504/comments","statuses_url":"https://api.github.com/repos/aces/Loris/statuses/3b1a6fcae5eac7d0d43d2a143adfb86aa2f56cd4","head":{"label":"zaliqarosli:normalise_consent","ref":"normalise_consent","sha":"3b1a6fcae5eac7d0d43d2a143adfb86aa2f56cd4","user":{"login":"zaliqarosli","id":17415878,"avatar_url":"https://avatars3.githubusercontent.com/u/17415878?v=4","gravatar_id":"","url":"https://api.github.com/users/zaliqarosli","html_url":"https://github.com/zaliqarosli","followers_url":"https://api.github.com/users/zaliqarosli/followers","following_url":"https://api.github.com/users/zaliqarosli/following{/other_user}","gists_url":"https://api.github.com/users/zaliqarosli/gists{/gist_id}","starred_url":"https://api.github.com/users/zaliqarosli/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zaliqarosli/subscriptions","organizations_url":"https://api.github.com/users/zaliqarosli/orgs","repos_url":"https://api.github.com/users/zaliqarosli/repos","events_url":"https://api.github.com/users/zaliqarosli/events{/privacy}","received_events_url":"https://api.github.com/users/zaliqarosli/received_events","type":"User","site_admin":false},"repo":{"id":113231564,"name":"Loris","full_name":"zaliqarosli/Loris","owner":{"login":"zaliqarosli","id":17415878,"avatar_url":"https://avatars3.githubusercontent.com/u/17415878?v=4","gravatar_id":"","url":"https://api.github.com/users/zaliqarosli","html_url":"https://github.com/zaliqarosli","followers_url":"https://api.github.com/users/zaliqarosli/followers","following_url":"https://api.github.com/users/zaliqarosli/following{/other_user}","gists_url":"https://api.github.com/users/zaliqarosli/gists{/gist_id}","starred_url":"https://api.github.com/users/zaliqarosli/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zaliqarosli/subscriptions","organizations_url":"https://api.github.com/users/zaliqarosli/orgs","repos_url":"https://api.github.com/users/zaliqarosli/repos","events_url":"https://api.github.com/users/zaliqarosli/events{/privacy}","received_events_url":"https://api.github.com/users/zaliqarosli/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/zaliqarosli/Loris","description":"LORIS is a web-accessible database solution for longitudinal multi-site studies.","fork":true,"url":"https://api.github.com/repos/zaliqarosli/Loris","forks_url":"https://api.github.com/repos/zaliqarosli/Loris/forks","keys_url":"https://api.github.com/repos/zaliqarosli/Loris/keys{/key_id}","collaborators_url":"https://api.github.com/repos/zaliqarosli/Loris/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/zaliqarosli/Loris/teams","hooks_url":"https://api.github.com/repos/zaliqarosli/Loris/hooks","issue_events_url":"https://api.github.com/repos/zaliqarosli/Loris/issues/events{/number}","events_url":"https://api.github.com/repos/zaliqarosli/Loris/events","assignees_url":"https://api.github.com/repos/zaliqarosli/Loris/assignees{/user}","branches_url":"https://api.github.com/repos/zaliqarosli/Loris/branches{/branch}","tags_url":"https://api.github.com/repos/zaliqarosli/Loris/tags","blobs_url":"https://api.github.com/repos/zaliqarosli/Loris/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/zaliqarosli/Loris/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/zaliqarosli/Loris/git/refs{/sha}","trees_url":"https://api.github.com/repos/zaliqarosli/Loris/git/trees{/sha}","statuses_url":"https://api.github.com/repos/zaliqarosli/Loris/statuses/{sha}","languages_url":"https://api.github.com/repos/zaliqarosli/Loris/languages","stargazers_url":"https://api.github.com/repos/zaliqarosli/Loris/stargazers","contributors_url":"https://api.github.com/repos/zaliqarosli/Loris/contributors","subscribers_url":"https://api.github.com/repos/zaliqarosli/Loris/subscribers","subscription_url":"https://api.github.com/repos/zaliqarosli/Loris/subscription","commits_url":"https://api.github.com/repos/zaliqarosli/Loris/commits{/sha}","git_commits_url":"https://api.github.com/repos/zaliqarosli/Loris/git/commits{/sha}","comments_url":"https://api.github.com/repos/zaliqarosli/Loris/comments{/number}","issue_comment_url":"https://api.github.com/repos/zaliqarosli/Loris/issues/comments{/number}","contents_url":"https://api.github.com/repos/zaliqarosli/Loris/contents/{+path}","compare_url":"https://api.github.com/repos/zaliqarosli/Loris/compare/{base}...{head}","merges_url":"https://api.github.com/repos/zaliqarosli/Loris/merges","archive_url":"https://api.github.com/repos/zaliqarosli/Loris/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/zaliqarosli/Loris/downloads","issues_url":"https://api.github.com/repos/zaliqarosli/Loris/issues{/number}","pulls_url":"https://api.github.com/repos/zaliqarosli/Loris/pulls{/number}","milestones_url":"https://api.github.com/repos/zaliqarosli/Loris/milestones{/number}","notifications_url":"https://api.github.com/repos/zaliqarosli/Loris/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/zaliqarosli/Loris/labels{/name}","releases_url":"https://api.github.com/repos/zaliqarosli/Loris/releases{/id}","deployments_url":"https://api.github.com/repos/zaliqarosli/Loris/deployments","created_at":"2017-12-05T20:50:03Z","updated_at":"2017-12-05T20:50:07Z","pushed_at":"2018-02-22T18:07:33Z","git_url":"git://github.com/zaliqarosli/Loris.git","ssh_url":"git@github.com:zaliqarosli/Loris.git","clone_url":"https://github.com/zaliqarosli/Loris.git","svn_url":"https://github.com/zaliqarosli/Loris","homepage":"","size":74110,"stargazers_count":0,"watchers_count":0,"language":"PHP","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":null,"forks":0,"open_issues":0,"watchers":0,"default_branch":"minor"}},"base":{"label":"aces:minor","ref":"minor","sha":"386135586caf9b250f3e04ce6b1cb6802951fc96","user":{"login":"aces","id":472868,"avatar_url":"https://avatars2.githubusercontent.com/u/472868?v=4","gravatar_id":"","url":"https://api.github.com/users/aces","html_url":"https://github.com/aces","followers_url":"https://api.github.com/users/aces/followers","following_url":"https://api.github.com/users/aces/following{/other_user}","gists_url":"https://api.github.com/users/aces/gists{/gist_id}","starred_url":"https://api.github.com/users/aces/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aces/subscriptions","organizations_url":"https://api.github.com/users/aces/orgs","repos_url":"https://api.github.com/users/aces/repos","events_url":"https://api.github.com/users/aces/events{/privacy}","received_events_url":"https://api.github.com/users/aces/received_events","type":"Organization","site_admin":false},"repo":{"id":1125630,"name":"Loris","full_name":"aces/Loris","owner":{"login":"aces","id":472868,"avatar_url":"https://avatars2.githubusercontent.com/u/472868?v=4","gravatar_id":"","url":"https://api.github.com/users/aces","html_url":"https://github.com/aces","followers_url":"https://api.github.com/users/aces/followers","following_url":"https://api.github.com/users/aces/following{/other_user}","gists_url":"https://api.github.com/users/aces/gists{/gist_id}","starred_url":"https://api.github.com/users/aces/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aces/subscriptions","organizations_url":"https://api.github.com/users/aces/orgs","repos_url":"https://api.github.com/users/aces/repos","events_url":"https://api.github.com/users/aces/events{/privacy}","received_events_url":"https://api.github.com/users/aces/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/aces/Loris","description":"LORIS is a web-accessible database solution for longitudinal multi-site studies.","fork":false,"url":"https://api.github.com/repos/aces/Loris","forks_url":"https://api.github.com/repos/aces/Loris/forks","keys_url":"https://api.github.com/repos/aces/Loris/keys{/key_id}","collaborators_url":"https://api.github.com/repos/aces/Loris/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/aces/Loris/teams","hooks_url":"https://api.github.com/repos/aces/Loris/hooks","issue_events_url":"https://api.github.com/repos/aces/Loris/issues/events{/number}","events_url":"https://api.github.com/repos/aces/Loris/events","assignees_url":"https://api.github.com/repos/aces/Loris/assignees{/user}","branches_url":"https://api.github.com/repos/aces/Loris/branches{/branch}","tags_url":"https://api.github.com/repos/aces/Loris/tags","blobs_url":"https://api.github.com/repos/aces/Loris/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/aces/Loris/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/aces/Loris/git/refs{/sha}","trees_url":"https://api.github.com/repos/aces/Loris/git/trees{/sha}","statuses_url":"https://api.github.com/repos/aces/Loris/statuses/{sha}","languages_url":"https://api.github.com/repos/aces/Loris/languages","stargazers_url":"https://api.github.com/repos/aces/Loris/stargazers","contributors_url":"https://api.github.com/repos/aces/Loris/contributors","subscribers_url":"https://api.github.com/repos/aces/Loris/subscribers","subscription_url":"https://api.github.com/repos/aces/Loris/subscription","commits_url":"https://api.github.com/repos/aces/Loris/commits{/sha}","git_commits_url":"https://api.github.com/repos/aces/Loris/git/commits{/sha}","comments_url":"https://api.github.com/repos/aces/Loris/comments{/number}","issue_comment_url":"https://api.github.com/repos/aces/Loris/issues/comments{/number}","contents_url":"https://api.github.com/repos/aces/Loris/contents/{+path}","compare_url":"https://api.github.com/repos/aces/Loris/compare/{base}...{head}","merges_url":"https://api.github.com/repos/aces/Loris/merges","archive_url":"https://api.github.com/repos/aces/Loris/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/aces/Loris/downloads","issues_url":"https://api.github.com/repos/aces/Loris/issues{/number}","pulls_url":"https://api.github.com/repos/aces/Loris/pulls{/number}","milestones_url":"https://api.github.com/repos/aces/Loris/milestones{/number}","notifications_url":"https://api.github.com/repos/aces/Loris/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/aces/Loris/labels{/name}","releases_url":"https://api.github.com/repos/aces/Loris/releases{/id}","deployments_url":"https://api.github.com/repos/aces/Loris/deployments","created_at":"2010-11-30T14:57:57Z","updated_at":"2018-02-13T09:36:32Z","pushed_at":"2018-02-22T18:07:35Z","git_url":"git://github.com/aces/Loris.git","ssh_url":"git@github.com:aces/Loris.git","clone_url":"https://github.com/aces/Loris.git","svn_url":"https://github.com/aces/Loris","homepage":"","size":74069,"stargazers_count":58,"watchers_count":58,"language":"PHP","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":84,"mirror_url":null,"archived":false,"open_issues_count":76,"license":{"key":"gpl-3.0","name":"GNU General Public License v3.0","spdx_id":"GPL-3.0","url":"https://api.github.com/licenses/gpl-3.0"},"forks":84,"open_issues":76,"watchers":58,"default_branch":"minor"}},"_links":{"self":{"href":"https://api.github.com/repos/aces/Loris/pulls/3504"},"html":{"href":"https://github.com/aces/Loris/pull/3504"},"issue":{"href":"https://api.github.com/repos/aces/Loris/issues/3504"},"comments":{"href":"https://api.github.com/repos/aces/Loris/issues/3504/comments"},"review_comments":{"href":"https://api.github.com/repos/aces/Loris/pulls/3504/comments"},"review_comment":{"href":"https://api.github.com/repos/aces/Loris/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/aces/Loris/pulls/3504/commits"},"statuses":{"href":"https://api.github.com/repos/aces/Loris/statuses/3b1a6fcae5eac7d0d43d2a143adfb86aa2f56cd4"}},"author_association":"NONE"}}
{"actor":{"display_login":"PapillonMcGill"}}