A Privacy-Preserving Zero-Code Conversational Statistical Analysis System for Clinical Research Using Agentic AI and Local R Execution

Read the full article See related articles

Discuss this preprint

Start a discussion What are Sciety discussions?

Listed in

This article is not in any list yet, why not save it to one of your lists.
Log in to save this article

Abstract

Background

Clinical data analysis typically requires statistical programming skills, whereas cloud-based artificial intelligence (AI) agents risk exposing sensitive patient records. We developed and functionally validated a privacy-preserving, zero-code conversational statistical analysis framework that translates natural-language clinical research requests into executable R workflows while strictly retaining raw patient data within local computing environments.

Methods

Orchestrated by the n8n engine, the system integrates the DeepSeek-Reasoner model with a Pinecone vector database for retrieval-augmented generation (RAG), grounding statistical selection in curated biostatistical guidance and R templates. Core functionalities include data schema perception, interactive data cleaning, requirements refinement, and local R code execution via a controlled command-line interface. System performance was evaluated by replicating a published prognostic model study on metabolic dysfunction-associated steatotic liver disease (MASLD).

Findings

All core analytical workflows — including data cleaning, multivariable Cox proportional hazards modeling, model diagnostics, and publication-ready tables and figures (e.g., baseline characteristics, Schoenfeld residuals, receiver operating characteristic curves, and forest plots) — were executed solely through natural-language dialogues without manual coding. The external large language model actively clarified analytical prompts while receiving zero row-level patient data.

Interpretation

Decoupling remote cloud reasoning from local code execution lowers the technical threshold for clinicians conducting data-driven research while safeguarding data privacy. This architecture provides a practical, scalable, and reproducible framework for converting natural-language clinical questions into executable statistical workflows.

Research in context

Evidence before this study

We searched PubMed, Web of Science, Embase, and IEEE Xplore for peer-reviewed research articles published from database inception up to 1 February 2026, using search terms including (“large language models” OR “agentic AI” OR “conversational AI”) AND (“clinical data analysis” OR “biostatistics” OR “R execution”) AND (“privacy-preserving” OR “local computation” OR “retrieval-augmented generation”). No language restrictions were applied. Existing clinical data analysis tools present a fundamental trade-off between analytical flexibility and ease of use. While programming languages like R and Python offer high flexibility and transparency, they require substantial statistical coding expertise. Conversely, low-code or visual workflow platforms (e.g., KNIME, LinkR) reduce coding demands but are constrained by pre-implemented, rigid analytical modules. General-purpose AI coding agents (e.g., OpenAI Codex, Claude Code) enable natural-language interaction but lack domain-grounded biostatistical frameworks to ensure methodologically sound model specification and assumption evaluation. Crucially, transmitting row-level patient data to external cloud-hosted LLM endpoints poses severe data privacy, cybersecurity, and regulatory risks (e.g., HIPAA, GDPR). To date, zero-code systems that effectively decouple cloud-based LLM reasoning from local execution of raw patient data, while incorporating domain-specific biostatistical knowledge grounding, remain scarce.

Added value of this study

To our knowledge, this study presents a novel, human-supervised, privacy-preserving zero-code conversational statistical analysis system that architecturally separates external LLM-assisted reasoning from local patient-level data processing. Utilizing n8n as an orchestration platform, local R execution, and Pinecone-based retrieval-augmented generation (RAG) grounded in curated biostatistical guidance and R package documentation, the system translates natural-language clinical requests into executable, reproducible R workflows. Incorporating a human-in-the-loop requirement refinement mechanism ensures that investigators retain full control over judgment-dependent decisions, such as missing-data handling and variable selection. We functionally validated the system by fully reproducing a published prognostic model study for metabolic dysfunction-associated steatotic liver disease (MASLD). Without manual programming or exposing row-level patient data to external LLMs, the system generated publication-ready baseline tables, Cox proportional hazards regressions, ROC curves, and forest plots, while reducing the analytical lifecycle from days to hours.

Implications of all the available evidence

Our findings demonstrate that combining external agentic AI reasoning with local, knowledge-grounded execution provides a safe, transparent, and cost-effective solution for democratizing clinical data analysis. This architecture offers a scalable and privacy-compliant blueprint for healthcare institutions seeking to empower clinicians with advanced data analytics while strictly adhering to patient data protection regulations. Future research should prioritize implementing closed-loop automated error correction, semi-automated knowledge base curation, and formal multi-center usability and statistical validity evaluations with clinical end-users.

Article activity feed