Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ANC - skip Obstetric History step 2 on first pregnancy #1331

Merged
merged 4 commits into from
Sep 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ci-scripts/circleci_wait.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

CMD="$*"

TIMEOUT=3700
TIMEOUT=4300
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was it a one-time hiccup that the timeout wasn't enough or do you think it's a frequent problem?

Copy link
Collaborator Author

@anvmn anvmn Sep 23, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@AronNovak

It seems that whenever we exceed 1h execution, we get timeout anyways.
So, this change is not effective. Saw tasks fail with this increased timeout.
All failing tasks state 1h execution time. For example:

https://app.circleci.com/pipelines/github/TIP-Global-Health/eheza-app/4742/workflows/022cde6a-0985-44b5-9143-90f92554c68b/jobs/16322

Selection_875

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@anvmn if needed, let's open an issue for me and I can investigate a bit. Thanks for the details!

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

INTERVAL=240
$CMD &
CMD_PID=$!
Expand Down
2 changes: 1 addition & 1 deletion client/src/elm/Pages/Prenatal/Activity/Model.elm
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ type Msg
-- HistoryMsgs, OB, Step 1
| SetCurrentlyPregnant Bool
| SetOBIntInput (Maybe Int -> ObstetricFormFirstStep -> ObstetricFormFirstStep) String
| SaveOBHistoryStep1 PersonId (Maybe ( ObstetricHistoryId, ObstetricHistory ))
| SaveOBHistoryStep1 Bool PersonId (Maybe ( ObstetricHistoryId, ObstetricHistory )) (Maybe HistoryTask)
-- HistoryMsgs, OB, Step 2
| SetCSectionReason CSectionReason
| SetNumberOfCSections String
Expand Down
22 changes: 16 additions & 6 deletions client/src/elm/Pages/Prenatal/Activity/Update.elm
Original file line number Diff line number Diff line change
Expand Up @@ -356,16 +356,28 @@ update language currentDate id isLabTech db msg model =
, []
)

SaveOBHistoryStep1 personId saved ->
SaveOBHistoryStep1 skipSecondStep personId saved nextTask ->
let
measurementId =
Maybe.map Tuple.first saved

measurement =
getMeasurementValueFunc saved

( appMsgs, updatedData ) =
( model.historyData.obstetricFormFirstStep
( extraMsgs, updatedData ) =
if skipSecondStep then
( generateHistoryMsgs nextTask
, model.historyData
)

else
( []
, model.historyData
|> (\data -> { data | obstetricHistoryStep = ObstetricHistorySecondStep })
)

appMsgs =
model.historyData.obstetricFormFirstStep
|> toObstetricHistoryValueWithDefault measurement
|> Maybe.map
(Backend.PrenatalEncounter.Model.SaveObstetricHistory personId measurementId
Expand All @@ -374,14 +386,12 @@ update language currentDate id isLabTech db msg model =
>> List.singleton
)
|> Maybe.withDefault []
, model.historyData
|> (\data -> { data | obstetricHistoryStep = ObstetricHistorySecondStep })
)
in
( { model | historyData = updatedData }
, Cmd.none
, appMsgs
)
|> sequenceExtra (update language currentDate id isLabTech db) extraMsgs

SetCSectionReason reason ->
let
Expand Down
28 changes: 25 additions & 3 deletions client/src/elm/Pages/Prenatal/Activity/Utils.elm
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ import Measurement.Utils
import Measurement.View exposing (viewActionTakenLabel)
import Pages.Prenatal.Activity.Model exposing (..)
import Pages.Prenatal.Activity.Types exposing (..)
import Pages.Prenatal.Encounter.Utils exposing (emergencyReferalRequired, getAllActivities)
import Pages.Prenatal.Encounter.Utils exposing (emergencyReferalRequired, generateGravida, generatePara, getAllActivities)
import Pages.Prenatal.Model exposing (AssembledData, HealthEducationForm, PrenatalEncounterPhase(..), ReferralForm, VaccinationProgressDict)
import Pages.Prenatal.Utils exposing (..)
import Pages.Utils
Expand Down Expand Up @@ -788,8 +788,16 @@ historyTaskCompleted : AssembledData -> HistoryTask -> Bool
historyTaskCompleted assembled task =
case task of
Obstetric ->
isJust assembled.measurements.obstetricHistory
&& isJust assembled.measurements.obstetricHistoryStep2
let
obstetricHistoryValue =
getMeasurementValueFunc assembled.measurements.obstetricHistory
in
if skipObstetricHistorySecondStep obstetricHistoryValue then
isJust assembled.measurements.obstetricHistory

else
isJust assembled.measurements.obstetricHistory
&& isJust assembled.measurements.obstetricHistoryStep2

Medical ->
isJust assembled.measurements.medicalHistory
Expand All @@ -801,6 +809,20 @@ historyTaskCompleted assembled task =
isJust assembled.measurements.outsideCare


skipObstetricHistorySecondStep : Maybe ObstetricHistoryValue -> Bool
skipObstetricHistorySecondStep obstetricHistoryValue =
let
gravida =
Maybe.map generateGravida obstetricHistoryValue
|> Maybe.withDefault ""

para =
Maybe.map generatePara obstetricHistoryValue
|> Maybe.withDefault ""
in
gravida == "01" && para == "0000"


resolveExaminationTasks : AssembledData -> List ExaminationTask
resolveExaminationTasks assembled =
let
Expand Down
22 changes: 19 additions & 3 deletions client/src/elm/Pages/Prenatal/Activity/View.elm
Original file line number Diff line number Diff line change
Expand Up @@ -626,10 +626,12 @@ viewHistoryContent language currentDate assembled data =
Maybe.andThen (\task -> Dict.get task tasksCompletedFromTotalDict) activeTask
|> Maybe.withDefault ( 0, 0 )

( obstetricFormFirstStepInputs, obstetricFormFirstStepTasks ) =
obstetricFormFirstStep =
getMeasurementValueFunc assembled.measurements.obstetricHistory
|> obstetricHistoryFormWithDefault data.obstetricFormFirstStep
|> obstetricFormFirstStepInputsAndTasks language currentDate assembled

( obstetricFormFirstStepInputs, obstetricFormFirstStepTasks ) =
obstetricFormFirstStepInputsAndTasks language currentDate assembled obstetricFormFirstStep

( obstetricFormSecondStepInputs, obstetricFormSecondStepTasks ) =
getMeasurementValueFunc assembled.measurements.obstetricHistoryStep2
Expand Down Expand Up @@ -750,13 +752,27 @@ viewHistoryContent language currentDate assembled data =
Obstetric ->
case data.obstetricHistoryStep of
ObstetricHistoryFirstStep ->
let
skipSecondStep =
toObstetricHistoryValue obstetricFormFirstStep
|> skipObstetricHistorySecondStep

label =
if skipSecondStep then
Translate.Save

else
Translate.SaveAndNext
in
[ customSaveButton language
saveButtonActive
(SaveOBHistoryStep1
skipSecondStep
assembled.participant.person
assembled.measurements.obstetricHistory
nextTask
)
Translate.SaveAndNext
label
]

ObstetricHistorySecondStep ->
Expand Down