Main Content

File Attachments in Modelscape Review Editor

This example shows how to attach files to reviews using the Review Editor app in the Modelscape™ Review Environment (MRE).

You can attach documents to the Review Editor app. These documents include recommendations for improvement or evidence of model performance reports outside the Review Editor app. Use the app to attach files such as detailed model validation documents and scripts supporting such documents. By default, the Review Editor attaches the files to the project or model repository. You can also use the tools in the package to store the attachments in a network folder. This example explains how to use these tools, extend them, and customize them.

MicrosoftTeams-image.png

Use Custom Repositories

Attachments repositories are subclasses of the (abstract) modelscape.review.app.filerepository.FileRepository base class. The constructor of a subclass must accept a Review object as input and implement the following methods:

  • upload — Upload selected file to the file repository.

  • exists — Check whether a file already exists in the repository.

  • download — Retrieve a file from the repository.

The implementation must be on the MATLAB path.

For an example, see the network folder repository:

edit modelscape.review.app.filerepository.NetworkFolderRepository;

To point Review Editor to your custom file repository class, create a resources/extensions.json file anywhere on your MATLAB path and copy the following content into it:

{
    "mw.modelscape.review.attachments.customRepository" : {
        "type":"FileRepository",
        "name":"CustomRepository",
        "callback" : "some.namespace.FileRepository",
        "callbackType" : "matlab",
        "parameters" : { ... }
    }
}

Here name is used as a tag and callback is the full name of your file repository class. Fill type and callbackType as shown above. If your repository constructor requires any extra arguments, implement these as name-value pairs and store the configuration using the parameters field.

To distribute your file repository to MRE users, package your class implementation and the extensions.json file into a toolbox and deploy it with Modelscape as you set up Review Environment.