-
-
-
-
diff --git a/src/Components/Common/components/SkeletonLoading.res b/src/Components/Common/components/SkeletonLoading.res
deleted file mode 100644
index 71f4f11df91..00000000000
--- a/src/Components/Common/components/SkeletonLoading.res
+++ /dev/null
@@ -1,144 +0,0 @@
-let card = (~className="", ()) =>
-
-
-let smallCard = () =>
-
-
-let userCard = () =>
-
-
-let heading = () =>
-
-
-let profileCard = () =>
-
-
-let image = () =>
-
-
-let courseCard = () =>
-
-
-let paragraph = () =>
-
-
-let contents = () =>
-
-
-let pageLoad = () =>
-
-
-let multiple = (~count, ~element) =>
- Array.make(count, element)
- |> Array.mapi((key, element) =>
string_of_int}> element
)
- |> React.array
diff --git a/src/Components/Common/prescription-builder/types/Prescription__Prescription.res b/src/Components/Common/prescription-builder/types/Prescription__Prescription.res
deleted file mode 100644
index 97c42c6257f..00000000000
--- a/src/Components/Common/prescription-builder/types/Prescription__Prescription.res
+++ /dev/null
@@ -1,75 +0,0 @@
-@genType
-type t = {
- medicine: string,
- dosage: string,
- days: int,
- dosage_new : string,
- route : string,
- notes : string
-}
-
-let medicine = t => t.medicine
-let dosage = t => t.dosage
-let days = t => t.days
-let dosage_new = t => t.dosage_new
-let route = t => t.route
-let notes = t => t.notes
-
-let make = (medicine, dosage, days, dosage_new, route, notes) => {
- medicine: medicine,
- dosage: dosage,
- days: days,
- route : route,
- notes : notes,
- dosage_new : dosage_new
-}
-
-let empty = () => {
- medicine: "",
- route: "",
- dosage: "",
- dosage_new: "0 mg",
- days: 0,
- notes: ""
-}
-
-let updateMedicine = (medicine, t) => {...t, medicine: medicine}
-let updateDosage = (dosage, t) => {...t, dosage: dosage}
-let updateDays = (days, t) => {...t, days: days}
-let updateDosageNew = (dosage, t) => {...t, dosage_new: dosage}
-let updateRoute = (route, t) => {...t, route: route}
-let updateNotes = (notes, t) => {...t, notes: notes}
-
-let decode = json => {
- open Json.Decode
- {
- medicine: json |> field("medicine", string),
- dosage: json |> field("dosage", string),
- days: json |> field("days", int),
- route: json |> field("route", string),
- dosage_new: json |> field("dosage_new", string),
- notes: json |> field("notes", string),
- }
-}
-
-let encode = t => {
- open Json.Encode
- object_(list{
- ("medicine", t.medicine |> string),
- ("dosage", t.dosage |> string),
- ("dosage_new", t.dosage_new |> string),
- ("route", t.route |> string),
- ("notes", t.notes |> string),
- ("days", t.days |> int),
- })
-}
-
-let encodeArray = prescriptions =>
- prescriptions |> {
- open Json.Encode
- array(encode)
- }
-
-let makeFromJs = json => {
- Js.Array.isArray(json) ? Js.Array.map(p => make(p["medicine"], p["dosage"], p["days"], p["dosage_new"], p["route"], p["notes"]), json) : []
-}
diff --git a/src/Components/Common/utils/ArrayUtils.res b/src/Components/Common/utils/ArrayUtils.res
deleted file mode 100644
index c5f55b7b9e5..00000000000
--- a/src/Components/Common/utils/ArrayUtils.res
+++ /dev/null
@@ -1,44 +0,0 @@
-exception UnsafeFindFailed(string)
-
-let copyAndSort = (f, t) => {
- let cp = Js.Array.copy(t)
- Js.Array.sortInPlaceWith(f, cp)
-}
-
-let copyAndPush = (e, t) => {
- let copy = Js.Array.copy(t)
- Js.Array.push(e, copy) |> ignore
- copy
-}
-
-let isEmpty = a => Js.Array.length(a) == 0
-
-let isNotEmpty = a => !isEmpty(a)
-
-let replaceWithIndex = (i, t, l) => Js.Array.mapi((a, index) => index == i ? t : a, l)
-
-let flatten = a => a |> Js.Array.reduce((flat, next) => flat |> Js.Array.concat(next), [])
-
-let sort_uniq = (f, t) => t |> Array.to_list |> List.sort_uniq(f) |> Array.of_list
-
-let getOpt = (a, i) =>
- try Some(a |> Array.get(i)) catch {
- | Not_found => None
- }
-
-let swapUp = (i, t) =>
- if i <= 0 || i >= (t |> Array.length) {
- t
- } else {
- let copy = Js.Array.copy(t)
-
- copy[i] = t[i - 1]
- copy[i - 1] = t[i]
- copy
- }
-
-let swapDown = (i, t) => swapUp(i + 1, t)
-
-let last = t => t->Js.Array.unsafe_get(Js.Array.length(t) - 1)
-
-let findAndReplace = (index, f, array) => array |> Array.mapi((i, p) => i == index ? f(p) : p)
diff --git a/src/Components/Common/utils/DateFns.res b/src/Components/Common/utils/DateFns.res
deleted file mode 100644
index 4fa70abb144..00000000000
--- a/src/Components/Common/utils/DateFns.res
+++ /dev/null
@@ -1,129 +0,0 @@
-type locale
-
-@deriving(abstract)
-type formatDistanceOptions = {
- @optional
- includeSeconds: bool,
- @optional
- addSuffix: bool,
- @optional
- locale: locale,
-}
-
-@deriving(abstract)
-type formatDistanceStrictOptions = {
- @optional
- addSuffix: bool,
- @optional
- unit: string,
- @optional
- roundingMethod: string,
- @optional
- locale: locale,
-}
-
-// TODO: This function should return the user's actual / selected timezone.
-let currentTimeZone = () => "Asia/Kolkata"
-
-// TODO: This function should return either "HH:mm", or "h:mm a" depending on user's preferred time format.
-let selectedTimeFormat = () => "HH:mm"
-
-@module("date-fns")
-external formatDistanceOpt: (Js.Date.t, Js.Date.t, formatDistanceOptions) => string =
- "formatDistance"
-
-@module("date-fns")
-external formatDistanceStrictOpt: (Js.Date.t, Js.Date.t, formatDistanceStrictOptions) => string =
- "formatDistanceStrict"
-
-@module("date-fns")
-external formatDistanceToNowOpt: (Js.Date.t, formatDistanceOptions) => string =
- "formatDistanceToNow"
-
-@module("date-fns")
-external formatDistanceToNowStrictOpt: (Js.Date.t, formatDistanceStrictOptions) => string =
- "formatDistanceToNowStrict"
-
-let formatDistance = (date, baseDate, ~includeSeconds=false, ~addSuffix=false, ()) => {
- let options = formatDistanceOptions(~includeSeconds, ~addSuffix, ())
- formatDistanceOpt(date, baseDate, options)
-}
-
-let formatDistanceStrict = (
- date,
- baseDate,
- ~addSuffix=false,
- ~unit=?,
- ~roundingMethod="round",
- (),
-) => {
- let options = formatDistanceStrictOptions(~addSuffix, ~unit?, ~roundingMethod, ())
- formatDistanceStrictOpt(date, baseDate, options)
-}
-
-let formatDistanceToNow = (date, ~includeSeconds=false, ~addSuffix=false, ()) => {
- let options = formatDistanceOptions(~includeSeconds, ~addSuffix, ())
- formatDistanceToNowOpt(date, options)
-}
-
-let formatDistanceToNowStrict = (date, ~addSuffix=false, ~unit=?, ~roundingMethod="round", ()) => {
- let options = formatDistanceStrictOptions(~addSuffix, ~unit?, ~roundingMethod, ())
-
- formatDistanceToNowStrictOpt(date, options)
-}
-
-@deriving(abstract)
-type formatOptions = {
- timeZone: string,
- @optional
- locale: locale,
- @optional
- weekStartsOn: int,
- @optional
- firstWeekContainsDate: int,
- @optional
- useAdditionalWeekYearTokens: bool,
- @optional
- useAdditionalDayOfYearTokens: bool,
-}
-
-@module("date-fns-tz")
-external formatTz: (Js.Date.t, string, formatOptions) => string = "format"
-
-let format = (date, fmt) => {
- let timeZone = currentTimeZone()
-
- // Since the passed date is not time-zone-sensitive, we need to pass the
- // time-zone here so that the user's timezone is displayed in the generated
- // string.
- formatTz(date, fmt, formatOptions(~timeZone, ()))
-}
-
-let formatPreset = (date, ~short=false, ~year=false, ~time=false, ()) => {
- let leading = short ? "MMM d" : "MMMM d"
- let middle = year ? ", yyyy" : ""
- let trailing = time ? " " ++ selectedTimeFormat() : ""
-
- format(date, leading ++ (middle ++ trailing))
-}
-
-@module("date-fns")
-external decodeISOJs: Js.Json.t => Js.Date.t = "parseISO"
-
-let decodeISO = json =>
- if Js.typeof(json) == "string" {
- decodeISOJs(json)
- } else {
- raise(Json.Decode.DecodeError("Expected string, got " ++ Js.typeof(json)))
- }
-
-let encodeISO = date => Js.Date.toISOString(date)->Js.Json.string
-
-@module("date-fns") external parseISO: string => Js.Date.t = "parseISO"
-
-@module("date-fns") external isPast: Js.Date.t => bool = "isPast"
-
-@module("date-fns") external isFuture: Js.Date.t => bool = "isFuture"
-
-@module("date-fns")
-external differenceInSeconds: (Js.Date.t, Js.Date.t) => int = "differenceInSeconds"
diff --git a/src/Components/Common/utils/DictUtils.res b/src/Components/Common/utils/DictUtils.res
deleted file mode 100644
index 748ceed51c7..00000000000
--- a/src/Components/Common/utils/DictUtils.res
+++ /dev/null
@@ -1,26 +0,0 @@
-let setOptionalString = (key, value, payload) => {
- if String.trim(value) !== "" {
- Js.Dict.set(payload, key, Js.Json.string(value))
- }
-}
-
-let setOptionalNumber = (key, value, payload) => {
- switch value {
- | Some(v) => Js.Dict.set(payload, key, Js.Json.number(float_of_int(v)))
- | None => Js.Dict.set(payload, key, Js.Json.null)
- }
-}
-
-let setOptionalFloat = (key, value, payload) => {
- switch value {
- | Some(v) => Js.Dict.set(payload, key, Js.Json.number(v))
- | None => Js.Dict.set(payload, key, Js.Json.null)
- }
-}
-
-let setOptionalBool = (key, value, payload) => {
- switch value {
- | Some(v) => Js.Dict.set(payload, key, Js.Json.boolean(v))
- | None => Js.Dict.set(payload, key, Js.Json.null)
- }
-}
diff --git a/src/Components/Common/utils/ReactUtils.res b/src/Components/Common/utils/ReactUtils.res
deleted file mode 100644
index c83a85853d4..00000000000
--- a/src/Components/Common/utils/ReactUtils.res
+++ /dev/null
@@ -1,3 +0,0 @@
-let nullUnless = (element, condition) => condition ? element : React.null
-
-let nullIf = (element, condition) => nullUnless(element, !condition)
diff --git a/src/Components/Common/utils/ValidationUtils.res b/src/Components/Common/utils/ValidationUtils.res
deleted file mode 100644
index 61a79fbffa2..00000000000
--- a/src/Components/Common/utils/ValidationUtils.res
+++ /dev/null
@@ -1,22 +0,0 @@
-let isInputInRangeFloat = (minString, maxString, val) => {
- let min = Js.Float.fromString(minString)
- let max = Js.Float.fromString(maxString)
- let value = Js.Option.getWithDefault(min, val)
- if value < min || value > max {
- Some("Input outside range")
- } else {
- None
- }
-}
-
-let isInputInRangeInt = (min, max, val) => {
- switch val {
- | Some(value) =>
- switch (value < min, value > max) {
- | (true, _) => Some("Input less than " ++ string_of_int(min))
- | (_, true) => Some("Input greater than maximum")
- | _ => None
- }
- | None => None
- }
-}
diff --git a/src/Components/Common/utils/WindowUtils.res b/src/Components/Common/utils/WindowUtils.res
deleted file mode 100644
index e8eb1ceb4dc..00000000000
--- a/src/Components/Common/utils/WindowUtils.res
+++ /dev/null
@@ -1,9 +0,0 @@
-let confirm = (~onCancel=?, message, f) =>
- if {
- open Webapi.Dom
- window -> Window.confirm(message)
- } {
- f()
- } else {
- Belt.Option.mapWithDefault(onCancel, (), onCancel => onCancel())
- }
diff --git a/src/Components/CriticalCareRecording/ABGAnalysisEditor/CriticalCare__ABGAnalysisEditor.res b/src/Components/CriticalCareRecording/ABGAnalysisEditor/CriticalCare__ABGAnalysisEditor.res
deleted file mode 100644
index c3e5a6e7025..00000000000
--- a/src/Components/CriticalCareRecording/ABGAnalysisEditor/CriticalCare__ABGAnalysisEditor.res
+++ /dev/null
@@ -1,216 +0,0 @@
-open CriticalCare__Types
-let str = React.string
-
-@module("../CriticalCare__API")
-external updateDailyRound: (string, string, Js.Json.t, _ => unit, _ => unit) => unit =
- "updateDailyRound"
-
-let string_of_float = data => Belt.Option.mapWithDefault(data, "", Js.Float.toString)
-let string_of_int = data => Belt.Option.mapWithDefault(data, "", Js.Int.toString)
-let int_of_string = data => data->Belt.Int.fromString
-let float_of_string = data => data->Belt.Float.fromString
-
-type state = {
- po2: option
,
- pco2: option,
- pH: option,
- hco3: option,
- baseExcess: option,
- lactate: option,
- sodium: option,
- potassium: option,
- dirty: bool,
- saving: bool,
-}
-
-type action =
- | SetPO2(option)
- | SetPCO2(option)
- | SetpH(option)
- | SetHCO3(option)
- | SetBaseExcess(option)
- | SetLactate(option)
- | SetSodium(option)
- | SetPotassium(option)
- | SetSaving
- | ClearSaving
-
-let reducer = (state, action) => {
- switch action {
- | SetPO2(po2) => {...state, po2: po2, dirty: true}
- | SetPCO2(pco2) => {...state, pco2: pco2, dirty: true}
- | SetpH(pH) => {...state, pH: pH, dirty: true}
- | SetHCO3(hco3) => {...state, hco3: hco3, dirty: true}
- | SetBaseExcess(baseExcess) => {...state, baseExcess: baseExcess, dirty: true}
- | SetLactate(lactate) => {...state, lactate: lactate, dirty: true}
- | SetSodium(sodium) => {...state, sodium: sodium, dirty: true}
- | SetPotassium(potassium) => {...state, potassium: potassium, dirty: true}
- | SetSaving => {...state, saving: true}
- | ClearSaving => {...state, saving: false}
- }
-}
-
-let initialState = abg => {
- {
- po2: ABGAnalysis.po2(abg),
- pco2: ABGAnalysis.pco2(abg),
- pH: ABGAnalysis.pH(abg),
- hco3: ABGAnalysis.hco3(abg),
- baseExcess: ABGAnalysis.baseExcess(abg),
- lactate: ABGAnalysis.lactate(abg),
- sodium: ABGAnalysis.sodium(abg),
- potassium: ABGAnalysis.potassium(abg),
- saving: false,
- dirty: false,
- }
-}
-
-let makePayload = state => {
- let payload = Js.Dict.empty()
- DictUtils.setOptionalNumber("po2", state.po2, payload)
- DictUtils.setOptionalNumber("pco2", state.pco2, payload)
- DictUtils.setOptionalFloat("ph", state.pH, payload)
- DictUtils.setOptionalFloat("hco3", state.hco3, payload)
- DictUtils.setOptionalNumber("base_excess", state.baseExcess, payload)
- DictUtils.setOptionalFloat("lactate", state.lactate, payload)
- DictUtils.setOptionalFloat("sodium", state.sodium, payload)
- DictUtils.setOptionalFloat("potassium", state.potassium, payload)
- payload
-}
-
-let successCB = (send, updateCB, data) => {
- send(ClearSaving)
- updateCB(CriticalCare__DailyRound.makeFromJs(data))
-}
-
-let errorCB = (send, _error) => {
- send(ClearSaving)
-}
-
-let saveData = (id, consultationId, state, send, updateCB) => {
- send(SetSaving)
- updateDailyRound(
- consultationId,
- id,
- Js.Json.object_(makePayload(state)),
- successCB(send, updateCB),
- errorCB(send),
- )
-}
-
-let getStatus = (min, minText, max, maxText, val) => {
- if val >= min && val <= max {
- ("Normal", "#059669")
- } else if val < min {
- (minText, "#DC2626")
- } else {
- (maxText, "#DC2626")
- }
-}
-
-
-
-@react.component
-let make = (~arterialBloodGasAnalysis, ~updateCB, ~id, ~consultationId) => {
- let (state, send) = React.useReducer(reducer, initialState(arterialBloodGasAnalysis))
-
-
-
-
- send(SetPO2(int_of_string(s)))}
- getLabel={getStatus(50.0, "Low", 200.0, "High")}
- hasError={ValidationUtils.isInputInRangeInt(10, 400, state.po2)}
- />
- send(SetPCO2(int_of_string(s)))}
- getLabel={getStatus(35.0, "Low", 45.0, "High")}
- hasError={ValidationUtils.isInputInRangeInt(10, 200, state.pco2)}
- />
- send(SetpH(float_of_string(s)))}
- getLabel={getStatus(7.35, "Low", 7.45, "High")}
- hasError={ValidationUtils.isInputInRangeFloat("0.0", "10.0", state.pH)}
- />
- send(SetHCO3(float_of_string(s)))}
- getLabel={getStatus(22.0, "Low", 26.0, "High")}
- hasError={ValidationUtils.isInputInRangeFloat("5.0", "80.0", state.hco3)}
- />
- send(SetBaseExcess(int_of_string(s)))}
- getLabel={getStatus(-2.0, "Low", 2.0, "High")}
- hasError={ValidationUtils.isInputInRangeInt(-20, 20, state.baseExcess)}
- />
- send(SetLactate(float_of_string(s)))}
- getLabel={getStatus(0.0, "Low", 2.0, "High")}
- hasError={ValidationUtils.isInputInRangeFloat("0.0", "20.0", state.lactate)}
- />
- send(SetSodium(float_of_string(s)))}
- getLabel={getStatus(135.0, "Low", 145.0, "High")}
- hasError={ValidationUtils.isInputInRangeFloat("100.0", "170.0", state.sodium)}
- />
- send(SetPotassium(float_of_string(s)))}
- getLabel={getStatus(3.5, "Low", 5.5, "High")}
- hasError={ValidationUtils.isInputInRangeFloat("1.0", "10.0", state.potassium)}
- />
-
-
-
-}
diff --git a/src/Components/CriticalCareRecording/ABGAnalysisEditor/DailyRound__ABG.res b/src/Components/CriticalCareRecording/ABGAnalysisEditor/DailyRound__ABG.res
deleted file mode 100644
index 82b7e25f7e9..00000000000
--- a/src/Components/CriticalCareRecording/ABGAnalysisEditor/DailyRound__ABG.res
+++ /dev/null
@@ -1,68 +0,0 @@
-let str = React.string
-open CriticalCare__Types
-
-@react.component
-let make = (
- ~arterialBloodGasAnalysis,
- ~renderOptionalIntWithIndicators,
- ~renderOptionalFloatWithIndicators,
-) => {
-
- {renderOptionalIntWithIndicators(
- "PO2",
- ABGAnalysis.po2(arterialBloodGasAnalysis),
- 35,
- 45,
- "Low",
- "High",
- )}
- {renderOptionalFloatWithIndicators(
- "pH",
- ABGAnalysis.pH(arterialBloodGasAnalysis),
- 7.35,
- 7.45,
- "Low",
- "High",
- )}
- {renderOptionalFloatWithIndicators(
- "HCO3",
- ABGAnalysis.hco3(arterialBloodGasAnalysis),
- 22.0,
- 26.0,
- "Low",
- "High",
- )}
- {renderOptionalIntWithIndicators(
- "Base Excess",
- ABGAnalysis.baseExcess(arterialBloodGasAnalysis),
- -2,
- 2,
- "Low",
- "High",
- )}
- {renderOptionalFloatWithIndicators(
- "Lactate",
- ABGAnalysis.lactate(arterialBloodGasAnalysis),
- 0.0,
- 2.0,
- "Low",
- "High",
- )}
- {renderOptionalFloatWithIndicators(
- "Sodium",
- ABGAnalysis.sodium(arterialBloodGasAnalysis),
- 135.0,
- 145.0,
- "Low",
- "High",
- )}
- {renderOptionalFloatWithIndicators(
- "Potassium",
- ABGAnalysis.potassium(arterialBloodGasAnalysis),
- 3.5,
- 5.5,
- "Low",
- "High",
- )}
-
-}
diff --git a/src/Components/CriticalCareRecording/BloodSugarEditor/CriticalCare_BloodSugarEditor.res b/src/Components/CriticalCareRecording/BloodSugarEditor/CriticalCare_BloodSugarEditor.res
deleted file mode 100644
index 65db7a1bbf8..00000000000
--- a/src/Components/CriticalCareRecording/BloodSugarEditor/CriticalCare_BloodSugarEditor.res
+++ /dev/null
@@ -1,144 +0,0 @@
-let str = React.string
-open CriticalCare__Types
-
-@module("../CriticalCare__API")
-external updateDailyRound: (string, string, Js.Json.t, _ => unit, _ => unit) => unit =
- "updateDailyRound"
-
-type state = {
- blood_sugar_level: option,
- insulin_intake_dose: option,
- insulin_intake_frequency: BloodSugar.frequency,
- dirty: bool,
- saving: bool,
-}
-
-type action =
- | SetBloodSugarLevel(int)
- | SetDosage(float)
- | SetFrequency(BloodSugar.frequency)
- | SetSaving
- | ClearSaving
-
-let reducer = (state, action) => {
- switch action {
- | SetBloodSugarLevel(blood_sugar_level) => {
- ...state,
- blood_sugar_level: Some(blood_sugar_level),
- dirty: true,
- }
- | SetDosage(dosage) => {...state, insulin_intake_dose: Some(dosage), dirty: true}
- | SetFrequency(frequency) => {...state, insulin_intake_frequency: frequency, dirty: true}
- | SetSaving => {...state, saving: true}
- | ClearSaving => {...state, saving: false}
- }
-}
-
-let getStatus = (min, max, val) => {
- if val >= min && val <= max {
- ("Normal", "#059669")
- } else if val < min {
- ("Low", "#DC2626")
- } else {
- ("High", "#DC2626")
- }
-}
-
-let initialState = bloodsugarParameters => {
- {
- blood_sugar_level: BloodSugar.bloodsugar_level(bloodsugarParameters),
- insulin_intake_dose: BloodSugar.dosage(bloodsugarParameters),
- insulin_intake_frequency: BloodSugar.frequency(bloodsugarParameters),
- saving: false,
- dirty: false,
- }
-}
-
-let makePayload = state => {
- let payload = Js.Dict.empty()
-
- DictUtils.setOptionalNumber("blood_sugar_level", state.blood_sugar_level, payload)
- DictUtils.setOptionalFloat("insulin_intake_dose", state.insulin_intake_dose, payload)
- Js.Dict.set(
- payload,
- "insulin_intake_frequency",
- Js.Json.string(BloodSugar.encodeFrequency(state.insulin_intake_frequency)),
- )
- payload
-}
-
-let successCB = (send, updateCB, data) => {
- send(ClearSaving)
- updateCB(CriticalCare__DailyRound.makeFromJs(data))
-}
-
-let errorCB = (send, _error) => {
- send(ClearSaving)
-}
-
-let saveData = (id, consultationId, state, send, updateCB) => {
- send(SetSaving)
- updateDailyRound(
- consultationId,
- id,
- Js.Json.object_(makePayload(state)),
- successCB(send, updateCB),
- errorCB(send),
- )
-}
-
-@react.component
-let make = (~bloodsugarParameters, ~updateCB, ~id, ~consultationId) => {
- let (state, send) = React.useReducer(reducer, initialState(bloodsugarParameters))
-
-
-
{str("Blood Sugar")}
-
-
send(SetBloodSugarLevel(int_of_string(s)))}
- getLabel={getStatus(70.0, 110.0)}
- hasError={ValidationUtils.isInputInRangeInt(0, 700, state.blood_sugar_level)}
- />
- {str("Insulin Intake")}
- send(SetDosage(float_of_string(s)))}
- getLabel={_ => ("", "#ff0000")}
- hasError={ValidationUtils.isInputInRangeFloat("0", "100", state.insulin_intake_dose)}
- />
-
-
-
- {Js.Array.map(
- f =>
- send(SetFrequency(f))}
- />,
- [OD, BD, TD, UNKNOWN],
- )->React.array}
-
-
-
-
-
-}
diff --git a/src/Components/CriticalCareRecording/BloodSugarEditor/DailyRound__BloodSugar.res b/src/Components/CriticalCareRecording/BloodSugarEditor/DailyRound__BloodSugar.res
deleted file mode 100644
index c650e27284d..00000000000
--- a/src/Components/CriticalCareRecording/BloodSugarEditor/DailyRound__BloodSugar.res
+++ /dev/null
@@ -1,18 +0,0 @@
-let str = React.string
-open CriticalCare__Types
-
-@react.component
-let make = (~bloodSugar, ~renderLine, ~renderOptionalIntWithIndicators, ~renderOptionalFloat) => {
-
- {renderOptionalIntWithIndicators(
- "Blood Sugar Level",
- BloodSugar.bloodsugar_level(bloodSugar),
- 70,
- 110,
- "Low",
- "High",
- )}
- {renderOptionalFloat("Dosage", BloodSugar.dosage(bloodSugar))}
- {renderLine("Frequency", BloodSugar.frequencyToString(BloodSugar.frequency(bloodSugar)))}
-
-}
diff --git a/src/Components/CriticalCareRecording/CriticalCareRecording.res b/src/Components/CriticalCareRecording/CriticalCareRecording.res
deleted file mode 100644
index acbd4aee531..00000000000
--- a/src/Components/CriticalCareRecording/CriticalCareRecording.res
+++ /dev/null
@@ -1,4 +0,0 @@
-@react.component
-let make = (~id, ~facilityId, ~patientId, ~consultationId, ~preview) => {
-
-}
diff --git a/src/Components/CriticalCareRecording/CriticalCare__API.tsx b/src/Components/CriticalCareRecording/CriticalCare__API.tsx
deleted file mode 100644
index 7bddbf9eaee..00000000000
--- a/src/Components/CriticalCareRecording/CriticalCare__API.tsx
+++ /dev/null
@@ -1,43 +0,0 @@
-import { fireRequestV2 } from "../../Redux/fireRequest";
-import routes from "../../Redux/api";
-import request from "../../Utils/request/request";
-
-export const loadDailyRound = (
- consultationId: string,
- id: string,
- successCB: any = () => null,
- errorCB: any = () => null,
-) => {
- fireRequestV2("getDailyReport", [], {}, successCB, errorCB, {
- consultationId,
- id,
- });
-};
-
-export const updateDailyRound = (
- consultationId: string,
- id: string,
- params: object,
- successCB: any = () => null,
- errorCB: any = () => null,
-) => {
- fireRequestV2("updateDailyRound", [], params, successCB, errorCB, {
- consultationId,
- id,
- });
-};
-
-export const getAsset = (
- consultationId: string,
- setAsset: React.Dispatch>,
-) => {
- request(routes.listConsultationBeds, {
- query: { consultation: consultationId, limit: 1 },
- }).then(({ data }) => {
- // here its fetching the ventilator type assets
- const assets = data?.results[0].assets_objects?.filter(
- (asset) => asset.asset_class == "VENTILATOR",
- );
- setAsset(assets?.length || 0);
- });
-};
diff --git a/src/Components/CriticalCareRecording/CriticalCare__Index.res b/src/Components/CriticalCareRecording/CriticalCare__Index.res
deleted file mode 100644
index 0290728fd82..00000000000
--- a/src/Components/CriticalCareRecording/CriticalCare__Index.res
+++ /dev/null
@@ -1,210 +0,0 @@
-let str = React.string
-open CriticalCare__Types
-
-let renderLine = (title, value) => {
-
- {str(`${title}:`)}
- {str(value)}
-
-}
-
-let renderIndicators = (title, value, isMin, isMax, minText, maxText) => {
- let indicator = if isMax {
-
-
- {str(maxText)}
-
- } else if isMin {
-
-
- {str(minText)}
-
- } else {
-
-
- {str("Normal")}
-
- }
-
-
- {str(`${title}:`)}
- {str(value)}
- {indicator}
-
-}
-
-let renderOptionalIntWithIndicators = (title, value, min, max, minText, maxText) => {
- Belt.Option.mapWithDefault(value, React.null, v => {
- renderIndicators(title, string_of_int(v), v < min, v > max, minText, maxText)
- })
-}
-
-let renderOptionalFloatWithIndicators = (title, value, min, max, minText, maxText) => {
- Belt.Option.mapWithDefault(value, React.null, v =>
- renderIndicators(title, Js.Float.toString(v), v < min, v > max, minText, maxText)
- )
-}
-
-let renderIntWithIndicators = (title, value, min, max, minText, maxText) => {
- renderIndicators(title, string_of_int(value), value < min, value > max, minText, maxText)
-}
-
-let renderFloatWithIndicators = (title, value, min, max, minText, maxText) => {
- renderIndicators(title, Js.Float.toString(value), value < min, value > max, minText, maxText)
-}
-
-let renderOptionalInt = (title, value) => {
- Belt.Option.mapWithDefault(value, React.null, v => renderLine(title, string_of_int(v)))
-}
-
-let renderOptionalFloat = (title, value) => {
- Belt.Option.mapWithDefault(value, React.null, v => renderLine(title, Js.Float.toString(v)))
-}
-
-let renderOptionalBool = (title, value) => {
- Belt.Option.mapWithDefault(value, React.null, v => renderLine(title, v ? "Yes" : "No"))
-}
-
-let renderOptionalDescription = (title, value) => {
- switch value {
- | Some(v) =>
-
- {str(`${title}:`)}
- {str(v)}
-
- | None => React.null
- }
-}
-
-let title = text => {
- {str(text)}
-}
-
-@genType @react.component
-let make = (
- ~id,
- ~facilityId,
- ~patientId,
- ~consultationId,
- ~dailyRound: CriticalCare__DailyRound.t,
-) => {
- let neurologicalMonitoring = DailyRound.neurologicalMonitoring(dailyRound)
- let hemodynamicParameter = DailyRound.hemodynamicParameters(dailyRound)
- let nursingCare = DailyRound.nursingCare(dailyRound)
- let arterialBloodGasAnalysis = DailyRound.arterialBloodGasAnalysis(dailyRound)
- let ioBalance = DailyRound.ioBalance(dailyRound)
- let dialysis = DailyRound.dialysis(dailyRound)
- let pressureSoreParameter = DailyRound.pressureSoreParameter(dailyRound)
- let bloodSugar = DailyRound.bloodSugar(dailyRound)
- let ventilatorParameters = DailyRound.ventilatorParameters(dailyRound)
- let medicine = DailyRound.medicine(dailyRound)
- let others = DailyRound.others(dailyRound)
-
-
-
-
- {str("Go back to Consultation")}
-
-
-
-
-
{str("Consultation Update")}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- ()}
- id={id}
- consultationId={consultationId}
- />
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-}
diff --git a/src/Components/CriticalCareRecording/CriticalCare__Root.res b/src/Components/CriticalCareRecording/CriticalCare__Root.res
deleted file mode 100644
index 33f2564096c..00000000000
--- a/src/Components/CriticalCareRecording/CriticalCare__Root.res
+++ /dev/null
@@ -1,47 +0,0 @@
-@module("./CriticalCare__API")
-external loadDailyRound: (string, string, _ => unit, _ => unit) => unit = "loadDailyRound"
-
-open CriticalCare__Types
-let str = React.string
-
-type state = {
- loading: bool,
- dailyRound: option,
-}
-
-let successCB = (setState, dailyRound) => {
- setState(_state => {loading: false, dailyRound: Some(DailyRound.makeFromJs(dailyRound))})
-}
-
-let errorCB = (setState, _error) => {
- setState(_state => {dailyRound: None, loading: false})
-}
-
-let loadData = (setState, consultationId, id) => {
- loadDailyRound(consultationId, id, successCB(setState), errorCB(setState))
-}
-
-@react.component
-let make = (~id, ~facilityId, ~patientId, ~consultationId, ~preview) => {
- let (state, setState) = React.useState(() => {loading: true, dailyRound: None})
- React.useEffect1(() => {
- loadData(setState, consultationId, id)
- None
- }, [id])
-
-
- {state.loading
- ?
- : switch state.dailyRound {
- | Some(dailyRound) =>
- preview
- ?
- :
-
- | None => {
- Notifications.error({msg: "No Data "})
- <> >
- }
- }}
-
-}
diff --git a/src/Components/CriticalCareRecording/DailyRound__Medicines.res b/src/Components/CriticalCareRecording/DailyRound__Medicines.res
deleted file mode 100644
index ce143c24d29..00000000000
--- a/src/Components/CriticalCareRecording/DailyRound__Medicines.res
+++ /dev/null
@@ -1,50 +0,0 @@
-let str = React.string
-
-@react.component
-let make = (~prescriptions) => {
-
- {ArrayUtils.isEmpty(prescriptions)
- ?
{str("No Medicines Prescribed")}
- :
-
-
-
-
-
-
- {str("Medicine")}
- |
-
- {str("Dosage")}
- |
-
- {str("Days")}
- |
-
-
- {Js.Array.mapi((p, index) => {
-
-
- {str(Prescription__Prescription.medicine(p))}
- |
-
- {str(Prescription__Prescription.dosage(p))}
- |
-
- {str(string_of_int(Prescription__Prescription.days(p)))}
- |
-
- }, prescriptions)->React.array}
-
-
-
-
}
-
-}
diff --git a/src/Components/CriticalCareRecording/DialysisEditor/CriticalCare_DialysisEditor.res b/src/Components/CriticalCareRecording/DialysisEditor/CriticalCare_DialysisEditor.res
deleted file mode 100644
index bb10cf38a69..00000000000
--- a/src/Components/CriticalCareRecording/DialysisEditor/CriticalCare_DialysisEditor.res
+++ /dev/null
@@ -1,116 +0,0 @@
-let str = React.string
-open CriticalCare__Types
-
-@module("../CriticalCare__API")
-external updateDailyRound: (string, string, Js.Json.t, _ => unit, _ => unit) => unit =
- "updateDailyRound"
-
-type state = {
- dialysis_fluid_balance: option,
- dialysis_net_balance: option,
- dirty: bool,
- saving: bool,
-}
-
-type action =
- | SetFluidBalance(int)
- | SetNetBalance(int)
- | SetSaving
- | ClearSaving
-
-let reducer = (state, action) => {
- switch action {
- | SetFluidBalance(fluid_balance) => {
- ...state,
- dialysis_fluid_balance: Some(fluid_balance),
- dirty: true,
- }
- | SetNetBalance(net_balance) => {
- ...state,
- dialysis_net_balance: Some(net_balance),
- dirty: true,
- }
- | SetSaving => {...state, saving: true}
- | ClearSaving => {...state, saving: false}
- }
-}
-
-let initialState = dialysis_parameters => {
- {
- dialysis_fluid_balance: Dialysis.fluid_balance(dialysis_parameters),
- dialysis_net_balance: Dialysis.net_balance(dialysis_parameters),
- saving: false,
- dirty: false,
- }
-}
-
-let makePayload = state => {
- let payload = Js.Dict.empty()
-
- DictUtils.setOptionalNumber("dialysis_fluid_balance", state.dialysis_fluid_balance, payload)
- DictUtils.setOptionalNumber("dialysis_net_balance", state.dialysis_net_balance, payload)
-
- payload
-}
-
-let successCB = (send, updateCB, data) => {
- send(ClearSaving)
- updateCB(CriticalCare__DailyRound.makeFromJs(data))
-}
-
-let errorCB = (send, _error) => {
- send(ClearSaving)
-}
-
-let saveData = (id, consultationId, state, send, updateCB) => {
- send(SetSaving)
- updateDailyRound(
- consultationId,
- id,
- Js.Json.object_(makePayload(state)),
- successCB(send, updateCB),
- errorCB(send),
- )
-}
-
-
-@react.component
-let make = (~dialysisParameters, ~updateCB, ~id, ~consultationId) => {
- let (state, send) = React.useReducer(reducer, initialState(dialysisParameters))
-
-
-
{str("Dialysis")}
-
-
- send(SetFluidBalance(int_of_string(s)))}
- getLabel={_ => ("", "#ff0000")}
- hasError={ValidationUtils.isInputInRangeInt(0, 5000, state.dialysis_fluid_balance)}
- />
- send(SetNetBalance(int_of_string(s)))}
- getLabel={_ => ("", "#ff0000")}
- hasError={ValidationUtils.isInputInRangeInt(0, 5000, state.dialysis_net_balance)}
- />
-
-
-
-
-}
diff --git a/src/Components/CriticalCareRecording/DialysisEditor/DailyRound__Dialysis.res b/src/Components/CriticalCareRecording/DialysisEditor/DailyRound__Dialysis.res
deleted file mode 100644
index c023acb1636..00000000000
--- a/src/Components/CriticalCareRecording/DialysisEditor/DailyRound__Dialysis.res
+++ /dev/null
@@ -1,10 +0,0 @@
-let str = React.string
-open CriticalCare__Types
-
-@react.component
-let make = (~dialysis, ~renderOptionalInt) => {
-
- {renderOptionalInt("Fluid Balance", Dialysis.fluid_balance(dialysis))}
- {renderOptionalInt("Net Balance", Dialysis.net_balance(dialysis))}
-
-}
diff --git a/src/Components/CriticalCareRecording/HemodynamicParameters/CriticalCare__HemodynamicParametersEditor.res b/src/Components/CriticalCareRecording/HemodynamicParameters/CriticalCare__HemodynamicParametersEditor.res
deleted file mode 100644
index 47cc040440e..00000000000
--- a/src/Components/CriticalCareRecording/HemodynamicParameters/CriticalCare__HemodynamicParametersEditor.res
+++ /dev/null
@@ -1,358 +0,0 @@
-open CriticalCare__Types
-let str = React.string
-
-@module("../CriticalCare__API")
-external updateDailyRound: (string, string, Js.Json.t, _ => unit, _ => unit) => unit =
- "updateDailyRound"
-
-let fahrenheitToCelcius = (temp: option) => {
- switch temp {
- | Some(x) =>
- Js.Float.toFixedWithPrecision((x -. 32.0) *. (5.0 /. 9.0), ~digits=2)->Belt.Float.fromString
- | None => None
- }
-}
-let celciusToFahrenheit = (temp: option) => {
- switch temp {
- | Some(x) =>
- Js.Float.toFixedWithPrecision(x *. 9.0 /. 5.0 +. 32.0, ~digits=2)->Belt.Float.fromString
- | None => None
- }
-}
-
-type state = {
- pain: array,
- systolic: option,
- diastolic: option,
- pulse: option,
- spo2: option,
- temperature: option,
- resp: option,
- rhythm: HemodynamicParameters.rhythm,
- rhythmDetails: string,
- tempInCelcius: bool,
- dirty: bool,
- saving: bool,
-}
-
-type action =
- | SetPain(array)
- | SetSystolic(int)
- | SetDiastolic(int)
- | SetPulse(int)
- | SetSPO2(int)
- | SetTemperature(float)
- | ToggleTemperatureUnit
- | SetResp(int)
- | SetRhythm(HemodynamicParameters.rhythm)
- | SetRhythmDetails(string)
- | SetSaving
- | ClearSaving
-
-let reducer = (state, action) => {
- switch action {
- | SetPain(pain) => {
- ...state,
- pain,
- dirty: true,
- }
- | SetSystolic(systolic) => {
- ...state,
- systolic: Some(systolic),
- dirty: true,
- }
- | SetDiastolic(diastolic) => {
- ...state,
- diastolic: Some(diastolic),
- dirty: true,
- }
- | SetPulse(pulse) => {...state, pulse: Some(pulse), dirty: true}
- | SetSPO2(spo2) => {...state, spo2: Some(spo2), dirty: true}
- | SetTemperature(temperature) => {
- ...state,
- temperature: Some(temperature),
- dirty: true,
- }
- | ToggleTemperatureUnit => {
- ...state,
- temperature: state.tempInCelcius
- ? state.temperature->celciusToFahrenheit
- : state.temperature->fahrenheitToCelcius,
- tempInCelcius: !state.tempInCelcius,
- }
- | SetResp(resp) => {
- ...state,
- resp: Some(resp),
- dirty: true,
- }
- | SetRhythm(rhythm) => {...state, rhythm, dirty: true}
- | SetRhythmDetails(rhythmDetails) => {
- ...state,
- rhythmDetails,
- dirty: true,
- }
- | SetSaving => {...state, saving: true}
- | ClearSaving => {...state, saving: false}
- }
-}
-
-let initialState = hdp => {
- let bp = HemodynamicParameters.bp(hdp)
-
- {
- pain: HemodynamicParameters.pain(hdp),
- systolic: Belt.Option.map(bp, HemodynamicParameters.systolic),
- diastolic: Belt.Option.map(bp, HemodynamicParameters.diastolic),
- pulse: HemodynamicParameters.pulse(hdp),
- spo2: HemodynamicParameters.spo2(hdp),
- temperature: HemodynamicParameters.temperature(hdp),
- resp: HemodynamicParameters.resp(hdp),
- rhythm: HemodynamicParameters.rhythm(hdp),
- rhythmDetails: Belt.Option.getWithDefault(HemodynamicParameters.rhythmDetails(hdp), ""),
- tempInCelcius: false,
- saving: false,
- dirty: false,
- }
-}
-
-let computeMeanArterialPressure = (systolic, diastolic) => {
- float_of_int(systolic + 2 * diastolic) /. 3.0
-}
-
-let makePainField = p => {
- let payload = Js.Dict.empty()
- Js.Dict.set(payload, "region", Js.Json.string(Pain.endcodeRegion(p)))
- Js.Dict.set(payload, "scale", Js.Json.number(float_of_int(Pain.scale(p))))
- Js.Dict.set(payload, "description", Js.Json.string(p.description))
- payload
-}
-
-let makeBpPayload = (systolic, diastolic) => {
- let payload = Js.Dict.empty()
- Js.Dict.set(payload, "systolic", Js.Json.number(float_of_int(systolic)))
- Js.Dict.set(payload, "diastolic", Js.Json.number(float_of_int(diastolic)))
- Js.Dict.set(payload, "mean", Js.Json.number(computeMeanArterialPressure(systolic, diastolic)))
- payload
-}
-
-let makePayload = state => {
- let payload = Js.Dict.empty()
-
- switch (state.systolic, state.diastolic) {
- | (Some(systolic), Some(diastolic)) =>
- Js.Dict.set(payload, "bp", Js.Json.object_(makeBpPayload(systolic, diastolic)))
- | (_, _) => ()
- }
- Js.Dict.set(
- payload,
- "pain_scale_enhanced",
- Js.Json.objectArray(Js.Array.map(makePainField, state.pain)),
- )
- DictUtils.setOptionalNumber("pulse", state.pulse, payload)
- DictUtils.setOptionalNumber("ventilator_spo2", state.spo2, payload)
- DictUtils.setOptionalFloat(
- "temperature",
- state.tempInCelcius ? state.temperature->celciusToFahrenheit : state.temperature,
- payload,
- )
- DictUtils.setOptionalNumber("resp", state.resp, payload)
- Js.Dict.set(payload, "rhythm", Js.Json.string(HemodynamicParameters.encodeRhythm(state.rhythm)))
- DictUtils.setOptionalString("rhythm_detail", state.rhythmDetails, payload)
- payload
-}
-let successCB = (send, updateCB, data) => {
- send(ClearSaving)
- updateCB(CriticalCare__DailyRound.makeFromJs(data))
-}
-
-let errorCB = (send, _error) => {
- send(ClearSaving)
-}
-
-let saveData = (id, consultationId, state, send, updateCB) => {
- send(SetSaving)
- updateDailyRound(
- consultationId,
- id,
- Js.Json.object_(makePayload(state)),
- successCB(send, updateCB),
- errorCB(send),
- )
-}
-
-let getStatus = (min, minText, max, maxText, val) => {
- switch (val >= min, val <= max) {
- | (true, true) => ("Normal", "#059669")
- | (true, false) => (maxText, "#DC2626")
- | _ => (minText, "#DC2626")
- }
-}
-
-let meanArterialPressure = state => {
- switch (state.systolic, state.diastolic) {
- | (Some(systolic), Some(diastolic)) => computeMeanArterialPressure(systolic, diastolic)
- | (_, _) => 0.0
- }
-}
-
-let getPainStatus = val => {
- if val == 0.0 {
- ("No Pain", "#059669")
- } else if val < 4.0 {
- ("Minute", "#ff3f00")
- } else if val < 8.0 {
- ("Moderate", "#ff002c")
- } else {
- ("Severe", "#de000c")
- }
-}
-
-@react.component
-let make = (~hemodynamicParameter, ~updateCB, ~id, ~consultationId) => {
- let (state, send) = React.useReducer(reducer, initialState(hemodynamicParameter))
-
-
-
{str("Vitals")}
-
-
-
-
{str("BP (mm hg)")}
-
- {str(
- `Mean Arterial Pressure: ${Js.Float.toFixedWithPrecision(
- meanArterialPressure(state),
- ~digits=2,
- )}`,
- )}
-
-
-
send(SetSystolic(int_of_string(s)))}
- getLabel={getStatus(100.0, "Low", 140.0, "High")}
- hasError={ValidationUtils.isInputInRangeInt(0, 250, state.systolic)}
- />
- send(SetDiastolic(int_of_string(s)))}
- getLabel={getStatus(50.0, "Low", 90.0, "High")}
- hasError={ValidationUtils.isInputInRangeInt(30, 180, state.diastolic)}
- />
- send(SetSPO2(int_of_string(s)))}
- getLabel={getStatus(90.0, "Low", 100.0, "High")}
- hasError={ValidationUtils.isInputInRangeInt(0, 100, state.spo2)}
- />
-
-
-
ToggleTemperatureUnit->send}>
- {state.tempInCelcius ? "C"->str : "F"->str}
- }
- start={state.tempInCelcius ? "35" : "95"}
- end={state.tempInCelcius ? "41" : "106"}
- interval={"10"}
- step={0.1}
- value={Belt.Option.mapWithDefault(state.temperature, "", Js.Float.toString)}
- setValue={s => send(SetTemperature(float_of_string(s)))}
- getLabel={state.tempInCelcius
- ? getStatus(36.4, "Low", 37.5, "High")
- : getStatus(97.6, "Low", 99.6, "High")}
- hasError={state.tempInCelcius
- ? ValidationUtils.isInputInRangeFloat("35", "41", state.temperature)
- : ValidationUtils.isInputInRangeFloat("95", "106", state.temperature)}
- />
-
send(SetResp(int_of_string(s)))}
- getLabel={getStatus(12.0, "Low", 16.0, "High")}
- hasError={ValidationUtils.isInputInRangeInt(0, 150, state.resp)}
- />
-
-
-
{str("Pain")}
-
{str("Mark region and intensity of pain")}
-
-
- {
- send(SetPain(data))
- }}
- id={id}
- consultationId={consultationId}
- />
-
- send(SetPulse(int_of_string(s)))}
- getLabel={getStatus(40.0, "Bradycardia", 100.0, "Tachycardia")}
- hasError={ValidationUtils.isInputInRangeInt(0, 200, state.pulse)}
- />
-
-
-
- {Js.Array.map(
- r =>
- send(SetRhythm(r))}
- />,
- [Regular, IrRegular, UNKNOWN],
- )->React.array}
-
-
-
-
-
-
-
-
-}
diff --git a/src/Components/CriticalCareRecording/HemodynamicParameters/DailyRound__HemodynamicParameters.res b/src/Components/CriticalCareRecording/HemodynamicParameters/DailyRound__HemodynamicParameters.res
deleted file mode 100644
index 94f68240720..00000000000
--- a/src/Components/CriticalCareRecording/HemodynamicParameters/DailyRound__HemodynamicParameters.res
+++ /dev/null
@@ -1,71 +0,0 @@
-let str = React.string
-open CriticalCare__Types
-
-@react.component
-let make = (
- ~hemodynamicParameter,
- ~title,
- ~renderOptionalDescription,
- ~renderLine,
- ~renderIntWithIndicators,
- ~renderOptionalIntWithIndicators,
- ~renderFloatWithIndicators,
- ~renderOptionalFloatWithIndicators,
- ~renderOptionalInt,
-) => {
-