mirror of
https://github.com/gorules/zen.git
synced 2026-10-06 16:02:19 +00:00
* first draft * mock time; update snapshots * fix * Node.js test fix --------- Co-authored-by: Stefan <stefan@gorules.io>
318 lines
8.3 KiB
JSON
318 lines
8.3 KiB
JSON
{
|
|
"tests": [
|
|
{
|
|
"input": {
|
|
"patientId": "P12345",
|
|
"medication": "vancomycin",
|
|
"weightKg": 65,
|
|
"ageYears": 72,
|
|
"gfrValue": 45,
|
|
"liverFunction": "normal",
|
|
"allergies": [
|
|
"penicillin",
|
|
"sulfa"
|
|
],
|
|
"currentMedications": [
|
|
"metformin",
|
|
"lisinopril"
|
|
]
|
|
},
|
|
"output": {
|
|
"calculatedDose": {
|
|
"adjustmentReason": "adjusted for renal function",
|
|
"amount": 731.25,
|
|
"frequencyHours": "12",
|
|
"route": "intravenous",
|
|
"unit": "mg"
|
|
}
|
|
}
|
|
}
|
|
],
|
|
"nodes": [
|
|
{
|
|
"type": "inputNode",
|
|
"content": {
|
|
"schema": "{\n \"type\": \"object\",\n \"properties\": {\n \"patientId\": { \"type\": \"string\" },\n \"medication\": { \"type\": \"string\" },\n \"weightKg\": { \"type\": \"number\" },\n \"ageYears\": { \"type\": \"number\" },\n \"gfrValue\": { \"type\": \"number\" },\n \"liverFunction\": { \"type\": \"string\", \"enum\": [\"normal\", \"mild\", \"moderate\", \"severe\"] },\n \"allergies\": { \"type\": \"array\", \"items\": { \"type\": \"string\" } },\n \"currentMedications\": { \"type\": \"array\", \"items\": { \"type\": \"string\" } }\n },\n \"required\": [\"patientId\", \"medication\", \"weightKg\", \"ageYears\", \"gfrValue\"]\n}"
|
|
},
|
|
"id": "ip1",
|
|
"name": "patientData",
|
|
"position": {
|
|
"x": 110,
|
|
"y": 114
|
|
}
|
|
},
|
|
{
|
|
"type": "expressionNode",
|
|
"content": {
|
|
"expressions": [
|
|
{
|
|
"id": "e1-1",
|
|
"key": "isChild",
|
|
"value": "ageYears < 18"
|
|
},
|
|
{
|
|
"id": "e1-2",
|
|
"key": "isElderly",
|
|
"value": "ageYears >= 65"
|
|
},
|
|
{
|
|
"id": "e1-3",
|
|
"key": "hasRenalImpairment",
|
|
"value": "gfrValue < 60"
|
|
},
|
|
{
|
|
"id": "e1-4",
|
|
"key": "hasLiverImpairment",
|
|
"value": "liverFunction != 'normal'"
|
|
},
|
|
{
|
|
"id": "e1-5",
|
|
"key": "weightFactorAdult",
|
|
"value": "weightKg / 70"
|
|
},
|
|
{
|
|
"id": "e1-6",
|
|
"key": "weightFactorChild",
|
|
"value": "weightKg / 30"
|
|
},
|
|
{
|
|
"id": "e1-7",
|
|
"key": "renalAdjustmentFactor",
|
|
"value": "gfrValue < 30 ? 0.5 : (gfrValue < 60 ? 0.75 : 1)"
|
|
},
|
|
{
|
|
"id": "e1-8",
|
|
"key": "liverAdjustmentFactor",
|
|
"value": "liverFunction == 'severe' ? 0.5 : (liverFunction == 'moderate' ? 0.75 : (liverFunction == 'mild' ? 0.9 : 1))"
|
|
}
|
|
],
|
|
"passThrough": true,
|
|
"inputField": null,
|
|
"outputPath": null,
|
|
"executionMode": "single"
|
|
},
|
|
"id": "ex1",
|
|
"name": "calculateParameters",
|
|
"position": {
|
|
"x": 430,
|
|
"y": 114
|
|
}
|
|
},
|
|
{
|
|
"type": "decisionTableNode",
|
|
"content": {
|
|
"hitPolicy": "first",
|
|
"rules": [
|
|
{
|
|
"_id": "r1-1",
|
|
"i1-1": "'amoxicillin'",
|
|
"i1-2": "true",
|
|
"i1-3": "",
|
|
"i1-4": "",
|
|
"i1-5": "",
|
|
"o1-1": "50 * weightKg",
|
|
"o1-2": "'mg'",
|
|
"o1-3": "'8'",
|
|
"o1-4": "'oral'",
|
|
"o1-5": "'standard'"
|
|
},
|
|
{
|
|
"_id": "r1-2",
|
|
"i1-1": "'amoxicillin'",
|
|
"i1-2": "false",
|
|
"i1-3": "",
|
|
"i1-4": "",
|
|
"i1-5": "",
|
|
"o1-1": "500 * weightFactorAdult",
|
|
"o1-2": "'mg'",
|
|
"o1-3": "'8'",
|
|
"o1-4": "'oral'",
|
|
"o1-5": "'standard'"
|
|
},
|
|
{
|
|
"_id": "r1-3",
|
|
"i1-1": "'paracetamol'",
|
|
"i1-2": "true",
|
|
"i1-3": "",
|
|
"i1-4": "",
|
|
"i1-5": "",
|
|
"o1-1": "15 * weightKg",
|
|
"o1-2": "'mg'",
|
|
"o1-3": "'6'",
|
|
"o1-4": "'oral'",
|
|
"o1-5": "'standard'"
|
|
},
|
|
{
|
|
"_id": "r1-4",
|
|
"i1-1": "'paracetamol'",
|
|
"i1-2": "false",
|
|
"i1-3": "",
|
|
"i1-4": "",
|
|
"i1-5": "true",
|
|
"o1-1": "500 * renalAdjustmentFactor",
|
|
"o1-2": "'mg'",
|
|
"o1-3": "'8'",
|
|
"o1-4": "'oral'",
|
|
"o1-5": "'adjusted for renal function'"
|
|
},
|
|
{
|
|
"_id": "r1-5",
|
|
"i1-1": "'paracetamol'",
|
|
"i1-2": "false",
|
|
"i1-3": "",
|
|
"i1-4": "",
|
|
"i1-5": "",
|
|
"o1-1": "1000",
|
|
"o1-2": "'mg'",
|
|
"o1-3": "'6'",
|
|
"o1-4": "'oral'",
|
|
"o1-5": "'standard'"
|
|
},
|
|
{
|
|
"_id": "r1-6",
|
|
"i1-1": "'vancomycin'",
|
|
"i1-2": "",
|
|
"i1-3": "",
|
|
"i1-4": "true",
|
|
"i1-5": "",
|
|
"o1-1": "15 * weightKg * renalAdjustmentFactor",
|
|
"o1-2": "'mg'",
|
|
"o1-3": "'12'",
|
|
"o1-4": "'intravenous'",
|
|
"o1-5": "'adjusted for renal function'"
|
|
},
|
|
{
|
|
"_id": "r1-7",
|
|
"i1-1": "'vancomycin'",
|
|
"i1-2": "",
|
|
"i1-3": "",
|
|
"i1-4": "",
|
|
"i1-5": "",
|
|
"o1-1": "15 * weightKg",
|
|
"o1-2": "'mg'",
|
|
"o1-3": "'12'",
|
|
"o1-4": "'intravenous'",
|
|
"o1-5": "'standard'"
|
|
},
|
|
{
|
|
"_id": "r1-8",
|
|
"i1-1": "'warfarin'",
|
|
"i1-2": "",
|
|
"i1-3": "",
|
|
"i1-4": "",
|
|
"i1-5": "true",
|
|
"o1-1": "2 * liverAdjustmentFactor",
|
|
"o1-2": "'mg'",
|
|
"o1-3": "'24'",
|
|
"o1-4": "'oral'",
|
|
"o1-5": "'adjusted for liver function'"
|
|
},
|
|
{
|
|
"_id": "r1-9",
|
|
"i1-1": "'warfarin'",
|
|
"i1-2": "",
|
|
"i1-3": "true",
|
|
"i1-4": "",
|
|
"i1-5": "",
|
|
"o1-1": "3 * liverAdjustmentFactor",
|
|
"o1-2": "'mg'",
|
|
"o1-3": "'24'",
|
|
"o1-4": "'oral'",
|
|
"o1-5": "'adjusted for elderly'"
|
|
},
|
|
{
|
|
"_id": "r1-10",
|
|
"i1-1": "'warfarin'",
|
|
"i1-2": "",
|
|
"i1-3": "",
|
|
"i1-4": "",
|
|
"i1-5": "",
|
|
"o1-1": "5",
|
|
"o1-2": "'mg'",
|
|
"o1-3": "'24'",
|
|
"o1-4": "'oral'",
|
|
"o1-5": "'standard'"
|
|
}
|
|
],
|
|
"inputs": [
|
|
{
|
|
"id": "i1-1",
|
|
"name": "Medication",
|
|
"field": "medication"
|
|
},
|
|
{
|
|
"id": "i1-2",
|
|
"name": "Is Child",
|
|
"field": "isChild"
|
|
},
|
|
{
|
|
"id": "i1-3",
|
|
"name": "Is Elderly",
|
|
"field": "isElderly"
|
|
},
|
|
{
|
|
"id": "i1-4",
|
|
"name": "Has Renal Impairment",
|
|
"field": "hasRenalImpairment"
|
|
},
|
|
{
|
|
"id": "i1-5",
|
|
"name": "Has Liver Impairment",
|
|
"field": "hasLiverImpairment"
|
|
}
|
|
],
|
|
"outputs": [
|
|
{
|
|
"id": "o1-1",
|
|
"name": "Dose Amount",
|
|
"field": "calculatedDose.amount"
|
|
},
|
|
{
|
|
"id": "o1-2",
|
|
"name": "Dose Unit",
|
|
"field": "calculatedDose.unit"
|
|
},
|
|
{
|
|
"id": "o1-3",
|
|
"name": "Frequency (hours)",
|
|
"field": "calculatedDose.frequencyHours"
|
|
},
|
|
{
|
|
"id": "o1-4",
|
|
"name": "Route",
|
|
"field": "calculatedDose.route"
|
|
},
|
|
{
|
|
"id": "o1-5",
|
|
"name": "Adjustment Reason",
|
|
"field": "calculatedDose.adjustmentReason"
|
|
}
|
|
],
|
|
"passThrough": false,
|
|
"inputField": null,
|
|
"outputPath": null,
|
|
"executionMode": "single"
|
|
},
|
|
"id": "dt1",
|
|
"name": "calculateDosage",
|
|
"position": {
|
|
"x": 750,
|
|
"y": 114
|
|
}
|
|
}
|
|
],
|
|
"edges": [
|
|
{
|
|
"id": "ed1",
|
|
"sourceId": "ip1",
|
|
"targetId": "ex1",
|
|
"type": "edge"
|
|
},
|
|
{
|
|
"id": "ed2",
|
|
"sourceId": "ex1",
|
|
"targetId": "dt1",
|
|
"type": "edge"
|
|
}
|
|
]
|
|
} |