And another approach via template (not view) and properties:
And then you could use queries to list all clients data!
Template
- template:: wetflag via props
template-list-as:: template
template-usage:: `:client [[client {|}]], :age "", :weight ""`
- ```typescript
``{
function weightFromAge(age) {
if (age <= 1) return [0.5 * age + 4, '(Age / 2) + 4']
if (age <= 5) return [2 * age + 8, '(Age × 2) + 8']
if (age <= 13) return [3 * age + 7, '(Age × 3) + 7']
if (age <= 16) return [4 * age + 2, '(Age × 4) + 2']
return 70
}
var age = Number(c.args.age)
var [weight, weightFormula] = weightFromAge(age)
if (c.args.weight) {
weight = Number(c.args.weight)
weightFormula = '[given]'
}
_}``
#work ``[c.args.client]``
Age:: ``age``years
Weight:: ``weight``kg
Energy:: ``4 * weight``J
Tube/Internal-Diameter:: ``age / 4 + 4``cm
Tube/Length-oral:: ``age / 2 + 12``cm
Tube/Length-nasal:: ``age / 2 + 15``cm
Fluids/Medical:: ``weight * 20``mls
Fluids/Trauma:: ``weight * 10``mls
Lorazepam:: ``weight * 0.1``mg
Adrenaline:: ``weight * 0.1``mls
Glucose:: ``weight * 2``mls
```