0 / 0
Customizing user details for a factsheet
Customizing user details for a factsheet

Customizing user details for a factsheet

Users can programmatically customize the information about a model entry or model to enhance the factsheet that tracks the model lifecycle.

Updating a model or model entry programmatically

You might want to update a model entry or model factsheet with additional information. For example, some companies have a standard set of details they want to accompany a model entry or model facts.

Currently, you must update the tenant-level asset types by modifying the user attributes that uses the Watson Data REST API to update the asset.

Follow these steps to update a custom asset type:

  1. Provide the bss_account_id query parameter for the getcatalogtype method.
  2. Provide asset_type as model_entry_user if you are updating attributes for model_entry. Provide asset_type as modelfacts_user if you are updating attributes for model facts.
  3. Retrieve the current asset type definition by using the getcatalogtype method where asset_type is either modelfacts_user or model_entry.
  4. Update the current asset type definition with the custom attributes by adding them to properties JSON object following the schema that is defined in the API documentation. The following types of attributes are supported to view and edit from the user interface of the model entry or model:
    • string
    • date
    • integer
  5. After the JSON is updated with the new properties, start the changes by using the replaceassettype method. Provide the asset_type , bss_account_id, and request payload.

When the update is complete, you can view the custom attributes in the model entry details page and model details page.

Example 1: Retrieving and updating the model_entry_user asset type

Note: This example updates the model entry user data. You can use the same format but substitute modelfacts_user to retrieve and update details for the model factsheet.

This curl command retrieves the asset type model_entry_user:

curl -X GET --header 'Accept: application/json' --header 'Authorization: Bearer $token'  'https://api.dataplatform.cloud.ibm.com:443/v2/asset_types/model_entry_user?bss_account_id=<bss_account_id>'

This is a sample response payload for model entry user details:


{
    "description": "The model entry to capture user defined attributes.",
    "fields": [],
    "relationships": [],
    "properties": {},
    "decorates": [{
        "asset_type_name": "model_entry"
    }],
    "global_search_searchable": [],
    "localized_metadata_attributes": {
        "name": {
            "default": "Additional details",
            "en": "Additional details"
        }
    },
    "attribute_only": false,
    "name": "model_entry_user",
    "version": 1,
    "scope": "ACCOUNT"
}

This curl command updates the model_entry_user asset type:

curl -X PUT --header 'Content-Type: application/json' --header 'Accept: application/json' --header 'Authorization: Bearer $token'  -d '@requestbody.json' 'https://api.dataplatform.cloud.ibm.com:443/v2/asset_types/model_entry_user?bss_account_id=<bss_account_id>'

The requestbody.json contents look like this:

{
    "description": "The model entry to capture user defined attributes.",
    "fields": [],
    "relationships": [],
    "properties": {
        "user_attribute1": {
            "type": "string",
            "description": "User attribute1",
            "placeholder": "User attribute1",
            "is_array": false,
            "required": true,
            "hidden": false,
            "readonly": false,
            "default_value": "None",
            "label": {
                "default": "User attribute1"
            }
        },
        "user_attribute2": {
            "type": "integer",
            "description": "User attribute2",
            "placeholder": "User attribute2",
            "is_array": false,
            "required": true,
            "hidden": false,
            "readonly": false,
            "label": {
                "default": "User attribute2"
            }
        },
        "user_attribute3": {
            "type": "date",
            "description": "User attribute3",
            "placeholder": "User attribute3",
            "is_array": false,
            "required": true,
            "hidden": false,
            "readonly": false,
            "default_value": "None",
            "label": {
                "default": "User attribute3"
            }

    }
    "decorates": [{
        "asset_type_name": "model_entry"
    }],
    "global_search_searchable": [],
    "attribute_only": false,
    "localized_metadata_attributes": {
        "name": {
            "default": "Additional details",
            "en": "Additional details"
        }
    }
}

Updating user details by using the Python client

You can also update and replace an asset type with properties by using a Python script. For details, see fact sheet elements description.

Learn more

For more information see custom asset types.

Find out about working with a model inventory programmatically, by using the IBM_AIGOV_FACTS_CLIENT documentation.

Parent topic: Managing an inventory of model assets.