Main Content

File Attachments in Modelscape Review Editor

This example shows how to attach files to reviews using Review Editor app in the Modescape™ 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, and customize them.

Use Custom Repositories

Attachments repositories are subclasses of an (abstract) modelscape.review.app.filerepository.FileRepository base class. Construct such a subclass using a Review object, which defines the following functions:

  • upload: how and where a given file should be stored.

  • list: a list of the currently attached files.

  • URI: an identifier for a given file.

  • openRepositoryLocation: open the entire attachments repository for inspection.

The implementation must be in the MATLAB path.

For example, see the network folder repository:

edit modelscape.review.app.filerepository.NetworkFolderRepository;

Configure Attachment Repositories

Use MATLAB settings to point the MRE to the correct file repository class. To see the current active value of this setting, run:

s = settings;
s.modelscape.review.FileRepository.Type.ActiveValue
ans = 
"modelscape.review.app.filerepository.ProjectRepository"

The default value is modelscape.review.app.filerepository.ProjectRepository. If your custom repository file, myRepository.m, is in directory /+mre/+custom/ on the MATLAB path, then point the MRE to it by running:

s.modelscape.review.FileRepository.Type.TemporaryValue = "mre.custom.myRepository";

Querying the active value of the setting as above should now return mre.custom.myRepository. To reset the value of this setting, run

s.modelscape.review.FileRepository.Type.TemporaryValue = s.modelscape.review.FileRepository.Type.FactoryValue;

Use Network Folder Repository

You can also define other MATLAB settings and use them for configuring project repositories. Review Editor contains a repository definition for storing attachments to a network folder. To use this repository, run:

s = settings;
s.modelscape.review.FileRepository.Type.TemporaryValue = "modelscape.review.app.filerepository.NetworkFolderRepository";

Set the network folder to which Review Editor must copy the files to.

s.modelscape.review.FileRepository.Root.TemporaryValue = "//some/network/folder/name";

To ensure each model gets a unique directory, this repository saves the files to a directory of the form //some/network/folder/name, where name is the string returned by the ModelName method of the Modelscape Review class.