Sage-Bionetworks / sagebio-collaboration-portal

Collaboration Portal developed by Sage Bionetworks
1 stars 0 forks source link

Update activity capture to edit provenance when attachments change #568

Open jaeddy opened 4 years ago

jaeddy commented 4 years ago

I've added two endpoints to the prov-service API:

This will delete the USED relationship (edge) connecting the activity to the attachment (not the node itself). targetId represents the ObjectId in the PHCCP database.

Example request:

curl -X DELETE "http://localhost:8080/rest/v1/activities/041bab42-e6d3-11e9-b935-0242ac120003/used/TargetID_29" -H "accept: */*"

This will create a new USED relationship for the activity, connected to a node for the attachment (which will also be created, if needed). The body of the request is matches the interface in provenance/reference.model.ts — e.g.:

{
  "class": "Resource",
  "name": "TCGA BRCA Expression",
  "role": "dataToInput",
  "subclass": "File",
  "targetId": "resource0",
  "targetVersionId": "1"
}

Example request:

curl -X PUT "http://localhost:8080/rest/v1/activities/81323828-e6f1-11e9-a793-0242ac120003/used" -H "accept: */*" -H "Content-Type: application/json" -d "{\"class\":\"Resource\",\"name\":\"TCGA BRCA Expression\",\"role\":\"dataToInput\",\"subclass\":\"File\",\"targetId\":\"resource0\",\"targetVersionId\":\"1\"}"

Similar to how we currently pipe the results of a create() event to captureProvActivity.save(), we'd need to do something similar for updateInsight() — maybe something like captureProvActivity.removeUsed() and captureProvActivity.addUsed()?

We also need to figure out a way for the portal to store or retrieve the ID for an activity...