Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Event Centric Positioning #973

Merged
merged 7 commits into from
Jan 27, 2025

Conversation

SteveLasker
Copy link
Contributor

Updates to #972 to position Asset based Events and the new Event Centric approach.

@SteveLasker SteveLasker requested review from wp0pw, JAG-UK and henry739 and removed request for henry739 January 23, 2025 21:04
Comment on lines -123 to -410
Each attachment has an associated hash value and the name of the hash algorithm used that you can also get from the Blob API response.

Once you've uploaded your file, you can use the `"arc_attribute_type": "arc_attachment"` key-value pair within a dictionary of blob information to add the attachment to your Event.

For example:

```json
cat > /tmp/event.json <<EOF
{
"operation": "Record",
"behaviour": "RecordEvidence",
"event_attributes": {
"arc_display_type": "Safety Conformance",
"arc_description": "Safety conformance approved for version 1.6. See attached conformance report",
"arc_evidence": "DVA Conformance Report attached",
"conformance_report": {
"arc_attribute_type": "arc_attachment",
"arc_blob_hash_value": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"arc_blob_identity": "blobs/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"arc_blob_hash_alg": "SHA256",
"arc_file_name": "safety_conformance.pdf",
"arc_display_name": "Conformance Report",
},
"arc_primary_image": {
"arc_attribute_type": "arc_attachment",
"arc_blob_hash_value": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"arc_blob_identity": "blobs/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"arc_blob_hash_alg": "SHA256",
"arc_file_name": "photo.jpg",
"arc_display_name": "arc_primary_image",
},
},
"timestamp_declared": "2019-11-27T14:44:19Z",
"principal_declared": {
"issuer": "idp.synsation.io/1234",
"subject": "phil.b",
"email": "[email protected]"
},
}
EOF
```

Add the request to the Asset Record by POSTing it to the resource:

```bash
curl -X POST \
-H "@$HOME/.datatrails/bearer-token.txt" \
-H "Content-type: application/json" \
-d "@/tmp/event.json" \
https://app.datatrails.ai/archivist/v2/assets/$ASSET_UUID/events
```

The response:

```json
{
"identity": "assets/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/events/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"asset_identity": "assets/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"operation": "Record",
"behaviour": "RecordEvidence",
"event_attributes": {
"arc_display_type": "Safety Conformance",
"arc_description": "Safety conformance approved for version 1.6. See attached conformance report",
"arc_evidence": "DVA Conformance Report attached",
"conformance_report": {
"arc_attribute_type": "arc_attachment",
"arc_blob_hash_value": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"arc_blob_identity": "blobs/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"arc_blob_hash_alg": "SHA256",
"arc_file_name": "safety_conformance.pdf",
"arc_display_name": "Conformance Report",
},
"arc_primary_image": {
"arc_attribute_type": "arc_attachment",
"arc_blob_hash_value": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"arc_blob_identity": "blobs/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"arc_blob_hash_alg": "SHA256",
"arc_file_name": "safety_conformance.pdf",
"arc_display_name": "Conformance Report",
},
},
"timestamp_accepted": "2019-11-27T15:13:21Z",
"timestamp_declared": "2019-11-27T14:44:19Z",
"timestamp_committed": "2019-11-27T15:15:02Z",
"principal_declared": {
"issuer": "idp.synsation.io/1234",
"subject": "phil.b",
"email": "[email protected]"
},
"principal_accepted": {
"issuer": "job.idp.server/1234",
"subject": "bob@job"
},
"confirmation_status": "COMMITTED",
"block_number": 12,
"transaction_index": 5,
"transaction_id": "0x07569"
}
```

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've removed the attachment docs from here as the flow is quite broken. The user must navigate away from the these docs, create an attachment, save the id and hash, then return here.
As we're also not prioritizing attachments, I've streamlined the events docs to create and query events.
We can/should have separate docs for the attachments workflow.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That’s not valid. We need to keep attachments. If the flow doesn’t work then fix it, we can’t just delete it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about if I move the attachements to a separate doc, even part of this PR, but not in the event doc flow?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One place with the details and every other place with a reference is a fine model for sure. But it has to be clear how you include the attachment reference in an Event

Signed-off-by: steve lasker <[email protected]>
Signed-off-by: steve lasker <[email protected]>
Signed-off-by: steve lasker <[email protected]>
Signed-off-by: steve lasker <[email protected]>
@SteveLasker SteveLasker marked this pull request as ready for review January 27, 2025 21:46
@SteveLasker SteveLasker merged commit 3a67fa1 into dev/waldek/10215-update-docs Jan 27, 2025
@SteveLasker SteveLasker deleted the steve/972-updates branch January 27, 2025 21:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants