Логотип Nomogram Construction

Nomogram Construction

ОрганизацияПопулярное
aipoch
nomogram-construction

Use when constructing a prognosis nomogram from survival-related clinical predictors, exporting the nomogram bundle and C-index table, and optionally rendering the final nomogram PDF. NOT for: univariate/multivariable Cox feature screening, calibration curves, ROC analysis, decision-curve analysis, or non-survival outcomes.

Обзор

Издательaipoch
Репозиторийmedical-research-skills
Название навыкаnomogram-construction
Звёзды
1.9K
Форки
175
Встроенные файлы
20
ЛицензияMIT
Ссылки
  • Инструкции в формате Markdown

    Файл SKILL.md, который модель загружает по необходимости, поэтому токены расходуются только при подходящем запросе.

  • Работает с любой языковой моделью

    Навыки ИИ — это обычный Markdown, а не код для конкретного поставщика, поэтому они работают с GPT, Claude, Gemini, Grok и локальными моделями.

  • Файлы в комплекте: 20

    Скрипты, шаблоны и справочные материалы, которые модель может читать во время работы. Файлы доступны только для чтения и никогда не выполняются.

  • Открытый исходный код

    Опубликовано на GitHub: aipoch. Перед установкой изучите исходные материалы.

Установка

Установите навык ИИ Nomogram Construction в TypingMind, чтобы использовать его с любой LLM, или добавьте его в другой агент, который умеет читать SKILL.md.

1

Установка в TypingMind

TypingMind устанавливает навык прямо из его папки на GitHub: читает SKILL.md, собирает файлы ресурсов и сохраняет результат локально.

  1. Откройте приложение и перейдите в раздел «Плагины → Навыки».
  2. Выберите «Установить из GitHub».
  3. Вставьте указанную ниже ссылку на папку навыка и подтвердите установку.
    https://github.com/aipoch/medical-research-skills/tree/main/awesome-med-research-skills/Data%20Analysis/nomogram-construction
  4. Включите навык в каждом чате, где хотите его использовать.
Плагины → Навыки → Новый навык → По ссылке GitHub, затем вставьте ссылку на папку и нажмите «Продолжить».

Использование в TypingMind

Включите навык Nomogram Construction в любом чате TypingMind, и дальше модель всё сделает сама. Его название и описание хранятся в системном промпте, а при появлении подходящего запроса модель сама загружает полные инструкции. Вам не нужно вызывать навык вручную, и до фактического использования он не расходует токены.

Модель сама загружает навык Nomogram Construction, как только появляется подходящий для него запрос.

Работает с любой моделью ИИ

Навыки ИИ — это обычные инструкции в Markdown, а не код для конкретного поставщика, поэтому навык Nomogram Construction не привязан к модели, для которой он был создан. Установите его один раз в TypingMind и используйте с GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama или локальной моделью, которую запускаете самостоятельно, — со своими API-ключами.

  • Загружается только при необходимости

    Системный промпт содержит только название и описание. Инструкции загружаются при первом подходящем запросе, поэтому неиспользуемый навык не расходует токены.

  • Меняйте модели прямо в чате

    Навык состоит из инструкций, а не кода, поэтому смена модели не нарушает его работу: новая модель читает тот же файл SKILL.md.

Инструкции навыка

Это содержимое файла SKILL.md, которое загружает модель. Прочитайте его перед установкой: навык — это инструкции, которым будет следовать ваша модель.

Nomogram Construction

When to Use

Use this skill when you need to:

  • build a prognosis nomogram from already selected clinical prognostic variables;
  • estimate model discrimination with a C-index table;
  • export a nomogram bundle and generate a publication-ready nomogram PDF.

Typical user requests:

  • "Build a prognosis nomogram from age, stage, and risk score."
  • "Use these Cox-selected predictors to construct a nomogram and calculate the C-index."
  • "Generate a nomogram PDF from a survival prediction model."

When Not to Use

Do not use this skill for:

  • screening prognostic variables from scratch with Cox regression;
  • ROC curves, calibration curves, or decision-curve analysis;
  • diagnosis models, binary classification, or non-survival outcomes;
  • single-cell, differential-expression, or pathway analysis.

When to Read External Files

SituationFile to ReadPurpose
Need algorithm detailsreferences/algorithm.mdCox-based nomogram workflow, C-index, and assumptions
Need to run analysisscripts/main.RExecute Rscript scripts/main.R --mode build ... or --mode plot ...
Encounter errorsreferences/troubleshooting.mdCommon SKILL_* errors and solutions
Need CLI examplesreferences/cli-guide.mdDetailed command-line examples
Need test datatests/data/Example clinical CSV for smoke testing

Input Validation

This skill accepts:

  • A clinical CSV file with survival time, event indicator, and pre-selected prognostic features
  • Requests to build a Cox-based prognostic nomogram and compute the C-index
  • Requests to re-render a nomogram PDF from an existing .qs bundle (plot mode)

If the user's request does not involve nomogram construction from survival data — for example, asking to screen features with Cox regression, generate calibration curves, perform ROC analysis, or analyze non-survival binary outcomes — do not proceed with this workflow. Instead respond:

"nomogram-construction is designed to build a prognosis nomogram from pre-selected survival predictors and export the nomogram bundle with C-index table. Your request appears to be outside this scope. Please use a Cox feature-screening skill for variable selection, or a calibration-curve/ROC skill for model validation."


Prerequisites

R packages required: rms, openxlsx, qs, optparse.

Install with:

r
install.packages(c("rms", "openxlsx", "qs", "optparse"), repos = "https://cloud.r-project.org")

Or run the bootstrap installer:

bash
Rscript scripts/install_dependencies.R

Note: --help requires optparse to be loaded. If the package check fires before option parsing, install optparse first, then run --help.


Usage

Build Nomogram Bundle

bash
Rscript scripts/main.R \
  --mode build \
  --data_file ./clinical_data.csv \
  --features age,stage,risk \
  --time_col futime \
  --event_col fustat \
  --years 1,2,3 \
  --output_dir ./output/ \
  --seed 42

Render Nomogram Plot

bash
Rscript scripts/main.R \
  --mode plot \
  --nomo_data_file ./output/data/Nomogram_list.qs \
  --plot_save ./output/plot/nomogram_plot.pdf

Arguments

ShortLongTypeDefaultDescription
-m--modecharacterbuildExecution mode: build or plot
-d--data_filecharacterrequired for buildClinical CSV file with sample IDs as row names
-f--featurescharacterrequired for buildComma-separated prognostic features
-t--time_colcharacterfutimeSurvival time column
-e--event_colcharacterfustatEvent column encoded as 1=event, 0=censored
-y--yearscharacter1,2,3Prediction time points in years
-o--output_dircharacter./output/Output directory for build mode
--overwriteflagFALSEAllow writing into a non-empty output directory
-n--nomo_data_filecharacterrequired for plotNomogram bundle in .qs format
-p--plot_savecharacterrequired for plotOutput PDF path
-w--plot_widthdouble11Plot width in inches
-H--plot_heightdouble8Plot height in inches
-F--font_sizedouble8Plot font size
-l--line_widthdouble5Plot line width
--font_familycharactersansFont family for PDF output
-s--seedinteger42Random seed for reproducibility
-T--timeout_secondsinteger0Elapsed time limit in seconds; 0 disables timeout

Input Format

Clinical Data (data_file)

CSV file with sample IDs as row names and one column per feature/end-point variable.

csv
",age,stage,risk,futime,fustat
SAMPLE_001,65,StageIII,high,365,1
SAMPLE_002,52,StageII,low,730,0
SAMPLE_003,78,StageIV,high,180,1

Requirements

  • File format must be CSV.
  • Sample IDs must be stored in the first column as row names.
  • At least 3 prognostic features are required.
  • time_col must contain finite numeric values greater than 0.
  • event_col must contain only 0 and 1.
  • At least 20 complete samples and at least 10 events are required after filtering incomplete rows.

Nomogram Bundle (nomo_data_file)

The plot mode reads the .qs bundle produced by build mode.

Required bundle objects:

  • nomogram
  • c_index
  • model
  • data
  • features
  • time_points

Output Files

Build Mode

FileDescription
data/Nomogram_list.qsSerialized nomogram bundle
data/analysis_data.rdsComplete-case dataset used for modeling
table/nomogram_c_index.xlsxNomogram discrimination summary
session_info.txtSession information and build parameters

Plot Mode

FileDescription
plot/nomogram_plot.pdfRendered nomogram PDF
plot/session_info.txtPlotting session information and parameters

nomogram_c_index.xlsx

ColumnDescription
metricReported metric name
valueMetric value

Workflow

Step 1: Validate Input

  • Check file existence and CSV format.
  • Validate required feature, time, and event columns.
  • Validate time/event values and minimum sample/event counts.

Step 2: Prepare Modeling Dataset

  • Keep only requested features and outcome columns.
  • Convert character predictors to factors.
  • Remove incomplete rows across model variables.

Step 3: Fit Cox-Based Nomogram Model

  • Fit an rms::cph survival model.
  • Build survival functions at requested time points.
  • Construct the nomogram object.

Step 4: Evaluate Performance

  • Compute the model C-index.
  • Save a compact discrimination summary table.

Step 5: Save And Plot

  • Save the nomogram bundle and analysis dataset.
  • Render the nomogram PDF in plot mode.

Examples

Basic Build

bash
Rscript scripts/main.R \
  --mode build \
  -d clinical_data.csv \
  -f age,stage,risk \
  -o ./output/

Custom Prediction Horizons

bash
Rscript scripts/main.R \
  --mode build \
  -d clinical_data.csv \
  -f age,stage,risk,treatment \
  -y 1,3,5 \
  -o ./output/

Plot Existing Bundle

bash
Rscript scripts/main.R \
  --mode plot \
  -n ./output/data/Nomogram_list.qs \
  -p ./output/plot/nomogram_plot.pdf \
  -w 12 -H 9 -F 10

Error Handling

ErrorCauseSolution
SKILL_FILE_NOT_FOUNDInput file does not existVerify the file path
SKILL_EMPTY_DATAInput file is empty or has no usable rows and columnsRe-export the input file with valid rows and columns
SKILL_MISSING_COLUMNSRequired columns are absent from the clinical dataCheck column names and spelling
SKILL_INVALID_DATAInvalid time/event encoding, malformed bundle, or unreadable CSV/QS fileCheck input values and file integrity
SKILL_INSUFFICIENT_DATAToo few features, complete samples, or eventsProvide more valid predictors or samples
SKILL_ANALYSIS_ERRORcph() fitting, nomogram construction, or output writing failedCheck data quality, factor levels, and event distribution
SKILL_INVALID_PARAMETERMissing required CLI value, invalid mode, invalid years, or overwrite conflictReview command-line arguments
SKILL_PACKAGE_NOT_FOUNDRequired R package is not installedInstall with: Rscript -e "install.packages(c('rms', 'openxlsx', 'qs'), repos='https://cloud.r-project.org')"
SKILL_TIMEOUTThe configured timeout was exceededIncrease --timeout_seconds or reduce workload

IF error persists, READ: references/troubleshooting.md


Testing

Smoke Test With Included Data

bash
Rscript scripts/main.R --help

Rscript scripts/main.R \
  --mode build \
  -d tests/data/yuhou_cli_data.csv \
  -f age,gender,risk \
  -o tests/expected_output/ \
  --overwrite

Rscript scripts/main.R \
  --mode plot \
  -n tests/expected_output/data/Nomogram_list.qs \
  -p tests/expected_output/plot/nomogram_plot.pdf

Automated Smoke Test Script

bash
Rscript tests/run_smoke_test.R

Optional shell wrapper:

bash
bash tests/run_smoke_test.sh

Expected Output

text
tests/expected_output/
|-- data/analysis_data.rds
|-- data/Nomogram_list.qs
|-- plot/nomogram_plot.pdf
|-- plot/session_info.txt
|-- session_info.txt
`-- table/nomogram_c_index.xlsx

Historical development artifacts may still exist in tests/output/, but standardized validation uses tests/expected_output/.


References

  1. Harrell FE (2015). Regression Modeling Strategies.
  2. Iasonos A et al. (2008). How to build and interpret a nomogram for cancer prognosis. Journal of Clinical Oncology.
  3. Balachandran VP et al. (2015). Nomograms in oncology: more than meets the eye. The Lancet Oncology.

For detailed algorithm, READ: references/algorithm.md


Implementation Checklist

  • CLI parsing with optparse
  • set.seed() for reproducibility
  • requireNamespace() dependency checks
  • Session info recording
  • Timeout parameter exposed as CLI option
  • File reading instructions in SKILL.md
  • Modular script structure in scripts/
  • Test data provided in tests/data/
  • Error handling with SKILL_* codes
  • References documented in references/

Last updated: 2026-04-27 | Version: 2.1.0

Встроенные файлы

Модель читает эти файлы по мере необходимости, пока навык загружен. Они доступны только для чтения и никогда не выполняются.

Часто задаваемые вопросы

Что делает навык ИИ Nomogram Construction?

Use when constructing a prognosis nomogram from survival-related clinical predictors, exporting the nomogram bundle and C-index table, and optionally rendering the final nomogram PDF. NOT for: univariate/multivariable Cox feature screening, calibration curves, ROC analysis, decision-curve analysis, or non-survival outcomes.

Зачем использовать Nomogram Construction в TypingMind?

Потому что вы устанавливаете навык один раз и используете его с любой моделью. Nomogram Construction — это обычный текст в формате Markdown, а не код для конкретного поставщика, поэтому один и тот же навык работает с GPT-5, Claude, Gemini, Grok или локальной моделью. Вы можете менять модель прямо во время чата, и навык продолжит работать. TypingMind использует ваши собственные ключи API, поэтому вы платите поставщикам напрямую, а не оформляете подписку с оплатой за каждое место. Ваши навыки и чаты остаются в вашем собственном хранилище.

Как установить Nomogram Construction в TypingMind?

В TypingMind откройте «Плагины → Навыки → Установить из GitHub» и вставьте https://github.com/aipoch/medical-research-skills/tree/main/awesome-med-research-skills/Data%20Analysis/nomogram-construction. TypingMind прочитает файл SKILL.md, включит сопутствующие файлы в пакет и установит навык, который можно включать отдельно для каждого чата.

Какие модели ИИ могут использовать Nomogram Construction?

Любая модель, которую вы подключите в TypingMind. Навыки ИИ — это обычные инструкции в формате Markdown, а не код для конкретного поставщика, поэтому GPT, Claude, Gemini, Grok и локальные модели могут загружать этот навык, когда запрос ему соответствует.

Со сколькими моделями ИИ можно использовать Nomogram Construction?

С любым количеством. Если модель поддерживает навыки, вы можете использовать с ней Nomogram Construction: GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama и другие — всё в TypingMind с вашими собственными ключами API.

Бесплатен ли навык ИИ Nomogram Construction?

Да. Навык опубликован на GitHub автором aipoch по лицензии MIT. Вы платите только своему поставщику ИИ за использованные токены.

Что такое навыки ИИ?

Навык ИИ — это многоразовый набор инструкций, который объясняет модели ИИ, как выполнять конкретную задачу. Он соответствует открытому формату Agent Skills: файл SKILL.md с названием и описанием, а также любые скрипты, шаблоны или справочные файлы, которые могут понадобиться модели. Модель читает инструкции, только когда ваш запрос соответствует навыку, поэтому установленный навык ничего не стоит, пока не используется.

Чем навыки ИИ отличаются от плагинов и серверов MCP?

Плагин или сервер MCP даёт модели новые инструменты для вызова — код, который где-то выполняется и возвращает результат. Навык ИИ вместо этого даёт модели знания и порядок действий: как подойти к задаче, какие шаги выполнить и каким должен быть хороший результат. Навыки — это обычный текст в формате Markdown, поэтому им не нужны сервер, ключ API или среда выполнения, и они работают с любой моделью.

Все

Создайте свою рабочую ИИ-среду сейчас

Подпишитесь на нашу рассылку, чтобы узнавать о новых функциях и предстоящих розыгрышах 👇