proknow.Audit
Audit
- class proknow.Audit.Audit(proknow, requestor)
This class should be used to interact with the audit logs in a Proknow organization. It is instantiated for you as an attribute of the
proknow.ProKnow.ProKnow
class.- query(**kwargs)
Queries for audit logs.
- Parameters:
options (dict) – Dictionary of one or more of the following query parameters
page_size (int) – (Default is 25) The number of items for each page
start_time (datetime) – Start time cut off for whole query
end_time (datetime) – End time cut off for whole query
types (str or list) – List of event types
user_id (str) – ID of events’ enacting user
user_name (str) – User name of events’ enacting user
patient_id (str) – ID of patient
patient_name (str) – Name of patient
patient_mrn (str) – Medical record number of patient
workspace_id (str) – ID of workspace in which events took place
workspace_name (str) – Name of workspace in which events took place
collection_id (str) – ID of a collection
resource_id (str) – ID of a resource
resource_name (str) – Name of a resource
classification (str) – ‘HTTP’ or ‘AUTH’
methods (str or list) – List of HTTP methods: ‘GET’, ‘HEAD’, ‘POST’, ‘PUT’, ‘DELETE’, ‘CONNECT’, ‘OPTIONS’, ‘TRACE’, or ‘PATCH’
uri (str) – Filter by the uri that events took place (e.g. ‘/metrics/custom’)
user_agent (str) – User Agent attributed to events (e.g. Browser User Agent)
ip_address (str) – IP Address attributed to events
status_codes (str or list) – List of status codes of events (e.g. 200)
text (str or list) – Text to search for in all text fields
- Returns:
An object representing a page of query results
- Return type:
- Raises:
proknow.Exceptions.HttpError – If the HTTP request generated an error.
Example
This example shows how to query for all events in a workspace called “Clinical”:
from proknow import ProKnow pk = ProKnow('https://example.proknow.com', credentials_file="./credentials.json") clinicalResults = pk.audit.query(workspace_name="Clinical") while len(clinicalResults.items) > 0: for item in clinicalResults.items: print(item) clinicalResults = clinicalResults.next()
AuditResultsPage
- class proknow.Audit.AuditResultsPage(audit, options, total, items)
This class represents a page of audit log query results. It’s instantiated by the
proknow.Audit.Audit.query()
method.- total
The total number of possible results for the given query, not the total of items in the object’s item list.
- Type:
int
- items
A list of dictionaries to represent each item returned for the current page.
- Item Keys:
id: The ID of the event
timestamp: Time of event
user_id: User ID of event’s enacting user
user_name: User name of event’s enacting user
patient_id: ID of patient
patient_name: Name of patient
patient_mrn: Medical record number of patient
resource_id: ID of a resource
resource_name: Name of a resource
workspace_id: ID of workspace in which events took place
workspace_name: Name of workspace in which events took place
collection_id: ID of a collection
type: Event type (e.g. ‘workspace_created’)
classification: ‘HTTP’ or ‘AUTH’
method: HTTP method: ‘GET’, ‘HEAD’, ‘POST’, ‘PUT’, ‘DELETE’, ‘CONNECT’, ‘OPTIONS’, ‘TRACE’, or ‘PATCH’
uri: Uri that event took place (e.g. ‘/metrics/custom’)
user_agent: User Agent attributed to event (e.g. Browser User Agent)
ip_address: IP Address attributed to event
status_code: Status code of event (e.g. 200)
data: Request data
- Type:
list of dict
- next()
Gets the next page of query results using the initial query parameters.
- Returns:
A new object representing the next page of query results relative to the current page.
- Return type:
- Raises:
proknow.Exceptions.HttpError – If the HTTP request generated an error.