Add nursing assessment packs, ward board, and nurse performance KPIs.
Deploy Ladill Care / deploy (push) Successful in 55s
Deploy Ladill Care / deploy (push) Successful in 55s
Seeds NEWS2/Braden/Morse/pain packs with visit vitals and a unit dashboard for MAR, assessments, notes, and handover activity. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -80,16 +80,48 @@ class ScoringService
|
||||
}
|
||||
|
||||
if (str_starts_with($strategy, 'custom:')) {
|
||||
return $this->customScore($assessment, substr($strategy, 7));
|
||||
$result = $this->customScore($assessment, substr($strategy, 7));
|
||||
} else {
|
||||
$result = match ($strategy) {
|
||||
'sum_items' => $this->sumItems($assessment),
|
||||
'single_value' => $this->singleValue($assessment),
|
||||
default => throw ValidationException::withMessages([
|
||||
'scoring' => "Unknown scoring strategy [{$strategy}].",
|
||||
]),
|
||||
};
|
||||
}
|
||||
|
||||
return match ($strategy) {
|
||||
'sum_items' => $this->sumItems($assessment),
|
||||
'single_value' => $this->singleValue($assessment),
|
||||
default => throw ValidationException::withMessages([
|
||||
'scoring' => "Unknown scoring strategy [{$strategy}].",
|
||||
]),
|
||||
};
|
||||
$result['severity_label'] = $result['severity_label']
|
||||
?? $this->severityFromBands($assessment->template?->meta, $result['total'] ?? null);
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array<string, mixed>|null $meta
|
||||
*/
|
||||
protected function severityFromBands(?array $meta, mixed $total): ?string
|
||||
{
|
||||
if ($total === null || ! is_numeric($total)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$bands = $meta['severity_bands'] ?? null;
|
||||
if (! is_array($bands) || $bands === []) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$score = (float) $total;
|
||||
foreach ($bands as $band) {
|
||||
if (! is_array($band) || ! isset($band['max'], $band['label'])) {
|
||||
continue;
|
||||
}
|
||||
if ($score <= (float) $band['max']) {
|
||||
return (string) $band['label'];
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user