Skip to content

Commit

Permalink
Error loading retention visit (#1326)
Browse files Browse the repository at this point in the history
Co-authored-by: kantush <sainingo>
  • Loading branch information
sainingo authored Sep 11, 2023
1 parent 06153d5 commit d77b4b6
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions programs/scope-builder.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,6 @@ function buildScope(dataDictionary) {
buildPatientScopeMembers(scope, dataDictionary.patient);
}

if (dataDictionary.patient) {
const result = conditionalDCVisits(dataDictionary);
if (result) {
isStandardDcVisit = true;
}
}

if (dataDictionary.enrollment) {
buildProgramScopeMembers(scope, dataDictionary.enrollment);
}
Expand Down Expand Up @@ -70,6 +63,10 @@ function buildScope(dataDictionary) {
}

if (dataDictionary.dcQualifedVisits) {
const result = conditionalDCVisits(dataDictionary);
if (result) {
isStandardDcVisit = true;
}
if (
dataDictionary.dcQualifedVisits.qualifies_for_standard_visit === 1 ||
isStandardDcVisit
Expand Down Expand Up @@ -169,8 +166,11 @@ function conditionalDCVisits(patient) {
const latestEncounter = getLatestEncounter(patientEncounters);
const expectedEncounterToBeDrugPickup =
'987009c6-6f24-43f7-9640-c285d6553c63';
// return true if the latest encounter is a drug pickup
return latestEncounter.encounterType.uuid === expectedEncounterToBeDrugPickup;
if (latestEncounter) {
return (
latestEncounter.encounterType.uuid === expectedEncounterToBeDrugPickup
);
}
}

function buildPatientScopeMembers(scope, patient) {
Expand Down

0 comments on commit d77b4b6

Please sign in to comment.