# Customizing details for a use case or factsheet #

You can programmatically customize the information that is collected in factsheets for AI use cases\. Use customized factsheets as part of your AI Governance strategy\.

## Updating a model or model use case programmatically ##

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

Currently, you must update the tenant\-level asset types by modifying the user attributes that uses the [Watson Data REST API](https://cloud.ibm.com/apidocs/watson-data-api#introduction) to update the asset\.

## Updating a custom asset type ##

Follow these steps to update a custom asset type:

<!-- <ol> -->

1.  Provide the `bss_account_id` query parameter for the [`getcatalogtype` method](https://cloud.ibm.com/apidocs/watson-data-api#getcatalogtype)\.
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](https://cloud.ibm.com/apidocs/watson-data-api#getcatalogtype) where `asset_type` is either `modelfacts_user` or `model_entry_user`\.
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 use case or model:
    
    <!-- <ul> -->
    
     *  string
     *  date
     *  integer
    
    <!-- </ul> -->
    
5.  After the JSON is updated with the new properties, start the changes by using the [`replaceassettype` method](https://cloud.ibm.com/apidocs/watson-data-api#replaceassettype)\. Provide the `asset_type` , `bss_account_id`, and request payload\.

<!-- </ol> -->

When the update is complete, you can view the custom attributes in the AI use case details page and model details page\.

## Example 1: Retrieving and updating the `model_entry_user` asset type ##

Note:This example updates the use case 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: ZenApiKey ${MY_TOKEN}"  'https://api.dataplatform.cloud.ibm.com:443/v2/asset_types/model_entry_user?bss_account_id=<bss_account_id>'

This snippet is a sample response payload for model use case user details:

    {
        "description": "The model use case 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: ZenApiKey ${MY_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 use case 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](https://s3.us.cloud-object-storage.appdomain.cloud/factsheets-client/index.html#factsheet-asset-elements)\.

After you update asset type definitions with custom attributes, you can provide values for those attributes from the model use case overview and model details pages\. You can also update values to the custom attributes that use these Python API client methods:

<!-- <ul> -->

 *  [Model Asset Utilities](https://s3.us.cloud-object-storage.appdomain.cloud/factsheets-client/index.html#ibm_aigov_facts_client.factsheet.asset_utils_model.ModelAssetUtilities.set_custom_fact)
 *  [Model Entry Utilities](https://s3.us.cloud-object-storage.appdomain.cloud/factsheets-client/index.html#ibm_aigov_facts_client.factsheet.asset_utils_model.ModelEntryUtilities.set_custom_fact)

<!-- </ul> -->

## Capturing cell facts for a model ##

When a data scientist develops a model in a notebook, they generate visualizations for key model details, such as ROC curve, confusion matrix, panda profiling report, or the output of any cell execution\. To capture those facts as part of a model use case, use the ['capture\_cell\_facts\`](https://s3.us.cloud-object-storage.appdomain.cloud/factsheets-client/index.html#capture-cell-facts) function in the AI Factsheets Python client library\.

## Troubleshooting custom fields ##

After you customize fields and make them available to users, a user trying to update fields in the **Additional details** section of model details might get this error:

    Update failed. To update an asset attribute, you must be a catalog Admin or an asset owner or member with the Editor role. Ask a catalog Admin to update your catalog role or ask an asset member with the Editor role to add you as a member.

If the user already has edit permission on the model and is still getting the error message, follow these steps to resolve it\.

<!-- <ol> -->

1.  Invoke the API command for [createassetattributenewv2](https://cloud.ibm.com/apidocs/watson-data-api-cpd#createassetattributenewv2)\.
2.  Use this payload with the command:
    
        {
          "name": "modelfacts_system",
          "entity": {
          }
        }
    
    where `asset_id` is the `model_id`. Enter either `project_id` or `space_id` or `catalog_id` where the model exists.

<!-- </ol> -->

## Learn more ##

Find out about working with an inventory programmatically, by using the [IBM\_AIGOV\_FACTS\_CLIENT documentation](https://s3.us.cloud-object-storage.appdomain.cloud/factsheets-client/index.html)\.

<!-- </article "role="article" "> -->