From 80bafde4b3ac7e4f8e4151efd9be5c8e3f112226 Mon Sep 17 00:00:00 2001 From: 9sneha-n <9sneha.n@gmail.com> Date: Thu, 23 May 2024 21:31:54 +0530 Subject: [PATCH] fix: add facility code col for facility form --- src/data/entities/D2Survey.ts | 2 ++ src/data/utils/surveyListMappers.ts | 7 +++++++ src/domain/entities/Survey.ts | 1 + .../components/survey-list/table/SurveyListTable.tsx | 2 +- 4 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/data/entities/D2Survey.ts b/src/data/entities/D2Survey.ts index 94d397d..d272c6d 100644 --- a/src/data/entities/D2Survey.ts +++ b/src/data/entities/D2Survey.ts @@ -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"; diff --git a/src/data/utils/surveyListMappers.ts b/src/data/utils/surveyListMappers.ts index 0667bbe..cac8281 100644 --- a/src/data/utils/surveyListMappers.ts +++ b/src/data/utils/surveyListMappers.ts @@ -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"; @@ -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 ?? "", @@ -75,6 +81,7 @@ export const mapTrackedEntityToSurvey = ( surveyFormType: surveyFormType, childCount: undefined, uniquePatient: { id: patientId, code: "" }, + facilityCode: facilityCode, }; return survey; }); diff --git a/src/domain/entities/Survey.ts b/src/domain/entities/Survey.ts index d2f69a8..683c16b 100644 --- a/src/domain/entities/Survey.ts +++ b/src/domain/entities/Survey.ts @@ -54,4 +54,5 @@ export interface Survey extends SurveyBase { parentWardRegisterId?: Id; uniquePatient?: { id: string; code: string }; childCount?: number | ProgramOptionCountMap; + facilityCode?: string; } diff --git a/src/webapp/components/survey-list/table/SurveyListTable.tsx b/src/webapp/components/survey-list/table/SurveyListTable.tsx index a9574b9..b1a647b 100644 --- a/src/webapp/components/survey-list/table/SurveyListTable.tsx +++ b/src/webapp/components/survey-list/table/SurveyListTable.tsx @@ -277,7 +277,7 @@ export const SurveyListTable: React.FC = ({ {survey.assignedOrgUnit.name} )} {surveyFormType === "PrevalenceFacilityLevelForm" && ( - {survey.id} + {survey.facilityCode} )} {(surveyFormType === "PPSSurveyForm" ||