Appcardio Development Docs
This page documents the internal structure of Appcardio tools. Learn how each calculator is built, how inputs are processed, how PHP handles the logic, and how results are rendered.
Sample Tool Code
This is the full example code used to demonstrate how Appcardio tools are constructed internally.
// ---- SAMPLE CODE (FULL) ----
<ul>
<form method="post" action="">
<li><strong>Age (years)</strong>
<input type="text" class="form-control" name="age" id="age"
value="<?php echo isset($_POST['age']) ? $_POST['age'] : ''; ?>" required>
</li>
<li><strong>High-sensitivity Troponin T (ng/L)</strong>
<input type="text" class="form-control" name="troponin" id="troponin"
value="<?php echo isset($_POST['troponin']) ? $_POST['troponin'] : ''; ?>" required>
</li>
<li><strong>NT-proBNP (pg/mL)</strong>
<input type="text" class="form-control" name="ntprobnp" id="ntprobnp"
value="<?php echo isset($_POST['ntprobnp']) ? $_POST['ntprobnp'] : ''; ?>" required>
</li>
<li><strong>History of Stroke or TIA</strong>
<select class="form-control" name="stroke_history">
<option value="0">No</option>
<option value="1">Yes</option>
</select>
</li>
<li><button type="submit" name="calculate">Calculate</button></li>
</form>
</ul>
<?php
if (isset($_POST['calculate'])) {
$age = floatval($_POST['age']);
$troponin = floatval($_POST['troponin']);
$ntprobnp = floatval($_POST['ntprobnp']);
$stroke_history = intval($_POST['stroke_history']);
$log_trop = log($troponin + 1);
$log_ntp = log($ntprobnp + 1);
$score = (0.02 * $age) + (0.48 * $stroke_history)
+ (0.35 * $log_trop) + (0.33 * $log_ntp);
$predicted_risk = 100 * (1 - pow(0.98, exp($score - 3.5)));
if ($predicted_risk < 1.5) $risk_cat = "Low Risk";
elseif ($predicted_risk < 3.0) $risk_cat = "Intermediate Risk";
else $risk_cat = "High Risk";
echo "<p>Predicted Risk: $predicted_risk%</p>";
echo "<p>Category: $risk_cat</p>";
}
?>
Code Breakdown
The form uses a POST method to capture user input. Each field has:
- Label
- Input element
- Value persistence using
isset()
User input is converted into numerical formats using:
$age = floatval($_POST['age']);
$troponin = floatval($_POST['troponin']);
$stroke_history = intval($_POST['stroke_history']);
This section handles biomarker log-transformation and risk scoring.
$log_trop = log($troponin + 1);
$score = (0.02 * $age) + (0.48 * $stroke_history)
+ (0.35 * $log_trop) + (0.33 * $log_ntp);
Outputs are formatted and printed in table format.
echo "Predicted Risk: $predicted_risk%
";
echo "Category: $risk_cat
";
Design Philosophy
Appcardio tools follow a strict design and development philosophy to ensure clarity, clinical accuracy, and long-term maintainability.
1. Simplicity First
Tools must be simple, fast, and intuitive. No unnecessary elements. No clutter. Only what clinicians need.
2. Clinically Accurate
Every formula and decision algorithm must reference established guidelines and scientific literature.
3. Consistent Structure
Every Appcardio tool follows the same technical skeleton: input → sanitization → calculation → output. Predictable, readable, and maintainable.
4. Open & Accessible
Our tools are free, ad-free, and require no registration. Access to cardiology decision tools should never be restricted.
5. Zero Bloat Philosophy
Lightweight PHP, minimal JS, no dependency hell. Every tool loads instantly to support clinical environments.
6. Clear Output
Results must be easy to read and clinically actionable. Tables, highlights, and risk categorization must be obvious.
Contribute to Appcardio
We welcome developers, clinicians, researchers, and anyone passionate about advancing cardiovascular medicine. If you have ideas for new tools, calculators, or decision models, Appcardio would be honored to publish your contribution.
How You Can Contribute
- Submit a new cardiovascular calculator or decision algorithm
- Improve existing scripts for accuracy or performance
- Share a validated clinical formula not yet available on Appcardio
- Help expand documentation and educational content
Contributions will be reviewed for scientific accuracy, usability, and alignment with Appcardio's design philosophy.
Submit Your Tool Idea