Class: LexiconService

LexiconService


new LexiconService()

This service class provides an API for Lexicon searches

Methods


isActiveCode(code, type, date, callback)

Returns whether or not a code is active on the given date

Parameters:
Name Type Description
code String

ICD or CPT code to be checked.

type String

Type of code - ICD, GMPX (any), or CHP (CPT)

date String

Date to check for expiration/activation, defaults to current date

callback function

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

Returns:

True or False

Type
Boolean

lookupAllergies(searchInput, callback)

Return a list of allergies and synonyms within a range specified by the user's search text

Notes: o Tradename is not a unique value in NDC ie/ > 1 NDC may have it and they may (though not always) go to different generics. Need to pick first NDC (order by IEN) with a tradename and use its generic o A generic's label may match a tradename exactly. Rather than use the path from NDC to generic, the algorithm jumps right to the generic in those cases. However to preserve order ie/ deliver results in order - we still need to lookup the first matching NDC (this is the epitome of following the path and not meaning of an algorithm!)

(in MUMPS: S K=$$TGTOG^PSNAPIS(I) from ORWDAL32.m. This uses the B index
of Generics to check for an exact match. If none is found, the trademark
index of NDC is used and the generic is taken from there)
... why not remove these entries all together as they will also appear in the Generic
list directly (as themselves). MUMPS doesn't, so we can't (in the legacyService)

Note that this matches NDC tradename and generic id ie/ unlike other matches, the label used for the id IS NOT the id's ... it is taken from a different collection.

Parameters:
Name Type Description
searchInput String

User's search text

callback function

the function that will process results from listSymptoms

Returns:

res - a sorted list of symptoms and synonyms

Type
Array

lookupCodingSystem(source, callback)

Retrieve a Coding System object.

Parameters:
Name Type Description
source String

Abbreviation of the source coding system under test.

callback function

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

Returns:

Coding System object 'sourceAbbreviation' {String} Abbreviated name of the coding system 'nomenclature' {String} Longer description 'implementationDate' {String} Implementation date in ISO format

Type
Object

lookupConcept(conceptId, callback)

Return a trimmed Concept record

Parameters:
Name Type Description
conceptId String

Concept urn

callback function

the function that will process results

Returns:

res - the trimmed Concept record

Type
Array

lookupDiagnosis(diagnosisCodeNumber, callback)

Return a trimmed IcdDiagnosis record

Parameters:
Name Type Description
diagnosisCodeNumber String

Diagnosis code number

callback function

the function that will process results

Returns:

res - the trimmed Diagnosis record

Type
Array

lookupProblems(search, options, callback)

Retrieve expression data entries associated with problems that match a particular search term.

Parameters:
Name Type Description
search String

Search term to use to find problems.

options Object

Search options:

Properties
Name Type Description
synonyms Boolean

(default = false) True to include synonym expressions, false for no synonyms

completion Boolean

(default = false) True to include regex backed completion mapping, false for exact matches

view String

(default = 'PLS') Coding system subset view to use for the search

date String

(default = "TODAY") Date to search

callback function

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

Returns:

The function will return an object with the following structure as the result of the callback: result.PRIMARY: An array of Expression objects that were found by a direct search term match against major concept listing. result.SECONDARY: An array of Expression objects that were found by mapping a synonym found via search terms, mapped back to the corresponding Major Concept

                   Expression Objects:
                       id: The national URN of the expression
                       label: The textual representation of the expression
                       snomedDesignationCode: SNOMED designation code
                       codes: Array of codes (from 757.02) associated with the expression
                         codes.code,
                         codes.activationDetails
                         codes.classificationSource
                       conceptUsage:
                         conceptUsage.originatingValue,
                         conceptUsage.frequency,
                       synonyms: Array of synonyms
                         synonyms.ien
                          synonyms.label
                         synonyms.snomedDesignationCode
Type
Object

lookupSymptoms(searchInput, direction, limit, callback)

Return a list of symptoms and synonyms within a range specified by the user's search text and direction

NOTE: ORWDAL32 SYMPTOMS status check does not affect results in RPC Runner, so we do not implement a status check in this implementation

Parameters:
Name Type Description
searchInput String

User's search text

direction Number

Sort direction (1 for normal, -1 for reverse)

limit Object

optional parameteres to set quantity and/or specifics of output

Properties
Name Type Description
quantity Number

the maximum number of symptoms to display, defaults to infinity

showExactMatch Boolean

if true, the output will include an exact match of the searchInput, otherwise it will be excluded. Defaults to false.

callback function

the function that will process results from listSymptoms

Returns:

res - a sorted list of symptoms and synonyms

Type
Array

lookupTermFrequency(text, callback)

Retrieve the maximum number of records that must be inspected during a Lexicon search to find matching entries for the input search text.

Parameters:
Name Type Description
text String

Text string intended as the input for a Lexicon search

callback function

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

Returns:

The maximum number of records that must be inspected during a Lexicon search to find matching entries for the input search text.

Type
Number

tokenize(searchTerm, options)

Tokenize a string-based search term set.

Parameters:
Name Type Description
searchTerm String

Search term to tokenize.

options Object

Tokenization options

Properties
Name Type Description
completion Boolean

(default = false) True to include regex backed completion mapping, false for exact matches

Returns:

List of items that can be used in a search for expressions, or null if there were no terms

Type
Array