Stores the generic drug names (GNNs) and narrative description for a
single version of a drug class definition. Each version is a distinct
object (e.g., spec_acei_v1, spec_acei_v2).
Active bindings
drug_classShort drug class identifier (read-only).
versionVersion label, e.g.
"v1"(read-only).labelHuman-readable drug class label (read-only).
Methods
DrugSpec$new()
Create a new DrugSpec.
Arguments
drug_classShort identifier string, e.g.
"acei".labelHuman-readable label.
defsCharacter string describing the drug class. May be
NULL.generic_namesCharacter vector of GNN drug names that are single-indication and aligned with, and FDA-approved for, this drug class's indication. Stored at
priority = 1(core).generic_names_probableCharacter vector of GNN drug names that have more than one indication (e.g., also FDA-approved, or widely used off-label, for a different condition) in addition to this drug class's indication. Stored at
priority = 2(probable).generic_names_cautiousCharacter vector of GNN drug names that are included in this drug class despite not having their expected indication approved in the US (e.g., approved for a related but distinct condition, or not marketed in the US at all). Stored at
priority = 3(cautious).brand_namesOptional named list mapping a GNN drug name (must appear in
generic_names,generic_names_probable, orgeneric_names_cautious) to one or more brand name strings, e.g.list(SEMAGLUTIDE = "Ozempic", "PAROXETINE MESYLATE" = c("Brisdelle", "Pexeva")). Generics with no entry get an empty brand vector. Stored as a list-column (brand) inget_generics()output, since a single generic can map to zero, one, or multiple brands. Ignored (and must be left empty) ifgeneric_defsis supplied.generic_defsOptional alternative to
generic_names/generic_names_probable/generic_names_cautious/brand_names, for drug classes whose generics don't all map to a single condition/indication context (e.g. a drug that's core for one condition but cautious for another). A data frame/tibble with required columnsgeneric(character) andpriority(integer,1/2/3), and optional columnscondition(character;NAif omitted, meaning "not condition-specific") andbrand(character;NAif omitted or unknown). The same generic may appear in multiple rows with differentpriority/conditioncombinations (e.g. finerenone at priority 1 for"ckd"and priority 3 for"hypertension"), and multiple brands for one(generic, priority, condition)combination are expressed as duplicate rows differing only inbrand:tibble::tribble( ~generic, ~priority, ~condition, ~brand, "FINERENONE", 1, "ckd", "Kerendia", "FINERENONE", 3, "hypertension", "Kerendia", "EPLERENONE", 2, "hypertension", "Inspra" )Cannot be combined with
generic_names/generic_names_probable/generic_names_cautious/brand_names.versionOptional version label string, e.g.
"v1".
DrugSpec$get_generics()
Retrieve generic (and brand) drug names as a tidy data frame.
Arguments
priorityInteger vector subsetting confidence tiers to include (
1= core,2= probable,3= cautious). Default1.conditionOptional character vector subsetting to specific condition(s) (only meaningful for specs built with
generic_defs; see DrugSpec$new()).NULL(default) applies no condition filtering. When supplied, rows with aconditionincondition, and rows withcondition = NA(not condition-specific), are both included.
Returns
A tibble with columns generic, brand (a list-column of
character vectors — character(0) when a generic has no known
brand, length 1+ otherwise), priority, condition (NA unless
the spec was built with generic_defs), class, and version. Use
tidyr::unnest(result, brand, keep_empty = TRUE) to get one row per
brand (this drops the generic entirely for a plain unnest() without
keep_empty = TRUE, since most generics have no brand on record).