diff --git a/client/src/elm/Backend/Measurement/Model.elm b/client/src/elm/Backend/Measurement/Model.elm index 41ad62cb5e..a6abfe4b3a 100644 --- a/client/src/elm/Backend/Measurement/Model.elm +++ b/client/src/elm/Backend/Measurement/Model.elm @@ -676,13 +676,17 @@ type MedicalHistorySign | HypertensionBeforePregnancy | RenalDisease | NoMedicalHistorySigns + -- Sign is kept as legacy value, to preserve data recorded during encounters, + -- before it was split into 2 signs at MedicalHistoryPhysicalCondition. + | UterineMyoma + -- Sign is kept as legacy value, to preserve data recorded during encounters, + -- before it was replaced by MedicalHistoryMentalHealthIssue signs. + | MentalHealthHistory -- @todo: Below signs are deprecated. Can be removed around January 2025. | BowedLegs - | UterineMyoma | HIV | TuberculosisPast | TuberculosisPresent - | MentalHealthHistory type MedicalHistoryPhysicalCondition diff --git a/client/src/elm/Pages/Prenatal/Encounter/Utils.elm b/client/src/elm/Pages/Prenatal/Encounter/Utils.elm index d841a0b0fe..d46476fd76 100644 --- a/client/src/elm/Pages/Prenatal/Encounter/Utils.elm +++ b/client/src/elm/Pages/Prenatal/Encounter/Utils.elm @@ -934,10 +934,14 @@ generateMedicalDiagnosisAlertData language currentDate measurements diagnosis = in case diagnosis of DiagnosisUterineMyoma -> - generateAlertForDiagnosis .physicalConditions - [ Backend.Measurement.Model.PhysicalConditionUterineMyomaCurrent - , Backend.Measurement.Model.PhysicalConditionUterineMyomaSurgicalResection - ] + Maybe.Extra.or + (generateAlertForDiagnosis .physicalConditions + [ Backend.Measurement.Model.PhysicalConditionUterineMyomaCurrent + , Backend.Measurement.Model.PhysicalConditionUterineMyomaSurgicalResection + ] + ) + -- Support for legacy value. + (generateAlertForDiagnosis .signs [ Backend.Measurement.Model.UterineMyoma ]) Backend.PrenatalActivity.Model.DiagnosisDiabetes -> generateAlertForDiagnosis .signs [ Backend.Measurement.Model.Diabetes ] @@ -967,12 +971,16 @@ generateMedicalDiagnosisAlertData language currentDate measurements diagnosis = generateAlertForDiagnosis .infectiousDiseases [ Backend.Measurement.Model.InfectiousDiseasesHIV ] DiagnosisMentalHealthHistory -> - generateAlertForDiagnosis .mentalHealthIssues - [ Backend.Measurement.Model.MentalHealthIssueGeneralDepression - , Backend.Measurement.Model.MentalHealthIssuePerinatalDepression - , Backend.Measurement.Model.MentalHealthIssueSchizophrenia - , Backend.Measurement.Model.MentalHealthIssueTrauma - ] + Maybe.Extra.or + (generateAlertForDiagnosis .mentalHealthIssues + [ Backend.Measurement.Model.MentalHealthIssueGeneralDepression + , Backend.Measurement.Model.MentalHealthIssuePerinatalDepression + , Backend.Measurement.Model.MentalHealthIssueSchizophrenia + , Backend.Measurement.Model.MentalHealthIssueTrauma + ] + ) + -- Support for legacy value. + (generateAlertForDiagnosis .signs [ Backend.Measurement.Model.MentalHealthHistory ]) calculateBmi : Maybe Float -> Maybe Float -> Maybe Float diff --git a/client/src/elm/Pages/Prenatal/ProgressReport/View.elm b/client/src/elm/Pages/Prenatal/ProgressReport/View.elm index c08e070e3c..bb268423c4 100644 --- a/client/src/elm/Pages/Prenatal/ProgressReport/View.elm +++ b/client/src/elm/Pages/Prenatal/ProgressReport/View.elm @@ -659,8 +659,43 @@ viewObstetricHistoryPane language currentDate measurements = ) |> Maybe.withDefault [] + obsetricHistoryStep2 = + getMeasurementValueFunc measurements.obstetricHistoryStep2 + |> Maybe.map + (\value -> + if EverySet.member Backend.Measurement.Model.CSectionInPast value.previousDelivery then + Maybe.andThen (EverySet.toList >> List.head) value.cSectionReason + |> Maybe.map + (\cSectionReason -> + let + previousDeliveryMethod = + if EverySet.member Backend.Measurement.Model.CSectionInPreviousDelivery value.previousDelivery then + translate language Translate.CSection + + else + translate language Translate.VaginalDeliveryLabel + in + [ translate language Translate.CSectionFor + ++ " " + ++ String.toLower (translate language <| Translate.CSectionReasons cSectionReason) + ++ " " + ++ translate language Translate.WithMostRecentDeliveryBy + ++ " " + ++ String.toLower previousDeliveryMethod + ++ "." + ] + ) + |> Maybe.withDefault [] + + else + [] + ) + |> Maybe.withDefault [] + content = - List.map (\alert -> li [] [ text alert ]) obsetricHistory + obsetricHistory + ++ obsetricHistoryStep2 + |> List.map (\alert -> li [] [ text alert ]) |> ul [] |> List.singleton in diff --git a/client/src/elm/Translate.elm b/client/src/elm/Translate.elm index a8edd97e3a..b78b6a5389 100644 --- a/client/src/elm/Translate.elm +++ b/client/src/elm/Translate.elm @@ -542,6 +542,7 @@ type TranslationId | ConvulsionsAndUnconsciousPreviousDelivery | ConvulsionsPreviousDelivery | CSection + | CSectionFor | CSectionScar CSectionScar | CurrentMedication | Dashboard Dashboard @@ -1895,6 +1896,7 @@ type TranslationId | WhatWasTheirResponse | WhoCaresForTheChildDuringTheDay | WhoInFamilyHasCondition + | WithMostRecentDeliveryBy | WhyNot | WrittenProtocolsFollowed | Year @@ -4414,6 +4416,12 @@ translationSet trans = , kirundi = Nothing } + CSectionFor -> + { english = "C-Section for" + , kinyarwanda = Nothing + , kirundi = Nothing + } + CSectionScar scar -> case scar of Vertical -> @@ -23649,6 +23657,12 @@ translationSet trans = , kirundi = Just "Ninde mu muryango iwanyu ameze uku/afise ingorane nk'iyi/afise ikibazo nk'iki" } + WithMostRecentDeliveryBy -> + { english = "with most recent delivery by" + , kinyarwanda = Nothing + , kirundi = Nothing + } + WhyNot -> { english = "Why not" , kinyarwanda = Just "Kubera iki" diff --git a/server/hedley/modules/custom/hedley_prenatal/hedley_prenatal.module b/server/hedley/modules/custom/hedley_prenatal/hedley_prenatal.module index f8f14ab7b5..62ea049bdc 100644 --- a/server/hedley/modules/custom/hedley_prenatal/hedley_prenatal.module +++ b/server/hedley/modules/custom/hedley_prenatal/hedley_prenatal.module @@ -119,7 +119,6 @@ function hedley_prenatal_migrate_medical_history($node) { $migrated_values_physical_condition = []; $physical_condition_migration = [ - 'uterine-myonma', 'bowed-legs', ]; @@ -132,21 +131,13 @@ function hedley_prenatal_migrate_medical_history($node) { foreach ($node->field_medical_history[LANGUAGE_NONE] as $index => $item) { if (in_array($item['value'], $physical_condition_migration)) { - if ($item['value'] == 'uterine-myonma') { - $migrated_values_physical_condition[] = ['value' => 'uterine-myonma-current']; - } - else { - $migrated_values_physical_condition[] = $item; - } + $migrated_values_physical_condition[] = $item; unset($node->field_medical_history[LANGUAGE_NONE][$index]); } elseif (in_array($item['value'], $infectious_disease_migration)) { $migrated_values_infectious_disease[] = $item; unset($node->field_medical_history[LANGUAGE_NONE][$index]); } - elseif ($item['value'] == 'mental-health-history') { - unset($node->field_medical_history[LANGUAGE_NONE][$index]); - } } if (empty($node->field_medical_history[LANGUAGE_NONE])) { $node->field_medical_history[LANGUAGE_NONE][0]['value'] = 'none';