diff --git a/client/src/assets/scss/_new.scss b/client/src/assets/scss/_new.scss index bcc5f0abbc..9de4a2b35e 100644 --- a/client/src/assets/scss/_new.scss +++ b/client/src/assets/scss/_new.scss @@ -3084,6 +3084,13 @@ div.page-report.clinical .ui.unstackable.items { } } + .vaccination-history { + + .pane-content { + padding-left: 0; + } + } + .chw-activities { .heading, @@ -4054,7 +4061,8 @@ div.page-activity.well-child, div.page-report.acute-illness, div.page-report.well-child, div.page-report.child-scoreboard, -div.page-activity.patient-record { +div.page-activity.patient-record, +div.page-report.clinical { .heading { border-bottom: 1px solid $color-text; diff --git a/client/src/elm/Backend/Measurement/Model.elm b/client/src/elm/Backend/Measurement/Model.elm index 1647f20229..41ad62cb5e 100644 --- a/client/src/elm/Backend/Measurement/Model.elm +++ b/client/src/elm/Backend/Measurement/Model.elm @@ -1161,7 +1161,7 @@ type PrenatalHIVSign | PartnerSurpressedViralLoad -- This option is an indicator. -- When Lab tech fills the result, they do not - -- answer follow up quesrtion. We use this optin to indicate + -- answer follow up question. We use this optin to indicate -- that nurse will have to complete the results follow up. | PrenatalHIVSignPendingInput | NoPrenatalHIVSign diff --git a/client/src/elm/Components/ReportToWhatsAppDialog/Model.elm b/client/src/elm/Components/ReportToWhatsAppDialog/Model.elm index dee2dcfa8c..7507e25015 100644 --- a/client/src/elm/Components/ReportToWhatsAppDialog/Model.elm +++ b/client/src/elm/Components/ReportToWhatsAppDialog/Model.elm @@ -82,6 +82,7 @@ type ReportComponentAntenatal = ComponentAntenatalObstetricHistory | ComponentAntenatalMedicalDiagnosis | ComponentAntenatalObstetricalDiagnosis + | ComponentAntenatalImmunizationHistory | ComponentAntenatalCHWActivity | ComponentAntenatalPatientProgress | ComponentAntenatalLabsResults diff --git a/client/src/elm/Components/ReportToWhatsAppDialog/View.elm b/client/src/elm/Components/ReportToWhatsAppDialog/View.elm index f49fe62f06..0c5c7d0da5 100644 --- a/client/src/elm/Components/ReportToWhatsAppDialog/View.elm +++ b/client/src/elm/Components/ReportToWhatsAppDialog/View.elm @@ -315,6 +315,7 @@ viewComponentsSelection language currentDate phoneNumber componentsList reportTy [ ComponentAntenatalObstetricHistory , ComponentAntenatalMedicalDiagnosis , ComponentAntenatalObstetricalDiagnosis + , ComponentAntenatalImmunizationHistory , ComponentAntenatalCHWActivity , ComponentAntenatalPatientProgress , ComponentAntenatalLabsResults diff --git a/client/src/elm/Measurement/Model.elm b/client/src/elm/Measurement/Model.elm index 22078584d7..1232deb8de 100644 --- a/client/src/elm/Measurement/Model.elm +++ b/client/src/elm/Measurement/Model.elm @@ -1944,6 +1944,12 @@ type alias VaccinationProgressDict = Dict WellChildVaccineType (Dict VaccineDose NominalDate) +type VaccinationStatus + = StatusBehind + | StatusCompleted + | StatusUpToDate + + type ImmunisationTask = TaskBCG | TaskDTP diff --git a/client/src/elm/Pages/Prenatal/Activity/Utils.elm b/client/src/elm/Pages/Prenatal/Activity/Utils.elm index 614894a888..bba65e0d00 100644 --- a/client/src/elm/Pages/Prenatal/Activity/Utils.elm +++ b/client/src/elm/Pages/Prenatal/Activity/Utils.elm @@ -5123,7 +5123,7 @@ expectImmunisationTask : NominalDate -> AssembledData -> ImmunisationTask -> Boo expectImmunisationTask currentDate assembled task = let futureVaccinations = - generateFutureVaccinationsData currentDate assembled + generateFutureVaccinationsDataByHistory currentDate assembled |> Dict.fromList isTaskExpected vaccineType = @@ -5139,11 +5139,25 @@ expectImmunisationTask currentDate assembled task = |> isTaskExpected +generateFutureVaccinationsDataByHistory : NominalDate -> AssembledData -> List ( PrenatalVaccineType, Maybe ( VaccineDose, NominalDate ) ) +generateFutureVaccinationsDataByHistory currentDate assembled = + generateFutureVaccinationsData currentDate assembled.globalLmpDate assembled.vaccinationHistory + + +generateFutureVaccinationsDataByProgress : NominalDate -> AssembledData -> List ( PrenatalVaccineType, Maybe ( VaccineDose, NominalDate ) ) +generateFutureVaccinationsDataByProgress currentDate assembled = + generateFutureVaccinationsData currentDate assembled.globalLmpDate assembled.vaccinationProgress + + {-| For each type of vaccine, we generate next dose and administration date. If there's no need for future vaccination, Nothing is returned. -} -generateFutureVaccinationsData : NominalDate -> AssembledData -> List ( PrenatalVaccineType, Maybe ( VaccineDose, NominalDate ) ) -generateFutureVaccinationsData currentDate assembled = +generateFutureVaccinationsData : + NominalDate + -> Maybe NominalDate + -> VaccinationProgressDict + -> List ( PrenatalVaccineType, Maybe ( VaccineDose, NominalDate ) ) +generateFutureVaccinationsData currentDate globalLmpDate vaccinationDict = Maybe.map (\lmpDate -> let @@ -5154,7 +5168,7 @@ generateFutureVaccinationsData currentDate assembled = (\vaccineType -> let nextVaccinationData = - case latestVaccinationDataForVaccine assembled.vaccinationHistory vaccineType of + case latestVaccinationDataForVaccine vaccinationDict vaccineType of Just ( lastDoseAdministered, lastDoseDate ) -> nextVaccinationDataForVaccine currentDate egaInWeeks vaccineType lastDoseDate lastDoseAdministered @@ -5169,7 +5183,7 @@ generateFutureVaccinationsData currentDate assembled = ) allVaccineTypes ) - assembled.globalLmpDate + globalLmpDate |> Maybe.withDefault [] diff --git a/client/src/elm/Pages/Prenatal/ProgressReport/View.elm b/client/src/elm/Pages/Prenatal/ProgressReport/View.elm index 75e048e807..c08e070e3c 100644 --- a/client/src/elm/Pages/Prenatal/ProgressReport/View.elm +++ b/client/src/elm/Pages/Prenatal/ProgressReport/View.elm @@ -55,6 +55,7 @@ import Html.Attributes exposing (..) import Html.Events exposing (..) import List.Extra exposing (greedyGroupsOf) import Maybe.Extra exposing (isJust, isNothing, unwrap) +import Measurement.Model exposing (VaccinationStatus(..)) import Measurement.Utils exposing ( outsideCareMedicationOptionsAnemia @@ -64,10 +65,10 @@ import Measurement.Utils , outsideCareMedicationOptionsSyphilis ) import Pages.Page exposing (Page(..), UserPage(..)) -import Pages.Prenatal.Activity.Utils exposing (respiratoryRateElevated) +import Pages.Prenatal.Activity.Utils exposing (generateFutureVaccinationsDataByProgress, respiratoryRateElevated) import Pages.Prenatal.Encounter.Utils exposing (..) import Pages.Prenatal.Encounter.View exposing (viewActionButton) -import Pages.Prenatal.Model exposing (AssembledData) +import Pages.Prenatal.Model exposing (AssembledData, VaccinationProgressDict) import Pages.Prenatal.ProgressReport.Model exposing (..) import Pages.Prenatal.ProgressReport.Svg exposing (viewBMIForEGA, viewFundalHeightForEGA, viewMarkers) import Pages.Prenatal.ProgressReport.Utils exposing (..) @@ -516,6 +517,8 @@ viewContent language currentDate site features isChw isLabTech isResultsReviewer |> showIf (showComponent Components.ReportToWhatsAppDialog.Model.ComponentAntenatalMedicalDiagnosis) , viewObstetricalDiagnosisPane language currentDate isChw firstNurseEncounterMeasurements assembled |> showIf (showComponent Components.ReportToWhatsAppDialog.Model.ComponentAntenatalObstetricalDiagnosis) + , viewVaccinationHistoryPane language currentDate assembled + |> showIf (showComponent Components.ReportToWhatsAppDialog.Model.ComponentAntenatalImmunizationHistory) , viewChwActivityPane language currentDate isChw assembled |> showIf (showComponent Components.ReportToWhatsAppDialog.Model.ComponentAntenatalCHWActivity) , viewPatientProgressPane language currentDate isChw assembled @@ -989,6 +992,76 @@ viewObstetricalDiagnosisPane language currentDate isChw firstNurseEncounterMeasu ] +viewVaccinationHistoryPane : Language -> NominalDate -> AssembledData -> Html any +viewVaccinationHistoryPane language currentDate assembled = + div [ class "vaccination-history" ] <| + [ viewItemHeading language Translate.ImmunizationHistory "blue" + , div [ class "pane-content" ] <| + viewVaccinationOverview language currentDate assembled + ] + + +viewVaccinationOverview : + Language + -> NominalDate + -> AssembledData + -> List (Html any) +viewVaccinationOverview language currentDate assembled = + let + entriesHeading = + div [ class "heading vaccination" ] + [ div [ class "name" ] [ text <| translate language Translate.Immunisation ] + , div [ class "date" ] [ text <| translate language Translate.DateReceived ] + , div [ class "next-due" ] [ text <| translate language Translate.NextDue ] + , div [ class "status" ] [ text <| translate language Translate.StatusLabel ] + ] + + futureVaccinationsData = + generateFutureVaccinationsDataByProgress currentDate assembled + |> Dict.fromList + + entries = + Dict.toList assembled.vaccinationProgress + |> List.map viewVaccinationEntry + + viewVaccinationEntry ( vaccineType, doses ) = + let + nextDue = + Dict.get vaccineType futureVaccinationsData + |> Maybe.Extra.join + |> Maybe.map Tuple.second + + nextDueText = + Maybe.map formatDDMMYYYY nextDue + |> Maybe.withDefault "" + + ( status, statusClass ) = + Maybe.map + (\dueDate -> + if Date.compare dueDate currentDate == LT then + ( StatusBehind, "behind" ) + + else + ( StatusUpToDate, "up-to-date" ) + ) + nextDue + |> Maybe.withDefault ( StatusCompleted, "completed" ) + in + div [ class "entry vaccination" ] + [ div [ class "cell name" ] [ text <| translate language <| Translate.PrenatalVaccineLabel vaccineType ] + , Dict.values doses + |> List.sortWith Date.compare + |> List.map (formatDDMMYYYY >> text >> List.singleton >> p []) + |> div [ class "cell date" ] + , div [ classList [ ( "cell next-due ", True ), ( "red", status == StatusBehind ) ] ] + [ text nextDueText ] + , div [ class <| "cell status " ++ statusClass ] + [ text <| translate language <| Translate.VaccinationStatus status ] + ] + in + entriesHeading :: entries + + viewChwActivityPane : Language -> NominalDate -> Bool -> AssembledData -> Html Msg viewChwActivityPane language currentDate isChw assembled = let diff --git a/client/src/elm/Pages/WellChild/Activity/Types.elm b/client/src/elm/Pages/WellChild/Activity/Types.elm index 80cbb5d492..3aebdae180 100644 --- a/client/src/elm/Pages/WellChild/Activity/Types.elm +++ b/client/src/elm/Pages/WellChild/Activity/Types.elm @@ -1,12 +1,6 @@ module Pages.WellChild.Activity.Types exposing (..) -type VaccinationStatus - = StatusBehind - | StatusCompleted - | StatusUpToDate - - type DangerSignsTask = TaskSymptomsReview | TaskVitals diff --git a/client/src/elm/Pages/WellChild/Activity/View.elm b/client/src/elm/Pages/WellChild/Activity/View.elm index 302b01268e..eec4be6781 100644 --- a/client/src/elm/Pages/WellChild/Activity/View.elm +++ b/client/src/elm/Pages/WellChild/Activity/View.elm @@ -34,6 +34,7 @@ import Measurement.Model , PhotoForm , VaccinationFormViewMode(..) , VaccinationProgressDict + , VaccinationStatus(..) , VitalsForm , VitalsFormMode(..) ) diff --git a/client/src/elm/Translate.elm b/client/src/elm/Translate.elm index 586dddb252..a8edd97e3a 100644 --- a/client/src/elm/Translate.elm +++ b/client/src/elm/Translate.elm @@ -79,6 +79,7 @@ import Measurement.Model , LaboratoryTask(..) , NCDAStep(..) , NextStepsTask(..) + , VaccinationStatus(..) ) import Pages.AcuteIllness.Activity.Types exposing @@ -144,7 +145,6 @@ import Pages.WellChild.Activity.Types ( HomeVisitTask(..) , NextStepsTask(..) , NutritionAssessmentTask(..) - , VaccinationStatus(..) ) import Pages.WellChild.Encounter.Model exposing (ECDPopupType(..), WarningPopupType(..)) import Pages.WellChild.ProgressReport.Model @@ -18524,6 +18524,9 @@ translationSet trans = , kirundi = Just "Isuzuma ry'ivyara" } + ComponentAntenatalImmunizationHistory -> + translationSet ImmunizationHistory + ComponentAntenatalCHWActivity -> { english = "CHW Activity" , kinyarwanda = Nothing