Modules should have short, all-lowercase names. Underscores can be used in the module name if it improves readability. Python packages should also have short, all-lowercase names, although the use of underscores is discouraged.Create a main
analyzer.py file with your enrichment logic. The easiest method for this (and enrichment modules are fairly small) is to find an example module, and use it as a base with a LLM to help draft your code.
If your module needs additional dependencies, you have two options. Before either, first install Poetry.
For the first option, you can cd to projects/file_enrichment or libs/file_enrichment_modules/ and run poetry add X for the needed library.
Alternatively (and easier) you can create a pyproject.yaml in the new module module folder. An example is:
poetry add X to add a new library. The dynamic module loader will install the necessary dependencies in a Poetry env for just that module.
Tips / Tricks
Theshould_process() function determines if the module should run on a file. You can either check the name or any other component of the base enriched file with file_enriched = get_file_enriched(object_id):
On Transforms
File transforms require atype (used as a title for display) and an object_id to reference the data to display.
Optional metadata is:
| Metadata Field | Type | Description |
|---|---|---|
| file_name | string | Name of the file (i.e., for downloads) |
| display_type_in_dashboard | display_type | How to display in the dashboard |
| display_title | string | Title to display for the transform in the dashboard |
| default_display | bool | true to set this transform as the default display |
| offer_as_download | bool | If set to true offered as a download tab, downloading as file_name |
| Value | Description |
|---|---|
| monaco | Display in a Monaco editor, using the extension from file_name to help determine the language type. |
| Render as a PDF | |
| image | Render as an image |
| markdown | Render as an image |
| null | Don’t display content |