Columns
| Column | Type | Size | Nulls | Auto | Default | Children | Parents | Comments | ||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| id | INT | 10 | 0 | 
 |  | Surrogate id of the record used as the primary incrementing key | ||||||||
| uuid | BINARY | 16 | √ | NULL |  |  | Binary of Unique User Identifier that is for both external reference to this entity and for future offline use. | |||||||
| type | enum('file_url', 'blob', 'web_url') | 8 | √ | NULL |  |  | Type of the document (e.g., ‘file_url’, ‘blob’, ‘web_url’) | |||||||
| size | INT | 10 | √ | NULL |  |  | Size of the document in bytes | |||||||
| date | DATETIME | 19 | √ | NULL |  |  | Date when the document was created | |||||||
| url | VARCHAR | 255 | √ | NULL |  |  | URL of the document | |||||||
| mimetype | VARCHAR | 255 | √ | NULL |  |  | MIME type of the document | |||||||
| pages | INT | 10 | √ | NULL |  |  | If the document is a multi-page format like tiff and has at least 1 page this will be 1 or greater,if a non-multi-page format this should be null or empty | |||||||
| owner | INT | 10 | √ | NULL |  | 
 | Foreign key identifier to users of who initially persisted the document | |||||||
| revision | TIMESTAMP | 19 | current_timestamp() |  |  | Timestamp of the last time the document was changed and persisted | ||||||||
| foreign_id | BIGINT | 19 | √ | NULL |  | 
 | The internal patient identifier | |||||||
| docdate | DATE | 10 | √ | NULL |  |  | Date (YYYY-MM-DD) logically associated with the document, e.g. when a picture was taken. | |||||||
| hash | VARCHAR | 255 | √ | NULL |  |  | Hash value of the document from when it was uploaded | |||||||
| list_id | BIGINT | 19 | 0 |  | 
 | FK to lists.id associated with the document when the document is related to an issue | ||||||||
| couch_docid | VARCHAR | 100 | √ | NULL |  |  | CouchDB document ID | |||||||
| couch_revid | VARCHAR | 100 | √ | NULL |  |  | CouchDB revision ID | |||||||
| storagemethod | TINYINT | 3 | 0 |  |  | Storage method (0->Harddisk, 1->CouchDB) | ||||||||
| path_depth | TINYINT | 3 | √ | 1 |  |  | Depth of path to use in the URL to find the document. Not applicable for CouchDB. . Empty in export. | |||||||
| imported | TINYINT | 3 | √ | 0 |  |  | Parsing status for CCR/CCD/CCDA importing | |||||||
| encounter_id | BIGINT | 19 | 0 |  | 
 | Encounter ID if tagged | ||||||||
| encounter_check | BOOLEAN | 3 | 0 |  |  | If an encounter is created while tagging (0 or 1) | ||||||||
| audit_master_approval_status | TINYINT | 3 | 1 |  |  | Approval status from audit_master table | ||||||||
| audit_master_id | INT | 10 | √ | NULL |  |  | ID from the audit_master table | |||||||
| documentationOf | VARCHAR | 255 | √ | NULL |  |  | Used for CCDA and lab documents where the individual / contents of the documentation of a service event is recorded | |||||||
| thumb_url | VARCHAR | 255 | √ | NULL |  |  | URL of the document’s thumbnail | |||||||
| encrypted | TINYINT | 3 | 0 |  |  | Encryption status (0->No, 1->Yes) | ||||||||
| document_data | LONGTEXT | 2147483647 | √ | NULL |  |  | Additional metadata concerning the document is stored here. CCDA/CDA documents store their validation log in this field and DICOM files store a JSON history of actions taken on the DICOM in this field | |||||||
| name | VARCHAR | 255 | √ | NULL |  |  | Name of the document. Populated since OpenEMR versions 6.0.0+ | |||||||
| drive_uuid | BINARY | 16 | √ | NULL |  |  | UUID of the document’s drive. Empty in export | |||||||
| deleted | BOOLEAN | 3 | 0 |  |  | Flag indicating if the document is deleted (0 or 1). If a file has been marked as deleted the underlying file stored in the file storage system is NOT included in data exports and is no longer available for retrieval | ||||||||
| date_expires | DATETIME | 19 | √ | NULL |  |  | Date when the document expires and is no longer available. | |||||||
| foreign_reference_id | BIGINT | 19 | √ | NULL |  |  | DB Unique identifier reference to another table record in the database. This is not unique in the document. The table that this record points to is in the foreign_reference_table | |||||||
| foreign_reference_table | VARCHAR | 40 | √ | NULL |  |  | Table associated with the foreign reference_id will be populated if foreign_reference_id is populated | 
Indexes
| Constraint Name | Type | Sort | Column(s) | 
|---|---|---|---|
| PRIMARY | Primary key | Asc | id | 
| drive_uuid | Must be unique | Asc | drive_uuid | 
| foreign_id | Performance | Asc | foreign_id | 
| foreign_reference | Performance | Asc/Asc | foreign_reference_id + foreign_reference_table | 
| owner | Performance | Asc | owner | 
| revision | Performance | Asc | revision | 
| uuid | Must be unique | Asc | uuid |