Main Content

File Attachments in Modelscape Review Editor

This example shows how to attach files to reviews using the 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 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;

Configure Attachment Repositories

Use MATLAB settings to point the MRE to the correct file repository class. Display the current active value of this setting.

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, is in the /+mre/+custom/ folder on the MATLAB path, then point the MRE to it.

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

Querying the active value of the setting returns mre.custom.myRepository. Reset the the value of this setting.

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. Use this repository.

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 ensure each model gets a unique folder, this repository saves the files to a folder with the name //some/network/folder/name, where name is the string that the ModelName method of the Modelscape Review class returns.

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