When building web applications for clinical or educational contexts, speed, clarity, and zero-latency inputs are everything. A few seconds of delay or an unintuitive interface can frustrate a user trying to evaluate assessment criteria under pressure.
Recently, I built and launched an interactive APGAR Score Calculator designed to compute infant health assessment scores instantly on the client side.
In this post, I’ll break down why I built it, how the APGAR scoring system works programmatically, and the key UX and architectural choices behind making it seamless.
What is the APGAR Score?
The APGAR score is a standardized assessment method used worldwide to evaluate a newborn child’s physical condition immediately after birth (typically at 1 minute and 5 minutes post-delivery).
It evaluates 5 key clinical parameters, each scored from 0 to 2:
- A ppearance (Skin Color)
- P ulse (Heart Rate)
- G rimace (Reflex Irritability)
- A ctivity (Muscle Tone)
- R espiration (Breathing Effort)
💡 Score Interpretation Summary:
- 7 to 10: Normal / Reassuring
- 4 to 6: Moderately Low (May require oxygen or monitoring)
- 0 to 3: Critical / Low (Requires immediate medical intervention)
The Technical Problem with Existing Tools
Most online clinical calculators suffer from three major design flaws:
- Server-side roundtrips: Forcing a form submit button to POST 5 integers introduces unnecessary latency.
- Cluttered visual hierarchy: Excessive ads, massive header blocks, and non-essential inputs distract from the primary output.
- Lack of contextual feedback: Displaying a raw number without immediately categorizing the severity or providing actionable insights.
System Architecture & Technical Goals
To fix these issues, I set out to build a lightweight tool with strict performance targets:
- Zero external dependencies for core calculation logic.
- Client-side reactive updates on every user selection.
- Fully responsive layout optimized for both mobile screens and desktop viewports.
- Instant visual feedback loops with color-coded score classifications.
Core Algorithm & Logic Implementation
Calculating the APGAR score relies on an immediate state sum, paired with clean conditional mapping to categorize clinical status.
Here is a clean TypeScript implementation representing the evaluation logic behind the tool:
typescript
type ApgarCategory = {
label: string;
score: number; // 0, 1, or 2
};
interface ApgarState {
appearance: number;
pulse: number;
grimace: number;
activity: number;
respiration: number;
}
interface EvaluationResult {
totalScore: number;
status: 'Critical' | 'Moderately Low' | 'Normal';
colorCode: string;
description: string;
}
function evaluateApgar(state: ApgarState): EvaluationResult {
const totalScore =
state.appearance +
state.pulse +
state.grimace +
state.activity +
state.respiration;
if (totalScore >= 7) {
return {
totalScore,
status: 'Normal',
colorCode: '#22c55e', // Green
description: 'Infant is in good physical condition. Standard post-natal care recommended.'
};
} else if (totalScore >= 4) {
return {
totalScore,
status: 'Moderately Low',
colorCode: '#eab308', // Amber
description: 'Infant may require special assistance, airway clearing, or oxygen administration.'
};
} else {
return {
totalScore,
status: 'Critical',
colorCode: '#ef4444', // Red
description: 'Immediate medical attention and resuscitative measures required.'
};
}
}

Top comments (0)