Skip to content

Commit

Permalink
The system should not allow to add PEP record for a patient if: 1. pa…
Browse files Browse the repository at this point in the history
…tient has HIV Confirmed Date in Intake-A 2. HIV Status = Reactive
  • Loading branch information
melkam-mekonnen committed Jul 30, 2024
1 parent 1d4114a commit 96af1f3
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 3 deletions.
8 changes: 6 additions & 2 deletions src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ export const priorityPopulationTypeConcept =
export const dateOfHIVDiagnosisConcept = "160554AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA";
export const dateOfHIVConfirmation = "160753AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA";
export const exposedPersonStatus = "ad4935e0-624a-4e01-8e51-02acd0b45f07";
export const hivStatus = "21ea1d83-acd7-4c99-b4cc-33a90e6dd7d7";
export const regimen = "6d7d0327-e1f8-4246-bfe5-be1e82d94b14";
export const artStartdate = "ae329187-6232-4142-aa91-22c85bc8e5b5";
export const entryPointConcept = "160540AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA";
Expand Down Expand Up @@ -174,10 +175,13 @@ export const formWarning = (formName) =>

export const POSITIVE_PATIENT_WARNING =
"* Patient has already been confirmed as HIV positive !";
export const REACTIVE_EXPOSED_PERSON_WARNING =

export const REACTIVE_EXPOSED_PERSON_WARNING =
"* Exposed person's status is reactive in PEP Registration form !";

export const REACTIVE_HIV_STATUS_WARNING =
"* Patient's HIV status is reactive in a previous PEP Followup form !";

export const AGE_ABOVE_THREE_WARNING =
"* Children above three years old are not eligible for PMTCT !";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@ import {
MRN_NULL_WARNING,
POSITIVE_PATIENT_WARNING,
REACTIVE_EXPOSED_PERSON_WARNING,
REACTIVE_HIV_STATUS_WARNING,
POST_EXPOSURE_FOLLOWUP_ENCOUNTER_TYPE,
POST_EXPOSURE_REGISTRATION_ENCOUNTER_TYPE,
dateOfHIVConfirmation,
exposedPersonStatus,
hivStatus,
formWarning,
} from "../../../constants";
import { getData } from "../../encounterUtils";
Expand Down Expand Up @@ -104,6 +106,7 @@ const PostExposureFollowup = ({ patientUuid, isFormSaved }) => {
const [hasScreeningEncounter, setHasScreeningEncounter] = useState(false);
const [isConfirmedPositive, setIsConfirmedPositive] = useState(false);
const [isExposedPersonReactive, setIsExposedPersonReactive] = useState(false);
const [isHivStatusReactive, setIsHivStatusReactive] = useState(false);

useEffect(() => {
(async () => {
Expand Down Expand Up @@ -140,6 +143,14 @@ const PostExposureFollowup = ({ patientUuid, isFormSaved }) => {
);
if (exposedPerson == '1228AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA') setIsExposedPersonReactive(true);
})();
(async () => {
const hivStatusReactive = await getLatestObs(
patientUuid,
hivStatus,
POST_EXPOSURE_FOLLOWUP_ENCOUNTER_TYPE
);
if (hivStatusReactive == '1228AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA') setIsHivStatusReactive(true);
})();
});
return (
<>
Expand All @@ -154,7 +165,7 @@ const PostExposureFollowup = ({ patientUuid, isFormSaved }) => {
displayText: "Add",
moduleName: moduleName,
hideFormLauncher:
!hasMRN || !hasScreeningEncounter || isConfirmedPositive || isExposedPersonReactive,
!hasMRN || !hasScreeningEncounter || isConfirmedPositive || isExposedPersonReactive || isHivStatusReactive,
}}
/>
{!hasMRN && <p className={styles.patientName}>{MRN_NULL_WARNING}</p>}
Expand All @@ -167,6 +178,9 @@ const PostExposureFollowup = ({ patientUuid, isFormSaved }) => {
{isExposedPersonReactive && (
<p className={styles.patientName}>{REACTIVE_EXPOSED_PERSON_WARNING}</p>
)}
{isHivStatusReactive && (
<p className={styles.patientName}>{REACTIVE_HIV_STATUS_WARNING}</p>
)}
</>
);
};
Expand Down

0 comments on commit 96af1f3

Please sign in to comment.