Better apgar formula

This commit is contained in:
Álvaro González 2026-01-25 18:39:43 +01:00
parent 76769973f3
commit fd5999d586
2 changed files with 10 additions and 8 deletions

View file

@ -126,11 +126,11 @@ Where:
"name": "Apgar Score", "name": "Apgar Score",
"description": "Newborn health assessment scoring system\n\nScores 0-2 for:\n1. Heart rate\n2. Breathing\n3. Muscle tone\n4. Reflexes\n5. Skin color\nTotal score 0-10", "description": "Newborn health assessment scoring system\n\nScores 0-2 for:\n1. Heart rate\n2. Breathing\n3. Muscle tone\n4. Reflexes\n5. Skin color\nTotal score 0-10",
"input": [ "input": [
{"name": "HeartRate", "values": ["hr1", "hr2", "hr3"] }, {"name": "HeartRate", "values": ["Absent", "< 100 bpm>", "> 100 bpm"] },
{"name": "Breathing", "values": ["hr1", "hr2", "hr3"] }, {"name": "Breathing", "values": ["Absent", "Weak, irregular", "Strong, robust cry"] },
{"name": "MuscleTone", "values": ["hr1", "hr2", "hr3"] }, {"name": "MuscleTone", "values": ["None", "Some", "Flexed arms/leg, resists extension"] },
{"name": "Reflexes", "values": ["hr1", "hr2", "hr3"] }, {"name": "Reflexes", "values": ["No response", "Grimace on aggressive stimulation", "Cry on stimulation"] },
{"name": "SkinColor", "values": ["hr1", "hr2", "hr3"] } {"name": "SkinColor", "values": ["Blue or pale", "Blue extremities, pink body", "Pink"] }
], ],
"output": {"name": "Result", "unit": "scalar"}, "output": {"name": "Result", "unit": "scalar"},
"d4rtCode": """ "d4rtCode": """

View file

@ -15,14 +15,16 @@ class FormulaScreen extends StatefulWidget {
State<FormulaScreen> createState() => _FormulaScreenState(); State<FormulaScreen> createState() => _FormulaScreenState();
} }
// TODO: Create VariableWidget. Depending on VariableSpec.values, it can be a ValueDropdown or a D4rtEditingController
// The d4rtValue will be FormulaResult?
//// Start of D4rtEditingController class //// //// Start of D4rtEditingController class ////
class D4rtEditingController extends TextEditingController { class D4rtEditingController extends TextEditingController {
String? _lastError; String? _lastError;
String _text = "";
String? get lastError => _lastError; String? get lastError => _lastError;
FormulaResult? _lastValue; FormulaResult? _lastValue;
D4rtEditingController({String? text}) : super(text: text); D4rtEditingController({super.text});
bool validate() { bool validate() {
try { try {
@ -38,7 +40,7 @@ class D4rtEditingController extends TextEditingController {
} }
} }
get d4rtValue => _lastValue; FormulaResult? get d4rtValue => _lastValue;
set text(String newText) { set text(String newText) {
super.text = newText; super.text = newText;