Class: UserMetaService

UserMetaService


new UserMetaService()

Service for Meta (non-clinical) queries relating to Users.

Methods


canUserModifyAllergies(context, callback)

Returns true if a user can mark an allergy as entered in error, otherwise false

Parameters:
Name Type Description
context Object

The session data

callback function

The callback function used to process results

Returns:

res - true or false

Type
Boolean

formatNameComponents(name)

Format the contents of a name component object and return a simplified component object in its place

Parameters:
Name Type Description
name Object

Name component (file type 20) VDM object

Returns:

Simplified name component object

Type
Object

formatUserName(name)

Split a user name label and return a simplified component object in its place

Parameters:
Name Type Description
name String

User 'name' field (from file type 200) VDM object. Per schema documentation this must be in the 'LAST,FIRST MIDDLE SUFFIX' format.

Returns:

Simplified name component object

Type
Object

hasMultipleSecurityKeys(keys, context, callback)

Returns true if a user holds one key from a set of security keys, otherwise false.

Parameters:
Name Type Description
keys Array

The names of the security keys (i.e. ['GMV MANAGER', 'LRLAB'])

context Object

Session context information associated with the service call.

callback function

Function called on process completion, with standard (err, result) signature.

Returns:
Type
Boolean

hasSecurityKey(key, context, callback)

Returns true if a user holds a security key, otherwise false.

Parameters:
Name Type Description
key String

The name of the security key (i.e. 'XUPROGMODE')

context Object

Session context information associated with the service call.

callback function

Function called on process completion, with standard (err, result) signature.

Returns:
Type
Boolean

isActiveProvider(visitDate, context, callback)

Returns true if provider is good and false if the provider is not active or does not have an active person class.

Parameters:
Name Type Description
visitDate String

encounter date/time in Fileman format

context Object

Session context information associated with the service call.

callback function

Function called on process completion, with standard (err, result) signature.

Returns:

Either true or false depending on if provider is active or has an active person class status

Type
Boolean

listDivisions(context, callback)

Returns a list of divisions of the current user, or makes changes to the user's division & returns 0 (see description)

NOTE: This service will CHANGE the session division to SYSTEM division if (1) the divisions list has a single division and (2) divisionId is different from the divisionId in session.divisions

Parameters:
Name Type Description
context Object

Session context information associated with the service call.

callback function

Function called on process completion, with standard (err, result) signature.

Returns:

Object with array of divisions, or a success/fail message if user's division is changed

Type
Object

listUserInfo(context, callback)

Returns preferences for the current user.

Note: In addition to returning user preferences, this service UPDATES the sidLastChecked property of NewPerson.

Parameters:
Name Type Description
context Object

Session context information associated with the service call.

callback function

Function called on process completion, with standard (err, result) signature.

Returns:

Object with user preferences

Type
Object

listUsers(searchTerm, limit, context, callback)

Returns a list of all existing users based off station Id

Parameters:
Name Type Description
searchTerm String

Search term to use for starting the returned list

limit Number

[description] The maximum number of NewPerson objects to query, defaults to 44

context Object

Session context information associated with the service call.

callback function

Function called on process completion, with standard (err, result) signature.

Returns:

Object with array of users

Type
Object

lookupAlternativeName(context, callback)

This RPC gets the SUBJECT ALTERNATIVE NAME field from the New Person (#200) file field 501.2. It is used to check that the correct PIV card has been put into the reader.

Parameters:
Name Type Description
context Object

Session context information associated with the service call.

callback function

Function called on process completion, with standard (err, result) signature.

Returns:

subjectAlternativeName value from response or empty string

Type
String

lookupAppointmentDateRange(context, callback)

Get user’s (all levels) Encounter appointment date range.

Parameters:
Name Type Description
context Object

Session context information associated with the service call.

callback function

Function called on process completion, with standard (err, result) signature.

Returns:

The appointment date range: startDate: The start date stopDate: The end date

Type
Object

lookupDefaultListSort()

Return the current user’s default patient selection list SORT ORDER setting.

Returns:

A or D

Type
String

lookupDefaultParameters(data, context, callback)

Get the "GMV USER DEFAULT" parameter instance defined by the "DATA" variable

Parameters:
Name Type Description
data String

The name of the instance to get.

context Object

Session context information associated with the service call.

callback function

Function called on process completion, with standard (err, result) signature.

Returns:

Object with parameter value or empty string if it doesn't exist

Type
Object

lookupDefaultPatientList()

Return the current user’s default patient list

Returns:

patient list

Type
array

lookupSessionContext(userID, stationId, callback)

Get a session context object based on a user ID and a station number, which, in essence, represents a unique VISTA system

Parameters:
Name Type Description
userID String

The ID (URN) of a particular user

stationId String | Number

The station ID used to identify a particular VISTA system

callback function

Function called on process completion, with standard error-first (err, result) signature.


lookupUserDefaults(data, context, callback)

Get the default info for the currently logged in user

Parameters:
Name Type Description
data String

Not utilized in this service

context Object

Session context information associated with the service call.

callback function

Function called on process completion, with standard (err, result) signature.

Returns:

Object with user parameter values: [userId, userLabel, domainId, domainLabel, facilityId, facilityLabel, isManager, title, DTIME, site]

Type
Object

lookupUserInfo(context, callback)

Returns information about a user after logon.

Parameters:
Name Type Description
context Object

Session context information associated with the service call.

callback function

Function called on process completion, with standard (err, result) signature.

Returns:

Information associated with the current user

Type
Object

setDefaultParameters(data, context, callback)

Create, update, or clear the "GMV USER DEFAULT" parameter instance defined by the "DATA" variable

Parameters:
Name Type Description
data String

The name of the instance to set with the value to set, separated by a caret (e.g. TEST^10) or just the instance to clear

context Object

Session context information associated with the service call.

callback function

Function called on process completion, with standard (err, result) signature.

Returns:

Return code (success=1 or fail=-1) and message

Type
String

setDivision(stationNumber, context, callback)

Sets the user's session Division and returns a success/failure message.

NOTE: This implementation only supports division setting by stationNumber, not by division name

Parameters:
Name Type Description
stationNumber Number

The station number of the division to assign to the current user's session.

context Object

Session context information associated with the service call.

callback function

Function called on process completion, with standard (err, result) signature.

Returns:

A success or failure message.

Type
Object

titleCaseNames(str)

Convert a name string (possibly with more than one word) to "title case"

Parameters:
Name Type Description
str String

Name string

Returns:

Name string with the first letter of each distinct word capitalized

Type
String

titleCaseTitles(str)

Use VistA's scheme to convert name titles (prefix, suffix, degree) to "title case"

Parameters:
Name Type Description
str String

Name string

Returns:

Name string with capitalization applied, per VistA logic

Type
String