Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Summary

There are multiple attribute tables that exist in Pellucid. Each links to a different table. Each attributes table holds attributes for their respective entities. Attribute is the type and value is the value of the attribute (e.g. designation, emergency).

...

Table Creation


CREATE TABLE hospital_attributes ( 
`attribute_id` int(11) unsigned NOT NULL AUTO_INCREMENT, 
`entity_id` bigint(20) unsigned NOT NULL, 
`attribute` varchar(255) NOT NULL, 
`value` varchar(255) DEFAULT NULL, 
`created` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', 
`modified` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP, 
`source` varchar(64) DEFAULT NULL, 
PRIMARY KEY (`attribute_id`), 
KEY `entity_id` (`entity_id`), 
CONSTRAINT `hospital_attributes_ibfk_1` FOREIGN KEY (`entity_id`) REFERENCES `entity_hospitals` (`entity_id`) ON DELETE CASCADE 
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

 

Field Information


`attribute_id` unique ID that identifies each attribute 
`entity_id` ID number that indicates an entity or asc. Links to the entity_hospitals or entity_ascs tables 
`attribute` descriptors identifying the type of attribute associated with the entity 
`value` the value of the attribute 
`created` the date and time the row was created in YYYY-MM-DD HH:MM:SS format 
`modified` the date and time the row was last edited in YYYY-MM-DD HH:MM:SS format

 

Fields
fieldtypeattributesnotesexample
attribute_idINT(11)UNSIGNED NOT NULL AUTO_INCREMENTProvided by Pellucid1234567
entity_idBIGINT(20)UNSIGNED NOT NULLProvided by Pellucid, FOREIGN KEY: links to entities987654321
attributeVARCHAR(255)NOT NULLDetermined by IPROaa_md
valueVARCHAR(255)DEFAULT NULLDetermined by IPROemergency
createdtimestampNOT NULL DEFAULT '0000-00-00 00:00:00'The date and time the row was created2010-09-16 09:15:36
modifiedtimestampNOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMPThe date and time the row was edited2010-09-16 09:15:36
sourceVARCHAR(64)DEFAULT NULLThe source of the attributes dataabc1


PRIMARY KEY (`attribute_id`) 
KEY `entity_id` (`entity_id`) 
CONSTRAINT `hospital_attributes_ibfk_1` FOREIGN KEY (`entity_id`) REFERENCES `entity_hospitals` (`entity_id`) ON DELETE CASCADE

 

Notes

Some of the attributes tables will also have a source associated with them.  This is a VARCHAR field that allows us to identify where the data is coming from

The attribute_id is the primary key and is unique to the table, but can be used multiple times in different attributes tables.  As such, it differs from the entity_id that is specifically designed to be unique across multiple tables.