Skip to contents

Introduction to Study Flowcharts

The flowchart function in ClinicoPath provides a powerful tool for creating visual representations of study workflows, clinical pathways, and research processes. Unlike CONSORT diagrams which are specifically designed for randomized controlled trials, the flowchart function offers flexibility for various types of studies and processes.

Key Features

  • Flexible Design: Adaptable to any type of study or process flow
  • Multiple Layouts: Support for top-to-bottom and left-to-right orientations
  • Customizable Styling: Various color schemes, node sizes, and typography options
  • Statistical Display: Automatic calculation of percentages and exclusion numbers
  • Professional Output: Publication-ready diagrams with comprehensive summaries

When to Use Flowcharts

Flowcharts are essential for:

  • Observational Studies: Cohort and case-control study participant flow
  • Diagnostic Studies: Patient journey through diagnostic processes
  • Laboratory Workflows: Sample processing and quality control steps
  • Research Pipelines: Multi-stage research methodology documentation
  • Clinical Pathways: Patient care pathway visualization
  • Biomarker Studies: Sample collection to final analysis workflow

Package Setup and Data Loading

## Warning: replacing previous import 'dplyr::as_data_frame' by
## 'igraph::as_data_frame' when loading 'ClinicoPath'
## Warning: replacing previous import 'DiagrammeR::count_automorphisms' by
## 'igraph::count_automorphisms' when loading 'ClinicoPath'
## Warning: replacing previous import 'dplyr::groups' by 'igraph::groups' when
## loading 'ClinicoPath'
## Warning: replacing previous import 'DiagrammeR::get_edge_ids' by
## 'igraph::get_edge_ids' when loading 'ClinicoPath'
## Warning: replacing previous import 'dplyr::union' by 'igraph::union' when
## loading 'ClinicoPath'
## Warning: replacing previous import 'dplyr::select' by 'jmvcore::select' when
## loading 'ClinicoPath'
## Warning: replacing previous import 'igraph::union' by 'lubridate::union' when
## loading 'ClinicoPath'
## Warning: replacing previous import 'igraph::%--%' by 'lubridate::%--%' when
## loading 'ClinicoPath'
## Warning: replacing previous import 'cutpointr::tnr' by 'mlr3measures::tnr' when
## loading 'ClinicoPath'
## Warning: replacing previous import 'cutpointr::precision' by
## 'mlr3measures::precision' when loading 'ClinicoPath'
## Warning: replacing previous import 'cutpointr::tn' by 'mlr3measures::tn' when
## loading 'ClinicoPath'
## Warning: replacing previous import 'cutpointr::fnr' by 'mlr3measures::fnr' when
## loading 'ClinicoPath'
## Warning: replacing previous import 'cutpointr::tp' by 'mlr3measures::tp' when
## loading 'ClinicoPath'
## Warning: replacing previous import 'cutpointr::npv' by 'mlr3measures::npv' when
## loading 'ClinicoPath'
## Warning: replacing previous import 'cutpointr::ppv' by 'mlr3measures::ppv' when
## loading 'ClinicoPath'
## Warning: replacing previous import 'cutpointr::auc' by 'mlr3measures::auc' when
## loading 'ClinicoPath'
## Warning: replacing previous import 'cutpointr::tpr' by 'mlr3measures::tpr' when
## loading 'ClinicoPath'
## Warning: replacing previous import 'cutpointr::fn' by 'mlr3measures::fn' when
## loading 'ClinicoPath'
## Warning: replacing previous import 'cutpointr::fp' by 'mlr3measures::fp' when
## loading 'ClinicoPath'
## Warning: replacing previous import 'cutpointr::fpr' by 'mlr3measures::fpr' when
## loading 'ClinicoPath'
## Warning: replacing previous import 'cutpointr::recall' by
## 'mlr3measures::recall' when loading 'ClinicoPath'
## Warning: replacing previous import 'cutpointr::specificity' by
## 'mlr3measures::specificity' when loading 'ClinicoPath'
## Warning: replacing previous import 'cutpointr::sensitivity' by
## 'mlr3measures::sensitivity' when loading 'ClinicoPath'
## Warning: replacing previous import 'igraph::as_data_frame' by
## 'tibble::as_data_frame' when loading 'ClinicoPath'
## Warning: replacing previous import 'igraph::crossing' by 'tidyr::crossing' when
## loading 'ClinicoPath'
## Warning: replacing previous import 'magrittr::extract' by 'tidyr::extract' when
## loading 'ClinicoPath'
## Warning: replacing previous import 'mlr3measures::sensitivity' by
## 'caret::sensitivity' when loading 'ClinicoPath'
## Warning: replacing previous import 'mlr3measures::specificity' by
## 'caret::specificity' when loading 'ClinicoPath'
## Registered S3 methods overwritten by 'useful':
##   method         from     
##   autoplot.acf   ggfortify
##   fortify.acf    ggfortify
##   fortify.kmeans ggfortify
##   fortify.ts     ggfortify
## Warning: replacing previous import 'jmvcore::select' by 'dplyr::select' when
## loading 'ClinicoPath'
## Registered S3 methods overwritten by 'ggpp':
##   method                  from   
##   heightDetails.titleGrob ggplot2
##   widthDetails.titleGrob  ggplot2
## Warning: replacing previous import 'DataExplorer::plot_histogram' by
## 'grafify::plot_histogram' when loading 'ClinicoPath'
## Warning: replacing previous import 'dplyr::select' by 'jmvcore::select' when
## loading 'ClinicoPath'
## Warning: replacing previous import 'mlr3measures::auc' by 'pROC::auc' when
## loading 'ClinicoPath'
## Warning: replacing previous import 'cutpointr::roc' by 'pROC::roc' when loading
## 'ClinicoPath'
## Warning: replacing previous import 'tibble::view' by 'summarytools::view' when
## loading 'ClinicoPath'
## 
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
## 
##     filter, lag
## The following objects are masked from 'package:base':
## 
##     intersect, setdiff, setequal, union
library(knitr)

# Load comprehensive flowchart test datasets
data("clinical_trial_flow")
data("cancer_pathway_flow")
data("biomarker_discovery_flow")
data("multiarm_trial_flow")
data("diagnostic_validation_flow")
data("epidemiology_study_flow")
data("lab_workflow_flow")
data("minimal_flow")
data("research_pipeline_flow")
data("patient_journey_flow")
data("flowchart_comprehensive_data")

Basic Flowchart Creation

Simple Clinical Trial Flow

Let’s start with a basic clinical trial flowchart:

# Display the clinical trial data structure
knitr::kable(clinical_trial_flow, 
             caption = "Basic Clinical Trial Flow Data")

# Create a basic flowchart
basic_flowchart <- flowchart(
  data = clinical_trial_flow,
  nodes = c("step1", "step2", "step3", "step4", "step5"),
  counts = c("count1", "count2", "count3", "count4", "count5"),
  direction = "TB",
  nodeWidth = 2.5,
  nodeHeight = 1,
  fontSize = 10,
  showPercentages = TRUE,
  showExclusions = TRUE,
  nodeColor = "blue",
  includeTitle = TRUE
)

This creates a flowchart showing: - Step 1: 1,500 patients assessed for eligibility - Step 2: 1,200 patients randomized (80% of assessed) - Step 3-4: Equal allocation to treatment arms (600 each) - Step 5: 1,050 patients completed the study (87.5% retention)

Cancer Treatment Pathway

# Display cancer pathway data
knitr::kable(cancer_pathway_flow,
             caption = "Cancer Treatment Pathway Flow Data")

# Create cancer pathway flowchart with horizontal layout
cancer_flowchart <- flowchart(
  data = cancer_pathway_flow,
  nodes = c("node1", "node2", "node3", "node4", "node5", "node6"),
  counts = c("n1", "n2", "n3", "n4", "n5", "n6"),
  direction = "LR",  # Left-to-right layout
  nodeWidth = 3,
  nodeHeight = 1.5,
  fontSize = 12,
  showPercentages = TRUE,
  showExclusions = TRUE,
  nodeColor = "green",
  includeTitle = TRUE
)

This pathway demonstrates: - Initial Diagnosis: 800 patients - Staging Complete: 750 patients (93.8% completion) - Treatment Started: 720 patients (96% of staged patients) - Response Assessment: 680 patients (94.4% had assessment) - Protocol Completion: 620 patients (91.2% completion rate) - Long-term Follow-up: 580 patients (93.5% follow-up rate)

Advanced Flowchart Features

Biomarker Discovery Study

# Display biomarker discovery data
knitr::kable(biomarker_discovery_flow,
             caption = "Biomarker Discovery Study Flow")

# Create flowchart with different variable structure
biomarker_flowchart <- flowchart(
  data = biomarker_discovery_flow,
  nodes = rep("stage_label", 6),
  counts = rep("participant_count", 6),
  direction = "TB",
  nodeWidth = 3.5,
  nodeHeight = 1.2,
  fontSize = 11,
  showPercentages = TRUE,
  showExclusions = FALSE,  # Don't show exclusions for this type
  nodeColor = "gray",
  includeTitle = TRUE
)

Multi-arm Clinical Trial

# Display multi-arm trial structure
knitr::kable(multiarm_trial_flow,
             caption = "Multi-arm Clinical Trial Design")

# Create complex multi-arm flowchart
multiarm_flowchart <- flowchart(
  data = multiarm_trial_flow,
  nodes = c("phase1", "phase2", "phase3", "phase4", "phase5", "phase6", "phase7"),
  counts = c("phase1_n", "phase2_n", "phase3_n", "phase4_n", "phase5_n", "phase6_n", "phase7_n"),
  direction = "TB",
  nodeWidth = 2.8,
  nodeHeight = 1.1,
  fontSize = 10,
  showPercentages = TRUE,
  showExclusions = TRUE,
  nodeColor = "blue",
  includeTitle = TRUE
)

This demonstrates a 4-arm trial with: - Screening: 2,000 patients screened - Eligibility: 1,600 patients eligible (80% eligibility rate) - Randomization: 1,500 patients randomized (93.8% randomization rate) - Equal Allocation: 375 patients per arm (4 arms total)

Specialized Applications

Diagnostic Test Validation Flow

# Display diagnostic validation data
knitr::kable(diagnostic_validation_flow,
             caption = "Diagnostic Test Validation Process")

# Create diagnostic workflow flowchart
diagnostic_flowchart <- flowchart(
  data = diagnostic_validation_flow,
  nodes = rep("step_description", 6),
  counts = rep("case_numbers", 6),
  direction = "LR",
  nodeWidth = 3.2,
  nodeHeight = 1.3,
  fontSize = 11,
  showPercentages = TRUE,
  showExclusions = TRUE,
  nodeColor = "green",
  includeTitle = TRUE
)

Laboratory Workflow

# Display laboratory workflow data
knitr::kable(lab_workflow_flow,
             caption = "Laboratory Sample Processing Workflow")

# Create lab workflow flowchart
lab_flowchart <- flowchart(
  data = lab_workflow_flow,
  nodes = rep("process_step", 6),
  counts = rep("sample_count", 6),
  direction = "TB",
  nodeWidth = 2.8,
  nodeHeight = 1,
  fontSize = 10,
  showPercentages = FALSE,  # Not as relevant for lab processes
  showExclusions = TRUE,
  nodeColor = "gray",
  includeTitle = FALSE
)

Large-Scale Epidemiological Study

# Display epidemiology study data
knitr::kable(epidemiology_study_flow,
             caption = "Large-Scale Epidemiological Cohort Study")

# Create large cohort flowchart
epidemiology_flowchart <- flowchart(
  data = epidemiology_study_flow,
  nodes = rep("cohort_stage", 7),
  counts = rep("cohort_size", 7),
  direction = "TB",
  nodeWidth = 4,
  nodeHeight = 1.2,
  fontSize = 12,
  showPercentages = TRUE,
  showExclusions = TRUE,
  nodeColor = "blue",
  includeTitle = TRUE
)

This large-scale study shows: - Initial Population: 50,000 individuals identified - Contact Success: 35,000 contacted (70% contact rate) - Baseline Participation: 28,000 enrolled (80% participation rate) - Long-term Retention: 21,500 at final analysis (76.8% retention over 5 years)

Customization Options

Layout Directions

# Top-to-bottom layout (default)
tb_flowchart <- flowchart(
  data = minimal_flow,
  nodes = c("node_a", "node_b"),
  counts = c("count_a", "count_b"),
  direction = "TB",
  nodeColor = "blue"
)

# Left-to-right layout
lr_flowchart <- flowchart(
  data = minimal_flow,
  nodes = c("node_a", "node_b"),
  counts = c("count_a", "count_b"),
  direction = "LR",
  nodeColor = "blue"
)

Color Schemes

# Test different color schemes with the same data
test_data <- minimal_flow

# Blue (Clinical) - professional medical appearance
blue_flowchart <- flowchart(
  data = test_data,
  nodes = c("node_a", "node_b"),
  counts = c("count_a", "count_b"),
  nodeColor = "blue"
)

# Gray (Professional) - neutral, formal appearance
gray_flowchart <- flowchart(
  data = test_data,
  nodes = c("node_a", "node_b"),
  counts = c("count_a", "count_b"),
  nodeColor = "gray"
)

# Green (Success) - positive, progress-oriented appearance
green_flowchart <- flowchart(
  data = test_data,
  nodes = c("node_a", "node_b"),
  counts = c("count_a", "count_b"),
  nodeColor = "green"
)

Node Sizing and Typography

# Small, compact nodes
compact_flowchart <- flowchart(
  data = clinical_trial_flow,
  nodes = c("step1", "step2", "step3"),
  counts = c("count1", "count2", "count3"),
  nodeWidth = 2,
  nodeHeight = 0.8,
  fontSize = 8
)

# Large, prominent nodes
prominent_flowchart <- flowchart(
  data = clinical_trial_flow,
  nodes = c("step1", "step2", "step3"),
  counts = c("count1", "count2", "count3"),
  nodeWidth = 4,
  nodeHeight = 1.8,
  fontSize = 14
)

Display Options

# Minimal display (no percentages, exclusions, or title)
minimal_display <- flowchart(
  data = clinical_trial_flow,
  nodes = c("step1", "step2", "step3"),
  counts = c("count1", "count2", "count3"),
  showPercentages = FALSE,
  showExclusions = FALSE,
  includeTitle = FALSE
)

# Full display (all options enabled)
full_display <- flowchart(
  data = clinical_trial_flow,
  nodes = c("step1", "step2", "step3"),
  counts = c("count1", "count2", "count3"),
  showPercentages = TRUE,
  showExclusions = TRUE,
  includeTitle = TRUE
)

Real-World Research Applications

Research Pipeline Workflow

# Display research pipeline data
knitr::kable(research_pipeline_flow,
             caption = "Complete Research Pipeline from Concept to Publication")

# Create comprehensive research pipeline flowchart
research_flowchart <- flowchart(
  data = research_pipeline_flow,
  nodes = rep("pipeline_step", 9),
  counts = rep("milestone_count", 9),
  direction = "TB",
  nodeWidth = 3.5,
  nodeHeight = 1.2,
  fontSize = 11,
  showPercentages = TRUE,
  showExclusions = TRUE,
  nodeColor = "gray",
  includeTitle = TRUE
)

This workflow shows the complete research journey: - Literature Review: 150 studies initially reviewed - Study Design: 120 studies met design criteria - Ethics Approval: 100 studies received approval - Data Collection: 90 studies completed data collection - Manuscript Preparation: 80 studies reached publication stage

Patient Journey Analysis

# Display patient journey data
knitr::kable(patient_journey_flow,
             caption = "Real-World Patient Journey Through Healthcare System")

# Create patient journey flowchart
journey_flowchart <- flowchart(
  data = patient_journey_flow,
  nodes = rep("journey_point", 6),
  counts = rep("patient_numbers", 6),
  direction = "LR",
  nodeWidth = 3.2,
  nodeHeight = 1.4,
  fontSize = 11,
  showPercentages = TRUE,
  showExclusions = TRUE,
  nodeColor = "green",
  includeTitle = TRUE
)

This real-world evidence study tracks: - Initial Contact: 3,000 patients with first hospital visit - Diagnostic Phase: 2,800 patients completed diagnostic workup - Treatment Decision: 2,600 patients reached treatment decision - Treatment Implementation: 2,400 patients initiated treatment - Ongoing Care: 2,000 patients in long-term follow-up

Comprehensive Dataset Analysis

Multi-Study Comparison

# Display the comprehensive dataset structure
knitr::kable(flowchart_comprehensive_data,
             caption = "Comprehensive Dataset with Multiple Study Types")

# Analyze each study type separately
study_types <- unique(flowchart_comprehensive_data$flow_type)

for(study_type in study_types) {
  cat("\n### ", study_type, " Analysis\n")
  
  # Subset data for this study type
  subset_data <- flowchart_comprehensive_data[
    flowchart_comprehensive_data$flow_type == study_type, 
  ]
  
  # Calculate retention rates
  initial_n <- subset_data$count1[1]
  final_n <- subset_data$count5[1]
  retention_rate <- round((final_n / initial_n) * 100, 1)
  
  cat("Initial participants:", initial_n, "\n")
  cat("Final participants:", final_n, "\n")
  cat("Overall retention rate:", retention_rate, "%\n")
  
  # Create flowchart for this study type
  study_flowchart <- flowchart(
    data = subset_data,
    nodes = c("step1", "step2", "step3", "step4", "step5"),
    counts = c("count1", "count2", "count3", "count4", "count5"),
    direction = "TB",
    showPercentages = TRUE,
    includeTitle = TRUE,
    nodeColor = ifelse(study_type == "Clinical Trial", "blue",
                      ifelse(study_type == "Cancer Pathway", "green", "gray"))
  )
}

Statistical Interpretation

Flow Statistics and Quality Metrics

# Calculate key statistics from flowchart data
calculate_flow_stats <- function(data, count_vars) {
  counts <- data[count_vars]
  
  # Basic statistics
  initial_n <- counts[1, 1]
  final_n <- counts[1, ncol(counts)]
  max_n <- max(counts, na.rm = TRUE)
  min_n <- min(counts, na.rm = TRUE)
  
  # Flow metrics
  overall_retention <- (final_n / initial_n) * 100
  completion_rate <- (final_n / max_n) * 100
  
  # Loss patterns
  step_losses <- c()
  for(i in 1:(ncol(counts)-1)) {
    loss <- counts[1, i] - counts[1, i+1]
    step_losses <- c(step_losses, loss)
  }
  
  return(list(
    initial_n = initial_n,
    final_n = final_n,
    overall_retention = round(overall_retention, 1),
    completion_rate = round(completion_rate, 1),
    step_losses = step_losses,
    max_loss_step = which.max(step_losses)
  ))
}

# Example: Analyze clinical trial flow
ct_stats <- calculate_flow_stats(
  clinical_trial_flow, 
  c("count1", "count2", "count3", "count4", "count5")
)

cat("Clinical Trial Flow Analysis:\n")
cat("Initial participants:", ct_stats$initial_n, "\n")
cat("Final participants:", ct_stats$final_n, "\n")
cat("Overall retention:", ct_stats$overall_retention, "%\n")
cat("Completion rate:", ct_stats$completion_rate, "%\n")
cat("Largest loss at step:", ct_stats$max_loss_step, "\n")

Quality Assessment Criteria

# Define quality benchmarks for different study types
assess_flow_quality <- function(retention_rate, study_type) {
  if(study_type == "Clinical Trial") {
    if(retention_rate >= 85) return("Excellent")
    if(retention_rate >= 75) return("Good")
    if(retention_rate >= 65) return("Acceptable")
    return("Poor")
  } else if(study_type == "Epidemiology") {
    if(retention_rate >= 70) return("Excellent")
    if(retention_rate >= 60) return("Good")
    if(retention_rate >= 50) return("Acceptable")
    return("Poor")
  } else {
    if(retention_rate >= 80) return("Excellent")
    if(retention_rate >= 70) return("Good")
    if(retention_rate >= 60) return("Acceptable")
    return("Poor")
  }
}

# Assess different study flows
studies_assessment <- data.frame(
  Study = c("Clinical Trial", "Cancer Pathway", "Biomarker Discovery"),
  Initial_N = c(1500, 800, 2500),
  Final_N = c(1050, 580, 1800),
  Retention_Rate = c(70, 72.5, 72),
  Quality = c(
    assess_flow_quality(70, "Clinical Trial"),
    assess_flow_quality(72.5, "Cancer Pathway"),
    assess_flow_quality(72, "Biomarker Discovery")
  )
)

knitr::kable(studies_assessment,
             caption = "Flow Quality Assessment Across Study Types",
             digits = 1)

Integration with jamovi

Using Flowcharts in jamovi

The flowchart function integrates seamlessly with jamovi:

  1. Open jamovi and load your dataset
  2. Navigate to Exploration → ClinicoPath Reports → Study Flowchart
  3. Configure your flowchart:
    • Select node data variables (step descriptions)
    • Select count variables (participant numbers)
    • Choose layout direction (TB or LR)
    • Customize appearance options
  4. Review outputs:
    • Node Data Summary table
    • Visual flowchart diagram
    • Interactive customization options

Data Preparation for jamovi

# Example of preparing data for jamovi flowchart
jamovi_ready_data <- data.frame(
  study_step_1 = "Patients Screened",
  participants_1 = 2000,
  study_step_2 = "Eligible Patients", 
  participants_2 = 1600,
  study_step_3 = "Consented Patients",
  participants_3 = 1400,
  study_step_4 = "Randomized Patients",
  participants_4 = 1350,
  study_step_5 = "Completed Follow-up",
  participants_5 = 1200
)

knitr::kable(jamovi_ready_data,
             caption = "Data Structure Ready for jamovi Flowchart Analysis")

Best Practices and Guidelines

Data Structure Requirements

  1. Node Variables: Should contain descriptive text for each step
  2. Count Variables: Must be numeric values representing participant/sample numbers
  3. Logical Flow: Counts should generally decrease or remain stable across steps
  4. Consistent Naming: Use systematic variable naming for easier analysis

Visual Design Principles

  1. Direction Choice:
    • Use TB (Top-to-Bottom) for: Sequential processes, clinical workflows
    • Use LR (Left-to-Right) for: Timeline-based studies, pathway analysis
  2. Color Selection:
    • Blue: Medical/clinical studies, professional presentations
    • Gray: Technical processes, methodology documentation
    • Green: Success-oriented flows, positive outcomes
  3. Node Sizing:
    • Small nodes: When space is limited, multiple flowcharts on one page
    • Large nodes: For presentation slides, standalone diagrams

Common Pitfalls to Avoid

  1. Inconsistent Counting: Ensure counts are logical across steps
  2. Too Many Steps: Limit to 7-9 steps for clarity
  3. Poor Labels: Use clear, concise step descriptions
  4. Missing Context: Always include titles and explanatory text

Troubleshooting Common Issues

Data Validation

# Function to validate flowchart data
validate_flowchart_data <- function(data, node_vars, count_vars) {
  errors <- c()
  
  # Check variable existence
  missing_nodes <- node_vars[!node_vars %in% names(data)]
  missing_counts <- count_vars[!count_vars %in% names(data)]
  
  if(length(missing_nodes) > 0) {
    errors <- c(errors, paste("Missing node variables:", paste(missing_nodes, collapse = ", ")))
  }
  
  if(length(missing_counts) > 0) {
    errors <- c(errors, paste("Missing count variables:", paste(missing_counts, collapse = ", ")))
  }
  
  # Check variable count match
  if(length(node_vars) != length(count_vars)) {
    errors <- c(errors, "Number of node variables must match number of count variables")
  }
  
  # Check for numeric counts
  for(count_var in count_vars[count_vars %in% names(data)]) {
    if(!is.numeric(data[[count_var]])) {
      errors <- c(errors, paste("Count variable", count_var, "must be numeric"))
    }
  }
  
  return(errors)
}

# Example validation
validation_result <- validate_flowchart_data(
  clinical_trial_flow,
  c("step1", "step2", "step3"),
  c("count1", "count2", "count3")
)

if(length(validation_result) == 0) {
  cat("✓ Data validation passed successfully\n")
} else {
  cat("✗ Data validation errors:\n")
  for(error in validation_result) {
    cat("  -", error, "\n")
  }
}

Edge Cases and Solutions

# Test various edge cases
edge_cases <- list(
  # Case 1: Single step
  single_step = data.frame(
    step = "Only Step",
    count = 100
  ),
  
  # Case 2: Zero participants
  zero_participants = data.frame(
    step = "Empty Study",
    count = 0
  ),
  
  # Case 3: Perfect retention
  perfect_retention = data.frame(
    step1 = "Start", count1 = 500,
    step2 = "Middle", count2 = 500,
    step3 = "End", count3 = 500
  )
)

# Test each edge case
for(case_name in names(edge_cases)) {
  cat("\nTesting edge case:", case_name, "\n")
  
  tryCatch({
    if(case_name == "single_step" || case_name == "zero_participants") {
      result <- flowchart(
        data = edge_cases[[case_name]],
        nodes = "step",
        counts = "count"
      )
    } else {
      result <- flowchart(
        data = edge_cases[[case_name]],
        nodes = c("step1", "step2", "step3"),
        counts = c("count1", "count2", "count3")
      )
    }
    cat("✓ Edge case handled successfully\n")
  }, error = function(e) {
    cat("✗ Error:", e$message, "\n")
  })
}

Conclusion

The ClinicoPath flowchart function provides a comprehensive solution for visualizing study workflows and research processes. Key advantages include:

Versatile Design: Suitable for any type of study or process flow
Professional Output: Publication-ready diagrams with customizable styling
Statistical Integration: Automatic calculation of flow statistics and metrics
jamovi Compatibility: Seamless integration with interactive analysis environment
Comprehensive Documentation: Detailed examples and best practices

Key Takeaways

  1. Plan Your Flow: Design your data structure before creating flowcharts
  2. Choose Appropriate Layouts: Match direction and styling to your content type
  3. Validate Data Quality: Check for logical flow patterns and data consistency
  4. Customize Thoughtfully: Select colors and sizes appropriate for your audience
  5. Document Thoroughly: Include titles, legends, and explanatory text

Next Steps

  1. Practice with the provided example datasets
  2. Adapt the methods to your own research data
  3. Integrate with other ClinicoPath functions for comprehensive reporting
  4. Export diagrams for publications and presentations

Additional Resources

For more advanced flowchart techniques and integration with other analysis functions, explore the complete ClinicoPath vignette series.


This vignette demonstrates the comprehensive capabilities of the ClinicoPath flowchart function for research workflow visualization and clinical pathway documentation.