personalcancertoolkit / openmrs-module-patientportaltoolkit

Other
7 stars 9 forks source link

Create Event Table #392

Closed maurya closed 3 years ago

maurya commented 3 years ago

event_log table

name type description
id long int unsigned not null auto_increment primary key
created_at timestamp default NOW()
user_id users.user_id foreign key to user
event varchar(50) not null pre-defined event name like TREATMENT_TAB_VIEWED
event_data json optional data for event (will vary by event type), if MySQL < 5.7, we'll have to use text data type
bmamlin commented 3 years ago

@maurya fyi, I edited your description to flesh out the design a bit

maurya commented 3 years ago

sql for the table

CREATE TABLE `openmrs`.`patientportal_event_log` (
  `id` INT UNSIGNED NOT NULL AUTO_INCREMENT,
  `created_at` TIMESTAMP(3) NOT NULL DEFAULT NOW(3),
  `user_id` INT NULL,
  `event` VARCHAR(50) NOT NULL,
  `event_data` JSON NULL,
  PRIMARY KEY (`id`),
  INDEX `User_id_fk_idx` (`user_id` ASC),
  CONSTRAINT `User_id_fk`
    FOREIGN KEY (`user_id`)
    REFERENCES `openmrs`.`users` (`user_id`)
    ON DELETE NO ACTION
    ON UPDATE NO ACTION);
maurya commented 3 years ago

Added the event Table code commit - https://github.com/personalcancertoolkit/openmrs-module-patientportaltoolkit/commit/3f53ac16aed3e58e4869238b0092de4f5a95d479

maurya commented 3 years ago

added the javascript piece here - https://github.com/personalcancertoolkit/openmrs-module-patientportaltoolkit/commit/ec19339141f007ef22521315217f53af4a02c615