Source: https://github.com/aipoch/medical-research-skills
EBM Calculator
Evidence-Based Medicine diagnostic test calculator.
Quick Check
Use this command to verify that the packaged script entry point can be parsed before deeper execution.
python -m py_compile scripts/main.py
Audit-Ready Commands
Use these concrete commands for validation. They are intentionally self-contained and avoid placeholder paths.
python -m py_compile scripts/main.py
python scripts/main.py --help
When to Use
- Use this skill when calculating diagnostic test performance (sensitivity, specificity, PPV, NPV, likelihood ratios).
- Use this skill when converting between pre-test and post-test probability or computing NNT.
- Use this skill when the user says "calculate sensitivity", "EBM calculator", "diagnostic accuracy", or "likelihood ratio".
Workflow
- Identify calculation mode: Determine mode from user request —
diagnostic (sensitivity/specificity/PPV/NPV/LR), nnt (number needed to treat), or probability (pre/post-test probability conversion).
- Collect required parameters:
- Diagnostic mode: TP, FN, TN, FP counts; optional prevalence for PPV/NPV adjustment
- NNT mode: control event rate, experimental event rate
- Probability mode: pre-test probability, likelihood ratio
- Validate inputs: Check that all counts are non-negative integers, rates are between 0 and 1, and denominators are not zero. If invalid, report exact error and stop.
- Checkpoint: Display input summary to user for confirmation before computing results.
- Compute results: Execute calculations per mode. Include interpretation string (e.g., "LR+ of 10 strongly rules in disease").
- Output: Return structured JSON with computed metrics and interpretation.
- Fallback: If a required parameter is missing, output a template showing which fields are needed with example values.
Features
- Sensitivity / Specificity calculation
- PPV / NPV with prevalence adjustment
- Likelihood ratios (LR+ / LR-)
- Number Needed to Treat (NNT)
- Pre/post-test probability conversion
Parameters
| Parameter |
Type |
Default |
Required |
Description |
--mode, -m |
string |
diagnostic |
No |
Calculation mode (diagnostic, nnt, probability) |
--tp, --true-pos |
int |
- |
* |
True positives (diagnostic mode) |
--fn, --false-neg |
int |
- |
* |
False negatives (diagnostic mode) |
--tn, --true-neg |
int |
- |
* |
True negatives (diagnostic mode) |
--fp, --false-pos |
int |
- |
* |
False positives (diagnostic mode) |
--prevalence, -p |
float |
- |
No |
Disease prevalence 0-1 (diagnostic mode) |
--control-rate |
float |
- |
** |
Control event rate 0-1 (nnt mode) |
--experimental-rate |
float |
- |
** |
Experimental event rate 0-1 (nnt mode) |
--pretest |
float |
- |
*** |
Pre-test probability 0-1 (probability mode) |
--lr |
float |
- |
*** |
Likelihood ratio (probability mode) |
--output, -o |
string |
stdout |
No |
Output file path |
* Required for diagnostic mode
** Required for nnt mode
*** Required for probability mode
Output Format
{
"sensitivity": "float",
"specificity": "float",
"ppv": "float",
"npv": "float",
"lr_positive": "float",
"lr_negative": "float",
"interpretation": "string"
}
Risk Assessment
| Risk Indicator |
Assessment |
Level |
| Code Execution |
Python/R scripts executed locally |
Medium |
| Network Access |
No external API calls |
Low |
| File System Access |
Read input files, write output files |
Medium |
| Instruction Tampering |
Standard prompt guidelines |
Low |
| Data Exposure |
Output files saved to workspace |
Low |
Security Checklist
Prerequisites
No additional Python packages required.
Evaluation Criteria
Success Metrics
Test Cases
- Basic Functionality: Standard input → Expected output
- Edge Case: Invalid input → Graceful error handling
- Performance: Large dataset → Acceptable processing time
Lifecycle Status
- Current Stage: Draft
- Next Review Date: 2026-03-06
- Known Issues: None
- Planned Improvements:
- Performance optimization
- Additional feature support
Output Requirements
Every final response should make these items explicit when they are relevant:
- Objective or requested deliverable
- Inputs used and assumptions introduced
- Workflow or decision path
- Core result, recommendation, or artifact
- Constraints, risks, caveats, or validation needs
- Unresolved items and next-step checks
Error Handling
- If required inputs are missing, state exactly which fields are missing and request only the minimum additional information.
- If the task goes outside the documented scope, stop instead of guessing or silently widening the assignment.
- If
scripts/main.py fails, report the failure point, summarize what still can be completed safely, and provide a manual fallback.
- Do not fabricate files, citations, data, search results, or execution outcomes.
Input Validation
This skill accepts requests that match the documented purpose of ebm-calculator and include enough context to complete the workflow safely.
Do not continue the workflow when the request is out of scope, missing a critical input, or would require unsupported assumptions. Instead respond:
ebm-calculator only handles its documented workflow. Please provide the missing required inputs or switch to a more suitable skill.
Response Template
Use the following fixed structure for non-trivial requests:
- Objective
- Inputs Received
- Assumptions
- Workflow
- Deliverable
- Risks and Limits
- Next Checks
If the request is simple, you may compress the structure, but still keep assumptions and limits explicit when they affect correctness.
1---2name: ebm-calculator3description: Evidence-Based Medicine diagnostic test calculator. Computes sensitivity, specificity, PPV, NPV, likelihood ratios, NNT, and pre/post-test probability.4license: MIT5---6> **Source**: [https://github.com/aipoch/medical-research-skills](https://github.com/aipoch/medical-research-skills)
7
8# EBM Calculator
9
10Evidence-Based Medicine diagnostic test calculator.
11
12## Quick Check
13
14Use this command to verify that the packaged script entry point can be parsed before deeper execution.
15
16```bash
17python -m py_compile scripts/main.py
18```
19
20## Audit-Ready Commands
21
22Use these concrete commands for validation. They are intentionally self-contained and avoid placeholder paths.
23
24```bash
25python -m py_compile scripts/main.py
26python scripts/main.py --help
27```
28
29## When to Use
30
31- Use this skill when calculating diagnostic test performance (sensitivity, specificity, PPV, NPV, likelihood ratios).
32- Use this skill when converting between pre-test and post-test probability or computing NNT.
33- Use this skill when the user says "calculate sensitivity", "EBM calculator", "diagnostic accuracy", or "likelihood ratio".
34
35## Workflow
36
371. **Identify calculation mode**: Determine mode from user request — `diagnostic` (sensitivity/specificity/PPV/NPV/LR), `nnt` (number needed to treat), or `probability` (pre/post-test probability conversion).
382. **Collect required parameters**:
39 - Diagnostic mode: TP, FN, TN, FP counts; optional prevalence for PPV/NPV adjustment
40 - NNT mode: control event rate, experimental event rate
41 - Probability mode: pre-test probability, likelihood ratio
423. **Validate inputs**: Check that all counts are non-negative integers, rates are between 0 and 1, and denominators are not zero. If invalid, report exact error and stop.
434. **Checkpoint**: Display input summary to user for confirmation before computing results.
445. **Compute results**: Execute calculations per mode. Include interpretation string (e.g., "LR+ of 10 strongly rules in disease").
456. **Output**: Return structured JSON with computed metrics and interpretation.
467. **Fallback**: If a required parameter is missing, output a template showing which fields are needed with example values.
47
48## Features
49
50- Sensitivity / Specificity calculation
51- PPV / NPV with prevalence adjustment
52- Likelihood ratios (LR+ / LR-)
53- Number Needed to Treat (NNT)
54- Pre/post-test probability conversion
55
56## Parameters
57
58| Parameter | Type | Default | Required | Description |
59|-----------|------|---------|----------|-------------|
60| `--mode`, `-m` | string | diagnostic | No | Calculation mode (diagnostic, nnt, probability) |
61| `--tp`, `--true-pos` | int | - | * | True positives (diagnostic mode) |
62| `--fn`, `--false-neg` | int | - | * | False negatives (diagnostic mode) |
63| `--tn`, `--true-neg` | int | - | * | True negatives (diagnostic mode) |
64| `--fp`, `--false-pos` | int | - | * | False positives (diagnostic mode) |
65| `--prevalence`, `-p` | float | - | No | Disease prevalence 0-1 (diagnostic mode) |
66| `--control-rate` | float | - | ** | Control event rate 0-1 (nnt mode) |
67| `--experimental-rate` | float | - | ** | Experimental event rate 0-1 (nnt mode) |
68| `--pretest` | float | - | *** | Pre-test probability 0-1 (probability mode) |
69| `--lr` | float | - | *** | Likelihood ratio (probability mode) |
70| `--output`, `-o` | string | stdout | No | Output file path |
71
72\* Required for diagnostic mode
73\** Required for nnt mode
74\*** Required for probability mode
75
76## Output Format
77
78```json
79{
80 "sensitivity": "float",
81 "specificity": "float",
82 "ppv": "float",
83 "npv": "float",
84 "lr_positive": "float",
85 "lr_negative": "float",
86 "interpretation": "string"
87}
88```
89
90## Risk Assessment
91
92| Risk Indicator | Assessment | Level |
93|----------------|------------|-------|
94| Code Execution | Python/R scripts executed locally | Medium |
95| Network Access | No external API calls | Low |
96| File System Access | Read input files, write output files | Medium |
97| Instruction Tampering | Standard prompt guidelines | Low |
98| Data Exposure | Output files saved to workspace | Low |
99
100## Security Checklist
101
102- [ ] No hardcoded credentials or API keys
103- [ ] No unauthorized file system access (../)
104- [ ] Output does not expose sensitive information
105- [ ] Prompt injection protections in place
106- [ ] Input file paths validated (no ../ traversal)
107- [ ] Output directory restricted to workspace
108- [ ] Script execution in sandboxed environment
109- [ ] Error messages sanitized (no stack traces exposed)
110- [ ] Dependencies audited
111
112## Prerequisites
113
114No additional Python packages required.
115
116## Evaluation Criteria
117
118### Success Metrics
119- [ ] Successfully executes main functionality
120- [ ] Output meets quality standards
121- [ ] Handles edge cases gracefully
122- [ ] Performance is acceptable
123
124### Test Cases
1251. **Basic Functionality**: Standard input → Expected output
1262. **Edge Case**: Invalid input → Graceful error handling
1273. **Performance**: Large dataset → Acceptable processing time
128
129## Lifecycle Status
130
131- **Current Stage**: Draft
132- **Next Review Date**: 2026-03-06
133- **Known Issues**: None
134- **Planned Improvements**:
135 - Performance optimization
136 - Additional feature support
137
138## Output Requirements
139
140Every final response should make these items explicit when they are relevant:
141
142- Objective or requested deliverable
143- Inputs used and assumptions introduced
144- Workflow or decision path
145- Core result, recommendation, or artifact
146- Constraints, risks, caveats, or validation needs
147- Unresolved items and next-step checks
148
149## Error Handling
150
151- If required inputs are missing, state exactly which fields are missing and request only the minimum additional information.
152- If the task goes outside the documented scope, stop instead of guessing or silently widening the assignment.
153- If `scripts/main.py` fails, report the failure point, summarize what still can be completed safely, and provide a manual fallback.
154- Do not fabricate files, citations, data, search results, or execution outcomes.
155
156## Input Validation
157
158This skill accepts requests that match the documented purpose of `ebm-calculator` and include enough context to complete the workflow safely.
159
160Do not continue the workflow when the request is out of scope, missing a critical input, or would require unsupported assumptions. Instead respond:
161
162> `ebm-calculator` only handles its documented workflow. Please provide the missing required inputs or switch to a more suitable skill.
163
164## Response Template
165
166Use the following fixed structure for non-trivial requests:
167
1681. Objective
1692. Inputs Received
1703. Assumptions
1714. Workflow
1725. Deliverable
1736. Risks and Limits
1747. Next Checks
175
176If the request is simple, you may compress the structure, but still keep assumptions and limits explicit when they affect correctness.