Closed mandy-chessell closed 3 years ago
Further investigation shows that this comment was added as part of the "Understanding an asset" lab in this code:
displayName = "Drop Foot Clinical Trial Patients"
description = "List of patients registered for the drop foot clinical trial."
fullPath = "file://secured/research/clinical-trials/drop-foot/Patients.csv"
assetName = "Patient Asset"
assetGUIDs = assetOwnerCreateCSVAsset(cocoMDS1Name, cocoMDS1PlatformName, cocoMDS1PlatformURL, petersUserId, displayName, description, fullPath)
assetGUID = getLastGUID(assetGUIDs)
print("Created " + assetName)
commentType = "STANDARD_COMMENT"
commentText = "The hospital is still recruiting patients and so we are expecting a new version of this file at the end of week 4"
isPublic = True
commentGUID = addCommentToAsset(cocoMDS1Name,
cocoMDS1PlatformName,
cocoMDS1PlatformURL,
petersUserId,
assetGUID,
commentText,
commentType,
isPublic)
patientAssetOwner = "tanyatidie"
patientOwnerType = "USER_ID"
addOwner(cocoMDS2Name, cocoMDS2PlatformName, cocoMDS2PlatformURL, erinsUserId, assetName, assetGUID, patientAssetOwner, patientOwnerType)
addZones(cocoMDS2Name, cocoMDS2PlatformName, cocoMDS2PlatformURL, erinsUserId, assetName, assetGUID, ["data-lake", "clinical-trials"])
print("Done.")
Which is this code
def addCommentToAsset(serverName, serverPlatformName, serverPlatformURL, userId, requestType, commentText, commentType, isPublic):
assetConsumerURL = serverPlatformURL + '/servers/' + serverName + '/open-metadata/access-services/asset-consumer/users/' + userId
addCommentURL = assetConsumerURL + '/assets/' + requestType + '/comments'
commentBody={
"class" : "CommentProperties",
"commentType" : commentType,
"commentText" : commentText,
"isPublic" : isPublic
}
response = issuePost(addCommentURL,commentBody)
commentGUID = response.json().get('guid')
if commentGUID:
return commentGUID
else:
print ("No comment added")
processErrorResponse(serverName, serverPlatformName, serverPlatformURL, response)
The assetGUID (which will become the anchorGUID) is being passed in as the requestType
parameter which is being passed to the Asset Consumer OMAS as the assetGUID. So it is just a badly named parameter.
Next need to look at what is happening in the server.
Just run method again and both asset and comment are correctly set up ... this is the comment
{
"class": "EntityDetailResponse",
"relatedHTTPCode": 200,
"entity": {
"class": "EntityDetail",
"headerVersion": 1,
"type": {
"class": "InstanceType",
"typeDefCategory": "ENTITY_DEF",
"typeDefGUID": "1a226073-9c84-40e4-a422-fbddb9b84278",
"typeDefName": "Comment",
"typeDefVersion": 2,
"typeDefDescription": "Descriptive feedback or discussion related to an item.",
"typeDefSuperTypes": [
{
"headerVersion": 1,
"guid": "a32316b8-dc8c-48c5-b12b-71c1b2a080bf",
"name": "Referenceable",
"status": "ACTIVE_TYPEDEF"
},
{
"headerVersion": 1,
"guid": "4e7761e8-3969-4627-8f40-bfe3cde85a1d",
"name": "OpenMetadataRoot",
"status": "ACTIVE_TYPEDEF"
}
],
"validInstanceProperties": [
"qualifiedName",
"additionalProperties",
"anchorGUID",
"commentType",
"text",
"type"
]
},
"instanceProvenanceType": "LOCAL_COHORT",
"metadataCollectionId": "e89b978d-da68-4aec-8001-3bb46f32aee9",
"metadataCollectionName": "Data Lake Catalog",
"createdBy": "peterprofile",
"createTime": "2021-02-10T22:13:12.108+00:00",
"version": 1,
"guid": "3bf90b75-05f6-44f6-884b-4f96e5c2393f",
"classifications": [
{
"class": "Classification",
"headerVersion": 1,
"type": {
"class": "InstanceType",
"typeDefCategory": "CLASSIFICATION_DEF",
"typeDefGUID": "aa44f302-2e43-4669-a1e7-edaae414fc6e",
"typeDefName": "Anchors",
"typeDefVersion": 2,
"typeDefDescription": "Identifies the anchor entities for an element that is part of a large composite object such as an asset.",
"validInstanceProperties": [
"anchorGUID"
]
},
"instanceProvenanceType": "LOCAL_COHORT",
"metadataCollectionId": "e89b978d-da68-4aec-8001-3bb46f32aee9",
"metadataCollectionName": "Data Lake Catalog",
"createdBy": "peterprofile",
"createTime": "2021-02-10T22:09:58.253+00:00",
"version": 1,
"classificationOrigin": "ASSIGNED",
"name": "Anchors",
"properties": {
"class": "InstanceProperties",
"instanceProperties": {
"anchorGUID": {
"class": "PrimitivePropertyValue",
"instancePropertyCategory": "PRIMITIVE",
"typeGUID": "b34a64b9-554a-42b1-8f8a-7d5c2339f9c4",
"typeName": "string",
"primitiveDefCategory": "OM_PRIMITIVE_TYPE_STRING",
"primitiveValue": "abc58494-e027-4228-95f4-4bb907979803"
}
},
"propertyNames": [
"anchorGUID"
],
"propertyCount": 1
},
"status": "ACTIVE"
}
],
"properties": {
"class": "InstanceProperties",
"instanceProperties": {
"commentType": {
"class": "EnumPropertyValue",
"instancePropertyCategory": "ENUM",
"ordinal": 0
},
"text": {
"class": "PrimitivePropertyValue",
"instancePropertyCategory": "PRIMITIVE",
"typeGUID": "b34a64b9-554a-42b1-8f8a-7d5c2339f9c4",
"typeName": "string",
"primitiveDefCategory": "OM_PRIMITIVE_TYPE_STRING",
"primitiveValue": "The hospital is still recruiting patients and so we are expecting a new version of this file at the end of week 4"
},
"qualifiedName": {
"class": "PrimitivePropertyValue",
"instancePropertyCategory": "PRIMITIVE",
"typeGUID": "b34a64b9-554a-42b1-8f8a-7d5c2339f9c4",
"typeName": "string",
"primitiveDefCategory": "OM_PRIMITIVE_TYPE_STRING",
"primitiveValue": "481c068c-2854-4ced-9fec-01191c4541eb"
}
},
"propertyNames": [
"qualifiedName",
"commentType",
"text"
],
"propertyCount": 3
},
"status": "ACTIVE"
}
}
I am going to close this for the time being since I can not recreate it
Noticed a curious exception coming from testing the labs:
Nested in the initial message is:
This is occurring when the anchor entity is being validated.
On retrieving the entity from the repository it seems that the GUID in the Anchors classification is set to
<unknown>
and the repository services is quite right to throw an exception.So the important question is "Why is the AnchorGUID set to such a ridiculous value?"