Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(fix) Add pTracker Id to the mamba report endpoint #1908

Merged
merged 1 commit into from
Jul 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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"
}
]
}
}
Loading