question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Code handling for AuditEvent

See original GitHub issue

I just checked out the library, so this is probably a misunderstanding:

When I decode this example AuditEvent the result doesn’t validate because the example has numbers for outcome and agent.network.type. I see from the code that you have defined enums, and the library is expecting values like ‘Success’ for outcome, and ‘MachineName’ for agent.network.type.

The possible values for outcome are defined here. Network type is defined here. My understanding is that the code (ie the number) should be included in the resource.

Could you clarify what the expected behaviour for decode is, wrt these code fields?

const validationResult = R4.RTTI_AuditEvent.decode(auditEventJSON)
console.log(PathReporter.report(validationResult))

[ ‘Invalid value “2” supplied to : IAuditEvent/0: { resourceType: “AuditEvent”, type: ICoding, agent: Array<IAuditEvent_Agent>, source: IAuditEvent_Source }/agent: Array<IAuditEvent_Agent>/0: IAuditEvent_Agent/network: IAuditEvent_Network/type: AuditEvent_NetworkTypeKind’, ‘Invalid value “1” supplied to : IAuditEvent/0: { resourceType: “AuditEvent”, type: ICoding, agent: Array<IAuditEvent_Agent>, source: IAuditEvent_Source }/agent: Array<IAuditEvent_Agent>/1: IAuditEvent_Agent/network: IAuditEvent_Network/type: AuditEvent_NetworkTypeKind’, ‘Invalid value “0” supplied to : IAuditEvent/1: Partial<{ id: RTTI_idType, meta: IMeta, implicitRules: RTTI_uriType, _implicitRules: IElement, language: RTTI_codeType, _language: IElement, text: INarrative, contained: Array<IResourceList>, extension: Array<IExtension>, modifierExtension: Array<IExtension>, subtype: Array<ICoding>, action: AuditEventActionKind, _action: IElement, period: IPeriod, recorded: RTTI_instantType, _recorded: IElement, outcome: AuditEventOutcomeKind, _outcome: IElement, outcomeDesc: string, _outcomeDesc: IElement, purposeOfEvent: Array<ICodeableConcept>, entity: Array<IAuditEvent_Entity> }>/outcome: AuditEventOutcomeKind’ ]

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:7 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
vetlevocommented, Aug 11, 2021

I ran into the same issue when starting to use this library for creating audit events, basically the values defined in enum: https://github.com/Ahryman40k/typescript-fhir-types/blob/9bb375d63bd7730a530718dc9138f2caf73f7104/src/R4/Resource/RTTI_AuditEvent_Network.ts#L4 should be numerical codes from 1 through 5 and not the display names as mentioned previously. This has been the same since FHIR version 3.0.0 https://hl7.org/fhir/STU3/codesystem-network-type.html

There is also an issue as mentioned above with the AuditEventOutcomeKind.

Proposed changes:

export enum AuditEvent_NetworkTypeKind {
	_machineName = '1',
	_ipAddress = '2',
	_telephoneNumber = '3',
	_emailAddress = '4',
	_uri = '5'
}
export enum AuditEventOutcomeKind {
	_success = '0',
	_minorFailure = '4',
	_seriousFailure = '8',
	_majorFailure = '12'
}

Apart from this single issue we’ve had great use of this package! 😊

1reaction
Ahryman40kcommented, Jan 28, 2020

Hi @matthewdenobrega,

Finally, it’s easier as I thought, the provided value for the network type is ‘2’ and in my library, in file RTTI_AuditEvent_Network.ts, you can see ‘type’ is type of AuditEvent_NetworkTypeKind define as

export enum AuditEvent_NetworkTypeKind {
	_machineName = 'MachineName',
	_ipAddress = 'IPAddress',
	_telephoneNumber = 'TelephoneNumber',
	_emailAddress = 'EmailAddress',
	_uri = 'Uri'
}

So it means ‘2’ is an invalid value. I may have made a mistake there …

I’m rewriting the generator, but I’m really busy. So please be patient or don’t hesitate to fork the repository to fix the code.

Best regards

Read more comments on GitHub >

github_iconTop Results From Across the Web

AuditEvent - FHIR v5.0.0-cibuild
AuditEvent.outcome.code​​ Indicates whether the event succeeded or failed. when a code is given there must be one code from the given codeSystem.
Read more >
Audit event codes and fields - IBM
Event Code Event Variable Contents ADLG Add Transaction Log dbname: dbspace , name. extra_1: log_size ALSQ Alter Sequence dbname: database_name. tabid: table_id ALUR Alter User objname:...
Read more >
Audit Event Codes - Micro Focus
These are the audit events emitted by the External Security Facility (ESF), Micro Focus Directory Server (MFDS), JCL, and Data File Tools.
Read more >
AuditEvent - FHIR v4.0.1
Code representing the role the entity played in the audit event. Extensible · AuditEventEntityRole. AuditEvent.entity.lifecycle, Identifier for the data life- ...
Read more >
Spring Boot Authentication Auditing Support - Baeldung
getAuditEvent(); System.out.println("Principal " + auditEvent. ... If you want to test it, check out the source code and run:
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found