Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 2 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
a8b6af245f10

1 change: 0 additions & 1 deletion web/src/components/MappingSelect/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
1 change: 0 additions & 1 deletion web/src/components/ModalCreateMapper/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down
3 changes: 2 additions & 1 deletion web/src/components/ModalExpression/utils.ts
Original file line number Diff line number Diff line change
@@ -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);
1 change: 0 additions & 1 deletion web/src/components/TerminologyField/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
1 change: 0 additions & 1 deletion web/src/containers/App/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
@@ -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' ? (
<div>
Expand All @@ -27,5 +27,5 @@ export function MappingEditorError(props: MappingEditorErrorProps) {
</div>
) : (
<div />
)
}
);
}
1 change: 0 additions & 1 deletion web/src/containers/Main/MappingEditor/interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
1 change: 0 additions & 1 deletion web/src/containers/Main/MappingEditor/useMappingEditor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down
50 changes: 0 additions & 50 deletions web/src/containers/Main/__test__/main-callback.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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<Mapping>({
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<Mapping>({
resourceType: 'Mapping',
id: existingMappingId,
});

if (isSuccess(responseAfter)) {
expect(responseAfter.data.id).toBe(existingMappingId);
} else {
expect(responseAfter.error.id).toBe('not-found');
}
},
timeOutMs,
);
1 change: 0 additions & 1 deletion web/src/containers/Main/__test__/main.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
164 changes: 1 addition & 163 deletions web/src/containers/Main/__test__/resources/index.tsx
Original file line number Diff line number Diff line change
@@ -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,
Expand Down Expand Up @@ -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,
Expand All @@ -375,14 +223,4 @@ export const EXPECTED_RESOURCES = {
mappingDemo1,
mappingDemo1New,
batchRequestDemo1,
idExtractionIssue,
idExtractionResource,
idExtractionResourceUndefined,
idExtractionError,
idExtractionErrorUndefined,
mappingIdList,
mappingInfoList,
mappingIdListEmpty,
showToastError,
showToastIndex,
};
Loading
Loading