Initializing help system before first use

Application Interface

Topics covered in this chapter:

The functions for interacting with the Insight server are provided by the xpressinsight.AppInterface class. The methods of that class can be used, e.g., for downloading and uploading attachments, and for getting scenario and application meta data.

You can access the application interface functions via the insight property of the Insight application. This property is inherited from the base class xpressinsight.AppBase. The following example code, can be used to upload an attachment from within the Insight application class:

    self.insight.put_scen_attach("attachment.txt")

Note that the Python keyword self represents the current instance of the Insight application class. The following example shows how to integrate this line of code in an application.

import xpressinsight as xi

@xi.AppConfig(name="Attachment Example")
class App(xi.AppBase):

    @xi.ExecModeLoad(descr="Uploads attachment.")
    def load(self):
        with open("attachment.txt", "w") as text_file:
            text_file.write("Hello!")

        self.insight.put_scen_attach("attachment.txt")
        print('Upload status:', self.insight.attach_status)

    @xi.ExecModeRun(descr="Downloads attachment.")
    def run(self):
        self.insight.get_scen_attach("attachment.txt")
        print('Download status:', self.insight.attach_status)

        if self.insight.attach_status == xi.AttachStatus.OK:
            with open("attachment.txt", "r") as text_file:
                print(text_file.readline())

App Interface Classes

This class represents the Xpress Insight application interface. Use this interface to access attachments and meta data like the scenario ID.
Adds the given ItemInfo object to the repository of item infos that are used in test mode.
Retrieves information about a given app attachment.
Property for the id of the Xpress Insight application which is the parent of the model.
Property for the name of the Xpress Insight application which is the parent of the model.
Read-only property indicating the status of the most recent attempt to access or modify an attachment.
Removes any ItemInfo objects previously added in test mode.
Deletes a scenario attachment.
Delete the internal working directory of the xpressinsight package.
Property for the execution mode in which Xpress Insight is running the model.
Retrieves an app attachment from the Insight server, placing it in the Python working directory where it can be read by the model.
Gets Insight attachments by tag
Gets Insight attachments by tag
Retrieves the the 'rules' used to validate attachments and attachment meta-data.
Gets Insight attachments by tag
Get information for a repository item with the supplied path.
Get information for items in the folder with the supplied path.
Returns a generator for reading the messages sent to the scenario.
Retrieves an attachment from the Insight server for a given scenario, placing it in the Python working directory where it can be read by the model.
Retrieves a list of all the files attached to the app.
Retrieves a list of all the files attached to the app with the given tag.
Retrieves a list of the attachment tags defined in the companion file.
Retrieves a list of all the files attached to a given scenario.
Retrieves a list of all the files attached to a scenario with the given tag.
Appends one or more messages to the tail of the messages queue, in test mode. These messages will be retrieved by a future call to insight.get_messages.
Uploads a scenario attachment to the Insight server, reading it from the Python working directory.
Renames an existing scenario attachment.
Resets the progress state for each Xpress Insight v4 progress metric back to their initial values.
Retrieves information about a given scenario attachment.
Property for the id of the Xpress Insight scenario.
Property for the name of the Xpress Insight scenario.
Property for getting the parent path of the Xpress Insight scenario.
Property for the path of the Xpress Insight scenario.
Stores the current values of the progress entities into the Xpress Insight v5 scenario.
Sets the 'rules' used to validate attachments and attachment meta-data.
Sets the list of tags that can be used in attachments
Update the description of an existing scenario attachment.
Mark an existing scenario attachment as hidden or visible in the Xpress Insight UI.
Update the tags of an existing scenario attachment.
Property for the path to use for the attachments directory of the current app, when in test mode.
Property for the location to store mock attachments for app and scenario, when in test mode.
Property for the location of the app companion file to parse, when in test mode.
Read-only property to check whether the Insight application is running in test mode or in Insight.
Property for the path to use for the scenario attachments directory of the current scenario.
Sends a progress update notification for a single metric from the model to the Xpress Insight v4 system.
Property for the username of the Insight user that initiated the current scenario execution.
Property for the version number of the Insight server that is executing the scenario.
Read-only property for the internal working directory of the xpressinsight package.
Indicates the type of metric a progress update is providing.
Indicates the direction of optimization.

Attachments Classes

An object containing information about a single attachment.
A class containing information about the rules used by Insight when verifying attachments.
Indicates the status of the most recent attempt to access or modify an attachment.
A class containing information about a tag defined in the app's companion file.
Possible values for attachment tag usage.

Repository Classes

An exception that occurred during a call to certain AppInterface methods.
A class containing information for a repository item.
The RepositoryPath class can be used to build, analyze, and modify a repository path.
Creates a RepositoryPath object from the give path string.
Get a normalized absolute version of the path. In particular, process "." and ".." path elements.
Append an unencoded repository path string element (e.g. an item name) to the end of the RepositoryPath.
Get the list of decoded path string elements of the RepositoryPath.
Get the item name that is represented by the given encoded repository path string element.
Get the list of encoded path string elements of the RepositoryPath.
Encode the elements of a path and append them to a new path.
Encode the name of a repository item such that it can be used as a repository path string element.
True if the path starts with a path element separator (slash "/").
Remove the last element of the path.

© 2001-2023 Fair Isaac Corporation. All rights reserved. This documentation is the property of Fair Isaac Corporation (“FICO”). Receipt or possession of this documentation does not convey rights to disclose, reproduce, make derivative works, use, or allow others to use it except solely for internal evaluation purposes to determine whether to purchase a license to the software described in this documentation, or as otherwise set forth in a written software license agreement between you and FICO (or a FICO affiliate). Use of this documentation and the software described in it must conform strictly to the foregoing permitted uses, and no other use is permitted.