How to make AuditEvent.entity.what reference to a delete resource

135 views
Skip to first unread message

christophe spielmann

unread,
May 3, 2021, 5:22:36 AM5/3/21
to HAPI FHIR
Hello,
I am creating audit event for all actions performed by a FHIR client with a
AuditEventInterceptor extends ThreadLocalCapturingInterceptor
My intend is to create an AuditEvent in case of deletion by using the response from the FHIR server. 
But when I save the AuditEvent that I created, it fails as AuditEvent.entity.what references a deleted resource. It there a way to overcome this ? 
Thanks.
The AuditEvent looks like below:

{
  "resourceType": "AuditEvent",
  "type": {
    "code": "rest",
    "display": "Restful Operation"
  },
  "subtype": [
    {
      "code": "delete"
    }
  ],
  "action": "D",
  "recorded": "2021-05-03T11:04:24.120+02:00",
  "outcome": "0",
  "agent": [
    {
      "type": {
        "coding": [
          {
            "code": "humanuser",
            "display": "human user"
          }
        ]
      },
      "who": {
      },
      "altId": "2234567813",
      "name": "CHRISTOPHE SPIELMANN",
      "requestor": true
    }
  ],
  "source": {
    "site": "ceprescription",
    "type": [
      {
        "code": "3",
        "display": "Web Server"
      }
    ]
  },
  "entity": [
    {
      "what": {
        "reference": "Patient/106146/_history/2"
      },
      "type": {
        "code": "Patient",
        "display": "Patient"
      },
      "description": "deletion of resource Patient/106146/_history/2",
      "detail": [
        {
          "type": "RequestedURL",
        }
      ]
    }
  ]
}

James Agnew

unread,
May 3, 2021, 8:07:09 AM5/3/21
to christophe spielmann, HAPI FHIR
I don't think this is possible right now, we don't allow references to point to deleted resources.

I can totally understand your use case though- It would probably make sense for us to add configuration where you can nominate specific paths to allow such references. Please feel free to submit a feature request ticket and/or PR.

Cheers,
James

--
You received this message because you are subscribed to the Google Groups "HAPI FHIR" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hapi-fhir+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/hapi-fhir/3a046873-9452-4438-a05b-bb5db3bb8bc6n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages