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

O3-1713: Order basket drug search implemented with SWR #922

Merged
merged 16 commits into from
Jan 3, 2023
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Code cleanup
vasharma05 committed Dec 21, 2022

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
commit 02c4ce84e5d2d97014658c16a4ed7a2e60a7a06b
15 changes: 0 additions & 15 deletions packages/esm-patient-medications-app/src/api/api.ts
Original file line number Diff line number Diff line change
@@ -44,15 +44,6 @@ export function getPatientEncounterId(patientUuid: string, abortController: Abor
});
}

export function getDrugByName(drugName: string, abortController?: AbortController) {
return openmrsFetch(
`/ws/rest/v1/drug?q=${drugName}&v=custom:(uuid,display,name,strength,dosageForm:(display,uuid),concept)`,
{
signal: abortController?.signal,
},
);
}

export function useDurationUnits(durationUnitsConcept) {
const url = `/ws/rest/v1/concept/${durationUnitsConcept}?v=custom:(answers:(uuid,display))`;
const { data, error } = useSWRImmutable<FetchResponse<{ answers: Array<OpenmrsResource> }>, Error>(
@@ -81,12 +72,6 @@ export function getMedicationByUuid(abortController: AbortController, orderUuid:
);
}

export function getOrderTemplatesByDrug(drugUuid: string, abortController?: AbortController) {
return openmrsFetch(`/ws/rest/v1/ordertemplates/orderTemplate?drug=${drugUuid}&retired=${false}`, {
signal: abortController?.signal,
});
}

export function useCurrentOrderBasketEncounter(patientUuid: string) {
const [nowDateString] = new Date().toISOString().split('T');
const sessionObject = useSession();
154 changes: 0 additions & 154 deletions packages/esm-patient-medications-app/src/order-basket/drug-search.ts

This file was deleted.

Original file line number Diff line number Diff line change
@@ -52,7 +52,7 @@ export default function OrderBasketSearchResults({
<InlineNotification
kind="error"
lowContrast={true}
title={t('errorFetchingDrugResults', 'Error fetching medications')}
title={t('errorFetchingDrugResults', 'Error fetching drugs')}
subtitle={t('trySearchingDrugsAgain', 'Please try searching again')}
caption={error?.message}
/>
6 changes: 4 additions & 2 deletions packages/esm-patient-medications-app/translations/en.json
Original file line number Diff line number Diff line change
@@ -29,6 +29,8 @@
"emptyOrderBasket": "Your basket is empty",
"endDate": "End date",
"error": "Error",
"errorFetchingDrugOrderTemplates": "Error fetching drug order templates",
"errorFetchingDrugResults": "Error fetching medications",
"errorFetchingDurationUnits": "Error occured when fetching duration units",
"fetchingDurationUnits": "Fetching duration units...",
"freeTextDosage": "Free Text Dosage",
@@ -73,12 +75,12 @@
"revisedOrders_one": "{count} order(s) being modified (revised)",
"revisedOrders_other": "{count} order(s) being modified (revised)",
"saveOrder": "Save order",
"searchFieldPlaceholder": "Search for an order (e.g. \"Aspirin\")",
"searchForAnOrder": "Search for an order above",
"searchResultsExactMatchesForTerm_one": "{count} exact match(es) for \"{searchTerm}\"",
"searchResultsExactMatchesForTerm_other": "{count} exact match(es) for \"{searchTerm}\"",
"signAndClose": "Sign and close",
"startDate": "Start date",
"takeAsNeeded": "Take As Needed",
"tryReopeningTheForm": "Please try launching the form again"
"tryReopeningTheForm": "Please try launching the form again",
"trySearchingDrugsAgain": "Please try searching again"
}