Limit minimum gestation to 23 weeks as per NICE thresholds

This commit is contained in:
RunasSudo 2024-08-27 17:13:23 +10:00
parent f8e26d4e4d
commit acb0aeffa8
Signed by: RunasSudo
GPG Key ID: 7234E476BF21C61A
3 changed files with 5 additions and 5 deletions

View File

@ -22,7 +22,7 @@
function plotGraphData() { function plotGraphData() {
let gestation = document.getElementById('gestation').valueAsNumber; let gestation = document.getElementById('gestation').valueAsNumber;
if (isNaN(gestation) || gestation < 22) { if (isNaN(gestation) || gestation < 23) {
chart.data.datasets[0].data = []; chart.data.datasets[0].data = [];
chart.data.datasets[1].data = []; chart.data.datasets[1].data = [];
} else { } else {
@ -145,7 +145,7 @@ function updateBilirubin() {
resultDiv.className = 'hidden'; resultDiv.className = 'hidden';
return; return;
} }
if (isNaN(gestation) || gestation < 22) { if (isNaN(gestation) || gestation < 23) {
resultDiv.className = 'hidden'; resultDiv.className = 'hidden';
return; return;
} }

View File

@ -46,7 +46,7 @@ function phototherapy_thresh(d, gestation) {
if (gestation >= 38) { if (gestation >= 38) {
return phototherapy_38wks(d); return phototherapy_38wks(d);
} }
if (gestation < 22) { if (gestation < 23) {
throw new Error('Invalid gestation'); throw new Error('Invalid gestation');
} }
if (d <= 0) { if (d <= 0) {
@ -63,7 +63,7 @@ function exchange_thresh(d, gestation) {
if (gestation >= 38) { if (gestation >= 38) {
return exchange_38wks(d); return exchange_38wks(d);
} }
if (gestation < 22) { if (gestation < 23) {
throw new Error('Invalid gestation'); throw new Error('Invalid gestation');
} }
if (d <= 0) { if (d <= 0) {

View File

@ -35,7 +35,7 @@
<div class="sm:grid sm:grid-cols-3"> <div class="sm:grid sm:grid-cols-3">
<label for="gestation" class="text-sm font-medium text-gray-900 pt-1.5">Gestational age:</label> <label for="gestation" class="text-sm font-medium text-gray-900 pt-1.5">Gestational age:</label>
<div class="col-span-2 relative rounded-md shadow-sm"> <div class="col-span-2 relative rounded-md shadow-sm">
<input id="gestation" type="number" value="38" min="22" onchange="plotGraphData();updateBilirubin()" class="w-full rounded-md border-0 py-1.5 pr-[8.8rem] text-gray-900 ring-1 ring-inset ring-gray-300 focus:ring-2 focus:ring-inset focus:ring-indigo-600 text-sm"> <input id="gestation" type="number" value="38" min="23" onchange="plotGraphData();updateBilirubin()" class="w-full rounded-md border-0 py-1.5 pr-[8.8rem] text-gray-900 ring-1 ring-inset ring-gray-300 focus:ring-2 focus:ring-inset focus:ring-indigo-600 text-sm">
<div class="pointer-events-none absolute inset-y-0 right-0 flex items-center pr-3"> <div class="pointer-events-none absolute inset-y-0 right-0 flex items-center pr-3">
<span class="text-gray-500 text-sm">completed weeks</span> <span class="text-gray-500 text-sm">completed weeks</span>
</div> </div>