Skip to content

Latest commit

 

History

History
45 lines (37 loc) · 2.16 KB

README.md

File metadata and controls

45 lines (37 loc) · 2.16 KB

ATNA2FHIR

ATNA2FHIR converts audit logs that adhere to the (ATNA) Audit Trail Message Format into (HL7 FHIR) AuditEvent resources.

Installing

Using npm:

$ npm install @upmc-enterprises/atna2fhir

Versioning

ATNA2FHIR Version FHIR Version
1.x.x R4

Usage

const converter = require('@upmc-enterprises/atna2fhir')

const xml = `<AuditMessage>
    <EventIdentification EventActionCode="E" EventDateTime="2014-11-10T12:00:00.500-08:00" EventOutcomeIndicator="0">
        <EventID csd-code="110100" codeSystemName="DCM" originalText="Application Activity"/>
        <EventTypeCode csd-code="110120" codeSystemName="DCM" originalText="Application Start"/>
        <EventOutcomeDescription>Example Description</EventOutcomeDescription>
    </EventIdentification>
    <ActiveParticipant AlternativeUserID="alt@user" NetworkAccessPointID="127.0.0.1" NetworkAccessPointTypeCode="2" UserID="root" UserIsRequestor="true">
        <RoleIDCode csd-code="110150" codeSystemName="DCM" originalText="Application"/>
        <MediaIdentifier>
            <MediaType csd-code="110030" codeSystemName="DCM" originalText="USB Disk Emulation"/>
        </MediaIdentifier>
    </ActiveParticipant>
    <AuditSourceIdentification code="4" AuditSourceID="127.0.0.1@ACCT">
        <AuditSourceTypeCode csd-code="9" codeSystemName="DCM" originalText="Other" />
    </AuditSourceIdentification>
    <ParticipantObjectIdentification ParticipantObjectID="1.2.3" ParticipantObjectTypeCode="2" ParticipantObjectTypeCodeRole="3" ParticipantObjectDataLifeCycle="1">
        <ParticipantObjectIDTypeCode code="110180" codeSystemName="DCM" displayName="Study Instance UID"/>
    </ParticipantObjectIdentification>    
</AuditMessage>`

const auditEvent = await converter.convert(xml)
const transaction = converter.wrapInABundleTransaction(auditEvent)
console.log(JSON.stringify(transaction))