Class: AllergyService

AllergyService


new AllergyService()

CRUD functions for the Allergy domain.

Methods


createAllergy(args, context, callback)

Creates a new Allergy and assigns it to the current patient.

Parameters:
Name Type Description
args Object

Object with all allergy properties to be created.

Properties
Name Type Description
reactant Object
Properties
Name Type Description
id String

Allergy reactant identifier.

label String

Allergy reactant label (e.g. CHOCOLATE).

allergyType String

Type of allergy. Possible values: DRUG, FOOD, (DRUG, FOOD), OTHER.

mechanism String

Allergy mechanism. Possible values: ALLERGY, PHARMACOLOGIC, UNKNOWN.

observedOrHistorical String

Observed or historical indicator. Possible values: OBSERVED, HISTORICAL.

allergySeverity String

Allergy severity. Possible values: MILD, MODERATE, SEVERE.

dateOccurred Date

Date occurred value.

reactions Array

List of reaction identifiers.

comments Array

List of allergy comments.

context Object

the session data

callback function

the callback function used to process results

Returns:

A success or fail message.

Type
Object

createNoReactionsAllergyAssessment(context, callback)

Creates a new Allergy Assessment with no reactions for the current patient

This is equivalent to setting a 'No Known Allergies' state to a patient's allergy record

Parameters:
Name Type Description
context Object

the session data

callback function

the callback function used to process results

Returns:

A success or fail message.

Type
Object

deleteAllergy(allergyId, context, callback)

Permanently deletes (!) an existing Allergy record in MongoDB.

ONLY USE FOR TESTING!!

Parameters:
Name Type Description
allergyId String

The id of the allergy to delete

context Object

the session data

callback function

the callback function used to process results

Returns:

A success or fail message.

Type
Object

deleteAllergyAssessment(context, callback)

Deletes the Allergy Assessment of the current patient

Only called when the last existing Allergy is removed from a Patient's list of Allergies

Parameters:
Name Type Description
context Object

the session data

callback function

the callback function used to process results

Returns:

A success or fail message.

Type
Object

listAllergies(context, callback)

Returns allergies for a patient, 'No Allergy Assessment', or 'No Known Allergies'

Parameters:
Name Type Description
context Object

the session data

callback function

the callback function used to process results

Returns:

An Object with an array of Allergies attributed to the patient, or an error message.

Type
Object

lookupAllergy(allergyId, context, callback)

Returns information about a specified allergy.

Note: Only allergies assigned to the current patient in context can be looked up.

Parameters:
Name Type Description
allergyId String

The allergy ID to lookup (in URN format)

context Object

the session data

callback function

the callback function used to process results

Returns:

An object with allergy properties, or error message if allergy search fails.

Type
Object

lookupAllergyAssessment(context, callback)

Returns information about a patient's Allergy Assessment.

Parameters:
Name Type Description
context Object

the session data

callback function

the callback function used to process results

Returns:

An object with id and hasReaction properties, or error message if allergy search fails.

Type
Object

removeAllergy(allergyId, comment, context, callback)

"Removes" an existing Allergy record in MongoDB

Sets "isRemoved" and "removalDetails" properties of an existing Allergy record. If the last allergy assigned to a patient is removed, then the patient's Allergy Assessment is deleted

Parameters:
Name Type Description
allergyId String

The id of the allergy to remove

comment String

Optional comment to be added to the removalDetails

context Object

the session data

callback function

the callback function used to process results

Returns:

A success or fail message.

Type
Object

updateAllergy(allergyId, allergyProperties, context, callback)

Updates an existing Allergy record in MongoDB

NOTE: At the moment, this service is not being utilized by any RPC, and will PROBABLY require more testing in the future.

Parameters:
Name Type Description
allergyId String

The id of the allergy to update

allergyProperties Object

Object with properties to be updated as key/value pairs

context Object

the session data

callback function

the callback function used to process results

Returns:

A success or fail message.

Type
Object

updateAllergyAssessment(context, callback)

Updates the Allergy Assessment of the current patient

This service should only be called when a Patient is assigned a new allergy through createAllergy

Parameters:
Name Type Description
context Object

the session data

callback function

the callback function used to process results

Returns:

A success or fail message.

Type
Object