build-internal: Internal functions for buildDose process

build-internalR Documentation

Internal functions for buildDose process

Description

These internal functions aid the buildDose function and process.

Details

tstrsplit2: a wrapper for the tstrsplit function in data.table with some additional formatting

convert: formats final results that are returned in buildDose, including separating the extracted expression from its start and stop position

entVal: isolates the extracted expression from a string of the format "extracted expression::start position::stop position"

entStart: isolates the start position from a string of the format "extracted expression::start position::stop position"

entStop: isolates the stop position from a string of the format "extracted expression::start position::stop position"

remainder: performs some formatting for paths containing NA values

getCombosIx: forms the individual paths within the getPaths function

getPaths: builds paths from entity pairings using other helper function getCombosIx

getOpt: takes in the possible paths as well as the cost computations from getCosts, combines costs at the path level using the helper functions remainder and getPaths, and returns the path with the minimum cost

getCosts: computes the distance for each path based on the distance method specified in buildDose

findOptPath: uses the helper functions getCosts and getOpt to determine the optimal path based on the selected distance method

stdRoute: standardize the "route" entity. This function is also used in the collapseDose function and process.

grp: groups drug entities based on a particular anchor point (e.g. strength or dose)

anchorByStrength: forms subgroups of entities by anchoring to strength. This is done within existing groups which are anchored by drug name

combineGroups: determines how to form groups of the entities based on the complexity of the extraction (i.e., number of extractions for each entity)

makeCombos: takes all extracted entities and puts them into groups based on position and minimum cost of paths. This is the highest level function within buildDose; it calls other helper functions including combineGroups and anchorByStrength.

findRareValues: find rare values for each column in a data.frame; rare defaults to less than two percent.


EHR documentation built on Dec. 28, 2022, 1:31 a.m.