Skip to contents

peridefs 0.3.2

New features

  • Every get_*_codes() result now has a fifth column, definition, with a text description of each code (NA when none is available). Composite results (e.g. get_ascvd_codes()) place class after definition. Definitions are looked up at build time and stored in the spec objects, so there are no runtime lookups. Sources: CMS FY2026 files (ICD-10-CM, ICD-10-PCS), CMS v32 files (ICD-9-CM diagnoses and procedures), and the NLM Clinical Tables API (HCPCS Level II). CPT descriptions are paraphrased, not AMA text.
  • CodeSpec keeps an optional definitions vector parallel to codes; add_codes() pads it with NA and remove_codes() subsets it.
  • Direct access to the ASCVD components: get_chd_v1_codes(), get_stroke_v1_codes(), get_lead_pad_v1_codes(), get_cerebrovasc_disease_v1_codes(), and the matching *_defs() functions. These wrap get_ascvd_codes()/get_ascvd_defs() with component fixed.
  • CompositeCodeSpec$new() gains components_by_variable_type, which sets different default components for the condition and outcome definitions.

Behavior changes

  • get_ascvd_codes() and get_ascvd_defs() no longer return every component by default. The condition definition uses CHD + cerebrovascular disease + LEAD/PAD, and the outcome definition uses CHD + stroke + LEAD/PAD. Pass component explicitly to override this.
  • Obesity (spec_obesity_v1) now uses a strict BMI >= 30 definition. Excluded ICD-10 E66.1, E66.3, R93.9, and Z68.25-Z68.29. Added ICD-9 codes (excluding 278.02 and V85.21-V85.25). The same code sets apply to both condition and outcome definitions.
  • CHD: removed 33515 (not a valid CPT code) from the HCPCS list; the range is now 33510-33514 and 33516-33519.
  • Definition-book text now says “outpatient physician” claim/visit instead of “evaluation and management”.

Known gaps

  • No definition for F3331, the retired ICD-9 procedure codes (360, 3601, 3602, 3605, 3608, 3618), or retired HCPCS G0290/G0291.

peridefs 0.3.1

Breaking changes

  • Split the unified diabetes spec into separate Type 1 and Type 2 objects (no deprecated aliases kept):

    • spec_diabetes_v1 → spec_diabetes_type1_v1, spec_diabetes_type2_v1
    • spec_diabetes → spec_diabetes_type1, spec_diabetes_type2
    • get_diabetes_v1_codes/defs() → get_diabetes_type1/type2_v1_codes/defs()
    • get_diabetes_generics/meds_labels() → get_diabetes_type1/type2_generics/meds_labels()
  • spec_glp1_v1 condition tags updated from "diabetes" to "diabetes_type2".

  • Renamed all condition- and drug-related objects/functions built around hypertension and hyperlipidemia so they use the full condition name everywhere, instead of mixing an abbreviation (htn) with a drug-mechanism name (lipid_lowering) on one side and full condition names on the other:

    • spec_htn_v1 -> spec_hypertension_v1; get_htn_v1_codes() -> get_hypertension_v1_codes(); get_htn_v1_defs() -> get_hypertension_v1_defs(). The CodeSpec’s own condition identifier also changed from "htn" to "hypertension".
    • The five composite CompositeDrugSpec objects are now named after the condition they treat rather than the drug mechanism class: spec_antihypertensive -> spec_hypertension, spec_antidiabetic -> spec_diabetes, spec_antiobesity -> spec_obesity, spec_antidepressive -> spec_depression, spec_lipid_lowering -> spec_hyperlipidemia – along with their get_*_generics()/ get_*_defs() accessor pairs (e.g. get_antihypertensive_generics() -> get_hypertension_generics(); get_antihypertensive_defs() similarly became get_hypertension_meds_labels(), see below). Each object’s drug_class field (e.g. "antihypertensive") is unchanged – it remains a distinct, drug-mechanism-based identifier, separate from condition.
  • CompositeDrugSpec$get_defs() was replaced by CompositeDrugSpec$get_meds_labels(), and the five corresponding exported wrapper functions were renamed to match: get_hypertension_defs() -> get_hypertension_meds_labels(), get_diabetes_defs() -> get_diabetes_meds_labels(), get_obesity_defs() -> get_obesity_meds_labels(), get_depression_defs() -> get_depression_meds_labels(), get_hyperlipidemia_defs() -> get_hyperlipidemia_meds_labels(). These now return a tibble with columns name (the component key, e.g. "acei_v1") and label (e.g. "ACE Inhibitors") instead of a bare character vector/string, and no longer include version information in the output (already encoded in name). A drug leaf’s defs field is typically just an internal sourcing note (e.g. "From the Perisphere antihypertensive medication list."), not a clinical definition, and naming the composite accessor after the condition made it too easy to confuse with the condition side’s get_*_v1_defs(), which does return a real diagnostic-algorithm narrative — hence the move away from a _defs()-style name entirely. get_defs() (the general low-level dispatcher) still works on a CompositeDrugSpec, now returning this same tibble.

  • The class column of get_*_generics() for the diabetes and hyperlipidemia composites no longer redundantly encodes the condition (e.g. "antidiab_biguanide", "ll_statin"); it’s now just the unprefixed drug-mechanism class ("biguanide", "statin"), matching the convention already used by the hypertension, obesity, and depression composites. The composite’s own condition column/field already supplies the condition context, so repeating it in class was redundant. This only changes the leaf DrugSpec’s drug_class identifier (and therefore the class output column) — the underlying R object variable names in data-raw/build_specs.R (e.g. spec_antidiab_biguanide_v1, spec_ll_statin_v1) are unchanged.

ICD code changes

  • ICD-9 250.xx codes split by 5th digit (1/3 → Type 1; 0/2 → Type 2). Non-type-specific complication codes (357.2, 362.0x, 366.41) placed in Type 2 per convention.
  • ICD-10: E10.xx → Type 1; E11.xx + E08/E09/E13 → Type 2 per convention.
  • Ophthalmic codes (E10.3xx, E11.3xx) now dynamically expanded via children() to capture all FY2020+ laterality-specific retinopathy codes. Fixes a pre-existing omission of E11.37X1/X3/X9, removes 4 non-billable E11 codes, and adds missing neuropathy, angiopathy, and nephropathy subtypes to both specs.

peridefs 0.3.0

Breaking changes

  • Collapsed the hypertension, coronary heart disease (CHD), depression, and diabetes specs down to a single version each (issue #4). Previously, these specs had multiple versions (e.g., spec_htn_v1/spec_htn_v2) that shared identical codes and differed only in the narrative defs text (e.g., whether a medication criterion was included); the remaining single version of each now carries the most complete (formerly highest-numbered) narrative. As a result, the following exported functions and package data objects have been removed: get_htn_v2_codes(), get_htn_v2_defs(), spec_htn_v2; get_depression_v2_codes(), get_depression_v2_defs(), spec_depression_v2; get_diabetes_v2_codes(), get_diabetes_v2_defs(), get_diabetes_v3_codes(), get_diabetes_v3_defs(), spec_diabetes_v2, spec_diabetes_v3; and the spec_ascvd composite no longer has a "chd_v2" component (only "chd_v1", now carrying the merged definition). Use get_htn_v1_codes(), get_depression_v1_codes(), and get_diabetes_v1_codes() (and their _defs() counterparts) going forward — they now return the most current definition.

  • CodeSpec$get_codes()/CompositeCodeSpec$get_codes() output (and therefore get_ascvd_codes() and similar composite accessors) no longer duplicates the version number inside the class column. class is now the component’s own unversioned condition identifier (e.g., "chd"), while version continues to hold the version tag (e.g., "v1") separately — previously class held the full versioned component key (e.g., "chd_v1"), which duplicated information already present in version. Any downstream code filtering on class == "chd_v1"-style values needs to filter on class == "chd" and version == "v1" instead.

peridefs 0.2.0

  • Added concatenate argument (default FALSE) to all get_*_codes() functions. When TRUE, all code vectors are collapsed into a single unnamed character vector instead of a named list. Errors informatively if combined with format = "tibble".

  • get_*_codes(variable_type = "outcome") now falls back to condition codes for specs that have no outcome definition, rather than returning empty code sets.

  • Added depression (history) specs: spec_depression_v1 (diagnosis only) and spec_depression_v2 (diagnosis or antidepressive medication), with accessor functions get_depression_v1_codes(), get_depression_v2_codes(), and corresponding _defs() variants.

  • Exported spec_antidepressive_v1 as a standalone spec with accessor functions get_antidepressive_v1_generics(), get_antidepressive_v1_codes(), and get_antidepressive_v1_defs().

  • Added spec_antiobesity, a composite drug spec ([CompositeDrugSpec]) combining non_glp1_v1 (naltrexone/bupropion, orlistat) and glp1_v1 (exenatide, dulaglutide, semaglutide, liraglutide, tirzepatide) components, with accessor functions get_antiobesity_generics(), get_antiobesity_codes(), and get_antiobesity_defs().

  • Added asthma spec spec_asthma_v1 (ICD-9 493.xx, ICD-10 J45.xx; 20 and 26 codes respectively), with accessor functions get_asthma_v1_codes() and get_asthma_v1_defs().

  • Added obesity hypoventilation syndrome spec spec_ohs_v1 (ICD-9 278.03, ICD-10 E66.2; also covers Pickwickian syndrome), with accessor functions get_ohs_v1_codes() and get_ohs_v1_defs().

  • All composite spec getter functions (get_*_codes(), get_*_generics(), get_*_codes() for drug specs) now accept a vector of component names to retrieve and union multiple components in one call (e.g., get_ascvd_codes(component = c("chd_v1", "stroke_v1"))). Errors informatively if any component name is invalid.

  • get_*_generics() and get_*_codes() for drug specs now return a named list by default (keyed by component name), consistent with the behaviour of get_*_codes() for condition specs. Pass concatenate = TRUE to flatten to an unnamed character vector (the previous default behaviour).

  • component is no longer a visible parameter on getter functions for non-composite specs; it only appears in the signature of getters that actually require it.

peridefs 0.1.0

  • Initial development version.