diff --git a/.git-blame-ignore-revs b/.git-blame-ignore-revs
new file mode 100644
index 00000000..f9c04067
--- /dev/null
+++ b/.git-blame-ignore-revs
@@ -0,0 +1,2 @@
+a8b6af245f10
+
diff --git a/web/src/components/MappingSelect/index.tsx b/web/src/components/MappingSelect/index.tsx
index b508e1f0..1a1a862b 100644
--- a/web/src/components/MappingSelect/index.tsx
+++ b/web/src/components/MappingSelect/index.tsx
@@ -3,7 +3,6 @@ import _ from 'lodash';
import { MappingSelectError } from 'web/src/components/MappingSelectError';
import { MappingErrorManager, Title } from 'web/src/containers/Main/types';
-
import s from './MappingSelect.module.scss';
interface MappingSelectProps {
diff --git a/web/src/components/ModalCreateMapper/index.tsx b/web/src/components/ModalCreateMapper/index.tsx
index c3d916c9..21c976d1 100644
--- a/web/src/components/ModalCreateMapper/index.tsx
+++ b/web/src/components/ModalCreateMapper/index.tsx
@@ -6,7 +6,6 @@ import { Button } from 'web/src/components/Button';
import { InputField } from 'web/src/components/InputField';
import { Select } from 'web/src/components/Select';
-
import s from './ModalCreateMapper.module.scss';
import { FieldWrapper } from '../FieldWrapper';
diff --git a/web/src/components/ModalExpression/utils.ts b/web/src/components/ModalExpression/utils.ts
index 324bf4ca..4893cdbb 100644
--- a/web/src/components/ModalExpression/utils.ts
+++ b/web/src/components/ModalExpression/utils.ts
@@ -1 +1,2 @@
-export const extractParameterName = (expression: string) => String(expression.split('.')[0]).slice(1);
+export const extractParameterName = (expression: string) =>
+ String(expression.split('.')[0]).slice(1);
diff --git a/web/src/components/TerminologyField/index.tsx b/web/src/components/TerminologyField/index.tsx
index 00e05ffd..5d676a35 100644
--- a/web/src/components/TerminologyField/index.tsx
+++ b/web/src/components/TerminologyField/index.tsx
@@ -7,7 +7,6 @@ import AsyncSelect from 'react-select/async';
import { isSuccess } from 'fhir-react/lib/libs/remoteData';
import { mapSuccess, service } from 'fhir-react/lib/services/service';
-
import s from './TerminologyField.module.scss';
interface TerminologyFieldProps {
diff --git a/web/src/containers/App/index.tsx b/web/src/containers/App/index.tsx
index bf46b0a7..34dc0950 100644
--- a/web/src/containers/App/index.tsx
+++ b/web/src/containers/App/index.tsx
@@ -8,7 +8,6 @@ import { RenderRemoteData } from 'fhir-react/lib/components/RenderRemoteData';
import { useService } from 'fhir-react/lib/hooks/service';
import { success } from 'fhir-react/lib/libs/remoteData';
-
import {
authorize,
getToken,
diff --git a/web/src/containers/Main/MappingEditor/MappingEditorError/index.tsx b/web/src/containers/Main/MappingEditor/MappingEditorError/index.tsx
index 6491eb31..1716a0f8 100644
--- a/web/src/containers/Main/MappingEditor/MappingEditorError/index.tsx
+++ b/web/src/containers/Main/MappingEditor/MappingEditorError/index.tsx
@@ -1,12 +1,12 @@
-import { Button } from "web/src/components/Button";
+import { Button } from 'web/src/components/Button';
-import { formatError } from "fhir-react/lib/utils/error";
+import { formatError } from 'fhir-react/lib/utils/error';
-import { MappingEditorErrorProps } from "../interfaces";
+import { MappingEditorErrorProps } from '../interfaces';
import s from '../MappingEditor.module.scss';
export function MappingEditorError(props: MappingEditorErrorProps) {
- const {error, setEditorSelect, editorState} = props;
+ const { error, setEditorSelect, editorState } = props;
return editorState !== 'ready' ? (
@@ -27,5 +27,5 @@ export function MappingEditorError(props: MappingEditorErrorProps) {
) : (
- )
-}
\ No newline at end of file
+ );
+}
diff --git a/web/src/containers/Main/MappingEditor/interfaces.ts b/web/src/containers/Main/MappingEditor/interfaces.ts
index bbfa1dba..bf0cbf0a 100644
--- a/web/src/containers/Main/MappingEditor/interfaces.ts
+++ b/web/src/containers/Main/MappingEditor/interfaces.ts
@@ -5,7 +5,6 @@ import { YAMLException } from 'js-yaml';
import { RemoteData, RemoteDataResult } from 'fhir-react/lib/libs/remoteData';
import { WithId } from 'fhir-react/lib/services/fhir';
-
export type EditorState = 'initial' | 'loading' | 'select' | 'ready';
interface CommonMappingEditorProps {
diff --git a/web/src/containers/Main/MappingEditor/useMappingEditor.ts b/web/src/containers/Main/MappingEditor/useMappingEditor.ts
index bb1d877e..9f814edb 100644
--- a/web/src/containers/Main/MappingEditor/useMappingEditor.ts
+++ b/web/src/containers/Main/MappingEditor/useMappingEditor.ts
@@ -19,7 +19,6 @@ import {
import { WithId, extractBundleResources } from 'fhir-react/lib/services/fhir';
import { mapSuccess } from 'fhir-react/lib/services/service';
-
import { EditorState } from './interfaces';
import { getMappings } from '../utils';
diff --git a/web/src/containers/Main/__test__/main-callback.test.ts b/web/src/containers/Main/__test__/main-callback.test.ts
index b45e7590..7ecdd05b 100644
--- a/web/src/containers/Main/__test__/main-callback.test.ts
+++ b/web/src/containers/Main/__test__/main-callback.test.ts
@@ -4,13 +4,9 @@ import { Questionnaire, QuestionnaireResponse } from 'fhir/r4b';
import { useMain } from 'web/src/containers/Main/useMain';
import { setData } from 'web/src/services/localStorage';
-import { isFailure, isSuccess } from 'fhir-react/lib/libs/remoteData';
-import { getFHIRResource } from 'fhir-react/lib/services/fhir';
-import { axiosInstance } from 'fhir-react/lib/services/instance';
import { service } from 'fhir-react/lib/services/service';
import { ensure } from 'fhir-react/lib/utils/tests';
-
import { EXPECTED_RESOURCES } from './resources';
import mappingDemo1 from './resources/Mapping/demo-1.json';
import mappingTest1New from './resources/Mapping/test-1-new.json';
@@ -110,49 +106,3 @@ test.skip(
},
timeOutMs,
);
-
-test.skip(
- 'saveNewMapping',
- async () => {
- const notFoundMappingId = 'foobar-100';
- const existingMappingId = 'foobar-101';
-
- await setup();
- const { result } = renderHook(() => useMain('test-1'));
-
- expect(
- result.current.saveNewMapping(
- EXPECTED_RESOURCES.mappingIdListEmpty,
- EXPECTED_RESOURCES.mappingInfoList,
- ),
- ).toBeUndefined();
-
- const responseBefore = await getFHIRResource({
- resourceType: 'Mapping',
- id: notFoundMappingId,
- });
-
- if (isFailure(responseBefore)) {
- expect(responseBefore.error.id).toBe('not-found');
- }
-
- await act(async () => {
- result.current.saveNewMapping(
- EXPECTED_RESOURCES.mappingIdList,
- EXPECTED_RESOURCES.mappingInfoList,
- );
- });
-
- const responseAfter = await getFHIRResource({
- resourceType: 'Mapping',
- id: existingMappingId,
- });
-
- if (isSuccess(responseAfter)) {
- expect(responseAfter.data.id).toBe(existingMappingId);
- } else {
- expect(responseAfter.error.id).toBe('not-found');
- }
- },
- timeOutMs,
-);
diff --git a/web/src/containers/Main/__test__/main.test.ts b/web/src/containers/Main/__test__/main.test.ts
index 1ef74611..0e91ab38 100644
--- a/web/src/containers/Main/__test__/main.test.ts
+++ b/web/src/containers/Main/__test__/main.test.ts
@@ -10,7 +10,6 @@ import { isSuccess } from 'fhir-react/lib/libs/remoteData';
import { service } from 'fhir-react/lib/services/service';
import { ensure } from 'fhir-react/lib/utils/tests';
-
const questionnaireIdInitial = 'demo-1';
import mappingDemo1 from './resources/Mapping/demo-1.json';
diff --git a/web/src/containers/Main/__test__/resources/index.tsx b/web/src/containers/Main/__test__/resources/index.tsx
index 95a89859..05e7780b 100644
--- a/web/src/containers/Main/__test__/resources/index.tsx
+++ b/web/src/containers/Main/__test__/resources/index.tsx
@@ -1,5 +1,4 @@
-import { OperationOutcome, Patient, Questionnaire } from 'fhir/r4b';
-import { MapperInfo } from 'web/src/components/ModalCreateMapper/types';
+import { Patient } from 'fhir/r4b';
import {
newQuestionnaireFHIR,
newQuestionnaireFHIRItem,
@@ -212,157 +211,6 @@ const batchRequestDemo1 = {
resourceType: 'Bundle',
};
-const idExtractionIssue = {
- expression: ['Questionnaire.mapping.2'],
- code: 'invalid',
- severity: 'fatal',
-};
-const idExtractionResource: Questionnaire = {
- mapping: [
- { id: 'demo-1', resourceType: 'Mapping' },
- { id: 'demo-2', resourceType: 'Mapping' },
- { id: 'foobar', resourceType: 'Mapping' },
- ],
- resourceType: 'Questionnaire',
- status: 'active',
-};
-const idExtractionResourceUndefined: Questionnaire = {
- mapping: [],
- resourceType: 'Questionnaire',
- status: 'active',
-};
-const idExtractionError: OperationOutcome = {
- resourceType: 'OperationOutcome',
- issue: [],
-};
-const idExtractionErrorUndefined: OperationOutcome = {
- //@ts-ignore
- resourceType: '',
- issue: [],
-};
-
-const mappingIdList = ['foobar-101'];
-
-const mappingIdListEmpty: [] = [];
-
-const mappingInfoList: MapperInfo[] = [
- {
- mappingId: 'foobar-101',
- resource: {
- item: [
- {
- item: [
- {
- text: 'First Name',
- type: 'string',
- linkId: 'first-name',
- initialExpression: {
- language: 'text/fhirpath',
- expression: '%LaunchPatient.name.given.first()',
- },
- },
- {
- text: 'Middle Name',
- type: 'string',
- linkId: 'middle-name',
- initialExpression: {
- language: 'text/fhirpath',
- expression: '%LaunchPatient.name.given[1]',
- },
- },
- {
- text: 'Last Name',
- type: 'string',
- linkId: 'last-name',
- initialExpression: {
- language: 'text/fhirpath',
- expression: '%LaunchPatient.name.family.first()',
- },
- },
- {
- text: 'Date of Birth',
- type: 'date',
- linkId: 'date-of-birth',
- initialExpression: {
- language: 'text/fhirpath',
- expression: '%LaunchPatient.birthDate',
- },
- },
- {
- text: 'Gender',
- type: 'string',
- linkId: 'gender',
- initialExpression: {
- language: 'text/fhirpath',
- expression: '%LaunchPatient.gender',
- },
- },
- {
- text: 'ID',
- type: 'string',
- hidden: true,
- linkId: 'patientId',
- initialExpression: {
- language: 'text/fhirpath',
- expression: '%LaunchPatient.id',
- },
- },
- ],
- text: 'Demographics',
- type: 'group',
- linkId: 'Demographics',
- },
- ],
- status: 'active',
- mapping: [
- {
- id: 'demo-1',
- resourceType: 'Mapping',
- },
- {
- id: 'foobar-101',
- resourceType: 'Mapping',
- },
- ],
- launchContext: [
- {
- name: { code: 'LaunchPatient' },
- type: ['Patient'],
- description: 'The patient that is to be used to pre-populate the form',
- },
- ],
- id: 'demo-1',
- resourceType: 'Questionnaire',
- },
- index: 0,
- indexOfMapper: 1,
- },
-];
-
-const showToastError: OperationOutcome = {
- resourceType: 'OperationOutcome',
- text: {
- status: 'generated',
- div: 'Invalid resource',
- },
- issue: [
- {
- severity: 'fatal',
- code: 'invalid',
- expression: ['Questionnaire.mapping.1.resourceType'],
- diagnostics: 'expected one of Mapping',
- },
- {
- severity: 'fatal',
- code: 'invalid',
- expression: ['Questionnaire.mapping.1'],
- diagnostics: "Resource Type 'Mappin' does not exist",
- },
- ],
-};
-
-const showToastIndex = 1;
-
export const EXPECTED_RESOURCES = {
patient,
questionnaire,
@@ -375,14 +223,4 @@ export const EXPECTED_RESOURCES = {
mappingDemo1,
mappingDemo1New,
batchRequestDemo1,
- idExtractionIssue,
- idExtractionResource,
- idExtractionResourceUndefined,
- idExtractionError,
- idExtractionErrorUndefined,
- mappingIdList,
- mappingInfoList,
- mappingIdListEmpty,
- showToastError,
- showToastIndex,
};
diff --git a/web/src/containers/Main/useFHIRMappingLanguage.ts b/web/src/containers/Main/useFHIRMappingLanguage.ts
index 3cfa28d1..dc0345d4 100644
--- a/web/src/containers/Main/useFHIRMappingLanguage.ts
+++ b/web/src/containers/Main/useFHIRMappingLanguage.ts
@@ -1,27 +1,25 @@
-import { Bundle, QuestionnaireResponse, StructureMap } from "fhir/r4b";
-import { useCallback, useEffect, useState } from "react";
-import { convert, createStructureMap, transform } from "web/src/services/fhirmapping";
-
-import { isSuccess } from "fhir-react/lib/libs/remoteData";
-
+import { Bundle, QuestionnaireResponse, StructureMap } from 'fhir/r4b';
+import { useCallback, useEffect, useState } from 'react';
+import { convert, createStructureMap, transform } from 'web/src/services/fhirmapping';
+import { isSuccess } from 'fhir-react/lib/libs/remoteData';
export function useFHIRMappingLanguage(questionnaireResponse: QuestionnaireResponse | undefined) {
- const [fhirMappingLangMode, setFhirMappingLangMode] = useState(false)
- const [mapString, setMapString] = useState('')
- const [prevMapString, setPrevMapString] = useState('')
- const [structureMapData, setStructureMapData] = useState(undefined)
- const [structureMap, setStructureMap] = useState(undefined)
- const [structureMapUrl, setStructureMapUrl] = useState(undefined)
- const [mappingResult, setMappingResult] = useState(undefined)
+ const [fhirMappingLangMode, setFhirMappingLangMode] = useState(false);
+ const [mapString, setMapString] = useState('');
+ const [prevMapString, setPrevMapString] = useState('');
+ const [structureMapData, setStructureMapData] = useState(undefined);
+ const [structureMap, setStructureMap] = useState(undefined);
+ const [structureMapUrl, setStructureMapUrl] = useState(undefined);
+ const [mappingResult, setMappingResult] = useState(undefined);
const fetchConvertData = useCallback(async (mapString: string, prevMapString: string) => {
- if (mapString !== prevMapString){
+ if (mapString !== prevMapString) {
const response = await convert({ mapString });
if (isSuccess(response)) {
setStructureMapData(response.data);
} else {
- setMappingResult(response.error)
+ setMappingResult(response.error);
}
}
}, []);
@@ -35,11 +33,14 @@ export function useFHIRMappingLanguage(questionnaireResponse: QuestionnaireRespo
}
}, []);
- const fetchMappingResult = useCallback(async (structureMapUrl: string, questionnaireResponse: QuestionnaireResponse) => {
- const response = await transform({ structureMapUrl, questionnaireResponse });
- const dataToSet = isSuccess(response) ? response.data : response.error
- setMappingResult(dataToSet)
- }, []);
+ const fetchMappingResult = useCallback(
+ async (structureMapUrl: string, questionnaireResponse: QuestionnaireResponse) => {
+ const response = await transform({ structureMapUrl, questionnaireResponse });
+ const dataToSet = isSuccess(response) ? response.data : response.error;
+ setMappingResult(dataToSet);
+ },
+ [],
+ );
useEffect(() => {
if (mapString !== prevMapString) {
@@ -62,9 +63,9 @@ export function useFHIRMappingLanguage(questionnaireResponse: QuestionnaireRespo
const changeMapString = (value: string) => {
setPrevMapString(mapString);
setMapString(value);
- }
+ };
- const toggleMappingMode = () => setFhirMappingLangMode(!fhirMappingLangMode)
+ const toggleMappingMode = () => setFhirMappingLangMode(!fhirMappingLangMode);
return {
fhirMappingLangMode,
@@ -73,4 +74,4 @@ export function useFHIRMappingLanguage(questionnaireResponse: QuestionnaireRespo
setMapString: changeMapString,
mappingResult,
};
-}
\ No newline at end of file
+}
diff --git a/web/src/serviceWorker.ts b/web/src/serviceWorker.ts
index 62c09f6e..d02e6673 100644
--- a/web/src/serviceWorker.ts
+++ b/web/src/serviceWorker.ts
@@ -19,8 +19,8 @@ const isLocalhost = Boolean(
);
type Config = {
- onSuccess?: (registration: ServiceWorkerRegistration) => void;
- onUpdate?: (registration: ServiceWorkerRegistration) => void;
+ onSuccess?: (registration: ServiceWorkerRegistration) => void;
+ onUpdate?: (registration: ServiceWorkerRegistration) => void;
};
export function register(config?: Config) {
@@ -109,7 +109,10 @@ function checkValidServiceWorker(swUrl: string, config?: Config) {
.then((response) => {
// Ensure service worker exists, and that we really are getting a JS file.
const contentType = response.headers.get('content-type');
- if (response.status === 404 || (contentType != null && contentType.indexOf('javascript') === -1)) {
+ if (
+ response.status === 404 ||
+ (contentType != null && contentType.indexOf('javascript') === -1)
+ ) {
// No service worker found. Probably a different app. Reload the page.
navigator.serviceWorker.ready.then((registration) => {
registration.unregister().then(() => {
diff --git a/web/src/services/auth.ts b/web/src/services/auth.ts
index 80c8ed69..f7fd4443 100644
--- a/web/src/services/auth.ts
+++ b/web/src/services/auth.ts
@@ -13,7 +13,6 @@ import {
} from 'fhir-react/lib/services/instance';
import { extractErrorCode } from 'fhir-react/lib/utils/error';
-
import { getData } from './localStorage';
export function getUserInfo() {
diff --git a/web/src/services/extract.ts b/web/src/services/extract.ts
index 2f6209e8..6e7f4182 100644
--- a/web/src/services/extract.ts
+++ b/web/src/services/extract.ts
@@ -4,7 +4,6 @@ import _ from 'lodash';
import { service } from 'fhir-react/lib/services/service';
-
import { juteURL, fhirpathMappingUrl } from './initialize';
interface Props {
diff --git a/web/src/services/fhirmapping.ts b/web/src/services/fhirmapping.ts
index 9c3a926d..2b9c1f55 100644
--- a/web/src/services/fhirmapping.ts
+++ b/web/src/services/fhirmapping.ts
@@ -1,26 +1,26 @@
-import { Bundle, QuestionnaireResponse, StructureMap } from "fhir/r4b";
+import { Bundle, QuestionnaireResponse, StructureMap } from 'fhir/r4b';
-import { service } from "fhir-react/lib/services/service";
+import { service } from 'fhir-react/lib/services/service';
-import { fhirMappingLanguageUrl } from "shared/src/constants";
+import { fhirMappingLanguageUrl } from 'shared/src/constants';
const CONTENT_TYPE_FHIR_MAPPING = 'text/fhir-mapping';
const CONTENT_TYPE_FHIR_JSON = 'application/fhir+json';
const ACCEPT_FHIR_JSON = 'application/fhir+json';
-export async function convert({mapString}: {mapString: string}) {
+export async function convert({ mapString }: { mapString: string }) {
return await service({
baseURL: fhirMappingLanguageUrl,
url: `/StructureMap/$convert`,
method: 'POST',
data: mapString,
headers: {
- 'Content-Type': CONTENT_TYPE_FHIR_MAPPING
- }
+ 'Content-Type': CONTENT_TYPE_FHIR_MAPPING,
+ },
});
}
-export async function createStructureMap({structureMap}: {structureMap: StructureMap}){
+export async function createStructureMap({ structureMap }: { structureMap: StructureMap }) {
return await service({
baseURL: fhirMappingLanguageUrl,
url: `/StructureMap`,
@@ -29,7 +29,13 @@ export async function createStructureMap({structureMap}: {structureMap: Structur
});
}
-export async function transform({structureMapUrl, questionnaireResponse}: {structureMapUrl: string, questionnaireResponse: QuestionnaireResponse}){
+export async function transform({
+ structureMapUrl,
+ questionnaireResponse,
+}: {
+ structureMapUrl: string;
+ questionnaireResponse: QuestionnaireResponse;
+}) {
return await service({
baseURL: fhirMappingLanguageUrl,
url: `/StructureMap/$transform`,
@@ -40,7 +46,7 @@ export async function transform({structureMapUrl, questionnaireResponse}: {struc
},
headers: {
'Content-Type': CONTENT_TYPE_FHIR_JSON,
- 'Accept': ACCEPT_FHIR_JSON
- }
+ Accept: ACCEPT_FHIR_JSON,
+ },
});
-}
\ No newline at end of file
+}
diff --git a/web/src/utils/common.ts b/web/src/utils/common.ts
index 5c79a967..b6e69349 100644
--- a/web/src/utils/common.ts
+++ b/web/src/utils/common.ts
@@ -1,3 +1,6 @@
-export function hasOwnProperty(obj: X, prop: Y): obj is X & Record {
- return obj.hasOwnProperty(prop);
+export function hasOwnProperty(
+ obj: X,
+ prop: Y,
+): obj is X & Record {
+ return Object.prototype.hasOwnProperty.call(obj, prop);
}