Modeling an AuditEvent using Blockchain?

Hi all,
I’ve been asked to convert a Blockchain app to use FHIR resources. Doing pretty good so far, but I’ve apparently found where the sidewalk ends. So, I’m kicking this out to the community to see if anybody can help with some data modeling.

Here’s the blockchain event that we’ve successfully used in an audit log:

// BlockChainEvent 
{ 
  address: '0x59d01dcbcc58224f21ddf5063a1070a37b29f6ec',
  topics: 
  [ '0x5e2510585e36c769ee0aa8d684b60b5f6efca424bb7cd9b1bab30f76120789e0',
    '0x0000000000000000000000000c2b3a8a18a0c021e6b0b41933ab31e39e96903e' ],
  data: '0x',
  blockNumber: 3434,
  transactionIndex: 0,
  transactionHash: '0x5499113c83c8d4171af10caed59bf23ed906861bd073c4e8c9fb447b7b61891d',
  blockHash: '0x9bd754b1a7cefc8f1d4412ad962653137ea9e47e1be31841a71abbe6ec406428',
  logIndex: 0,
  removed: false,
  userName: 'Liddel, Alice',
  timestamp: Thu Apr 06 2017 00:21:54 GMT-0500 (CDT) 
}

And here’s what I’ve got so far while translating it into an AuditEvent:

var blockChainEvent = Ledger.getEvent();

var newAuditEvent = {
  "resourceType": "AuditEvent",
  "type": {
    "system": "http://hl7.org/fhir/audit-event-type",
    "code": "rest",
    "display": "Restful Operation"
  },
  "subtype": [
    {
      "system": "http://hl7.org/fhir/restful-interaction",
      "code": "vread",
      "display": "vread"
    }
  ],
  "action": "R",
  "recorded": "",
  "outcome": "0",
  "agent": [{
      "userId": {
        "value":  blockChainEvent.userId
      },
      "altId":  blockChainEvent.blockHash,
      "name": blockChainEvent.userName,
      "requestor": true,
      "role": [
        {
          "coding": [
            {
              "system": "http://dicom.nema.org/resources/ontology/DCM",
              "code": "110153",
              "display": "Source Role ID"
            }
          ]
        }
      ],
      "network": {
        "address":  blockChainEvent.address,
        "type": "blockchain"
      }
    }],
  "source": {
    "site": "Blockchain on FHIR",
    "identifier": {
      "value": Meteor.absoluteUrl()
    },
    "type": [
      {
        "system": "http://hl7.org/fhir/security-source-type",
        "code": "3",
        "display": "Web Server"
      }
    ]
  },
  "entity": [
    {
      "reference": {
        "reference": "Patient/example/_history/1"
      },
      "type": {
        "system": "http://hl7.org/fhir/object-type",
        "code": "2",
        "display": "System Object"
      },
      "lifecycle": {
        "system": "http://hl7.org/fhir/dicom-audit-lifecycle",
        "code": "6",
        "display": "Access / Use"
      }
    }
  ]}

console.log(newAuditEvent);
AuditEvents.insert(newAuditEvent);

I’ve no clue where topics, blockHash, blockNumber, transactionIndex, and transactionHash should go.

Maybe AuditEvent.agent.altId could store one of them such as the blockHash? Obviously, we should use AuditEvent.source. Maybe the blockNumber? Cardinality suggests we can get at least one value in there. Or should that just be “Ethereum”? Maybe BlockChainEvent.topics could go into AuditEvent.type and AuditEvent.subtype? But that still leaves us the transactionIndex and transactionHash.

Any thoughts would be much appreciated.

what are the definitions/usage of topics, blockHash, blockNumber, transactionIndex, and transactionHash?

1 Like