Skip to content

Commit

Permalink
Merge branch 'use-fhir-questionnaire' of https://github.com/beda-soft…
Browse files Browse the repository at this point in the history
…ware/sdc-ide into 69-use-fhir-questionnaire
  • Loading branch information
ialakey committed Jun 27, 2024
2 parents 63f468a + 4a51eea commit a7b0408
Show file tree
Hide file tree
Showing 42 changed files with 880 additions and 538 deletions.
32 changes: 20 additions & 12 deletions shared/src/constants.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,21 @@
export const baseURL =
(window as any).BASE_URL === '{{BASE_URL}}'
? 'http://localhost:8080/'
: (window as any).BASE_URL;
export const juteURL =
(window as any).JUTE_URL === '{{JUTE_URL}}'
? 'http://localhost:8090/'
: (window as any).JUTE_URL;
const envs = {
baseURL: ['BASE_URL', 'http://localhost:8080'],
juteURL: ['JUTE_URL', 'http://localhost:8099'],
aiQuestionnaireBuilderUrl: ['AI_BUILDER_URL', 'http://localhost:3002'],
fhirpathMappingUrl: ['FHIRPATHMAPPING_URL', 'http://localhost:8091'],
fhirMappingLanguageUrl: ['FHIRMAPPING_URL','http://localhost:8084/matchboxv3/fhir']
}

export const aiQuestionnaireBuilderUrl = 'https://builder.emr.beda.software';
// export const aiQuestionnaireBuilderUrl = 'http://localhost:3002';
export const fhirpathMappingUrl = 'https://fhirpathmapper.emr.beda.software';
// export const fhirpathMappingUrl = 'http://localhost:8091';
export const configuration:Record<keyof typeof envs,string> = {} as any;

const globalConfig = (window as any)

Object.keys(envs).forEach((key) => {
const [globalKey,defaultValue] = envs[key];
if(globalConfig[globalKey] == `{{${globalKey}}}`){
configuration[key] = defaultValue;
} else {
configuration[key] = globalConfig[globalKey];
}
})
console.log(configuration)
2 changes: 1 addition & 1 deletion vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const require = createRequire(import.meta.url);
export const getBaseConfig = ({ plugins = [], build = {}, test = {} }) =>
defineConfig(({ command }) => ({
server: {
port: command === 'build' ? 5000 : 3000,
port: command === 'build' ? 5000 : 3001,
},
plugins: [
viteCommonjs(),
Expand Down
5 changes: 4 additions & 1 deletion web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,14 @@
"version": "0.3.1",
"private": true,
"dependencies": {
"@beda.software/fhir-react": "^1.8.6",
"@beda.software/remote-data": "^1.1.3",
"@codemirror/commands": "^6.2.4",
"@codemirror/language": "^6.9.0",
"@codemirror/legacy-modes": "^6.3.3",
"@codemirror/state": "^6.2.1",
"@codemirror/view": "^6.16.0",
"@monaco-editor/react": "^4.6.0",
"@sentry/browser": "^6.19.7",
"@sentry/react": "^6.19.7",
"@sentry/tracing": "^6.19.7",
Expand All @@ -31,10 +34,10 @@
"@types/react-toastify": "^4.1.0",
"@types/yaml": "^1.9.7",
"aidbox-react": "^1.4.0",
"allotment": "^1.20.2",
"babel-loader": "8.1.0",
"babel-plugin-import": "^1.13.3",
"classnames": "^2.3.1",
"fhir-react": "https://github.com/beda-software/fhir-react.git",
"fhirpath": "^3.5.0",
"final-form": "^4.20.4",
"final-form-arrays": "^3.0.2",
Expand Down
33 changes: 33 additions & 0 deletions web/src/components/Cell/Cell.module.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
@import 'src/styles/colors';

.title {
display: flex;
line-height: 32px;
margin-bottom: 3px;
}

.container {
width: 100%;
height: 100%;
overflow: auto;
display: flex;
flex-direction: column;
}

.evenContainer {
background-color: $base-light-color;
}

.oddContainer {
background-color: $base-surface-color;
}

.content {
flex: 1;
padding: 20px;
overflow-y: auto;
}

.boxHeader {
position: relative;
}
23 changes: 23 additions & 0 deletions web/src/components/Cell/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import classNames from 'classnames';

import s from './Cell.module.scss';

interface CellProps extends React.HTMLAttributes<HTMLDivElement> {
title?: string;
even?: boolean;
}

export function Cell({ title, children, even }: CellProps) {
const isEven = even ?? false;

return (
<div className={classNames(s.container, isEven ? s.evenContainer : s.oddContainer)}>
<div className={s.content}>
<div className={s.boxHeader}>
<h2 className={s.title}>{title}</h2>
</div>
{children}
</div>
</div>
);
}
74 changes: 0 additions & 74 deletions web/src/components/ExpandableElement/ExpandableElement.module.scss

This file was deleted.

49 changes: 0 additions & 49 deletions web/src/components/ExpandableElement/index.tsx

This file was deleted.

16 changes: 0 additions & 16 deletions web/src/components/ExpandableRow/ExpandableRow.module.scss

This file was deleted.

20 changes: 0 additions & 20 deletions web/src/components/ExpandableRow/index.tsx

This file was deleted.

2 changes: 1 addition & 1 deletion web/src/components/LaunchContextEditor/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { FhirResource, Parameters, ParametersParameter, Questionnaire } from 'fh
import { useMemo, useState } from 'react';
import { SingleValue } from 'react-select';

import { success } from 'fhir-react/lib/libs/remoteData';
import { success } from '@beda.software/remote-data';

import { groupLaunchContextParams } from './groupLaunchContextParams';
import s from './LaunchContextEditor.module.scss';
Expand Down
6 changes: 3 additions & 3 deletions web/src/components/ModalExpression/hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import { extractParameterName } from 'web/src/components/ModalExpression/utils';
import { ExpressionResultOutput } from 'web/src/containers/Main/types';
import YAML, { visitor } from 'yaml';

import { useService } from 'fhir-react/lib/hooks/service';
import { isSuccess } from 'fhir-react/lib/libs/remoteData';
import { service } from 'fhir-react/lib/services/service';
import { useService } from '@beda.software/fhir-react';
import { isSuccess } from '@beda.software/remote-data';
import { service } from 'src/services/fhir';

import { QuestionnaireResponse } from 'shared/src/contrib/aidbox';

Expand Down
2 changes: 1 addition & 1 deletion web/src/components/ModalExpression/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { InputField } from 'web/src/components/InputField';
import { useExpressionModal } from 'web/src/components/ModalExpression/hooks';
import { ResourceCodeDisplay } from 'web/src/components/ResourceCodeDisplay';

import { isSuccess, RemoteData } from 'fhir-react/lib/libs/remoteData';
import { isSuccess, RemoteData } from '@beda.software/remote-data';

import s from './ModalExpression.module.scss';
import { ModalExpressionProps } from './types';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,8 @@ import fhirpath from 'fhirpath';
import { ActionMeta, MultiValue, SingleValue } from 'react-select';
import { loadResourceOptions } from 'web/src/services/questionnaire';

import { isSuccess } from 'fhir-react/lib/libs/remoteData';
import { ResourcesMap } from 'fhir-react/lib/services/fhir';
import { buildQueryParams } from 'fhir-react/lib/services/instance';
import { isSuccess, buildQueryParams } from '@beda.software/remote-data';
import { ResourcesMap } from '@beda.software/fhir-react';

import {
QuestionnaireItemAnswerOption,
Expand Down
4 changes: 2 additions & 2 deletions web/src/components/QRFormWrapper/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ import { useFormContext } from 'react-hook-form';
import { RenderRemoteData } from 'web/src/components/RenderRemoteData';
import { QRFormWrapperProps } from 'web/src/containers/Main/types';

import { sequenceMap } from 'fhir-react/lib/services/service';
import { formatError } from 'fhir-react/lib/utils/error';
import { sequenceMap } from '@beda.software/remote-data';
import { formatError } from '@beda.software/fhir-react';

import { QuestionnaireResponse as FCEQuestionnaireResponse } from 'shared/src/contrib/aidbox';

Expand Down
4 changes: 2 additions & 2 deletions web/src/components/RenderRemoteData.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import {
isNotAsked,
isSuccess,
RemoteData,
} from 'fhir-react/lib/libs/remoteData';
import { formatError } from 'fhir-react/lib/utils/error';
} from '@beda.software/remote-data';
import { formatError } from '@beda.software/fhir-react';

interface RenderRemoteDataProps<S, E = any> {
remoteData: RemoteData<S, E>;
Expand Down
7 changes: 3 additions & 4 deletions web/src/components/ResourceSelect/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@ import _ from 'lodash';
import { useCallback } from 'react';
import { MultiValue, SingleValue } from 'react-select';

import { RenderRemoteData } from 'fhir-react/lib/components/RenderRemoteData';
import { isSuccess, RemoteData } from 'fhir-react/lib/libs/remoteData';
import { getFHIRResources, WithId } from 'fhir-react/lib/services/fhir';
import { mapSuccess } from 'fhir-react/lib/services/service';
import { RenderRemoteData, WithId} from '@beda.software/fhir-react';
import { getFHIRResources } from 'src/services/fhir';
import { mapSuccess, isSuccess, RemoteData } from '@beda.software/remote-data';

import s from './ResourceSelect.module.scss';
import { AsyncSelect } from '../Select';
Expand Down
8 changes: 3 additions & 5 deletions web/src/components/SourceQueryDebugModal/hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,9 @@ import * as _ from 'lodash';
import { useCallback, useState } from 'react';
import { toast } from 'react-toastify';

import { useService } from 'fhir-react/lib/hooks/service';
import { isFailure, success, isSuccess } from 'fhir-react/lib/libs/remoteData';
import { saveFHIRResource } from 'fhir-react/lib/services/fhir';
import { mapSuccess, service } from 'fhir-react/lib/services/service';
import { formatError } from 'fhir-react/lib/utils/error';
import { useService, formatError } from '@beda.software/fhir-react';
import { isFailure, success, isSuccess, mapSuccess } from '@beda.software/remote-data';
import { saveFHIRResource, service } from 'src/services/fhir';

import { Props } from './types';

Expand Down
2 changes: 1 addition & 1 deletion web/src/components/SourceQueryDebugModal/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Button } from 'web/src/components/Button';
import { CodeEditor } from 'web/src/components/CodeEditor';

import { RenderRemoteData } from 'fhir-react/lib/components/RenderRemoteData';
import { RenderRemoteData } from '@beda.software/fhir-react';

import { useSourceQueryDebugModal } from './hooks';
import s from './SourceQueryDebugModal.module.scss';
Expand Down
Loading

0 comments on commit a7b0408

Please sign in to comment.