Code handling for AuditEvent
See original GitHub issueI 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:
- Created 4 years ago
- Reactions:1
- Comments:7 (6 by maintainers)
Top GitHub Comments
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:
Apart from this single issue we’ve had great use of this package! 😊
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
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