diff --git a/web/src/components/ModalExpression/hooks.ts b/web/src/components/ModalExpression/hooks.ts index 416c8bef..d514c2f8 100644 --- a/web/src/components/ModalExpression/hooks.ts +++ b/web/src/components/ModalExpression/hooks.ts @@ -1,13 +1,13 @@ +import { useService } from '@beda.software/fhir-react'; +import { isSuccess } from '@beda.software/remote-data'; import fhirpath from 'fhirpath'; import yaml from 'js-yaml'; import { useCallback, useContext, useEffect, useState } from 'react'; import { extractParameterName } from 'web/src/components/ModalExpression/utils'; import { ExpressionResultOutput } from 'web/src/containers/Main/types'; +import { service } from 'web/src/services/fhir'; import YAML, { visitor } from 'yaml'; -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'; diff --git a/web/src/components/ResourceSelect/index.tsx b/web/src/components/ResourceSelect/index.tsx index b5c50356..10f741fc 100644 --- a/web/src/components/ResourceSelect/index.tsx +++ b/web/src/components/ResourceSelect/index.tsx @@ -1,12 +1,11 @@ +import { RenderRemoteData, WithId } from '@beda.software/fhir-react'; +import { mapSuccess, isSuccess, RemoteData } from '@beda.software/remote-data'; import classNames from 'classnames'; import { Bundle, Resource } from 'fhir/r4b'; import _ from 'lodash'; import { useCallback } from 'react'; import { MultiValue, SingleValue } from 'react-select'; - -import { RenderRemoteData, WithId} from '@beda.software/fhir-react'; -import { getFHIRResources } from 'src/services/fhir'; -import { mapSuccess, isSuccess, RemoteData } from '@beda.software/remote-data'; +import { getFHIRResources } from 'web/src/services/fhir'; import s from './ResourceSelect.module.scss'; import { AsyncSelect } from '../Select'; diff --git a/web/src/components/SourceQueryDebugModal/hooks.ts b/web/src/components/SourceQueryDebugModal/hooks.ts index b9178268..7d424057 100644 --- a/web/src/components/SourceQueryDebugModal/hooks.ts +++ b/web/src/components/SourceQueryDebugModal/hooks.ts @@ -1,11 +1,10 @@ +import { useService, formatError } from '@beda.software/fhir-react'; +import { isFailure, success, isSuccess, mapSuccess } from '@beda.software/remote-data'; import { Questionnaire, Bundle, Resource } from 'fhir/r4b'; import * as _ from 'lodash'; import { useCallback, useState } from 'react'; import { toast } from 'react-toastify'; - -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 { saveFHIRResource, service } from 'web/src/services/fhir'; import { Props } from './types'; diff --git a/web/src/containers/Main/QuestionnaireEditor/useQuestionnaireEditor.ts b/web/src/containers/Main/QuestionnaireEditor/useQuestionnaireEditor.ts index e5a3656e..28cece15 100644 --- a/web/src/containers/Main/QuestionnaireEditor/useQuestionnaireEditor.ts +++ b/web/src/containers/Main/QuestionnaireEditor/useQuestionnaireEditor.ts @@ -1,8 +1,7 @@ -import { Questionnaire } from 'fhir/r4b'; - import { useService, extractBundleResources } from '@beda.software/fhir-react'; -import { getFHIRResources } from 'src/services/fhir'; import { mapSuccess } from '@beda.software/remote-data'; +import { Questionnaire } from 'fhir/r4b'; +import { getFHIRResources } from 'web/src/services/fhir'; export function useQuestionnaireEditor() { const [questionnairesRD] = useService(async () => diff --git a/web/src/containers/Main/context.ts b/web/src/containers/Main/context.ts index c91f4178..87bc7167 100644 --- a/web/src/containers/Main/context.ts +++ b/web/src/containers/Main/context.ts @@ -1,18 +1,20 @@ +import { RemoteDataResult } from '@beda.software/remote-data'; +import { Parameters, Questionnaire, QuestionnaireResponse } from 'fhir/r4b'; import { createContext } from 'react'; import { QRFormWrapper } from 'web/src/components/QRFormWrapper'; -import { RemoteDataResult } from '@beda.software/remote-data'; +import { assemble, populate } from 'web/src/services/sdc'; -import { Parameters, Questionnaire, QuestionnaireResponse } from "fhir/r4b"; import { QRFWrapper } from './types'; -import { assemble, populate } from 'src/services/sdc'; -type AssembleService = (qId:string) => Promise> -type PopulateService = (launchContext:Parameters) => Promise> +type AssembleService = (qId: string) => Promise>; +type PopulateService = ( + launchContext: Parameters, +) => Promise>; interface SDCContextType { - assemble: AssembleService - populate: PopulateService + assemble: AssembleService; + populate: PopulateService; } export const FormRenderContext = createContext(QRFormWrapper); -export const SDCContext = createContext({ assemble, populate }) +export const SDCContext = createContext({ assemble, populate }); diff --git a/web/src/containers/Main/useMain.ts b/web/src/containers/Main/useMain.ts index 109b90c4..e2ec083f 100644 --- a/web/src/containers/Main/useMain.ts +++ b/web/src/containers/Main/useMain.ts @@ -1,15 +1,20 @@ +import { useService, WithId , formatError } from '@beda.software/fhir-react'; import { - Questionnaire, - Parameters, - ParametersParameter, - Bundle, - FhirResource, -} from 'fhir/r4b'; + RemoteData, + RemoteDataResult, + failure, + isFailure, + isSuccess, + notAsked, + success, +} from '@beda.software/remote-data'; +import { Questionnaire, Parameters, ParametersParameter, Bundle, FhirResource } from 'fhir/r4b'; import { useCallback, useContext, useState } from 'react'; import { useNavigate } from 'react-router-dom'; import { toast } from 'react-toastify'; import { generateMappingService, generateQuestionnaireService } from 'web/src/services/builder'; import { applyMapping as applyMappingService, extract } from 'web/src/services/extract'; +import { service, saveFHIRResource } from 'web/src/services/fhir'; import { createFHIRResource as createAidboxFHIRResource, @@ -17,25 +22,13 @@ import { saveFHIRResource as saveAidboxFHIRResource, } from 'aidbox-react/lib/services/fhir'; -import { useService, WithId } from '@beda.software/fhir-react'; -import { - RemoteData, - RemoteDataResult, - failure, - isFailure, - isSuccess, - notAsked, - success, -} from '@beda.software/remote-data'; // import { WithId, saveFHIRResource } from 'fhir-react/lib/services/fhir'; // import { service } from 'fhir-react/lib/services/service'; -import {service, saveFHIRResource} from 'src/services/fhir'; -import { formatError } from '@beda.software/fhir-react'; import { Mapping } from 'shared/src/contrib/aidbox'; -import { getMappings, makeMappingExtension } from './utils'; import { SDCContext } from './context'; +import { getMappings, makeMappingExtension } from './utils'; export function useLaunchContext() { const [launchContext, setLaunchContext] = useState({ @@ -65,7 +58,7 @@ export function useLaunchContext() { export function useMain(questionnaireId: string) { const navigate = useNavigate(); - const {assemble, populate} = useContext(SDCContext) + const { assemble, populate } = useContext(SDCContext); const { launchContext, setLaunchContext, clearLaunchContext } = useLaunchContext(); const [mappingRD, setMappingRD] = useState>>(notAsked); @@ -107,7 +100,8 @@ export function useMain(questionnaireId: string) { const [assembledQuestionnaireRD, assembledQuestionnaireRDManager] = useService( () => assemble(questionnaireId), - [questionnaireId, assemble]); + [questionnaireId, assemble], + ); const reloadQuestionnaire = useCallback(async () => { originalQuestionnaireRDManager.reload(); @@ -178,7 +172,8 @@ export function useMain(questionnaireId: string) { const [questionnaireResponseRD, questionnaireResponseRDManager] = useService( () => populate(launchContext), - [launchContext, populate]); + [launchContext, populate], + ); const createMapping = useCallback( async (mapping: Mapping) => {