Skip to content

Commit 8cd6171

Browse files
committed
Use HS terminology server
1 parent 08a680c commit 8cd6171

2 files changed

Lines changed: 18 additions & 1 deletion

File tree

src/main.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,14 @@ import '@beda.software/emr/dist/style.css';
1414
// Use you https://github.com/beda-software/fhir-emr/blob/master/src/theme/ThemeProvider.tsx as example
1515
import { PatientDashboardProvider } from '@beda.software/emr/dist/components/Dashboard/contexts';
1616
import { DateTimeFormatContext } from '@beda.software/emr/dist/contexts/date-time-format';
17+
import { ValueSetExpandProvider } from '@beda.software/emr/contexts';
1718

1819
import { App } from './containers/App';
1920
import { dashboard } from './containers/PatientDetails/Dashboard/config';
2021
import { dynamicActivate, getCurrentLocale } from './services/i18n';
2122
import { ThemeProvider } from './theme';
2223
import { dateFormats } from './utils/date';
24+
import { expandValueSet } from './services/terminology';
2325

2426
export const AppWithContext = () => {
2527
useEffect(() => {
@@ -31,7 +33,9 @@ export const AppWithContext = () => {
3133
<DateTimeFormatContext.Provider value={dateFormats}>
3234
<PatientDashboardProvider dashboard={dashboard}>
3335
<ThemeProvider>
34-
<App />
36+
<ValueSetExpandProvider.Provider value={expandValueSet}>
37+
<App />
38+
</ValueSetExpandProvider.Provider>
3539
</ThemeProvider>
3640
</PatientDashboardProvider>
3741
</DateTimeFormatContext.Provider>

src/services/terminology.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import { expandHealthSamuraiValueSet } from '@beda.software/emr/services';
2+
import { isSuccess } from '@beda.software/remote-data';
3+
4+
5+
export async function expandValueSet(answerValueSet: string | undefined, searchText: string) {
6+
if (answerValueSet) {
7+
const response = await expandHealthSamuraiValueSet(answerValueSet, searchText);
8+
if (isSuccess(response)){
9+
return response.data;
10+
}
11+
}
12+
return [];
13+
}

0 commit comments

Comments
 (0)