Skip to content

Commit

Permalink
Merge pull request #1352 from TIP-Global-Health/issue-1349
Browse files Browse the repository at this point in the history
ANC Review - requirements changes
  • Loading branch information
anvmn authored Oct 13, 2024
2 parents 5de4cf4 + 7a6d222 commit 9785b57
Show file tree
Hide file tree
Showing 5 changed files with 75 additions and 23 deletions.
8 changes: 6 additions & 2 deletions client/src/elm/Backend/Measurement/Model.elm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
28 changes: 18 additions & 10 deletions client/src/elm/Pages/Prenatal/Encounter/Utils.elm
Original file line number Diff line number Diff line change
Expand Up @@ -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 ]
Expand Down Expand Up @@ -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
Expand Down
37 changes: 36 additions & 1 deletion client/src/elm/Pages/Prenatal/ProgressReport/View.elm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
14 changes: 14 additions & 0 deletions client/src/elm/Translate.elm
Original file line number Diff line number Diff line change
Expand Up @@ -542,6 +542,7 @@ type TranslationId
| ConvulsionsAndUnconsciousPreviousDelivery
| ConvulsionsPreviousDelivery
| CSection
| CSectionFor
| CSectionScar CSectionScar
| CurrentMedication
| Dashboard Dashboard
Expand Down Expand Up @@ -1895,6 +1896,7 @@ type TranslationId
| WhatWasTheirResponse
| WhoCaresForTheChildDuringTheDay
| WhoInFamilyHasCondition
| WithMostRecentDeliveryBy
| WhyNot
| WrittenProtocolsFollowed
| Year
Expand Down Expand Up @@ -4414,6 +4416,12 @@ translationSet trans =
, kirundi = Nothing
}

CSectionFor ->
{ english = "C-Section for"
, kinyarwanda = Nothing
, kirundi = Nothing
}

CSectionScar scar ->
case scar of
Vertical ->
Expand Down Expand Up @@ -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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,6 @@ function hedley_prenatal_migrate_medical_history($node) {

$migrated_values_physical_condition = [];
$physical_condition_migration = [
'uterine-myonma',
'bowed-legs',
];

Expand All @@ -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';
Expand Down

0 comments on commit 9785b57

Please sign in to comment.