This conversation is an example of Informal design review.
Requirement:
The project currently lacks a central repository for metadata. One of our need is to get list of patient related tables.
Existing resources:
There are some scripts in current code that do this - each in its own way. Two useful scripts are deleter.php which deletes patient file/record and LOG_TABLES in EventAuditLogger.php. Both have list of hard coded entries.
Proposed Changes:
- Add two tables for storing metadata.
CREATE TABLE
devobj
(
id
int(11) NOT NULL AUTO_INCREMENT,
obj_type
varchar(255) NOT NULL,
obj_key
varchar(255) NOT NULL,
obj_context
varchar(255) NOT NULL,
obj_desc
varchar(255) DEFAULT NULL,
active
tinyint(1) DEFAULT ‘1’ COMMENT ‘0 = inactive, 1 = active’,
obj_json
json DEFAULT NULL COMMENT ‘json data for the object’,
PRIMARY KEY (id
),
UNIQUE KEYix_devobj
(obj_type
,obj_key
,obj_context
)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;CREATE TABLE
devobj_component
(
devobj_id
int(11) NOT NULL,
compobj_id
int(11) NOT NULL,
comp_type
varchar(255) NOT NULL,
comp_seq
int(11) DEFAULT ‘0’,
PRIMARY KEY (devobj_id
,compobj_id
,comp_type
)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-
Provide class src/DevObject/OdDevObject.php and possibly OdDevFile.php which extends OdDevObject. These should support basic data entry with minimal validation using a form like :
-
Initial setup to include a single devobject as follows:
type: OpenEMR\DevObject\OdDevObject
key: db.patient.tables
json: list of all known patient related tables in valid json form as"table": "pid column"
e.g.
{“patient_data” : “pid”, “immunizations”: “patient_id”, “documents”: “foreign_id”, …}
- Test by updating current deleter.php - remove hardcoded table names only. No logic change should be performed.
Design lockdown:
4/15/2020.