CLAUDE.md

CLAUDE.md

This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.

Package Overview

ClinicoPath is a comprehensive jamovi module for clinicopathological research analysis. It provides statistical analysis tools specifically designed for pathology and clinical research, including survival analysis, decision analysis, descriptive statistics, and specialized plots.

Core Architecture

Jamovi Module Structure

This is a jamovi R module with a specific 4-file architecture pattern:

Key Backend Pattern

All analysis classes inherit from auto-generated base classes and use R6 class system:

crosstableClass <- R6::R6Class(
    "crosstableClass", 
    inherit = crosstableBase,  # Auto-generated from .yaml files
    private = list(
        .init = function() { ... },
        .run = function() { ... }
    )
)

Main Functional Areas

  1. ClinicoPath Descriptives: Summary statistics, Table One, cross tables, data checking
  2. ClinicoPath Survival: Survival analysis, Cox regression, Kaplan-Meier, competing risks
  3. meddecide: Medical decision analysis, ROC curves, sensitivity/specificity, diagnostic tests
  4. JJStatsPlot: Statistical plots using ggstatsplot wrappers
  5. Patient Follow-Up Plots: Swimmer plots, waterfall plots, treatment response visualization

Development Commands

Testing

# Run all tests
Rscript -e "devtools::test()"

# Run specific test file
Rscript -e "testthat::test_file('tests/testthat/test-roc.R')"

Building and Checking

# Check package
Rscript -e "devtools::check()"

# Build package
Rscript -e "devtools::build()"

# Install development version
Rscript -e "devtools::install()"

Jamovi Module Development

# Build jamovi module (.jmo file)
# This requires jamovi development tools
Rscript -e "jmvtools::prepare()"
Rscript -e "devtools::document()"
Rscript -e "jmvtools::install()"

# Install module in jamovi for testing
# Copy .jmo file to jamovi modules directory

Key Dependencies and Patterns

Core Dependencies

Data Processing Pattern

Most modules follow this pattern:

  1. Clean variable names with janitor::clean_names()
  2. Set variable labels with labelled::set_variable_labels()
  3. Build formulas dynamically based on user inputs
  4. Apply appropriate statistical tests
  5. Format results for display

Output Types

Module Categories by Menu Structure

Exploration Menu

Survival Menu

meddecide Menu

JJStatsPlot Menu

Common Development Tasks

Adding New Analysis Module

  1. Create 4 jamovi files: .a.yaml, .u.yaml, .r.yaml, .b.R
  2. Add entry to jamovi/0000.yaml
  3. Implement R6 class inheriting from auto-generated base
  4. Add to appropriate menu group/subgroup

Testing Strategy

Documentation

File Structure Notes



sbalci/ClinicoPathJamoviModule documentation built on June 13, 2025, 9:34 a.m.