Skip to content

Commit

Permalink
Add pTracker Id to the mamba report endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
hadijahkyampeire committed Jul 17, 2024
1 parent 4588dab commit cd89502
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 9 deletions.
2 changes: 1 addition & 1 deletion packages/esm-commons-lib/src/api.resource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ export function fetchEtlData(
let endpoint = '';
switch (reportType) {
case 'fetchMambaAncData':
endpoint = `/ws/rest/v1/mamba/report?report_id=${reportId}&person_uuid=${patientUuid}`;
endpoint = `/ws/rest/v1/mamba/report?report_id=${reportId}&ptracker_id=${pTrackerId}&person_uuid=${patientUuid}`;
break;
case 'MotherHivStatus':
endpoint = `/ws/rest/v1/mamba/report?report_id=${reportId}&ptracker_id=${pTrackerId}&person_uuid=${patientUuid}`;
Expand Down
17 changes: 13 additions & 4 deletions packages/esm-commons-lib/src/utils/summary-card-config-builder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,23 +16,32 @@ export const getSummaryCardProps = (schemaConfig, config = null) => {
return getConditionalConceptValue(encounter, column.conditionalConceptMappings, column.isDate);
}

const pTrackerId = encounter?.patient?.identifiers.find(
(id) => id?.identifierType?.uuid === config?.identifiersTypes?.ptrackerIdentifierType,
)?.identifier;

if (column?.mambaEtlData === 'ancVisits') {
const response = fetchEtlData('fetchMambaAncData', 'no_of_anc_visits', encounter?.patient?.uuid);
const response = fetchEtlData('fetchMambaAncData', 'no_of_anc_visits', encounter?.patient?.uuid, pTrackerId);
return response?.data;
}

if (column?.mambaEtlData === 'motherStatus') {
const response = fetchEtlData('fetchMambaAncData', 'mother_status', encounter?.patient?.uuid);
const response = fetchEtlData('fetchMambaAncData', 'mother_status', encounter?.patient?.uuid, pTrackerId);
return response?.data;
}

if (column?.mambaEtlData === 'deliveryDate') {
const response = fetchEtlData('fetchMambaAncData', 'estimated_date_of_delivery', encounter?.patient?.uuid);
const response = fetchEtlData(
'fetchMambaAncData',
'estimated_date_of_delivery',
encounter?.patient?.uuid,
pTrackerId,
);
return response?.data;
}

if (column?.mambaEtlData === 'motherHivStatus') {
const response = fetchEtlData('fetchMambaAncData', 'mother_hiv_status', encounter?.patient?.uuid);
const response = fetchEtlData('fetchMambaAncData', 'mother_hiv_status', encounter?.patient?.uuid, pTrackerId);
return response?.data;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,20 @@
{
"id": "motherHIVStatus",
"title": "Mother HIV Status",
"encounterTypes": [],
"encounterTypes": ["antenatalEncounterType", "laborAndDeliveryEncounterType", "motherPostnatalEncounterType"],
"mambaEtlData": "motherHivStatus"
},
{
"id": "expectedDeliveryDate",
"title": "Expected Delivery Date",
"encounterTypes": [],
"encounterTypes": ["antenatalEncounterType", "laborAndDeliveryEncounterType", "motherPostnatalEncounterType"],
"mambaEtlData": "deliveryDate"
},
{
"id": "motherStatus",
"title": "Mother Status",
"encounterTypes": [],
"encounterTypes": ["antenatalEncounterType", "laborAndDeliveryEncounterType", "motherPostnatalEncounterType"],
"mambaEtlData": "motherStatus"
}
]
}
}

0 comments on commit cd89502

Please sign in to comment.