Home > Class Reference > %SYS namespace > %ZHSLIB.Audit.Log

%ZHSLIB.Audit.Log

persistent class %ZHSLIB.Audit.Log extends %Library.Persistent, %XML.Adaptor

SQL Table Name: %ZHSLIB_Audit.Log

To use the audit log, first define a log entry by calling: ##ClassMethod(%ZHSLIB.Audit.Log).CreateLog( arguments ) to define the overall entry. This will return a reference to a log object. Next, on the log object, for each "participant" (patient, doctor, etc.) call AddParticipant( arguments) to add these to the log. If SDA is being logged, that needs its own call: LogSDA(sda) Finally, on the log object, call SaveLog(). See the documentation for CreateLog for chaining log items together.

Property Inventory (Including Private)

Method Inventory (Including Private)

Properties (Including Private)

property AccessGateway as %String);
Property methods: AccessGatewayDisplayToLogical(), AccessGatewayGet(), AccessGatewayGetStored(), AccessGatewayIsValid(), AccessGatewayLogicalToDisplay(), AccessGatewayLogicalToOdbc(), AccessGatewayNormalize(), AccessGatewaySet()
property EventID as %String) [ Required ];
Property methods: EventIDDisplayToLogical(), EventIDGet(), EventIDGetStored(), EventIDIsValid(), EventIDLogicalToDisplay(), EventIDLogicalToOdbc(), EventIDNormalize(), EventIDSet()
property InitiatingLogID as %String) [ Required ];
Property methods: InitiatingLogIDDisplayToLogical(), InitiatingLogIDGet(), InitiatingLogIDGetStored(), InitiatingLogIDIndexExists(), InitiatingLogIDIsValid(), InitiatingLogIDLogicalToDisplay(), InitiatingLogIDLogicalToOdbc(), InitiatingLogIDNormalize(), InitiatingLogIDSet()
property LogEnd as %TimeStamp;
Property methods: LogEndDisplayToLogical(), LogEndGet(), LogEndGetStored(), LogEndIsValid(), LogEndLogicalToDisplay(), LogEndLogicalToXSD(), LogEndNormalize(), LogEndOdbcToLogical(), LogEndSet(), LogEndXSDToLogical()
property LogID as %String) [ Required ];
Property methods: LogIDDisplayToLogical(), LogIDGet(), LogIDGetStored(), LogIDIndexExists(), LogIDIsValid(), LogIDLogicalToDisplay(), LogIDLogicalToOdbc(), LogIDNormalize(), LogIDSet()
property LogStart as %TimeStamp;
Property methods: LogStartDisplayToLogical(), LogStartGet(), LogStartGetStored(), LogStartIsValid(), LogStartLogicalToDisplay(), LogStartLogicalToXSD(), LogStartNormalize(), LogStartOdbcToLogical(), LogStartSet(), LogStartXSDToLogical()
property OtherEvent as %String);
Property methods: OtherEventDisplayToLogical(), OtherEventGet(), OtherEventGetStored(), OtherEventIsValid(), OtherEventLogicalToDisplay(), OtherEventLogicalToOdbc(), OtherEventNormalize(), OtherEventSet()
property ParticipantList as list of %ZHSLIB.Audit.LogParticipant [ Private , Transient ];
Property methods: ParticipantListBuildValueArray(), ParticipantListCollectionToDisplay(), ParticipantListCollectionToOdbc(), ParticipantListDisplayToCollection(), ParticipantListGet(), ParticipantListGetObject(), ParticipantListGetObjectId(), ParticipantListGetSwizzled(), ParticipantListIsValid(), ParticipantListOdbcToCollection(), ParticipantListSet(), ParticipantListSetObject(), ParticipantListSetObjectId()
relationship Participants as array of %ZHSLIB.Audit.LogParticipant [ InitialExpression = $listbuild("%ZHSLIB.Audit.LogParticipant","Log",+$this,"children",1,1) , Transient , Inverse = Log , Cardinality = children ];
Property methods: ParticipantsGet(), ParticipantsGetObject(), ParticipantsGetObjectId(), ParticipantsGetSwizzled(), ParticipantsIsEmpty(), ParticipantsIsValid(), ParticipantsNewObject(), ParticipantsRClose(), ParticipantsRExec(), ParticipantsRFetch(), ParticipantsRelate(), ParticipantsSQLCompute(), ParticipantsSet(), ParticipantsUnRelate()
property ProxyUserID as %String);
Property methods: ProxyUserIDDisplayToLogical(), ProxyUserIDGet(), ProxyUserIDGetStored(), ProxyUserIDIsValid(), ProxyUserIDLogicalToDisplay(), ProxyUserIDLogicalToOdbc(), ProxyUserIDNormalize(), ProxyUserIDSet()
property Roles as %String);
Property methods: RolesDisplayToLogical(), RolesGet(), RolesGetStored(), RolesIsValid(), RolesLogicalToDisplay(), RolesLogicalToOdbc(), RolesNormalize(), RolesSet()
property SDA as %Stream.GlobalCharacter;
Property methods: SDADelete(), SDAGet(), SDAGetObject(), SDAGetObjectId(), SDAGetStored(), SDAGetSwizzled(), SDAIsValid(), SDANewObject(), SDAOid(), SDAOpen(), SDASet(), SDASetObject(), SDASetObjectId(), SDAUnSwizzle()
property SourceID as %String);
Property methods: SourceIDDisplayToLogical(), SourceIDGet(), SourceIDGetStored(), SourceIDIsValid(), SourceIDLogicalToDisplay(), SourceIDLogicalToOdbc(), SourceIDNormalize(), SourceIDSet()
property UserID as %String);
Property methods: UserIDDisplayToLogical(), UserIDGet(), UserIDGetStored(), UserIDIsValid(), UserIDLogicalToDisplay(), UserIDLogicalToOdbc(), UserIDNormalize(), UserIDSet()

Methods (Including Private)

private method %OnNew(ByRef pErr As %String, pInitiatingLogID As %String, pEventID As %String, pOtherEvent As %String = "", pLogStart As %TimeStamp = {$ZDATETIME($ZTIMESTAMP, 3, 1, 3)}, pSourceID As %String, pUserID As %String, pRoles As %String, pAccessGateway As %String, pProxyUserID As %String = "") as %Status [ Language = objectscript ]
Method is being transitioned as of SMB1026 - the data will only be used to store the fetched SDAs on the edge, and we will no longer log anything else here. To ease the transition, we'll pass in pErr as "SDA" for new uses, along with pEventId and pInitiatingLogID
method AddParticipant(pType As %String = "", pOtherType As %String = "", pID As %String = "", pIDText As %String = "", pDetail As %String = "") as %Status [ Language = objectscript ]
Arguments:
  • pType: (see %ZHSLIB.Audit.LogParticipant)
  • pOtherType: if type is O, this is required
  • pID: The identifier (i.e. the MRN, or patient ID, or doctor or facility identifier, etc.)
  • pIDText: Optional string name for pID - ex: patient or doctor name
  • pDetail: Optional string blob with details specific to each type of event & participant. See audit trail design document on HealthShare Wiki for what should go here.
  • classmethod AddSDA(pLogID, pSDA) as %Status [ Language = objectscript ]
    This may be called to add SDA to an already saved log. It will return an error if the SDA already has been logged
    classmethod AssignLogID(ByRef pLogID As %String) as %Status [ Language = objectscript ]
    This class method can be called form the hub or any gateway to increment the log counter and to assign a globally unique log ID. It can be called, for instance, on the access gateway in order to get the initiating log ID that will be used to tie together a sequence of lookups, retrievals, and viewing.
    classmethod CreateLog(Output pLogRef As %ZHSLIB.Audit.Log, ByRef pInitiatingLogID As %String = "", pEventID As %String = "", pOtherEvent As %String = "", pLogStart As %TimeStamp = {$ZDT($ZTIMESTAMP, 3, 1, 3)}, pSourceID As %String = "", pUserID As %String = "", pRoles As %String = "", pAccessGateway As %String = "", pProxyUserID As %String = "") as %String [ Language = objectscript ]
    Arguments:
  • pLogRef: By reference, to return the OREF to the created log
  • pInitiaingLogID: This argument is used by reference to chain log events together. For the first event, pass in an empty string, and this will generate a log ID. For subsequent events, pass in this generated log ID. The log ID is unique throughout the HealthShare installation. It's generated by a combination that identifies the computer name, ensemble instance, namespace, and a sequential number.
  • pEventID: This identifies the type of event being logged. Choices are (so far): ConsentUpdate, PatientSearch, SearchPatient, BreakGlass, RecordRequest, and Other
  • pOtherEvent:Required for event ID of Other
  • pLogStart: Optionally, pass in a timestamp. If missing, this will use the current time
  • pSourceID: Optionally, pass is an identifier of the unique "application" that was the source of this audit event. If missing, this will use the same prefix as the generated log ID.
  • pUserID: Pass is an identifier of the user who was the "active participant" for this event. The User might not be a person, for system generated events. UserID must uniquely identify a person or system within the Source ID
  • pRoles: Pass in the Roles for this user
  • pAccessGateway: Pass in the name of the access gateway where it all started
  • pProxyUserID - if the user is acting as a proxy for someone else, this will be the proxied one
    Returns: a status message - $$$OK, etc.
  • classmethod CreateSDALog(pInitiatingLogID As %String, pEventID As %String, pSDA As %Stream.Object, Output pLogId As %String) as %Status [ Language = objectscript ]
    New Method used as of SMB1026 to create a log to store the fetched SDA
    method LogSDA(pSDA) as %Status [ Language = objectscript ]
    Argument: SDA document. SDA is kept separate from the rest of the data in order to preserve privacy and confidentiality It can be a string, a Stream, or an XML adapter
    classmethod NewInitiatingLog() as %String [ Language = objectscript ]
    Utility Method to generate unique initiating log ID
    classmethod NextID(pAfterID As %Integer) as %Integer [ Language = objectscript ]
    classmethod NextSysAudit(ByRef pUTCTimeStamp As %String, ByRef pSystemID As %String, ByRef pAuditIndex As %BigInt, ByRef pProperties As %String) as %Integer [ Language = objectscript ]
    classmethod SaveIHE(pIHELog As %Persistent) as %Status [ Language = objectscript ]
    Utility Method used to save IHE logs, when stored in a secured tamperproof database
    method SaveLog() as %Status [ Language = objectscript ]

    Queries

    query AfterID(AfterID As %Integer)
    SQL Query:
    SELECT %ID,EventID,InitiatingLogID,LogEnd,LogID,LogStart,OtherEvent,SourceID,UserID,Roles,AccessGateway FROM Log WHERE %ID > :AfterID ORDER BY %ID
    query ByEventID(EventType As %String, AfterID As %Integer)
    SQL Query:
    SELECT %ID,EventID,InitiatingLogID,LogEnd,LogID,LogStart,OtherEvent,SourceID,UserID,Roles,AccessGateway FROM Log WHERE ( (EventID = :EventType) OR (:EventType='') ) AND (%ID > :AfterID) ORDER BY %ID
    Query used for Audit Actions. Two arguments:
  • EventType - the type of event desire.
  • AfterID - to retrieve all audit events whose %ID is after this argument (0 means all)
  • Indexes

    index (InitiatingLogIDIndex on InitiatingLogID);
    Index methods: InitiatingLogIDIndexExists()
    index (LogIDIndex on LogID);
    Index methods: LogIDIndexExists()

    Inherited Members

    Inherited Methods (Including Private)

    Storage

    Storage Model: Storage (%ZHSLIB.Audit.Log)

    ^HS.Audit("LogD")(ID)
    =
    %%CLASSNAME
    LogID
    InitiatingLogID
    EventID
    OtherEvent
    LogStart
    LogEnd
    SourceID
    UserID
    Roles
    AccessGateway
    SDA
    ProxyUserID
    FeedbackOpens in a new window