-
Notifications
You must be signed in to change notification settings - Fork 549
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed oxygen support option in respiratory support (#5261)
* not fixed yet * Added Oxygen Respiratory Support * small updates
- Loading branch information
1 parent
cecdce5
commit e47b65f
Showing
7 changed files
with
208 additions
and
140 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
126 changes: 2 additions & 124 deletions
126
...reRecording/VentilatorParametersEditor/CriticalCare__VentilatorParametersEditor__None.res
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,126 +1,4 @@ | ||
let str = React.string | ||
open CriticalCare__Types | ||
|
||
let ventilatorOxygenModality: array<Options.t> = [ | ||
{label: "Nasal Prongs", value: "NASAL_PRONGS", name: "oxygenModality"}, | ||
{label: "Simple Face Mask", value: "SIMPLE_FACE_MASK", name: "oxygenModality"}, | ||
{label: "Non Rebreathing Mask", value: "NON_REBREATHING_MASK", name: "oxygenModality"}, | ||
{label: "High Flow Nasal Cannula", value: "HIGH_FLOW_NASAL_CANNULA", name: "oxygenModality"}, | ||
] | ||
|
||
let silderOptionArray = [ | ||
{ | ||
"title": "FiO2 (%)", | ||
"start": "21", | ||
"end": "100", | ||
"interval": "10", | ||
"step": 1.0, | ||
"id": "ventilator_fi02", | ||
"min": 21.0, | ||
"max": 60.0, | ||
}, | ||
{ | ||
"title": "SPO2 (%)", | ||
"start": "0", | ||
"end": "100", | ||
"interval": "10", | ||
"step": 1.0, | ||
"id": "ventilator_spo2", | ||
"min": 90.0, | ||
"max": 100.0, | ||
}, | ||
] | ||
|
||
@react.component | ||
let make = (~state: VentilatorParameters.state, ~send: VentilatorParameters.action => unit) => { | ||
let getOxygenFlowRateLabel = switch state.ventilator_oxygen_modality { | ||
| NASAL_PRONGS => VentilatorParameters.getStatus(1.0, "Low", 4.0, "High") | ||
| SIMPLE_FACE_MASK => VentilatorParameters.getStatus(5.0, "Low", 10.0, "High") | ||
| NON_REBREATHING_MASK => VentilatorParameters.getStatus(11.0, "Low", 15.0, "High") | ||
| _ => VentilatorParameters.getStatus(0.0, "Low", 50.0, "High") | ||
} | ||
<div> | ||
<h4 className="mb-4"> {str("Oxygen Modality")} </h4> | ||
<CriticalCare__RadioButton | ||
defaultChecked={VentilatorParameters.encodeVentilatorOxygenModalityType( | ||
state.ventilator_oxygen_modality, | ||
)} | ||
onChange={e => { | ||
send( | ||
SetOxygenModality( | ||
VentilatorParameters.decodeVetilatorOxygenModalityType(ReactEvent.Form.target(e)["id"]), | ||
), | ||
) | ||
}} | ||
options={ventilatorOxygenModality} | ||
ishorizontal={false} | ||
/> | ||
{state.ventilator_oxygen_modality === HIGH_FLOW_NASAL_CANNULA | ||
? <Slider | ||
title={"Flow Rate"} | ||
start={"0"} | ||
end={"70"} | ||
interval={"5"} | ||
step={1.0} | ||
value={Belt.Int.toString( | ||
switch state.ventilator_oxygen_modality_flow_rate { | ||
| Some(value) => value | ||
| _ => 0 | ||
}, | ||
)} | ||
setValue={s => send(SetOxygenModalityFlowRate(Belt.Int.fromString(s)))} | ||
getLabel={VentilatorParameters.getStatus(35.0, "Low", 60.0, "High")} | ||
hasError={ValidationUtils.isInputInRangeInt(0, 70, state.ventilator_oxygen_modality_flow_rate)} | ||
/> | ||
: <Slider | ||
title={"Oxygen Flow Rate"} | ||
start={"0"} | ||
end={"50"} | ||
interval={"5"} | ||
step={1.0} | ||
value={Belt.Int.toString( | ||
switch state.ventilator_oxygen_modality_oxygen_rate { | ||
| Some(value) => value | ||
| _ => 0 | ||
}, | ||
)} | ||
setValue={s => send(SetOxygenModalityOxygenRate(Belt.Int.fromString(s)))} | ||
getLabel={getOxygenFlowRateLabel} | ||
hasError={ValidationUtils.isInputInRangeInt(0, 50, state.ventilator_oxygen_modality_oxygen_rate)} | ||
/>} | ||
{silderOptionArray | ||
|> Array.map(option => { | ||
let value: option<int> = switch option["id"] { | ||
| "ventilator_oxygen_modality_flow_rate" => state.ventilator_oxygen_modality_flow_rate | ||
| "ventilator_fi02" => state.ventilator_fi02 | ||
| "ventilator_spo2" => state.ventilator_spo2 | ||
| _ => None | ||
} | ||
let handleChange: option<int> => VentilatorParameters.action = s => | ||
switch option["id"] { | ||
| "ventilator_fi02" => SetFIO2(s) | ||
| "ventilator_spo2" => SetSPO2(s) | ||
} | ||
let className = option["id"] === "ventilator_fi02" && state.ventilator_oxygen_modality !== HIGH_FLOW_NASAL_CANNULA ? "hidden" : "" | ||
<Slider | ||
className | ||
key={`none-${option["id"]}`} | ||
title={option["title"]} | ||
start={option["start"]} | ||
end={option["end"]} | ||
interval={option["interval"]} | ||
step={option["step"]} | ||
value={Belt.Int.toString( | ||
switch value { | ||
| Some(value) => value | ||
| _ => Pervasives.int_of_string(option["start"]) | ||
}, | ||
)} | ||
setValue={s => send(handleChange(Belt.Int.fromString(s)))} | ||
getLabel={VentilatorParameters.getStatus(option["min"], "Low", option["max"], "High")} | ||
hasError={ValidationUtils.isInputInRangeFloat(option["start"], option["end"], Some(Belt.Int.toFloat(switch value { | None => Pervasives.int_of_string(option["start"]) | Some(v) => v })))} | ||
/> | ||
}) | ||
|> React.array} | ||
</div> | ||
let make = () => { | ||
<div /> | ||
} |
149 changes: 149 additions & 0 deletions
149
...ng/VentilatorParametersEditor/CriticalCare__VentilatorParametersEditor__OxygenSupport.res
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,149 @@ | ||
let str = React.string | ||
open CriticalCare__Types | ||
|
||
let ventilatorOxygenModality: array<Options.t> = [ | ||
{label: "Nasal Prongs", value: "NASAL_PRONGS", name: "oxygenModality"}, | ||
{label: "Simple Face Mask", value: "SIMPLE_FACE_MASK", name: "oxygenModality"}, | ||
{label: "Non Rebreathing Mask", value: "NON_REBREATHING_MASK", name: "oxygenModality"}, | ||
{label: "High Flow Nasal Cannula", value: "HIGH_FLOW_NASAL_CANNULA", name: "oxygenModality"}, | ||
] | ||
|
||
let silderOptionArray = [ | ||
{ | ||
"title": "FiO2 (%)", | ||
"start": "21", | ||
"end": "100", | ||
"interval": "10", | ||
"step": 1.0, | ||
"id": "ventilator_fi02", | ||
"min": 21.0, | ||
"max": 60.0, | ||
}, | ||
{ | ||
"title": "SPO2 (%)", | ||
"start": "0", | ||
"end": "100", | ||
"interval": "10", | ||
"step": 1.0, | ||
"id": "ventilator_spo2", | ||
"min": 90.0, | ||
"max": 100.0, | ||
}, | ||
] | ||
|
||
@react.component | ||
let make = (~state: VentilatorParameters.state, ~send: VentilatorParameters.action => unit) => { | ||
let getOxygenFlowRateLabel = switch state.ventilator_oxygen_modality { | ||
| NASAL_PRONGS => VentilatorParameters.getStatus(1.0, "Low", 4.0, "High") | ||
| SIMPLE_FACE_MASK => VentilatorParameters.getStatus(5.0, "Low", 10.0, "High") | ||
| NON_REBREATHING_MASK => VentilatorParameters.getStatus(11.0, "Low", 15.0, "High") | ||
| _ => VentilatorParameters.getStatus(0.0, "Low", 50.0, "High") | ||
} | ||
<div> | ||
<h4 className="mb-4"> {str("Oxygen Modality")} </h4> | ||
<CriticalCare__RadioButton | ||
defaultChecked={VentilatorParameters.encodeVentilatorOxygenModalityType( | ||
state.ventilator_oxygen_modality, | ||
)} | ||
onChange={e => { | ||
send( | ||
SetOxygenModality( | ||
VentilatorParameters.decodeVetilatorOxygenModalityType(ReactEvent.Form.target(e)["id"]), | ||
), | ||
) | ||
}} | ||
options={ventilatorOxygenModality} | ||
ishorizontal={false} | ||
/> | ||
{state.ventilator_oxygen_modality === HIGH_FLOW_NASAL_CANNULA | ||
? <Slider | ||
title={"Flow Rate"} | ||
start={"0"} | ||
end={"70"} | ||
interval={"5"} | ||
step={1.0} | ||
value={Belt.Int.toString( | ||
switch state.ventilator_oxygen_modality_flow_rate { | ||
| Some(value) => value | ||
| _ => 0 | ||
}, | ||
)} | ||
setValue={s => send(SetOxygenModalityFlowRate(Belt.Int.fromString(s)))} | ||
getLabel={VentilatorParameters.getStatus(35.0, "Low", 60.0, "High")} | ||
hasError={ValidationUtils.isInputInRangeInt( | ||
0, | ||
70, | ||
state.ventilator_oxygen_modality_flow_rate, | ||
)} | ||
/> | ||
: <Slider | ||
title={"Oxygen Flow Rate"} | ||
start={"0"} | ||
end={"50"} | ||
interval={"5"} | ||
step={1.0} | ||
value={Belt.Int.toString( | ||
switch state.ventilator_oxygen_modality_oxygen_rate { | ||
| Some(value) => value | ||
| _ => 0 | ||
}, | ||
)} | ||
setValue={s => send(SetOxygenModalityOxygenRate(Belt.Int.fromString(s)))} | ||
getLabel={getOxygenFlowRateLabel} | ||
hasError={ValidationUtils.isInputInRangeInt( | ||
0, | ||
50, | ||
state.ventilator_oxygen_modality_oxygen_rate, | ||
)} | ||
/>} | ||
{silderOptionArray | ||
|> Array.map(option => { | ||
let value: option<int> = switch option["id"] { | ||
| "ventilator_oxygen_modality_flow_rate" => state.ventilator_oxygen_modality_flow_rate | ||
| "ventilator_fi02" => state.ventilator_fi02 | ||
| "ventilator_spo2" => state.ventilator_spo2 | ||
| _ => None | ||
} | ||
let handleChange: option<int> => VentilatorParameters.action = s => | ||
switch option["id"] { | ||
| "ventilator_fi02" => SetFIO2(s) | ||
| "ventilator_spo2" => SetSPO2(s) | ||
} | ||
let className = | ||
option["id"] === "ventilator_fi02" && | ||
state.ventilator_oxygen_modality !== HIGH_FLOW_NASAL_CANNULA | ||
? "hidden" | ||
: "" | ||
<Slider | ||
className | ||
key={`none-${option["id"]}`} | ||
title={option["title"]} | ||
start={option["start"]} | ||
end={option["end"]} | ||
interval={option["interval"]} | ||
step={option["step"]} | ||
value={Belt.Int.toString( | ||
switch value { | ||
| Some(value) => value | ||
| _ => Pervasives.int_of_string(option["start"]) | ||
}, | ||
)} | ||
setValue={s => send(handleChange(Belt.Int.fromString(s)))} | ||
getLabel={VentilatorParameters.getStatus(option["min"], "Low", option["max"], "High")} | ||
hasError={ValidationUtils.isInputInRangeFloat( | ||
option["start"], | ||
option["end"], | ||
Some( | ||
Belt.Int.toFloat( | ||
switch value { | ||
| None => Pervasives.int_of_string(option["start"]) | ||
| Some(v) => v | ||
}, | ||
), | ||
), | ||
)} | ||
/> | ||
}) | ||
|> React.array} | ||
</div> | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.