Skip to content

Commit

Permalink
Merge pull request #56 from EyeSeeTea/fix/facility-code-col
Browse files Browse the repository at this point in the history
facility code column
  • Loading branch information
MiquelAdell authored May 24, 2024
2 parents d634b0f + 80bafde commit 6dc75dd
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/data/entities/D2Survey.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ export const AMR_SURVEYS_PREVALENCE_TEA_PATIENT_ID = "mUaaSzbeMmj";
export const AMR_SURVEYS_PREVALENCE_TEA_AMRPATIENT_IDPREVALENCE = "M1D2XXokPWl";
export const AMR_SURVEYS_PREVALENCE_TEA_PATIENT_IDA19 = "yq8en6ZkENB";

export const AMR_SURVEYS_PREVALENCE_TEA_HOSPITAL_ID = "hpNIfydqgkD";

//Prevalence Tracked Entity Attribute types
export const PREVALENCE_FACILITY_LEVEL_TET = "eY4BDBKXegX";
export const PREVALENCE_CASE_REPORT_TET = "hyR1eTHLX8B";
Expand Down
7 changes: 7 additions & 0 deletions src/data/utils/surveyListMappers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import {
AMR_SURVEYS_MORTALITY_TEA_SURVEY_ID_FUP,
AMR_SURVEYS_MORTALITY_TEA_SURVEY_ID_DF,
AMR_SURVEYS_MORTALITY_TEA_SURVEY_ID_COH,
AMR_SURVEYS_PREVALENCE_TEA_HOSPITAL_ID,
} from "../entities/D2Survey";
import { D2TrackerEvent } from "@eyeseetea/d2-api/api/trackerEvents";
import { getSurveyNameBySurveyFormType } from "./surveyProgramHelper";
Expand Down Expand Up @@ -56,6 +57,11 @@ export const mapTrackedEntityToSurvey = (
attribute.attribute === AMR_SURVEYS_MORTALITY_TEA_PAT_ID_COH2
)?.value ?? "";

const facilityCode =
trackedEntity.attributes?.find(
attribute => attribute.attribute === AMR_SURVEYS_PREVALENCE_TEA_HOSPITAL_ID
)?.value ?? "";

const survey: Survey = {
id: trackedEntity.trackedEntity ?? "",
name: trackedEntity.trackedEntity ?? "",
Expand All @@ -75,6 +81,7 @@ export const mapTrackedEntityToSurvey = (
surveyFormType: surveyFormType,
childCount: undefined,
uniquePatient: { id: patientId, code: "" },
facilityCode: facilityCode,
};
return survey;
});
Expand Down
1 change: 1 addition & 0 deletions src/domain/entities/Survey.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,5 @@ export interface Survey extends SurveyBase {
parentWardRegisterId?: Id;
uniquePatient?: { id: string; code: string };
childCount?: number | ProgramOptionCountMap;
facilityCode?: string;
}
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ export const SurveyListTable: React.FC<SurveyListTableProps> = ({
<TableCell>{survey.assignedOrgUnit.name}</TableCell>
)}
{surveyFormType === "PrevalenceFacilityLevelForm" && (
<TableCell>{survey.id}</TableCell>
<TableCell>{survey.facilityCode}</TableCell>
)}

{(surveyFormType === "PPSSurveyForm" ||
Expand Down

0 comments on commit 6dc75dd

Please sign in to comment.