A high-performance, deterministic C engine designed for autonomous patient triage and clinical risk stratification. The core architecture utilizes a multi-tiered evaluation pipeline that weighs acute symptom profiles against historical physiological baselines while processing heuristic edge-cases for acute systemic emergencies.
- Standalone CLI triage engine
🛠️ System Architecture & Working Mechanism
The diagnostic engine processes patient information through three independent logical stages:
Symptom-Based Scoring Matrix: Patient symptoms are matched against a predefined diagnostic knowledge base. Each symptom is assigned a base weight, which is dynamically adjusted using logical multipliers based on symptom duration and clinical severity (rated on a scale of 1–5). Comorbidity-Based Probability Adjustment: The system refines disease likelihood by incorporating physiological indicators and existing medical conditions. For example, fasting blood glucose values ≥126 mg/dL increase the likelihood of uncontrolled diabetes, while abnormal systolic and diastolic blood pressure readings influence hypertension-related assessments. Critical Red-Flag Detection: A separate safety layer operates independently of the scoring engine to identify medical emergencies requiring immediate attention. This includes conditions such as acute radiating chest pain, thyroid storm, and hyperpyrexia with body temperature ≥104°F (40°C), which override normal scoring and trigger urgent alerts.
The ingestion layer collects demographic variables to compute foundational metabolic baselines (BMI calculation) and activate age-dependent risk multipliers.
The engine parses underlying physiological comorbidities alongside acute indicators to flag compounding clinical vulnerabilities.
A prioritized matrix array sorts conditional scores to output percentage-based matching probabilities alongside immediate actionable guidelines.
The backend runs automated physical file serialization, mapping telemetry inputs to an append-only ledger and generating structured, local diagnostic summaries.
Technical Implementation DetailsMemory Architecture & Data ModelingHierarchical Struct Modeling: Organized into modular, deeply nested composite data types to model patient profiles with minimal cache misses:SymptomEntry: Stores localized symptom descriptors, severity scale metrics, and duration timestamps.MedicalHistory: Aggregates chronic conditions, historical clinical records, and allergy profiles.Patient: Acts as the root record, binding demographic identifiers, historical clinical data, and dynamic lists of current symptoms.Dynamic Allocation & Safety: Employs heap allocation via malloc() and calloc() for runtime symptom matching and candidate lists, minimizing the stack memory footprint. Explicit deallocation routines (free()) and pointer zeroing are applied to prevent memory leaks and dangling pointer dereferencing.Algorithmic Complexity & OptimizationSymptom Processing Pipeline:Matches reported patient indicators against the pre-compiled clinical repository using iterative lookup and string tokenization.Time Complexity:
gcc symptom_checker_v2.c -o pulse_matrix -lm Recommended Production FlagsFor strict conformance checking and optimization during deployment:Bashgcc -Wall -Wextra -pedantic -O2 symptom_checker_v2.c -o pulse_matrix -lm Deployment CharacteristicsStandalone Binary: Produces a lightweight, self-contained binary (<5 MB) with no runtime shared-library dependencies outside standard libc and libm.Cross-Platform Compatibility: Runs across all POSIX-compliant environments (Linux, macOS, BSD) and Windows (via MinGW, MSYS2, or WSL).




