Categorization

Mayan EDMS several ways to visual organize documents. Document categorization allows showing users different views of document groups. These are divided into ones requiring manual maintenance and others that are updated automatically.

Manual methods

Document types

The basic unit of data in Mayan EDMS is the document type. A document type can be interpreted also as a document category, a document class, or a document template. Every other aspect of the system will rely or be tied to one or more document type. Create one document type for each type or class of document you intend to upload into Mayan EDMS.

Document types need to be created before documents can be uploaded. It is not possible to upload documents without assigning them a document type.

Document types usually mirror the type of physical, paper document they represent.

Example document types:

  • Letter
  • Invoice
  • Timesheet
  • Blueprint
blockdiag each document type many documents

Examples:

blockdiag Invoice invoice_001.pdf invoice_032.pdf
blockdiag Receipts groceries_18-01-11.pdf car_payment-17-01-02.png

Settings and attributes are applied to document types and documents will inherit those settings and attributes based on the document type they were assigned when uploaded into Mayan EDMS. A document can only be of one type at a given moment, but if needed, the type of a document can be changed. Upon changing its type, the document will lose its previous settings and attributes, and will inherit the settings and attributes of its new type.

Creating document types

Permissions required

The “Create document types” permission is required for this action.

  1. Go to the System ‣ Setup ‣ Document types menu.
  2. From the Actions dropdown select Create document type.
  3. Enter a label to be shown to users when using this document type.
  4. Optional: Enter a period of time after which documents of this type will be moved to the trash.
  5. Optional: Select the unit of time for the period after which the document will be moved to the trash.
  6. Optional: Enter a period of time after which documents moved to the trash will be permanently deleted.
  7. Optional: Select the unit of time for the period of time after which the documents moved to the trash will be permanently deleted
  8. Press Submit.

Cabinets

Cabinets are a multi-level method to organize documents. Each cabinet can contain documents as well as other sub level cabinets. Cabinets can be added from the Cabinets ‣ Add new menu.

With a cabinet structure created, the next step is to add documents to them. To add documents to a cabinet, select the cabinet tab of a document, and select Actions ‣ Add to cabinets link.

Documents can also be added in bulk to one or more cabinets from any view that lists documents.

Tags

Tags are color coded properties that can be attached or removed from documents. Tags allow giving documents a binary property. Documents can also be tagged with more than one tag.

Once tagged, documents can be searched by their tags. It is also possible to show all the documents tagged with a particular tag via the Documents link of each tag.

To view, add, or remove tags from a specific document, go to the document view and click on the Tags tab. This view will show the current tags of a document. The Actions menu will now show two new options: one to attach more tags to the document and another to remove tags from the document.

It is also possible to tag documents in bulk by selecting several documents from any view that displays a list documents and selecting the Attach tag or Remove tags from the dropdown menu.

Creating tags

Permissions required

The “Create new tags” permission is required for this action.

  1. Go to the Tags ‣ Create menu.
  2. Enter a label to identify the tag.
  3. Select a color for the tag.
  4. Press Submit.

View all tags

Permissions required

The “View tags” permission is required for this action, globally or via an ACL for a tag.

  1. Go to the Tags ‣ All menu.

Automatic methods

Indexes

Indexes are an automatic method to hierarchically organize documents in relation to their properties (Metadata, label, MIME type, etc). To use indexes you need to first create an index template. Once created, associate the index to one or more Document types.

Index are hierarchical models so a tree template needs to be specified for them. This tree template will contain references to document metadata or properties that will be replaced with the actual value for those metadata or properties.

Example:

  • Document type: Product sheet
  • Metadata type: Product year, associated as a required metadata for the document type Product sheet.
  • Index: Product sheets per year, and associated to the document type Product sheet.
  • Index slug: product-sheets-per-year. Slugs are internal unique identifiers that can be used by other Mayan EDMS modules to reference each index.
  • Index tree template as follows:
blockdiag Product sheets per year Root (Has document links? No) {{ document.metadata_value_of.product_year }} (Has document links? Yes) Tree template

Now every time a new Product sheet is uploaded a hierarchical unit with the value of the metadata type Product year is created and a link to the uploaded Product sheet added to it.

Example:

Suppose three Product sheets are uploaded with the following values as their Product year metadata: 2001, 2002, 2001 respectively. The result index that will be generate based on the tree template would be as follows:

blockdiag Product sheets per year 2001 2002 Product A data sheet (2001) Product C data sheet (2001) Product B data sheet (2002) Index content

Index examples

Index of document types

Permissions required

  • The “Create new document indexes” permission is required for this action.
  • The “Edit document indexes” permission is required for this action, globally of via an ACL for a document index.
  • The “Edit document types” permission is required for this action, globally of via an ACL for a document type.

This index will create one level for each document type in the system and place links to the document of each respective type.

  1. Go to the System ‣ Setup ‣ Indexes menu.

  2. Create a new index using Actions > Create new.

  3. Give it a label to describe it, and an internal name. The internal name is used when referencing this index in other parts of the system.

  4. Press the Template link of the newly created index.

  5. Select New child node to create a new level in which the following template code will be entered.

    {{ document.document_type }}
    
  6. Save the template.

  7. Click on Document types and associate this index with existing document types in the system.

  8. Finally go to Tools ‣ Rebuild indexes to execute the index template. The rebuild process is only necessary when changes are made to the index templates. Otherwise they update automatically whenever a new document is uploaded or existing documents properties are modified.

  9. A new index should appear under Indexes menu.

You can also program different behavior based on the different document types, by use a comparison and a conditional statement. As the document_type itself is not a string you cannot directly use that for that comparison. You will have to use the label of the document type.

For example:

{% if document.document_type.label == "Invoice" or document.document_type.label == "Letter" %}
Correspondence
{% else %}
{{ document.document_type }}
{% endif %}

This will create and index level for each document type. Except for documents of types “Invoice” and “Letter”, these will now go into the level “Correspondence”.

Index document by department, taken from the first character of the invoice number metadata

Requires one index node with the template:

{% if document.metadata_value_of.invoice_number.0 == "A" %}Accounting
{% if document.metadata_value_of.invoice_number.0 == "H" %}Human Resources
{% endif %}
Nested date index from a date contained in a metadata

Assuming the metadata type is named date_issued with a date format of YYYY-MM-DD. The target is to have two levels: one for years and another sub level for months.

First level: Year

{{ document.metadata_value_of.date_issued|slice:"0:4" }}

Second level: Months

{{ document.metadata_value_of.date_issued|slice:"5:7" }}

Optional: Third level: Day

{{ document.metadata_value_of.date_issued|slice:"8:10" }}
Index by OCR content

This example indexes documents in a “quarterly report” level if they have the fragment “quarterly report” in the OCR text:

{% if "quarterly report" in document.latest_version.ocr_content|join:" "|lower %}Quarterly reports{% endif %}

The same applies to text content extracted for the document:

{% if "quarterly report" in document.latest_version.content|join:" "|lower %}Quarterly reports{% endif %}
Index documents not found in any cabinet
{% if document.cabinets.count == 0 %}No Cabinets{% endif %}
Index documents not tagged
{% if document.tags.count == 0 %}No Tags{% endif %}
Index documents specifically, by the year of a metadata field otherwise by their uploaded year
{% for tag in document.tags.all %}{% if tag.label == "Taxes" %}{% if document.metadata_value_of.tax_year|length_is:"4" %}{{ document.metadata_value_of.tax_year }}{% else %}{{ document.date_added|date:"Y" }}{% endif %}{% endif %}{% endfor %}

Mirroring

Indexes can be exported as FUSE filesystems. Using the management command mountindex we could export the previous example index as follows:

mkdir -p ~/indexes/products
mayan-edms.py mountindex product-sheets-per-year ~/indexes/products

The ~/indexes/products directory will now have a directory and files structure identical to that of the index. Once indexes are mounted with this command, they behave like any other filesystem directory and can even be further shared via the network with network file system software like Samba or NFS.

blockdiag Product sheets per year Block device (Hard drive) Network Users mirroring

Indexes and mirrored indexes are Read Only as they are generated as a result of prior activities like document uploads, metadata changes.