FHIR Chat · AuditEvent.entity gets trimmed · hapi

Stream: hapi

Topic: AuditEvent.entity gets trimmed


view this post on Zulip Mohammad Jafari (May 06 2021 at 04:53):

Trying to create an AuditEvent with more than one element in the entity array, this array seems to get trimmed to 1 element in the created resource --without any errors.

Here is an example to re-recreate this on the public test server:
request body:

{
  "resourceType": "AuditEvent",
  "type": {
    "system": "http://hl7.org/fhir/ValueSet/audit-event-type",
    "code": "110112",
    "display": "Query"
  },
  "action": "E",
  "outcome": "0",
  "outcomeDesc": "CONSENT_PERMIT",
  "agent": [
    {
      "who": {
        "identifier": {
          "system": "urn:ietf:rfc:3986",
          "value": "urn:oid:1.1"
        }
      }
    }
  ],
  "source": {
    "observer": {
      "display": "LEAP Consent Decision Service"
    },
    "type": [
      {
        "system": "http://terminology.hl7.org/CodeSystem/security-source-type",
        "code": "4",
        "display": "Application Server"
      }
    ]
  },
  "entity": [
    {
      "what": {
        "reference": "Consent/2045174",
        "type": {
          "system": "http://hl7.org/fhir/resource-types",
          "code": "Consent"
        }
      }
    },
    {
      "what": {
        "reference": {
          "reference": "Patient/1731610",
          "display": "Younger,Gallow"
        },
        "type": {
          "system": "http://terminology.hl7.org/CodeSystem/audit-entity-type",
          "code": "1",
          "display": "Person"
        }
      }
    }
  ]
}

Response: 201 created
Response body:

{
  "resourceType": "AuditEvent",
  "id": "2082005",
  "meta": {
    "versionId": "1",
    "lastUpdated": "2021-05-06T04:43:15.586+00:00"
  },
  "type": {
    "system": "http://hl7.org/fhir/ValueSet/audit-event-type",
    "code": "110112",
    "display": "Query"
  },
  "action": "E",
  "outcome": "0",
  "outcomeDesc": "CONSENT_PERMIT",
  "agent": [ {
    "who": {
      "identifier": {
        "system": "urn:ietf:rfc:3986",
        "value": "urn:oid:1.1"
      }
    }
  } ],
  "source": {
    "observer": {
      "display": "LEAP Consent Decision Service"
    },
    "type": [ {
      "system": "http://terminology.hl7.org/CodeSystem/security-source-type",
      "code": "4",
      "display": "Application Server"
    } ]
  },
  "entity": [ {
    "what": {
      "reference": "Consent/2045174"
    }
  } ]
}

view this post on Zulip John Moehrke (May 06 2021 at 12:54):

so this is a problem with the server you are using? Or do you think it is hapi api toolkit? Have you tried using a different kind of server? like Grahame's?

view this post on Zulip John Moehrke (May 06 2021 at 12:55):

@Daryl Moehrke can your test app reproduce this?

view this post on Zulip Mohammad Jafari (May 06 2021 at 16:27):

Grahame's server seems to be down. I'm suspecting that this is a HAPI bug @James Agnew.

view this post on Zulip John Moehrke (May 06 2021 at 16:58):

@Mohammad Jafari which Grahame server did you try? @Mark Iantorno might be able to reset it

view this post on Zulip Mark Iantorno (May 06 2021 at 17:00):

Grahame has many servers

view this post on Zulip Mark Iantorno (May 06 2021 at 17:00):

What is the address

view this post on Zulip Mark Iantorno (May 06 2021 at 17:00):

or name

view this post on Zulip Mark Iantorno (May 06 2021 at 17:01):

@Mohammad Jafari

view this post on Zulip Mohammad Jafari (May 06 2021 at 17:09):

I usually go to https://test.fhir.org/r4

view this post on Zulip John Moehrke (May 06 2021 at 17:40):

seems still dead. @Mark Iantorno can you reset this server?

view this post on Zulip James Agnew (May 06 2021 at 18:27):

That resource produces quite a few validation errors. That may well be related:

{
  "resourceType": "OperationOutcome",
  "text": {
    "status": "generated",
    "div": "<div xmlns=\"http://www.w3.org/1999/xhtml\"><h1>Operation Outcome</h1><table border=\"0\"><tr><td style=\"font-weight: bold;\">ERROR</td><td>[AuditEvent.entity[0].what.type, Line 38, Col 58]</td><td><pre>This property must be an simple value, not an object (type at AuditEvent.entity[0].what.type)</pre></td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td style=\"font-weight: bold;\">ERROR</td>\n\t\t\t\t<td>[AuditEvent.entity[1].what.reference, Line 46, Col 42]</td>\n\t\t\t\t<td><pre>This property must be an simple value, not an object (reference at AuditEvent.entity[1].what.reference)</pre></td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td style=\"font-weight: bold;\">ERROR</td>\n\t\t\t\t<td>[AuditEvent.entity[1].what.type, Line 50, Col 79]</td>\n\t\t\t\t<td><pre>This property must be an simple value, not an object (type at AuditEvent.entity[1].what.type)</pre></td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td style=\"font-weight: bold;\">WARNING</td>\n\t\t\t\t<td>[AuditEvent, Line 1, Col 2]</td>\n\t\t\t\t<td><pre>dom-6: 'A resource should have narrative for robust management' failed</pre></td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td style=\"font-weight: bold;\">ERROR</td>\n\t\t\t\t<td>[AuditEvent, Line 1, Col 2]</td>\n\t\t\t\t<td><pre>AuditEvent.recorded: minimum required = 1, but only found 0 (from http://hl7.org/fhir/StructureDefinition/AuditEvent)</pre></td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td style=\"font-weight: bold;\">ERROR</td>\n\t\t\t\t<td>[AuditEvent.type, Line 4, Col 63]</td>\n\t\t\t\t<td><pre>The Coding references a value set, not a code system ('http://hl7.org/fhir/ValueSet/audit-event-type')</pre></td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td style=\"font-weight: bold;\">ERROR</td>\n\t\t\t\t<td>[AuditEvent.type, Line 4, Col 63]</td>\n\t\t\t\t<td><pre>Unknown Code System 'http://hl7.org/fhir/ValueSet/audit-event-type'</pre></td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td style=\"font-weight: bold;\">ERROR</td>\n\t\t\t\t<td>[AuditEvent.agent[0], Line 12, Col 6]</td>\n\t\t\t\t<td><pre>AuditEvent.agent.requestor: minimum required = 1, but only found 0 (from http://hl7.org/fhir/StructureDefinition/AuditEvent)</pre></td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td style=\"font-weight: bold;\">WARNING</td>\n\t\t\t\t<td>[AuditEvent.entity[1].what, Line 49, Col 18]</td>\n\t\t\t\t<td><pre>A Reference without an actual reference or identifier should have a display</pre></td>\n\t\t\t</tr>\n\t\t</table>\n\t</div>"
  },
  "issue": [
    {
      "severity": "error",
      "code": "processing",
      "diagnostics": "This property must be an simple value, not an object (type at AuditEvent.entity[0].what.type)",
      "location": [
        "AuditEvent.entity[0].what.type",
        "Line 38, Col 58"
      ]
    },
    {
      "severity": "error",
      "code": "processing",
      "diagnostics": "This property must be an simple value, not an object (reference at AuditEvent.entity[1].what.reference)",
      "location": [
        "AuditEvent.entity[1].what.reference",
        "Line 46, Col 42"
      ]
    },
    {
      "severity": "error",
      "code": "processing",
      "diagnostics": "This property must be an simple value, not an object (type at AuditEvent.entity[1].what.type)",
      "location": [
        "AuditEvent.entity[1].what.type",
        "Line 50, Col 79"
      ]
    },
    {
      "severity": "warning",
      "code": "processing",
      "diagnostics": "dom-6: 'A resource should have narrative for robust management' failed",
      "location": [
        "AuditEvent",
        "Line 1, Col 2"
      ]
    },
    {
      "severity": "error",
      "code": "processing",
      "diagnostics": "AuditEvent.recorded: minimum required = 1, but only found 0 (from http://hl7.org/fhir/StructureDefinition/AuditEvent)",
      "location": [
        "AuditEvent",
        "Line 1, Col 2"
      ]
    },
    {
      "severity": "error",
      "code": "processing",
      "diagnostics": "The Coding references a value set, not a code system ('http://hl7.org/fhir/ValueSet/audit-event-type')",
      "location": [
        "AuditEvent.type",
        "Line 4, Col 63"
      ]
    },
    {
      "severity": "error",
      "code": "processing",
      "diagnostics": "Unknown Code System 'http://hl7.org/fhir/ValueSet/audit-event-type'",
      "location": [
        "AuditEvent.type",
        "Line 4, Col 63"
      ]
    },
    {
      "severity": "error",
      "code": "processing",
      "diagnostics": "AuditEvent.agent.requestor: minimum required = 1, but only found 0 (from http://hl7.org/fhir/StructureDefinition/AuditEvent)",
      "location": [
        "AuditEvent.agent[0]",
        "Line 12, Col 6"
      ]
    },
    {
      "severity": "warning",
      "code": "processing",
      "diagnostics": "A Reference without an actual reference or identifier should have a display",
      "location": [
        "AuditEvent.entity[1].what",
        "Line 49, Col 18"
      ]
    }
  ]
}

view this post on Zulip John Moehrke (May 06 2021 at 19:19):

I think this set of .entity are indeed wrongly assembled

view this post on Zulip John Moehrke (May 06 2021 at 19:19):

"entity": [
{
"what": {
"reference": "Consent/2045174",
"type": {
"system": "http://hl7.org/fhir/resource-types",
"code": "Consent"
}
}
},
{
"what": {
"reference": {
"reference": "Patient/1731610",
"display": "Younger,Gallow"
},
"type": {
"system": "http://terminology.hl7.org/CodeSystem/audit-entity-type",
"code": "1",
"display": "Person"
}
}

view this post on Zulip John Moehrke (May 06 2021 at 19:21):

the 'what' references should not need to have a reference.type. I think the type is intended to be the entity[0].type

view this post on Zulip John Moehrke (May 06 2021 at 19:22):

@Mohammad Jafari are you just wanting to say that the consent resource and the patient were involved?

view this post on Zulip John Moehrke (May 06 2021 at 19:23):

see my IG on this topic http://build.fhir.org/ig/JohnMoehrke/BasicAudit/branches/main/index.html

view this post on Zulip John Moehrke (May 06 2021 at 19:25):

I realize you are doing an audit of an access control "decision", but the entity section should look similar to my examples

view this post on Zulip John Moehrke (May 06 2021 at 19:26):

see this one for a simple RESTful Create http://build.fhir.org/ig/JohnMoehrke/BasicAudit/branches/main/AuditEvent-ex-auditBasicCreate1.json.html

view this post on Zulip John Moehrke (May 06 2021 at 19:28):

change your entity section like this
"entity" : [
{
"what" : {
"reference" : "Patient/1731610"
},
"type" : {
"system" : "http://terminology.hl7.org/CodeSystem/audit-entity-type",
"code" : "1",
"display" : "Person"
},
"role" : {
"system" : "http://terminology.hl7.org/CodeSystem/object-role",
"code" : "1",
"display" : "Patient"
}
},
{
"what" : {
"reference" : "Consent/2045174"
},
"type" : {
"system" : "http://terminology.hl7.org/CodeSystem/audit-entity-type",
"code" : "2",
"display" : "System Object"
},
"role" : {
"system" : "http://terminology.hl7.org/CodeSystem/object-role",
"code" : "4",
"display" : "Domain Resource"
}
}
]

view this post on Zulip John Moehrke (May 06 2021 at 19:29):

i have not thought of what the entity.type or entity.role values would be for the consent... let me think...

view this post on Zulip John Moehrke (May 06 2021 at 19:30):

I guess type might be okay to be Consent... it is that kind of an object...

view this post on Zulip John Moehrke (May 06 2021 at 19:31):

role seems best to be a "13" Security Resource

view this post on Zulip Mohammad Jafari (May 06 2021 at 19:44):

Thanks @James Agnew . The server accepted the resource with no errors, so that's why I didn't think to check the validity.

view this post on Zulip Mohammad Jafari (May 06 2021 at 20:26):

Thanks @John Moehrke for pointing out the IG. I made adjustments to comply with this IG.

view this post on Zulip John Moehrke (May 06 2021 at 20:27):

well... it is not a formal IG... yet.... but It does all validate and It is my thinking of how this would work.


Last updated: Apr 12 2022 at 19:14 UTC