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",
"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": [
{"name": "HeartRate", "values": ["hr1", "hr2", "hr3"] },
{"name": "Breathing", "values": ["hr1", "hr2", "hr3"] },
{"name": "MuscleTone", "values": ["hr1", "hr2", "hr3"] },
{"name": "Reflexes", "values": ["hr1", "hr2", "hr3"] },
{"name": "SkinColor", "values": ["hr1", "hr2", "hr3"] }
{"name": "HeartRate", "values": ["Absent", "< 100 bpm>", "> 100 bpm"] },
{"name": "Breathing", "values": ["Absent", "Weak, irregular", "Strong, robust cry"] },
{"name": "MuscleTone", "values": ["None", "Some", "Flexed arms/leg, resists extension"] },
{"name": "Reflexes", "values": ["No response", "Grimace on aggressive stimulation", "Cry on stimulation"] },
{"name": "SkinColor", "values": ["Blue or pale", "Blue extremities, pink body", "Pink"] }
],
"output": {"name": "Result", "unit": "scalar"},
"d4rtCode": """

View file

@ -15,14 +15,16 @@ class FormulaScreen extends StatefulWidget {
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 ////
class D4rtEditingController extends TextEditingController {
String? _lastError;
String _text = "";
String? get lastError => _lastError;
FormulaResult? _lastValue;
D4rtEditingController({String? text}) : super(text: text);
D4rtEditingController({super.text});
bool validate() {
try {
@ -38,7 +40,7 @@ class D4rtEditingController extends TextEditingController {
}
}
get d4rtValue => _lastValue;
FormulaResult? get d4rtValue => _lastValue;
set text(String newText) {
super.text = newText;