Registering an Event Against a Document Profile Asset
Registering an Event Against a Document Profile Asset
It is rare for a document to remain unchanged during it’s lifetime. Some documents are expected to go though many versions (e.g product documentation) while others (e.g. an employment contract) change much less frequently.
If you need to update your registered Document Profile Asset you can record this as an Event. The
Document Profile defines two types of Event; Publish and Withdraw.
Document Registration is the first Event with each new version being recorded as a Publish Event.
There is also the option to record an event (Record Event) that is important but is not formally part of the document profile. An example of this could be a document content review or a change in security classification.
When the document version is no longer to be used there is a Withdraw Event.
These Events track key moments of an Document’s lifecycle; details of Who Did What When to each version of the document.
Note: Before registering an Event, follow
this guide to register your first Document.
Open the Asset Overview for a Document Profile Asset
When viewing your Document, you have the choice of Add New Version (publish a new version), Withdraw Document (the document has reached End of Life) or Record Event (any other event that you wish to record).
Create an empty file, in later steps we will add the correct JSON.
{}
Note: In addition to the Asset and Event attributes that are part of the Document Profile, it is possible to record other attributes that are not part of the profile. These are:
Event Attributes - Attributes specific to an Event, i.e. a new author.
Asset Attributes - Attributes of the Asset that may change as a result of the Event, i.e. the new document hash.
Adding a New Version
Click on the Add New Version button. Information that is specific to the Document Profile is entered in the Document Information tab. As with registering the document, the new version can be dragged into the auto-fill dropzone or you can manually enter the document hash.
Add your event_attributes and asset_attributes as key-value pairs.
Fill out the metadata about your Event; operation and behaviour detail what class of Event is being performed. By default this should always be Record and RecordEvidence, respectively.
In the asset attributes section you should include the required DataTrails asset attributes as defined by the document profile. The new document version hash value is document_hash_value, the hash algorithm is document_hash_alg and the document_status which must be Published.
In the event attributes section you should also add the required DataTrails event attribute arc_display_type together with any other event specific attributes. The Document Profile specifies that arc_display_type must be Publish.
---steps:- step:action:EVENTS_CREATEdescription:Record event against My First Document.asset_label:assets/<asset-id>operation:Recordbehaviour:RecordEvidenceasset_attributes:document_hash_value:84684c83afd5e9cb3a83439872eae74798979ff5754b15931dbe768092174ec9document_hash_alg:sha256document_version:"2"document_status:Publishedevent_attributes:arc_description:Publish version 2 of My First Documentarc_display_type:Publishdocument_version_authors:- display_name:Dee Authoremail:dee@writeme.org- display_name:Anne Authoremail:anne@writeme.org confirm:false
Add your event_attributes and asset_attributes as key-value pairs.
Fill out the metadata about your Event; operation and behaviour detail what class of Event is being performed. By default this should always be Record and RecordEvidence, respectively.
In the asset attributes section you should include the required DataTrails asset attributes as defined by the document profile. The new document version hash value is document_hash_value, the hash algorithm is document_hash_alg and the document_status which must be Published.
In the event attributes section you should also add the required DataTrails event attribute arc_display_type together with any other event specific attributes. The Document Profile specifies that arc_display_type must be Publish.
{"operation":"Record","behaviour":"RecordEvidence","asset_attributes":{"document_hash_value":"84684c83afd5e9cb3a83439872eae74798979ff5754b15931dbe768092174ec9","document_hash_alg":"sha256","document_version":"2","document_status":"Published"},"event_attributes":{"arc_description":"Publish version 2 of My First Document","arc_display_type":"Publish","document_version_authors":[{"display_name":"Dee Author","email":"dee@writeme.org"},{"display_name":"Anne Author","email":"anne@writeme.org"}]}}
This Event will be POSTed to a specific Asset endpoint when the curl command is run. To do this, you will need to include the correct assets/<asset-id> string for the asset in the URL.
The Withdraw Event
If a document is no longer required, or if for any reason it is decided that it should no longer be used, then a document can be withdrawn. Withdrawal is optional and it is usually the final event in the document lifecycle. It can be reversed in DataTrails by publishing a new version.
Use the attribute/value pairs in the example below to register a Withdraw event
---steps:- step:action:EVENTS_CREATEdescription:Withdraw My First Document.asset_label:assets/<asset-id>operation:Recordbehaviour:RecordEvidenceasset_attributes:document_status:Withdrawnevent_attributes:arc_description:Withdraw My First Documentarc_display_type:Withdrawconfirm:false
Use the attribute/value pairs in the example below to register a Withdraw event
{"behaviour":"RecordEvidence","operation":"Record","asset_attributes":{"document_status":"Withdrawn"},"event_attributes":{"arc_description":"Withdraw My First Document","arc_display_type":"Withdraw"}}
Recording a Generic Event The Record Event button provides a way to record generic events that are not part of the Document Profile lifecycle. The asset and event attributes are in separate tabs in this Event type.
---steps:- step:action:EVENTS_CREATEdescription:Record event against My First Document.asset_label:assets/<asset-id>operation:Recordbehaviour:RecordEvidenceevent_attributes:arc_description:Document reviewarc_display_type:Reviewconfirm:false
The Event History can be seen in the Asset Overview from
step 1, simply click on the Event History tab and then any Event row to view it. The Overview tab shows the details of the Event including the version and document hash of this specific version.
The EVENTS_LIST action can be used to view all Events, or filtered using attributes (attrs) to view details of a specific Event
To view all Events, use:
---steps:- step:action:EVENTS_LISTdescription:List all events.print_response:true
To view the details of the Event you just created for My First Container, use:
---steps:- step:action:EVENTS_LISTdescription:List Events against the Document 'My First Document'.print_response:trueasset_label:assets/59e2b78b-d555-49a0-8775-f336b640122e attrs:arc_display_type:Publish
Event data can be viewed using curl commands
To view all Events across all Assets, use:
curl -v -X GET \
-H "@$HOME/.datatrails/bearer-token.txt"\
https://app.datatrails.ai/archivist/v2/assets/-/events
To view the details of the Event you just created for My First Document, use:
curl -v -X GET \
-H "@$HOME/.datatrails/bearer-token.txt"\
https://app.datatrails.ai/archivist/v2/assets/<asset-id>/events/<event-id>