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

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.

Tags are created from the Tags ‣ Create menu.

To view all created tags use the Tags ‣ All menu.

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.

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

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. Go to 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 untagged documents
{% 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.