...
Code Block | ||
---|---|---|
| ||
CREATE TABLE `WeeklyAdherenceReports` (
`appId` varchar(255) NOT NULL,
`studyId` varchar(255) NOT NULL,
`userId` varchar(255) NOT NULL,
`createdOn` bigint(20) unsigned NOT NULL,
`labels` text NOT NULL,
`weeklyAdherencePercent` int(3) unsigned NOT NULL,
`reportData` mediumtext NOT NULL,
PRIMARY KEY (`appId`, `studyId`, `userId`),
CONSTRAINT `WeeklyAdherenceReports-Study-Constraint`
FOREIGN KEY (`studyId`, `appId`)
REFERENCES `Substudies` (`id`, `studyId`) ON DELETE CASCADE,
CONSTRAINT `WeeklyAdherenceReports-Account-Constraint`
FOREIGN KEY (`userId`)
REFERENCES `Accounts` (`id`) ON DELETE CASCADE,
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; |
The “labels” column “labels“ columns will pull out the labels from the JSON into a pipe-delimited string, to enable searching for records that match the label in the study-scoped API (searching by label and percentage of adherence are UI design requirements). Note that right now, this would mean the server would need to create the labels and the client would need to search with those server-supplied labels.
Weekly Adherence Reports for Study
...