From 39d26f54badf40ad13919a9791e686ca5a322a7a Mon Sep 17 00:00:00 2001 From: Pavel R Date: Tue, 28 May 2024 17:48:26 +0200 Subject: [PATCH 01/12] Use fhir-questionnaire as Questionnaire Response Form Ref: https://github.com/beda-software/sdc-ide/issues/66 --- .gitmodules | 3 + package.json | 3 +- packages/@beda.software/fhir-questionnaire | 1 + web/package.json | 3 +- .../components/boolean/index.tsx | 5 +- .../components/choice/hook.ts | 2 +- .../components/choice/index.tsx | 5 +- .../components/date.tsx | 5 +- .../components/decimal.tsx | 5 +- .../components/display.tsx | 2 +- .../components/group/GTable/index.tsx | 2 +- .../group/RepeatableGroups/index.tsx | 3 +- .../components/group/flex.tsx | 3 +- .../components/group/index.tsx | 4 +- .../components/integer.tsx | 5 +- .../components/label.tsx | 2 +- .../components/questionItems.tsx | 34 + .../components/reference/hooks.ts | 5 +- .../components/reference/index.tsx | 2 +- .../components/string.tsx | 5 +- .../BaseQuestionnaireResponseForm/index.tsx | 108 +- web/src/components/QRFormWrapper/index.tsx | 21 +- yarn.lock | 1215 ++++++++++++++++- 23 files changed, 1359 insertions(+), 84 deletions(-) create mode 100644 .gitmodules create mode 160000 packages/@beda.software/fhir-questionnaire create mode 100644 web/src/components/BaseQuestionnaireResponseForm/components/questionItems.tsx diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 00000000..3fa24410 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "packages/@beda.software/fhir-questionnaire"] + path = packages/@beda.software/fhir-questionnaire + url = https://github.com/beda-software/fhir-questionnaire diff --git a/package.json b/package.json index d1b83765..2fa6fbdb 100644 --- a/package.json +++ b/package.json @@ -51,7 +51,8 @@ "packages": [ "web", "shared", - "sdc-qrf" + "sdc-qrf", + "packages/@beda.software/fhir-questionnaire" ], "nohoist": [ "**/react-native", diff --git a/packages/@beda.software/fhir-questionnaire b/packages/@beda.software/fhir-questionnaire new file mode 160000 index 00000000..713ab284 --- /dev/null +++ b/packages/@beda.software/fhir-questionnaire @@ -0,0 +1 @@ +Subproject commit 713ab2841b4f64511e49cdcacbdb91b9ed663a62 diff --git a/web/package.json b/web/package.json index ace3fe15..ccf0a09e 100644 --- a/web/package.json +++ b/web/package.json @@ -57,7 +57,8 @@ "shared": "0.0.2", "ts-jest": "^27.1.4", "vitest": "^0.33.0", - "yaml": "^2.1.1" + "yaml": "^2.1.1", + "@beda.software/fhir-questionnaire": "1.0.0" }, "scripts": { "start": "vite", diff --git a/web/src/components/BaseQuestionnaireResponseForm/components/boolean/index.tsx b/web/src/components/BaseQuestionnaireResponseForm/components/boolean/index.tsx index 71da71b8..c50c63aa 100644 --- a/web/src/components/BaseQuestionnaireResponseForm/components/boolean/index.tsx +++ b/web/src/components/BaseQuestionnaireResponseForm/components/boolean/index.tsx @@ -1,5 +1,8 @@ +import { + QuestionItemProps, + useQuestionnaireResponseFormContext, +} from '@beda.software/fhir-questionnaire/vendor/sdc-qrf'; import { Field } from 'react-final-form'; -import { QuestionItemProps, useQuestionnaireResponseFormContext } from 'sdc-qrf/src'; import s from './BooleanField.module.scss'; import { QuestionLabel } from '../label'; diff --git a/web/src/components/BaseQuestionnaireResponseForm/components/choice/hook.ts b/web/src/components/BaseQuestionnaireResponseForm/components/choice/hook.ts index a5f43656..60a2ad7b 100644 --- a/web/src/components/BaseQuestionnaireResponseForm/components/choice/hook.ts +++ b/web/src/components/BaseQuestionnaireResponseForm/components/choice/hook.ts @@ -1,5 +1,5 @@ +import { AnswerValue, QuestionItemProps } from '@beda.software/fhir-questionnaire/vendor/sdc-qrf'; import _ from 'lodash'; -import { AnswerValue, QuestionItemProps } from 'sdc-qrf/src'; import { isSuccess, RemoteDataResult, success } from 'aidbox-react/lib/libs/remoteData'; import { applyDataTransformer, service } from 'aidbox-react/lib/services/service'; diff --git a/web/src/components/BaseQuestionnaireResponseForm/components/choice/index.tsx b/web/src/components/BaseQuestionnaireResponseForm/components/choice/index.tsx index f80c094c..0d88a300 100644 --- a/web/src/components/BaseQuestionnaireResponseForm/components/choice/index.tsx +++ b/web/src/components/BaseQuestionnaireResponseForm/components/choice/index.tsx @@ -1,4 +1,7 @@ -import { QuestionItemProps, useQuestionnaireResponseFormContext } from 'sdc-qrf/src'; +import { + QuestionItemProps, + useQuestionnaireResponseFormContext, +} from '@beda.software/fhir-questionnaire/vendor/sdc-qrf'; import { getAnswerCode, getAnswerDisplay } from 'web/src/utils/questionnaire'; import { QuestionnaireItemAnswerOption } from 'shared/src/contrib/aidbox'; diff --git a/web/src/components/BaseQuestionnaireResponseForm/components/date.tsx b/web/src/components/BaseQuestionnaireResponseForm/components/date.tsx index 9f06352e..e74955e2 100644 --- a/web/src/components/BaseQuestionnaireResponseForm/components/date.tsx +++ b/web/src/components/BaseQuestionnaireResponseForm/components/date.tsx @@ -1,5 +1,8 @@ +import { + QuestionItemProps, + useQuestionnaireResponseFormContext, +} from '@beda.software/fhir-questionnaire/vendor/sdc-qrf'; import moment from 'moment'; -import { QuestionItemProps, useQuestionnaireResponseFormContext } from 'sdc-qrf/src'; import { FHIRDateTimeFormat } from 'fhir-react/lib/utils/date'; diff --git a/web/src/components/BaseQuestionnaireResponseForm/components/decimal.tsx b/web/src/components/BaseQuestionnaireResponseForm/components/decimal.tsx index cbe719f6..e2c4b75d 100644 --- a/web/src/components/BaseQuestionnaireResponseForm/components/decimal.tsx +++ b/web/src/components/BaseQuestionnaireResponseForm/components/decimal.tsx @@ -1,4 +1,7 @@ -import { QuestionItemProps, useQuestionnaireResponseFormContext } from 'sdc-qrf/src'; +import { + QuestionItemProps, + useQuestionnaireResponseFormContext, +} from '@beda.software/fhir-questionnaire/vendor/sdc-qrf'; import { QuestionField } from './field'; import { QuestionLabel } from './label'; diff --git a/web/src/components/BaseQuestionnaireResponseForm/components/display.tsx b/web/src/components/BaseQuestionnaireResponseForm/components/display.tsx index 2a243de4..468d2141 100644 --- a/web/src/components/BaseQuestionnaireResponseForm/components/display.tsx +++ b/web/src/components/BaseQuestionnaireResponseForm/components/display.tsx @@ -1,4 +1,4 @@ -import { QuestionItemProps } from 'sdc-qrf/src'; +import { QuestionItemProps } from '@beda.software/fhir-questionnaire/vendor/sdc-qrf'; import s from '../QuestionnaireResponseForm.module.scss'; diff --git a/web/src/components/BaseQuestionnaireResponseForm/components/group/GTable/index.tsx b/web/src/components/BaseQuestionnaireResponseForm/components/group/GTable/index.tsx index 47070064..1710de81 100644 --- a/web/src/components/BaseQuestionnaireResponseForm/components/group/GTable/index.tsx +++ b/web/src/components/BaseQuestionnaireResponseForm/components/group/GTable/index.tsx @@ -1,4 +1,4 @@ -import { GroupItemProps } from 'sdc-qrf/src'; +import { GroupItemProps } from '@beda.software/fhir-questionnaire/vendor/sdc-qrf'; import s from './GTable.module.scss'; import { GroupLabel } from '../label'; diff --git a/web/src/components/BaseQuestionnaireResponseForm/components/group/RepeatableGroups/index.tsx b/web/src/components/BaseQuestionnaireResponseForm/components/group/RepeatableGroups/index.tsx index f888e774..246fb29c 100644 --- a/web/src/components/BaseQuestionnaireResponseForm/components/group/RepeatableGroups/index.tsx +++ b/web/src/components/BaseQuestionnaireResponseForm/components/group/RepeatableGroups/index.tsx @@ -1,10 +1,11 @@ +import { GroupItemProps } from '@beda.software/fhir-questionnaire/vendor/sdc-qrf'; import _ from 'lodash'; import React from 'react'; // eslint-disable-next-line import/named import { Field, FieldInputProps } from 'react-final-form'; -import { GroupItemProps, QuestionItems } from 'sdc-qrf/src'; import s from './RepeatableGroups.module.scss'; +import { QuestionItems } from '../../questionItems'; import { GroupLabel } from '../label'; interface RepeatableGroupsProps { diff --git a/web/src/components/BaseQuestionnaireResponseForm/components/group/flex.tsx b/web/src/components/BaseQuestionnaireResponseForm/components/group/flex.tsx index 9cc833f6..216b151b 100644 --- a/web/src/components/BaseQuestionnaireResponseForm/components/group/flex.tsx +++ b/web/src/components/BaseQuestionnaireResponseForm/components/group/flex.tsx @@ -1,11 +1,12 @@ +import { GroupItemProps } from '@beda.software/fhir-questionnaire/vendor/sdc-qrf'; import classNames from 'classnames'; -import { GroupItemProps, QuestionItems } from 'sdc-qrf/src'; import { GroupContext } from './context'; import s from './Group.module.scss'; import { GTable as GTableControl } from './GTable'; import { GroupLabel } from './label'; import { RepeatableGroupRow, RepeatableGroups } from './RepeatableGroups'; +import { QuestionItems } from '../questionItems'; function Flex(props: GroupItemProps & { type?: 'col' | 'row' | 'gtable' }) { const { parentPath, questionItem, context, type = 'col' } = props; diff --git a/web/src/components/BaseQuestionnaireResponseForm/components/group/index.tsx b/web/src/components/BaseQuestionnaireResponseForm/components/group/index.tsx index 1c0fbbb7..39aad9b6 100644 --- a/web/src/components/BaseQuestionnaireResponseForm/components/group/index.tsx +++ b/web/src/components/BaseQuestionnaireResponseForm/components/group/index.tsx @@ -1,9 +1,10 @@ +import { GroupItemProps } from '@beda.software/fhir-questionnaire/vendor/sdc-qrf'; import _ from 'lodash'; -import { GroupItemProps, QuestionItems } from 'sdc-qrf/src'; import s from './Group.module.scss'; import { GroupLabel } from './label'; import { RepeatableGroups } from './RepeatableGroups'; +import { QuestionItems } from '../questionItems'; export function Group(props: GroupItemProps) { const { parentPath, questionItem, context } = props; @@ -13,7 +14,6 @@ export function Group(props: GroupItemProps) { if (repeats) { return ; } - return (
diff --git a/web/src/components/BaseQuestionnaireResponseForm/components/integer.tsx b/web/src/components/BaseQuestionnaireResponseForm/components/integer.tsx index 88581313..3656527a 100644 --- a/web/src/components/BaseQuestionnaireResponseForm/components/integer.tsx +++ b/web/src/components/BaseQuestionnaireResponseForm/components/integer.tsx @@ -1,4 +1,7 @@ -import { QuestionItemProps, useQuestionnaireResponseFormContext } from 'sdc-qrf/src'; +import { + QuestionItemProps, + useQuestionnaireResponseFormContext, +} from '@beda.software/fhir-questionnaire/vendor/sdc-qrf'; import { QuestionField } from './field'; import { QuestionLabel } from './label'; diff --git a/web/src/components/BaseQuestionnaireResponseForm/components/label.tsx b/web/src/components/BaseQuestionnaireResponseForm/components/label.tsx index c24beab7..c636e970 100644 --- a/web/src/components/BaseQuestionnaireResponseForm/components/label.tsx +++ b/web/src/components/BaseQuestionnaireResponseForm/components/label.tsx @@ -1,6 +1,6 @@ +import { useQuestionnaireResponseFormContext } from '@beda.software/fhir-questionnaire/vendor/sdc-qrf'; import classNames from 'classnames'; import { useContext } from 'react'; -import { useQuestionnaireResponseFormContext } from 'sdc-qrf/src'; import { QuestionnaireItem } from 'shared/src/contrib/aidbox'; diff --git a/web/src/components/BaseQuestionnaireResponseForm/components/questionItems.tsx b/web/src/components/BaseQuestionnaireResponseForm/components/questionItems.tsx new file mode 100644 index 00000000..4ac2e8e1 --- /dev/null +++ b/web/src/components/BaseQuestionnaireResponseForm/components/questionItems.tsx @@ -0,0 +1,34 @@ +import { QuestionnaireItem } from '@beda.software/fhir-questionnaire/contrib/aidbox'; +import { QuestionItem } from '@beda.software/fhir-questionnaire/vendor/sdc-qrf/components'; +import { useQuestionnaireResponseFormContext } from '@beda.software/fhir-questionnaire/vendor/sdc-qrf/hooks'; +import { ItemContext } from '@beda.software/fhir-questionnaire/vendor/sdc-qrf/types'; +import { getEnabledQuestions } from '@beda.software/fhir-questionnaire/vendor/sdc-qrf/utils'; +import React from 'react'; + +export interface QuestionItemsProps { + questionItems: QuestionnaireItem[]; + context: ItemContext; + parentPath: string[]; +} + +export function QuestionItems(props: QuestionItemsProps) { + const { questionItems, parentPath, context } = props; + const { formValues } = useQuestionnaireResponseFormContext(); + + return ( + + {getEnabledQuestions(questionItems, parentPath, formValues, context).map( + (item, index) => { + return ( + + ); + }, + )} + + ); +} diff --git a/web/src/components/BaseQuestionnaireResponseForm/components/reference/hooks.ts b/web/src/components/BaseQuestionnaireResponseForm/components/reference/hooks.ts index 23939f08..967b77e7 100644 --- a/web/src/components/BaseQuestionnaireResponseForm/components/reference/hooks.ts +++ b/web/src/components/BaseQuestionnaireResponseForm/components/reference/hooks.ts @@ -1,6 +1,9 @@ +import { + parseFhirQueryExpression, + QuestionItemProps, +} from '@beda.software/fhir-questionnaire/vendor/sdc-qrf'; import fhirpath from 'fhirpath'; import { ActionMeta, MultiValue, SingleValue } from 'react-select'; -import { parseFhirQueryExpression, QuestionItemProps } from 'sdc-qrf/src'; import { loadResourceOptions } from 'web/src/services/questionnaire'; import { isSuccess } from 'fhir-react/lib/libs/remoteData'; diff --git a/web/src/components/BaseQuestionnaireResponseForm/components/reference/index.tsx b/web/src/components/BaseQuestionnaireResponseForm/components/reference/index.tsx index 0bc64c85..b590b265 100644 --- a/web/src/components/BaseQuestionnaireResponseForm/components/reference/index.tsx +++ b/web/src/components/BaseQuestionnaireResponseForm/components/reference/index.tsx @@ -1,4 +1,4 @@ -import { useQuestionnaireResponseFormContext } from 'sdc-qrf/src'; +import { useQuestionnaireResponseFormContext } from '@beda.software/fhir-questionnaire/vendor/sdc-qrf'; import { getAnswerCode, getAnswerDisplay } from 'web/src/utils/questionnaire'; import { AidboxResource, QuestionnaireItemAnswerOption, Resource } from 'shared/src/contrib/aidbox'; diff --git a/web/src/components/BaseQuestionnaireResponseForm/components/string.tsx b/web/src/components/BaseQuestionnaireResponseForm/components/string.tsx index 91c88a8b..a099ba6c 100644 --- a/web/src/components/BaseQuestionnaireResponseForm/components/string.tsx +++ b/web/src/components/BaseQuestionnaireResponseForm/components/string.tsx @@ -1,4 +1,7 @@ -import { QuestionItemProps, useQuestionnaireResponseFormContext } from 'sdc-qrf/src'; +import { + QuestionItemProps, + useQuestionnaireResponseFormContext, +} from '@beda.software/fhir-questionnaire/vendor/sdc-qrf'; import { QuestionField } from './field'; import { QuestionLabel } from './label'; diff --git a/web/src/components/BaseQuestionnaireResponseForm/index.tsx b/web/src/components/BaseQuestionnaireResponseForm/index.tsx index 9d14909b..460ec9cd 100644 --- a/web/src/components/BaseQuestionnaireResponseForm/index.tsx +++ b/web/src/components/BaseQuestionnaireResponseForm/index.tsx @@ -1,13 +1,16 @@ -import _ from 'lodash'; -import { useRef } from 'react'; -import { Form, FormSpy } from 'react-final-form'; import { - calcInitialContext, + QuestionnaireResponseForm, + questionnaireIdWOAssembleLoader, +} from '@beda.software/fhir-questionnaire'; +import { QuestionnaireResponseFormProps } from '@beda.software/fhir-questionnaire/components/QuestionnaireResponseForm/questionnaire-response-form-data'; +import { FormItems, - QuestionItems, QuestionnaireResponseFormData, - QuestionnaireResponseFormProvider, -} from 'sdc-qrf/src'; +} from '@beda.software/fhir-questionnaire/vendor/sdc-qrf'; +import { QuestionnaireResponse } from 'fhir/r4b'; +import _ from 'lodash'; +import { useRef } from 'react'; +import { Form, FormSpy } from 'react-final-form'; import { Col, @@ -29,13 +32,20 @@ import s from './QuestionnaireResponseForm.module.scss'; interface Props { formData: QuestionnaireResponseFormData; onSubmit: (formData: QuestionnaireResponseFormData) => Promise; + serviceProvider: QuestionnaireResponseFormProps['serviceProvider']; readOnly?: boolean; onChange?: (data: QuestionnaireResponseFormData) => any; } type FormValues = FormItems; -export function BaseQuestionnaireResponseForm({ formData, onSubmit, readOnly, onChange }: Props) { +export function BaseQuestionnaireResponseForm({ + formData, + onSubmit, + readOnly, + onChange, + serviceProvider, +}: Props) { const previousValues = useRef(null); const onFormChange = (values: FormValues) => { @@ -49,46 +59,52 @@ export function BaseQuestionnaireResponseForm({ formData, onSubmit, readOnly, on }; return ( -
onSubmit({ ...formData, formValues: values })} - initialValues={formData.formValues} - render={({ handleSubmit, values, form }) => ( - - { - return onFormChange(formState.values); - }} - /> - form.change('', newValues)} - groupItemComponent={Group} - itemControlGroupItemComponents={{ col: Col, row: Row, gtable: GTable }} - questionItemComponents={{ - date: QuestionDate, - dateTime: QuestionDateTime, - string: QuestionString, - text: QuestionString, - choice: QuestionChoice, - boolean: QuestionBoolean, - display: QuestionDisplay, - decimal: QuestionDecimal, - reference: QuestionReference, - integer: QuestionInteger, - }} - readOnly={readOnly} - > - <> - ( + onSubmit({ ...formData, formValues: values })} + initialValues={formData.formValues} + render={({ handleSubmit, values, form }) => ( + + { + return onFormChange(formState.values); + }} /> - - - + {items} + + )} + /> )} + ItemWrapper={({ children }) => <>{children}} + groupItemComponent={Group} + widgetsByGroupQuestionItemControl={{ col: Col, row: Row, gtable: GTable }} + autosave /> ); } diff --git a/web/src/components/QRFormWrapper/index.tsx b/web/src/components/QRFormWrapper/index.tsx index c3d2b3e1..a892fe83 100644 --- a/web/src/components/QRFormWrapper/index.tsx +++ b/web/src/components/QRFormWrapper/index.tsx @@ -1,3 +1,9 @@ +import { + fromFirstClassExtension, + mapFormToResponse, + mapResponseToForm, + toFirstClassExtension, +} from '@beda.software/fhir-questionnaire/vendor/sdc-qrf'; import { Questionnaire as FHIRQuestionnaire, QuestionnaireResponse as FHIRQuestionnaireResponse, @@ -5,13 +11,8 @@ import { } from 'fhir/r4b'; import _ from 'lodash'; import { useCallback } from 'react'; -import { - fromFirstClassExtension, - mapFormToResponse, - mapResponseToForm, - toFirstClassExtension, -} from 'sdc-qrf/src'; import { RenderRemoteData } from 'web/src/components/RenderRemoteData'; +import { useFHIRServiceProvider } from 'web/src/services/fhir'; import { RemoteData } from 'fhir-react/lib/libs/remoteData'; import { sequenceMap } from 'fhir-react/lib/services/service'; @@ -38,7 +39,12 @@ export function QRFormWrapper({ const onChange = useCallback(_.debounce(saveQuestionnaireResponse, 1000), [ saveQuestionnaireResponse, ]); - const remoteDataResult = sequenceMap({ questionnaireRD, questionnaireResponseRD }); + const serviceProvider = useFHIRServiceProvider(); + const remoteDataResult = sequenceMap({ + questionnaireRD, + questionnaireResponseRD, + serviceProvider, + }); return ( ( =29.4.3 < 30", jest-diff@^29.6.2: version "29.6.2" resolved "https://registry.yarnpkg.com/jest-diff/-/jest-diff-29.6.2.tgz#c36001e5543e82a0805051d3ceac32e6825c1c46" @@ -8317,6 +9059,16 @@ jest-diff@^27.5.1: jest-get-type "^27.5.1" pretty-format "^27.5.1" +jest-diff@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/jest-diff/-/jest-diff-29.7.0.tgz#017934a66ebb7ecf6f205e84699be10afd70458a" + integrity sha512-LMIgiIrhigmPrs03JHpxUh2yISK3vLFPkAodPeo0+BuF7wA2FoQbkEg1u8gBYBThncu7e1oEDUfIXVuTqLRUjw== + dependencies: + chalk "^4.0.0" + diff-sequences "^29.6.3" + jest-get-type "^29.6.3" + pretty-format "^29.7.0" + jest-docblock@^27.5.1: version "27.5.1" resolved "https://registry.yarnpkg.com/jest-docblock/-/jest-docblock-27.5.1.tgz#14092f364a42c6108d42c33c8cf30e058e25f6c0" @@ -8324,6 +9076,13 @@ jest-docblock@^27.5.1: dependencies: detect-newline "^3.0.0" +jest-docblock@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/jest-docblock/-/jest-docblock-29.7.0.tgz#8fddb6adc3cdc955c93e2a87f61cfd350d5d119a" + integrity sha512-q617Auw3A612guyaFgsbFeYpNP5t2aoUNLwBUbc/0kD1R4t9ixDbyFTHd1nok4epoVFpr7PmeWHrhvuV3XaJ4g== + dependencies: + detect-newline "^3.0.0" + jest-each@^27.5.1: version "27.5.1" resolved "https://registry.yarnpkg.com/jest-each/-/jest-each-27.5.1.tgz#5bc87016f45ed9507fed6e4702a5b468a5b2c44e" @@ -8335,6 +9094,17 @@ jest-each@^27.5.1: jest-util "^27.5.1" pretty-format "^27.5.1" +jest-each@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/jest-each/-/jest-each-29.7.0.tgz#162a9b3f2328bdd991beaabffbb74745e56577d1" + integrity sha512-gns+Er14+ZrEoC5fhOfYCY1LOHHr0TI+rQUHZS8Ttw2l7gl+80eHc/gFf2Ktkw0+SIACDTeWvpFcv3B04VembQ== + dependencies: + "@jest/types" "^29.6.3" + chalk "^4.0.0" + jest-get-type "^29.6.3" + jest-util "^29.7.0" + pretty-format "^29.7.0" + jest-environment-jsdom@^27.5.1: version "27.5.1" resolved "https://registry.yarnpkg.com/jest-environment-jsdom/-/jest-environment-jsdom-27.5.1.tgz#ea9ccd1fc610209655a77898f86b2b559516a546" @@ -8360,6 +9130,18 @@ jest-environment-node@^27.5.1: jest-mock "^27.5.1" jest-util "^27.5.1" +jest-environment-node@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/jest-environment-node/-/jest-environment-node-29.7.0.tgz#0b93e111dda8ec120bc8300e6d1fb9576e164376" + integrity sha512-DOSwCRqXirTOyheM+4d5YZOrWcdu0LNZ87ewUoywbcb2XR4wKgqiG8vNeYwhjFMbEkfju7wx2GYH0P2gevGvFw== + dependencies: + "@jest/environment" "^29.7.0" + "@jest/fake-timers" "^29.7.0" + "@jest/types" "^29.6.3" + "@types/node" "*" + jest-mock "^29.7.0" + jest-util "^29.7.0" + jest-get-type@^27.5.1: version "27.5.1" resolved "https://registry.yarnpkg.com/jest-get-type/-/jest-get-type-27.5.1.tgz#3cd613c507b0f7ace013df407a1c1cd578bcb4f1" @@ -8370,6 +9152,11 @@ jest-get-type@^29.4.3: resolved "https://registry.yarnpkg.com/jest-get-type/-/jest-get-type-29.4.3.tgz#1ab7a5207c995161100b5187159ca82dd48b3dd5" integrity sha512-J5Xez4nRRMjk8emnTpWrlkyb9pfRQQanDrvWHhsR1+VUfbwxi30eVcZFlcdGInRibU4G5LwHXpI7IRHU0CY+gg== +jest-get-type@^29.6.3: + version "29.6.3" + resolved "https://registry.yarnpkg.com/jest-get-type/-/jest-get-type-29.6.3.tgz#36f499fdcea197c1045a127319c0481723908fd1" + integrity sha512-zrteXnqYxfQh7l5FHyL38jL39di8H8rHoecLH3JNxH3BwOrBsNeabdap5e0I23lD4HHI8W5VFBZqG4Eaq5LNcw== + jest-haste-map@^27.5.1: version "27.5.1" resolved "https://registry.yarnpkg.com/jest-haste-map/-/jest-haste-map-27.5.1.tgz#9fd8bd7e7b4fa502d9c6164c5640512b4e811e7f" @@ -8390,6 +9177,25 @@ jest-haste-map@^27.5.1: optionalDependencies: fsevents "^2.3.2" +jest-haste-map@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/jest-haste-map/-/jest-haste-map-29.7.0.tgz#3c2396524482f5a0506376e6c858c3bbcc17b104" + integrity sha512-fP8u2pyfqx0K1rGn1R9pyE0/KTn+G7PxktWidOBTqFPLYX0b9ksaMFkhK5vrS3DVun09pckLdlx90QthlW7AmA== + dependencies: + "@jest/types" "^29.6.3" + "@types/graceful-fs" "^4.1.3" + "@types/node" "*" + anymatch "^3.0.3" + fb-watchman "^2.0.0" + graceful-fs "^4.2.9" + jest-regex-util "^29.6.3" + jest-util "^29.7.0" + jest-worker "^29.7.0" + micromatch "^4.0.4" + walker "^1.0.8" + optionalDependencies: + fsevents "^2.3.2" + jest-jasmine2@^27.5.1: version "27.5.1" resolved "https://registry.yarnpkg.com/jest-jasmine2/-/jest-jasmine2-27.5.1.tgz#a037b0034ef49a9f3d71c4375a796f3b230d1ac4" @@ -8421,6 +9227,14 @@ jest-leak-detector@^27.5.1: jest-get-type "^27.5.1" pretty-format "^27.5.1" +jest-leak-detector@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/jest-leak-detector/-/jest-leak-detector-29.7.0.tgz#5b7ec0dadfdfec0ca383dc9aa016d36b5ea4c728" + integrity sha512-kYA8IJcSYtST2BY9I+SMC32nDpBT3J2NvWJx8+JCuCdl/CR1I4EKUJROiP8XtCcxqgTTBGJNdbB1A8XRKbTetw== + dependencies: + jest-get-type "^29.6.3" + pretty-format "^29.7.0" + jest-matcher-utils@^27.0.0, jest-matcher-utils@^27.5.1: version "27.5.1" resolved "https://registry.yarnpkg.com/jest-matcher-utils/-/jest-matcher-utils-27.5.1.tgz#9c0cdbda8245bc22d2331729d1091308b40cf8ab" @@ -8441,6 +9255,16 @@ jest-matcher-utils@^29.6.2: jest-get-type "^29.4.3" pretty-format "^29.6.2" +jest-matcher-utils@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/jest-matcher-utils/-/jest-matcher-utils-29.7.0.tgz#ae8fec79ff249fd592ce80e3ee474e83a6c44f12" + integrity sha512-sBkD+Xi9DtcChsI3L3u0+N0opgPYnCRPtGcQYrgXmR+hmt/fYfWAL0xRXYU8eWOdfuLgBe0YCW3AFtnRLagq/g== + dependencies: + chalk "^4.0.0" + jest-diff "^29.7.0" + jest-get-type "^29.6.3" + pretty-format "^29.7.0" + jest-message-util@^27.5.1: version "27.5.1" resolved "https://registry.yarnpkg.com/jest-message-util/-/jest-message-util-27.5.1.tgz#bdda72806da10d9ed6425e12afff38cd1458b6cf" @@ -8486,6 +9310,21 @@ jest-message-util@^29.6.2: slash "^3.0.0" stack-utils "^2.0.3" +jest-message-util@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/jest-message-util/-/jest-message-util-29.7.0.tgz#8bc392e204e95dfe7564abbe72a404e28e51f7f3" + integrity sha512-GBEV4GRADeP+qtB2+6u61stea8mGcOT4mCtrYISZwfu9/ISHFJ/5zOMXYbpBE9RsS5+Gb63DW4FgmnKJ79Kf6w== + dependencies: + "@babel/code-frame" "^7.12.13" + "@jest/types" "^29.6.3" + "@types/stack-utils" "^2.0.0" + chalk "^4.0.0" + graceful-fs "^4.2.9" + micromatch "^4.0.4" + pretty-format "^29.7.0" + slash "^3.0.0" + stack-utils "^2.0.3" + jest-mock@^27.5.1: version "27.5.1" resolved "https://registry.yarnpkg.com/jest-mock/-/jest-mock-27.5.1.tgz#19948336d49ef4d9c52021d34ac7b5f36ff967d6" @@ -8494,6 +9333,15 @@ jest-mock@^27.5.1: "@jest/types" "^27.5.1" "@types/node" "*" +jest-mock@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/jest-mock/-/jest-mock-29.7.0.tgz#4e836cf60e99c6fcfabe9f99d017f3fdd50a6347" + integrity sha512-ITOMZn+UkYS4ZFh83xYAOzWStloNzJFO2s8DWrE4lhtGD+AorgnbkiKERe4wQVBydIGPx059g6riW5Btp6Llnw== + dependencies: + "@jest/types" "^29.6.3" + "@types/node" "*" + jest-util "^29.7.0" + jest-pnp-resolver@^1.2.2: version "1.2.3" resolved "https://registry.yarnpkg.com/jest-pnp-resolver/-/jest-pnp-resolver-1.2.3.tgz#930b1546164d4ad5937d5540e711d4d38d4cad2e" @@ -8509,6 +9357,11 @@ jest-regex-util@^28.0.0: resolved "https://registry.yarnpkg.com/jest-regex-util/-/jest-regex-util-28.0.2.tgz#afdc377a3b25fb6e80825adcf76c854e5bf47ead" integrity sha512-4s0IgyNIy0y9FK+cjoVYoxamT7Zeo7MhzqRGx7YDYmaQn1wucY9rotiGkBzzcMXTtjrCAP/f7f+E0F7+fxPNdw== +jest-regex-util@^29.6.3: + version "29.6.3" + resolved "https://registry.yarnpkg.com/jest-regex-util/-/jest-regex-util-29.6.3.tgz#4a556d9c776af68e1c5f48194f4d0327d24e8a52" + integrity sha512-KJJBsRCyyLNWCNBOvZyRDnAIfUiRJ8v+hOBQYGn8gDyF3UegwiP4gwRR3/SDa42g1YbVycTidUF3rKjyLFDWbg== + jest-resolve-dependencies@^27.5.1: version "27.5.1" resolved "https://registry.yarnpkg.com/jest-resolve-dependencies/-/jest-resolve-dependencies-27.5.1.tgz#d811ecc8305e731cc86dd79741ee98fed06f1da8" @@ -8518,6 +9371,14 @@ jest-resolve-dependencies@^27.5.1: jest-regex-util "^27.5.1" jest-snapshot "^27.5.1" +jest-resolve-dependencies@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/jest-resolve-dependencies/-/jest-resolve-dependencies-29.7.0.tgz#1b04f2c095f37fc776ff40803dc92921b1e88428" + integrity sha512-un0zD/6qxJ+S0et7WxeI3H5XSe9lTBBR7bOHCHXkKR6luG5mwDDlIzVQ0V5cZCuoTgEdcdwzTghYkTWfubi+nA== + dependencies: + jest-regex-util "^29.6.3" + jest-snapshot "^29.7.0" + jest-resolve@^27.4.2, jest-resolve@^27.5.1: version "27.5.1" resolved "https://registry.yarnpkg.com/jest-resolve/-/jest-resolve-27.5.1.tgz#a2f1c5a0796ec18fe9eb1536ac3814c23617b384" @@ -8534,6 +9395,21 @@ jest-resolve@^27.4.2, jest-resolve@^27.5.1: resolve.exports "^1.1.0" slash "^3.0.0" +jest-resolve@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/jest-resolve/-/jest-resolve-29.7.0.tgz#64d6a8992dd26f635ab0c01e5eef4399c6bcbc30" + integrity sha512-IOVhZSrg+UvVAshDSDtHyFCCBUl/Q3AAJv8iZ6ZjnZ74xzvwuzLXid9IIIPgTnY62SJjfuupMKZsZQRsCvxEgA== + dependencies: + chalk "^4.0.0" + graceful-fs "^4.2.9" + jest-haste-map "^29.7.0" + jest-pnp-resolver "^1.2.2" + jest-util "^29.7.0" + jest-validate "^29.7.0" + resolve "^1.20.0" + resolve.exports "^2.0.0" + slash "^3.0.0" + jest-runner@^27.5.1: version "27.5.1" resolved "https://registry.yarnpkg.com/jest-runner/-/jest-runner-27.5.1.tgz#071b27c1fa30d90540805c5645a0ec167c7b62e5" @@ -8561,6 +9437,33 @@ jest-runner@^27.5.1: source-map-support "^0.5.6" throat "^6.0.1" +jest-runner@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/jest-runner/-/jest-runner-29.7.0.tgz#809af072d408a53dcfd2e849a4c976d3132f718e" + integrity sha512-fsc4N6cPCAahybGBfTRcq5wFR6fpLznMg47sY5aDpsoejOcVYFb07AHuSnR0liMcPTgBsA3ZJL6kFOjPdoNipQ== + dependencies: + "@jest/console" "^29.7.0" + "@jest/environment" "^29.7.0" + "@jest/test-result" "^29.7.0" + "@jest/transform" "^29.7.0" + "@jest/types" "^29.6.3" + "@types/node" "*" + chalk "^4.0.0" + emittery "^0.13.1" + graceful-fs "^4.2.9" + jest-docblock "^29.7.0" + jest-environment-node "^29.7.0" + jest-haste-map "^29.7.0" + jest-leak-detector "^29.7.0" + jest-message-util "^29.7.0" + jest-resolve "^29.7.0" + jest-runtime "^29.7.0" + jest-util "^29.7.0" + jest-watcher "^29.7.0" + jest-worker "^29.7.0" + p-limit "^3.1.0" + source-map-support "0.5.13" + jest-runtime@^27.5.1: version "27.5.1" resolved "https://registry.yarnpkg.com/jest-runtime/-/jest-runtime-27.5.1.tgz#4896003d7a334f7e8e4a53ba93fb9bcd3db0a1af" @@ -8589,6 +9492,34 @@ jest-runtime@^27.5.1: slash "^3.0.0" strip-bom "^4.0.0" +jest-runtime@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/jest-runtime/-/jest-runtime-29.7.0.tgz#efecb3141cf7d3767a3a0cc8f7c9990587d3d817" + integrity sha512-gUnLjgwdGqW7B4LvOIkbKs9WGbn+QLqRQQ9juC6HndeDiezIwhDP+mhMwHWCEcfQ5RUXa6OPnFF8BJh5xegwwQ== + dependencies: + "@jest/environment" "^29.7.0" + "@jest/fake-timers" "^29.7.0" + "@jest/globals" "^29.7.0" + "@jest/source-map" "^29.6.3" + "@jest/test-result" "^29.7.0" + "@jest/transform" "^29.7.0" + "@jest/types" "^29.6.3" + "@types/node" "*" + chalk "^4.0.0" + cjs-module-lexer "^1.0.0" + collect-v8-coverage "^1.0.0" + glob "^7.1.3" + graceful-fs "^4.2.9" + jest-haste-map "^29.7.0" + jest-message-util "^29.7.0" + jest-mock "^29.7.0" + jest-regex-util "^29.6.3" + jest-resolve "^29.7.0" + jest-snapshot "^29.7.0" + jest-util "^29.7.0" + slash "^3.0.0" + strip-bom "^4.0.0" + jest-serializer@^27.5.1: version "27.5.1" resolved "https://registry.yarnpkg.com/jest-serializer/-/jest-serializer-27.5.1.tgz#81438410a30ea66fd57ff730835123dea1fb1f64" @@ -8625,6 +9556,32 @@ jest-snapshot@^27.5.1: pretty-format "^27.5.1" semver "^7.3.2" +jest-snapshot@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/jest-snapshot/-/jest-snapshot-29.7.0.tgz#c2c574c3f51865da1bb329036778a69bf88a6be5" + integrity sha512-Rm0BMWtxBcioHr1/OX5YCP8Uov4riHvKPknOGs804Zg9JGZgmIBkbtlxJC/7Z4msKYVbIJtfU+tKb8xlYNfdkw== + dependencies: + "@babel/core" "^7.11.6" + "@babel/generator" "^7.7.2" + "@babel/plugin-syntax-jsx" "^7.7.2" + "@babel/plugin-syntax-typescript" "^7.7.2" + "@babel/types" "^7.3.3" + "@jest/expect-utils" "^29.7.0" + "@jest/transform" "^29.7.0" + "@jest/types" "^29.6.3" + babel-preset-current-node-syntax "^1.0.0" + chalk "^4.0.0" + expect "^29.7.0" + graceful-fs "^4.2.9" + jest-diff "^29.7.0" + jest-get-type "^29.6.3" + jest-matcher-utils "^29.7.0" + jest-message-util "^29.7.0" + jest-util "^29.7.0" + natural-compare "^1.4.0" + pretty-format "^29.7.0" + semver "^7.5.3" + jest-util@^27.0.0, jest-util@^27.5.1: version "27.5.1" resolved "https://registry.yarnpkg.com/jest-util/-/jest-util-27.5.1.tgz#3ba9771e8e31a0b85da48fe0b0891fb86c01c2f9" @@ -8649,6 +9606,18 @@ jest-util@^28.1.3: graceful-fs "^4.2.9" picomatch "^2.2.3" +jest-util@^29.0.0, jest-util@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/jest-util/-/jest-util-29.7.0.tgz#23c2b62bfb22be82b44de98055802ff3710fc0bc" + integrity sha512-z6EbKajIpqGKU56y5KBUgy1dt1ihhQJgWzUlZHArA/+X2ad7Cb5iF+AK1EWVL/Bo7Rz9uurpqw6SiBCefUbCGA== + dependencies: + "@jest/types" "^29.6.3" + "@types/node" "*" + chalk "^4.0.0" + ci-info "^3.2.0" + graceful-fs "^4.2.9" + picomatch "^2.2.3" + jest-util@^29.6.2: version "29.6.2" resolved "https://registry.yarnpkg.com/jest-util/-/jest-util-29.6.2.tgz#8a052df8fff2eebe446769fd88814521a517664d" @@ -8673,6 +9642,18 @@ jest-validate@^27.5.1: leven "^3.1.0" pretty-format "^27.5.1" +jest-validate@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/jest-validate/-/jest-validate-29.7.0.tgz#7bf705511c64da591d46b15fce41400d52147d9c" + integrity sha512-ZB7wHqaRGVw/9hST/OuFUReG7M8vKeq0/J2egIGLdvjHCmYqGARhzXmtgi+gVeZ5uXFF219aOc3Ls2yLg27tkw== + dependencies: + "@jest/types" "^29.6.3" + camelcase "^6.2.0" + chalk "^4.0.0" + jest-get-type "^29.6.3" + leven "^3.1.0" + pretty-format "^29.7.0" + jest-watch-typeahead@^1.0.0: version "1.1.0" resolved "https://registry.yarnpkg.com/jest-watch-typeahead/-/jest-watch-typeahead-1.1.0.tgz#b4a6826dfb9c9420da2f7bc900de59dad11266a9" @@ -8713,6 +9694,20 @@ jest-watcher@^28.0.0: jest-util "^28.1.3" string-length "^4.0.1" +jest-watcher@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/jest-watcher/-/jest-watcher-29.7.0.tgz#7810d30d619c3a62093223ce6bb359ca1b28a2f2" + integrity sha512-49Fg7WXkU3Vl2h6LbLtMQ/HyB6rXSIX7SqvBLQmssRBGN9I0PNvPmAmCWSOY6SOvrjhI/F7/bGAv9RtnsPA03g== + dependencies: + "@jest/test-result" "^29.7.0" + "@jest/types" "^29.6.3" + "@types/node" "*" + ansi-escapes "^4.2.1" + chalk "^4.0.0" + emittery "^0.13.1" + jest-util "^29.7.0" + string-length "^4.0.1" + jest-worker@^26.2.1: version "26.6.2" resolved "https://registry.yarnpkg.com/jest-worker/-/jest-worker-26.6.2.tgz#7f72cbc4d643c365e27b9fd775f9d0eaa9c7a8ed" @@ -8740,6 +9735,16 @@ jest-worker@^28.0.2: merge-stream "^2.0.0" supports-color "^8.0.0" +jest-worker@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/jest-worker/-/jest-worker-29.7.0.tgz#acad073acbbaeb7262bd5389e1bcf43e10058d4a" + integrity sha512-eIz2msL/EzL9UFTFFx7jBTkeZfku0yUAyZZZmJ93H2TYEiroIx2PQjEXcwYtYl8zXCxb+PAmA2hLIt/6ZEkPHw== + dependencies: + "@types/node" "*" + jest-util "^29.7.0" + merge-stream "^2.0.0" + supports-color "^8.0.0" + jest@^27.4.3, jest@^27.5.1: version "27.5.1" resolved "https://registry.yarnpkg.com/jest/-/jest-27.5.1.tgz#dadf33ba70a779be7a6fc33015843b51494f63fc" @@ -8749,6 +9754,16 @@ jest@^27.4.3, jest@^27.5.1: import-local "^3.0.2" jest-cli "^27.5.1" +jest@^29.2.1: + version "29.7.0" + resolved "https://registry.yarnpkg.com/jest/-/jest-29.7.0.tgz#994676fc24177f088f1c5e3737f5697204ff2613" + integrity sha512-NIy3oAFp9shda19hy4HK0HRTWKtPJmGdnvywu01nOqNC2vZg+Z+fvJDxpMQA88eb2I9EcafcdjYgsDthnYTvGw== + dependencies: + "@jest/core" "^29.7.0" + "@jest/types" "^29.6.3" + import-local "^3.0.2" + jest-cli "^29.7.0" + jiti@^1.18.2: version "1.19.1" resolved "https://registry.yarnpkg.com/jiti/-/jiti-1.19.1.tgz#fa99e4b76a23053e0e7cde098efe1704a14c16f1" @@ -8867,7 +9882,7 @@ json-stringify-safe@^5.0.1, json-stringify-safe@~5.0.1: resolved "https://registry.yarnpkg.com/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz#1296a2d58fd45f19a0f6ce01d65701e2c735b6eb" integrity sha512-ZClg6AaYvamvYEE82d3Iyd3vSSIjQ+odgjaTzRuO3s7toCdFKczob2i0zCh7JE8kWn17yvAWhUVxvqGwUalsRA== -json5@2.x, json5@^2.1.2, json5@^2.2.0, json5@^2.2.2: +json5@2.x, json5@^2.1.2, json5@^2.2.0, json5@^2.2.2, json5@^2.2.3: version "2.2.3" resolved "https://registry.yarnpkg.com/json5/-/json5-2.2.3.tgz#78cd6f1a19bdc12b73db5ad0c61efd66c1e29283" integrity sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg== @@ -9091,6 +10106,11 @@ lilconfig@2.1.0, lilconfig@^2.0.3, lilconfig@^2.0.5, lilconfig@^2.1.0: resolved "https://registry.yarnpkg.com/lilconfig/-/lilconfig-2.1.0.tgz#78e23ac89ebb7e1bfbf25b18043de756548e7f52" integrity sha512-utWOt/GHzuUxnLKxB6dk81RoOeoNeHgbrXiuGk4yyF5qlRz+iIVWu56E2fqGHFrXz0QNUhLB/8nKqvRH66JKGQ== +lilconfig@~3.1.1: + version "3.1.1" + resolved "https://registry.yarnpkg.com/lilconfig/-/lilconfig-3.1.1.tgz#9d8a246fa753106cfc205fd2d77042faca56e5e3" + integrity sha512-O18pf7nyvHTckunPWCV1XUNXU1piu01y2b7ATJ0ppkUkk8ocqVWBrYjJBCwHDjD/ZWcfyrA0P4gKhzWGi5EINQ== + lines-and-columns@^1.1.6: version "1.2.4" resolved "https://registry.yarnpkg.com/lines-and-columns/-/lines-and-columns-1.2.4.tgz#eca284f75d2965079309dc0ad9255abb2ebc1632" @@ -9117,6 +10137,22 @@ lint-staged@^13.2.3: string-argv "0.3.2" yaml "2.3.1" +lint-staged@^15.2.0: + version "15.2.5" + resolved "https://registry.yarnpkg.com/lint-staged/-/lint-staged-15.2.5.tgz#8c342f211bdb34ffd3efd1311248fa6b50b43b50" + integrity sha512-j+DfX7W9YUvdzEZl3Rk47FhDF6xwDBV5wwsCPw6BwWZVPYJemusQmvb9bRsW23Sqsaa+vRloAWogbK4BUuU2zA== + dependencies: + chalk "~5.3.0" + commander "~12.1.0" + debug "~4.3.4" + execa "~8.0.1" + lilconfig "~3.1.1" + listr2 "~8.2.1" + micromatch "~4.0.7" + pidtree "~0.6.0" + string-argv "~0.3.2" + yaml "~2.4.2" + listr2@6.6.1: version "6.6.1" resolved "https://registry.yarnpkg.com/listr2/-/listr2-6.6.1.tgz#08b2329e7e8ba6298481464937099f4a2cd7f95d" @@ -9129,6 +10165,18 @@ listr2@6.6.1: rfdc "^1.3.0" wrap-ansi "^8.1.0" +listr2@~8.2.1: + version "8.2.1" + resolved "https://registry.yarnpkg.com/listr2/-/listr2-8.2.1.tgz#06a1a6efe85f23c5324180d7c1ddbd96b5eefd6d" + integrity sha512-irTfvpib/rNiD637xeevjO2l3Z5loZmuaRi0L0YE5LfijwVY96oyVn0DFD3o/teAok7nfobMG1THvvcHh/BP6g== + dependencies: + cli-truncate "^4.0.0" + colorette "^2.0.20" + eventemitter3 "^5.0.1" + log-update "^6.0.0" + rfdc "^1.3.1" + wrap-ansi "^9.0.0" + load-json-file@6.2.0: version "6.2.0" resolved "https://registry.yarnpkg.com/load-json-file/-/load-json-file-6.2.0.tgz#5c7770b42cafa97074ca2848707c61662f4251a1" @@ -9276,6 +10324,17 @@ log-update@^5.0.1: strip-ansi "^7.0.1" wrap-ansi "^8.0.1" +log-update@^6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/log-update/-/log-update-6.0.0.tgz#0ddeb7ac6ad658c944c1de902993fce7c33f5e59" + integrity sha512-niTvB4gqvtof056rRIrTZvjNYE4rCUzO6X/X+kYjd7WFxXeJ0NwEFnRxX6ehkvv3jTwrXnNdtAak5XYZuIyPFw== + dependencies: + ansi-escapes "^6.2.0" + cli-cursor "^4.0.0" + slice-ansi "^7.0.0" + strip-ansi "^7.1.0" + wrap-ansi "^9.0.0" + loose-envify@^1.1.0, loose-envify@^1.4.0: version "1.4.0" resolved "https://registry.yarnpkg.com/loose-envify/-/loose-envify-1.4.0.tgz#71ee51fa7be4caec1a63839f7e682d8132d30caf" @@ -9477,6 +10536,14 @@ micromatch@4.0.5, micromatch@^4.0.2, micromatch@^4.0.4, micromatch@^4.0.5: braces "^3.0.2" picomatch "^2.3.1" +micromatch@~4.0.7: + version "4.0.7" + resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-4.0.7.tgz#33e8190d9fe474a9895525f5618eee136d46c2e5" + integrity sha512-LPP/3KorzCwBxfeUuZmaR6bG2kdeHSbe0P2tY3FLRU4vYrjYz5hI4QZwV0njUx3jeuKe67YukQ1LSPZBKDqO/Q== + dependencies: + braces "^3.0.3" + picomatch "^2.3.1" + mime-db@1.52.0, "mime-db@>= 1.43.0 < 2": version "1.52.0" resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.52.0.tgz#bbabcdc02859f4987301c856e3387ce5ec43bf70" @@ -9686,6 +10753,11 @@ moment@^2.29.1: resolved "https://registry.yarnpkg.com/moment/-/moment-2.29.4.tgz#3dbe052889fe7c1b2ed966fcb3a77328964ef108" integrity sha512-5LC9SOxjSc2HF6vO2CyuTDNivEdoz2IvyJJGj6X8DJ0eFyfszE0QiEd+iXmBvUP3WHxSjFH/vIsA0EN00cgr8w== +moment@^2.30.1: + version "2.30.1" + resolved "https://registry.yarnpkg.com/moment/-/moment-2.30.1.tgz#f8c91c07b7a786e30c59926df530b4eac96974ae" + integrity sha512-uEmtNhbDOrWPFS+hdjFCBfy9f2YoyzRpwcl+DqpC6taX21FzsTLQVbMV/W7PzNSX6x/bhC1zA3c2UQ5NzH6how== + ms@2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/ms/-/ms-2.0.0.tgz#5608aeadfc00be6c2901df5f9861788de0d597c8" @@ -9833,6 +10905,11 @@ node-releases@^2.0.13: resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-2.0.13.tgz#d5ed1627c23e3461e819b02e57b75e4899b1c81d" integrity sha512-uYr7J37ae/ORWdZeQ1xxMJe3NtdmqMC/JZK+geofDrkLUApKRHPd18/TxtBOJ4A0/+uUIliorNrfYV6s1b02eQ== +node-releases@^2.0.14: + version "2.0.14" + resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-2.0.14.tgz#2ffb053bceb8b2be8495ece1ab6ce600c4461b0b" + integrity sha512-y10wOWt8yZpqXmOgRo77WaHEmhYQYGNA6y421PKsKYWEK8aW+cqAphborZDhqfyKrbZEN92CN1X2KbafY2s7Yw== + nopt@^6.0.0: version "6.0.0" resolved "https://registry.yarnpkg.com/nopt/-/nopt-6.0.0.tgz#245801d8ebf409c6df22ab9d95b65e1309cdb16d" @@ -10267,7 +11344,7 @@ p-limit@^2.0.0, p-limit@^2.2.0: dependencies: p-try "^2.0.0" -p-limit@^3.0.2: +p-limit@^3.0.2, p-limit@^3.1.0: version "3.1.0" resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-3.1.0.tgz#e1daccbe78d0d1388ca18c64fea38e3e57e3706b" integrity sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ== @@ -10540,12 +11617,17 @@ picocolors@^1.0.0: resolved "https://registry.yarnpkg.com/picocolors/-/picocolors-1.0.0.tgz#cb5bdc74ff3f51892236eaf79d68bc44564ab81c" integrity sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ== +picocolors@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/picocolors/-/picocolors-1.0.1.tgz#a8ad579b571952f0e5d25892de5445bcfe25aaa1" + integrity sha512-anP1Z8qwhkbmu7MFP5iTt+wQKXgwzf7zTyGlcdzabySa9vd0Xt392U0rVmz9poOaBj0uHJKyyo9/upk0HrEQew== + picomatch@^2.0.4, picomatch@^2.2.1, picomatch@^2.2.2, picomatch@^2.2.3, picomatch@^2.3.1: version "2.3.1" resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.3.1.tgz#3ba3833733646d9d3e4995946c1365a67fb07a42" integrity sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA== -pidtree@0.6.0: +pidtree@0.6.0, pidtree@~0.6.0: version "0.6.0" resolved "https://registry.yarnpkg.com/pidtree/-/pidtree-0.6.0.tgz#90ad7b6d42d5841e69e0a2419ef38f8883aa057c" integrity sha512-eG2dWTVw5bzqGRztnHExczNxt5VGsE6OwTeCG3fdUf9KBsZzO3R5OIIIzWR+iZA0NtZ+RDVdaoE2dK1cn6jH4g== @@ -11215,6 +12297,15 @@ pretty-format@^29.0.0, pretty-format@^29.5.0, pretty-format@^29.6.2: ansi-styles "^5.0.0" react-is "^18.0.0" +pretty-format@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-29.7.0.tgz#ca42c758310f365bfa71a0bda0a807160b776812" + integrity sha512-Pdlw/oPxN+aXdmM9R00JVC9WVFoCLTKJvDVLgmJ+qAffBMxsV85l/Lu7sNx4zSzPyoL2euImuEwHhOXdEgNFZQ== + dependencies: + "@jest/schemas" "^29.6.3" + ansi-styles "^5.0.0" + react-is "^18.0.0" + proc-log@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/proc-log/-/proc-log-3.0.0.tgz#fb05ef83ccd64fd7b20bbe9c8c1070fc08338dd8" @@ -11302,6 +12393,11 @@ punycode@^2.1.0, punycode@^2.1.1: resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.3.0.tgz#f67fa67c94da8f4d0cfff981aee4118064199b8f" integrity sha512-rRV+zQD8tVFys26lAGR9WUuS4iUAngJScM+ZRSKtvl5tKeZ2t5bvdNFdNHBW9FWR4guGHlgmsZ1G7BSm2wTbuA== +pure-rand@^6.0.0: + version "6.1.0" + resolved "https://registry.yarnpkg.com/pure-rand/-/pure-rand-6.1.0.tgz#d173cf23258231976ccbdb05247c9787957604f2" + integrity sha512-bVWawvoZoBYpp6yIoQtQXHZjmz35RSVHnUOTefl8Vcjr8snTPY1wnpSPMWekcFwbxI6gtmT7rSYPFvz71ldiOA== + q@^1.1.2: version "1.5.1" resolved "https://registry.yarnpkg.com/q/-/q-1.5.1.tgz#7e32f75b41381291d04611f1bf14109ac00651d7" @@ -11463,6 +12559,11 @@ react-final-form@^6.5.9: dependencies: "@babel/runtime" "^7.15.4" +react-hook-form@^7.49.3: + version "7.51.5" + resolved "https://registry.yarnpkg.com/react-hook-form/-/react-hook-form-7.51.5.tgz#4afbfb819312db9fea23e8237a3a0d097e128b43" + integrity sha512-J2ILT5gWx1XUIJRETiA7M19iXHlG74+6O3KApzvqB/w8S5NQR7AbU8HVZrMALdmDgWpRPYiZJl0zx8Z4L2mP6Q== + "react-is@^16.12.0 || ^17.0.0 || ^18.0.0", react-is@^18.0.0, react-is@^18.2.0: version "18.2.0" resolved "https://registry.yarnpkg.com/react-is/-/react-is-18.2.0.tgz#199431eeaaa2e09f86427efbb4f1473edb47609b" @@ -11900,6 +13001,11 @@ resolve.exports@^1.1.0: resolved "https://registry.yarnpkg.com/resolve.exports/-/resolve.exports-1.1.1.tgz#05cfd5b3edf641571fd46fa608b610dda9ead999" integrity sha512-/NtpHNDN7jWhAaQ9BvBUYZ6YTXsRBgfqWFWP7BZBaoMJO/I3G5OFzvTuWNlZC3aPjins1F+TNrLKsGbH4rfsRQ== +resolve.exports@^2.0.0: + version "2.0.2" + resolved "https://registry.yarnpkg.com/resolve.exports/-/resolve.exports-2.0.2.tgz#f8c934b8e6a13f539e38b7098e2e36134f01e800" + integrity sha512-X2UW6Nw3n/aMgDVy+0rSqgHlv39WZAlZrXCdnbyEiKm17DSqHX4MmQMaST3FbeWR5FTuRcUwYAziZajji0Y7mg== + resolve@^1.1.7, resolve@^1.10.0, resolve@^1.14.2, resolve@^1.19.0, resolve@^1.20.0, resolve@^1.22.2, resolve@^1.22.3, resolve@^1.22.4: version "1.22.4" resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.22.4.tgz#1dc40df46554cdaf8948a486a10f6ba1e2026c34" @@ -11954,6 +13060,11 @@ rfdc@^1.3.0: resolved "https://registry.yarnpkg.com/rfdc/-/rfdc-1.3.0.tgz#d0b7c441ab2720d05dc4cf26e01c89631d9da08b" integrity sha512-V2hovdzFbOi77/WajaSMXk2OLm+xNIeQdMMuB7icj7bk6zi2F8GGAxigcnDFpJHbNyNcgyJDiP+8nOrY5cZGrA== +rfdc@^1.3.1: + version "1.3.1" + resolved "https://registry.yarnpkg.com/rfdc/-/rfdc-1.3.1.tgz#2b6d4df52dffe8bb346992a10ea9451f24373a8f" + integrity sha512-r5a3l5HzYlIC68TpmYKlxWjmOP6wiPJ1vWv2HeLhNsRZMrCkxeqxiHlQ21oXmQ4F3SiryXBHhAD7JZqvOJjFmg== + rimraf@^3.0.0, rimraf@^3.0.2: version "3.0.2" resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-3.0.2.tgz#f1a5402ba6220ad52cc1282bac1ae3aa49fd061a" @@ -12285,7 +13396,7 @@ signal-exit@3.0.7, signal-exit@^3.0.2, signal-exit@^3.0.3, signal-exit@^3.0.7: resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.7.tgz#a9a1767f8af84155114eaabd73f99273c8f59ad9" integrity sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ== -signal-exit@^4.0.1: +signal-exit@^4.0.1, signal-exit@^4.1.0: version "4.1.0" resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-4.1.0.tgz#952188c1cbd546070e2dd20d0f41c0ae0530cb04" integrity sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw== @@ -12324,6 +13435,14 @@ slice-ansi@^5.0.0: ansi-styles "^6.0.0" is-fullwidth-code-point "^4.0.0" +slice-ansi@^7.0.0: + version "7.1.0" + resolved "https://registry.yarnpkg.com/slice-ansi/-/slice-ansi-7.1.0.tgz#cd6b4655e298a8d1bdeb04250a433094b347b9a9" + integrity sha512-bSiSngZ/jWeX93BqeIAbImyTbEihizcwNjFoRUIY/T1wWQsfsm2Vw1agPKylXvQTU7iASGdHhyqRlqQzfz+Htg== + dependencies: + ansi-styles "^6.2.1" + is-fullwidth-code-point "^5.0.0" + smart-buffer@^4.2.0: version "4.2.0" resolved "https://registry.yarnpkg.com/smart-buffer/-/smart-buffer-4.2.0.tgz#6e1d71fa4f18c05f7d0ff216dd16a481d0e8d9ae" @@ -12381,6 +13500,14 @@ source-map-loader@^3.0.0: iconv-lite "^0.6.3" source-map-js "^1.0.1" +source-map-support@0.5.13: + version "0.5.13" + resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.13.tgz#31b24a9c2e73c2de85066c0feb7d44767ed52932" + integrity sha512-SHSKFHadjVA5oR4PPqhtAVdcBWwRYVd6g6cAXnIbRiIwc2EhPrTuKUBdSLvlEKyIP3GCf89fltvcZiP9MMFA1w== + dependencies: + buffer-from "^1.0.0" + source-map "^0.6.0" + source-map-support@^0.5.6, source-map-support@~0.5.20: version "0.5.21" resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.21.tgz#04fe7c7f9e1ed2d662233c28cb2b35b9f63f6e4f" @@ -12579,7 +13706,7 @@ strict-uri-encode@^2.0.0: resolved "https://registry.yarnpkg.com/strict-uri-encode/-/strict-uri-encode-2.0.0.tgz#b9c7330c7042862f6b142dc274bbcc5866ce3546" integrity sha512-QwiXZgpRcKkhTj2Scnn++4PKtWsH0kpzZ62L2R6c/LUVYv7hVnZqcg2+sMuT6R7Jusu1vviK/MFsu6kNJfWlEQ== -string-argv@0.3.2: +string-argv@0.3.2, string-argv@~0.3.2: version "0.3.2" resolved "https://registry.yarnpkg.com/string-argv/-/string-argv-0.3.2.tgz#2b6d0ef24b656274d957d54e0a4bbf6153dc02b6" integrity sha512-aqD2Q0144Z+/RqG52NeHEkZauTAUWJO8c6yTftGJKO3Tja5tUgIfmIl6kExvhtxSDP7fXB6DvzkfMpCd/F3G+Q== @@ -12631,6 +13758,15 @@ string-width@^5.0.0, string-width@^5.0.1, string-width@^5.1.2: emoji-regex "^9.2.2" strip-ansi "^7.0.1" +string-width@^7.0.0: + version "7.1.0" + resolved "https://registry.yarnpkg.com/string-width/-/string-width-7.1.0.tgz#d994252935224729ea3719c49f7206dc9c46550a" + integrity sha512-SEIJCWiX7Kg4c129n48aDRwLbFb2LJmXXFrWBG4NGaRtMQ3myKPKbwrD1BKqQn74oCoNMBVrfDEr5M9YxCsrkw== + dependencies: + emoji-regex "^10.3.0" + get-east-asian-width "^1.0.0" + strip-ansi "^7.1.0" + string.prototype.matchall@^4.0.6, string.prototype.matchall@^4.0.8: version "4.0.8" resolved "https://registry.yarnpkg.com/string.prototype.matchall/-/string.prototype.matchall-4.0.8.tgz#3bf85722021816dcd1bf38bb714915887ca79fd3" @@ -12702,7 +13838,7 @@ stringify-object@^3.3.0: dependencies: ansi-regex "^5.0.1" -strip-ansi@^7.0.1: +strip-ansi@^7.0.1, strip-ansi@^7.1.0: version "7.1.0" resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-7.1.0.tgz#d5b6568ca689d8561370b0707685d22434faff45" integrity sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ== @@ -13174,6 +14310,20 @@ ts-jest@^27.1.4, ts-jest@^27.1.5: semver "7.x" yargs-parser "20.x" +ts-jest@^29.1.1: + version "29.1.4" + resolved "https://registry.yarnpkg.com/ts-jest/-/ts-jest-29.1.4.tgz#26f8a55ce31e4d2ef7a1fd47dc7fa127e92793ef" + integrity sha512-YiHwDhSvCiItoAgsKtoLFCuakDzDsJ1DLDnSouTaTmdOcOwIkSzbLXduaQ6M5DRVhuZC/NYaaZ/mtHbWMv/S6Q== + dependencies: + bs-logger "0.x" + fast-json-stable-stringify "2.x" + jest-util "^29.0.0" + json5 "^2.2.3" + lodash.memoize "4.x" + make-error "1.x" + semver "^7.5.3" + yargs-parser "^21.0.1" + tsconfig-paths@^3.14.2: version "3.14.2" resolved "https://registry.yarnpkg.com/tsconfig-paths/-/tsconfig-paths-3.14.2.tgz#6e32f1f79412decd261f92d633a9dc1cfa99f088" @@ -13454,6 +14604,14 @@ update-browserslist-db@^1.0.11: escalade "^3.1.1" picocolors "^1.0.0" +update-browserslist-db@^1.0.13: + version "1.0.16" + resolved "https://registry.yarnpkg.com/update-browserslist-db/-/update-browserslist-db-1.0.16.tgz#f6d489ed90fb2f07d67784eb3f53d7891f736356" + integrity sha512-KVbTxlBYlckhF5wgfyZXTWnMn7MMZjMu9XG8bPlliUOP9ThaF4QnhP8qrjrH7DRzHfSk0oQv1wToW+iA5GajEQ== + dependencies: + escalade "^3.1.2" + picocolors "^1.0.1" + uri-js@^4.2.2: version "4.4.1" resolved "https://registry.yarnpkg.com/uri-js/-/uri-js-4.4.1.tgz#9b1a52595225859e55f669d928f88c6c57f2a77e" @@ -13528,6 +14686,15 @@ v8-to-istanbul@^8.1.0: convert-source-map "^1.6.0" source-map "^0.7.3" +v8-to-istanbul@^9.0.1: + version "9.2.0" + resolved "https://registry.yarnpkg.com/v8-to-istanbul/-/v8-to-istanbul-9.2.0.tgz#2ed7644a245cddd83d4e087b9b33b3e62dfd10ad" + integrity sha512-/EH/sDgxU2eGxajKdwLCDmQ4FWq+kpi3uCmBGpw1xJtnAxEjlD8j8PEiGWpCIMIs3ciNAgH0d3TTJiUkYzyZjA== + dependencies: + "@jridgewell/trace-mapping" "^0.3.12" + "@types/istanbul-lib-coverage" "^2.0.1" + convert-source-map "^2.0.0" + validate-npm-package-license@3.0.4, validate-npm-package-license@^3.0.1, validate-npm-package-license@^3.0.4: version "3.0.4" resolved "https://registry.yarnpkg.com/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz#fc91f6b9c7ba15c857f4cb2c5defeec39d4f410a" @@ -13636,7 +14803,7 @@ w3c-xmlserializer@^2.0.0: dependencies: xml-name-validator "^3.0.0" -walker@^1.0.7: +walker@^1.0.7, walker@^1.0.8: version "1.0.8" resolved "https://registry.yarnpkg.com/walker/-/walker-1.0.8.tgz#bd498db477afe573dc04185f011d3ab8a8d7653f" integrity sha512-ts/8E8l5b7kY0vlWLewOkDXMmPdLcVV4GmOQLyxuSswIJsweeFZtAsMF7k1Nszz+TYBQrlYRmzOnr398y1JemQ== @@ -14135,6 +15302,15 @@ wrap-ansi@^8.0.1, wrap-ansi@^8.1.0: string-width "^5.0.1" strip-ansi "^7.0.1" +wrap-ansi@^9.0.0: + version "9.0.0" + resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-9.0.0.tgz#1a3dc8b70d85eeb8398ddfb1e4a02cd186e58b3e" + integrity sha512-G8ura3S+3Z2G+mkgNRq8dqaFZAuxfsxpBB8OCTGRTCtp+l/v9nbFNmCUP1BZMts3G1142MsZfn6eeUKrr4PD1Q== + dependencies: + ansi-styles "^6.2.1" + string-width "^7.0.0" + strip-ansi "^7.1.0" + wrappy@1: version "1.0.2" resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" @@ -14167,6 +15343,14 @@ write-file-atomic@^3.0.0: signal-exit "^3.0.2" typedarray-to-buffer "^3.1.5" +write-file-atomic@^4.0.2: + version "4.0.2" + resolved "https://registry.yarnpkg.com/write-file-atomic/-/write-file-atomic-4.0.2.tgz#a9df01ae5b77858a027fd2e80768ee433555fcfd" + integrity sha512-7KxauUdBmSdWnmpaGFg+ppNjKF8uNLry8LyzjauQDOVONfFLNKrKvQOxZ/VuTIcS/gge/YNahf5RIIQWTSarlg== + dependencies: + imurmurhash "^0.1.4" + signal-exit "^3.0.7" + write-json-file@^3.2.0: version "3.2.0" resolved "https://registry.yarnpkg.com/write-json-file/-/write-json-file-3.2.0.tgz#65bbdc9ecd8a1458e15952770ccbadfcff5fe62a" @@ -14245,6 +15429,11 @@ yaml@^1.10.0, yaml@^1.10.2, yaml@^1.7.2: resolved "https://registry.yarnpkg.com/yaml/-/yaml-1.10.2.tgz#2301c5ffbf12b467de8da2333a459e29e7920e4b" integrity sha512-r3vXyErRCYJ7wg28yvBY5VSoAF8ZvlcW9/BwUzEtUsjvX/DKs24dIkuwjtuprwJJHsbyUbLApepYTR1BN4uHrg== +yaml@~2.4.2: + version "2.4.2" + resolved "https://registry.yarnpkg.com/yaml/-/yaml-2.4.2.tgz#7a2b30f2243a5fc299e1f14ca58d475ed4bc5362" + integrity sha512-B3VqDZ+JAg1nZpaEmWtTXUlBneoGx6CPM9b0TENK6aoSu5t73dItudwdgmi6tHlIZZId4dZ9skcAQ2UbcyAeVA== + yargs-parser@20.2.4: version "20.2.4" resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-20.2.4.tgz#b42890f14566796f85ae8e3a25290d205f154a54" @@ -14255,7 +15444,7 @@ yargs-parser@20.x, yargs-parser@^20.2.2, yargs-parser@^20.2.3: resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-20.2.9.tgz#2eb7dc3b0289718fc295f362753845c41a0c94ee" integrity sha512-y11nGElTIV+CT3Zv9t7VKl+Q3hTQoT9a1Qzezhhl6Rp21gJ/IVTW7Z3y9EWXhuUBC2Shnf+DX0antecpAwSP8w== -yargs-parser@21.1.1, yargs-parser@^21.1.1: +yargs-parser@21.1.1, yargs-parser@^21.0.1, yargs-parser@^21.1.1: version "21.1.1" resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-21.1.1.tgz#9096bceebf990d21bb31fa9516e0ede294a77d35" integrity sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw== @@ -14273,7 +15462,7 @@ yargs@16.2.0, yargs@^16.2.0: y18n "^5.0.5" yargs-parser "^20.2.2" -yargs@^17.6.2: +yargs@^17.3.1, yargs@^17.6.2: version "17.7.2" resolved "https://registry.yarnpkg.com/yargs/-/yargs-17.7.2.tgz#991df39aca675a192b816e1e0363f9d75d2aa269" integrity sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w== From 1cdd3a280a08d8c4d37cece3203aa60ba8bd5ab3 Mon Sep 17 00:00:00 2001 From: Pavel R Date: Wed, 29 May 2024 13:49:38 +0200 Subject: [PATCH 02/12] WIP: Remove sdc-qrf from sources Ref: https://github.com/beda-software/sdc-ide/issues/66 --- package.json | 1 - sdc-qrf/LICENSE | 21 - sdc-qrf/README.md | 9 - sdc-qrf/jest.config.js | 19 - sdc-qrf/package.json | 40 - sdc-qrf/src/components.tsx | 218 ----- sdc-qrf/src/context.ts | 5 - sdc-qrf/src/converter/__tests__/fce.test.ts | 224 ----- .../questionnaire_fce/allergies.json | 405 --------- .../questionnaire_fce/beverages.json | 72 -- .../choice_answer_option.json | 53 -- .../resources/questionnaire_fce/consent.json | 86 -- .../questionnaire_fce/enable_when.json | 103 --- .../questionnaire_fce/encounter_create.json | 126 --- .../resources/questionnaire_fce/gad_7.json | 459 ----------- .../questionnaire_fce/immunization.json | 182 ----- .../questionnaire_fce/medication.json | 189 ----- .../multiple_type_launch_context.json | 406 --------- .../questionnaire_fce/patient_create.json | 84 -- .../questionnaire_fce/patient_edit.json | 125 --- .../questionnaire_fce/phq_2_phq_9.json | 552 ------------- .../questionnaire_fce/physicalexam.json | 385 --------- .../practitioner_create.json | 90 -- .../practitioner_create_structure_map.json | 91 --- .../questionnaire_fce/practitioner_edit.json | 144 ---- .../practitioner_role_create.json | 37 - .../questionnaire_fce/public_appointment.json | 91 --- .../questionnaire_fce/review_of_systems.json | 389 --------- .../questionnaire_fce/source_queries.json | 34 - .../resources/questionnaire_fce/vitals.json | 234 ------ .../questionnaire_fhir/allergies.json | 433 ---------- .../questionnaire_fhir/beverages.json | 99 --- .../choice_answer_option.json | 49 -- .../resources/questionnaire_fhir/consent.json | 119 --- .../questionnaire_fhir/enable_when.json | 87 -- .../questionnaire_fhir/encounter_create.json | 171 ---- .../resources/questionnaire_fhir/gad_7.json | 489 ----------- .../questionnaire_fhir/immunization.json | 215 ----- .../questionnaire_fhir/medication.json | 226 ------ .../multiple_type_launch_context.json | 416 ---------- .../questionnaire_fhir/patient_create.json | 97 --- .../questionnaire_fhir/patient_edit.json | 183 ----- .../questionnaire_fhir/phq_2_phq_9.json | 580 ------------- .../questionnaire_fhir/physicalexam.json | 544 ------------- .../practitioner_create.json | 87 -- .../practitioner_create_structure_map.json | 91 --- .../questionnaire_fhir/practitioner_edit.json | 193 ----- .../practitioner_role_create.json | 44 - .../public_appointment.json | 116 --- .../questionnaire_fhir/review_of_systems.json | 368 --------- .../questionnaire_fhir/source_queries.json | 37 - .../resources/questionnaire_fhir/vitals.json | 317 -------- .../allergies_inprogress.json | 78 -- .../cardiology.json | 96 --- .../few_answers.json | 48 -- .../questionnaire_response_fce/gad_7.json | 165 ---- .../immunization.json | 86 -- .../medication.json | 116 --- .../new_appointment.json | 96 --- .../questionnaire_response_fce/patient.json | 87 -- .../phq_2_phq_9.json | 193 ----- .../physicalexam.json | 187 ----- .../practitioner.json | 57 -- .../reference_answer_with_assoc.json | 147 ---- .../review_of_systems.json | 129 --- .../questionnaire_response_fce/vitals.json | 168 ---- .../allergies_inprogress.json | 73 -- .../cardiology.json | 87 -- .../few_answers.json | 46 -- .../questionnaire_response_fhir/gad_7.json | 146 ---- .../immunization.json | 77 -- .../medication.json | 101 --- .../new_appointment.json | 86 -- .../questionnaire_response_fhir/patient.json | 78 -- .../phq_2_phq_9.json | 170 ---- .../physicalexam.json | 158 ---- .../practitioner.json | 54 -- .../reference_answer_with_assoc.json | 86 -- .../review_of_systems.json | 118 --- .../questionnaire_response_fhir/vitals.json | 145 ---- sdc-qrf/src/converter/extensions.ts | 149 ---- sdc-qrf/src/converter/fceToFhir/index.ts | 27 - .../fceToFhir/questionnaire/index.ts | 15 - .../questionnaire/processExtensions.ts | 75 -- .../fceToFhir/questionnaire/processItems.ts | 194 ----- .../fceToFhir/questionnaire/processMeta.ts | 19 - .../fceToFhir/questionnaireResponse/index.ts | 21 - .../questionnaireResponse/processAnswers.ts | 53 -- .../questionnaireResponse/processMeta.ts | 16 - .../questionnaireResponse/processReference.ts | 24 - sdc-qrf/src/converter/fhirToFce/index.ts | 27 - .../fhirToFce/questionnaire/index.ts | 25 - .../questionnaire/processExtensions.ts | 113 --- .../fhirToFce/questionnaire/processItems.ts | 159 ---- .../fhirToFce/questionnaire/processMeta.ts | 17 - .../fhirToFce/questionnaireResponse/index.ts | 21 - .../questionnaireResponse/processAnswers.ts | 53 -- .../questionnaireResponse/processMeta.ts | 14 - .../questionnaireResponse/processReference.ts | 20 - sdc-qrf/src/converter/fhirToFce/utils.ts | 36 - sdc-qrf/src/converter/index.ts | 106 --- sdc-qrf/src/hooks.ts | 7 - sdc-qrf/src/index.ts | 5 - sdc-qrf/src/setupTests.ts | 1 - sdc-qrf/src/types.ts | 105 --- sdc-qrf/src/utils.ts | 751 ----------------- sdc-qrf/tests/resources/questionnaire.ts | 339 -------- sdc-qrf/tests/utils.test.ts | 767 ------------------ sdc-qrf/tsconfig.json | 31 - sdc-qrf/vite.config.ts | 14 - .../BaseQuestionnaireResponseForm/index.tsx | 5 +- yarn.lock | 306 +------ 112 files changed, 35 insertions(+), 16393 deletions(-) delete mode 100644 sdc-qrf/LICENSE delete mode 100644 sdc-qrf/README.md delete mode 100644 sdc-qrf/jest.config.js delete mode 100644 sdc-qrf/package.json delete mode 100644 sdc-qrf/src/components.tsx delete mode 100644 sdc-qrf/src/context.ts delete mode 100644 sdc-qrf/src/converter/__tests__/fce.test.ts delete mode 100644 sdc-qrf/src/converter/__tests__/resources/questionnaire_fce/allergies.json delete mode 100644 sdc-qrf/src/converter/__tests__/resources/questionnaire_fce/beverages.json delete mode 100644 sdc-qrf/src/converter/__tests__/resources/questionnaire_fce/choice_answer_option.json delete mode 100644 sdc-qrf/src/converter/__tests__/resources/questionnaire_fce/consent.json delete mode 100644 sdc-qrf/src/converter/__tests__/resources/questionnaire_fce/enable_when.json delete mode 100644 sdc-qrf/src/converter/__tests__/resources/questionnaire_fce/encounter_create.json delete mode 100644 sdc-qrf/src/converter/__tests__/resources/questionnaire_fce/gad_7.json delete mode 100644 sdc-qrf/src/converter/__tests__/resources/questionnaire_fce/immunization.json delete mode 100644 sdc-qrf/src/converter/__tests__/resources/questionnaire_fce/medication.json delete mode 100644 sdc-qrf/src/converter/__tests__/resources/questionnaire_fce/multiple_type_launch_context.json delete mode 100644 sdc-qrf/src/converter/__tests__/resources/questionnaire_fce/patient_create.json delete mode 100644 sdc-qrf/src/converter/__tests__/resources/questionnaire_fce/patient_edit.json delete mode 100644 sdc-qrf/src/converter/__tests__/resources/questionnaire_fce/phq_2_phq_9.json delete mode 100644 sdc-qrf/src/converter/__tests__/resources/questionnaire_fce/physicalexam.json delete mode 100644 sdc-qrf/src/converter/__tests__/resources/questionnaire_fce/practitioner_create.json delete mode 100644 sdc-qrf/src/converter/__tests__/resources/questionnaire_fce/practitioner_create_structure_map.json delete mode 100644 sdc-qrf/src/converter/__tests__/resources/questionnaire_fce/practitioner_edit.json delete mode 100644 sdc-qrf/src/converter/__tests__/resources/questionnaire_fce/practitioner_role_create.json delete mode 100644 sdc-qrf/src/converter/__tests__/resources/questionnaire_fce/public_appointment.json delete mode 100644 sdc-qrf/src/converter/__tests__/resources/questionnaire_fce/review_of_systems.json delete mode 100644 sdc-qrf/src/converter/__tests__/resources/questionnaire_fce/source_queries.json delete mode 100644 sdc-qrf/src/converter/__tests__/resources/questionnaire_fce/vitals.json delete mode 100644 sdc-qrf/src/converter/__tests__/resources/questionnaire_fhir/allergies.json delete mode 100644 sdc-qrf/src/converter/__tests__/resources/questionnaire_fhir/beverages.json delete mode 100644 sdc-qrf/src/converter/__tests__/resources/questionnaire_fhir/choice_answer_option.json delete mode 100644 sdc-qrf/src/converter/__tests__/resources/questionnaire_fhir/consent.json delete mode 100644 sdc-qrf/src/converter/__tests__/resources/questionnaire_fhir/enable_when.json delete mode 100644 sdc-qrf/src/converter/__tests__/resources/questionnaire_fhir/encounter_create.json delete mode 100644 sdc-qrf/src/converter/__tests__/resources/questionnaire_fhir/gad_7.json delete mode 100644 sdc-qrf/src/converter/__tests__/resources/questionnaire_fhir/immunization.json delete mode 100644 sdc-qrf/src/converter/__tests__/resources/questionnaire_fhir/medication.json delete mode 100644 sdc-qrf/src/converter/__tests__/resources/questionnaire_fhir/multiple_type_launch_context.json delete mode 100644 sdc-qrf/src/converter/__tests__/resources/questionnaire_fhir/patient_create.json delete mode 100644 sdc-qrf/src/converter/__tests__/resources/questionnaire_fhir/patient_edit.json delete mode 100644 sdc-qrf/src/converter/__tests__/resources/questionnaire_fhir/phq_2_phq_9.json delete mode 100644 sdc-qrf/src/converter/__tests__/resources/questionnaire_fhir/physicalexam.json delete mode 100644 sdc-qrf/src/converter/__tests__/resources/questionnaire_fhir/practitioner_create.json delete mode 100644 sdc-qrf/src/converter/__tests__/resources/questionnaire_fhir/practitioner_create_structure_map.json delete mode 100644 sdc-qrf/src/converter/__tests__/resources/questionnaire_fhir/practitioner_edit.json delete mode 100644 sdc-qrf/src/converter/__tests__/resources/questionnaire_fhir/practitioner_role_create.json delete mode 100644 sdc-qrf/src/converter/__tests__/resources/questionnaire_fhir/public_appointment.json delete mode 100644 sdc-qrf/src/converter/__tests__/resources/questionnaire_fhir/review_of_systems.json delete mode 100644 sdc-qrf/src/converter/__tests__/resources/questionnaire_fhir/source_queries.json delete mode 100644 sdc-qrf/src/converter/__tests__/resources/questionnaire_fhir/vitals.json delete mode 100644 sdc-qrf/src/converter/__tests__/resources/questionnaire_response_fce/allergies_inprogress.json delete mode 100644 sdc-qrf/src/converter/__tests__/resources/questionnaire_response_fce/cardiology.json delete mode 100644 sdc-qrf/src/converter/__tests__/resources/questionnaire_response_fce/few_answers.json delete mode 100644 sdc-qrf/src/converter/__tests__/resources/questionnaire_response_fce/gad_7.json delete mode 100644 sdc-qrf/src/converter/__tests__/resources/questionnaire_response_fce/immunization.json delete mode 100644 sdc-qrf/src/converter/__tests__/resources/questionnaire_response_fce/medication.json delete mode 100644 sdc-qrf/src/converter/__tests__/resources/questionnaire_response_fce/new_appointment.json delete mode 100644 sdc-qrf/src/converter/__tests__/resources/questionnaire_response_fce/patient.json delete mode 100644 sdc-qrf/src/converter/__tests__/resources/questionnaire_response_fce/phq_2_phq_9.json delete mode 100644 sdc-qrf/src/converter/__tests__/resources/questionnaire_response_fce/physicalexam.json delete mode 100644 sdc-qrf/src/converter/__tests__/resources/questionnaire_response_fce/practitioner.json delete mode 100644 sdc-qrf/src/converter/__tests__/resources/questionnaire_response_fce/reference_answer_with_assoc.json delete mode 100644 sdc-qrf/src/converter/__tests__/resources/questionnaire_response_fce/review_of_systems.json delete mode 100644 sdc-qrf/src/converter/__tests__/resources/questionnaire_response_fce/vitals.json delete mode 100644 sdc-qrf/src/converter/__tests__/resources/questionnaire_response_fhir/allergies_inprogress.json delete mode 100644 sdc-qrf/src/converter/__tests__/resources/questionnaire_response_fhir/cardiology.json delete mode 100644 sdc-qrf/src/converter/__tests__/resources/questionnaire_response_fhir/few_answers.json delete mode 100644 sdc-qrf/src/converter/__tests__/resources/questionnaire_response_fhir/gad_7.json delete mode 100644 sdc-qrf/src/converter/__tests__/resources/questionnaire_response_fhir/immunization.json delete mode 100644 sdc-qrf/src/converter/__tests__/resources/questionnaire_response_fhir/medication.json delete mode 100644 sdc-qrf/src/converter/__tests__/resources/questionnaire_response_fhir/new_appointment.json delete mode 100644 sdc-qrf/src/converter/__tests__/resources/questionnaire_response_fhir/patient.json delete mode 100644 sdc-qrf/src/converter/__tests__/resources/questionnaire_response_fhir/phq_2_phq_9.json delete mode 100644 sdc-qrf/src/converter/__tests__/resources/questionnaire_response_fhir/physicalexam.json delete mode 100644 sdc-qrf/src/converter/__tests__/resources/questionnaire_response_fhir/practitioner.json delete mode 100644 sdc-qrf/src/converter/__tests__/resources/questionnaire_response_fhir/reference_answer_with_assoc.json delete mode 100644 sdc-qrf/src/converter/__tests__/resources/questionnaire_response_fhir/review_of_systems.json delete mode 100644 sdc-qrf/src/converter/__tests__/resources/questionnaire_response_fhir/vitals.json delete mode 100644 sdc-qrf/src/converter/extensions.ts delete mode 100644 sdc-qrf/src/converter/fceToFhir/index.ts delete mode 100644 sdc-qrf/src/converter/fceToFhir/questionnaire/index.ts delete mode 100644 sdc-qrf/src/converter/fceToFhir/questionnaire/processExtensions.ts delete mode 100644 sdc-qrf/src/converter/fceToFhir/questionnaire/processItems.ts delete mode 100644 sdc-qrf/src/converter/fceToFhir/questionnaire/processMeta.ts delete mode 100644 sdc-qrf/src/converter/fceToFhir/questionnaireResponse/index.ts delete mode 100644 sdc-qrf/src/converter/fceToFhir/questionnaireResponse/processAnswers.ts delete mode 100644 sdc-qrf/src/converter/fceToFhir/questionnaireResponse/processMeta.ts delete mode 100644 sdc-qrf/src/converter/fceToFhir/questionnaireResponse/processReference.ts delete mode 100644 sdc-qrf/src/converter/fhirToFce/index.ts delete mode 100644 sdc-qrf/src/converter/fhirToFce/questionnaire/index.ts delete mode 100644 sdc-qrf/src/converter/fhirToFce/questionnaire/processExtensions.ts delete mode 100644 sdc-qrf/src/converter/fhirToFce/questionnaire/processItems.ts delete mode 100644 sdc-qrf/src/converter/fhirToFce/questionnaire/processMeta.ts delete mode 100644 sdc-qrf/src/converter/fhirToFce/questionnaireResponse/index.ts delete mode 100644 sdc-qrf/src/converter/fhirToFce/questionnaireResponse/processAnswers.ts delete mode 100644 sdc-qrf/src/converter/fhirToFce/questionnaireResponse/processMeta.ts delete mode 100644 sdc-qrf/src/converter/fhirToFce/questionnaireResponse/processReference.ts delete mode 100644 sdc-qrf/src/converter/fhirToFce/utils.ts delete mode 100644 sdc-qrf/src/converter/index.ts delete mode 100644 sdc-qrf/src/hooks.ts delete mode 100644 sdc-qrf/src/index.ts delete mode 100644 sdc-qrf/src/setupTests.ts delete mode 100644 sdc-qrf/src/types.ts delete mode 100644 sdc-qrf/src/utils.ts delete mode 100644 sdc-qrf/tests/resources/questionnaire.ts delete mode 100644 sdc-qrf/tests/utils.test.ts delete mode 100644 sdc-qrf/tsconfig.json delete mode 100644 sdc-qrf/vite.config.ts diff --git a/package.json b/package.json index 2fa6fbdb..9fa3191c 100644 --- a/package.json +++ b/package.json @@ -51,7 +51,6 @@ "packages": [ "web", "shared", - "sdc-qrf", "packages/@beda.software/fhir-questionnaire" ], "nohoist": [ diff --git a/sdc-qrf/LICENSE b/sdc-qrf/LICENSE deleted file mode 100644 index 128537d1..00000000 --- a/sdc-qrf/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2020 Ilya Beda - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/sdc-qrf/README.md b/sdc-qrf/README.md deleted file mode 100644 index 857bf316..00000000 --- a/sdc-qrf/README.md +++ /dev/null @@ -1,9 +0,0 @@ -# sdc-qrf - -Set of utils packaged in [npm package](https://www.npmjs.com/package/sdc-qrf) to render forms for SDC Questionnaire/Questionnaire Response. - -Sdc-qrf uses in [fhir-emr](https://github.com/beda-software/fhir-emr) project. Also we're using [aidbox-sdc](https://github.com/beda-software/aidbox-sdc) as backed for fhir-emr. - -```sh -npm i sdc-qrf -``` diff --git a/sdc-qrf/jest.config.js b/sdc-qrf/jest.config.js deleted file mode 100644 index 604d4d2f..00000000 --- a/sdc-qrf/jest.config.js +++ /dev/null @@ -1,19 +0,0 @@ -// For a detailed explanation regarding each configuration property, visit: -// https://jestjs.io/docs/en/configuration.html - -module.exports = { - // Automatically clear mock calls and instances between every test - clearMocks: true, - - // The directory where Jest should output its coverage files - coverageDirectory: 'coverage', - - // The test environment that will be used for testing - testEnvironment: 'jsdom', - - testMatch: ['**/?(*.)+(spec|test).[jt]s?(x)'], - - transform: { - '^.+\\.tsx?$': 'ts-jest', - }, -}; diff --git a/sdc-qrf/package.json b/sdc-qrf/package.json deleted file mode 100644 index dc270001..00000000 --- a/sdc-qrf/package.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "name": "sdc-qrf", - "license": "MIT", - "version": "0.3.1", - "scripts": { - "build": "tsc", - "coverage": "jest --coverage --coverageReporters=text-lcov | coveralls", - "prepare": "npm run build", - "test": "vitest run --no-threads", - "typecheck": "tsc" - }, - "dependencies": { - "classnames": "^2.3.1", - "fhirpath": "^3.5.0", - "lodash": "^4.17.15", - "tslib": "^2.4.0", - "query-string": "^7.1.1" - }, - "devDependencies": { - "@babel/core": "^7.7.7", - "@babel/preset-env": "^7.7.7", - "@babel/preset-typescript": "^7.7.7", - "@testing-library/react": "^13.3.0", - "@testing-library/react-hooks": "^8.0.1", - "@types/jest": "^27.5.1", - "babel-jest": "^27.5.1", - "coveralls": "^3.0.9", - "jest": "^27.5.1", - "ts-jest": "^27.1.5", - "react": "^18.2.0", - "react-test-renderer": "^18.2.0" - }, - "files": [ - "lib/**/*", - "src/**/*", - "README.md", - "LICENSE" - ], - "main": "./lib/index.js" -} diff --git a/sdc-qrf/src/components.tsx b/sdc-qrf/src/components.tsx deleted file mode 100644 index 786368d0..00000000 --- a/sdc-qrf/src/components.tsx +++ /dev/null @@ -1,218 +0,0 @@ -import fhirpath from 'fhirpath'; -import _ from 'lodash'; -import isEqual from 'lodash/isEqual'; -import React, { ReactChild, useEffect, useContext, useMemo, useRef } from 'react'; - -import { QuestionnaireItem } from 'shared/src/contrib/aidbox'; - -import { useQuestionnaireResponseFormContext } from '.'; -import { QRFContext } from './context'; -import { ItemContext, QRFContextData, QuestionItemProps, QuestionItemsProps } from './types'; -import { calcContext, getBranchItems, getEnabledQuestions, wrapAnswerValue } from './utils'; - -export function usePreviousValue(value: T) { - const prevValue = useRef(); - - useEffect(() => { - prevValue.current = value; - - return () => { - prevValue.current = undefined; - }; - }); - - return prevValue.current; -} - -export function QuestionItems(props: QuestionItemsProps) { - const { questionItems, parentPath, context } = props; - const { formValues } = useQuestionnaireResponseFormContext(); - - return ( - - {getEnabledQuestions(questionItems, parentPath, formValues, context).map( - (item, index) => { - return ( - - ); - }, - )} - - ); -} - -export function QuestionItem(props: QuestionItemProps) { - const { questionItem, context: initialContext, parentPath } = props; - const { - questionItemComponents, - customWidgets, - groupItemComponent, - itemControlQuestionItemComponents, - itemControlGroupItemComponents, - } = useContext(QRFContext); - const { formValues, setFormValues } = useQuestionnaireResponseFormContext(); - - const { type, linkId, calculatedExpression, variable, repeats, itemControl } = questionItem; - const fieldPath = useMemo(() => [...parentPath, linkId!], [parentPath, linkId]); - - // TODO: how to do when item is not in QR (e.g. default element of repeatable group) - const branchItems = getBranchItems( - fieldPath, - initialContext.questionnaire, - initialContext.resource, - ); - const context = - type === 'group' - ? branchItems.qrItems.map((curQRItem) => - calcContext(initialContext, variable, branchItems.qItem, curQRItem), - ) - : calcContext(initialContext, variable, branchItems.qItem, branchItems.qrItems[0]!); - const prevAnswers = usePreviousValue(_.get(formValues, fieldPath)); - - useEffect(() => { - if (!isGroupItem(questionItem, context) && calculatedExpression) { - // TODO: Add support for x-fhir-query - if (calculatedExpression.language === 'text/fhirpath') { - const newValues = fhirpath.evaluate( - context.context || {}, - calculatedExpression.expression!, - context as ItemContext, - ); - const newAnswers = newValues.length - ? repeats - ? newValues.map((answer: any) => ({ value: wrapAnswerValue(type, answer) })) - : [{ value: wrapAnswerValue(type, newValues[0]) }] - : undefined; - - if (!isEqual(newAnswers, prevAnswers)) { - const allValues = _.set(_.cloneDeep(formValues), fieldPath, newAnswers); - setFormValues(allValues, fieldPath, newAnswers); - } - } - } - }, [ - setFormValues, - formValues, - calculatedExpression, - context, - parentPath, - repeats, - type, - questionItem, - prevAnswers, - fieldPath, - ]); - - if (isGroupItem(questionItem, context)) { - if (itemControl) { - if ( - !itemControlGroupItemComponents || - !itemControlGroupItemComponents[itemControl.coding![0]!.code!] - ) { - console.warn(`QRF: Unsupported group itemControl '${itemControl.coding![0]! - .code!}'. - Please define 'itemControlGroupWidgets' for '${itemControl.coding![0]!.code!}'`); - const DefaultComponent = groupItemComponent; - return DefaultComponent ? ( - - ) : null; - } - - const Component = itemControlGroupItemComponents[itemControl.coding![0]!.code!]!; - - return ( - - ); - } - if (!groupItemComponent) { - console.warn(`QRF: groupWidget is not specified but used in questionnaire.`); - - return null; - } - - const GroupWidgetComponent = groupItemComponent; - - return ( - - ); - } - - if (itemControl) { - if ( - !itemControlQuestionItemComponents || - !itemControlQuestionItemComponents[itemControl.coding![0]!.code!] - ) { - console.warn( - `QRF: Unsupported itemControl '${itemControl.coding![0]!.code!}'. -Please define 'itemControlWidgets' for '${itemControl.coding![0]!.code!}'`, - ); - - const DefaultComponent = questionItemComponents[questionItem.type]; - return DefaultComponent ? ( - - ) : null; - } - - const Component = itemControlQuestionItemComponents[itemControl.coding![0]!.code!]!; - - return ; - } - - // TODO: deprecate! - if (customWidgets && linkId && linkId in customWidgets) { - console.warn( - `QRF: 'customWidgets' are deprecated, use 'Questionnaire.item.itemControl' instead`, - ); - - if (type === 'group') { - console.error(`QRF: Use 'itemControl' for group custom widgets`); - return null; - } - - const Component = customWidgets[linkId]!; - - return ; - } - - if (type in questionItemComponents) { - const Component = questionItemComponents[type]!; - - return ; - } - - console.error(`QRF: Unsupported item type '${type}'`); - - return null; -} - -export function QuestionnaireResponseFormProvider({ - children, - ...props -}: QRFContextData & { children: ReactChild }) { - return {children}; -} - -/* Helper that resolves right context type */ -function isGroupItem( - questionItem: QuestionnaireItem, - context: ItemContext | ItemContext[], -): context is ItemContext[] { - return questionItem.type === 'group'; -} diff --git a/sdc-qrf/src/context.ts b/sdc-qrf/src/context.ts deleted file mode 100644 index f62e2a83..00000000 --- a/sdc-qrf/src/context.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { createContext } from 'react'; - -import { QRFContextData } from './types'; - -export const QRFContext = createContext({} as any); diff --git a/sdc-qrf/src/converter/__tests__/fce.test.ts b/sdc-qrf/src/converter/__tests__/fce.test.ts deleted file mode 100644 index cb25f20c..00000000 --- a/sdc-qrf/src/converter/__tests__/fce.test.ts +++ /dev/null @@ -1,224 +0,0 @@ -import { - QuestionnaireResponse as FHIRQuestionnaireResponse, - Questionnaire as FHIRQuestionnaire, -} from 'fhir/r4b'; -import cloneDeep from 'lodash/cloneDeep'; - -import { - QuestionnaireResponse as FCEQuestionnaireResponse, - Questionnaire as FCEQuestionnaire, -} from 'shared/src/contrib/aidbox'; - -// fce questionnaire -import fce_allergies from './resources/questionnaire_fce/allergies.json'; -import fce_beverages from './resources/questionnaire_fce/beverages.json'; -import fce_choice_answer_option from './resources/questionnaire_fce/choice_answer_option.json'; -import fce_consent from './resources/questionnaire_fce/consent.json'; -import fce_enable_when from './resources/questionnaire_fce/enable_when.json'; -import fce_encounter_create from './resources/questionnaire_fce/encounter_create.json'; -import fce_gad_7 from './resources/questionnaire_fce/gad_7.json'; -import fce_immunization from './resources/questionnaire_fce/immunization.json'; -import fce_medication from './resources/questionnaire_fce/medication.json'; -import fce_multiple_type_launch_context from './resources/questionnaire_fce/multiple_type_launch_context.json'; -import fce_patient_create from './resources/questionnaire_fce/patient_create.json'; -import fce_patient_edit from './resources/questionnaire_fce/patient_edit.json'; -import fce_phq_2_phq_9 from './resources/questionnaire_fce/phq_2_phq_9.json'; -import fce_physicalexam from './resources/questionnaire_fce/physicalexam.json'; -import fce_practitioner_create from './resources/questionnaire_fce/practitioner_create.json'; -import fce_practitioner_create_structure_map from './resources/questionnaire_fce/practitioner_create_structure_map.json'; -import fce_practitioner_edit from './resources/questionnaire_fce/practitioner_edit.json'; -import fce_practitioner_role_create from './resources/questionnaire_fce/practitioner_role_create.json'; -import fce_public_appointment from './resources/questionnaire_fce/public_appointment.json'; -import fce_review_of_systems from './resources/questionnaire_fce/review_of_systems.json'; -import fce_source_queries from './resources/questionnaire_fce/source_queries.json'; -import fce_vitals from './resources/questionnaire_fce/vitals.json'; -// fhir questionnaire -import fhir_allergies from './resources/questionnaire_fhir/allergies.json'; -import fhir_beverages from './resources/questionnaire_fhir/beverages.json'; -import fhir_choice_answer_option from './resources/questionnaire_fhir/choice_answer_option.json'; -import fhir_consent from './resources/questionnaire_fhir/consent.json'; -import fhir_enable_when from './resources/questionnaire_fhir/enable_when.json'; -import fhir_encounter_create from './resources/questionnaire_fhir/encounter_create.json'; -import fhir_gad_7 from './resources/questionnaire_fhir/gad_7.json'; -import fhir_immunization from './resources/questionnaire_fhir/immunization.json'; -import fhir_medication from './resources/questionnaire_fhir/medication.json'; -import fhir_multiple_type_launch_context from './resources/questionnaire_fhir/multiple_type_launch_context.json'; -import fhir_patient_create from './resources/questionnaire_fhir/patient_create.json'; -import fhir_patient_edit from './resources/questionnaire_fhir/patient_edit.json'; -import fhir_phq_2_phq_9 from './resources/questionnaire_fhir/phq_2_phq_9.json'; -import fhir_physicalexam from './resources/questionnaire_fhir/physicalexam.json'; -import fhir_practitioner_create from './resources/questionnaire_fhir/practitioner_create.json'; -import fhir_practitioner_create_structure_map from './resources/questionnaire_fhir/practitioner_create_structure_map.json'; -import fhir_practitioner_edit from './resources/questionnaire_fhir/practitioner_edit.json'; -import fhir_practitioner_role_create from './resources/questionnaire_fhir/practitioner_role_create.json'; -import fhir_public_appointment from './resources/questionnaire_fhir/public_appointment.json'; -import fhir_review_of_systems from './resources/questionnaire_fhir/review_of_systems.json'; -import fhir_source_queries from './resources/questionnaire_fhir/source_queries.json'; -import fhir_vitals from './resources/questionnaire_fhir/vitals.json'; -// fce questionnaire response -import fce_allergies_inprogress_qr from './resources/questionnaire_response_fce/allergies_inprogress.json'; -import fce_cardiology_qr from './resources/questionnaire_response_fce/cardiology.json'; -import fce_few_answers_qr from './resources/questionnaire_response_fce/few_answers.json'; -import fce_gad_7_qr from './resources/questionnaire_response_fce/gad_7.json'; -import fce_immunization_qr from './resources/questionnaire_response_fce/immunization.json'; -import fce_medication_qr from './resources/questionnaire_response_fce/medication.json'; -import fce_new_appointment_qr from './resources/questionnaire_response_fce/new_appointment.json'; -import fce_patient_qr from './resources/questionnaire_response_fce/patient.json'; -import fce_phq_2_phq_9_qr from './resources/questionnaire_response_fce/phq_2_phq_9.json'; -import fce_physicalexam_qr from './resources/questionnaire_response_fce/physicalexam.json'; -import fce_practitioner_qr from './resources/questionnaire_response_fce/practitioner.json'; -import fce_reference_answer_with_assoc from './resources/questionnaire_response_fce/reference_answer_with_assoc.json'; -import fce_review_of_systems_qr from './resources/questionnaire_response_fce/review_of_systems.json'; -import fce_vitals_qr from './resources/questionnaire_response_fce/vitals.json'; -// fhir questionnaire response -import fhir_allergies_inprogress_qr from './resources/questionnaire_response_fhir/allergies_inprogress.json'; -import fhir_cardiology_qr from './resources/questionnaire_response_fhir/cardiology.json'; -import fhir_few_answers_qr from './resources/questionnaire_response_fhir/few_answers.json'; -import fhir_gad_7_qr from './resources/questionnaire_response_fhir/gad_7.json'; -import fhir_immunization_qr from './resources/questionnaire_response_fhir/immunization.json'; -import fhir_medication_qr from './resources/questionnaire_response_fhir/medication.json'; -import fhir_new_appointment_qr from './resources/questionnaire_response_fhir/new_appointment.json'; -import fhir_patient_qr from './resources/questionnaire_response_fhir/patient.json'; -import fhir_phq_2_phq_9_qr from './resources/questionnaire_response_fhir/phq_2_phq_9.json'; -import fhir_physicalexam_qr from './resources/questionnaire_response_fhir/physicalexam.json'; -import fhir_practitioner_qr from './resources/questionnaire_response_fhir/practitioner.json'; -import fhir_reference_answer_with_assoc from './resources/questionnaire_response_fhir/reference_answer_with_assoc.json'; -import fhir_review_of_systems_qr from './resources/questionnaire_response_fhir/review_of_systems.json'; -import fhir_vitals_qr from './resources/questionnaire_response_fhir/vitals.json'; -import { toFirstClassExtension, fromFirstClassExtension } from '../../converter'; - -function sortExtensionsRecursive(object: any) { - if (typeof object !== 'object' || object === null) { - return object; - } - for (const [key, property] of Object.entries(object)) { - if (Array.isArray(property)) { - if (key === 'extension') { - property.sort((a, b) => (a.url === b.url ? 0 : a.url < b.url ? -1 : 1)); - } - for (const nestedProperty of property) { - sortExtensionsRecursive(nestedProperty); - } - } else { - sortExtensionsRecursive(property); - } - } - return object; -} - -export function sortExtensionsList(object: any) { - return sortExtensionsRecursive(cloneDeep(object)); -} - -describe('Questionanire and QuestionnaireResponses transformation', () => { - test.each([ - [fhir_allergies, fce_allergies], - [fhir_beverages, fce_beverages], - [fhir_choice_answer_option, fce_choice_answer_option], - [fhir_encounter_create, fce_encounter_create], - [fhir_gad_7, fce_gad_7], - [fhir_immunization, fce_immunization], - [fhir_medication, fce_medication], - [fhir_multiple_type_launch_context, fce_multiple_type_launch_context], - [fhir_patient_create, fce_patient_create], - [fhir_patient_edit, fce_patient_edit], - [fhir_phq_2_phq_9, fce_phq_2_phq_9], - [fhir_physicalexam, fce_physicalexam], - [fhir_practitioner_create, fce_practitioner_create], - [fhir_practitioner_edit, fce_practitioner_edit], - [fhir_practitioner_role_create, fce_practitioner_role_create], - [fhir_public_appointment, fce_public_appointment], - [fhir_review_of_systems, fce_review_of_systems], - [fhir_source_queries, fce_source_queries], - [fhir_vitals, fce_vitals], - [fhir_practitioner_create_structure_map, fce_practitioner_create_structure_map], - [fhir_consent, fce_consent], - [fhir_enable_when, fce_enable_when], - ])( - 'Each FHIR Questionnaire should convert to FCE', - async (fhir_questionnaire, fce_questionnaire) => { - expect(toFirstClassExtension(fhir_questionnaire as FHIRQuestionnaire)).toStrictEqual( - fce_questionnaire, - ); - }, - ); - - test.each([ - [fce_allergies, fhir_allergies], - [fce_beverages, fhir_beverages], - [fce_choice_answer_option, fhir_choice_answer_option], - [fce_encounter_create, fhir_encounter_create], - [fce_gad_7, fhir_gad_7], - [fce_immunization, fhir_immunization], - [fce_medication, fhir_medication], - [fce_multiple_type_launch_context, fhir_multiple_type_launch_context], - [fce_patient_create, fhir_patient_create], - [fce_patient_edit, fhir_patient_edit], - [fce_phq_2_phq_9, fhir_phq_2_phq_9], - [fce_physicalexam, fhir_physicalexam], - [fce_practitioner_create, fhir_practitioner_create], - [fce_practitioner_edit, fhir_practitioner_edit], - [fce_practitioner_role_create, fhir_practitioner_role_create], - [fce_public_appointment, fhir_public_appointment], - [fce_review_of_systems, fhir_review_of_systems], - [fce_source_queries, fhir_source_queries], - [fce_vitals, fhir_vitals], - [fce_practitioner_create_structure_map, fhir_practitioner_create_structure_map], - [fce_consent, fhir_consent], - [fce_enable_when, fhir_enable_when], - ])( - 'Each FCE Questionnaire should convert to FHIR', - async (fce_questionnaire, fhir_questionnaire) => { - expect( - sortExtensionsList(fromFirstClassExtension(fce_questionnaire as FCEQuestionnaire)), - ).toStrictEqual(sortExtensionsList(fhir_questionnaire)); - }, - ); - - test.each([ - [fhir_allergies_inprogress_qr, fce_allergies_inprogress_qr], - [fhir_cardiology_qr, fce_cardiology_qr], - [fhir_few_answers_qr, fce_few_answers_qr], - [fhir_gad_7_qr, fce_gad_7_qr], - [fhir_immunization_qr, fce_immunization_qr], - [fhir_medication_qr, fce_medication_qr], - [fhir_new_appointment_qr, fce_new_appointment_qr], - [fhir_patient_qr, fce_patient_qr], - [fhir_phq_2_phq_9_qr, fce_phq_2_phq_9_qr], - [fhir_physicalexam_qr, fce_physicalexam_qr], - [fhir_practitioner_qr, fce_practitioner_qr], - [fhir_review_of_systems_qr, fce_review_of_systems_qr], - [fhir_vitals_qr, fce_vitals_qr], - ])( - 'Each FHIR QuestionnaireResponse should convert to FCE', - async (fhirQuestionnaireResponse, expectedFCE) => { - expect( - toFirstClassExtension(fhirQuestionnaireResponse as FHIRQuestionnaireResponse), - ).toStrictEqual(expectedFCE); - }, - ); - - test.each([ - [fce_allergies_inprogress_qr, fhir_allergies_inprogress_qr], - [fce_cardiology_qr, fhir_cardiology_qr], - [fce_few_answers_qr, fhir_few_answers_qr], - [fce_gad_7_qr, fhir_gad_7_qr], - [fce_immunization_qr, fhir_immunization_qr], - [fce_medication_qr, fhir_medication_qr], - [fce_new_appointment_qr, fhir_new_appointment_qr], - [fce_patient_qr, fhir_patient_qr], - [fce_phq_2_phq_9_qr, fhir_phq_2_phq_9_qr], - [fce_physicalexam_qr, fhir_physicalexam_qr], - [fce_practitioner_qr, fhir_practitioner_qr], - [fce_review_of_systems_qr, fhir_review_of_systems_qr], - [fce_vitals_qr, fhir_vitals_qr], - [fce_reference_answer_with_assoc, fhir_reference_answer_with_assoc], - ])( - 'Each FCE QuestionnaireResponse should convert to FHIR', - async (fceQuestionnaireResponse, expectedFHIR) => { - expect( - fromFirstClassExtension(fceQuestionnaireResponse as FCEQuestionnaireResponse), - ).toStrictEqual(expectedFHIR); - }, - ); -}); diff --git a/sdc-qrf/src/converter/__tests__/resources/questionnaire_fce/allergies.json b/sdc-qrf/src/converter/__tests__/resources/questionnaire_fce/allergies.json deleted file mode 100644 index 34168744..00000000 --- a/sdc-qrf/src/converter/__tests__/resources/questionnaire_fce/allergies.json +++ /dev/null @@ -1,405 +0,0 @@ -{ - "subjectType": ["Encounter", "Patient"], - "meta": { - "profile": ["https://beda.software/beda-emr-questionnaire"], - "lastUpdated": "2023-04-10T03:43:34.792167Z", - "createdAt": "2023-04-05T05:22:35.752466Z", - "versionId": "694" - }, - "launchContext": [ - { - "name": { - "code": "LaunchPatient", - "system": "http://hl7.org/fhir/uv/sdc/CodeSystem/launchContext" - }, - "type": ["Patient"] - }, - { - "name": { - "code": "Author", - "system": "http://hl7.org/fhir/uv/sdc/CodeSystem/launchContext" - }, - "type": ["Resource"] - } - ], - "name": "Allergies", - "item": [ - { - "text": "DateTime", - "type": "dateTime", - "hidden": true, - "linkId": "dateTime", - "initialExpression": { - "language": "text/fhirpath", - "expression": "now()" - } - }, - { - "text": "PatientId", - "type": "string", - "hidden": true, - "linkId": "patientId", - "initialExpression": { - "language": "text/fhirpath", - "expression": "%Patient.id" - } - }, - { - "text": "PatientName", - "type": "string", - "hidden": true, - "linkId": "patientName", - "initialExpression": { - "language": "text/fhirpath", - "expression": "%Patient.name.given[0] + ' ' + %Patient.name.family" - } - }, - { - "text": "Type", - "type": "choice", - "linkId": "type", - "required": true, - "itemControl": { - "coding": [ - { - "code": "inline-choice" - } - ] - }, - "answerOption": [ - { - "value": { - "Coding": { - "code": "418634005", - "system": "http://hl7.org/fhir/allergy-intolerance-category", - "display": "Drug" - } - } - }, - { - "value": { - "Coding": { - "code": "414285001", - "system": "http://hl7.org/fhir/allergy-intolerance-category", - "display": "Food" - } - } - }, - { - "value": { - "Coding": { - "code": "426232007", - "system": "http://hl7.org/fhir/allergy-intolerance-category", - "display": "Environmental" - } - } - } - ] - }, - { - "text": "Reaction", - "type": "choice", - "linkId": "reaction", - "repeats": true, - "itemControl": { - "coding": [ - { - "code": "inline-choice" - } - ] - }, - "answerOption": [ - { - "value": { - "Coding": { - "code": "39579001", - "system": "http://snomed.ct", - "display": "Anaphylaxis" - } - } - }, - { - "value": { - "Coding": { - "code": "25064002", - "system": "http://snomed.ct", - "display": "Headache" - } - } - }, - { - "value": { - "Coding": { - "code": "247472004", - "system": "http://snomed.ct", - "display": "Hives (Wheal)" - } - } - }, - { - "value": { - "Coding": { - "code": "422587007", - "system": "http://snomed.ct", - "display": "Nausea" - } - } - }, - { - "value": { - "Coding": { - "code": "422400008", - "system": "http://snomed.ct", - "display": "Vomiting" - } - } - } - ] - }, - { - "text": "Substance", - "type": "choice", - "linkId": "substance-drug", - "enableWhen": [ - { - "answer": { - "Coding": { - "code": "418634005", - "system": "http://snomed.ct" - } - }, - "operator": "=", - "question": "type" - } - ], - "itemControl": { - "coding": [ - { - "code": "inline-choice" - } - ] - }, - "answerOption": [ - { - "value": { - "Coding": { - "code": "LA26702-3", - "system": "http://loinc.org", - "display": "Aspirin" - } - } - }, - { - "value": { - "Coding": { - "code": "LA30119-4", - "system": "http://loinc.org", - "display": "Iodine" - } - } - }, - { - "value": { - "Coding": { - "code": "LA14348-9", - "system": "http://loinc.org", - "display": "Naproxen, ketoprofen or other non-steroidal" - } - } - }, - { - "value": { - "Coding": { - "code": "LA28487-9", - "system": "http://loinc.org", - "display": "Penicillin" - } - } - }, - { - "value": { - "Coding": { - "code": "LA30118-6", - "system": "http://loinc.org", - "display": "Sulfa drugs" - } - } - } - ] - }, - { - "text": "Substance", - "type": "choice", - "linkId": "substance-food", - "enableWhen": [ - { - "answer": { - "Coding": { - "code": "414285001", - "system": "http://snomed.ct" - } - }, - "operator": "=", - "question": "type" - } - ], - "itemControl": { - "coding": [ - { - "code": "inline-choice" - } - ] - }, - "answerOption": [ - { - "value": { - "Coding": { - "code": "102259006", - "system": "http://snomed.ct", - "display": "Citrus fruit" - } - } - }, - { - "value": { - "Coding": { - "code": "102260001", - "system": "http://snomed.ct", - "display": "Peanut butter" - } - } - }, - { - "value": { - "Coding": { - "code": "102261002", - "system": "http://snomed.ct", - "display": "Strawberry" - } - } - }, - { - "value": { - "Coding": { - "code": "102262009", - "system": "http://snomed.ct", - "display": "Chocolate" - } - } - }, - { - "value": { - "Coding": { - "code": "102263004", - "system": "http://snomed.ct", - "display": "Eggs" - } - } - }, - { - "value": { - "Coding": { - "code": "102264005", - "system": "http://snomed.ct", - "display": "Cheese" - } - } - } - ] - }, - { - "text": "Substance", - "type": "choice", - "linkId": "substance-environmental", - "enableWhen": [ - { - "answer": { - "Coding": { - "code": "426232007", - "system": "http://snomed.ct" - } - }, - "operator": "=", - "question": "type" - } - ], - "itemControl": { - "coding": [ - { - "code": "inline-choice" - } - ] - }, - "answerOption": [ - { - "value": { - "Coding": { - "code": "111088007", - "system": "http://snomed.ct", - "display": "Latex" - } - } - }, - { - "value": { - "Coding": { - "code": "256259004", - "system": "http://snomed.ct", - "display": "Pollen" - } - } - }, - { - "value": { - "Coding": { - "code": "256277009", - "system": "http://snomed.ct", - "display": "Grass pollen" - } - } - }, - { - "value": { - "Coding": { - "code": "256417003", - "system": "http://snomed.ct", - "display": "Horse dander" - } - } - } - ] - }, - { - "text": "Notes", - "type": "string", - "linkId": "notes" - }, - { - "text": "Active", - "type": "string", - "hidden": true, - "linkId": "status", - "initial": [ - { - "value": { - "Coding": { - "code": "active", - "system": "http://terminology.hl7.org/ValueSet/allergyintolerance-clinical", - "display": "Active" - } - } - } - ] - } - ], - "mapping": [ - { - "id": "allergy-extract", - "resourceType": "Mapping" - } - ], - "resourceType": "Questionnaire", - "status": "active", - "id": "allergies", - "url": "https://aidbox.emr.beda.software/ui/console#/entities/Questionnaire/allergies" -} diff --git a/sdc-qrf/src/converter/__tests__/resources/questionnaire_fce/beverages.json b/sdc-qrf/src/converter/__tests__/resources/questionnaire_fce/beverages.json deleted file mode 100644 index 53f3ce65..00000000 --- a/sdc-qrf/src/converter/__tests__/resources/questionnaire_fce/beverages.json +++ /dev/null @@ -1,72 +0,0 @@ -{ - "url": "https://aidbox.emr.beda.software/ui/console#/entities/Questionnaire/baverages", - "item": [ - { - "linkId": "slider", - "itemControl": { - "coding": [ - { - "code": "slider" - } - ] - }, - "start": 1, - "type": "decimal", - "stop": 20, - "helpText": "How many beverages you are consuming per day?", - "stopLabel": "20+", - "sliderStepValue": 2, - "text": "Frequency per week" - }, - { - "text": "Beverage", - "type": "choice", - "linkId": "beverage-type", - "itemControl": { - "coding": [ - { - "code": "solid-radio-button" - } - ] - }, - "answerOption": [ - { - "value": { - "Coding": { - "code": "beer", - "display": "Beer" - } - } - }, - { - "value": { - "Coding": { - "code": "wine", - "display": "Wine" - } - } - }, - { - "value": { - "Coding": { - "code": "none", - "display": "None" - } - } - } - ], - "adjustLastToRight": true - } - ], - "meta": { - "profile": ["https://beda.software/beda-emr-questionnaire"], - "lastUpdated": "2023-04-10T03:43:34.792167Z", - "createdAt": "2023-04-05T05:22:35.752466Z", - "versionId": "694" - }, - "name": "Beverages", - "status": "draft", - "subjectType": ["Patient"], - "id": "beverages", - "resourceType": "Questionnaire" -} diff --git a/sdc-qrf/src/converter/__tests__/resources/questionnaire_fce/choice_answer_option.json b/sdc-qrf/src/converter/__tests__/resources/questionnaire_fce/choice_answer_option.json deleted file mode 100644 index 3eaa5b08..00000000 --- a/sdc-qrf/src/converter/__tests__/resources/questionnaire_fce/choice_answer_option.json +++ /dev/null @@ -1,53 +0,0 @@ -{ - "item": [ - { - "text": "What is your favorite color?", - "type": "choice", - "linkId": "1", - "answerOption": [ - { - "value": { - "Coding": { - "code": "red", - "system": "http://example.org/colors", - "display": "Red" - } - } - }, - { - "value": { - "Coding": { - "code": "blue", - "system": "http://example.org/colors", - "display": "Blue" - } - } - }, - { - "value": { - "Reference": { - "id": "123", - "resourceType": "Color", - "display": "Other" - } - } - }, - { - "value": { - "string": "I don't have a favorite color" - } - } - ] - } - ], - "status": "draft", - "subjectType": ["Patient"], - "id": "example", - "resourceType": "Questionnaire", - "meta": { - "profile": ["https://beda.software/beda-emr-questionnaire"], - "lastUpdated": "2023-04-24T00:09:09.518780Z", - "createdAt": "2023-04-24T00:09:09.518780Z", - "versionId": "205" - } -} diff --git a/sdc-qrf/src/converter/__tests__/resources/questionnaire_fce/consent.json b/sdc-qrf/src/converter/__tests__/resources/questionnaire_fce/consent.json deleted file mode 100644 index 2dc880f1..00000000 --- a/sdc-qrf/src/converter/__tests__/resources/questionnaire_fce/consent.json +++ /dev/null @@ -1,86 +0,0 @@ -{ - "subjectType": ["Encounter", "Patient"], - "meta": { - "profile": ["https://beda.software/beda-emr-questionnaire"], - "lastUpdated": "2023-05-04T06:32:48.956795Z", - "createdAt": "2023-05-04T05:27:07.639041Z", - "versionId": "1087" - }, - "name": "Consent", - "item": [ - { - "text": "Practitioner", - "type": "reference", - "linkId": "practitioner", - "repeats": false, - "required": true, - "choiceColumn": [ - { - "path": "name.given.first() + ' ' + name.family", - "forDisplay": true - } - ], - "answerExpression": { - "language": "application/x-fhir-query", - "expression": "Practitioner" - }, - "referenceResource": ["Practitioner"] - }, - { - "text": "Service", - "type": "reference", - "linkId": "service", - "repeats": false, - "required": true, - "choiceColumn": [ - { - "path": "name", - "forDisplay": true - } - ], - "answerExpression": { - "language": "application/x-fhir-query", - "expression": "Endpoint?identifier=https://fhir.emr.beda.software/CodeSystem/consent-subject|&status=active" - }, - "referenceResource": ["Endpoint"] - }, - { - "text": "Provision", - "type": "choice", - "linkId": "provision", - "repeats": false, - "required": true, - "answerOption": [ - { - "value": { - "Coding": { - "code": "deny", - "system": "http://hl7.org/fhir/consent-provision-type", - "display": "Deny" - } - } - }, - { - "value": { - "Coding": { - "code": "permit", - "system": "http://hl7.org/fhir/consent-provision-type", - "display": "Permit" - } - } - } - ] - } - ], - "mapping": [ - { - "id": "consent-extract", - "resourceType": "Mapping" - } - ], - "resourceType": "Questionnaire", - "title": "Sign-off Consent", - "status": "active", - "id": "consent", - "url": "https://aidbox.emr.beda.software/ui/console#/entities/Questionnaire/consent" -} diff --git a/sdc-qrf/src/converter/__tests__/resources/questionnaire_fce/enable_when.json b/sdc-qrf/src/converter/__tests__/resources/questionnaire_fce/enable_when.json deleted file mode 100644 index 9affdd50..00000000 --- a/sdc-qrf/src/converter/__tests__/resources/questionnaire_fce/enable_when.json +++ /dev/null @@ -1,103 +0,0 @@ -{ - "item": [ - { - "text": "Do you smoke?", - "type": "choice", - "linkId": "1", - "enableWhen": [ - { - "answer": { - "boolean": true - }, - "operator": "exists", - "question": "2" - }, - { - "answer": { - "decimal": 10 - }, - "operator": "=", - "question": "3" - }, - { - "answer": { - "integer": 5 - }, - "operator": "=", - "question": "4" - }, - { - "answer": { - "date": "2023-05-07" - }, - "operator": "=", - "question": "5" - }, - { - "answer": { - "dateTime": "2023-04-06T02:48:16+00:00" - }, - "operator": "=", - "question": "6" - }, - { - "answer": { - "time": "10:30:00" - }, - "operator": "=", - "question": "7" - }, - { - "answer": { - "string": "example" - }, - "operator": "=", - "question": "8" - }, - { - "answer": { - "Coding": { - "code": "123456", - "system": "http://snomed.info/sct" - } - }, - "operator": "=", - "question": "9" - }, - { - "answer": { - "Quantity": { - "code": "mg", - "unit": "mg", - "value": 5, - "system": "http://unitsofmeasure.org" - } - }, - "operator": "=", - "question": "10" - }, - { - "answer": { - "Reference": { - "id": "example", - "display": "example patient", - "resourceType": "Patient" - } - }, - "operator": "=", - "question": "11" - } - ] - } - ], - "status": "active", - "subjectType": ["Patient"], - "id": "example", - "resourceType": "Questionnaire", - "meta": { - "profile": ["https://beda.software/beda-emr-questionnaire"], - "lastUpdated": "2023-05-07T09:04:40.566686Z", - "createdAt": "2023-05-07T09:04:40.566686Z", - "versionId": "459" - } -} diff --git a/sdc-qrf/src/converter/__tests__/resources/questionnaire_fce/encounter_create.json b/sdc-qrf/src/converter/__tests__/resources/questionnaire_fce/encounter_create.json deleted file mode 100644 index ce558c13..00000000 --- a/sdc-qrf/src/converter/__tests__/resources/questionnaire_fce/encounter_create.json +++ /dev/null @@ -1,126 +0,0 @@ -{ - "meta": { - "profile": ["https://beda.software/beda-emr-questionnaire"], - "lastUpdated": "2023-04-10T03:43:34.792167Z", - "createdAt": "2023-04-05T05:22:35.752466Z", - "versionId": "694" - }, - "launchContext": [ - { - "name": { - "code": "Patient", - "system": "http://hl7.org/fhir/uv/sdc/CodeSystem/launchContext" - }, - "type": ["Patient"] - } - ], - "name": "encounter-create", - "item": [ - { - "text": "PatientId", - "type": "string", - "hidden": true, - "linkId": "patientId", - "initialExpression": { - "language": "text/fhirpath", - "expression": "%Patient.id" - } - }, - { - "text": "PatientName", - "type": "string", - "linkId": "patientName", - "readOnly": true, - "initialExpression": { - "language": "text/fhirpath", - "expression": "%Patient.name.given[0] + ' ' + %Patient.name.family" - } - }, - { - "text": "Practitioner", - "type": "reference", - "linkId": "practitioner-role", - "required": true, - "choiceColumn": [ - { - "path": "practitioner.resource.name.given.first() + ' ' + practitioner.resource.name.family + ' - ' + specialty.first().coding.display", - "forDisplay": true - } - ], - "answerExpression": { - "language": "application/x-fhir-query", - "expression": "PractitionerRole?_assoc=practitioner" - }, - "referenceResource": ["PractitionerRole"] - }, - { - "text": "Service", - "type": "choice", - "linkId": "service", - "repeats": false, - "required": true, - "answerOption": [ - { - "value": { - "Coding": { - "code": "consultation", - "system": "http://fhir.org/guides/argonaut-scheduling/CodeSystem/visit-type", - "display": "The first appointment" - } - } - }, - { - "value": { - "Coding": { - "code": "follow-up", - "system": "http://fhir.org/guides/argonaut-scheduling/CodeSystem/visit-type", - "display": "A follow up visit" - } - } - } - ] - }, - { - "text": "Date", - "type": "date", - "linkId": "date" - }, - { - "item": [ - { - "type": "time", - "linkId": "start-time" - }, - { - "type": "time", - "linkId": "end-time" - } - ], - "text": "Time", - "type": "group", - "linkId": "Time period", - "itemControl": { - "coding": [ - { - "code": "time-range-picker" - } - ] - } - } - ], - "mapping": [ - { - "id": "encounter-create-extract", - "resourceType": "Mapping" - }, - { - "id": "test-mapper", - "resourceType": "Mapping" - } - ], - "resourceType": "Questionnaire", - "title": "Encounter create", - "status": "active", - "id": "encounter-create", - "url": "https://aidbox.emr.beda.software/ui/console#/entities/Questionnaire/encounter-create" -} diff --git a/sdc-qrf/src/converter/__tests__/resources/questionnaire_fce/gad_7.json b/sdc-qrf/src/converter/__tests__/resources/questionnaire_fce/gad_7.json deleted file mode 100644 index 091b47bb..00000000 --- a/sdc-qrf/src/converter/__tests__/resources/questionnaire_fce/gad_7.json +++ /dev/null @@ -1,459 +0,0 @@ -{ - "subjectType": [ - "Encounter", - "Patient" - ], - "meta": { - "profile": [ - "https://beda.software/beda-emr-questionnaire" - ], - "lastUpdated": "2023-04-10T03:43:34.792167Z", - "createdAt": "2023-04-05T05:22:35.752466Z", - "versionId": "694" - }, - "launchContext": [ - { - "name": { - "code": "Patient", - "system": "http://hl7.org/fhir/uv/sdc/CodeSystem/launchContext" - }, - "type": [ - "Patient" - ] - }, - { - "name": { - "code": "Author", - "system": "http://hl7.org/fhir/uv/sdc/CodeSystem/launchContext" - }, - "type": [ - "Resource" - ] - } - ], - "name": "GAD-7", - "item": [ - { - "text": "DateTime", - "type": "dateTime", - "hidden": true, - "linkId": "dateTime", - "initialExpression": { - "language": "text/fhirpath", - "expression": "now()" - } - }, - { - "text": "PatientId", - "type": "string", - "hidden": true, - "linkId": "patientId", - "initialExpression": { - "language": "text/fhirpath", - "expression": "%Patient.id" - } - }, - { - "text": "PatientName", - "type": "string", - "hidden": true, - "linkId": "patientName", - "initialExpression": { - "language": "text/fhirpath", - "expression": "%Patient.name.given[0] + ' ' + %Patient.name.family" - } - }, - { - "item": [ - { - "text": "Feeling nervous, anxious, or on edge", - "type": "choice", - "linkId": "69725-0", - "required": true, - "itemControl": { - "coding": [ - { - "code": "inline-choice" - } - ] - }, - "answerOption": [ - { - "value": { - "Coding": { - "code": "LA6568-5", - "system": "http://loinc.org", - "display": "Not at all" - } - } - }, - { - "value": { - "Coding": { - "code": "LA6569-3", - "system": "http://loinc.org", - "display": "Several days" - } - } - }, - { - "value": { - "Coding": { - "code": "LA6570-1", - "system": "http://loinc.org", - "display": "More than half the days" - } - } - }, - { - "value": { - "Coding": { - "code": "LA6571-9", - "system": "http://loinc.org", - "display": "Nearly every day" - } - } - } - ] - }, - { - "text": "Not being able to stop or control worrying", - "type": "choice", - "linkId": "68509-9", - "required": true, - "itemControl": { - "coding": [ - { - "code": "inline-choice" - } - ] - }, - "answerOption": [ - { - "value": { - "Coding": { - "code": "LA6568-5", - "system": "http://loinc.org", - "display": "Not at all" - } - } - }, - { - "value": { - "Coding": { - "code": "LA6569-3", - "system": "http://loinc.org", - "display": "Several days" - } - } - }, - { - "value": { - "Coding": { - "code": "LA6570-1", - "system": "http://loinc.org", - "display": "More than half the days" - } - } - }, - { - "value": { - "Coding": { - "code": "LA6571-9", - "system": "http://loinc.org", - "display": "Nearly every day" - } - } - } - ] - }, - { - "text": "Worrying too much about different things", - "type": "choice", - "linkId": "69733-4", - "required": true, - "itemControl": { - "coding": [ - { - "code": "inline-choice" - } - ] - }, - "answerOption": [ - { - "value": { - "Coding": { - "code": "LA6568-5", - "system": "http://loinc.org", - "display": "Not at all" - } - } - }, - { - "value": { - "Coding": { - "code": "LA6569-3", - "system": "http://loinc.org", - "display": "Several days" - } - } - }, - { - "value": { - "Coding": { - "code": "LA6570-1", - "system": "http://loinc.org", - "display": "More than half the days" - } - } - }, - { - "value": { - "Coding": { - "code": "LA6571-9", - "system": "http://loinc.org", - "display": "Nearly every day" - } - } - } - ] - }, - { - "text": "Trouble relaxing", - "type": "choice", - "linkId": "69734-2", - "required": true, - "itemControl": { - "coding": [ - { - "code": "inline-choice" - } - ] - }, - "answerOption": [ - { - "value": { - "Coding": { - "code": "LA6568-5", - "system": "http://loinc.org", - "display": "Not at all" - } - } - }, - { - "value": { - "Coding": { - "code": "LA6569-3", - "system": "http://loinc.org", - "display": "Several days" - } - } - }, - { - "value": { - "Coding": { - "code": "LA6570-1", - "system": "http://loinc.org", - "display": "More than half the days" - } - } - }, - { - "value": { - "Coding": { - "code": "LA6571-9", - "system": "http://loinc.org", - "display": "Nearly every day" - } - } - } - ] - }, - { - "text": "Being so restless that it is hard to sit still", - "type": "choice", - "linkId": "69735-9", - "required": true, - "itemControl": { - "coding": [ - { - "code": "inline-choice" - } - ] - }, - "answerOption": [ - { - "value": { - "Coding": { - "code": "LA6568-5", - "system": "http://loinc.org", - "display": "Not at all" - } - } - }, - { - "value": { - "Coding": { - "code": "LA6569-3", - "system": "http://loinc.org", - "display": "Several days" - } - } - }, - { - "value": { - "Coding": { - "code": "LA6570-1", - "system": "http://loinc.org", - "display": "More than half the days" - } - } - }, - { - "value": { - "Coding": { - "code": "LA6571-9", - "system": "http://loinc.org", - "display": "Nearly every day" - } - } - } - ] - }, - { - "text": "Becoming easily annoyed or irritable", - "type": "choice", - "linkId": "69689-8", - "required": true, - "itemControl": { - "coding": [ - { - "code": "inline-choice" - } - ] - }, - "answerOption": [ - { - "value": { - "Coding": { - "code": "LA6568-5", - "system": "http://loinc.org", - "display": "Not at all" - } - } - }, - { - "value": { - "Coding": { - "code": "LA6569-3", - "system": "http://loinc.org", - "display": "Several days" - } - } - }, - { - "value": { - "Coding": { - "code": "LA6570-1", - "system": "http://loinc.org", - "display": "More than half the days" - } - } - }, - { - "value": { - "Coding": { - "code": "LA6571-9", - "system": "http://loinc.org", - "display": "Nearly every day" - } - } - } - ] - }, - { - "text": "Feeling afraid, as if something awful might happen", - "type": "choice", - "linkId": "69736-7", - "required": true, - "itemControl": { - "coding": [ - { - "code": "inline-choice" - } - ] - }, - "answerOption": [ - { - "value": { - "Coding": { - "code": "LA6568-5", - "system": "http://loinc.org", - "display": "Not at all" - } - } - }, - { - "value": { - "Coding": { - "code": "LA6569-3", - "system": "http://loinc.org", - "display": "Several days" - } - } - }, - { - "value": { - "Coding": { - "code": "LA6570-1", - "system": "http://loinc.org", - "display": "More than half the days" - } - } - }, - { - "value": { - "Coding": { - "code": "LA6571-9", - "system": "http://loinc.org", - "display": "Nearly every day" - } - } - } - ] - }, - { - "text": "GAD-7 Anxiety Severity Score", - "type": "integer", - "linkId": "anxiety-score", - "readOnly": true, - "required": true, - "itemControl": { - "coding": [ - { - "code": "anxiety-score" - } - ] - }, - "calculatedExpression": { - "language": "text/fhirpath", - "expression": "%QuestionnaireResponse.item.item.answer.children().children().where(code='LA6569-3').count() + %QuestionnaireResponse.item.item.answer.children().children().where(code='LA6570-1').count() * 2 + %QuestionnaireResponse.item.item.answer.children().children().where(code='LA6571-9').count() * 3" - } - } - ], - "text": "Over the last two weeks, how often have you been bothered by the following problems?", - "type": "group", - "linkId": "gad-7" - } - ], - "mapping": [ - { - "id": "gad-7-extract", - "resourceType": "Mapping" - } - ], - "resourceType": "Questionnaire", - "status": "active", - "id": "gad-7", - "url": "https://aidbox.emr.beda.software/ui/console#/entities/Questionnaire/gad7" -} \ No newline at end of file diff --git a/sdc-qrf/src/converter/__tests__/resources/questionnaire_fce/immunization.json b/sdc-qrf/src/converter/__tests__/resources/questionnaire_fce/immunization.json deleted file mode 100644 index f361c3b0..00000000 --- a/sdc-qrf/src/converter/__tests__/resources/questionnaire_fce/immunization.json +++ /dev/null @@ -1,182 +0,0 @@ -{ - "subjectType": [ - "Encounter", - "Patient" - ], - "meta": { - "profile": [ - "https://beda.software/beda-emr-questionnaire" - ], - "lastUpdated": "2023-04-10T03:43:34.792167Z", - "createdAt": "2023-04-05T05:22:35.752466Z", - "versionId": "694" - }, - "launchContext": [ - { - "name": { - "code": "Patient", - "system": "http://hl7.org/fhir/uv/sdc/CodeSystem/launchContext" - }, - "type": [ - "Patient" - ] - }, - { - "name": { - "code": "Author", - "system": "http://hl7.org/fhir/uv/sdc/CodeSystem/launchContext" - }, - "type": [ - "Resource" - ] - } - ], - "name": "Immunization", - "item": [ - { - "text": "DateTime", - "type": "dateTime", - "hidden": true, - "linkId": "dateTime", - "initialExpression": { - "language": "text/fhirpath", - "expression": "now()" - } - }, - { - "text": "EncounterId", - "type": "string", - "hidden": true, - "linkId": "encounterId", - "initialExpression": { - "language": "text/fhirpath", - "expression": "%Encounter.id" - } - }, - { - "text": "PatientId", - "type": "string", - "hidden": true, - "linkId": "patientId", - "required": true, - "initialExpression": { - "language": "text/fhirpath", - "expression": "%Patient.id" - } - }, - { - "text": "PatientName", - "type": "string", - "hidden": true, - "linkId": "patientName", - "initialExpression": { - "language": "text/fhirpath", - "expression": "%Patient.name.given[0] + ' ' + %Patient.name.family" - } - }, - { - "text": "Vaccine", - "type": "choice", - "linkId": "vaccine-code", - "required": true, - "answerOption": [ - { - "value": { - "Coding": { - "code": "143", - "system": "http://hl7.org/fhir/sid/cvx", - "display": "Adenovirus types 4 and 7" - } - } - }, - { - "value": { - "Coding": { - "code": "24", - "system": "http://hl7.org/fhir/sid/cvx", - "display": "anthrax" - } - } - }, - { - "value": { - "Coding": { - "code": "173", - "system": "http://hl7.org/fhir/sid/cvx", - "display": "cholera, BivWC" - } - } - }, - { - "value": { - "Coding": { - "code": "56", - "system": "http://hl7.org/fhir/sid/cvx", - "display": "dengue fever" - } - } - }, - { - "value": { - "Coding": { - "code": "12", - "system": "http://hl7.org/fhir/sid/cvx", - "display": "diphtheria antitoxin" - } - } - }, - { - "value": { - "Coding": { - "code": "52", - "system": "http://hl7.org/fhir/sid/cvx", - "display": "Hep A, adult" - } - } - }, - { - "value": { - "Coding": { - "code": "58", - "system": "http://hl7.org/fhir/sid/cvx", - "display": "Hep C" - } - } - }, - { - "value": { - "Coding": { - "code": "60", - "system": "http://hl7.org/fhir/sid/cvx", - "display": "herpes simplex 2" - } - } - }, - { - "value": { - "Coding": { - "code": "61", - "system": "http://hl7.org/fhir/sid/cvx", - "display": "HIV" - } - } - } - ] - }, - { - "text": "Date of injection", - "type": "date", - "linkId": "date-of-injection" - } - ], - "mapping": [ - { - "id": "immunization-extract", - "resourceType": "Mapping" - } - ], - "resourceType": "Questionnaire", - "status": "active", - "id": "immunization", - "url": "https://aidbox.emr.beda.software/ui/console#/entities/Questionnaire/immunization" -} \ No newline at end of file diff --git a/sdc-qrf/src/converter/__tests__/resources/questionnaire_fce/medication.json b/sdc-qrf/src/converter/__tests__/resources/questionnaire_fce/medication.json deleted file mode 100644 index c9cb6e61..00000000 --- a/sdc-qrf/src/converter/__tests__/resources/questionnaire_fce/medication.json +++ /dev/null @@ -1,189 +0,0 @@ -{ - "subjectType": ["Encounter", "Patient"], - "meta": { - "profile": ["https://beda.software/beda-emr-questionnaire"], - "lastUpdated": "2023-04-10T03:43:34.792167Z", - "createdAt": "2023-04-05T05:22:35.752466Z", - "versionId": "694" - }, - "launchContext": [ - { - "name": { - "code": "Patient", - "system": "http://hl7.org/fhir/uv/sdc/CodeSystem/launchContext" - }, - "type": ["Patient"] - }, - { - "name": { - "code": "Author", - "system": "http://hl7.org/fhir/uv/sdc/CodeSystem/launchContext" - }, - "type": ["Resource"] - } - ], - "name": "Medication", - "item": [ - { - "text": "DateTime", - "type": "dateTime", - "hidden": true, - "linkId": "dateTime", - "initialExpression": { - "language": "text/fhirpath", - "expression": "now()" - } - }, - { - "text": "EncounterId", - "type": "string", - "hidden": true, - "linkId": "encounterId", - "initialExpression": { - "language": "text/fhirpath", - "expression": "%Encounter.id" - } - }, - { - "text": "PatientId", - "type": "string", - "hidden": true, - "linkId": "patientId", - "required": true, - "initialExpression": { - "language": "text/fhirpath", - "expression": "%Patient.id" - } - }, - { - "text": "PatientName", - "type": "string", - "hidden": true, - "linkId": "patientName", - "initialExpression": { - "language": "text/fhirpath", - "expression": "%Patient.name.given[0] + ' ' + %Patient.name.family" - } - }, - { - "text": "Medication name", - "type": "choice", - "linkId": "medication", - "required": true, - "answerOption": [ - { - "value": { - "Coding": { - "code": "261000", - "system": "http://snomed.info/sct", - "display": "Codeine phosphate" - } - } - }, - { - "value": { - "Coding": { - "code": "2336001", - "system": "http://snomed.info/sct", - "display": "Fibrinogen Tokyo II" - } - } - }, - { - "value": { - "Coding": { - "code": "363000", - "system": "http://snomed.info/sct", - "display": "Fibrinogen San Juan" - } - } - }, - { - "value": { - "Coding": { - "code": "519005", - "system": "http://snomed.info/sct", - "display": "Free protein S" - } - } - }, - { - "value": { - "Coding": { - "code": "585007", - "system": "http://snomed.info/sct", - "display": "SP - Substance P" - } - } - }, - { - "value": { - "Coding": { - "code": "693002", - "system": "http://snomed.info/sct", - "display": "Trichothecene" - } - } - }, - { - "value": { - "Coding": { - "code": "698006", - "system": "http://snomed.info/sct", - "display": "Erythromycin lactobionate" - } - } - }, - { - "value": { - "Coding": { - "code": "699003", - "system": "http://snomed.info/sct", - "display": "Coal tar extract" - } - } - }, - { - "value": { - "Coding": { - "code": "747006", - "system": "http://snomed.info/sct", - "display": "Oxamniquine" - } - } - } - ] - }, - { - "text": "Dosage", - "type": "string", - "linkId": "dosage", - "required": true - }, - { - "text": "Start Date", - "type": "date", - "linkId": "start-date" - }, - { - "text": "Stop Date", - "type": "date", - "linkId": "stop-date" - }, - { - "text": "Notes", - "type": "string", - "linkId": "notes" - } - ], - "mapping": [ - { - "id": "medication-statement-extract", - "resourceType": "Mapping" - } - ], - "resourceType": "Questionnaire", - "status": "active", - "id": "medication", - "url": "https://aidbox.emr.beda.software/ui/console#/entities/Questionnaire/medication" -} diff --git a/sdc-qrf/src/converter/__tests__/resources/questionnaire_fce/multiple_type_launch_context.json b/sdc-qrf/src/converter/__tests__/resources/questionnaire_fce/multiple_type_launch_context.json deleted file mode 100644 index eb116f75..00000000 --- a/sdc-qrf/src/converter/__tests__/resources/questionnaire_fce/multiple_type_launch_context.json +++ /dev/null @@ -1,406 +0,0 @@ -{ - "subjectType": [ - "Encounter", - "Patient" - ], - "meta": { - "profile": [ - "https://beda.software/beda-emr-questionnaire" - ], - "lastUpdated": "2023-04-10T03:43:34.792167Z", - "createdAt": "2023-04-05T05:22:35.752466Z", - "versionId": "694" - }, - "launchContext": [ - { - "name": { - "code": "LaunchPatient", - "system": "http://hl7.org/fhir/uv/sdc/CodeSystem/launchContext" - }, - "type": [ - "Patient", - "Resource" - ] - } - ], - "name": "Allergies", - "item": [ - { - "text": "DateTime", - "type": "dateTime", - "hidden": true, - "linkId": "dateTime", - "initialExpression": { - "language": "text/fhirpath", - "expression": "now()" - } - }, - { - "text": "PatientId", - "type": "string", - "hidden": true, - "linkId": "patientId", - "initialExpression": { - "language": "text/fhirpath", - "expression": "%Patient.id" - } - }, - { - "text": "PatientName", - "type": "string", - "hidden": true, - "linkId": "patientName", - "initialExpression": { - "language": "text/fhirpath", - "expression": "%Patient.name.given[0] + ' ' + %Patient.name.family" - } - }, - { - "text": "Type", - "type": "choice", - "linkId": "type", - "required": true, - "itemControl": { - "coding": [ - { - "code": "inline-choice" - } - ] - }, - "answerOption": [ - { - "value": { - "Coding": { - "code": "418634005", - "system": "http://hl7.org/fhir/allergy-intolerance-category", - "display": "Drug" - } - } - }, - { - "value": { - "Coding": { - "code": "414285001", - "system": "http://hl7.org/fhir/allergy-intolerance-category", - "display": "Food" - } - } - }, - { - "value": { - "Coding": { - "code": "426232007", - "system": "http://hl7.org/fhir/allergy-intolerance-category", - "display": "Environmental" - } - } - } - ] - }, - { - "text": "Reaction", - "type": "choice", - "linkId": "reaction", - "repeats": true, - "itemControl": { - "coding": [ - { - "code": "inline-choice" - } - ] - }, - "answerOption": [ - { - "value": { - "Coding": { - "code": "39579001", - "system": "http://snomed.ct", - "display": "Anaphylaxis" - } - } - }, - { - "value": { - "Coding": { - "code": "25064002", - "system": "http://snomed.ct", - "display": "Headache" - } - } - }, - { - "value": { - "Coding": { - "code": "247472004", - "system": "http://snomed.ct", - "display": "Hives (Wheal)" - } - } - }, - { - "value": { - "Coding": { - "code": "422587007", - "system": "http://snomed.ct", - "display": "Nausea" - } - } - }, - { - "value": { - "Coding": { - "code": "422400008", - "system": "http://snomed.ct", - "display": "Vomiting" - } - } - } - ] - }, - { - "text": "Substance", - "type": "choice", - "linkId": "substance-drug", - "enableWhen": [ - { - "answer": { - "Coding": { - "code": "418634005", - "system": "http://snomed.ct" - } - }, - "operator": "=", - "question": "type" - } - ], - "itemControl": { - "coding": [ - { - "code": "inline-choice" - } - ] - }, - "answerOption": [ - { - "value": { - "Coding": { - "code": "LA26702-3", - "system": "http://loinc.org", - "display": "Aspirin" - } - } - }, - { - "value": { - "Coding": { - "code": "LA30119-4", - "system": "http://loinc.org", - "display": "Iodine" - } - } - }, - { - "value": { - "Coding": { - "code": "LA14348-9", - "system": "http://loinc.org", - "display": "Naproxen, ketoprofen or other non-steroidal" - } - } - }, - { - "value": { - "Coding": { - "code": "LA28487-9", - "system": "http://loinc.org", - "display": "Penicillin" - } - } - }, - { - "value": { - "Coding": { - "code": "LA30118-6", - "system": "http://loinc.org", - "display": "Sulfa drugs" - } - } - } - ] - }, - { - "text": "Substance", - "type": "choice", - "linkId": "substance-food", - "enableWhen": [ - { - "answer": { - "Coding": { - "code": "414285001", - "system": "http://snomed.ct" - } - }, - "operator": "=", - "question": "type" - } - ], - "itemControl": { - "coding": [ - { - "code": "inline-choice" - } - ] - }, - "answerOption": [ - { - "value": { - "Coding": { - "code": "102259006", - "system": "http://snomed.ct", - "display": "Citrus fruit" - } - } - }, - { - "value": { - "Coding": { - "code": "102260001", - "system": "http://snomed.ct", - "display": "Peanut butter" - } - } - }, - { - "value": { - "Coding": { - "code": "102261002", - "system": "http://snomed.ct", - "display": "Strawberry" - } - } - }, - { - "value": { - "Coding": { - "code": "102262009", - "system": "http://snomed.ct", - "display": "Chocolate" - } - } - }, - { - "value": { - "Coding": { - "code": "102263004", - "system": "http://snomed.ct", - "display": "Eggs" - } - } - }, - { - "value": { - "Coding": { - "code": "102264005", - "system": "http://snomed.ct", - "display": "Cheese" - } - } - } - ] - }, - { - "text": "Substance", - "type": "choice", - "linkId": "substance-environmental", - "enableWhen": [ - { - "answer": { - "Coding": { - "code": "426232007", - "system": "http://snomed.ct" - } - }, - "operator": "=", - "question": "type" - } - ], - "itemControl": { - "coding": [ - { - "code": "inline-choice" - } - ] - }, - "answerOption": [ - { - "value": { - "Coding": { - "code": "111088007", - "system": "http://snomed.ct", - "display": "Latex" - } - } - }, - { - "value": { - "Coding": { - "code": "256259004", - "system": "http://snomed.ct", - "display": "Pollen" - } - } - }, - { - "value": { - "Coding": { - "code": "256277009", - "system": "http://snomed.ct", - "display": "Grass pollen" - } - } - }, - { - "value": { - "Coding": { - "code": "256417003", - "system": "http://snomed.ct", - "display": "Horse dander" - } - } - } - ] - }, - { - "text": "Notes", - "type": "string", - "linkId": "notes" - }, - { - "text": "Active", - "type": "string", - "hidden": true, - "linkId": "status", - "initial": [ - { - "value": { - "Coding": { - "code": "active", - "system": "http://terminology.hl7.org/ValueSet/allergyintolerance-clinical", - "display": "Active" - } - } - } - ] - } - ], - "mapping": [ - { - "id": "allergy-extract", - "resourceType": "Mapping" - } - ], - "resourceType": "Questionnaire", - "status": "active", - "id": "allergies", - "url": "https://aidbox.emr.beda.software/ui/console#/entities/Questionnaire/allergies" -} \ No newline at end of file diff --git a/sdc-qrf/src/converter/__tests__/resources/questionnaire_fce/patient_create.json b/sdc-qrf/src/converter/__tests__/resources/questionnaire_fce/patient_create.json deleted file mode 100644 index 001f62a5..00000000 --- a/sdc-qrf/src/converter/__tests__/resources/questionnaire_fce/patient_create.json +++ /dev/null @@ -1,84 +0,0 @@ -{ - "meta": { - "profile": ["https://beda.software/beda-emr-questionnaire"], - "lastUpdated": "2023-04-10T03:43:34.792167Z", - "createdAt": "2023-04-05T05:22:35.752466Z", - "versionId": "694" - }, - "name": "patient-create", - "item": [ - { - "text": "patientId", - "type": "string", - "hidden": true, - "linkId": "patient-id" - }, - { - "text": "Last name", - "type": "string", - "linkId": "last-name", - "required": true - }, - { - "text": "First name", - "type": "string", - "linkId": "first-name", - "required": true - }, - { - "text": "Middle name", - "type": "string", - "linkId": "middle-name" - }, - { - "text": "Birth date", - "type": "date", - "linkId": "birth-date" - }, - { - "text": "Gender", - "type": "choice", - "linkId": "gender", - "answerOption": [ - { - "value": { - "string": "male" - } - }, - { - "value": { - "string": "female" - } - } - ] - }, - { - "text": "SSN", - "type": "string", - "linkId": "ssn" - }, - { - "text": "Phone number", - "type": "string", - "linkId": "mobile", - "itemControl": { - "coding": [ - { - "code": "phoneWidget" - } - ] - } - } - ], - "mapping": [ - { - "id": "patient-create", - "resourceType": "Mapping" - } - ], - "resourceType": "Questionnaire", - "title": "Patient create", - "status": "active", - "id": "patient-create", - "url": "https://aidbox.emr.beda.software/ui/console#/entities/Questionnaire/patient-create" -} diff --git a/sdc-qrf/src/converter/__tests__/resources/questionnaire_fce/patient_edit.json b/sdc-qrf/src/converter/__tests__/resources/questionnaire_fce/patient_edit.json deleted file mode 100644 index a29ce320..00000000 --- a/sdc-qrf/src/converter/__tests__/resources/questionnaire_fce/patient_edit.json +++ /dev/null @@ -1,125 +0,0 @@ -{ - "meta": { - "profile": ["https://beda.software/beda-emr-questionnaire"], - "lastUpdated": "2023-04-10T03:43:34.792167Z", - "createdAt": "2023-04-05T05:22:35.752466Z", - "versionId": "694" - }, - "launchContext": [ - { - "name": { - "code": "Patient", - "system": "http://hl7.org/fhir/uv/sdc/CodeSystem/launchContext" - }, - "type": ["Patient"] - } - ], - "name": "edit-patient", - "item": [ - { - "text": "patientId", - "type": "string", - "hidden": true, - "linkId": "patient-id", - "readOnly": true, - "initialExpression": { - "language": "text/fhirpath", - "expression": "%Patient.id" - } - }, - { - "text": "Last name", - "type": "string", - "linkId": "last-name", - "required": true, - "initialExpression": { - "language": "text/fhirpath", - "expression": "%Patient.name.family" - } - }, - { - "text": "First name", - "type": "string", - "linkId": "first-name", - "initialExpression": { - "language": "text/fhirpath", - "expression": "%Patient.name.given[0]" - } - }, - { - "text": "Middle name", - "type": "string", - "linkId": "middle-name", - "initialExpression": { - "language": "text/fhirpath", - "expression": "%Patient.name.given[1]" - } - }, - { - "text": "Birth date", - "type": "date", - "linkId": "birth-date", - "initialExpression": { - "language": "text/fhirpath", - "expression": "%Patient.birthDate" - } - }, - { - "text": "Gender", - "type": "choice", - "linkId": "gender", - "answerOption": [ - { - "value": { - "string": "male" - } - }, - { - "value": { - "string": "female" - } - } - ], - "initialExpression": { - "language": "text/fhirpath", - "expression": "%Patient.gender" - } - }, - { - "text": "SSN", - "type": "string", - "linkId": "ssn", - "initialExpression": { - "language": "text/fhirpath", - "expression": "%Patient.identifier.where(system='1.2.643.100.3').value" - } - }, - { - "text": "Phone number", - "type": "string", - "linkId": "mobile", - "itemControl": { - "coding": [ - { - "code": "phoneWidget" - } - ] - }, - "initialExpression": { - "language": "text/fhirpath", - "expression": "%Patient.telecom.where(system='phone').value" - } - } - ], - "mapping": [ - { - "id": "patient-create", - "resourceType": "Mapping" - } - ], - "resourceType": "Questionnaire", - "title": "Edit patient", - "status": "active", - "id": "patient-edit", - "url": "https://aidbox.emr.beda.software/ui/console#/entities/Questionnaire/patient-edit" -} diff --git a/sdc-qrf/src/converter/__tests__/resources/questionnaire_fce/phq_2_phq_9.json b/sdc-qrf/src/converter/__tests__/resources/questionnaire_fce/phq_2_phq_9.json deleted file mode 100644 index 56824908..00000000 --- a/sdc-qrf/src/converter/__tests__/resources/questionnaire_fce/phq_2_phq_9.json +++ /dev/null @@ -1,552 +0,0 @@ -{ - "subjectType": ["Encounter", "Patient"], - "meta": { - "profile": ["https://beda.software/beda-emr-questionnaire"], - "lastUpdated": "2023-04-10T03:43:34.792167Z", - "createdAt": "2023-04-05T05:22:35.752466Z", - "versionId": "694" - }, - "launchContext": [ - { - "name": { - "code": "Patient", - "system": "http://hl7.org/fhir/uv/sdc/CodeSystem/launchContext" - }, - "type": ["Patient"] - }, - { - "name": { - "code": "Author", - "system": "http://hl7.org/fhir/uv/sdc/CodeSystem/launchContext" - }, - "type": ["Resource"] - } - ], - "name": "PHQ-2/PHQ-9 Depression Screening", - "item": [ - { - "text": "DateTime", - "type": "dateTime", - "hidden": true, - "linkId": "dateTime", - "initialExpression": { - "language": "text/fhirpath", - "expression": "now()" - } - }, - { - "text": "PatientId", - "type": "string", - "hidden": true, - "linkId": "patientId", - "initialExpression": { - "language": "text/fhirpath", - "expression": "%Patient.id" - } - }, - { - "text": "PatientName", - "type": "string", - "hidden": true, - "linkId": "patientName", - "initialExpression": { - "language": "text/fhirpath", - "expression": "%Patient.name.given[0] + ' ' + %Patient.name.family" - } - }, - { - "item": [ - { - "text": "Little interest or pleasure in doing things", - "type": "choice", - "linkId": "44250-9", - "required": true, - "itemControl": { - "coding": [ - { - "code": "inline-choice" - } - ] - }, - "answerOption": [ - { - "value": { - "Coding": { - "code": "LA6568-5", - "system": "http://loinc.org", - "display": "Not at all" - } - } - }, - { - "value": { - "Coding": { - "code": "LA6569-3", - "system": "http://loinc.org", - "display": "Several days" - } - } - }, - { - "value": { - "Coding": { - "code": "LA6570-1", - "system": "http://loinc.org", - "display": "More than half the days" - } - } - }, - { - "value": { - "Coding": { - "code": "LA6571-9", - "system": "http://loinc.org", - "display": "Nearly every day" - } - } - } - ] - }, - { - "text": "Feeling down, depressed, or hopeless", - "type": "choice", - "linkId": "44255-8", - "required": true, - "itemControl": { - "coding": [ - { - "code": "inline-choice" - } - ] - }, - "answerOption": [ - { - "value": { - "Coding": { - "code": "LA6568-5", - "system": "http://loinc.org", - "display": "Not at all" - } - } - }, - { - "value": { - "Coding": { - "code": "LA6569-3", - "system": "http://loinc.org", - "display": "Several days" - } - } - }, - { - "value": { - "Coding": { - "code": "LA6570-1", - "system": "http://loinc.org", - "display": "More than half the days" - } - } - }, - { - "value": { - "Coding": { - "code": "LA6571-9", - "system": "http://loinc.org", - "display": "Nearly every day" - } - } - } - ] - }, - { - "text": "Trouble falling or staying asleep, or sleeping too much", - "type": "choice", - "linkId": "44259-0", - "required": true, - "itemControl": { - "coding": [ - { - "code": "inline-choice" - } - ] - }, - "answerOption": [ - { - "value": { - "Coding": { - "code": "LA6568-5", - "system": "http://loinc.org", - "display": "Not at all" - } - } - }, - { - "value": { - "Coding": { - "code": "LA6569-3", - "system": "http://loinc.org", - "display": "Several days" - } - } - }, - { - "value": { - "Coding": { - "code": "LA6570-1", - "system": "http://loinc.org", - "display": "More than half the days" - } - } - }, - { - "value": { - "Coding": { - "code": "LA6571-9", - "system": "http://loinc.org", - "display": "Nearly every day" - } - } - } - ] - }, - { - "text": "Feeling tired or having little energy", - "type": "choice", - "linkId": "44254-1", - "required": true, - "itemControl": { - "coding": [ - { - "code": "inline-choice" - } - ] - }, - "answerOption": [ - { - "value": { - "Coding": { - "code": "LA6568-5", - "system": "http://loinc.org", - "display": "Not at all" - } - } - }, - { - "value": { - "Coding": { - "code": "LA6569-3", - "system": "http://loinc.org", - "display": "Several days" - } - } - }, - { - "value": { - "Coding": { - "code": "LA6570-1", - "system": "http://loinc.org", - "display": "More than half the days" - } - } - }, - { - "value": { - "Coding": { - "code": "LA6571-9", - "system": "http://loinc.org", - "display": "Nearly every day" - } - } - } - ] - }, - { - "text": "Poor appetite or overeating", - "type": "choice", - "linkId": "44251-7", - "required": true, - "itemControl": { - "coding": [ - { - "code": "inline-choice" - } - ] - }, - "answerOption": [ - { - "value": { - "Coding": { - "code": "LA6568-5", - "system": "http://loinc.org", - "display": "Not at all" - } - } - }, - { - "value": { - "Coding": { - "code": "LA6569-3", - "system": "http://loinc.org", - "display": "Several days" - } - } - }, - { - "value": { - "Coding": { - "code": "LA6570-1", - "system": "http://loinc.org", - "display": "More than half the days" - } - } - }, - { - "value": { - "Coding": { - "code": "LA6571-9", - "system": "http://loinc.org", - "display": "Nearly every day" - } - } - } - ] - }, - { - "text": "Feeling bad about yourself-or that you are a failure or have let yourself or your family down", - "type": "choice", - "linkId": "44258-2", - "required": true, - "itemControl": { - "coding": [ - { - "code": "inline-choice" - } - ] - }, - "answerOption": [ - { - "value": { - "Coding": { - "code": "LA6568-5", - "system": "http://loinc.org", - "display": "Not at all" - } - } - }, - { - "value": { - "Coding": { - "code": "LA6569-3", - "system": "http://loinc.org", - "display": "Several days" - } - } - }, - { - "value": { - "Coding": { - "code": "LA6570-1", - "system": "http://loinc.org", - "display": "More than half the days" - } - } - }, - { - "value": { - "Coding": { - "code": "LA6571-9", - "system": "http://loinc.org", - "display": "Nearly every day" - } - } - } - ] - }, - { - "text": "Trouble concentrating on things, such as reading the newspaper or watching television", - "type": "choice", - "linkId": "44252-5", - "required": true, - "itemControl": { - "coding": [ - { - "code": "inline-choice" - } - ] - }, - "answerOption": [ - { - "value": { - "Coding": { - "code": "LA6568-5", - "system": "http://loinc.org", - "display": "Not at all" - } - } - }, - { - "value": { - "Coding": { - "code": "LA6569-3", - "system": "http://loinc.org", - "display": "Several days" - } - } - }, - { - "value": { - "Coding": { - "code": "LA6570-1", - "system": "http://loinc.org", - "display": "More than half the days" - } - } - }, - { - "value": { - "Coding": { - "code": "LA6571-9", - "system": "http://loinc.org", - "display": "Nearly every day" - } - } - } - ] - }, - { - "text": "Moving or speaking so slowly that other people could have noticed. Or the opposite-being so fidgety or restless that you have been moving around a lot more than usual", - "type": "choice", - "linkId": "44253-3", - "required": true, - "itemControl": { - "coding": [ - { - "code": "inline-choice" - } - ] - }, - "answerOption": [ - { - "value": { - "Coding": { - "code": "LA6568-5", - "system": "http://loinc.org", - "display": "Not at all" - } - } - }, - { - "value": { - "Coding": { - "code": "LA6569-3", - "system": "http://loinc.org", - "display": "Several days" - } - } - }, - { - "value": { - "Coding": { - "code": "LA6570-1", - "system": "http://loinc.org", - "display": "More than half the days" - } - } - }, - { - "value": { - "Coding": { - "code": "LA6571-9", - "system": "http://loinc.org", - "display": "Nearly every day" - } - } - } - ] - }, - { - "text": "Thoughts that you would be better off dead, or of hurting yourself in some way", - "type": "choice", - "linkId": "44260-8", - "required": true, - "itemControl": { - "coding": [ - { - "code": "inline-choice" - } - ] - }, - "answerOption": [ - { - "value": { - "Coding": { - "code": "LA6568-5", - "system": "http://loinc.org", - "display": "Not at all" - } - } - }, - { - "value": { - "Coding": { - "code": "LA6569-3", - "system": "http://loinc.org", - "display": "Several days" - } - } - }, - { - "value": { - "Coding": { - "code": "LA6570-1", - "system": "http://loinc.org", - "display": "More than half the days" - } - } - }, - { - "value": { - "Coding": { - "code": "LA6571-9", - "system": "http://loinc.org", - "display": "Nearly every day" - } - } - } - ] - }, - { - "text": "PHQ2/PHQ-9 Depression Severity Score", - "type": "integer", - "linkId": "phq9-total-score", - "readOnly": true, - "required": true, - "itemControl": { - "coding": [ - { - "code": "depression-score" - } - ] - }, - "calculatedExpression": { - "language": "text/fhirpath", - "expression": "%QuestionnaireResponse.item.item.answer.children().children().where(code='LA6569-3').count() + %QuestionnaireResponse.item.item.answer.children().children().where(code='LA6570-1').count() * 2 + %QuestionnaireResponse.item.item.answer.children().children().where(code='LA6571-9').count() * 3" - } - } - ], - "text": "Over the past 2 weeks, how often have you been bothered by:", - "type": "group", - "linkId": "phq2phq9" - } - ], - "mapping": [ - { - "id": "phq2phq9-extract", - "resourceType": "Mapping" - } - ], - "resourceType": "Questionnaire", - "status": "active", - "id": "phq2phq9", - "url": "https://aidbox.emr.beda.software/ui/console#/entities/Questionnaire/phq2phq9" -} diff --git a/sdc-qrf/src/converter/__tests__/resources/questionnaire_fce/physicalexam.json b/sdc-qrf/src/converter/__tests__/resources/questionnaire_fce/physicalexam.json deleted file mode 100644 index afdaf4ea..00000000 --- a/sdc-qrf/src/converter/__tests__/resources/questionnaire_fce/physicalexam.json +++ /dev/null @@ -1,385 +0,0 @@ -{ - "subjectType": ["Encounter"], - "meta": { - "profile": ["https://beda.software/beda-emr-questionnaire"], - "lastUpdated": "2023-04-10T03:43:34.792167Z", - "createdAt": "2023-04-05T05:22:35.752466Z", - "versionId": "694" - }, - "launchContext": [ - { - "name": { - "code": "Patient", - "system": "http://hl7.org/fhir/uv/sdc/CodeSystem/launchContext" - }, - "type": ["Patient"], - "description": "Patient is answering the questionnaire" - } - ], - "name": "Physical exam", - "item": [ - { - "item": [ - { - "code": [ - { - "code": "71389-1", - "system": "http://loinc.org", - "display": "CMS - constitutional exam panel" - } - ], - "text": "General", - "type": "text", - "macro": "Well nourished, well developed, awake and alert, resting comfortably in no acute distress, cooperative on exam", - "linkId": "general", - "itemControl": { - "coding": [ - { - "code": "text-with-macro" - } - ] - } - }, - { - "code": [ - { - "code": "71392-5", - "system": "http://loinc.org", - "display": "CMS - ear-nose-mouth-throat exam panel" - } - ], - "text": "HEENT", - "type": "text", - "macro": "NCAT, PERRL, normal conjunctivae, nonicteric sclerae, bilateral EAC/TM clear, no nasal discharge, OP clear, moist mucous membranes", - "linkId": "heent", - "itemControl": { - "coding": [ - { - "code": "text-with-macro" - } - ] - } - }, - { - "code": [ - { - "code": "71393-3", - "system": "http://loinc.org", - "display": "CMS - neck exam panel" - } - ], - "text": "Neck", - "type": "text", - "macro": "Supple, normal ROM, no lymphadenopathy/masses, nontender", - "linkId": "neck", - "itemControl": { - "coding": [ - { - "code": "text-with-macro" - } - ] - } - }, - { - "code": [ - { - "code": "71395-8", - "system": "http://loinc.org", - "display": "CMS - cardiovascular exam panel" - } - ], - "text": "Cardiovascular", - "type": "text", - "macro": "RRR, normal S1/S2, no murmurs/gallops/rub", - "linkId": "cardiovascular", - "itemControl": { - "coding": [ - { - "code": "text-with-macro" - } - ] - } - }, - { - "code": [ - { - "code": "71394-1", - "system": "http://loinc.org", - "display": "CMS - respiratory exam panel" - } - ], - "text": "Pulmonary", - "type": "text", - "macro": "No respiratory distress, lungs CTAB: no rales, rhonchi, or wheeze", - "linkId": "pulmonary", - "itemControl": { - "coding": [ - { - "code": "text-with-macro" - } - ] - } - }, - { - "code": [ - { - "code": "71397-4", - "system": "http://loinc.org", - "display": "CMS - gastrointestinal - abdomen exam panel" - } - ], - "text": "Abdominal", - "type": "text", - "macro": "Soft and non-tender with no guarding or rebound; +BS normoactive, no tympany on auscultation", - "linkId": "abdominal", - "itemControl": { - "coding": [ - { - "code": "text-with-macro" - } - ] - } - }, - { - "code": [ - { - "code": "71402-2", - "system": "http://loinc.org", - "display": "CMS - musculoskeletal exam panel" - } - ], - "text": "Musculoskeletal", - "type": "text", - "macro": "Normal ROM of UE and LE, normal bulk and tone,", - "linkId": "musculoskeletal", - "itemControl": { - "coding": [ - { - "code": "text-with-macro" - } - ] - } - }, - { - "code": [ - { - "code": "71401-4", - "system": "http://loinc.org", - "display": "CMS - extremities exam panel" - } - ], - "text": "Extremities", - "type": "text", - "macro": "Pulses intact with normal cap refill, no LE pitting edema or calf tenderness", - "linkId": "extremities", - "itemControl": { - "coding": [ - { - "code": "text-with-macro" - } - ] - } - }, - { - "code": [ - { - "code": "71404-8", - "system": "http://loinc.org", - "display": "CMS - neurologic exam panel" - } - ], - "text": "Neurologic", - "type": "text", - "macro": "AAOx3, converses normally. CN II - XII grossly intact. Gait and coordination intact. 5+ BL UE/LE strength, no gross motor or sensory defects", - "linkId": "neurologic", - "itemControl": { - "coding": [ - { - "code": "text-with-macro" - } - ] - } - }, - { - "code": [ - { - "code": "71405-5", - "system": "http://loinc.org", - "display": "CMS - psychiatric exam panel" - } - ], - "text": "Psychiatric", - "type": "text", - "macro": "Normal mood and affect. Judgement/competence is appropriate", - "linkId": "psychiatric", - "itemControl": { - "coding": [ - { - "code": "text-with-macro" - } - ] - } - }, - { - "code": [ - { - "code": "71403-0", - "system": "http://loinc.org", - "display": "CMS - skin exam panel" - } - ], - "text": "Skin", - "type": "text", - "macro": "Warm, dry, and intact. No rashes, dermatoses, petechiae, or lesions", - "linkId": "skin", - "itemControl": { - "coding": [ - { - "code": "text-with-macro" - } - ] - } - }, - { - "code": [ - { - "code": "32473-1", - "system": "http://loinc.org", - "display": "Physical findings.sensation" - } - ], - "text": "Monofilament", - "type": "text", - "macro": "Normal sensation bilaterally on soles of feet with 10g monofilament", - "linkId": "monofilament", - "itemControl": { - "coding": [ - { - "code": "text-with-macro" - } - ] - } - }, - { - "text": "Other Systems (optional)", - "type": "display", - "linkId": "other-systems-optional" - }, - { - "code": [ - { - "code": "71396-6", - "system": "http://loinc.org", - "display": "CMS - breast exam panel" - } - ], - "text": "Chest", - "type": "text", - "macro": "The chest wall is symmetric, without deformity, and is atraumatic in appearance", - "linkId": "chest", - "itemControl": { - "coding": [ - { - "code": "text-with-macro" - } - ] - } - }, - { - "code": [ - { - "code": "71399-0", - "system": "http://loinc.org", - "display": "CMS - genitourinary exam - female panel" - } - ], - "text": "Genitourinary", - "type": "text", - "macro": "External genitalia without erythema, exudate or discharge", - "linkId": "genitourinary-female", - "itemControl": { - "coding": [ - { - "code": "text-with-macro" - } - ] - }, - "enableWhenExpression": { - "language": "text/fhirpath", - "expression": "%Patient.gender = 'female'" - } - }, - { - "code": [ - { - "code": "71398-2", - "system": "http://loinc.org", - "display": "CMS - genitourinary exam - male panel" - } - ], - "text": "Genitourinary", - "type": "text", - "macro": "Penis without lesions. No urethral discharge. Testes normal size without masses or tenderness. No scrotal masses. No hernia", - "linkId": "genitourinary-male", - "itemControl": { - "coding": [ - { - "code": "text-with-macro" - } - ] - }, - "enableWhenExpression": { - "language": "text/fhirpath", - "expression": "%Patient.gender = 'male'" - } - }, - { - "code": [ - { - "code": "8708-0", - "system": "http://loinc.org", - "display": "Phys find Rectum" - } - ], - "text": "Rectal", - "type": "text", - "macro": "Normal external anus and normal tone. No palpable masses, normal mucosa, brown stool. Hemoccult negative", - "linkId": "rectal", - "itemControl": { - "coding": [ - { - "code": "text-with-macro" - } - ] - } - }, - { - "code": [ - { - "code": "71400-6", - "system": "http://loinc.org", - "display": "CMS - lymphatic exam panel" - } - ], - "text": "Lymphatic", - "type": "text", - "macro": "No enlarged lymph nodes of occipital, pre- and postauricular, submandibular, anterior or posterior cervical, or supraclavicular identified", - "linkId": "lymphatic", - "itemControl": { - "coding": [ - { - "code": "text-with-macro" - } - ] - } - } - ], - "type": "group", - "linkId": "physical-exam-group" - } - ], - "resourceType": "Questionnaire", - "status": "active", - "id": "physical-exam", - "url": "https://aidbox.emr.beda.software/ui/console#/entities/Questionnaire/physical-exam" -} diff --git a/sdc-qrf/src/converter/__tests__/resources/questionnaire_fce/practitioner_create.json b/sdc-qrf/src/converter/__tests__/resources/questionnaire_fce/practitioner_create.json deleted file mode 100644 index e4d94d23..00000000 --- a/sdc-qrf/src/converter/__tests__/resources/questionnaire_fce/practitioner_create.json +++ /dev/null @@ -1,90 +0,0 @@ -{ - "meta": { - "profile": ["https://beda.software/beda-emr-questionnaire"], - "lastUpdated": "2023-04-10T03:43:34.792167Z", - "createdAt": "2023-04-05T05:22:35.752466Z", - "versionId": "694" - }, - "name": "practitioner-create", - "item": [ - { - "text": "Last name", - "type": "string", - "linkId": "last-name", - "required": true - }, - { - "text": "First name", - "type": "string", - "linkId": "first-name" - }, - { - "text": "Middle name", - "type": "string", - "linkId": "middle-name" - }, - { - "text": "Specialty", - "type": "choice", - "linkId": "specialty", - "answerOption": [ - { - "value": { - "Coding": { - "code": "394577000", - "system": "http://snomed.info/sct", - "display": "Anesthetics" - } - } - }, - { - "value": { - "Coding": { - "code": "394579002", - "system": "http://snomed.info/sct", - "display": "Cardiology" - } - } - }, - { - "value": { - "Coding": { - "code": "394582007", - "system": "http://snomed.info/sct", - "display": "Dermatology" - } - } - }, - { - "value": { - "Coding": { - "code": "394583002", - "system": "http://snomed.info/sct", - "display": "Endocrinology" - } - } - }, - { - "value": { - "Coding": { - "code": "419772000", - "system": "http://snomed.info/sct", - "display": "Family practice" - } - } - } - ] - } - ], - "mapping": [ - { - "id": "practitioner-create", - "resourceType": "Mapping" - } - ], - "resourceType": "Questionnaire", - "title": "Practitioner create", - "status": "active", - "id": "practitioner-create", - "url": "https://aidbox.emr.beda.software/ui/console#/entities/Questionnaire/practitioner-create" -} diff --git a/sdc-qrf/src/converter/__tests__/resources/questionnaire_fce/practitioner_create_structure_map.json b/sdc-qrf/src/converter/__tests__/resources/questionnaire_fce/practitioner_create_structure_map.json deleted file mode 100644 index 976358f7..00000000 --- a/sdc-qrf/src/converter/__tests__/resources/questionnaire_fce/practitioner_create_structure_map.json +++ /dev/null @@ -1,91 +0,0 @@ -{ - "meta": { - "profile": ["https://beda.software/beda-emr-questionnaire"], - "lastUpdated": "2023-04-25T06:51:01.969393Z", - "createdAt": "2023-04-25T06:38:33.794441Z", - "versionId": "268" - }, - "name": "practitioner-create", - "item": [ - { - "text": "Last name", - "type": "string", - "linkId": "last-name", - "required": true - }, - { - "text": "First name", - "type": "string", - "linkId": "first-name" - }, - { - "text": "Middle name", - "type": "string", - "linkId": "middle-name" - }, - { - "text": "Specialty", - "type": "choice", - "linkId": "specialty", - "answerOption": [ - { - "value": { - "Coding": { - "code": "394577000", - "system": "http://snomed.info/sct", - "display": "Anesthetics" - } - } - }, - { - "value": { - "Coding": { - "code": "394579002", - "system": "http://snomed.info/sct", - "display": "Cardiology" - } - } - }, - { - "value": { - "Coding": { - "code": "394582007", - "system": "http://snomed.info/sct", - "display": "Dermatology" - } - } - }, - { - "value": { - "Coding": { - "code": "394583002", - "system": "http://snomed.info/sct", - "display": "Endocrinology" - } - } - }, - { - "value": { - "Coding": { - "code": "419772000", - "system": "http://snomed.info/sct", - "display": "Family practice" - } - } - } - ] - } - ], - "mapping": [ - { - "id": "practitioner-create", - "resourceType": "Mapping" - } - ], - "resourceType": "Questionnaire", - "title": "Practitioner create", - "targetStructureMap": ["StructureMap/practitioner-create"], - "status": "active", - "id": "practitioner-create-fhir-testing", - "url": "https://aidbox.emr.beda.software/ui/console#/entities/Questionnaire/practitioner-create" -} diff --git a/sdc-qrf/src/converter/__tests__/resources/questionnaire_fce/practitioner_edit.json b/sdc-qrf/src/converter/__tests__/resources/questionnaire_fce/practitioner_edit.json deleted file mode 100644 index 15a67887..00000000 --- a/sdc-qrf/src/converter/__tests__/resources/questionnaire_fce/practitioner_edit.json +++ /dev/null @@ -1,144 +0,0 @@ -{ - "meta": { - "profile": ["https://beda.software/beda-emr-questionnaire"], - "lastUpdated": "2023-04-10T03:43:34.792167Z", - "createdAt": "2023-04-05T05:22:35.752466Z", - "versionId": "694" - }, - "launchContext": [ - { - "name": { - "code": "Practitioner", - "system": "http://hl7.org/fhir/uv/sdc/CodeSystem/launchContext" - }, - "type": ["Practitioner"] - }, - { - "name": { - "code": "PractitionerRole", - "system": "http://hl7.org/fhir/uv/sdc/CodeSystem/launchContext" - }, - "type": ["PractitionerRole"] - } - ], - "name": "practitioner edit", - "item": [ - { - "text": "practitionerId", - "type": "string", - "hidden": true, - "linkId": "practitioner-id", - "readOnly": true, - "initialExpression": { - "language": "text/fhirpath", - "expression": "%Practitioner.id" - } - }, - { - "text": "practitionerRoleId", - "type": "string", - "hidden": true, - "linkId": "practitioner-role-id", - "readOnly": true, - "initialExpression": { - "language": "text/fhirpath", - "expression": "%PractitionerRole.id" - } - }, - { - "text": "First name", - "type": "string", - "linkId": "first-name", - "initialExpression": { - "language": "text/fhirpath", - "expression": "%Practitioner.name.given[0]" - } - }, - { - "text": "Middle name", - "type": "string", - "linkId": "middle-name", - "initialExpression": { - "language": "text/fhirpath", - "expression": "%Practitioner.name.given[1]" - } - }, - { - "text": "Last name", - "type": "string", - "linkId": "last-name", - "required": true, - "initialExpression": { - "language": "text/fhirpath", - "expression": "%Practitioner.name.family" - } - }, - { - "text": "Specialty", - "type": "choice", - "linkId": "specialty", - "answerOption": [ - { - "value": { - "Coding": { - "code": "394577000", - "system": "http://snomed.info/sct", - "display": "Anesthetics" - } - } - }, - { - "value": { - "Coding": { - "code": "394579002", - "system": "http://snomed.info/sct", - "display": "Cardiology" - } - } - }, - { - "value": { - "Coding": { - "code": "394582007", - "system": "http://snomed.info/sct", - "display": "Dermatology" - } - } - }, - { - "value": { - "Coding": { - "code": "394583002", - "system": "http://snomed.info/sct", - "display": "Endocrinology" - } - } - }, - { - "value": { - "Coding": { - "code": "419772000", - "system": "http://snomed.info/sct", - "display": "Family practice" - } - } - } - ], - "initialExpression": { - "language": "text/fhirpath", - "expression": "%PractitionerRole.specialty[0].coding" - } - } - ], - "mapping": [ - { - "id": "practitioner-edit", - "resourceType": "Mapping" - } - ], - "resourceType": "Questionnaire", - "title": "Practitioner edit", - "status": "active", - "id": "practitioner-edit", - "url": "https://aidbox.emr.beda.software/ui/console#/entities/Questionnaire/practitioner-edit" -} diff --git a/sdc-qrf/src/converter/__tests__/resources/questionnaire_fce/practitioner_role_create.json b/sdc-qrf/src/converter/__tests__/resources/questionnaire_fce/practitioner_role_create.json deleted file mode 100644 index e872bab4..00000000 --- a/sdc-qrf/src/converter/__tests__/resources/questionnaire_fce/practitioner_role_create.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "meta": { - "profile": ["https://beda.software/beda-emr-questionnaire"], - "lastUpdated": "2023-04-10T03:43:34.792167Z", - "createdAt": "2023-04-05T05:22:35.752466Z", - "versionId": "694" - }, - "name": "practitioner-role-create", - "item": [ - { - "text": "Organization", - "type": "string", - "linkId": "organization" - }, - { - "text": "Practitioner", - "type": "string", - "linkId": "practitioner" - }, - { - "text": "Speciality", - "type": "string", - "linkId": "specialty" - } - ], - "mapping": [ - { - "id": "practitioner-role-create", - "resourceType": "Mapping" - } - ], - "resourceType": "Questionnaire", - "title": "Create practitioner role", - "status": "active", - "id": "practitioner-role-create", - "url": "https://aidbox.emr.beda.software/ui/console#/entities/Questionnaire/practitioner-role-create" -} diff --git a/sdc-qrf/src/converter/__tests__/resources/questionnaire_fce/public_appointment.json b/sdc-qrf/src/converter/__tests__/resources/questionnaire_fce/public_appointment.json deleted file mode 100644 index 793d6c99..00000000 --- a/sdc-qrf/src/converter/__tests__/resources/questionnaire_fce/public_appointment.json +++ /dev/null @@ -1,91 +0,0 @@ -{ - "url": "https://aidbox.emr.beda.software/ui/console#/entities/Questionnaire/", - "item": [ - { - "text": "First name", - "type": "string", - "linkId": "first-name", - "required": true - }, - { - "text": "Last name", - "type": "string", - "linkId": "last-name", - "required": true - }, - { - "text": "Phone number", - "type": "string", - "linkId": "mobile", - "itemControl": { - "coding": [ - { - "code": "phoneWidget" - } - ] - } - }, - { - "text": "Practitioner", - "type": "choice", - "linkId": "practitioner-role", - "required": true, - "itemControl": { - "coding": [ - { - "code": "practitioner-role" - } - ] - } - }, - { - "text": "Type", - "type": "choice", - "hidden": true, - "linkId": "service-type", - "initial": [ - { - "value": { - "Coding": { - "code": "consultation", - "system": "http://fhir.org/guides/argonaut-scheduling/CodeSystem/visit-type", - "display": "The first appointment" - } - } - } - ], - "required": true - }, - { - "text": "Date and Time", - "type": "dateTime", - "linkId": "date-time-slot", - "required": true, - "itemControl": { - "coding": [ - { - "code": "date-time-slot" - } - ] - } - } - ], - "meta": { - "profile": [ - "https://beda.software/beda-emr-questionnaire" - ], - "lastUpdated": "2023-04-10T03:43:34.792167Z", - "createdAt": "2023-04-05T05:22:35.752466Z", - "versionId": "694" - }, - "name": "Appointment", - "status": "active", - "mapping": [ - { - "id": "public-appointment-extract", - "resourceType": "Mapping" - } - ], - "id": "public-appointment", - "resourceType": "Questionnaire" -} \ No newline at end of file diff --git a/sdc-qrf/src/converter/__tests__/resources/questionnaire_fce/review_of_systems.json b/sdc-qrf/src/converter/__tests__/resources/questionnaire_fce/review_of_systems.json deleted file mode 100644 index 4d451095..00000000 --- a/sdc-qrf/src/converter/__tests__/resources/questionnaire_fce/review_of_systems.json +++ /dev/null @@ -1,389 +0,0 @@ -{ - "url": "https://aidbox.emr.beda.software/ui/console#/entities/Questionnaire/review-of-systems", - "item": [ - { - "code": [ - { - "code": "71406-3", - "system": "http://loinc.org", - "display": "CMS - review of systems panel" - } - ], - "text": "Provider reviewed all systems and state that all are WNL except as noted below\n", - "type": "boolean", - "linkId": "provider-viewed-confirmation", - "initial": [ - { - "value": { - "boolean": false - } - } - ] - }, - { - "item": [ - { - "code": [ - { - "code": "71407-1", - "system": "http://loinc.org", - "display": "CMS - constitutional symptoms panel" - } - ], - "text": "General", - "type": "boolean", - "linkId": "general" - }, - { - "code": [ - { - "code": "71407-1-comment", - "system": "http://loinc.org", - "display": "CMS - constitutional symptoms panel - comment" - } - ], - "type": "text", - "linkId": "general-comment", - "enableWhen": [ - { - "answer": { - "boolean": true - }, - "operator": "=", - "question": "general" - } - ] - }, - { - "code": [ - { - "code": "71409-7", - "system": "http://loinc.org", - "display": "CMS - ear-nose-mouth-throat panel" - } - ], - "text": "HEENT", - "type": "boolean", - "linkId": "heent" - }, - { - "code": [ - { - "code": "71409-7-comment", - "system": "http://loinc.org", - "display": "CMS - ear-nose-mouth-throat panel - comment" - } - ], - "type": "text", - "linkId": "heent-comment", - "enableWhen": [ - { - "answer": { - "boolean": true - }, - "operator": "=", - "question": "heent" - } - ] - }, - { - "code": [ - { - "code": "71410-5", - "system": "http://loinc.org", - "display": "CMS - cardiovascular panel" - } - ], - "text": "Cardiovascular", - "type": "boolean", - "linkId": "cardiovascular" - }, - { - "code": [ - { - "code": "71410-5-comment", - "system": "http://loinc.org", - "display": "CMS - cardiovascular panel - comment" - } - ], - "type": "text", - "linkId": "cardiovascular-comment", - "enableWhen": [ - { - "answer": { - "boolean": true - }, - "operator": "=", - "question": "cardiovascular" - } - ] - }, - { - "code": [ - { - "code": "71411-3", - "system": "http://loinc.org", - "display": "CMS - respiratory panel" - } - ], - "text": "Respiratory", - "type": "boolean", - "linkId": "respiratory" - }, - { - "code": [ - { - "code": "71411-3-comment", - "system": "http://loinc.org", - "display": "CMS - respiratory panel - comment" - } - ], - "type": "text", - "linkId": "respiratory-comment", - "enableWhen": [ - { - "answer": { - "boolean": true - }, - "operator": "=", - "question": "respiratory" - } - ] - }, - { - "code": [ - { - "code": "71412-1", - "system": "http://loinc.org", - "display": "CMS - gastrointestinal panel" - } - ], - "text": "Gastrointestinal", - "type": "boolean", - "linkId": "gastrointestinal" - }, - { - "code": [ - { - "code": "71412-1-comment", - "system": "http://loinc.org", - "display": "CMS - gastrointestinal panel - comment" - } - ], - "type": "text", - "linkId": "gastrointestinal-comment", - "enableWhen": [ - { - "answer": { - "boolean": true - }, - "operator": "=", - "question": "gastrointestinal" - } - ] - }, - { - "code": [ - { - "code": "71413-9", - "system": "http://loinc.org", - "display": "CMS - genitourinary panel" - } - ], - "text": "Genitourinary", - "type": "boolean", - "linkId": "genitourinary" - }, - { - "code": [ - { - "code": "71413-9-comment", - "system": "http://loinc.org", - "display": "CMS - genitourinary panel - comment" - } - ], - "type": "text", - "linkId": "genitourinary-comment", - "enableWhen": [ - { - "answer": { - "boolean": true - }, - "operator": "=", - "question": "genitourinary" - } - ] - }, - { - "code": [ - { - "code": "71414-7", - "system": "http://loinc.org", - "display": "CMS - musculoskeletal panel" - } - ], - "text": "Musculoskeletal", - "type": "boolean", - "linkId": "musculoskeletal" - }, - { - "code": [ - { - "code": "71414-7-comment", - "system": "http://loinc.org", - "display": "CMS - musculoskeletal panel - comment" - } - ], - "type": "text", - "linkId": "musculoskeletal-comment", - "enableWhen": [ - { - "answer": { - "boolean": true - }, - "operator": "=", - "question": "musculoskeletal" - } - ] - }, - { - "code": [ - { - "code": "71416-2", - "system": "http://loinc.org", - "display": "CMS - neurological panel" - } - ], - "text": "Neurologic", - "type": "boolean", - "linkId": "neurologic" - }, - { - "code": [ - { - "code": "71416-2-comment", - "system": "http://loinc.org", - "display": "CMS - neurological panel - comment" - } - ], - "type": "text", - "linkId": "neurologic-comment", - "enableWhen": [ - { - "answer": { - "boolean": true - }, - "operator": "=", - "question": "neurologic" - } - ] - }, - { - "code": [ - { - "code": "71417-0", - "system": "http://loinc.org", - "display": "CMS - psychiatric panel" - } - ], - "text": "Psychiatric", - "type": "boolean", - "linkId": "psychiatric" - }, - { - "code": [ - { - "code": "71417-0-comment", - "system": "http://loinc.org", - "display": "CMS - psychiatric panel - comment" - } - ], - "type": "text", - "linkId": "psychiatric-comment", - "enableWhen": [ - { - "answer": { - "boolean": true - }, - "operator": "=", - "question": "psychiatric" - } - ] - }, - { - "code": [ - { - "code": "71415-4", - "system": "http://loinc.org", - "display": "CMS - integumentary panel" - } - ], - "text": "Skin", - "type": "boolean", - "linkId": "skin" - }, - { - "code": [ - { - "code": "71415-4-comment", - "system": "http://loinc.org", - "display": "CMS - integumentary panel - comment" - } - ], - "type": "text", - "linkId": "skin-comment", - "enableWhen": [ - { - "answer": { - "boolean": true - }, - "operator": "=", - "question": "skin" - } - ] - }, - { - "text": "Other", - "type": "boolean", - "linkId": "other" - }, - { - "type": "text", - "linkId": "other-comment", - "enableWhen": [ - { - "answer": { - "boolean": true - }, - "operator": "=", - "question": "other" - } - ] - } - ], - "text": "Select abnormal systems", - "type": "group", - "linkId": "abnormal-systems-group", - "enableWhen": [ - { - "answer": { - "boolean": true - }, - "operator": "=", - "question": "provider-viewed-confirmation" - } - ] - } - ], - "meta": { - "profile": ["https://beda.software/beda-emr-questionnaire"], - "lastUpdated": "2023-04-10T03:43:34.792167Z", - "createdAt": "2023-04-05T05:22:35.752466Z", - "versionId": "694" - }, - "name": "Review of Systems", - "status": "active", - "subjectType": ["Encounter"], - "id": "review-of-systems", - "resourceType": "Questionnaire" -} diff --git a/sdc-qrf/src/converter/__tests__/resources/questionnaire_fce/source_queries.json b/sdc-qrf/src/converter/__tests__/resources/questionnaire_fce/source_queries.json deleted file mode 100644 index e4ae3fee..00000000 --- a/sdc-qrf/src/converter/__tests__/resources/questionnaire_fce/source_queries.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "meta": { - "profile": ["https://beda.software/beda-emr-questionnaire"] - }, - "item": [ - { - "linkId": "question-1", - "type": "string", - "text": "Question" - } - ], - "status": "active", - "resourceType": "Questionnaire", - "contained": [ - { - "id": "PrePopQuery", - "type": "batch", - "entry": [ - { - "request": { - "url": "Patient?_id={{%LaunchPatient.id}}", - "method": "GET" - } - } - ], - "resourceType": "Bundle" - } - ], - "sourceQueries": [ - { - "localRef": "Bundle#PrePopQuery" - } - ] -} diff --git a/sdc-qrf/src/converter/__tests__/resources/questionnaire_fce/vitals.json b/sdc-qrf/src/converter/__tests__/resources/questionnaire_fce/vitals.json deleted file mode 100644 index 0b0f6f42..00000000 --- a/sdc-qrf/src/converter/__tests__/resources/questionnaire_fce/vitals.json +++ /dev/null @@ -1,234 +0,0 @@ -{ - "subjectType": ["Encounter", "Patient"], - "meta": { - "profile": ["https://beda.software/beda-emr-questionnaire"], - "lastUpdated": "2023-05-04T01:00:51.328418Z", - "createdAt": "2023-05-04T01:00:51.328418Z", - "versionId": "2" - }, - "launchContext": [ - { - "name": { - "code": "Patient" - }, - "type": ["Patient"] - } - ], - "name": "Vitals", - "item": [ - { - "text": "PatientId", - "type": "string", - "hidden": true, - "linkId": "patientId", - "initialExpression": { - "language": "text/fhirpath", - "expression": "%Patient.id" - } - }, - { - "text": "PatientName", - "type": "string", - "hidden": true, - "linkId": "patientName", - "initialExpression": { - "language": "text/fhirpath", - "expression": "%Patient.name.given[0] + ' ' + %Patient.name.family" - } - }, - { - "text": "Height", - "type": "integer", - "unit": { - "code": "cm", - "system": "http://unitsofmeasure.org", - "display": "cm" - }, - "linkId": "height" - }, - { - "text": "Weight", - "type": "integer", - "unit": { - "code": "kg", - "system": "http://unitsofmeasure.org", - "display": "kg" - }, - "linkId": "weight" - }, - { - "text": "Temperature", - "type": "integer", - "unit": { - "code": "Celsius", - "system": "http://unitsofmeasure.org", - "display": "Celsius" - }, - "linkId": "temperature" - }, - { - "text": "Oxygen saturation", - "type": "integer", - "unit": { - "code": "%", - "system": "http://unitsofmeasure.org", - "display": "%" - }, - "linkId": "oxygen-saturation" - }, - { - "text": "Pulse rate", - "type": "integer", - "unit": { - "code": "bpm", - "system": "http://unitsofmeasure.org", - "display": "bpm" - }, - "linkId": "pulse-rate" - }, - { - "text": "Respiratory Rate", - "type": "integer", - "unit": { - "code": "bpm", - "system": "http://unitsofmeasure.org", - "display": "bpm" - }, - "linkId": "respiratory-rate" - }, - { - "item": [ - { - "item": [ - { - "text": "BP systolic", - "type": "integer", - "unit": { - "code": "mmHg", - "system": "http://unitsofmeasure.org", - "display": "mmHg" - }, - "linkId": "blood-pressure-systolic" - }, - { - "text": "BP diastolic", - "type": "integer", - "unit": { - "code": "mmHg", - "system": "http://unitsofmeasure.org", - "display": "mmHg" - }, - "linkId": "blood-pressure-diastolic" - } - ], - "type": "group", - "linkId": "blood-pressure-systolic-diastolic", - "itemControl": { - "coding": [ - { - "code": "blood-pressure" - } - ] - } - }, - { - "text": "Positions", - "type": "choice", - "linkId": "blood-pressure-positions", - "itemControl": { - "coding": [ - { - "code": "inline-choice" - } - ] - }, - "answerOption": [ - { - "value": { - "Coding": { - "code": "sitting", - "display": "Sitting" - } - } - }, - { - "value": { - "Coding": { - "code": "lying", - "display": "Lying" - } - } - }, - { - "value": { - "Coding": { - "code": "standing", - "display": "Standing" - } - } - } - ] - }, - { - "text": "Arm", - "type": "choice", - "linkId": "blood-pressure-arm", - "itemControl": { - "coding": [ - { - "code": "inline-choice" - } - ] - }, - "answerOption": [ - { - "value": { - "Coding": { - "code": "biceps-left", - "display": "Biceps left" - } - } - }, - { - "value": { - "Coding": { - "code": "biceps-right", - "display": "Biceps right" - } - } - } - ] - } - ], - "text": "Blood Pressure", - "type": "group", - "linkId": "blood-pressure" - }, - { - "text": "BMI", - "type": "integer", - "unit": { - "code": "kg/m2", - "system": "http://unitsofmeasure.org", - "display": "kg/m2" - }, - "linkId": "bmi", - "readOnly": true, - "required": true, - "calculatedExpression": { - "language": "text/fhirpath", - "expression": "(%QuestionnaireResponse.item.where(linkId='weight').answer.value.integer / ((%QuestionnaireResponse.item.where(linkId='height').answer.value.integer / 100) * (%QuestionnaireResponse.item.where(linkId='height').answer.value.integer / 100))).round(2)" - } - } - ], - "mapping": [ - { - "id": "vitals", - "resourceType": "Mapping" - } - ], - "resourceType": "Questionnaire", - "status": "active", - "id": "vitals", - "url": "https://aidbox.emr.beda.software/ui/console#/entities/Questionnaire/vitals" -} diff --git a/sdc-qrf/src/converter/__tests__/resources/questionnaire_fhir/allergies.json b/sdc-qrf/src/converter/__tests__/resources/questionnaire_fhir/allergies.json deleted file mode 100644 index 50e1ccb3..00000000 --- a/sdc-qrf/src/converter/__tests__/resources/questionnaire_fhir/allergies.json +++ /dev/null @@ -1,433 +0,0 @@ -{ - "subjectType": [ - "Encounter", - "Patient" - ], - "meta": { - "profile": [ - "https://beda.software/beda-emr-questionnaire" - ], - "lastUpdated": "2023-04-10T03:43:34.792167Z", - "versionId": "694", - "extension": [ - { - "url": "ex:createdAt", - "valueInstant": "2023-04-05T05:22:35.752466Z" - } - ] - }, - "name": "Allergies", - "item": [ - { - "text": "DateTime", - "type": "dateTime", - "extension": [ - { - "url": "http://hl7.org/fhir/StructureDefinition/questionnaire-hidden", - "valueBoolean": true - }, - { - "url": "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-initialExpression", - "valueExpression": { - "language": "text/fhirpath", - "expression": "now()" - } - } - ], - "linkId": "dateTime" - }, - { - "text": "PatientId", - "type": "string", - "extension": [ - { - "url": "http://hl7.org/fhir/StructureDefinition/questionnaire-hidden", - "valueBoolean": true - }, - { - "url": "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-initialExpression", - "valueExpression": { - "language": "text/fhirpath", - "expression": "%Patient.id" - } - } - ], - "linkId": "patientId" - }, - { - "text": "PatientName", - "type": "string", - "extension": [ - { - "url": "http://hl7.org/fhir/StructureDefinition/questionnaire-hidden", - "valueBoolean": true - }, - { - "url": "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-initialExpression", - "valueExpression": { - "language": "text/fhirpath", - "expression": "%Patient.name.given[0] + ' ' + %Patient.name.family" - } - } - ], - "linkId": "patientName" - }, - { - "text": "Type", - "type": "choice", - "linkId": "type", - "required": true, - "answerOption": [ - { - "valueCoding": { - "code": "418634005", - "system": "http://hl7.org/fhir/allergy-intolerance-category", - "display": "Drug" - } - }, - { - "valueCoding": { - "code": "414285001", - "system": "http://hl7.org/fhir/allergy-intolerance-category", - "display": "Food" - } - }, - { - "valueCoding": { - "code": "426232007", - "system": "http://hl7.org/fhir/allergy-intolerance-category", - "display": "Environmental" - } - } - ], - "extension": [ - { - "url": "http://hl7.org/fhir/StructureDefinition/questionnaire-itemControl", - "valueCodeableConcept": { - "coding": [ - { - "code": "inline-choice" - } - ] - } - } - ] - }, - { - "text": "Reaction", - "type": "choice", - "linkId": "reaction", - "repeats": true, - "answerOption": [ - { - "valueCoding": { - "code": "39579001", - "system": "http://snomed.ct", - "display": "Anaphylaxis" - } - }, - { - "valueCoding": { - "code": "25064002", - "system": "http://snomed.ct", - "display": "Headache" - } - }, - { - "valueCoding": { - "code": "247472004", - "system": "http://snomed.ct", - "display": "Hives (Wheal)" - } - }, - { - "valueCoding": { - "code": "422587007", - "system": "http://snomed.ct", - "display": "Nausea" - } - }, - { - "valueCoding": { - "code": "422400008", - "system": "http://snomed.ct", - "display": "Vomiting" - } - } - ], - "extension": [ - { - "url": "http://hl7.org/fhir/StructureDefinition/questionnaire-itemControl", - "valueCodeableConcept": { - "coding": [ - { - "code": "inline-choice" - } - ] - } - } - ] - }, - { - "text": "Substance", - "type": "choice", - "linkId": "substance-drug", - "enableWhen": [ - { - "question": "type", - "operator": "=", - "answerCoding": { - "code": "418634005", - "system": "http://snomed.ct" - } - } - ], - "answerOption": [ - { - "valueCoding": { - "code": "LA26702-3", - "system": "http://loinc.org", - "display": "Aspirin" - } - }, - { - "valueCoding": { - "code": "LA30119-4", - "system": "http://loinc.org", - "display": "Iodine" - } - }, - { - "valueCoding": { - "code": "LA14348-9", - "system": "http://loinc.org", - "display": "Naproxen, ketoprofen or other non-steroidal" - } - }, - { - "valueCoding": { - "code": "LA28487-9", - "system": "http://loinc.org", - "display": "Penicillin" - } - }, - { - "valueCoding": { - "code": "LA30118-6", - "system": "http://loinc.org", - "display": "Sulfa drugs" - } - } - ], - "extension": [ - { - "url": "http://hl7.org/fhir/StructureDefinition/questionnaire-itemControl", - "valueCodeableConcept": { - "coding": [ - { - "code": "inline-choice" - } - ] - } - } - ] - }, - { - "text": "Substance", - "type": "choice", - "linkId": "substance-food", - "enableWhen": [ - { - "question": "type", - "operator": "=", - "answerCoding": { - "code": "414285001", - "system": "http://snomed.ct" - } - } - ], - "answerOption": [ - { - "valueCoding": { - "code": "102259006", - "system": "http://snomed.ct", - "display": "Citrus fruit" - } - }, - { - "valueCoding": { - "code": "102260001", - "system": "http://snomed.ct", - "display": "Peanut butter" - } - }, - { - "valueCoding": { - "code": "102261002", - "system": "http://snomed.ct", - "display": "Strawberry" - } - }, - { - "valueCoding": { - "code": "102262009", - "system": "http://snomed.ct", - "display": "Chocolate" - } - }, - { - "valueCoding": { - "code": "102263004", - "system": "http://snomed.ct", - "display": "Eggs" - } - }, - { - "valueCoding": { - "code": "102264005", - "system": "http://snomed.ct", - "display": "Cheese" - } - } - ], - "extension": [ - { - "url": "http://hl7.org/fhir/StructureDefinition/questionnaire-itemControl", - "valueCodeableConcept": { - "coding": [ - { - "code": "inline-choice" - } - ] - } - } - ] - }, - { - "text": "Substance", - "type": "choice", - "linkId": "substance-environmental", - "enableWhen": [ - { - "question": "type", - "operator": "=", - "answerCoding": { - "code": "426232007", - "system": "http://snomed.ct" - } - } - ], - "answerOption": [ - { - "valueCoding": { - "code": "111088007", - "system": "http://snomed.ct", - "display": "Latex" - } - }, - { - "valueCoding": { - "code": "256259004", - "system": "http://snomed.ct", - "display": "Pollen" - } - }, - { - "valueCoding": { - "code": "256277009", - "system": "http://snomed.ct", - "display": "Grass pollen" - } - }, - { - "valueCoding": { - "code": "256417003", - "system": "http://snomed.ct", - "display": "Horse dander" - } - } - ], - "extension": [ - { - "url": "http://hl7.org/fhir/StructureDefinition/questionnaire-itemControl", - "valueCodeableConcept": { - "coding": [ - { - "code": "inline-choice" - } - ] - } - } - ] - }, - { - "text": "Notes", - "type": "string", - "linkId": "notes" - }, - { - "text": "Active", - "type": "string", - "initial": [ - { - "valueCoding": { - "code": "active", - "system": "http://terminology.hl7.org/ValueSet/allergyintolerance-clinical", - "display": "Active" - } - } - ], - "linkId": "status", - "extension": [ - { - "url": "http://hl7.org/fhir/StructureDefinition/questionnaire-hidden", - "valueBoolean": true - } - ] - } - ], - "resourceType": "Questionnaire", - "extension": [ - { - "url": "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-launchContext", - "extension": [ - { - "url": "name", - "valueCoding": { - "system": "http://hl7.org/fhir/uv/sdc/CodeSystem/launchContext", - "code": "LaunchPatient" - } - }, - { - "url": "type", - "valueCode": "Patient" - } - ] - }, - { - "url": "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-launchContext", - "extension": [ - { - "url": "name", - "valueCoding": { - "system": "http://hl7.org/fhir/uv/sdc/CodeSystem/launchContext", - "code": "Author" - } - }, - { - "url": "type", - "valueCode": "Resource" - } - ] - }, - { - "url": "http://beda.software/fhir-extensions/questionnaire-mapper", - "valueReference": { - "reference": "Mapping/allergy-extract" - } - } - ], - "status": "active", - "id": "allergies", - "url": "https://aidbox.emr.beda.software/ui/console#/entities/Questionnaire/allergies" -} \ No newline at end of file diff --git a/sdc-qrf/src/converter/__tests__/resources/questionnaire_fhir/beverages.json b/sdc-qrf/src/converter/__tests__/resources/questionnaire_fhir/beverages.json deleted file mode 100644 index 4b84b90e..00000000 --- a/sdc-qrf/src/converter/__tests__/resources/questionnaire_fhir/beverages.json +++ /dev/null @@ -1,99 +0,0 @@ -{ - "subjectType": ["Patient"], - "meta": { - "profile": ["https://beda.software/beda-emr-questionnaire"], - "lastUpdated": "2023-04-10T03:43:34.792167Z", - "versionId": "694", - "extension": [ - { - "url": "ex:createdAt", - "valueInstant": "2023-04-05T05:22:35.752466Z" - } - ] - }, - "name": "Beverages", - "item": [ - { - "linkId": "slider", - "type": "decimal", - "extension": [ - { - "url": "http://hl7.org/fhir/StructureDefinition/questionnaire-itemControl", - "valueCodeableConcept": { - "coding": [ - { - "code": "slider" - } - ] - } - }, - { - "url": "http://hl7.org/fhir/StructureDefinition/questionnaire-sliderStepValue", - "valueInteger": 2 - }, - { - "url": "https://beda.software/fhir-emr-questionnaire/slider-start", - "valueInteger": 1 - }, - { - "url": "https://beda.software/fhir-emr-questionnaire/slider-stop", - "valueInteger": 20 - }, - { - "url": "https://beda.software/fhir-emr-questionnaire/help-text", - "valueString": "How many beverages you are consuming per day?" - }, - { - "url": "https://beda.software/fhir-emr-questionnaire/slider-stop-label", - "valueString": "20+" - } - ], - "text": "Frequency per week" - }, - { - "text": "Beverage", - "type": "choice", - "linkId": "beverage-type", - "extension": [ - { - "url": "http://hl7.org/fhir/StructureDefinition/questionnaire-itemControl", - "valueCodeableConcept": { - "coding": [ - { - "code": "solid-radio-button" - } - ] - } - }, - { - "url": "https://beda.software/fhir-emr-questionnaire/adjust-last-to-right", - "valueBoolean": true - } - ], - "answerOption": [ - { - "valueCoding": { - "code": "beer", - "display": "Beer" - } - }, - { - "valueCoding": { - "code": "wine", - "display": "Wine" - } - }, - { - "valueCoding": { - "code": "none", - "display": "None" - } - } - ] - } - ], - "resourceType": "Questionnaire", - "status": "draft", - "id": "beverages", - "url": "https://aidbox.emr.beda.software/ui/console#/entities/Questionnaire/baverages" -} diff --git a/sdc-qrf/src/converter/__tests__/resources/questionnaire_fhir/choice_answer_option.json b/sdc-qrf/src/converter/__tests__/resources/questionnaire_fhir/choice_answer_option.json deleted file mode 100644 index 0605e445..00000000 --- a/sdc-qrf/src/converter/__tests__/resources/questionnaire_fhir/choice_answer_option.json +++ /dev/null @@ -1,49 +0,0 @@ -{ - "item": [ - { - "text": "What is your favorite color?", - "type": "choice", - "linkId": "1", - "answerOption": [ - { - "valueCoding": { - "code": "red", - "system": "http://example.org/colors", - "display": "Red" - } - }, - { - "valueCoding": { - "code": "blue", - "system": "http://example.org/colors", - "display": "Blue" - } - }, - { - "valueReference": { - "display": "Other", - "reference": "Color/123" - } - }, - { - "valueString": "I don't have a favorite color" - } - ] - } - ], - "status": "draft", - "subjectType": ["Patient"], - "id": "example", - "resourceType": "Questionnaire", - "meta": { - "profile": ["https://beda.software/beda-emr-questionnaire"], - "lastUpdated": "2023-04-24T00:09:09.518780Z", - "versionId": "205", - "extension": [ - { - "url": "ex:createdAt", - "valueInstant": "2023-04-24T00:09:09.518780Z" - } - ] - } -} diff --git a/sdc-qrf/src/converter/__tests__/resources/questionnaire_fhir/consent.json b/sdc-qrf/src/converter/__tests__/resources/questionnaire_fhir/consent.json deleted file mode 100644 index 4cede4c7..00000000 --- a/sdc-qrf/src/converter/__tests__/resources/questionnaire_fhir/consent.json +++ /dev/null @@ -1,119 +0,0 @@ -{ - "subjectType": ["Encounter", "Patient"], - "meta": { - "profile": ["https://beda.software/beda-emr-questionnaire"], - "lastUpdated": "2023-05-04T06:32:48.956795Z", - "versionId": "1087", - "extension": [ - { - "url": "ex:createdAt", - "valueInstant": "2023-05-04T05:27:07.639041Z" - } - ] - }, - "name": "Consent", - "item": [ - { - "text": "Practitioner", - "type": "reference", - "linkId": "practitioner", - "repeats": false, - "required": true, - "extension": [ - { - "url": "http://hl7.org/fhir/StructureDefinition/questionnaire-referenceResource", - "valueCode": "Practitioner" - }, - { - "url": "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-choiceColumn", - "extension": [ - { - "url": "forDisplay", - "valueBoolean": true - }, - { - "url": "path", - "valueString": "name.given.first() + ' ' + name.family" - } - ] - }, - { - "url": "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-answerExpression", - "valueExpression": { - "language": "application/x-fhir-query", - "expression": "Practitioner" - } - } - ] - }, - { - "text": "Service", - "type": "reference", - "linkId": "service", - "repeats": false, - "required": true, - "extension": [ - { - "url": "http://hl7.org/fhir/StructureDefinition/questionnaire-referenceResource", - "valueCode": "Endpoint" - }, - { - "url": "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-choiceColumn", - "extension": [ - { - "url": "forDisplay", - "valueBoolean": true - }, - { - "url": "path", - "valueString": "name" - } - ] - }, - { - "url": "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-answerExpression", - "valueExpression": { - "language": "application/x-fhir-query", - "expression": "Endpoint?identifier=https://fhir.emr.beda.software/CodeSystem/consent-subject|&status=active" - } - } - ] - }, - { - "text": "Provision", - "type": "choice", - "linkId": "provision", - "repeats": false, - "required": true, - "answerOption": [ - { - "valueCoding": { - "code": "deny", - "system": "http://hl7.org/fhir/consent-provision-type", - "display": "Deny" - } - }, - { - "valueCoding": { - "code": "permit", - "system": "http://hl7.org/fhir/consent-provision-type", - "display": "Permit" - } - } - ] - } - ], - "resourceType": "Questionnaire", - "title": "Sign-off Consent", - "extension": [ - { - "url": "http://beda.software/fhir-extensions/questionnaire-mapper", - "valueReference": { - "reference": "Mapping/consent-extract" - } - } - ], - "status": "active", - "id": "consent", - "url": "https://aidbox.emr.beda.software/ui/console#/entities/Questionnaire/consent" -} diff --git a/sdc-qrf/src/converter/__tests__/resources/questionnaire_fhir/enable_when.json b/sdc-qrf/src/converter/__tests__/resources/questionnaire_fhir/enable_when.json deleted file mode 100644 index ec0db7fd..00000000 --- a/sdc-qrf/src/converter/__tests__/resources/questionnaire_fhir/enable_when.json +++ /dev/null @@ -1,87 +0,0 @@ -{ - "item": [ - { - "text": "Do you smoke?", - "type": "choice", - "linkId": "1", - "enableWhen": [ - { - "question": "2", - "operator": "exists", - "answerBoolean": true - }, - { - "question": "3", - "operator": "=", - "answerDecimal": 10 - }, - { - "question": "4", - "operator": "=", - "answerInteger": 5 - }, - { - "question": "5", - "operator": "=", - "answerDate": "2023-05-07" - }, - { - "question": "6", - "operator": "=", - "answerDateTime": "2023-04-06T02:48:16+00:00" - }, - { - "question": "7", - "operator": "=", - "answerTime": "10:30:00" - }, - { - "question": "8", - "operator": "=", - "answerString": "example" - }, - { - "question": "9", - "operator": "=", - "answerCoding": { - "code": "123456", - "system": "http://snomed.info/sct" - } - }, - { - "question": "10", - "operator": "=", - "answerQuantity": { - "code": "mg", - "unit": "mg", - "value": 5, - "system": "http://unitsofmeasure.org" - } - }, - { - "question": "11", - "operator": "=", - "answerReference": { - "display": "example patient", - "reference": "Patient/example" - } - } - ] - } - ], - "status": "active", - "subjectType": ["Patient"], - "id": "example", - "resourceType": "Questionnaire", - "meta": { - "profile": ["https://beda.software/beda-emr-questionnaire"], - "lastUpdated": "2023-05-07T09:04:40.566686Z", - "versionId": "459", - "extension": [ - { - "url": "ex:createdAt", - "valueInstant": "2023-05-07T09:04:40.566686Z" - } - ] - } -} diff --git a/sdc-qrf/src/converter/__tests__/resources/questionnaire_fhir/encounter_create.json b/sdc-qrf/src/converter/__tests__/resources/questionnaire_fhir/encounter_create.json deleted file mode 100644 index cecf1058..00000000 --- a/sdc-qrf/src/converter/__tests__/resources/questionnaire_fhir/encounter_create.json +++ /dev/null @@ -1,171 +0,0 @@ -{ - "meta": { - "profile": ["https://beda.software/beda-emr-questionnaire"], - "lastUpdated": "2023-04-10T03:43:34.792167Z", - "versionId": "694", - "extension": [ - { - "url": "ex:createdAt", - "valueInstant": "2023-04-05T05:22:35.752466Z" - } - ] - }, - "name": "encounter-create", - "item": [ - { - "text": "PatientId", - "type": "string", - "extension": [ - { - "url": "http://hl7.org/fhir/StructureDefinition/questionnaire-hidden", - "valueBoolean": true - }, - { - "url": "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-initialExpression", - "valueExpression": { - "language": "text/fhirpath", - "expression": "%Patient.id" - } - } - ], - "linkId": "patientId" - }, - { - "text": "PatientName", - "type": "string", - "linkId": "patientName", - "readOnly": true, - "extension": [ - { - "url": "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-initialExpression", - "valueExpression": { - "language": "text/fhirpath", - "expression": "%Patient.name.given[0] + ' ' + %Patient.name.family" - } - } - ] - }, - { - "text": "Practitioner", - "type": "reference", - "linkId": "practitioner-role", - "required": true, - "extension": [ - { - "url": "http://hl7.org/fhir/StructureDefinition/questionnaire-referenceResource", - "valueCode": "PractitionerRole" - }, - { - "extension": [ - { - "url": "forDisplay", - "valueBoolean": true - }, - { - "url": "path", - "valueString": "practitioner.resource.name.given.first() + ' ' + practitioner.resource.name.family + ' - ' + specialty.first().coding.display" - } - ], - "url": "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-choiceColumn" - }, - { - "valueExpression": { - "language": "application/x-fhir-query", - "expression": "PractitionerRole?_assoc=practitioner" - }, - "url": "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-answerExpression" - } - ] - }, - { - "text": "Service", - "type": "choice", - "linkId": "service", - "repeats": false, - "required": true, - "answerOption": [ - { - "valueCoding": { - "code": "consultation", - "system": "http://fhir.org/guides/argonaut-scheduling/CodeSystem/visit-type", - "display": "The first appointment" - } - }, - { - "valueCoding": { - "code": "follow-up", - "system": "http://fhir.org/guides/argonaut-scheduling/CodeSystem/visit-type", - "display": "A follow up visit" - } - } - ] - }, - { - "text": "Date", - "type": "date", - "linkId": "date" - }, - { - "item": [ - { - "type": "time", - "linkId": "start-time" - }, - { - "type": "time", - "linkId": "end-time" - } - ], - "text": "Time", - "type": "group", - "linkId": "Time period", - "extension": [ - { - "url": "http://hl7.org/fhir/StructureDefinition/questionnaire-itemControl", - "valueCodeableConcept": { - "coding": [ - { - "code": "time-range-picker" - } - ] - } - } - ] - } - ], - "resourceType": "Questionnaire", - "title": "Encounter create", - "extension": [ - { - "url": "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-launchContext", - "extension": [ - { - "url": "name", - "valueCoding": { - "code": "Patient", - "system": "http://hl7.org/fhir/uv/sdc/CodeSystem/launchContext" - } - }, - { - "url": "type", - "valueCode": "Patient" - } - ] - }, - { - "url": "http://beda.software/fhir-extensions/questionnaire-mapper", - "valueReference": { - "reference": "Mapping/encounter-create-extract" - } - }, - { - "url": "http://beda.software/fhir-extensions/questionnaire-mapper", - "valueReference": { - "reference": "Mapping/test-mapper" - } - } - ], - "status": "active", - "id": "encounter-create", - "url": "https://aidbox.emr.beda.software/ui/console#/entities/Questionnaire/encounter-create" -} diff --git a/sdc-qrf/src/converter/__tests__/resources/questionnaire_fhir/gad_7.json b/sdc-qrf/src/converter/__tests__/resources/questionnaire_fhir/gad_7.json deleted file mode 100644 index 5e4a7ab7..00000000 --- a/sdc-qrf/src/converter/__tests__/resources/questionnaire_fhir/gad_7.json +++ /dev/null @@ -1,489 +0,0 @@ -{ - "subjectType": [ - "Encounter", - "Patient" - ], - "meta": { - "profile": [ - "https://beda.software/beda-emr-questionnaire" - ], - "lastUpdated": "2023-04-10T03:43:34.792167Z", - "versionId": "694", - "extension": [ - { - "url": "ex:createdAt", - "valueInstant": "2023-04-05T05:22:35.752466Z" - } - ] - }, - "name": "GAD-7", - "item": [ - { - "text": "DateTime", - "type": "dateTime", - "extension": [ - { - "url": "http://hl7.org/fhir/StructureDefinition/questionnaire-hidden", - "valueBoolean": true - }, - { - "url": "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-initialExpression", - "valueExpression": { - "language": "text/fhirpath", - "expression": "now()" - } - } - ], - "linkId": "dateTime" - }, - { - "text": "PatientId", - "type": "string", - "extension": [ - { - "url": "http://hl7.org/fhir/StructureDefinition/questionnaire-hidden", - "valueBoolean": true - }, - { - "url": "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-initialExpression", - "valueExpression": { - "language": "text/fhirpath", - "expression": "%Patient.id" - } - } - ], - "linkId": "patientId" - }, - { - "text": "PatientName", - "type": "string", - "extension": [ - { - "url": "http://hl7.org/fhir/StructureDefinition/questionnaire-hidden", - "valueBoolean": true - }, - { - "url": "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-initialExpression", - "valueExpression": { - "language": "text/fhirpath", - "expression": "%Patient.name.given[0] + ' ' + %Patient.name.family" - } - } - ], - "linkId": "patientName" - }, - { - "item": [ - { - "text": "Feeling nervous, anxious, or on edge", - "type": "choice", - "linkId": "69725-0", - "required": true, - "answerOption": [ - { - "valueCoding": { - "code": "LA6568-5", - "system": "http://loinc.org", - "display": "Not at all" - } - }, - { - "valueCoding": { - "code": "LA6569-3", - "system": "http://loinc.org", - "display": "Several days" - } - }, - { - "valueCoding": { - "code": "LA6570-1", - "system": "http://loinc.org", - "display": "More than half the days" - } - }, - { - "valueCoding": { - "code": "LA6571-9", - "system": "http://loinc.org", - "display": "Nearly every day" - } - } - ], - "extension": [ - { - "url": "http://hl7.org/fhir/StructureDefinition/questionnaire-itemControl", - "valueCodeableConcept": { - "coding": [ - { - "code": "inline-choice" - } - ] - } - } - ] - }, - { - "text": "Not being able to stop or control worrying", - "type": "choice", - "linkId": "68509-9", - "required": true, - "answerOption": [ - { - "valueCoding": { - "code": "LA6568-5", - "system": "http://loinc.org", - "display": "Not at all" - } - }, - { - "valueCoding": { - "code": "LA6569-3", - "system": "http://loinc.org", - "display": "Several days" - } - }, - { - "valueCoding": { - "code": "LA6570-1", - "system": "http://loinc.org", - "display": "More than half the days" - } - }, - { - "valueCoding": { - "code": "LA6571-9", - "system": "http://loinc.org", - "display": "Nearly every day" - } - } - ], - "extension": [ - { - "url": "http://hl7.org/fhir/StructureDefinition/questionnaire-itemControl", - "valueCodeableConcept": { - "coding": [ - { - "code": "inline-choice" - } - ] - } - } - ] - }, - { - "text": "Worrying too much about different things", - "type": "choice", - "linkId": "69733-4", - "required": true, - "answerOption": [ - { - "valueCoding": { - "code": "LA6568-5", - "system": "http://loinc.org", - "display": "Not at all" - } - }, - { - "valueCoding": { - "code": "LA6569-3", - "system": "http://loinc.org", - "display": "Several days" - } - }, - { - "valueCoding": { - "code": "LA6570-1", - "system": "http://loinc.org", - "display": "More than half the days" - } - }, - { - "valueCoding": { - "code": "LA6571-9", - "system": "http://loinc.org", - "display": "Nearly every day" - } - } - ], - "extension": [ - { - "url": "http://hl7.org/fhir/StructureDefinition/questionnaire-itemControl", - "valueCodeableConcept": { - "coding": [ - { - "code": "inline-choice" - } - ] - } - } - ] - }, - { - "text": "Trouble relaxing", - "type": "choice", - "linkId": "69734-2", - "required": true, - "answerOption": [ - { - "valueCoding": { - "code": "LA6568-5", - "system": "http://loinc.org", - "display": "Not at all" - } - }, - { - "valueCoding": { - "code": "LA6569-3", - "system": "http://loinc.org", - "display": "Several days" - } - }, - { - "valueCoding": { - "code": "LA6570-1", - "system": "http://loinc.org", - "display": "More than half the days" - } - }, - { - "valueCoding": { - "code": "LA6571-9", - "system": "http://loinc.org", - "display": "Nearly every day" - } - } - ], - "extension": [ - { - "url": "http://hl7.org/fhir/StructureDefinition/questionnaire-itemControl", - "valueCodeableConcept": { - "coding": [ - { - "code": "inline-choice" - } - ] - } - } - ] - }, - { - "text": "Being so restless that it is hard to sit still", - "type": "choice", - "linkId": "69735-9", - "required": true, - "answerOption": [ - { - "valueCoding": { - "code": "LA6568-5", - "system": "http://loinc.org", - "display": "Not at all" - } - }, - { - "valueCoding": { - "code": "LA6569-3", - "system": "http://loinc.org", - "display": "Several days" - } - }, - { - "valueCoding": { - "code": "LA6570-1", - "system": "http://loinc.org", - "display": "More than half the days" - } - }, - { - "valueCoding": { - "code": "LA6571-9", - "system": "http://loinc.org", - "display": "Nearly every day" - } - } - ], - "extension": [ - { - "url": "http://hl7.org/fhir/StructureDefinition/questionnaire-itemControl", - "valueCodeableConcept": { - "coding": [ - { - "code": "inline-choice" - } - ] - } - } - ] - }, - { - "text": "Becoming easily annoyed or irritable", - "type": "choice", - "linkId": "69689-8", - "required": true, - "answerOption": [ - { - "valueCoding": { - "code": "LA6568-5", - "system": "http://loinc.org", - "display": "Not at all" - } - }, - { - "valueCoding": { - "code": "LA6569-3", - "system": "http://loinc.org", - "display": "Several days" - } - }, - { - "valueCoding": { - "code": "LA6570-1", - "system": "http://loinc.org", - "display": "More than half the days" - } - }, - { - "valueCoding": { - "code": "LA6571-9", - "system": "http://loinc.org", - "display": "Nearly every day" - } - } - ], - "extension": [ - { - "url": "http://hl7.org/fhir/StructureDefinition/questionnaire-itemControl", - "valueCodeableConcept": { - "coding": [ - { - "code": "inline-choice" - } - ] - } - } - ] - }, - { - "text": "Feeling afraid, as if something awful might happen", - "type": "choice", - "linkId": "69736-7", - "required": true, - "answerOption": [ - { - "valueCoding": { - "code": "LA6568-5", - "system": "http://loinc.org", - "display": "Not at all" - } - }, - { - "valueCoding": { - "code": "LA6569-3", - "system": "http://loinc.org", - "display": "Several days" - } - }, - { - "valueCoding": { - "code": "LA6570-1", - "system": "http://loinc.org", - "display": "More than half the days" - } - }, - { - "valueCoding": { - "code": "LA6571-9", - "system": "http://loinc.org", - "display": "Nearly every day" - } - } - ], - "extension": [ - { - "url": "http://hl7.org/fhir/StructureDefinition/questionnaire-itemControl", - "valueCodeableConcept": { - "coding": [ - { - "code": "inline-choice" - } - ] - } - } - ] - }, - { - "text": "GAD-7 Anxiety Severity Score", - "type": "integer", - "linkId": "anxiety-score", - "readOnly": true, - "required": true, - "extension": [ - { - "url": "http://hl7.org/fhir/StructureDefinition/questionnaire-itemControl", - "valueCodeableConcept": { - "coding": [ - { - "code": "anxiety-score" - } - ] - } - }, - { - "url": "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-calculatedExpression", - "valueExpression": { - "language": "text/fhirpath", - "expression": "%QuestionnaireResponse.item.item.answer.children().children().where(code='LA6569-3').count() + %QuestionnaireResponse.item.item.answer.children().children().where(code='LA6570-1').count() * 2 + %QuestionnaireResponse.item.item.answer.children().children().where(code='LA6571-9').count() * 3" - } - } - ] - } - ], - "text": "Over the last two weeks, how often have you been bothered by the following problems?", - "type": "group", - "linkId": "gad-7" - } - ], - "resourceType": "Questionnaire", - "extension": [ - { - "url": "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-launchContext", - "extension": [ - { - "url": "name", - "valueCoding": { - "system": "http://hl7.org/fhir/uv/sdc/CodeSystem/launchContext", - "code": "Patient" - } - }, - { - "url": "type", - "valueCode": "Patient" - } - ] - }, - { - "url": "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-launchContext", - "extension": [ - { - "url": "name", - "valueCoding": { - "system": "http://hl7.org/fhir/uv/sdc/CodeSystem/launchContext", - "code": "Author" - } - }, - { - "url": "type", - "valueCode": "Resource" - } - ] - }, - { - "url": "http://beda.software/fhir-extensions/questionnaire-mapper", - "valueReference": { - "reference": "Mapping/gad-7-extract" - } - } - ], - "status": "active", - "id": "gad-7", - "url": "https://aidbox.emr.beda.software/ui/console#/entities/Questionnaire/gad7" -} \ No newline at end of file diff --git a/sdc-qrf/src/converter/__tests__/resources/questionnaire_fhir/immunization.json b/sdc-qrf/src/converter/__tests__/resources/questionnaire_fhir/immunization.json deleted file mode 100644 index 818d8ca8..00000000 --- a/sdc-qrf/src/converter/__tests__/resources/questionnaire_fhir/immunization.json +++ /dev/null @@ -1,215 +0,0 @@ -{ - "subjectType": [ - "Encounter", - "Patient" - ], - "meta": { - "profile": [ - "https://beda.software/beda-emr-questionnaire" - ], - "lastUpdated": "2023-04-10T03:43:34.792167Z", - "versionId": "694", - "extension": [ - { - "url": "ex:createdAt", - "valueInstant": "2023-04-05T05:22:35.752466Z" - } - ] - }, - "name": "Immunization", - "item": [ - { - "text": "DateTime", - "type": "dateTime", - "extension": [ - { - "url": "http://hl7.org/fhir/StructureDefinition/questionnaire-hidden", - "valueBoolean": true - }, - { - "url": "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-initialExpression", - "valueExpression": { - "language": "text/fhirpath", - "expression": "now()" - } - } - ], - "linkId": "dateTime" - }, - { - "text": "EncounterId", - "type": "string", - "extension": [ - { - "url": "http://hl7.org/fhir/StructureDefinition/questionnaire-hidden", - "valueBoolean": true - }, - { - "url": "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-initialExpression", - "valueExpression": { - "language": "text/fhirpath", - "expression": "%Encounter.id" - } - } - ], - "linkId": "encounterId" - }, - { - "text": "PatientId", - "type": "string", - "extension": [ - { - "url": "http://hl7.org/fhir/StructureDefinition/questionnaire-hidden", - "valueBoolean": true - }, - { - "url": "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-initialExpression", - "valueExpression": { - "language": "text/fhirpath", - "expression": "%Patient.id" - } - } - ], - "linkId": "patientId", - "required": true - }, - { - "text": "PatientName", - "type": "string", - "extension": [ - { - "url": "http://hl7.org/fhir/StructureDefinition/questionnaire-hidden", - "valueBoolean": true - }, - { - "url": "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-initialExpression", - "valueExpression": { - "language": "text/fhirpath", - "expression": "%Patient.name.given[0] + ' ' + %Patient.name.family" - } - } - ], - "linkId": "patientName" - }, - { - "text": "Vaccine", - "type": "choice", - "linkId": "vaccine-code", - "required": true, - "answerOption": [ - { - "valueCoding": { - "code": "143", - "system": "http://hl7.org/fhir/sid/cvx", - "display": "Adenovirus types 4 and 7" - } - }, - { - "valueCoding": { - "code": "24", - "system": "http://hl7.org/fhir/sid/cvx", - "display": "anthrax" - } - }, - { - "valueCoding": { - "code": "173", - "system": "http://hl7.org/fhir/sid/cvx", - "display": "cholera, BivWC" - } - }, - { - "valueCoding": { - "code": "56", - "system": "http://hl7.org/fhir/sid/cvx", - "display": "dengue fever" - } - }, - { - "valueCoding": { - "code": "12", - "system": "http://hl7.org/fhir/sid/cvx", - "display": "diphtheria antitoxin" - } - }, - { - "valueCoding": { - "code": "52", - "system": "http://hl7.org/fhir/sid/cvx", - "display": "Hep A, adult" - } - }, - { - "valueCoding": { - "code": "58", - "system": "http://hl7.org/fhir/sid/cvx", - "display": "Hep C" - } - }, - { - "valueCoding": { - "code": "60", - "system": "http://hl7.org/fhir/sid/cvx", - "display": "herpes simplex 2" - } - }, - { - "valueCoding": { - "code": "61", - "system": "http://hl7.org/fhir/sid/cvx", - "display": "HIV" - } - } - ] - }, - { - "text": "Date of injection", - "type": "date", - "linkId": "date-of-injection" - } - ], - "resourceType": "Questionnaire", - "extension": [ - { - "url": "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-launchContext", - "extension": [ - { - "url": "name", - "valueCoding": { - "system": "http://hl7.org/fhir/uv/sdc/CodeSystem/launchContext", - "code": "Patient" - } - }, - { - "url": "type", - "valueCode": "Patient" - } - ] - }, - { - "url": "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-launchContext", - "extension": [ - { - "url": "name", - "valueCoding": { - "system": "http://hl7.org/fhir/uv/sdc/CodeSystem/launchContext", - "code": "Author" - } - }, - { - "url": "type", - "valueCode": "Resource" - } - ] - }, - { - "url": "http://beda.software/fhir-extensions/questionnaire-mapper", - "valueReference": { - "reference": "Mapping/immunization-extract" - } - } - ], - "status": "active", - "id": "immunization", - "url": "https://aidbox.emr.beda.software/ui/console#/entities/Questionnaire/immunization" -} \ No newline at end of file diff --git a/sdc-qrf/src/converter/__tests__/resources/questionnaire_fhir/medication.json b/sdc-qrf/src/converter/__tests__/resources/questionnaire_fhir/medication.json deleted file mode 100644 index 5cdf20cd..00000000 --- a/sdc-qrf/src/converter/__tests__/resources/questionnaire_fhir/medication.json +++ /dev/null @@ -1,226 +0,0 @@ -{ - "subjectType": ["Encounter", "Patient"], - "meta": { - "profile": ["https://beda.software/beda-emr-questionnaire"], - "lastUpdated": "2023-04-10T03:43:34.792167Z", - "versionId": "694", - "extension": [ - { - "url": "ex:createdAt", - "valueInstant": "2023-04-05T05:22:35.752466Z" - } - ] - }, - "name": "Medication", - "item": [ - { - "text": "DateTime", - "type": "dateTime", - "extension": [ - { - "url": "http://hl7.org/fhir/StructureDefinition/questionnaire-hidden", - "valueBoolean": true - }, - { - "url": "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-initialExpression", - "valueExpression": { - "language": "text/fhirpath", - "expression": "now()" - } - } - ], - "linkId": "dateTime" - }, - { - "text": "EncounterId", - "type": "string", - "extension": [ - { - "url": "http://hl7.org/fhir/StructureDefinition/questionnaire-hidden", - "valueBoolean": true - }, - { - "url": "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-initialExpression", - "valueExpression": { - "language": "text/fhirpath", - "expression": "%Encounter.id" - } - } - ], - "linkId": "encounterId" - }, - { - "text": "PatientId", - "type": "string", - "extension": [ - { - "url": "http://hl7.org/fhir/StructureDefinition/questionnaire-hidden", - "valueBoolean": true - }, - { - "url": "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-initialExpression", - "valueExpression": { - "language": "text/fhirpath", - "expression": "%Patient.id" - } - } - ], - "linkId": "patientId", - "required": true - }, - { - "text": "PatientName", - "type": "string", - "extension": [ - { - "url": "http://hl7.org/fhir/StructureDefinition/questionnaire-hidden", - "valueBoolean": true - }, - { - "url": "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-initialExpression", - "valueExpression": { - "language": "text/fhirpath", - "expression": "%Patient.name.given[0] + ' ' + %Patient.name.family" - } - } - ], - "linkId": "patientName" - }, - { - "text": "Medication name", - "type": "choice", - "linkId": "medication", - "required": true, - "answerOption": [ - { - "valueCoding": { - "code": "261000", - "system": "http://snomed.info/sct", - "display": "Codeine phosphate" - } - }, - { - "valueCoding": { - "code": "2336001", - "system": "http://snomed.info/sct", - "display": "Fibrinogen Tokyo II" - } - }, - { - "valueCoding": { - "code": "363000", - "system": "http://snomed.info/sct", - "display": "Fibrinogen San Juan" - } - }, - { - "valueCoding": { - "code": "519005", - "system": "http://snomed.info/sct", - "display": "Free protein S" - } - }, - { - "valueCoding": { - "code": "585007", - "system": "http://snomed.info/sct", - "display": "SP - Substance P" - } - }, - { - "valueCoding": { - "code": "693002", - "system": "http://snomed.info/sct", - "display": "Trichothecene" - } - }, - { - "valueCoding": { - "code": "698006", - "system": "http://snomed.info/sct", - "display": "Erythromycin lactobionate" - } - }, - { - "valueCoding": { - "code": "699003", - "system": "http://snomed.info/sct", - "display": "Coal tar extract" - } - }, - { - "valueCoding": { - "code": "747006", - "system": "http://snomed.info/sct", - "display": "Oxamniquine" - } - } - ] - }, - { - "text": "Dosage", - "type": "string", - "linkId": "dosage", - "required": true - }, - { - "text": "Start Date", - "type": "date", - "linkId": "start-date" - }, - { - "text": "Stop Date", - "type": "date", - "linkId": "stop-date" - }, - { - "text": "Notes", - "type": "string", - "linkId": "notes" - } - ], - "resourceType": "Questionnaire", - "extension": [ - { - "url": "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-launchContext", - "extension": [ - { - "url": "name", - "valueCoding": { - "system": "http://hl7.org/fhir/uv/sdc/CodeSystem/launchContext", - "code": "Patient" - } - }, - { - "url": "type", - "valueCode": "Patient" - } - ] - }, - { - "url": "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-launchContext", - "extension": [ - { - "url": "name", - "valueCoding": { - "system": "http://hl7.org/fhir/uv/sdc/CodeSystem/launchContext", - "code": "Author" - } - }, - { - "url": "type", - "valueCode": "Resource" - } - ] - }, - { - "url": "http://beda.software/fhir-extensions/questionnaire-mapper", - "valueReference": { - "reference": "Mapping/medication-statement-extract" - } - } - ], - "status": "active", - "id": "medication", - "url": "https://aidbox.emr.beda.software/ui/console#/entities/Questionnaire/medication" -} diff --git a/sdc-qrf/src/converter/__tests__/resources/questionnaire_fhir/multiple_type_launch_context.json b/sdc-qrf/src/converter/__tests__/resources/questionnaire_fhir/multiple_type_launch_context.json deleted file mode 100644 index 5a3d3623..00000000 --- a/sdc-qrf/src/converter/__tests__/resources/questionnaire_fhir/multiple_type_launch_context.json +++ /dev/null @@ -1,416 +0,0 @@ -{ - "subjectType": ["Encounter", "Patient"], - "meta": { - "profile": ["https://beda.software/beda-emr-questionnaire"], - "lastUpdated": "2023-04-10T03:43:34.792167Z", - "versionId": "694", - "extension": [ - { - "url": "ex:createdAt", - "valueInstant": "2023-04-05T05:22:35.752466Z" - } - ] - }, - "name": "Allergies", - "item": [ - { - "text": "DateTime", - "type": "dateTime", - "extension": [ - { - "url": "http://hl7.org/fhir/StructureDefinition/questionnaire-hidden", - "valueBoolean": true - }, - { - "url": "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-initialExpression", - "valueExpression": { - "language": "text/fhirpath", - "expression": "now()" - } - } - ], - "linkId": "dateTime" - }, - { - "text": "PatientId", - "type": "string", - "extension": [ - { - "url": "http://hl7.org/fhir/StructureDefinition/questionnaire-hidden", - "valueBoolean": true - }, - { - "url": "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-initialExpression", - "valueExpression": { - "language": "text/fhirpath", - "expression": "%Patient.id" - } - } - ], - "linkId": "patientId" - }, - { - "text": "PatientName", - "type": "string", - "extension": [ - { - "url": "http://hl7.org/fhir/StructureDefinition/questionnaire-hidden", - "valueBoolean": true - }, - { - "url": "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-initialExpression", - "valueExpression": { - "language": "text/fhirpath", - "expression": "%Patient.name.given[0] + ' ' + %Patient.name.family" - } - } - ], - "linkId": "patientName" - }, - { - "text": "Type", - "type": "choice", - "linkId": "type", - "required": true, - "answerOption": [ - { - "valueCoding": { - "code": "418634005", - "system": "http://hl7.org/fhir/allergy-intolerance-category", - "display": "Drug" - } - }, - { - "valueCoding": { - "code": "414285001", - "system": "http://hl7.org/fhir/allergy-intolerance-category", - "display": "Food" - } - }, - { - "valueCoding": { - "code": "426232007", - "system": "http://hl7.org/fhir/allergy-intolerance-category", - "display": "Environmental" - } - } - ], - "extension": [ - { - "url": "http://hl7.org/fhir/StructureDefinition/questionnaire-itemControl", - "valueCodeableConcept": { - "coding": [ - { - "code": "inline-choice" - } - ] - } - } - ] - }, - { - "text": "Reaction", - "type": "choice", - "linkId": "reaction", - "repeats": true, - "answerOption": [ - { - "valueCoding": { - "code": "39579001", - "system": "http://snomed.ct", - "display": "Anaphylaxis" - } - }, - { - "valueCoding": { - "code": "25064002", - "system": "http://snomed.ct", - "display": "Headache" - } - }, - { - "valueCoding": { - "code": "247472004", - "system": "http://snomed.ct", - "display": "Hives (Wheal)" - } - }, - { - "valueCoding": { - "code": "422587007", - "system": "http://snomed.ct", - "display": "Nausea" - } - }, - { - "valueCoding": { - "code": "422400008", - "system": "http://snomed.ct", - "display": "Vomiting" - } - } - ], - "extension": [ - { - "url": "http://hl7.org/fhir/StructureDefinition/questionnaire-itemControl", - "valueCodeableConcept": { - "coding": [ - { - "code": "inline-choice" - } - ] - } - } - ] - }, - { - "text": "Substance", - "type": "choice", - "linkId": "substance-drug", - "enableWhen": [ - { - "question": "type", - "operator": "=", - "answerCoding": { - "code": "418634005", - "system": "http://snomed.ct" - } - } - ], - "answerOption": [ - { - "valueCoding": { - "code": "LA26702-3", - "system": "http://loinc.org", - "display": "Aspirin" - } - }, - { - "valueCoding": { - "code": "LA30119-4", - "system": "http://loinc.org", - "display": "Iodine" - } - }, - { - "valueCoding": { - "code": "LA14348-9", - "system": "http://loinc.org", - "display": "Naproxen, ketoprofen or other non-steroidal" - } - }, - { - "valueCoding": { - "code": "LA28487-9", - "system": "http://loinc.org", - "display": "Penicillin" - } - }, - { - "valueCoding": { - "code": "LA30118-6", - "system": "http://loinc.org", - "display": "Sulfa drugs" - } - } - ], - "extension": [ - { - "url": "http://hl7.org/fhir/StructureDefinition/questionnaire-itemControl", - "valueCodeableConcept": { - "coding": [ - { - "code": "inline-choice" - } - ] - } - } - ] - }, - { - "text": "Substance", - "type": "choice", - "linkId": "substance-food", - "enableWhen": [ - { - "question": "type", - "operator": "=", - "answerCoding": { - "code": "414285001", - "system": "http://snomed.ct" - } - } - ], - "answerOption": [ - { - "valueCoding": { - "code": "102259006", - "system": "http://snomed.ct", - "display": "Citrus fruit" - } - }, - { - "valueCoding": { - "code": "102260001", - "system": "http://snomed.ct", - "display": "Peanut butter" - } - }, - { - "valueCoding": { - "code": "102261002", - "system": "http://snomed.ct", - "display": "Strawberry" - } - }, - { - "valueCoding": { - "code": "102262009", - "system": "http://snomed.ct", - "display": "Chocolate" - } - }, - { - "valueCoding": { - "code": "102263004", - "system": "http://snomed.ct", - "display": "Eggs" - } - }, - { - "valueCoding": { - "code": "102264005", - "system": "http://snomed.ct", - "display": "Cheese" - } - } - ], - "extension": [ - { - "url": "http://hl7.org/fhir/StructureDefinition/questionnaire-itemControl", - "valueCodeableConcept": { - "coding": [ - { - "code": "inline-choice" - } - ] - } - } - ] - }, - { - "text": "Substance", - "type": "choice", - "linkId": "substance-environmental", - "enableWhen": [ - { - "question": "type", - "operator": "=", - "answerCoding": { - "code": "426232007", - "system": "http://snomed.ct" - } - } - ], - "answerOption": [ - { - "valueCoding": { - "code": "111088007", - "system": "http://snomed.ct", - "display": "Latex" - } - }, - { - "valueCoding": { - "code": "256259004", - "system": "http://snomed.ct", - "display": "Pollen" - } - }, - { - "valueCoding": { - "code": "256277009", - "system": "http://snomed.ct", - "display": "Grass pollen" - } - }, - { - "valueCoding": { - "code": "256417003", - "system": "http://snomed.ct", - "display": "Horse dander" - } - } - ], - "extension": [ - { - "url": "http://hl7.org/fhir/StructureDefinition/questionnaire-itemControl", - "valueCodeableConcept": { - "coding": [ - { - "code": "inline-choice" - } - ] - } - } - ] - }, - { - "text": "Notes", - "type": "string", - "linkId": "notes" - }, - { - "text": "Active", - "type": "string", - "initial": [ - { - "valueCoding": { - "code": "active", - "system": "http://terminology.hl7.org/ValueSet/allergyintolerance-clinical", - "display": "Active" - } - } - ], - "linkId": "status", - "extension": [ - { - "url": "http://hl7.org/fhir/StructureDefinition/questionnaire-hidden", - "valueBoolean": true - } - ] - } - ], - "resourceType": "Questionnaire", - "extension": [ - { - "url": "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-launchContext", - "extension": [ - { - "url": "name", - "valueCoding": { - "system": "http://hl7.org/fhir/uv/sdc/CodeSystem/launchContext", - "code": "LaunchPatient" - } - }, - { - "url": "type", - "valueCode": "Patient" - }, - { - "url": "type", - "valueCode": "Resource" - } - ] - }, - { - "url": "http://beda.software/fhir-extensions/questionnaire-mapper", - "valueReference": { - "reference": "Mapping/allergy-extract" - } - } - ], - "status": "active", - "id": "allergies", - "url": "https://aidbox.emr.beda.software/ui/console#/entities/Questionnaire/allergies" -} diff --git a/sdc-qrf/src/converter/__tests__/resources/questionnaire_fhir/patient_create.json b/sdc-qrf/src/converter/__tests__/resources/questionnaire_fhir/patient_create.json deleted file mode 100644 index f6b009ec..00000000 --- a/sdc-qrf/src/converter/__tests__/resources/questionnaire_fhir/patient_create.json +++ /dev/null @@ -1,97 +0,0 @@ -{ - "meta": { - "profile": ["https://beda.software/beda-emr-questionnaire"], - "lastUpdated": "2023-04-10T03:43:34.792167Z", - "versionId": "694", - "extension": [ - { - "url": "ex:createdAt", - "valueInstant": "2023-04-05T05:22:35.752466Z" - } - ] - }, - "name": "patient-create", - "item": [ - { - "text": "patientId", - "type": "string", - "linkId": "patient-id", - "extension": [ - { - "url": "http://hl7.org/fhir/StructureDefinition/questionnaire-hidden", - "valueBoolean": true - } - ] - }, - { - "text": "Last name", - "type": "string", - "linkId": "last-name", - "required": true - }, - { - "text": "First name", - "type": "string", - "linkId": "first-name", - "required": true - }, - { - "text": "Middle name", - "type": "string", - "linkId": "middle-name" - }, - { - "text": "Birth date", - "type": "date", - "linkId": "birth-date" - }, - { - "text": "Gender", - "type": "choice", - "linkId": "gender", - "answerOption": [ - { - "valueString": "male" - }, - { - "valueString": "female" - } - ] - }, - { - "text": "SSN", - "type": "string", - "linkId": "ssn" - }, - { - "text": "Phone number", - "type": "string", - "linkId": "mobile", - "extension": [ - { - "url": "http://hl7.org/fhir/StructureDefinition/questionnaire-itemControl", - "valueCodeableConcept": { - "coding": [ - { - "code": "phoneWidget" - } - ] - } - } - ] - } - ], - "resourceType": "Questionnaire", - "title": "Patient create", - "extension": [ - { - "url": "http://beda.software/fhir-extensions/questionnaire-mapper", - "valueReference": { - "reference": "Mapping/patient-create" - } - } - ], - "status": "active", - "id": "patient-create", - "url": "https://aidbox.emr.beda.software/ui/console#/entities/Questionnaire/patient-create" -} diff --git a/sdc-qrf/src/converter/__tests__/resources/questionnaire_fhir/patient_edit.json b/sdc-qrf/src/converter/__tests__/resources/questionnaire_fhir/patient_edit.json deleted file mode 100644 index 5e6574a2..00000000 --- a/sdc-qrf/src/converter/__tests__/resources/questionnaire_fhir/patient_edit.json +++ /dev/null @@ -1,183 +0,0 @@ -{ - "meta": { - "profile": [ - "https://beda.software/beda-emr-questionnaire" - ], - "lastUpdated": "2023-04-10T03:43:34.792167Z", - "versionId": "694", - "extension": [ - { - "url": "ex:createdAt", - "valueInstant": "2023-04-05T05:22:35.752466Z" - } - ] - }, - "name": "edit-patient", - "item": [ - { - "text": "patientId", - "type": "string", - "extension": [ - { - "url": "http://hl7.org/fhir/StructureDefinition/questionnaire-hidden", - "valueBoolean": true - }, - { - "url": "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-initialExpression", - "valueExpression": { - "language": "text/fhirpath", - "expression": "%Patient.id" - } - } - ], - "linkId": "patient-id", - "readOnly": true - }, - { - "text": "Last name", - "type": "string", - "linkId": "last-name", - "required": true, - "extension": [ - { - "url": "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-initialExpression", - "valueExpression": { - "language": "text/fhirpath", - "expression": "%Patient.name.family" - } - } - ] - }, - { - "text": "First name", - "type": "string", - "linkId": "first-name", - "extension": [ - { - "url": "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-initialExpression", - "valueExpression": { - "language": "text/fhirpath", - "expression": "%Patient.name.given[0]" - } - } - ] - }, - { - "text": "Middle name", - "type": "string", - "linkId": "middle-name", - "extension": [ - { - "url": "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-initialExpression", - "valueExpression": { - "language": "text/fhirpath", - "expression": "%Patient.name.given[1]" - } - } - ] - }, - { - "text": "Birth date", - "type": "date", - "linkId": "birth-date", - "extension": [ - { - "url": "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-initialExpression", - "valueExpression": { - "language": "text/fhirpath", - "expression": "%Patient.birthDate" - } - } - ] - }, - { - "text": "Gender", - "type": "choice", - "linkId": "gender", - "answerOption": [ - { - "valueString": "male" - }, - { - "valueString": "female" - } - ], - "extension": [ - { - "url": "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-initialExpression", - "valueExpression": { - "language": "text/fhirpath", - "expression": "%Patient.gender" - } - } - ] - }, - { - "text": "SSN", - "type": "string", - "linkId": "ssn", - "extension": [ - { - "url": "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-initialExpression", - "valueExpression": { - "language": "text/fhirpath", - "expression": "%Patient.identifier.where(system='1.2.643.100.3').value" - } - } - ] - }, - { - "text": "Phone number", - "type": "string", - "linkId": "mobile", - "extension": [ - { - "url": "http://hl7.org/fhir/StructureDefinition/questionnaire-itemControl", - "valueCodeableConcept": { - "coding": [ - { - "code": "phoneWidget" - } - ] - } - }, - { - "url": "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-initialExpression", - "valueExpression": { - "language": "text/fhirpath", - "expression": "%Patient.telecom.where(system='phone').value" - } - } - ] - } - ], - "resourceType": "Questionnaire", - "title": "Edit patient", - "extension": [ - { - "url": "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-launchContext", - "extension": [ - { - "url": "name", - "valueCoding": { - "system": "http://hl7.org/fhir/uv/sdc/CodeSystem/launchContext", - "code": "Patient" - } - }, - { - "url": "type", - "valueCode": "Patient" - } - ] - }, - { - "url": "http://beda.software/fhir-extensions/questionnaire-mapper", - "valueReference": { - "reference": "Mapping/patient-create" - } - } - ], - "status": "active", - "id": "patient-edit", - "url": "https://aidbox.emr.beda.software/ui/console#/entities/Questionnaire/patient-edit" -} \ No newline at end of file diff --git a/sdc-qrf/src/converter/__tests__/resources/questionnaire_fhir/phq_2_phq_9.json b/sdc-qrf/src/converter/__tests__/resources/questionnaire_fhir/phq_2_phq_9.json deleted file mode 100644 index 7a7f4182..00000000 --- a/sdc-qrf/src/converter/__tests__/resources/questionnaire_fhir/phq_2_phq_9.json +++ /dev/null @@ -1,580 +0,0 @@ -{ - "subjectType": ["Encounter", "Patient"], - "meta": { - "profile": ["https://beda.software/beda-emr-questionnaire"], - "lastUpdated": "2023-04-10T03:43:34.792167Z", - "versionId": "694", - "extension": [ - { - "url": "ex:createdAt", - "valueInstant": "2023-04-05T05:22:35.752466Z" - } - ] - }, - "name": "PHQ-2/PHQ-9 Depression Screening", - "item": [ - { - "text": "DateTime", - "type": "dateTime", - "extension": [ - { - "url": "http://hl7.org/fhir/StructureDefinition/questionnaire-hidden", - "valueBoolean": true - }, - { - "url": "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-initialExpression", - "valueExpression": { - "language": "text/fhirpath", - "expression": "now()" - } - } - ], - "linkId": "dateTime" - }, - { - "text": "PatientId", - "type": "string", - "extension": [ - { - "url": "http://hl7.org/fhir/StructureDefinition/questionnaire-hidden", - "valueBoolean": true - }, - { - "url": "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-initialExpression", - "valueExpression": { - "language": "text/fhirpath", - "expression": "%Patient.id" - } - } - ], - "linkId": "patientId" - }, - { - "text": "PatientName", - "type": "string", - "extension": [ - { - "url": "http://hl7.org/fhir/StructureDefinition/questionnaire-hidden", - "valueBoolean": true - }, - { - "url": "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-initialExpression", - "valueExpression": { - "language": "text/fhirpath", - "expression": "%Patient.name.given[0] + ' ' + %Patient.name.family" - } - } - ], - "linkId": "patientName" - }, - { - "item": [ - { - "text": "Little interest or pleasure in doing things", - "type": "choice", - "linkId": "44250-9", - "required": true, - "answerOption": [ - { - "valueCoding": { - "code": "LA6568-5", - "system": "http://loinc.org", - "display": "Not at all" - } - }, - { - "valueCoding": { - "code": "LA6569-3", - "system": "http://loinc.org", - "display": "Several days" - } - }, - { - "valueCoding": { - "code": "LA6570-1", - "system": "http://loinc.org", - "display": "More than half the days" - } - }, - { - "valueCoding": { - "code": "LA6571-9", - "system": "http://loinc.org", - "display": "Nearly every day" - } - } - ], - "extension": [ - { - "url": "http://hl7.org/fhir/StructureDefinition/questionnaire-itemControl", - "valueCodeableConcept": { - "coding": [ - { - "code": "inline-choice" - } - ] - } - } - ] - }, - { - "text": "Feeling down, depressed, or hopeless", - "type": "choice", - "linkId": "44255-8", - "required": true, - "answerOption": [ - { - "valueCoding": { - "code": "LA6568-5", - "system": "http://loinc.org", - "display": "Not at all" - } - }, - { - "valueCoding": { - "code": "LA6569-3", - "system": "http://loinc.org", - "display": "Several days" - } - }, - { - "valueCoding": { - "code": "LA6570-1", - "system": "http://loinc.org", - "display": "More than half the days" - } - }, - { - "valueCoding": { - "code": "LA6571-9", - "system": "http://loinc.org", - "display": "Nearly every day" - } - } - ], - "extension": [ - { - "url": "http://hl7.org/fhir/StructureDefinition/questionnaire-itemControl", - "valueCodeableConcept": { - "coding": [ - { - "code": "inline-choice" - } - ] - } - } - ] - }, - { - "text": "Trouble falling or staying asleep, or sleeping too much", - "type": "choice", - "linkId": "44259-0", - "required": true, - "answerOption": [ - { - "valueCoding": { - "code": "LA6568-5", - "system": "http://loinc.org", - "display": "Not at all" - } - }, - { - "valueCoding": { - "code": "LA6569-3", - "system": "http://loinc.org", - "display": "Several days" - } - }, - { - "valueCoding": { - "code": "LA6570-1", - "system": "http://loinc.org", - "display": "More than half the days" - } - }, - { - "valueCoding": { - "code": "LA6571-9", - "system": "http://loinc.org", - "display": "Nearly every day" - } - } - ], - "extension": [ - { - "url": "http://hl7.org/fhir/StructureDefinition/questionnaire-itemControl", - "valueCodeableConcept": { - "coding": [ - { - "code": "inline-choice" - } - ] - } - } - ] - }, - { - "text": "Feeling tired or having little energy", - "type": "choice", - "linkId": "44254-1", - "required": true, - "answerOption": [ - { - "valueCoding": { - "code": "LA6568-5", - "system": "http://loinc.org", - "display": "Not at all" - } - }, - { - "valueCoding": { - "code": "LA6569-3", - "system": "http://loinc.org", - "display": "Several days" - } - }, - { - "valueCoding": { - "code": "LA6570-1", - "system": "http://loinc.org", - "display": "More than half the days" - } - }, - { - "valueCoding": { - "code": "LA6571-9", - "system": "http://loinc.org", - "display": "Nearly every day" - } - } - ], - "extension": [ - { - "url": "http://hl7.org/fhir/StructureDefinition/questionnaire-itemControl", - "valueCodeableConcept": { - "coding": [ - { - "code": "inline-choice" - } - ] - } - } - ] - }, - { - "text": "Poor appetite or overeating", - "type": "choice", - "linkId": "44251-7", - "required": true, - "answerOption": [ - { - "valueCoding": { - "code": "LA6568-5", - "system": "http://loinc.org", - "display": "Not at all" - } - }, - { - "valueCoding": { - "code": "LA6569-3", - "system": "http://loinc.org", - "display": "Several days" - } - }, - { - "valueCoding": { - "code": "LA6570-1", - "system": "http://loinc.org", - "display": "More than half the days" - } - }, - { - "valueCoding": { - "code": "LA6571-9", - "system": "http://loinc.org", - "display": "Nearly every day" - } - } - ], - "extension": [ - { - "url": "http://hl7.org/fhir/StructureDefinition/questionnaire-itemControl", - "valueCodeableConcept": { - "coding": [ - { - "code": "inline-choice" - } - ] - } - } - ] - }, - { - "text": "Feeling bad about yourself-or that you are a failure or have let yourself or your family down", - "type": "choice", - "linkId": "44258-2", - "required": true, - "answerOption": [ - { - "valueCoding": { - "code": "LA6568-5", - "system": "http://loinc.org", - "display": "Not at all" - } - }, - { - "valueCoding": { - "code": "LA6569-3", - "system": "http://loinc.org", - "display": "Several days" - } - }, - { - "valueCoding": { - "code": "LA6570-1", - "system": "http://loinc.org", - "display": "More than half the days" - } - }, - { - "valueCoding": { - "code": "LA6571-9", - "system": "http://loinc.org", - "display": "Nearly every day" - } - } - ], - "extension": [ - { - "url": "http://hl7.org/fhir/StructureDefinition/questionnaire-itemControl", - "valueCodeableConcept": { - "coding": [ - { - "code": "inline-choice" - } - ] - } - } - ] - }, - { - "text": "Trouble concentrating on things, such as reading the newspaper or watching television", - "type": "choice", - "linkId": "44252-5", - "required": true, - "answerOption": [ - { - "valueCoding": { - "code": "LA6568-5", - "system": "http://loinc.org", - "display": "Not at all" - } - }, - { - "valueCoding": { - "code": "LA6569-3", - "system": "http://loinc.org", - "display": "Several days" - } - }, - { - "valueCoding": { - "code": "LA6570-1", - "system": "http://loinc.org", - "display": "More than half the days" - } - }, - { - "valueCoding": { - "code": "LA6571-9", - "system": "http://loinc.org", - "display": "Nearly every day" - } - } - ], - "extension": [ - { - "url": "http://hl7.org/fhir/StructureDefinition/questionnaire-itemControl", - "valueCodeableConcept": { - "coding": [ - { - "code": "inline-choice" - } - ] - } - } - ] - }, - { - "text": "Moving or speaking so slowly that other people could have noticed. Or the opposite-being so fidgety or restless that you have been moving around a lot more than usual", - "type": "choice", - "linkId": "44253-3", - "required": true, - "answerOption": [ - { - "valueCoding": { - "code": "LA6568-5", - "system": "http://loinc.org", - "display": "Not at all" - } - }, - { - "valueCoding": { - "code": "LA6569-3", - "system": "http://loinc.org", - "display": "Several days" - } - }, - { - "valueCoding": { - "code": "LA6570-1", - "system": "http://loinc.org", - "display": "More than half the days" - } - }, - { - "valueCoding": { - "code": "LA6571-9", - "system": "http://loinc.org", - "display": "Nearly every day" - } - } - ], - "extension": [ - { - "url": "http://hl7.org/fhir/StructureDefinition/questionnaire-itemControl", - "valueCodeableConcept": { - "coding": [ - { - "code": "inline-choice" - } - ] - } - } - ] - }, - { - "text": "Thoughts that you would be better off dead, or of hurting yourself in some way", - "type": "choice", - "linkId": "44260-8", - "required": true, - "answerOption": [ - { - "valueCoding": { - "code": "LA6568-5", - "system": "http://loinc.org", - "display": "Not at all" - } - }, - { - "valueCoding": { - "code": "LA6569-3", - "system": "http://loinc.org", - "display": "Several days" - } - }, - { - "valueCoding": { - "code": "LA6570-1", - "system": "http://loinc.org", - "display": "More than half the days" - } - }, - { - "valueCoding": { - "code": "LA6571-9", - "system": "http://loinc.org", - "display": "Nearly every day" - } - } - ], - "extension": [ - { - "url": "http://hl7.org/fhir/StructureDefinition/questionnaire-itemControl", - "valueCodeableConcept": { - "coding": [ - { - "code": "inline-choice" - } - ] - } - } - ] - }, - { - "text": "PHQ2/PHQ-9 Depression Severity Score", - "type": "integer", - "linkId": "phq9-total-score", - "readOnly": true, - "required": true, - "extension": [ - { - "url": "http://hl7.org/fhir/StructureDefinition/questionnaire-itemControl", - "valueCodeableConcept": { - "coding": [ - { - "code": "depression-score" - } - ] - } - }, - { - "url": "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-calculatedExpression", - "valueExpression": { - "language": "text/fhirpath", - "expression": "%QuestionnaireResponse.item.item.answer.children().children().where(code='LA6569-3').count() + %QuestionnaireResponse.item.item.answer.children().children().where(code='LA6570-1').count() * 2 + %QuestionnaireResponse.item.item.answer.children().children().where(code='LA6571-9').count() * 3" - } - } - ] - } - ], - "text": "Over the past 2 weeks, how often have you been bothered by:", - "type": "group", - "linkId": "phq2phq9" - } - ], - "resourceType": "Questionnaire", - "extension": [ - { - "url": "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-launchContext", - "extension": [ - { - "url": "name", - "valueCoding": { - "system": "http://hl7.org/fhir/uv/sdc/CodeSystem/launchContext", - "code": "Patient" - } - }, - { - "url": "type", - "valueCode": "Patient" - } - ] - }, - { - "url": "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-launchContext", - "extension": [ - { - "url": "name", - "valueCoding": { - "system": "http://hl7.org/fhir/uv/sdc/CodeSystem/launchContext", - "code": "Author" - } - }, - { - "url": "type", - "valueCode": "Resource" - } - ] - }, - { - "url": "http://beda.software/fhir-extensions/questionnaire-mapper", - "valueReference": { - "reference": "Mapping/phq2phq9-extract" - } - } - ], - "status": "active", - "id": "phq2phq9", - "url": "https://aidbox.emr.beda.software/ui/console#/entities/Questionnaire/phq2phq9" -} diff --git a/sdc-qrf/src/converter/__tests__/resources/questionnaire_fhir/physicalexam.json b/sdc-qrf/src/converter/__tests__/resources/questionnaire_fhir/physicalexam.json deleted file mode 100644 index ddff4a86..00000000 --- a/sdc-qrf/src/converter/__tests__/resources/questionnaire_fhir/physicalexam.json +++ /dev/null @@ -1,544 +0,0 @@ -{ - "subjectType": ["Encounter"], - "meta": { - "profile": ["https://beda.software/beda-emr-questionnaire"], - "lastUpdated": "2023-04-10T03:43:34.792167Z", - "versionId": "694", - "extension": [ - { - "url": "ex:createdAt", - "valueInstant": "2023-04-05T05:22:35.752466Z" - } - ] - }, - "name": "Physical exam", - "item": [ - { - "item": [ - { - "code": [ - { - "code": "71389-1", - "system": "http://loinc.org", - "display": "CMS - constitutional exam panel" - } - ], - "text": "General", - "type": "text", - "extension": [ - { - "url": "http://hl7.org/fhir/StructureDefinition/questionnaire-itemControl", - "valueCodeableConcept": { - "coding": [ - { - "code": "text-with-macro" - } - ] - } - }, - { - "url": "https://beda.software/fhir-emr-questionnaire/macro", - "valueString": "Well nourished, well developed, awake and alert, resting comfortably in no acute distress, cooperative on exam" - } - ], - "linkId": "general" - }, - { - "code": [ - { - "code": "71392-5", - "system": "http://loinc.org", - "display": "CMS - ear-nose-mouth-throat exam panel" - } - ], - "text": "HEENT", - "type": "text", - "extension": [ - { - "url": "http://hl7.org/fhir/StructureDefinition/questionnaire-itemControl", - "valueCodeableConcept": { - "coding": [ - { - "code": "text-with-macro" - } - ] - } - }, - { - "url": "https://beda.software/fhir-emr-questionnaire/macro", - "valueString": "NCAT, PERRL, normal conjunctivae, nonicteric sclerae, bilateral EAC/TM clear, no nasal discharge, OP clear, moist mucous membranes" - } - ], - "linkId": "heent" - }, - { - "code": [ - { - "code": "71393-3", - "system": "http://loinc.org", - "display": "CMS - neck exam panel" - } - ], - "text": "Neck", - "type": "text", - "extension": [ - { - "url": "http://hl7.org/fhir/StructureDefinition/questionnaire-itemControl", - "valueCodeableConcept": { - "coding": [ - { - "code": "text-with-macro" - } - ] - } - }, - { - "url": "https://beda.software/fhir-emr-questionnaire/macro", - "valueString": "Supple, normal ROM, no lymphadenopathy/masses, nontender" - } - ], - "linkId": "neck" - }, - { - "code": [ - { - "code": "71395-8", - "system": "http://loinc.org", - "display": "CMS - cardiovascular exam panel" - } - ], - "text": "Cardiovascular", - "type": "text", - "extension": [ - { - "url": "http://hl7.org/fhir/StructureDefinition/questionnaire-itemControl", - "valueCodeableConcept": { - "coding": [ - { - "code": "text-with-macro" - } - ] - } - }, - { - "url": "https://beda.software/fhir-emr-questionnaire/macro", - "valueString": "RRR, normal S1/S2, no murmurs/gallops/rub" - } - ], - "linkId": "cardiovascular" - }, - { - "code": [ - { - "code": "71394-1", - "system": "http://loinc.org", - "display": "CMS - respiratory exam panel" - } - ], - "text": "Pulmonary", - "type": "text", - "extension": [ - { - "url": "http://hl7.org/fhir/StructureDefinition/questionnaire-itemControl", - "valueCodeableConcept": { - "coding": [ - { - "code": "text-with-macro" - } - ] - } - }, - { - "url": "https://beda.software/fhir-emr-questionnaire/macro", - "valueString": "No respiratory distress, lungs CTAB: no rales, rhonchi, or wheeze" - } - ], - "linkId": "pulmonary" - }, - { - "code": [ - { - "code": "71397-4", - "system": "http://loinc.org", - "display": "CMS - gastrointestinal - abdomen exam panel" - } - ], - "text": "Abdominal", - "type": "text", - "extension": [ - { - "url": "http://hl7.org/fhir/StructureDefinition/questionnaire-itemControl", - "valueCodeableConcept": { - "coding": [ - { - "code": "text-with-macro" - } - ] - } - }, - { - "url": "https://beda.software/fhir-emr-questionnaire/macro", - "valueString": "Soft and non-tender with no guarding or rebound; +BS normoactive, no tympany on auscultation" - } - ], - "linkId": "abdominal" - }, - { - "code": [ - { - "code": "71402-2", - "system": "http://loinc.org", - "display": "CMS - musculoskeletal exam panel" - } - ], - "text": "Musculoskeletal", - "type": "text", - "extension": [ - { - "url": "http://hl7.org/fhir/StructureDefinition/questionnaire-itemControl", - "valueCodeableConcept": { - "coding": [ - { - "code": "text-with-macro" - } - ] - } - }, - { - "url": "https://beda.software/fhir-emr-questionnaire/macro", - "valueString": "Normal ROM of UE and LE, normal bulk and tone," - } - ], - "linkId": "musculoskeletal" - }, - { - "code": [ - { - "code": "71401-4", - "system": "http://loinc.org", - "display": "CMS - extremities exam panel" - } - ], - "text": "Extremities", - "type": "text", - "extension": [ - { - "url": "http://hl7.org/fhir/StructureDefinition/questionnaire-itemControl", - "valueCodeableConcept": { - "coding": [ - { - "code": "text-with-macro" - } - ] - } - }, - { - "url": "https://beda.software/fhir-emr-questionnaire/macro", - "valueString": "Pulses intact with normal cap refill, no LE pitting edema or calf tenderness" - } - ], - "linkId": "extremities" - }, - { - "code": [ - { - "code": "71404-8", - "system": "http://loinc.org", - "display": "CMS - neurologic exam panel" - } - ], - "text": "Neurologic", - "type": "text", - "extension": [ - { - "url": "http://hl7.org/fhir/StructureDefinition/questionnaire-itemControl", - "valueCodeableConcept": { - "coding": [ - { - "code": "text-with-macro" - } - ] - } - }, - { - "url": "https://beda.software/fhir-emr-questionnaire/macro", - "valueString": "AAOx3, converses normally. CN II - XII grossly intact. Gait and coordination intact. 5+ BL UE/LE strength, no gross motor or sensory defects" - } - ], - "linkId": "neurologic" - }, - { - "code": [ - { - "code": "71405-5", - "system": "http://loinc.org", - "display": "CMS - psychiatric exam panel" - } - ], - "text": "Psychiatric", - "type": "text", - "extension": [ - { - "url": "http://hl7.org/fhir/StructureDefinition/questionnaire-itemControl", - "valueCodeableConcept": { - "coding": [ - { - "code": "text-with-macro" - } - ] - } - }, - { - "url": "https://beda.software/fhir-emr-questionnaire/macro", - "valueString": "Normal mood and affect. Judgement/competence is appropriate" - } - ], - "linkId": "psychiatric" - }, - { - "code": [ - { - "code": "71403-0", - "system": "http://loinc.org", - "display": "CMS - skin exam panel" - } - ], - "text": "Skin", - "type": "text", - "extension": [ - { - "url": "http://hl7.org/fhir/StructureDefinition/questionnaire-itemControl", - "valueCodeableConcept": { - "coding": [ - { - "code": "text-with-macro" - } - ] - } - }, - { - "url": "https://beda.software/fhir-emr-questionnaire/macro", - "valueString": "Warm, dry, and intact. No rashes, dermatoses, petechiae, or lesions" - } - ], - "linkId": "skin" - }, - { - "code": [ - { - "code": "32473-1", - "system": "http://loinc.org", - "display": "Physical findings.sensation" - } - ], - "text": "Monofilament", - "type": "text", - "extension": [ - { - "url": "http://hl7.org/fhir/StructureDefinition/questionnaire-itemControl", - "valueCodeableConcept": { - "coding": [ - { - "code": "text-with-macro" - } - ] - } - }, - { - "url": "https://beda.software/fhir-emr-questionnaire/macro", - "valueString": "Normal sensation bilaterally on soles of feet with 10g monofilament" - } - ], - "linkId": "monofilament" - }, - { - "text": "Other Systems (optional)", - "type": "display", - "linkId": "other-systems-optional" - }, - { - "code": [ - { - "code": "71396-6", - "system": "http://loinc.org", - "display": "CMS - breast exam panel" - } - ], - "text": "Chest", - "type": "text", - "extension": [ - { - "url": "http://hl7.org/fhir/StructureDefinition/questionnaire-itemControl", - "valueCodeableConcept": { - "coding": [ - { - "code": "text-with-macro" - } - ] - } - }, - { - "url": "https://beda.software/fhir-emr-questionnaire/macro", - "valueString": "The chest wall is symmetric, without deformity, and is atraumatic in appearance" - } - ], - "linkId": "chest" - }, - { - "code": [ - { - "code": "71399-0", - "system": "http://loinc.org", - "display": "CMS - genitourinary exam - female panel" - } - ], - "text": "Genitourinary", - "type": "text", - "extension": [ - { - "url": "http://hl7.org/fhir/StructureDefinition/questionnaire-itemControl", - "valueCodeableConcept": { - "coding": [ - { - "code": "text-with-macro" - } - ] - } - }, - { - "url": "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-enableWhenExpression", - "valueExpression": { - "language": "text/fhirpath", - "expression": "%Patient.gender = 'female'" - } - }, - { - "url": "https://beda.software/fhir-emr-questionnaire/macro", - "valueString": "External genitalia without erythema, exudate or discharge" - } - ], - "linkId": "genitourinary-female" - }, - { - "code": [ - { - "code": "71398-2", - "system": "http://loinc.org", - "display": "CMS - genitourinary exam - male panel" - } - ], - "text": "Genitourinary", - "type": "text", - "extension": [ - { - "url": "http://hl7.org/fhir/StructureDefinition/questionnaire-itemControl", - "valueCodeableConcept": { - "coding": [ - { - "code": "text-with-macro" - } - ] - } - }, - { - "url": "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-enableWhenExpression", - "valueExpression": { - "language": "text/fhirpath", - "expression": "%Patient.gender = 'male'" - } - }, - { - "url": "https://beda.software/fhir-emr-questionnaire/macro", - "valueString": "Penis without lesions. No urethral discharge. Testes normal size without masses or tenderness. No scrotal masses. No hernia" - } - ], - "linkId": "genitourinary-male" - }, - { - "code": [ - { - "code": "8708-0", - "system": "http://loinc.org", - "display": "Phys find Rectum" - } - ], - "text": "Rectal", - "type": "text", - "extension": [ - { - "url": "http://hl7.org/fhir/StructureDefinition/questionnaire-itemControl", - "valueCodeableConcept": { - "coding": [ - { - "code": "text-with-macro" - } - ] - } - }, - { - "url": "https://beda.software/fhir-emr-questionnaire/macro", - "valueString": "Normal external anus and normal tone. No palpable masses, normal mucosa, brown stool. Hemoccult negative" - } - ], - "linkId": "rectal" - }, - { - "code": [ - { - "code": "71400-6", - "system": "http://loinc.org", - "display": "CMS - lymphatic exam panel" - } - ], - "text": "Lymphatic", - "type": "text", - "extension": [ - { - "url": "http://hl7.org/fhir/StructureDefinition/questionnaire-itemControl", - "valueCodeableConcept": { - "coding": [ - { - "code": "text-with-macro" - } - ] - } - }, - { - "url": "https://beda.software/fhir-emr-questionnaire/macro", - "valueString": "No enlarged lymph nodes of occipital, pre- and postauricular, submandibular, anterior or posterior cervical, or supraclavicular identified" - } - ], - "linkId": "lymphatic" - } - ], - "type": "group", - "linkId": "physical-exam-group" - } - ], - "resourceType": "Questionnaire", - "extension": [ - { - "url": "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-launchContext", - "extension": [ - { - "url": "name", - "valueCoding": { - "system": "http://hl7.org/fhir/uv/sdc/CodeSystem/launchContext", - "code": "Patient" - } - }, - { - "url": "type", - "valueCode": "Patient" - }, - { - "url": "description", - "valueString": "Patient is answering the questionnaire" - } - ] - } - ], - "status": "active", - "id": "physical-exam", - "url": "https://aidbox.emr.beda.software/ui/console#/entities/Questionnaire/physical-exam" -} diff --git a/sdc-qrf/src/converter/__tests__/resources/questionnaire_fhir/practitioner_create.json b/sdc-qrf/src/converter/__tests__/resources/questionnaire_fhir/practitioner_create.json deleted file mode 100644 index 52688bd3..00000000 --- a/sdc-qrf/src/converter/__tests__/resources/questionnaire_fhir/practitioner_create.json +++ /dev/null @@ -1,87 +0,0 @@ -{ - "meta": { - "profile": ["https://beda.software/beda-emr-questionnaire"], - "lastUpdated": "2023-04-10T03:43:34.792167Z", - "versionId": "694", - "extension": [ - { - "url": "ex:createdAt", - "valueInstant": "2023-04-05T05:22:35.752466Z" - } - ] - }, - "name": "practitioner-create", - "item": [ - { - "text": "Last name", - "type": "string", - "linkId": "last-name", - "required": true - }, - { - "text": "First name", - "type": "string", - "linkId": "first-name" - }, - { - "text": "Middle name", - "type": "string", - "linkId": "middle-name" - }, - { - "text": "Specialty", - "type": "choice", - "linkId": "specialty", - "answerOption": [ - { - "valueCoding": { - "code": "394577000", - "system": "http://snomed.info/sct", - "display": "Anesthetics" - } - }, - { - "valueCoding": { - "code": "394579002", - "system": "http://snomed.info/sct", - "display": "Cardiology" - } - }, - { - "valueCoding": { - "code": "394582007", - "system": "http://snomed.info/sct", - "display": "Dermatology" - } - }, - { - "valueCoding": { - "code": "394583002", - "system": "http://snomed.info/sct", - "display": "Endocrinology" - } - }, - { - "valueCoding": { - "code": "419772000", - "system": "http://snomed.info/sct", - "display": "Family practice" - } - } - ] - } - ], - "resourceType": "Questionnaire", - "title": "Practitioner create", - "extension": [ - { - "url": "http://beda.software/fhir-extensions/questionnaire-mapper", - "valueReference": { - "reference": "Mapping/practitioner-create" - } - } - ], - "status": "active", - "id": "practitioner-create", - "url": "https://aidbox.emr.beda.software/ui/console#/entities/Questionnaire/practitioner-create" -} diff --git a/sdc-qrf/src/converter/__tests__/resources/questionnaire_fhir/practitioner_create_structure_map.json b/sdc-qrf/src/converter/__tests__/resources/questionnaire_fhir/practitioner_create_structure_map.json deleted file mode 100644 index 013dd1ff..00000000 --- a/sdc-qrf/src/converter/__tests__/resources/questionnaire_fhir/practitioner_create_structure_map.json +++ /dev/null @@ -1,91 +0,0 @@ -{ - "meta": { - "profile": ["https://beda.software/beda-emr-questionnaire"], - "lastUpdated": "2023-04-25T06:51:01.969393Z", - "versionId": "268", - "extension": [ - { - "url": "ex:createdAt", - "valueInstant": "2023-04-25T06:38:33.794441Z" - } - ] - }, - "name": "practitioner-create", - "item": [ - { - "text": "Last name", - "type": "string", - "linkId": "last-name", - "required": true - }, - { - "text": "First name", - "type": "string", - "linkId": "first-name" - }, - { - "text": "Middle name", - "type": "string", - "linkId": "middle-name" - }, - { - "text": "Specialty", - "type": "choice", - "linkId": "specialty", - "answerOption": [ - { - "valueCoding": { - "code": "394577000", - "system": "http://snomed.info/sct", - "display": "Anesthetics" - } - }, - { - "valueCoding": { - "code": "394579002", - "system": "http://snomed.info/sct", - "display": "Cardiology" - } - }, - { - "valueCoding": { - "code": "394582007", - "system": "http://snomed.info/sct", - "display": "Dermatology" - } - }, - { - "valueCoding": { - "code": "394583002", - "system": "http://snomed.info/sct", - "display": "Endocrinology" - } - }, - { - "valueCoding": { - "code": "419772000", - "system": "http://snomed.info/sct", - "display": "Family practice" - } - } - ] - } - ], - "resourceType": "Questionnaire", - "title": "Practitioner create", - "extension": [ - { - "url": "http://beda.software/fhir-extensions/questionnaire-mapper", - "valueReference": { - "reference": "Mapping/practitioner-create" - } - }, - { - "url": "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-targetStructureMap", - "valueCanonical": "StructureMap/practitioner-create" - } - ], - "status": "active", - "id": "practitioner-create-fhir-testing", - "url": "https://aidbox.emr.beda.software/ui/console#/entities/Questionnaire/practitioner-create" -} diff --git a/sdc-qrf/src/converter/__tests__/resources/questionnaire_fhir/practitioner_edit.json b/sdc-qrf/src/converter/__tests__/resources/questionnaire_fhir/practitioner_edit.json deleted file mode 100644 index f25e2ecf..00000000 --- a/sdc-qrf/src/converter/__tests__/resources/questionnaire_fhir/practitioner_edit.json +++ /dev/null @@ -1,193 +0,0 @@ -{ - "meta": { - "profile": ["https://beda.software/beda-emr-questionnaire"], - "lastUpdated": "2023-04-10T03:43:34.792167Z", - "versionId": "694", - "extension": [ - { - "url": "ex:createdAt", - "valueInstant": "2023-04-05T05:22:35.752466Z" - } - ] - }, - "name": "practitioner edit", - "item": [ - { - "text": "practitionerId", - "type": "string", - "extension": [ - { - "url": "http://hl7.org/fhir/StructureDefinition/questionnaire-hidden", - "valueBoolean": true - }, - { - "url": "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-initialExpression", - "valueExpression": { - "language": "text/fhirpath", - "expression": "%Practitioner.id" - } - } - ], - "linkId": "practitioner-id", - "readOnly": true - }, - { - "text": "practitionerRoleId", - "type": "string", - "extension": [ - { - "url": "http://hl7.org/fhir/StructureDefinition/questionnaire-hidden", - "valueBoolean": true - }, - { - "url": "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-initialExpression", - "valueExpression": { - "language": "text/fhirpath", - "expression": "%PractitionerRole.id" - } - } - ], - "linkId": "practitioner-role-id", - "readOnly": true - }, - { - "text": "First name", - "type": "string", - "linkId": "first-name", - "extension": [ - { - "url": "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-initialExpression", - "valueExpression": { - "language": "text/fhirpath", - "expression": "%Practitioner.name.given[0]" - } - } - ] - }, - { - "text": "Middle name", - "type": "string", - "linkId": "middle-name", - "extension": [ - { - "url": "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-initialExpression", - "valueExpression": { - "language": "text/fhirpath", - "expression": "%Practitioner.name.given[1]" - } - } - ] - }, - { - "text": "Last name", - "type": "string", - "linkId": "last-name", - "required": true, - "extension": [ - { - "url": "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-initialExpression", - "valueExpression": { - "language": "text/fhirpath", - "expression": "%Practitioner.name.family" - } - } - ] - }, - { - "text": "Specialty", - "type": "choice", - "linkId": "specialty", - "answerOption": [ - { - "valueCoding": { - "code": "394577000", - "system": "http://snomed.info/sct", - "display": "Anesthetics" - } - }, - { - "valueCoding": { - "code": "394579002", - "system": "http://snomed.info/sct", - "display": "Cardiology" - } - }, - { - "valueCoding": { - "code": "394582007", - "system": "http://snomed.info/sct", - "display": "Dermatology" - } - }, - { - "valueCoding": { - "code": "394583002", - "system": "http://snomed.info/sct", - "display": "Endocrinology" - } - }, - { - "valueCoding": { - "code": "419772000", - "system": "http://snomed.info/sct", - "display": "Family practice" - } - } - ], - "extension": [ - { - "url": "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-initialExpression", - "valueExpression": { - "language": "text/fhirpath", - "expression": "%PractitionerRole.specialty[0].coding" - } - } - ] - } - ], - "resourceType": "Questionnaire", - "title": "Practitioner edit", - "extension": [ - { - "url": "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-launchContext", - "extension": [ - { - "url": "name", - "valueCoding": { - "system": "http://hl7.org/fhir/uv/sdc/CodeSystem/launchContext", - "code": "Practitioner" - } - }, - { - "url": "type", - "valueCode": "Practitioner" - } - ] - }, - { - "url": "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-launchContext", - "extension": [ - { - "url": "name", - "valueCoding": { - "system": "http://hl7.org/fhir/uv/sdc/CodeSystem/launchContext", - "code": "PractitionerRole" - } - }, - { - "url": "type", - "valueCode": "PractitionerRole" - } - ] - }, - { - "url": "http://beda.software/fhir-extensions/questionnaire-mapper", - "valueReference": { - "reference": "Mapping/practitioner-edit" - } - } - ], - "status": "active", - "id": "practitioner-edit", - "url": "https://aidbox.emr.beda.software/ui/console#/entities/Questionnaire/practitioner-edit" -} diff --git a/sdc-qrf/src/converter/__tests__/resources/questionnaire_fhir/practitioner_role_create.json b/sdc-qrf/src/converter/__tests__/resources/questionnaire_fhir/practitioner_role_create.json deleted file mode 100644 index 5bb9de5b..00000000 --- a/sdc-qrf/src/converter/__tests__/resources/questionnaire_fhir/practitioner_role_create.json +++ /dev/null @@ -1,44 +0,0 @@ -{ - "meta": { - "profile": ["https://beda.software/beda-emr-questionnaire"], - "lastUpdated": "2023-04-10T03:43:34.792167Z", - "versionId": "694", - "extension": [ - { - "url": "ex:createdAt", - "valueInstant": "2023-04-05T05:22:35.752466Z" - } - ] - }, - "name": "practitioner-role-create", - "item": [ - { - "text": "Organization", - "type": "string", - "linkId": "organization" - }, - { - "text": "Practitioner", - "type": "string", - "linkId": "practitioner" - }, - { - "text": "Speciality", - "type": "string", - "linkId": "specialty" - } - ], - "resourceType": "Questionnaire", - "title": "Create practitioner role", - "extension": [ - { - "url": "http://beda.software/fhir-extensions/questionnaire-mapper", - "valueReference": { - "reference": "Mapping/practitioner-role-create" - } - } - ], - "status": "active", - "id": "practitioner-role-create", - "url": "https://aidbox.emr.beda.software/ui/console#/entities/Questionnaire/practitioner-role-create" -} diff --git a/sdc-qrf/src/converter/__tests__/resources/questionnaire_fhir/public_appointment.json b/sdc-qrf/src/converter/__tests__/resources/questionnaire_fhir/public_appointment.json deleted file mode 100644 index 8d6b5485..00000000 --- a/sdc-qrf/src/converter/__tests__/resources/questionnaire_fhir/public_appointment.json +++ /dev/null @@ -1,116 +0,0 @@ -{ - "meta": { - "profile": [ - "https://beda.software/beda-emr-questionnaire" - ], - "lastUpdated": "2023-04-10T03:43:34.792167Z", - "versionId": "694", - "extension": [ - { - "url": "ex:createdAt", - "valueInstant": "2023-04-05T05:22:35.752466Z" - } - ] - }, - "name": "Appointment", - "item": [ - { - "text": "First name", - "type": "string", - "linkId": "first-name", - "required": true - }, - { - "text": "Last name", - "type": "string", - "linkId": "last-name", - "required": true - }, - { - "text": "Phone number", - "type": "string", - "linkId": "mobile", - "extension": [ - { - "url": "http://hl7.org/fhir/StructureDefinition/questionnaire-itemControl", - "valueCodeableConcept": { - "coding": [ - { - "code": "phoneWidget" - } - ] - } - } - ] - }, - { - "text": "Practitioner", - "type": "choice", - "linkId": "practitioner-role", - "required": true, - "extension": [ - { - "url": "http://hl7.org/fhir/StructureDefinition/questionnaire-itemControl", - "valueCodeableConcept": { - "coding": [ - { - "code": "practitioner-role" - } - ] - } - } - ] - }, - { - "text": "Type", - "type": "choice", - "required": true, - "linkId": "service-type", - "initial": [ - { - "valueCoding": { - "code": "consultation", - "system": "http://fhir.org/guides/argonaut-scheduling/CodeSystem/visit-type", - "display": "The first appointment" - } - } - ], - "extension": [ - { - "url": "http://hl7.org/fhir/StructureDefinition/questionnaire-hidden", - "valueBoolean": true - } - ] - }, - { - "text": "Date and Time", - "type": "dateTime", - "linkId": "date-time-slot", - "required": true, - "extension": [ - { - "url": "http://hl7.org/fhir/StructureDefinition/questionnaire-itemControl", - "valueCodeableConcept": { - "coding": [ - { - "code": "date-time-slot" - } - ] - } - } - ] - } - ], - "resourceType": "Questionnaire", - "extension": [ - { - "url": "http://beda.software/fhir-extensions/questionnaire-mapper", - "valueReference": { - "reference": "Mapping/public-appointment-extract" - } - } - ], - "status": "active", - "id": "public-appointment", - "url": "https://aidbox.emr.beda.software/ui/console#/entities/Questionnaire/" -} \ No newline at end of file diff --git a/sdc-qrf/src/converter/__tests__/resources/questionnaire_fhir/review_of_systems.json b/sdc-qrf/src/converter/__tests__/resources/questionnaire_fhir/review_of_systems.json deleted file mode 100644 index 3caae5a6..00000000 --- a/sdc-qrf/src/converter/__tests__/resources/questionnaire_fhir/review_of_systems.json +++ /dev/null @@ -1,368 +0,0 @@ -{ - "subjectType": ["Encounter"], - "meta": { - "profile": ["https://beda.software/beda-emr-questionnaire"], - "lastUpdated": "2023-04-10T03:43:34.792167Z", - "versionId": "694", - "extension": [ - { - "url": "ex:createdAt", - "valueInstant": "2023-04-05T05:22:35.752466Z" - } - ] - }, - "name": "Review of Systems", - "item": [ - { - "code": [ - { - "code": "71406-3", - "system": "http://loinc.org", - "display": "CMS - review of systems panel" - } - ], - "text": "Provider reviewed all systems and state that all are WNL except as noted below\n", - "type": "boolean", - "linkId": "provider-viewed-confirmation", - "initial": [ - { - "valueBoolean": false - } - ] - }, - { - "item": [ - { - "code": [ - { - "code": "71407-1", - "system": "http://loinc.org", - "display": "CMS - constitutional symptoms panel" - } - ], - "text": "General", - "type": "boolean", - "linkId": "general" - }, - { - "code": [ - { - "code": "71407-1-comment", - "system": "http://loinc.org", - "display": "CMS - constitutional symptoms panel - comment" - } - ], - "type": "text", - "linkId": "general-comment", - "enableWhen": [ - { - "question": "general", - "operator": "=", - "answerBoolean": true - } - ] - }, - { - "code": [ - { - "code": "71409-7", - "system": "http://loinc.org", - "display": "CMS - ear-nose-mouth-throat panel" - } - ], - "text": "HEENT", - "type": "boolean", - "linkId": "heent" - }, - { - "code": [ - { - "code": "71409-7-comment", - "system": "http://loinc.org", - "display": "CMS - ear-nose-mouth-throat panel - comment" - } - ], - "type": "text", - "linkId": "heent-comment", - "enableWhen": [ - { - "question": "heent", - "operator": "=", - "answerBoolean": true - } - ] - }, - { - "code": [ - { - "code": "71410-5", - "system": "http://loinc.org", - "display": "CMS - cardiovascular panel" - } - ], - "text": "Cardiovascular", - "type": "boolean", - "linkId": "cardiovascular" - }, - { - "code": [ - { - "code": "71410-5-comment", - "system": "http://loinc.org", - "display": "CMS - cardiovascular panel - comment" - } - ], - "type": "text", - "linkId": "cardiovascular-comment", - "enableWhen": [ - { - "question": "cardiovascular", - "operator": "=", - "answerBoolean": true - } - ] - }, - { - "code": [ - { - "code": "71411-3", - "system": "http://loinc.org", - "display": "CMS - respiratory panel" - } - ], - "text": "Respiratory", - "type": "boolean", - "linkId": "respiratory" - }, - { - "code": [ - { - "code": "71411-3-comment", - "system": "http://loinc.org", - "display": "CMS - respiratory panel - comment" - } - ], - "type": "text", - "linkId": "respiratory-comment", - "enableWhen": [ - { - "question": "respiratory", - "operator": "=", - "answerBoolean": true - } - ] - }, - { - "code": [ - { - "code": "71412-1", - "system": "http://loinc.org", - "display": "CMS - gastrointestinal panel" - } - ], - "text": "Gastrointestinal", - "type": "boolean", - "linkId": "gastrointestinal" - }, - { - "code": [ - { - "code": "71412-1-comment", - "system": "http://loinc.org", - "display": "CMS - gastrointestinal panel - comment" - } - ], - "type": "text", - "linkId": "gastrointestinal-comment", - "enableWhen": [ - { - "question": "gastrointestinal", - "operator": "=", - "answerBoolean": true - } - ] - }, - { - "code": [ - { - "code": "71413-9", - "system": "http://loinc.org", - "display": "CMS - genitourinary panel" - } - ], - "text": "Genitourinary", - "type": "boolean", - "linkId": "genitourinary" - }, - { - "code": [ - { - "code": "71413-9-comment", - "system": "http://loinc.org", - "display": "CMS - genitourinary panel - comment" - } - ], - "type": "text", - "linkId": "genitourinary-comment", - "enableWhen": [ - { - "question": "genitourinary", - "operator": "=", - "answerBoolean": true - } - ] - }, - { - "code": [ - { - "code": "71414-7", - "system": "http://loinc.org", - "display": "CMS - musculoskeletal panel" - } - ], - "text": "Musculoskeletal", - "type": "boolean", - "linkId": "musculoskeletal" - }, - { - "code": [ - { - "code": "71414-7-comment", - "system": "http://loinc.org", - "display": "CMS - musculoskeletal panel - comment" - } - ], - "type": "text", - "linkId": "musculoskeletal-comment", - "enableWhen": [ - { - "question": "musculoskeletal", - "operator": "=", - "answerBoolean": true - } - ] - }, - { - "code": [ - { - "code": "71416-2", - "system": "http://loinc.org", - "display": "CMS - neurological panel" - } - ], - "text": "Neurologic", - "type": "boolean", - "linkId": "neurologic" - }, - { - "code": [ - { - "code": "71416-2-comment", - "system": "http://loinc.org", - "display": "CMS - neurological panel - comment" - } - ], - "type": "text", - "linkId": "neurologic-comment", - "enableWhen": [ - { - "question": "neurologic", - "operator": "=", - "answerBoolean": true - } - ] - }, - { - "code": [ - { - "code": "71417-0", - "system": "http://loinc.org", - "display": "CMS - psychiatric panel" - } - ], - "text": "Psychiatric", - "type": "boolean", - "linkId": "psychiatric" - }, - { - "code": [ - { - "code": "71417-0-comment", - "system": "http://loinc.org", - "display": "CMS - psychiatric panel - comment" - } - ], - "type": "text", - "linkId": "psychiatric-comment", - "enableWhen": [ - { - "question": "psychiatric", - "operator": "=", - "answerBoolean": true - } - ] - }, - { - "code": [ - { - "code": "71415-4", - "system": "http://loinc.org", - "display": "CMS - integumentary panel" - } - ], - "text": "Skin", - "type": "boolean", - "linkId": "skin" - }, - { - "code": [ - { - "code": "71415-4-comment", - "system": "http://loinc.org", - "display": "CMS - integumentary panel - comment" - } - ], - "type": "text", - "linkId": "skin-comment", - "enableWhen": [ - { - "question": "skin", - "operator": "=", - "answerBoolean": true - } - ] - }, - { - "text": "Other", - "type": "boolean", - "linkId": "other" - }, - { - "type": "text", - "linkId": "other-comment", - "enableWhen": [ - { - "question": "other", - "operator": "=", - "answerBoolean": true - } - ] - } - ], - "text": "Select abnormal systems", - "type": "group", - "linkId": "abnormal-systems-group", - "enableWhen": [ - { - "question": "provider-viewed-confirmation", - "operator": "=", - "answerBoolean": true - } - ] - } - ], - "resourceType": "Questionnaire", - "status": "active", - "id": "review-of-systems", - "url": "https://aidbox.emr.beda.software/ui/console#/entities/Questionnaire/review-of-systems" -} diff --git a/sdc-qrf/src/converter/__tests__/resources/questionnaire_fhir/source_queries.json b/sdc-qrf/src/converter/__tests__/resources/questionnaire_fhir/source_queries.json deleted file mode 100644 index e4b27230..00000000 --- a/sdc-qrf/src/converter/__tests__/resources/questionnaire_fhir/source_queries.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "meta": { - "profile": ["https://beda.software/beda-emr-questionnaire"] - }, - "item": [ - { - "linkId": "question-1", - "type": "string", - "text": "Question" - } - ], - "status": "active", - "resourceType": "Questionnaire", - "contained": [ - { - "id": "PrePopQuery", - "type": "batch", - "entry": [ - { - "request": { - "url": "Patient?_id={{%LaunchPatient.id}}", - "method": "GET" - } - } - ], - "resourceType": "Bundle" - } - ], - "extension": [ - { - "url": "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-sourceQueries", - "valueReference": { - "reference": "#Bundle#PrePopQuery" - } - } - ] -} diff --git a/sdc-qrf/src/converter/__tests__/resources/questionnaire_fhir/vitals.json b/sdc-qrf/src/converter/__tests__/resources/questionnaire_fhir/vitals.json deleted file mode 100644 index 0ae58d11..00000000 --- a/sdc-qrf/src/converter/__tests__/resources/questionnaire_fhir/vitals.json +++ /dev/null @@ -1,317 +0,0 @@ -{ - "subjectType": ["Encounter", "Patient"], - "meta": { - "profile": ["https://beda.software/beda-emr-questionnaire"], - "lastUpdated": "2023-05-04T01:00:51.328418Z", - "versionId": "2", - "extension": [ - { - "url": "ex:createdAt", - "valueInstant": "2023-05-04T01:00:51.328418Z" - } - ] - }, - "name": "Vitals", - "item": [ - { - "text": "PatientId", - "type": "string", - "extension": [ - { - "url": "http://hl7.org/fhir/StructureDefinition/questionnaire-hidden", - "valueBoolean": true - }, - { - "url": "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-initialExpression", - "valueExpression": { - "language": "text/fhirpath", - "expression": "%Patient.id" - } - } - ], - "linkId": "patientId" - }, - { - "text": "PatientName", - "type": "string", - "extension": [ - { - "url": "http://hl7.org/fhir/StructureDefinition/questionnaire-hidden", - "valueBoolean": true - }, - { - "url": "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-initialExpression", - "valueExpression": { - "language": "text/fhirpath", - "expression": "%Patient.name.given[0] + ' ' + %Patient.name.family" - } - } - ], - "linkId": "patientName" - }, - { - "text": "Height", - "type": "integer", - "linkId": "height", - "extension": [ - { - "url": "http://hl7.org/fhir/StructureDefinition/questionnaire-unit", - "valueCoding": { - "code": "cm", - "system": "http://unitsofmeasure.org", - "display": "cm" - } - } - ] - }, - { - "text": "Weight", - "type": "integer", - "linkId": "weight", - "extension": [ - { - "url": "http://hl7.org/fhir/StructureDefinition/questionnaire-unit", - "valueCoding": { - "code": "kg", - "system": "http://unitsofmeasure.org", - "display": "kg" - } - } - ] - }, - { - "text": "Temperature", - "type": "integer", - "linkId": "temperature", - "extension": [ - { - "url": "http://hl7.org/fhir/StructureDefinition/questionnaire-unit", - "valueCoding": { - "code": "Celsius", - "system": "http://unitsofmeasure.org", - "display": "Celsius" - } - } - ] - }, - { - "text": "Oxygen saturation", - "type": "integer", - "linkId": "oxygen-saturation", - "extension": [ - { - "url": "http://hl7.org/fhir/StructureDefinition/questionnaire-unit", - "valueCoding": { - "code": "%", - "system": "http://unitsofmeasure.org", - "display": "%" - } - } - ] - }, - { - "text": "Pulse rate", - "type": "integer", - "linkId": "pulse-rate", - "extension": [ - { - "url": "http://hl7.org/fhir/StructureDefinition/questionnaire-unit", - "valueCoding": { - "code": "bpm", - "system": "http://unitsofmeasure.org", - "display": "bpm" - } - } - ] - }, - { - "text": "Respiratory Rate", - "type": "integer", - "linkId": "respiratory-rate", - "extension": [ - { - "url": "http://hl7.org/fhir/StructureDefinition/questionnaire-unit", - "valueCoding": { - "code": "bpm", - "system": "http://unitsofmeasure.org", - "display": "bpm" - } - } - ] - }, - { - "item": [ - { - "item": [ - { - "text": "BP systolic", - "type": "integer", - "linkId": "blood-pressure-systolic", - "extension": [ - { - "url": "http://hl7.org/fhir/StructureDefinition/questionnaire-unit", - "valueCoding": { - "code": "mmHg", - "system": "http://unitsofmeasure.org", - "display": "mmHg" - } - } - ] - }, - { - "text": "BP diastolic", - "type": "integer", - "linkId": "blood-pressure-diastolic", - "extension": [ - { - "url": "http://hl7.org/fhir/StructureDefinition/questionnaire-unit", - "valueCoding": { - "code": "mmHg", - "system": "http://unitsofmeasure.org", - "display": "mmHg" - } - } - ] - } - ], - "type": "group", - "linkId": "blood-pressure-systolic-diastolic", - "extension": [ - { - "url": "http://hl7.org/fhir/StructureDefinition/questionnaire-itemControl", - "valueCodeableConcept": { - "coding": [ - { - "code": "blood-pressure" - } - ] - } - } - ] - }, - { - "text": "Positions", - "type": "choice", - "linkId": "blood-pressure-positions", - "answerOption": [ - { - "valueCoding": { - "code": "sitting", - "display": "Sitting" - } - }, - { - "valueCoding": { - "code": "lying", - "display": "Lying" - } - }, - { - "valueCoding": { - "code": "standing", - "display": "Standing" - } - } - ], - "extension": [ - { - "url": "http://hl7.org/fhir/StructureDefinition/questionnaire-itemControl", - "valueCodeableConcept": { - "coding": [ - { - "code": "inline-choice" - } - ] - } - } - ] - }, - { - "text": "Arm", - "type": "choice", - "linkId": "blood-pressure-arm", - "answerOption": [ - { - "valueCoding": { - "code": "biceps-left", - "display": "Biceps left" - } - }, - { - "valueCoding": { - "code": "biceps-right", - "display": "Biceps right" - } - } - ], - "extension": [ - { - "url": "http://hl7.org/fhir/StructureDefinition/questionnaire-itemControl", - "valueCodeableConcept": { - "coding": [ - { - "code": "inline-choice" - } - ] - } - } - ] - } - ], - "text": "Blood Pressure", - "type": "group", - "linkId": "blood-pressure" - }, - { - "text": "BMI", - "type": "integer", - "extension": [ - { - "url": "http://hl7.org/fhir/StructureDefinition/questionnaire-unit", - "valueCoding": { - "code": "kg/m2", - "system": "http://unitsofmeasure.org", - "display": "kg/m2" - } - }, - { - "url": "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-calculatedExpression", - "valueExpression": { - "language": "text/fhirpath", - "expression": "(%QuestionnaireResponse.item.where(linkId='weight').answer.value.integer / ((%QuestionnaireResponse.item.where(linkId='height').answer.value.integer / 100) * (%QuestionnaireResponse.item.where(linkId='height').answer.value.integer / 100))).round(2)" - } - } - ], - "linkId": "bmi", - "readOnly": true, - "required": true - } - ], - "resourceType": "Questionnaire", - "extension": [ - { - "url": "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-launchContext", - "extension": [ - { - "url": "name", - "valueCoding": { - "code": "Patient" - } - }, - { - "url": "type", - "valueCode": "Patient" - } - ] - }, - { - "url": "http://beda.software/fhir-extensions/questionnaire-mapper", - "valueReference": { - "reference": "Mapping/vitals" - } - } - ], - "status": "active", - "id": "vitals", - "url": "https://aidbox.emr.beda.software/ui/console#/entities/Questionnaire/vitals" -} diff --git a/sdc-qrf/src/converter/__tests__/resources/questionnaire_response_fce/allergies_inprogress.json b/sdc-qrf/src/converter/__tests__/resources/questionnaire_response_fce/allergies_inprogress.json deleted file mode 100644 index f8c0e4aa..00000000 --- a/sdc-qrf/src/converter/__tests__/resources/questionnaire_response_fce/allergies_inprogress.json +++ /dev/null @@ -1,78 +0,0 @@ -{ - "questionnaire": "allergies", - "meta": { - "lastUpdated": "2023-04-06T02:48:18.132716Z", - "createdAt": "2023-04-06T02:48:18.132716Z", - "versionId": "20530" - }, - "encounter": { - "id": "e133b999-9e91-4ebd-967e-450bad770682", - "resourceType": "Encounter" - }, - "item": [ - { - "answer": [ - { - "value": { - "dateTime": "2023-04-06T02:48:16+00:00" - } - } - ], - "linkId": "dateTime" - }, - { - "answer": [ - { - "value": { - "string": "683e382b-fed4-433e-9b6d-a847a7953bc0" - } - } - ], - "linkId": "patientId" - }, - { - "answer": [ - { - "value": { - "string": "Emily Nguyen" - } - } - ], - "linkId": "patientName" - }, - { - "answer": [ - { - "value": { - "Coding": { - "code": "active", - "system": "http://terminology.hl7.org/ValueSet/allergyintolerance-clinical", - "display": "Active" - } - } - } - ], - "linkId": "status" - }, - { - "answer": [], - "linkId": "type" - }, - { - "answer": [], - "linkId": "reaction" - }, - { - "answer": [], - "linkId": "notes" - } - ], - "resourceType": "QuestionnaireResponse", - "source": { - "id": "683e382b-fed4-433e-9b6d-a847a7953bc0", - "resourceType": "Patient" - }, - "status": "in-progress", - "id": "f0a0b4cf-ff0e-47e2-814d-3327a138653e", - "authored": "2023-04-06T02:48:17.734Z" -} diff --git a/sdc-qrf/src/converter/__tests__/resources/questionnaire_response_fce/cardiology.json b/sdc-qrf/src/converter/__tests__/resources/questionnaire_response_fce/cardiology.json deleted file mode 100644 index a6b693c0..00000000 --- a/sdc-qrf/src/converter/__tests__/resources/questionnaire_response_fce/cardiology.json +++ /dev/null @@ -1,96 +0,0 @@ -{ - "questionnaire": "cardiology-example", - "meta": { - "lastUpdated": "2023-04-06T02:43:40.015349Z", - "createdAt": "2023-04-06T02:43:16.150751Z", - "versionId": "20529" - }, - "encounter": { - "id": "e133b999-9e91-4ebd-967e-450bad770682", - "resourceType": "Encounter" - }, - "item": [ - { - "answer": [ - { - "value": { - "string": "123" - } - } - ], - "linkId": "complaints" - }, - { - "answer": [ - { - "value": { - "string": "123" - } - } - ], - "linkId": "examination-objective" - }, - { - "answer": [ - { - "value": { - "string": "321" - } - } - ], - "linkId": "observations-data" - }, - { - "answer": [ - { - "value": { - "string": "321" - } - } - ], - "linkId": "lab-data" - }, - { - "item": [ - { - "item": [ - { - "answer": [ - { - "value": { - "Coding": { - "code": "BA40", - "system": "http://id.who.int/icd/release/11/mms", - "display": "BA40 Angina pectoris" - } - } - } - ], - "linkId": "ds-icd-11" - }, - { - "answer": [ - { - "value": { - "string": "desc 123" - } - } - ], - "linkId": "ds-text" - } - ], - "linkId": "ds-main" - } - ], - "linkId": "group-ds" - } - ], - "resourceType": "QuestionnaireResponse", - "source": { - "id": "683e382b-fed4-433e-9b6d-a847a7953bc0", - "resourceType": "Patient" - }, - "status": "completed", - "id": "16917bdf-309f-4cd7-9a8a-56a928dbedea", - "authored": "2023-04-06T02:43:39Z" -} diff --git a/sdc-qrf/src/converter/__tests__/resources/questionnaire_response_fce/few_answers.json b/sdc-qrf/src/converter/__tests__/resources/questionnaire_response_fce/few_answers.json deleted file mode 100644 index d14e3cbb..00000000 --- a/sdc-qrf/src/converter/__tests__/resources/questionnaire_response_fce/few_answers.json +++ /dev/null @@ -1,48 +0,0 @@ -{ - "item": [ - { - "answer": [ - { - "value": { - "Coding": { - "code": "39579001", - "system": "http://snomed.ct", - "display": "Anaphylaxis" - } - } - }, - { - "value": { - "Coding": { - "code": "247472004", - "system": "http://snomed.ct", - "display": "Hives (Wheal)" - } - } - }, - { - "value": { - "Coding": { - "code": "422587007", - "system": "http://snomed.ct", - "display": "Nausea" - } - } - } - ], - "linkId": "reaction" - } - ], - "source": { - "id": "test-patient", - "resourceType": "Patient" - }, - "status": "completed", - "authored": "2023-04-14T09:36:35Z", - "questionnaire": "allergies", - "id": "test", - "resourceType": "QuestionnaireResponse", - "meta": { - "createdAt": "2023-04-14T09:36:35.349085Z" - } -} diff --git a/sdc-qrf/src/converter/__tests__/resources/questionnaire_response_fce/gad_7.json b/sdc-qrf/src/converter/__tests__/resources/questionnaire_response_fce/gad_7.json deleted file mode 100644 index 3bd7c936..00000000 --- a/sdc-qrf/src/converter/__tests__/resources/questionnaire_response_fce/gad_7.json +++ /dev/null @@ -1,165 +0,0 @@ -{ - "questionnaire": "gad-7", - "meta": { - "lastUpdated": "2023-04-06T01:29:05.681893Z", - "createdAt": "2023-04-06T01:28:53.793848Z", - "versionId": "20442" - }, - "encounter": { - "id": "e133b999-9e91-4ebd-967e-450bad770682", - "resourceType": "Encounter" - }, - "item": [ - { - "answer": [ - { - "value": { - "dateTime": "2023-04-06T01:28:52+00:00" - } - } - ], - "linkId": "dateTime" - }, - { - "answer": [ - { - "value": { - "string": "683e382b-fed4-433e-9b6d-a847a7953bc0" - } - } - ], - "linkId": "patientId" - }, - { - "answer": [ - { - "value": { - "string": "Emily Nguyen" - } - } - ], - "linkId": "patientName" - }, - { - "item": [ - { - "answer": [ - { - "value": { - "Coding": { - "code": "LA6569-3", - "system": "http://loinc.org", - "display": "Several days" - } - } - } - ], - "linkId": "69725-0" - }, - { - "answer": [ - { - "value": { - "Coding": { - "code": "LA6570-1", - "system": "http://loinc.org", - "display": "More than half the days" - } - } - } - ], - "linkId": "68509-9" - }, - { - "answer": [ - { - "value": { - "Coding": { - "code": "LA6568-5", - "system": "http://loinc.org", - "display": "Not at all" - } - } - } - ], - "linkId": "69733-4" - }, - { - "answer": [ - { - "value": { - "Coding": { - "code": "LA6571-9", - "system": "http://loinc.org", - "display": "Nearly every day" - } - } - } - ], - "linkId": "69734-2" - }, - { - "answer": [ - { - "value": { - "Coding": { - "code": "LA6570-1", - "system": "http://loinc.org", - "display": "More than half the days" - } - } - } - ], - "linkId": "69735-9" - }, - { - "answer": [ - { - "value": { - "Coding": { - "code": "LA6569-3", - "system": "http://loinc.org", - "display": "Several days" - } - } - } - ], - "linkId": "69689-8" - }, - { - "answer": [ - { - "value": { - "Coding": { - "code": "LA6568-5", - "system": "http://loinc.org", - "display": "Not at all" - } - } - } - ], - "linkId": "69736-7" - }, - { - "answer": [ - { - "value": { - "integer": 9 - } - } - ], - "linkId": "anxiety-score" - } - ], - "linkId": "gad-7" - } - ], - "resourceType": "QuestionnaireResponse", - "source": { - "id": "683e382b-fed4-433e-9b6d-a847a7953bc0", - "resourceType": "Patient" - }, - "status": "completed", - "id": "a00b8309-f74f-462c-a7e4-64852d5bf707", - "authored": "2023-04-06T01:29:05Z" -} diff --git a/sdc-qrf/src/converter/__tests__/resources/questionnaire_response_fce/immunization.json b/sdc-qrf/src/converter/__tests__/resources/questionnaire_response_fce/immunization.json deleted file mode 100644 index 15ffa104..00000000 --- a/sdc-qrf/src/converter/__tests__/resources/questionnaire_response_fce/immunization.json +++ /dev/null @@ -1,86 +0,0 @@ -{ - "questionnaire": "immunization", - "meta": { - "lastUpdated": "2023-04-06T02:39:03.018390Z", - "createdAt": "2023-04-06T02:38:51.964987Z", - "versionId": "20519" - }, - "encounter": { - "id": "e133b999-9e91-4ebd-967e-450bad770682", - "resourceType": "Encounter" - }, - "item": [ - { - "answer": [ - { - "value": { - "dateTime": "2023-04-06T02:38:50+00:00" - } - } - ], - "linkId": "dateTime" - }, - { - "answer": [ - { - "value": { - "string": "e133b999-9e91-4ebd-967e-450bad770682" - } - } - ], - "linkId": "encounterId" - }, - { - "answer": [ - { - "value": { - "string": "683e382b-fed4-433e-9b6d-a847a7953bc0" - } - } - ], - "linkId": "patientId" - }, - { - "answer": [ - { - "value": { - "string": "Emily Nguyen" - } - } - ], - "linkId": "patientName" - }, - { - "answer": [ - { - "value": { - "Coding": { - "code": "173", - "system": "http://hl7.org/fhir/sid/cvx", - "display": "cholera, BivWC" - } - } - } - ], - "linkId": "vaccine-code" - }, - { - "answer": [ - { - "value": { - "date": "2023-04-13" - } - } - ], - "linkId": "date-of-injection" - } - ], - "resourceType": "QuestionnaireResponse", - "source": { - "id": "683e382b-fed4-433e-9b6d-a847a7953bc0", - "resourceType": "Patient" - }, - "status": "completed", - "id": "5d59e534-a7ce-4254-8a41-31b3895ea525", - "authored": "2023-04-06T02:39:02Z" -} diff --git a/sdc-qrf/src/converter/__tests__/resources/questionnaire_response_fce/medication.json b/sdc-qrf/src/converter/__tests__/resources/questionnaire_response_fce/medication.json deleted file mode 100644 index e49a8205..00000000 --- a/sdc-qrf/src/converter/__tests__/resources/questionnaire_response_fce/medication.json +++ /dev/null @@ -1,116 +0,0 @@ -{ - "questionnaire": "medication", - "meta": { - "lastUpdated": "2023-04-06T01:59:42.145206Z", - "createdAt": "2023-04-06T01:59:02.311377Z", - "versionId": "20458" - }, - "encounter": { - "id": "e133b999-9e91-4ebd-967e-450bad770682", - "resourceType": "Encounter" - }, - "item": [ - { - "answer": [ - { - "value": { - "dateTime": "2023-04-06T01:59:00+00:00" - } - } - ], - "linkId": "dateTime" - }, - { - "answer": [ - { - "value": { - "string": "e133b999-9e91-4ebd-967e-450bad770682" - } - } - ], - "linkId": "encounterId" - }, - { - "answer": [ - { - "value": { - "string": "683e382b-fed4-433e-9b6d-a847a7953bc0" - } - } - ], - "linkId": "patientId" - }, - { - "answer": [ - { - "value": { - "string": "Emily Nguyen" - } - } - ], - "linkId": "patientName" - }, - { - "answer": [ - { - "value": { - "Coding": { - "code": "261000", - "system": "http://snomed.info/sct", - "display": "Codeine phosphate" - } - } - } - ], - "linkId": "medication" - }, - { - "answer": [ - { - "value": { - "string": "25 or 20" - } - } - ], - "linkId": "dosage" - }, - { - "answer": [ - { - "value": { - "date": "2023-04-10" - } - } - ], - "linkId": "start-date" - }, - { - "answer": [ - { - "value": { - "date": "2023-04-17" - } - } - ], - "linkId": "stop-date" - }, - { - "answer": [ - { - "value": { - "string": "nothing" - } - } - ], - "linkId": "notes" - } - ], - "resourceType": "QuestionnaireResponse", - "source": { - "id": "683e382b-fed4-433e-9b6d-a847a7953bc0", - "resourceType": "Patient" - }, - "status": "completed", - "id": "3d077aed-ccd4-43d4-843e-0e2224e7571e", - "authored": "2023-04-06T01:59:41Z" -} diff --git a/sdc-qrf/src/converter/__tests__/resources/questionnaire_response_fce/new_appointment.json b/sdc-qrf/src/converter/__tests__/resources/questionnaire_response_fce/new_appointment.json deleted file mode 100644 index 1e672c05..00000000 --- a/sdc-qrf/src/converter/__tests__/resources/questionnaire_response_fce/new_appointment.json +++ /dev/null @@ -1,96 +0,0 @@ -{ - "authored": "2023-04-05T06:27:57Z", - "id": "cf6d9d4b-bfcd-463f-9d26-b6769c2a3fc3", - "item": [ - { - "answer": [ - { - "value": { - "string": "683e382b-fed4-433e-9b6d-a847a7953bc0" - } - } - ], - "linkId": "patientId" - }, - { - "answer": [ - { - "value": { - "string": "Emily Nguyen" - } - } - ], - "linkId": "patientName" - }, - { - "answer": [ - { - "value": { - "Reference": { - "display": "Sanjay Patel - Cardiology", - "id": "429e6a55-8a64-4ede-ad12-1206522253eb", - "resourceType": "PractitionerRole" - } - } - } - ], - "linkId": "practitioner-role" - }, - { - "answer": [ - { - "value": { - "Coding": { - "code": "consultation", - "display": "The first appointment", - "system": "http://fhir.org/guides/argonaut-scheduling/CodeSystem/visit-type" - } - } - } - ], - "linkId": "service" - }, - { - "answer": [ - { - "value": { - "date": "2023-04-26" - } - } - ], - "linkId": "date" - }, - { - "item": [ - { - "answer": [ - { - "value": { - "time": "15:00:00" - } - } - ], - "linkId": "start-time" - }, - { - "answer": [ - { - "value": { - "time": "16:00:00" - } - } - ], - "linkId": "end-time" - } - ], - "linkId": "Time period" - } - ], - "meta": { - "createdAt": "2023-04-05T06:27:58.499391Z", - "lastUpdated": "2023-04-05T06:27:58.499391Z", - "versionId": "20420" - }, - "resourceType": "QuestionnaireResponse", - "status": "completed" -} diff --git a/sdc-qrf/src/converter/__tests__/resources/questionnaire_response_fce/patient.json b/sdc-qrf/src/converter/__tests__/resources/questionnaire_response_fce/patient.json deleted file mode 100644 index b2420a6c..00000000 --- a/sdc-qrf/src/converter/__tests__/resources/questionnaire_response_fce/patient.json +++ /dev/null @@ -1,87 +0,0 @@ -{ - "authored": "2023-04-05T06:03:19Z", - "id": "24306b57-b463-4e39-807f-e715a80bbe5f", - "item": [ - { - "answer": [], - "linkId": "patient-id" - }, - { - "answer": [ - { - "value": { - "string": "Nguyen" - } - } - ], - "linkId": "last-name" - }, - { - "answer": [ - { - "value": { - "string": "Emily" - } - } - ], - "linkId": "first-name" - }, - { - "answer": [ - { - "value": { - "string": "Marie" - } - } - ], - "linkId": "middle-name" - }, - { - "answer": [ - { - "value": { - "date": "1991-12-29" - } - } - ], - "linkId": "birth-date" - }, - { - "answer": [ - { - "value": { - "string": "female" - } - } - ], - "linkId": "gender" - }, - { - "answer": [ - { - "value": { - "string": "123-45-6789" - } - } - ], - "linkId": "ssn" - }, - { - "answer": [ - { - "value": { - "string": "15551234567" - } - } - ], - "linkId": "mobile" - } - ], - "meta": { - "createdAt": "2023-04-05T06:03:21.353895Z", - "lastUpdated": "2023-04-05T06:03:21.353895Z", - "versionId": "20412" - }, - "resourceType": "QuestionnaireResponse", - "status": "completed" -} diff --git a/sdc-qrf/src/converter/__tests__/resources/questionnaire_response_fce/phq_2_phq_9.json b/sdc-qrf/src/converter/__tests__/resources/questionnaire_response_fce/phq_2_phq_9.json deleted file mode 100644 index 550bc280..00000000 --- a/sdc-qrf/src/converter/__tests__/resources/questionnaire_response_fce/phq_2_phq_9.json +++ /dev/null @@ -1,193 +0,0 @@ -{ - "authored": "2023-04-06T02:33:05Z", - "encounter": { - "id": "e133b999-9e91-4ebd-967e-450bad770682", - "resourceType": "Encounter" - }, - "id": "846558b9-4c03-4af6-a258-62b0390633e2", - "item": [ - { - "answer": [ - { - "value": { - "dateTime": "2023-04-06T02:32:40+00:00" - } - } - ], - "linkId": "dateTime" - }, - { - "answer": [ - { - "value": { - "string": "683e382b-fed4-433e-9b6d-a847a7953bc0" - } - } - ], - "linkId": "patientId" - }, - { - "answer": [ - { - "value": { - "string": "Emily Nguyen" - } - } - ], - "linkId": "patientName" - }, - { - "item": [ - { - "answer": [ - { - "value": { - "Coding": { - "code": "LA6568-5", - "display": "Not at all", - "system": "http://loinc.org" - } - } - } - ], - "linkId": "44250-9" - }, - { - "answer": [ - { - "value": { - "Coding": { - "code": "LA6569-3", - "display": "Several days", - "system": "http://loinc.org" - } - } - } - ], - "linkId": "44255-8" - }, - { - "answer": [ - { - "value": { - "Coding": { - "code": "LA6570-1", - "display": "More than half the days", - "system": "http://loinc.org" - } - } - } - ], - "linkId": "44259-0" - }, - { - "answer": [ - { - "value": { - "Coding": { - "code": "LA6571-9", - "display": "Nearly every day", - "system": "http://loinc.org" - } - } - } - ], - "linkId": "44254-1" - }, - { - "answer": [ - { - "value": { - "Coding": { - "code": "LA6570-1", - "display": "More than half the days", - "system": "http://loinc.org" - } - } - } - ], - "linkId": "44251-7" - }, - { - "answer": [ - { - "value": { - "Coding": { - "code": "LA6569-3", - "display": "Several days", - "system": "http://loinc.org" - } - } - } - ], - "linkId": "44258-2" - }, - { - "answer": [ - { - "value": { - "Coding": { - "code": "LA6568-5", - "display": "Not at all", - "system": "http://loinc.org" - } - } - } - ], - "linkId": "44252-5" - }, - { - "answer": [ - { - "value": { - "Coding": { - "code": "LA6569-3", - "display": "Several days", - "system": "http://loinc.org" - } - } - } - ], - "linkId": "44253-3" - }, - { - "answer": [ - { - "value": { - "Coding": { - "code": "LA6570-1", - "display": "More than half the days", - "system": "http://loinc.org" - } - } - } - ], - "linkId": "44260-8" - }, - { - "answer": [ - { - "value": { - "integer": 12 - } - } - ], - "linkId": "phq9-total-score" - } - ], - "linkId": "phq2phq9" - } - ], - "meta": { - "createdAt": "2023-04-06T02:32:41.569773Z", - "lastUpdated": "2023-04-06T02:33:06.758734Z", - "versionId": "20508" - }, - "questionnaire": "phq2phq9", - "resourceType": "QuestionnaireResponse", - "source": { - "id": "683e382b-fed4-433e-9b6d-a847a7953bc0", - "resourceType": "Patient" - }, - "status": "completed" -} diff --git a/sdc-qrf/src/converter/__tests__/resources/questionnaire_response_fce/physicalexam.json b/sdc-qrf/src/converter/__tests__/resources/questionnaire_response_fce/physicalexam.json deleted file mode 100644 index a30b6882..00000000 --- a/sdc-qrf/src/converter/__tests__/resources/questionnaire_response_fce/physicalexam.json +++ /dev/null @@ -1,187 +0,0 @@ -{ - "questionnaire": "physical-exam", - "meta": { - "lastUpdated": "2023-04-06T02:05:52.434771Z", - "createdAt": "2023-04-06T02:05:32.668369Z", - "versionId": "20470" - }, - "encounter": { - "id": "e133b999-9e91-4ebd-967e-450bad770682", - "resourceType": "Encounter" - }, - "item": [ - { - "item": [ - { - "answer": [ - { - "value": { - "string": "Well nourished, well developed, awake and alert, resting comfortably in no acute distress, cooperative on exam" - } - } - ], - "linkId": "general" - }, - { - "answer": [ - { - "value": { - "string": "NCAT, PERRL, normal conjunctivae, nonicteric sclerae, bilateral EAC/TM clear, no nasal discharge, OP clear, moist mucous membranes" - } - } - ], - "linkId": "heent" - }, - { - "answer": [ - { - "value": { - "string": "Supple, normal ROM, no lymphadenopathy/masses, nontender" - } - } - ], - "linkId": "neck" - }, - { - "answer": [ - { - "value": { - "string": "RRR, normal S1/S2, no murmurs/gallops/rub" - } - } - ], - "linkId": "cardiovascular" - }, - { - "answer": [ - { - "value": { - "string": "No respiratory distress, lungs CTAB: no rales, rhonchi, or wheeze" - } - } - ], - "linkId": "pulmonary" - }, - { - "answer": [ - { - "value": { - "string": "Soft and non-tender with no guarding or rebound; +BS normoactive, no tympany on auscultation" - } - } - ], - "linkId": "abdominal" - }, - { - "answer": [ - { - "value": { - "string": "Normal ROM of UE and LE, normal bulk and tone," - } - } - ], - "linkId": "musculoskeletal" - }, - { - "answer": [ - { - "value": { - "string": "Pulses intact with normal cap refill, no LE pitting edema or calf tenderness" - } - } - ], - "linkId": "extremities" - }, - { - "answer": [ - { - "value": { - "string": "AAOx3, converses normally. CN II - XII grossly intact. Gait and coordination intact. 5+ BL UE/LE strength, no gross motor or sensory defects" - } - } - ], - "linkId": "neurologic" - }, - { - "answer": [ - { - "value": { - "string": "Normal mood and affect. Judgement/competence is appropriate" - } - } - ], - "linkId": "psychiatric" - }, - { - "answer": [ - { - "value": { - "string": "Warm, dry, and intact. No rashes, dermatoses, petechiae, or lesions" - } - } - ], - "linkId": "skin" - }, - { - "answer": [ - { - "value": { - "string": "Normal sensation bilaterally on soles of feet with 10g monofilament" - } - } - ], - "linkId": "monofilament" - }, - { - "answer": [ - { - "value": { - "string": "The chest wall is symmetric, without deformity, and is atraumatic in appearance" - } - } - ], - "linkId": "chest" - }, - { - "answer": [ - { - "value": { - "string": "External genitalia without erythema, exudate or discharge" - } - } - ], - "linkId": "genitourinary-female" - }, - { - "answer": [ - { - "value": { - "string": "Normal external anus and normal tone. No palpable masses, normal mucosa, brown stool. Hemoccult negative" - } - } - ], - "linkId": "rectal" - }, - { - "answer": [ - { - "value": { - "string": "No enlarged lymph nodes of occipital, pre- and postauricular, submandibular, anterior or posterior cervical, or supraclavicular identified" - } - } - ], - "linkId": "lymphatic" - } - ], - "linkId": "physical-exam-group" - } - ], - "resourceType": "QuestionnaireResponse", - "source": { - "id": "683e382b-fed4-433e-9b6d-a847a7953bc0", - "resourceType": "Patient" - }, - "status": "completed", - "id": "288fd914-b836-47dd-863a-e7d86a923f28", - "authored": "2023-04-06T02:05:51Z" -} diff --git a/sdc-qrf/src/converter/__tests__/resources/questionnaire_response_fce/practitioner.json b/sdc-qrf/src/converter/__tests__/resources/questionnaire_response_fce/practitioner.json deleted file mode 100644 index 437cece2..00000000 --- a/sdc-qrf/src/converter/__tests__/resources/questionnaire_response_fce/practitioner.json +++ /dev/null @@ -1,57 +0,0 @@ -{ - "authored": "2023-04-05T06:09:09Z", - "id": "cedd0c3e-be1a-4c1b-92af-351ed76fe41e", - "item": [ - { - "answer": [ - { - "value": { - "string": "Patel" - } - } - ], - "linkId": "last-name" - }, - { - "answer": [ - { - "value": { - "string": "Sanjay" - } - } - ], - "linkId": "first-name" - }, - { - "answer": [ - { - "value": { - "string": "Kumar" - } - } - ], - "linkId": "middle-name" - }, - { - "answer": [ - { - "value": { - "Coding": { - "code": "394579002", - "display": "Cardiology", - "system": "http://snomed.info/sct" - } - } - } - ], - "linkId": "specialty" - } - ], - "meta": { - "createdAt": "2023-04-05T06:09:10.640955Z", - "lastUpdated": "2023-04-05T06:09:10.640955Z", - "versionId": "20415" - }, - "resourceType": "QuestionnaireResponse", - "status": "completed" -} diff --git a/sdc-qrf/src/converter/__tests__/resources/questionnaire_response_fce/reference_answer_with_assoc.json b/sdc-qrf/src/converter/__tests__/resources/questionnaire_response_fce/reference_answer_with_assoc.json deleted file mode 100644 index 345665ce..00000000 --- a/sdc-qrf/src/converter/__tests__/resources/questionnaire_response_fce/reference_answer_with_assoc.json +++ /dev/null @@ -1,147 +0,0 @@ -{ - "authored": "2023-04-05T06:27:57Z", - "id": "cf6d9d4b-bfcd-463f-9d26-b6769c2a3fc3", - "item": [ - { - "answer": [ - { - "value": { - "string": "683e382b-fed4-433e-9b6d-a847a7953bc0" - } - } - ], - "linkId": "patientId" - }, - { - "answer": [ - { - "value": { - "string": "Emily Nguyen" - } - } - ], - "linkId": "patientName" - }, - { - "answer": [ - { - "value": { - "Reference": { - "display": "Sanjay Patel - Cardiology", - "id": "429e6a55-8a64-4ede-ad12-1206522253eb", - "resource": { - "healthcareService": [ - { - "display": "The first appointment", - "id": "consultation", - "resourceType": "HealthcareService" - }, - { - "display": "A follow up visit", - "id": "follow-up", - "resourceType": "HealthcareService" - } - ], - "id": "429e6a55-8a64-4ede-ad12-1206522253eb", - "meta": { - "createdAt": "2023-04-05T06:09:11.092359Z", - "lastUpdated": "2023-04-05T06:09:11.092359Z", - "versionId": "20418" - }, - "practitioner": { - "id": "42e9bdc0-4fe6-4b8d-a6a5-fcb68f1fe836", - "resource": { - "id": "42e9bdc0-4fe6-4b8d-a6a5-fcb68f1fe836", - "meta": { - "createdAt": "2023-04-05T06:09:11.092359Z", - "lastUpdated": "2023-04-05T06:09:11.092359Z", - "versionId": "20416" - }, - "name": [ - { - "family": "Patel", - "given": ["Sanjay", "Kumar"] - } - ], - "resourceType": "Practitioner" - }, - "resourceType": "Practitioner" - }, - "resourceType": "PractitionerRole", - "specialty": [ - { - "coding": [ - { - "code": "394579002", - "display": "Cardiology", - "system": "http://snomed.info/sct" - } - ] - } - ] - }, - "resourceType": "PractitionerRole" - } - } - } - ], - "linkId": "practitioner-role" - }, - { - "answer": [ - { - "value": { - "Coding": { - "code": "consultation", - "display": "The first appointment", - "system": "http://fhir.org/guides/argonaut-scheduling/CodeSystem/visit-type" - } - } - } - ], - "linkId": "service" - }, - { - "answer": [ - { - "value": { - "date": "2023-04-26" - } - } - ], - "linkId": "date" - }, - { - "item": [ - { - "answer": [ - { - "value": { - "time": "15:00:00" - } - } - ], - "linkId": "start-time" - }, - { - "answer": [ - { - "value": { - "time": "16:00:00" - } - } - ], - "linkId": "end-time" - } - ], - "linkId": "Time period" - } - ], - "meta": { - "createdAt": "2023-04-05T06:27:58.499391Z", - "lastUpdated": "2023-04-05T06:27:58.499391Z", - "versionId": "20420" - }, - "resourceType": "QuestionnaireResponse", - "status": "completed" -} diff --git a/sdc-qrf/src/converter/__tests__/resources/questionnaire_response_fce/review_of_systems.json b/sdc-qrf/src/converter/__tests__/resources/questionnaire_response_fce/review_of_systems.json deleted file mode 100644 index f588391d..00000000 --- a/sdc-qrf/src/converter/__tests__/resources/questionnaire_response_fce/review_of_systems.json +++ /dev/null @@ -1,129 +0,0 @@ -{ - "authored": "2023-04-06T02:11:08Z", - "encounter": { - "id": "e133b999-9e91-4ebd-967e-450bad770682", - "resourceType": "Encounter" - }, - "id": "d575fe05-9db2-4df8-b131-48bb5d27509d", - "item": [ - { - "answer": [ - { - "value": { - "boolean": true - } - } - ], - "linkId": "provider-viewed-confirmation" - }, - { - "item": [ - { - "answer": [], - "linkId": "general" - }, - { - "answer": [ - { - "value": { - "boolean": true - } - } - ], - "linkId": "heent" - }, - { - "answer": [ - { - "value": { - "string": "heent" - } - } - ], - "linkId": "heent-comment" - }, - { - "answer": [], - "linkId": "cardiovascular" - }, - { - "answer": [], - "linkId": "respiratory" - }, - { - "answer": [ - { - "value": { - "boolean": true - } - } - ], - "linkId": "gastrointestinal" - }, - { - "answer": [ - { - "value": { - "string": "gastrointestinal" - } - } - ], - "linkId": "gastrointestinal-comment" - }, - { - "answer": [], - "linkId": "genitourinary" - }, - { - "answer": [], - "linkId": "musculoskeletal" - }, - { - "answer": [], - "linkId": "neurologic" - }, - { - "answer": [ - { - "value": { - "boolean": true - } - } - ], - "linkId": "psychiatric" - }, - { - "answer": [ - { - "value": { - "string": "psychiatric" - } - } - ], - "linkId": "psychiatric-comment" - }, - { - "answer": [], - "linkId": "skin" - }, - { - "answer": [], - "linkId": "other" - } - ], - "linkId": "abnormal-systems-group" - } - ], - "meta": { - "createdAt": "2023-04-06T02:10:37.718483Z", - "lastUpdated": "2023-04-06T02:11:09.776717Z", - "versionId": "20480" - }, - "questionnaire": "review-of-systems", - "resourceType": "QuestionnaireResponse", - "source": { - "id": "683e382b-fed4-433e-9b6d-a847a7953bc0", - "resourceType": "Patient" - }, - "status": "completed" -} diff --git a/sdc-qrf/src/converter/__tests__/resources/questionnaire_response_fce/vitals.json b/sdc-qrf/src/converter/__tests__/resources/questionnaire_response_fce/vitals.json deleted file mode 100644 index 7e07b37a..00000000 --- a/sdc-qrf/src/converter/__tests__/resources/questionnaire_response_fce/vitals.json +++ /dev/null @@ -1,168 +0,0 @@ -{ - "questionnaire": "vitals", - "meta": { - "lastUpdated": "2023-04-06T02:20:25.903562Z", - "createdAt": "2023-04-06T02:19:51.712237Z", - "versionId": "20492" - }, - "encounter": { - "id": "e133b999-9e91-4ebd-967e-450bad770682", - "resourceType": "Encounter" - }, - "item": [ - { - "answer": [ - { - "value": { - "string": "683e382b-fed4-433e-9b6d-a847a7953bc0" - } - } - ], - "linkId": "patientId" - }, - { - "answer": [ - { - "value": { - "string": "Emily Nguyen" - } - } - ], - "linkId": "patientName" - }, - { - "answer": [ - { - "value": { - "integer": 180 - } - } - ], - "linkId": "height" - }, - { - "answer": [ - { - "value": { - "integer": 80 - } - } - ], - "linkId": "weight" - }, - { - "answer": [ - { - "value": { - "integer": 36 - } - } - ], - "linkId": "temperature" - }, - { - "answer": [ - { - "value": { - "integer": 56 - } - } - ], - "linkId": "oxygen-saturation" - }, - { - "answer": [ - { - "value": { - "integer": 100 - } - } - ], - "linkId": "pulse-rate" - }, - { - "answer": [ - { - "value": { - "integer": 50 - } - } - ], - "linkId": "respiratory-rate" - }, - { - "item": [ - { - "item": [ - { - "answer": [ - { - "value": { - "integer": 45 - } - } - ], - "linkId": "blood-pressure-systolic" - }, - { - "answer": [ - { - "value": { - "integer": 67 - } - } - ], - "linkId": "blood-pressure-diastolic" - } - ], - "linkId": "blood-pressure-systolic-diastolic" - }, - { - "answer": [ - { - "value": { - "Coding": { - "code": "sitting", - "display": "Sitting" - } - } - } - ], - "linkId": "blood-pressure-positions" - }, - { - "answer": [ - { - "value": { - "Coding": { - "code": "biceps-left", - "display": "Biceps left" - } - } - } - ], - "linkId": "blood-pressure-arm" - } - ], - "linkId": "blood-pressure" - }, - { - "answer": [ - { - "value": { - "integer": 24.69 - } - } - ], - "linkId": "bmi" - } - ], - "resourceType": "QuestionnaireResponse", - "source": { - "id": "683e382b-fed4-433e-9b6d-a847a7953bc0", - "resourceType": "Patient" - }, - "status": "completed", - "id": "a583cc11-99c6-4719-acab-cb3fb72f5078", - "authored": "2023-04-06T02:20:25Z" -} diff --git a/sdc-qrf/src/converter/__tests__/resources/questionnaire_response_fhir/allergies_inprogress.json b/sdc-qrf/src/converter/__tests__/resources/questionnaire_response_fhir/allergies_inprogress.json deleted file mode 100644 index 807858d6..00000000 --- a/sdc-qrf/src/converter/__tests__/resources/questionnaire_response_fhir/allergies_inprogress.json +++ /dev/null @@ -1,73 +0,0 @@ -{ - "questionnaire": "allergies", - "meta": { - "lastUpdated": "2023-04-06T02:48:18.132716Z", - "versionId": "20530", - "extension": [ - { - "url": "ex:createdAt", - "valueInstant": "2023-04-06T02:48:18.132716Z" - } - ] - }, - "encounter": { - "reference": "Encounter/e133b999-9e91-4ebd-967e-450bad770682" - }, - "item": [ - { - "answer": [ - { - "valueDateTime": "2023-04-06T02:48:16+00:00" - } - ], - "linkId": "dateTime" - }, - { - "answer": [ - { - "valueString": "683e382b-fed4-433e-9b6d-a847a7953bc0" - } - ], - "linkId": "patientId" - }, - { - "answer": [ - { - "valueString": "Emily Nguyen" - } - ], - "linkId": "patientName" - }, - { - "answer": [ - { - "valueCoding": { - "code": "active", - "system": "http://terminology.hl7.org/ValueSet/allergyintolerance-clinical", - "display": "Active" - } - } - ], - "linkId": "status" - }, - { - "answer": [], - "linkId": "type" - }, - { - "answer": [], - "linkId": "reaction" - }, - { - "answer": [], - "linkId": "notes" - } - ], - "resourceType": "QuestionnaireResponse", - "source": { - "reference": "Patient/683e382b-fed4-433e-9b6d-a847a7953bc0" - }, - "status": "in-progress", - "id": "f0a0b4cf-ff0e-47e2-814d-3327a138653e", - "authored": "2023-04-06T02:48:17.734Z" -} diff --git a/sdc-qrf/src/converter/__tests__/resources/questionnaire_response_fhir/cardiology.json b/sdc-qrf/src/converter/__tests__/resources/questionnaire_response_fhir/cardiology.json deleted file mode 100644 index 56806750..00000000 --- a/sdc-qrf/src/converter/__tests__/resources/questionnaire_response_fhir/cardiology.json +++ /dev/null @@ -1,87 +0,0 @@ -{ - "questionnaire": "cardiology-example", - "meta": { - "lastUpdated": "2023-04-06T02:43:40.015349Z", - "versionId": "20529", - "extension": [ - { - "url": "ex:createdAt", - "valueInstant": "2023-04-06T02:43:16.150751Z" - } - ] - }, - "encounter": { - "reference": "Encounter/e133b999-9e91-4ebd-967e-450bad770682" - }, - "item": [ - { - "answer": [ - { - "valueString": "123" - } - ], - "linkId": "complaints" - }, - { - "answer": [ - { - "valueString": "123" - } - ], - "linkId": "examination-objective" - }, - { - "answer": [ - { - "valueString": "321" - } - ], - "linkId": "observations-data" - }, - { - "answer": [ - { - "valueString": "321" - } - ], - "linkId": "lab-data" - }, - { - "item": [ - { - "item": [ - { - "answer": [ - { - "valueCoding": { - "code": "BA40", - "system": "http://id.who.int/icd/release/11/mms", - "display": "BA40 Angina pectoris" - } - } - ], - "linkId": "ds-icd-11" - }, - { - "answer": [ - { - "valueString": "desc 123" - } - ], - "linkId": "ds-text" - } - ], - "linkId": "ds-main" - } - ], - "linkId": "group-ds" - } - ], - "resourceType": "QuestionnaireResponse", - "source": { - "reference": "Patient/683e382b-fed4-433e-9b6d-a847a7953bc0" - }, - "status": "completed", - "id": "16917bdf-309f-4cd7-9a8a-56a928dbedea", - "authored": "2023-04-06T02:43:39Z" -} diff --git a/sdc-qrf/src/converter/__tests__/resources/questionnaire_response_fhir/few_answers.json b/sdc-qrf/src/converter/__tests__/resources/questionnaire_response_fhir/few_answers.json deleted file mode 100644 index a174cc15..00000000 --- a/sdc-qrf/src/converter/__tests__/resources/questionnaire_response_fhir/few_answers.json +++ /dev/null @@ -1,46 +0,0 @@ -{ - "item": [ - { - "answer": [ - { - "valueCoding": { - "code": "39579001", - "system": "http://snomed.ct", - "display": "Anaphylaxis" - } - }, - { - "valueCoding": { - "code": "247472004", - "system": "http://snomed.ct", - "display": "Hives (Wheal)" - } - }, - { - "valueCoding": { - "code": "422587007", - "system": "http://snomed.ct", - "display": "Nausea" - } - } - ], - "linkId": "reaction" - } - ], - "source": { - "reference": "Patient/test-patient" - }, - "status": "completed", - "authored": "2023-04-14T09:36:35Z", - "questionnaire": "allergies", - "id": "test", - "resourceType": "QuestionnaireResponse", - "meta": { - "extension": [ - { - "url": "ex:createdAt", - "valueInstant": "2023-04-14T09:36:35.349085Z" - } - ] - } -} diff --git a/sdc-qrf/src/converter/__tests__/resources/questionnaire_response_fhir/gad_7.json b/sdc-qrf/src/converter/__tests__/resources/questionnaire_response_fhir/gad_7.json deleted file mode 100644 index d1fa7e5c..00000000 --- a/sdc-qrf/src/converter/__tests__/resources/questionnaire_response_fhir/gad_7.json +++ /dev/null @@ -1,146 +0,0 @@ -{ - "questionnaire": "gad-7", - "meta": { - "lastUpdated": "2023-04-06T01:29:05.681893Z", - "versionId": "20442", - "extension": [ - { - "url": "ex:createdAt", - "valueInstant": "2023-04-06T01:28:53.793848Z" - } - ] - }, - "encounter": { - "reference": "Encounter/e133b999-9e91-4ebd-967e-450bad770682" - }, - "item": [ - { - "answer": [ - { - "valueDateTime": "2023-04-06T01:28:52+00:00" - } - ], - "linkId": "dateTime" - }, - { - "answer": [ - { - "valueString": "683e382b-fed4-433e-9b6d-a847a7953bc0" - } - ], - "linkId": "patientId" - }, - { - "answer": [ - { - "valueString": "Emily Nguyen" - } - ], - "linkId": "patientName" - }, - { - "item": [ - { - "answer": [ - { - "valueCoding": { - "code": "LA6569-3", - "system": "http://loinc.org", - "display": "Several days" - } - } - ], - "linkId": "69725-0" - }, - { - "answer": [ - { - "valueCoding": { - "code": "LA6570-1", - "system": "http://loinc.org", - "display": "More than half the days" - } - } - ], - "linkId": "68509-9" - }, - { - "answer": [ - { - "valueCoding": { - "code": "LA6568-5", - "system": "http://loinc.org", - "display": "Not at all" - } - } - ], - "linkId": "69733-4" - }, - { - "answer": [ - { - "valueCoding": { - "code": "LA6571-9", - "system": "http://loinc.org", - "display": "Nearly every day" - } - } - ], - "linkId": "69734-2" - }, - { - "answer": [ - { - "valueCoding": { - "code": "LA6570-1", - "system": "http://loinc.org", - "display": "More than half the days" - } - } - ], - "linkId": "69735-9" - }, - { - "answer": [ - { - "valueCoding": { - "code": "LA6569-3", - "system": "http://loinc.org", - "display": "Several days" - } - } - ], - "linkId": "69689-8" - }, - { - "answer": [ - { - "valueCoding": { - "code": "LA6568-5", - "system": "http://loinc.org", - "display": "Not at all" - } - } - ], - "linkId": "69736-7" - }, - { - "answer": [ - { - "valueInteger": 9 - } - ], - "linkId": "anxiety-score" - } - ], - "linkId": "gad-7" - } - ], - "resourceType": "QuestionnaireResponse", - "source": { - "reference": "Patient/683e382b-fed4-433e-9b6d-a847a7953bc0" - }, - "status": "completed", - "id": "a00b8309-f74f-462c-a7e4-64852d5bf707", - "authored": "2023-04-06T01:29:05Z" -} diff --git a/sdc-qrf/src/converter/__tests__/resources/questionnaire_response_fhir/immunization.json b/sdc-qrf/src/converter/__tests__/resources/questionnaire_response_fhir/immunization.json deleted file mode 100644 index 0a4e9ad2..00000000 --- a/sdc-qrf/src/converter/__tests__/resources/questionnaire_response_fhir/immunization.json +++ /dev/null @@ -1,77 +0,0 @@ -{ - "questionnaire": "immunization", - "meta": { - "lastUpdated": "2023-04-06T02:39:03.018390Z", - "versionId": "20519", - "extension": [ - { - "url": "ex:createdAt", - "valueInstant": "2023-04-06T02:38:51.964987Z" - } - ] - }, - "encounter": { - "reference": "Encounter/e133b999-9e91-4ebd-967e-450bad770682" - }, - "item": [ - { - "answer": [ - { - "valueDateTime": "2023-04-06T02:38:50+00:00" - } - ], - "linkId": "dateTime" - }, - { - "answer": [ - { - "valueString": "e133b999-9e91-4ebd-967e-450bad770682" - } - ], - "linkId": "encounterId" - }, - { - "answer": [ - { - "valueString": "683e382b-fed4-433e-9b6d-a847a7953bc0" - } - ], - "linkId": "patientId" - }, - { - "answer": [ - { - "valueString": "Emily Nguyen" - } - ], - "linkId": "patientName" - }, - { - "answer": [ - { - "valueCoding": { - "code": "173", - "system": "http://hl7.org/fhir/sid/cvx", - "display": "cholera, BivWC" - } - } - ], - "linkId": "vaccine-code" - }, - { - "answer": [ - { - "valueDate": "2023-04-13" - } - ], - "linkId": "date-of-injection" - } - ], - "resourceType": "QuestionnaireResponse", - "source": { - "reference": "Patient/683e382b-fed4-433e-9b6d-a847a7953bc0" - }, - "status": "completed", - "id": "5d59e534-a7ce-4254-8a41-31b3895ea525", - "authored": "2023-04-06T02:39:02Z" -} diff --git a/sdc-qrf/src/converter/__tests__/resources/questionnaire_response_fhir/medication.json b/sdc-qrf/src/converter/__tests__/resources/questionnaire_response_fhir/medication.json deleted file mode 100644 index 692dbeaf..00000000 --- a/sdc-qrf/src/converter/__tests__/resources/questionnaire_response_fhir/medication.json +++ /dev/null @@ -1,101 +0,0 @@ -{ - "questionnaire": "medication", - "meta": { - "lastUpdated": "2023-04-06T01:59:42.145206Z", - "versionId": "20458", - "extension": [ - { - "url": "ex:createdAt", - "valueInstant": "2023-04-06T01:59:02.311377Z" - } - ] - }, - "encounter": { - "reference": "Encounter/e133b999-9e91-4ebd-967e-450bad770682" - }, - "item": [ - { - "answer": [ - { - "valueDateTime": "2023-04-06T01:59:00+00:00" - } - ], - "linkId": "dateTime" - }, - { - "answer": [ - { - "valueString": "e133b999-9e91-4ebd-967e-450bad770682" - } - ], - "linkId": "encounterId" - }, - { - "answer": [ - { - "valueString": "683e382b-fed4-433e-9b6d-a847a7953bc0" - } - ], - "linkId": "patientId" - }, - { - "answer": [ - { - "valueString": "Emily Nguyen" - } - ], - "linkId": "patientName" - }, - { - "answer": [ - { - "valueCoding": { - "code": "261000", - "system": "http://snomed.info/sct", - "display": "Codeine phosphate" - } - } - ], - "linkId": "medication" - }, - { - "answer": [ - { - "valueString": "25 or 20" - } - ], - "linkId": "dosage" - }, - { - "answer": [ - { - "valueDate": "2023-04-10" - } - ], - "linkId": "start-date" - }, - { - "answer": [ - { - "valueDate": "2023-04-17" - } - ], - "linkId": "stop-date" - }, - { - "answer": [ - { - "valueString": "nothing" - } - ], - "linkId": "notes" - } - ], - "resourceType": "QuestionnaireResponse", - "source": { - "reference": "Patient/683e382b-fed4-433e-9b6d-a847a7953bc0" - }, - "status": "completed", - "id": "3d077aed-ccd4-43d4-843e-0e2224e7571e", - "authored": "2023-04-06T01:59:41Z" -} diff --git a/sdc-qrf/src/converter/__tests__/resources/questionnaire_response_fhir/new_appointment.json b/sdc-qrf/src/converter/__tests__/resources/questionnaire_response_fhir/new_appointment.json deleted file mode 100644 index def4f348..00000000 --- a/sdc-qrf/src/converter/__tests__/resources/questionnaire_response_fhir/new_appointment.json +++ /dev/null @@ -1,86 +0,0 @@ -{ - "authored": "2023-04-05T06:27:57Z", - "id": "cf6d9d4b-bfcd-463f-9d26-b6769c2a3fc3", - "item": [ - { - "answer": [ - { - "valueString": "683e382b-fed4-433e-9b6d-a847a7953bc0" - } - ], - "linkId": "patientId" - }, - { - "answer": [ - { - "valueString": "Emily Nguyen" - } - ], - "linkId": "patientName" - }, - { - "answer": [ - { - "valueReference": { - "display": "Sanjay Patel - Cardiology", - "reference": "PractitionerRole/429e6a55-8a64-4ede-ad12-1206522253eb" - } - } - ], - "linkId": "practitioner-role" - }, - { - "answer": [ - { - "valueCoding": { - "code": "consultation", - "display": "The first appointment", - "system": "http://fhir.org/guides/argonaut-scheduling/CodeSystem/visit-type" - } - } - ], - "linkId": "service" - }, - { - "answer": [ - { - "valueDate": "2023-04-26" - } - ], - "linkId": "date" - }, - { - "item": [ - { - "answer": [ - { - "valueTime": "15:00:00" - } - ], - "linkId": "start-time" - }, - { - "answer": [ - { - "valueTime": "16:00:00" - } - ], - "linkId": "end-time" - } - ], - "linkId": "Time period" - } - ], - "meta": { - "extension": [ - { - "url": "ex:createdAt", - "valueInstant": "2023-04-05T06:27:58.499391Z" - } - ], - "lastUpdated": "2023-04-05T06:27:58.499391Z", - "versionId": "20420" - }, - "resourceType": "QuestionnaireResponse", - "status": "completed" -} diff --git a/sdc-qrf/src/converter/__tests__/resources/questionnaire_response_fhir/patient.json b/sdc-qrf/src/converter/__tests__/resources/questionnaire_response_fhir/patient.json deleted file mode 100644 index 3e5c84f9..00000000 --- a/sdc-qrf/src/converter/__tests__/resources/questionnaire_response_fhir/patient.json +++ /dev/null @@ -1,78 +0,0 @@ -{ - "authored": "2023-04-05T06:03:19Z", - "id": "24306b57-b463-4e39-807f-e715a80bbe5f", - "item": [ - { - "answer": [], - "linkId": "patient-id" - }, - { - "answer": [ - { - "valueString": "Nguyen" - } - ], - "linkId": "last-name" - }, - { - "answer": [ - { - "valueString": "Emily" - } - ], - "linkId": "first-name" - }, - { - "answer": [ - { - "valueString": "Marie" - } - ], - "linkId": "middle-name" - }, - { - "answer": [ - { - "valueDate": "1991-12-29" - } - ], - "linkId": "birth-date" - }, - { - "answer": [ - { - "valueString": "female" - } - ], - "linkId": "gender" - }, - { - "answer": [ - { - "valueString": "123-45-6789" - } - ], - "linkId": "ssn" - }, - { - "answer": [ - { - "valueString": "15551234567" - } - ], - "linkId": "mobile" - } - ], - "meta": { - "extension": [ - { - "url": "ex:createdAt", - "valueInstant": "2023-04-05T06:03:21.353895Z" - } - ], - "lastUpdated": "2023-04-05T06:03:21.353895Z", - "versionId": "20412" - }, - "resourceType": "QuestionnaireResponse", - "status": "completed" -} diff --git a/sdc-qrf/src/converter/__tests__/resources/questionnaire_response_fhir/phq_2_phq_9.json b/sdc-qrf/src/converter/__tests__/resources/questionnaire_response_fhir/phq_2_phq_9.json deleted file mode 100644 index bbcef04d..00000000 --- a/sdc-qrf/src/converter/__tests__/resources/questionnaire_response_fhir/phq_2_phq_9.json +++ /dev/null @@ -1,170 +0,0 @@ -{ - "authored": "2023-04-06T02:33:05Z", - "encounter": { - "reference": "Encounter/e133b999-9e91-4ebd-967e-450bad770682" - }, - "id": "846558b9-4c03-4af6-a258-62b0390633e2", - "item": [ - { - "answer": [ - { - "valueDateTime": "2023-04-06T02:32:40+00:00" - } - ], - "linkId": "dateTime" - }, - { - "answer": [ - { - "valueString": "683e382b-fed4-433e-9b6d-a847a7953bc0" - } - ], - "linkId": "patientId" - }, - { - "answer": [ - { - "valueString": "Emily Nguyen" - } - ], - "linkId": "patientName" - }, - { - "item": [ - { - "answer": [ - { - "valueCoding": { - "code": "LA6568-5", - "display": "Not at all", - "system": "http://loinc.org" - } - } - ], - "linkId": "44250-9" - }, - { - "answer": [ - { - "valueCoding": { - "code": "LA6569-3", - "display": "Several days", - "system": "http://loinc.org" - } - } - ], - "linkId": "44255-8" - }, - { - "answer": [ - { - "valueCoding": { - "code": "LA6570-1", - "display": "More than half the days", - "system": "http://loinc.org" - } - } - ], - "linkId": "44259-0" - }, - { - "answer": [ - { - "valueCoding": { - "code": "LA6571-9", - "display": "Nearly every day", - "system": "http://loinc.org" - } - } - ], - "linkId": "44254-1" - }, - { - "answer": [ - { - "valueCoding": { - "code": "LA6570-1", - "display": "More than half the days", - "system": "http://loinc.org" - } - } - ], - "linkId": "44251-7" - }, - { - "answer": [ - { - "valueCoding": { - "code": "LA6569-3", - "display": "Several days", - "system": "http://loinc.org" - } - } - ], - "linkId": "44258-2" - }, - { - "answer": [ - { - "valueCoding": { - "code": "LA6568-5", - "display": "Not at all", - "system": "http://loinc.org" - } - } - ], - "linkId": "44252-5" - }, - { - "answer": [ - { - "valueCoding": { - "code": "LA6569-3", - "display": "Several days", - "system": "http://loinc.org" - } - } - ], - "linkId": "44253-3" - }, - { - "answer": [ - { - "valueCoding": { - "code": "LA6570-1", - "display": "More than half the days", - "system": "http://loinc.org" - } - } - ], - "linkId": "44260-8" - }, - { - "answer": [ - { - "valueInteger": 12 - } - ], - "linkId": "phq9-total-score" - } - ], - "linkId": "phq2phq9" - } - ], - "meta": { - "extension": [ - { - "url": "ex:createdAt", - "valueInstant": "2023-04-06T02:32:41.569773Z" - } - ], - "lastUpdated": "2023-04-06T02:33:06.758734Z", - "versionId": "20508" - }, - "questionnaire": "phq2phq9", - "resourceType": "QuestionnaireResponse", - "source": { - "reference": "Patient/683e382b-fed4-433e-9b6d-a847a7953bc0" - }, - "status": "completed" -} diff --git a/sdc-qrf/src/converter/__tests__/resources/questionnaire_response_fhir/physicalexam.json b/sdc-qrf/src/converter/__tests__/resources/questionnaire_response_fhir/physicalexam.json deleted file mode 100644 index b36e1ba8..00000000 --- a/sdc-qrf/src/converter/__tests__/resources/questionnaire_response_fhir/physicalexam.json +++ /dev/null @@ -1,158 +0,0 @@ -{ - "questionnaire": "physical-exam", - "meta": { - "lastUpdated": "2023-04-06T02:05:52.434771Z", - "versionId": "20470", - "extension": [ - { - "url": "ex:createdAt", - "valueInstant": "2023-04-06T02:05:32.668369Z" - } - ] - }, - "encounter": { - "reference": "Encounter/e133b999-9e91-4ebd-967e-450bad770682" - }, - "item": [ - { - "item": [ - { - "answer": [ - { - "valueString": "Well nourished, well developed, awake and alert, resting comfortably in no acute distress, cooperative on exam" - } - ], - "linkId": "general" - }, - { - "answer": [ - { - "valueString": "NCAT, PERRL, normal conjunctivae, nonicteric sclerae, bilateral EAC/TM clear, no nasal discharge, OP clear, moist mucous membranes" - } - ], - "linkId": "heent" - }, - { - "answer": [ - { - "valueString": "Supple, normal ROM, no lymphadenopathy/masses, nontender" - } - ], - "linkId": "neck" - }, - { - "answer": [ - { - "valueString": "RRR, normal S1/S2, no murmurs/gallops/rub" - } - ], - "linkId": "cardiovascular" - }, - { - "answer": [ - { - "valueString": "No respiratory distress, lungs CTAB: no rales, rhonchi, or wheeze" - } - ], - "linkId": "pulmonary" - }, - { - "answer": [ - { - "valueString": "Soft and non-tender with no guarding or rebound; +BS normoactive, no tympany on auscultation" - } - ], - "linkId": "abdominal" - }, - { - "answer": [ - { - "valueString": "Normal ROM of UE and LE, normal bulk and tone," - } - ], - "linkId": "musculoskeletal" - }, - { - "answer": [ - { - "valueString": "Pulses intact with normal cap refill, no LE pitting edema or calf tenderness" - } - ], - "linkId": "extremities" - }, - { - "answer": [ - { - "valueString": "AAOx3, converses normally. CN II - XII grossly intact. Gait and coordination intact. 5+ BL UE/LE strength, no gross motor or sensory defects" - } - ], - "linkId": "neurologic" - }, - { - "answer": [ - { - "valueString": "Normal mood and affect. Judgement/competence is appropriate" - } - ], - "linkId": "psychiatric" - }, - { - "answer": [ - { - "valueString": "Warm, dry, and intact. No rashes, dermatoses, petechiae, or lesions" - } - ], - "linkId": "skin" - }, - { - "answer": [ - { - "valueString": "Normal sensation bilaterally on soles of feet with 10g monofilament" - } - ], - "linkId": "monofilament" - }, - { - "answer": [ - { - "valueString": "The chest wall is symmetric, without deformity, and is atraumatic in appearance" - } - ], - "linkId": "chest" - }, - { - "answer": [ - { - "valueString": "External genitalia without erythema, exudate or discharge" - } - ], - "linkId": "genitourinary-female" - }, - { - "answer": [ - { - "valueString": "Normal external anus and normal tone. No palpable masses, normal mucosa, brown stool. Hemoccult negative" - } - ], - "linkId": "rectal" - }, - { - "answer": [ - { - "valueString": "No enlarged lymph nodes of occipital, pre- and postauricular, submandibular, anterior or posterior cervical, or supraclavicular identified" - } - ], - "linkId": "lymphatic" - } - ], - "linkId": "physical-exam-group" - } - ], - "resourceType": "QuestionnaireResponse", - "source": { - "reference": "Patient/683e382b-fed4-433e-9b6d-a847a7953bc0" - }, - "status": "completed", - "id": "288fd914-b836-47dd-863a-e7d86a923f28", - "authored": "2023-04-06T02:05:51Z" -} diff --git a/sdc-qrf/src/converter/__tests__/resources/questionnaire_response_fhir/practitioner.json b/sdc-qrf/src/converter/__tests__/resources/questionnaire_response_fhir/practitioner.json deleted file mode 100644 index f8649162..00000000 --- a/sdc-qrf/src/converter/__tests__/resources/questionnaire_response_fhir/practitioner.json +++ /dev/null @@ -1,54 +0,0 @@ -{ - "authored": "2023-04-05T06:09:09Z", - "id": "cedd0c3e-be1a-4c1b-92af-351ed76fe41e", - "item": [ - { - "answer": [ - { - "valueString": "Patel" - } - ], - "linkId": "last-name" - }, - { - "answer": [ - { - "valueString": "Sanjay" - } - ], - "linkId": "first-name" - }, - { - "answer": [ - { - "valueString": "Kumar" - } - ], - "linkId": "middle-name" - }, - { - "answer": [ - { - "valueCoding": { - "code": "394579002", - "display": "Cardiology", - "system": "http://snomed.info/sct" - } - } - ], - "linkId": "specialty" - } - ], - "meta": { - "extension": [ - { - "url": "ex:createdAt", - "valueInstant": "2023-04-05T06:09:10.640955Z" - } - ], - "lastUpdated": "2023-04-05T06:09:10.640955Z", - "versionId": "20415" - }, - "resourceType": "QuestionnaireResponse", - "status": "completed" -} diff --git a/sdc-qrf/src/converter/__tests__/resources/questionnaire_response_fhir/reference_answer_with_assoc.json b/sdc-qrf/src/converter/__tests__/resources/questionnaire_response_fhir/reference_answer_with_assoc.json deleted file mode 100644 index def4f348..00000000 --- a/sdc-qrf/src/converter/__tests__/resources/questionnaire_response_fhir/reference_answer_with_assoc.json +++ /dev/null @@ -1,86 +0,0 @@ -{ - "authored": "2023-04-05T06:27:57Z", - "id": "cf6d9d4b-bfcd-463f-9d26-b6769c2a3fc3", - "item": [ - { - "answer": [ - { - "valueString": "683e382b-fed4-433e-9b6d-a847a7953bc0" - } - ], - "linkId": "patientId" - }, - { - "answer": [ - { - "valueString": "Emily Nguyen" - } - ], - "linkId": "patientName" - }, - { - "answer": [ - { - "valueReference": { - "display": "Sanjay Patel - Cardiology", - "reference": "PractitionerRole/429e6a55-8a64-4ede-ad12-1206522253eb" - } - } - ], - "linkId": "practitioner-role" - }, - { - "answer": [ - { - "valueCoding": { - "code": "consultation", - "display": "The first appointment", - "system": "http://fhir.org/guides/argonaut-scheduling/CodeSystem/visit-type" - } - } - ], - "linkId": "service" - }, - { - "answer": [ - { - "valueDate": "2023-04-26" - } - ], - "linkId": "date" - }, - { - "item": [ - { - "answer": [ - { - "valueTime": "15:00:00" - } - ], - "linkId": "start-time" - }, - { - "answer": [ - { - "valueTime": "16:00:00" - } - ], - "linkId": "end-time" - } - ], - "linkId": "Time period" - } - ], - "meta": { - "extension": [ - { - "url": "ex:createdAt", - "valueInstant": "2023-04-05T06:27:58.499391Z" - } - ], - "lastUpdated": "2023-04-05T06:27:58.499391Z", - "versionId": "20420" - }, - "resourceType": "QuestionnaireResponse", - "status": "completed" -} diff --git a/sdc-qrf/src/converter/__tests__/resources/questionnaire_response_fhir/review_of_systems.json b/sdc-qrf/src/converter/__tests__/resources/questionnaire_response_fhir/review_of_systems.json deleted file mode 100644 index 57550222..00000000 --- a/sdc-qrf/src/converter/__tests__/resources/questionnaire_response_fhir/review_of_systems.json +++ /dev/null @@ -1,118 +0,0 @@ -{ - "authored": "2023-04-06T02:11:08Z", - "encounter": { - "reference": "Encounter/e133b999-9e91-4ebd-967e-450bad770682" - }, - "id": "d575fe05-9db2-4df8-b131-48bb5d27509d", - "item": [ - { - "answer": [ - { - "valueBoolean": true - } - ], - "linkId": "provider-viewed-confirmation" - }, - { - "item": [ - { - "answer": [], - "linkId": "general" - }, - { - "answer": [ - { - "valueBoolean": true - } - ], - "linkId": "heent" - }, - { - "answer": [ - { - "valueString": "heent" - } - ], - "linkId": "heent-comment" - }, - { - "answer": [], - "linkId": "cardiovascular" - }, - { - "answer": [], - "linkId": "respiratory" - }, - { - "answer": [ - { - "valueBoolean": true - } - ], - "linkId": "gastrointestinal" - }, - { - "answer": [ - { - "valueString": "gastrointestinal" - } - ], - "linkId": "gastrointestinal-comment" - }, - { - "answer": [], - "linkId": "genitourinary" - }, - { - "answer": [], - "linkId": "musculoskeletal" - }, - { - "answer": [], - "linkId": "neurologic" - }, - { - "answer": [ - { - "valueBoolean": true - } - ], - "linkId": "psychiatric" - }, - { - "answer": [ - { - "valueString": "psychiatric" - } - ], - "linkId": "psychiatric-comment" - }, - { - "answer": [], - "linkId": "skin" - }, - { - "answer": [], - "linkId": "other" - } - ], - "linkId": "abnormal-systems-group" - } - ], - "meta": { - "extension": [ - { - "url": "ex:createdAt", - "valueInstant": "2023-04-06T02:10:37.718483Z" - } - ], - "lastUpdated": "2023-04-06T02:11:09.776717Z", - "versionId": "20480" - }, - "questionnaire": "review-of-systems", - "resourceType": "QuestionnaireResponse", - "source": { - "reference": "Patient/683e382b-fed4-433e-9b6d-a847a7953bc0" - }, - "status": "completed" -} diff --git a/sdc-qrf/src/converter/__tests__/resources/questionnaire_response_fhir/vitals.json b/sdc-qrf/src/converter/__tests__/resources/questionnaire_response_fhir/vitals.json deleted file mode 100644 index 54fa7a73..00000000 --- a/sdc-qrf/src/converter/__tests__/resources/questionnaire_response_fhir/vitals.json +++ /dev/null @@ -1,145 +0,0 @@ -{ - "questionnaire": "vitals", - "meta": { - "lastUpdated": "2023-04-06T02:20:25.903562Z", - "versionId": "20492", - "extension": [ - { - "url": "ex:createdAt", - "valueInstant": "2023-04-06T02:19:51.712237Z" - } - ] - }, - "encounter": { - "reference": "Encounter/e133b999-9e91-4ebd-967e-450bad770682" - }, - "item": [ - { - "answer": [ - { - "valueString": "683e382b-fed4-433e-9b6d-a847a7953bc0" - } - ], - "linkId": "patientId" - }, - { - "answer": [ - { - "valueString": "Emily Nguyen" - } - ], - "linkId": "patientName" - }, - { - "answer": [ - { - "valueInteger": 180 - } - ], - "linkId": "height" - }, - { - "answer": [ - { - "valueInteger": 80 - } - ], - "linkId": "weight" - }, - { - "answer": [ - { - "valueInteger": 36 - } - ], - "linkId": "temperature" - }, - { - "answer": [ - { - "valueInteger": 56 - } - ], - "linkId": "oxygen-saturation" - }, - { - "answer": [ - { - "valueInteger": 100 - } - ], - "linkId": "pulse-rate" - }, - { - "answer": [ - { - "valueInteger": 50 - } - ], - "linkId": "respiratory-rate" - }, - { - "item": [ - { - "item": [ - { - "answer": [ - { - "valueInteger": 45 - } - ], - "linkId": "blood-pressure-systolic" - }, - { - "answer": [ - { - "valueInteger": 67 - } - ], - "linkId": "blood-pressure-diastolic" - } - ], - "linkId": "blood-pressure-systolic-diastolic" - }, - { - "answer": [ - { - "valueCoding": { - "code": "sitting", - "display": "Sitting" - } - } - ], - "linkId": "blood-pressure-positions" - }, - { - "answer": [ - { - "valueCoding": { - "code": "biceps-left", - "display": "Biceps left" - } - } - ], - "linkId": "blood-pressure-arm" - } - ], - "linkId": "blood-pressure" - }, - { - "answer": [ - { - "valueInteger": 24.69 - } - ], - "linkId": "bmi" - } - ], - "resourceType": "QuestionnaireResponse", - "source": { - "reference": "Patient/683e382b-fed4-433e-9b6d-a847a7953bc0" - }, - "status": "completed", - "id": "a583cc11-99c6-4719-acab-cb3fb72f5078", - "authored": "2023-04-06T02:20:25Z" -} diff --git a/sdc-qrf/src/converter/extensions.ts b/sdc-qrf/src/converter/extensions.ts deleted file mode 100644 index 9799f968..00000000 --- a/sdc-qrf/src/converter/extensions.ts +++ /dev/null @@ -1,149 +0,0 @@ -import { Extension as FHIRExtension } from 'fhir/r4b'; - -import { QuestionnaireItem as FCEQuestionnaireItem } from 'shared/src/contrib/aidbox'; - -export enum ExtensionIdentifier { - Hidden = 'http://hl7.org/fhir/StructureDefinition/questionnaire-hidden', - ItemControl = 'http://hl7.org/fhir/StructureDefinition/questionnaire-itemControl', - SliderStepValue = 'http://hl7.org/fhir/StructureDefinition/questionnaire-sliderStepValue', - Unit = 'http://hl7.org/fhir/StructureDefinition/questionnaire-unit', - ReferenceResource = 'http://hl7.org/fhir/StructureDefinition/questionnaire-referenceResource', - - ItemPopulationContext = 'http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-itemPopulationContext', - InitialExpression = 'http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-initialExpression', - ChoiceColumn = 'http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-choiceColumn', - CalculatedExpression = 'http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-calculatedExpression', - EnableWhenExpression = 'http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-enableWhenExpression', - AnswerExpression = 'http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-answerExpression', - - AdjustLastToRight = 'https://beda.software/fhir-emr-questionnaire/adjust-last-to-right', - SliderStart = 'https://beda.software/fhir-emr-questionnaire/slider-start', - SliderStop = 'https://beda.software/fhir-emr-questionnaire/slider-stop', - HelpText = 'https://beda.software/fhir-emr-questionnaire/help-text', - StopLabel = 'https://beda.software/fhir-emr-questionnaire/slider-stop-label', - Macro = 'https://beda.software/fhir-emr-questionnaire/macro', -} - -export type ExtensionTransformer = { - [key in ExtensionIdentifier]: - | { - transform: { - fromExtension: ( - extension: FHIRExtension, - ) => Partial | undefined; - toExtension: (item: FCEQuestionnaireItem) => FHIRExtension | undefined; - }; - } - | { - path: { - extension: keyof FHIRExtension; - questionnaire: keyof FCEQuestionnaireItem; - }; - }; -}; - -export const extensionTransformers: ExtensionTransformer = { - [ExtensionIdentifier.Hidden]: { - path: { extension: 'valueBoolean', questionnaire: 'hidden' }, - }, - [ExtensionIdentifier.ItemControl]: { - path: { extension: 'valueCodeableConcept', questionnaire: 'itemControl' }, - }, - [ExtensionIdentifier.SliderStepValue]: { - path: { extension: 'valueInteger', questionnaire: 'sliderStepValue' }, - }, - [ExtensionIdentifier.Unit]: { - path: { extension: 'valueCoding', questionnaire: 'unit' }, - }, - [ExtensionIdentifier.ReferenceResource]: { - transform: { - fromExtension: (extension) => { - if (extension.valueCode) { - return { referenceResource: [extension.valueCode] }; - } else { - return {}; - } - }, - toExtension: (item) => { - if (item.referenceResource?.length) { - return { - url: ExtensionIdentifier.ReferenceResource, - valueCode: item.referenceResource[0], - }; - } - }, - }, - }, - - [ExtensionIdentifier.ItemPopulationContext]: { - path: { extension: 'valueExpression', questionnaire: 'itemPopulationContext' }, - }, - [ExtensionIdentifier.InitialExpression]: { - path: { extension: 'valueExpression', questionnaire: 'initialExpression' }, - }, - [ExtensionIdentifier.CalculatedExpression]: { - path: { extension: 'valueExpression', questionnaire: 'calculatedExpression' }, - }, - [ExtensionIdentifier.EnableWhenExpression]: { - path: { extension: 'valueExpression', questionnaire: 'enableWhenExpression' }, - }, - [ExtensionIdentifier.AnswerExpression]: { - path: { extension: 'valueExpression', questionnaire: 'answerExpression' }, - }, - [ExtensionIdentifier.ChoiceColumn]: { - transform: { - fromExtension: (extension) => { - const choiceColumnExtension = extension.extension; - if (choiceColumnExtension) { - return { - choiceColumn: [ - { - forDisplay: - choiceColumnExtension.find((obj) => obj.url === 'forDisplay') - ?.valueBoolean ?? false, - path: choiceColumnExtension.find((obj) => obj.url === 'path') - ?.valueString, - }, - ], - }; - } - }, - toExtension: (item) => { - if (item.choiceColumn) { - return { - url: ExtensionIdentifier.ChoiceColumn, - extension: [ - { - url: 'forDisplay', - valueBoolean: item.choiceColumn[0]?.forDisplay, - }, - { - url: 'path', - valueString: item.choiceColumn[0]?.path, - }, - ], - }; - } - }, - }, - }, - - [ExtensionIdentifier.AdjustLastToRight]: { - path: { extension: 'valueBoolean', questionnaire: 'adjustLastToRight' }, - }, - [ExtensionIdentifier.SliderStart]: { - path: { extension: 'valueInteger', questionnaire: 'start' }, - }, - [ExtensionIdentifier.SliderStop]: { - path: { extension: 'valueInteger', questionnaire: 'stop' }, - }, - [ExtensionIdentifier.HelpText]: { - path: { extension: 'valueString', questionnaire: 'helpText' }, - }, - [ExtensionIdentifier.StopLabel]: { - path: { extension: 'valueString', questionnaire: 'stopLabel' }, - }, - [ExtensionIdentifier.Macro]: { - path: { extension: 'valueString', questionnaire: 'macro' }, - }, -}; diff --git a/sdc-qrf/src/converter/fceToFhir/index.ts b/sdc-qrf/src/converter/fceToFhir/index.ts deleted file mode 100644 index 019771f6..00000000 --- a/sdc-qrf/src/converter/fceToFhir/index.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { - Questionnaire as FHIRQuestionnaire, - QuestionnaireResponse as FHIRQuestionnaireResponse, -} from 'fhir/r4b'; - -import { - Questionnaire as FCEQuestionnaire, - QuestionnaireResponse as FCEQuestionnaireResponse, -} from 'shared/src/contrib/aidbox'; - -import { convertQuestionnaire } from './questionnaire'; -import { convertQuestionnaireResponse } from './questionnaireResponse'; - -export function fromFirstClassExtension( - fceQuestionnaireResponse: FCEQuestionnaireResponse, -): FHIRQuestionnaireResponse; -export function fromFirstClassExtension(fceQuestionnaire: FCEQuestionnaire): FHIRQuestionnaire; -export function fromFirstClassExtension( - fceResource: FCEQuestionnaire | FCEQuestionnaireResponse, -): FHIRQuestionnaireResponse | FHIRQuestionnaire { - switch (fceResource.resourceType) { - case 'Questionnaire': - return convertQuestionnaire(fceResource); - case 'QuestionnaireResponse': - return convertQuestionnaireResponse(fceResource); - } -} diff --git a/sdc-qrf/src/converter/fceToFhir/questionnaire/index.ts b/sdc-qrf/src/converter/fceToFhir/questionnaire/index.ts deleted file mode 100644 index fa8bf910..00000000 --- a/sdc-qrf/src/converter/fceToFhir/questionnaire/index.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { Questionnaire as FHIRQuestionnaire } from 'fhir/r4b'; -import cloneDeep from 'lodash/cloneDeep'; - -import { Questionnaire as FCEQuestionnaire } from 'shared/src/contrib/aidbox'; - -import { processExtensions } from './processExtensions'; -import { processItems } from './processItems'; -import { processMeta } from './processMeta'; - -export function convertQuestionnaire(questionnaire: FCEQuestionnaire): FHIRQuestionnaire { - questionnaire = cloneDeep(questionnaire); - questionnaire.meta = questionnaire.meta ? processMeta(questionnaire.meta) : questionnaire.meta; - questionnaire.item = processItems(questionnaire.item ?? []); - return processExtensions(questionnaire) as FHIRQuestionnaire; -} diff --git a/sdc-qrf/src/converter/fceToFhir/questionnaire/processExtensions.ts b/sdc-qrf/src/converter/fceToFhir/questionnaire/processExtensions.ts deleted file mode 100644 index 1de45139..00000000 --- a/sdc-qrf/src/converter/fceToFhir/questionnaire/processExtensions.ts +++ /dev/null @@ -1,75 +0,0 @@ -import { Extension as FHIRExtension, Questionnaire as FHIRQuestionnaire } from 'fhir/r4b'; - -import { Questionnaire as FCEQuestionnaire } from 'shared/src/contrib/aidbox'; - -export function processExtensions(questionnaire: FCEQuestionnaire): FHIRQuestionnaire { - const { launchContext, mapping, sourceQueries, targetStructureMap, ...fhirQuestionnaire } = - questionnaire; - - let extensions: FHIRExtension[] = []; - - if (launchContext) { - for (const launchContextItem of launchContext) { - const name = launchContextItem.name; - const typeList = launchContextItem.type; - const description = launchContextItem.description; - const launchContextExtension: FHIRExtension[] = [ - { - url: 'name', - valueCoding: name, - }, - ]; - - for (const typeCode of typeList ?? []) { - launchContextExtension.push({ url: 'type', valueCode: typeCode }); - } - - if (description !== undefined) { - launchContextExtension.push({ - url: 'description', - valueString: description, - }); - } - - extensions.push({ - url: 'http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-launchContext', - extension: launchContextExtension, - }); - } - } - - if (mapping) { - extensions = extensions.concat( - mapping.map((m) => ({ - url: 'http://beda.software/fhir-extensions/questionnaire-mapper', - valueReference: { - reference: `Mapping/${m.id}`, - }, - })), - ); - } - - if (sourceQueries) { - extensions = extensions.concat( - sourceQueries.map((item) => ({ - url: 'http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-sourceQueries', - valueReference: { reference: `#${item.localRef}` }, - })), - ); - } - - if (targetStructureMap) { - extensions = extensions.concat( - targetStructureMap.map((targetStructureMapRef) => ({ - url: 'http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-targetStructureMap', - valueCanonical: targetStructureMapRef, - })), - ); - } - - if (extensions.length) { - fhirQuestionnaire.extension = (fhirQuestionnaire.extension ?? []).concat(extensions); - } - - return fhirQuestionnaire as FHIRQuestionnaire; -} diff --git a/sdc-qrf/src/converter/fceToFhir/questionnaire/processItems.ts b/sdc-qrf/src/converter/fceToFhir/questionnaire/processItems.ts deleted file mode 100644 index a1296c4d..00000000 --- a/sdc-qrf/src/converter/fceToFhir/questionnaire/processItems.ts +++ /dev/null @@ -1,194 +0,0 @@ -import { - Quantity as QuantityFHIR, - QuestionnaireItemEnableWhen as FHIRQuestionnaireItemEnableWhen, - QuestionnaireItem as FHIRQuestionnaireItem, - QuestionnaireItemAnswerOption as FHIRQuestionnaireItemAnswerOption, - QuestionnaireItemInitial as FHIRQuestionnaireItemInitial, -} from 'fhir/r4b'; - -import { - QuestionnaireItem as FCEQuestionnaireItem, - QuestionnaireItemEnableWhen as FCEQuestionnaireItemEnableWhen, - QuestionnaireItemEnableWhenAnswer as FCEQuestionnaireItemEnableWhenAnswer, - QuestionnaireItemAnswerOption as FCEQuestionnaireItemAnswerOption, - QuestionnaireItemInitial as FCEQuestionnaireItemInitial, -} from 'shared/src/contrib/aidbox'; - -import { - convertFromFHIRExtension, - convertToFHIRExtension, - toFHIRReference, -} from '../../../converter'; - -export function processItems(items: FCEQuestionnaireItem[]): FHIRQuestionnaireItem[] { - return items.map((item) => { - const extensions = convertToFHIRExtension(item); - if (extensions.length > 0) { - const fieldsToOmit = extensions - .map(convertFromFHIRExtension) - .filter((ext): ext is Partial => ext !== undefined) - .flatMap(Object.keys); - for (const field of fieldsToOmit) { - delete item[field]; - } - item.extension = extensions.sort(); - } - - const { - enableBehavior, - enableWhen, - answerOption, - initial, - item: nestedItems, - type, - ...commonOptions - } = item; - - const fhirItem: FHIRQuestionnaireItem = { - ...commonOptions, - type: type as FHIRQuestionnaireItem['type'], - }; - - if (answerOption !== undefined) { - fhirItem.answerOption = processAnswerOption(answerOption); - } - - if (enableBehavior !== undefined) { - fhirItem.enableBehavior = enableBehavior as FHIRQuestionnaireItem['enableBehavior']; - } - - if (enableWhen !== undefined) { - fhirItem.enableWhen = processEnableWhen(enableWhen); - } - - if (initial) { - fhirItem.initial = processInitial(initial); - } - - if (nestedItems) { - fhirItem.item = processItems(nestedItems); - } - - return fhirItem; - }); -} - -const convertEnableWhen = ( - answer: FCEQuestionnaireItemEnableWhenAnswer, - answerType: string, - result: FHIRQuestionnaireItemEnableWhen, -) => { - if (answer[answerType] !== undefined) { - switch (answerType) { - case 'boolean': - result.answerBoolean = answer[answerType]; - break; - case 'decimal': - result.answerDecimal = answer[answerType]; - break; - case 'integer': - result.answerInteger = answer[answerType]; - break; - case 'date': - result.answerDate = answer[answerType]; - break; - case 'dateTime': - result.answerDateTime = answer[answerType]; - break; - case 'time': - result.answerTime = answer[answerType]; - break; - case 'string': - result.answerString = answer[answerType]; - break; - case 'Coding': - result.answerCoding = answer[answerType]; - break; - case 'Quantity': - result.answerQuantity = answer[answerType] as QuantityFHIR; - break; - case 'Reference': - result.answerReference = toFHIRReference(answer[answerType]); - break; - default: - break; - } - } -}; - -function processAnswerOption( - options: FCEQuestionnaireItemAnswerOption[], -): FHIRQuestionnaireItemAnswerOption[] { - return options.map((option) => { - const { value, ...commonOptions } = option; - - const fhirOption: FHIRQuestionnaireItemAnswerOption = { ...commonOptions }; - - if (value?.Coding) { - fhirOption.valueCoding = value.Coding; - } - if (value?.string) { - fhirOption.valueString = value.string; - } - if (value?.Reference) { - fhirOption.valueReference = toFHIRReference(value.Reference); - } - if (value?.date) { - fhirOption.valueDate = value.date; - } - if (value?.integer) { - fhirOption.valueInteger = value.integer; - } - if (value?.time) { - fhirOption.valueTime = value.time; - } - - return fhirOption; - }); -} - -function processEnableWhen(options: FCEQuestionnaireItemEnableWhen[]) { - return options.map((item: FCEQuestionnaireItemEnableWhen) => { - const { question, operator, answer } = item; - const result: FHIRQuestionnaireItemEnableWhen = { - question, - operator: operator as 'exists' | '=' | '!=' | '>' | '<' | '>=' | '<=', - }; - - if (!answer) { - return result; - } - - const answerTypes = [ - 'boolean', - 'decimal', - 'integer', - 'date', - 'dateTime', - 'time', - 'string', - 'Coding', - 'Quantity', - 'Reference', - ]; - - answerTypes.forEach((answerType) => { - convertEnableWhen(answer, answerType, result); - }); - - return result; - }); -} - -function processInitial(options: FCEQuestionnaireItemInitial[]): FHIRQuestionnaireItemInitial[] { - return options.map((entry) => { - const result: FHIRQuestionnaireItemInitial = {}; - if (entry.value?.boolean !== undefined) { - result.valueBoolean = entry.value.boolean; - } - if (entry.value?.Coding !== undefined) { - result.valueCoding = entry.value.Coding; - } - return result; - }); -} diff --git a/sdc-qrf/src/converter/fceToFhir/questionnaire/processMeta.ts b/sdc-qrf/src/converter/fceToFhir/questionnaire/processMeta.ts deleted file mode 100644 index 405cb5ee..00000000 --- a/sdc-qrf/src/converter/fceToFhir/questionnaire/processMeta.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { Meta as FHIRMeta } from 'fhir/r4b'; - -import { Meta as FCEMeta } from 'shared/src/contrib/aidbox'; - -export function processMeta(meta: FCEMeta): FHIRMeta { - const { createdAt, ...fhirMeta } = meta; - - if (createdAt) { - fhirMeta.extension = [ - ...(meta.extension ?? []), - { - url: 'ex:createdAt', - valueInstant: createdAt, - }, - ]; - } - - return fhirMeta; -} diff --git a/sdc-qrf/src/converter/fceToFhir/questionnaireResponse/index.ts b/sdc-qrf/src/converter/fceToFhir/questionnaireResponse/index.ts deleted file mode 100644 index d731a2d5..00000000 --- a/sdc-qrf/src/converter/fceToFhir/questionnaireResponse/index.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { QuestionnaireResponse as FHIRQuestionnaireResponse } from 'fhir/r4b'; -import cloneDeep from 'lodash/cloneDeep'; - -import { QuestionnaireResponse as FCEQuestionnaireResponse } from 'shared/src/contrib/aidbox'; - -import { processAnswers } from './processAnswers'; -import { processMeta } from './processMeta'; -import { processReference } from './processReference'; - -export function convertQuestionnaireResponse( - questionnaireResponse: FCEQuestionnaireResponse, -): FHIRQuestionnaireResponse { - questionnaireResponse = cloneDeep(questionnaireResponse); - if (questionnaireResponse.item) { - processAnswers(questionnaireResponse.item); - } - questionnaireResponse.meta = questionnaireResponse.meta - ? processMeta(questionnaireResponse.meta) - : questionnaireResponse.meta; - return processReference(questionnaireResponse); -} diff --git a/sdc-qrf/src/converter/fceToFhir/questionnaireResponse/processAnswers.ts b/sdc-qrf/src/converter/fceToFhir/questionnaireResponse/processAnswers.ts deleted file mode 100644 index 45a99d9e..00000000 --- a/sdc-qrf/src/converter/fceToFhir/questionnaireResponse/processAnswers.ts +++ /dev/null @@ -1,53 +0,0 @@ -import { QuestionnaireResponseItemAnswer as FHIRQuestionnaireResponseItemAnswer } from 'fhir/r4b'; -import isEmpty from 'lodash/isEmpty'; - -import { - QuestionnaireResponseItem as FCEQuestionnaireResponseItem, - QuestionnaireResponseItemAnswer as FCEQuestionnaireResponseItemAnswer, -} from 'shared/src/contrib/aidbox'; - -import { toFHIRReference } from '../../../converter'; - -export function processAnswers(items: FCEQuestionnaireResponseItem[]) { - for (const item of items) { - if (item.answer) { - item.answer = item.answer.map(processAnswer).filter((answer) => !isEmpty(answer)); - } - if (item.item) { - processAnswers(item.item); - } - } -} - -function processAnswer( - answerItem: FCEQuestionnaireResponseItemAnswer, -): FHIRQuestionnaireResponseItemAnswer { - if (!answerItem.value) { - return answerItem; - } - const { value, ...item } = answerItem; - const fhirAnswerItem: FHIRQuestionnaireResponseItemAnswer = item; - const valueMappings = { - string: 'valueString', - decimal: 'valueDecimal', - integer: 'valueInteger', - boolean: 'valueBoolean', - Coding: 'valueCoding', - date: 'valueDate', - dateTime: 'valueDateTime', - time: 'valueTime', - }; - for (const key in valueMappings) { - if (key in value) { - const newKey = valueMappings[key]; - if (newKey) { - fhirAnswerItem[newKey] = value[key]; - } - break; - } - } - if (value.Reference) { - fhirAnswerItem.valueReference = toFHIRReference(value.Reference); - } - return fhirAnswerItem; -} diff --git a/sdc-qrf/src/converter/fceToFhir/questionnaireResponse/processMeta.ts b/sdc-qrf/src/converter/fceToFhir/questionnaireResponse/processMeta.ts deleted file mode 100644 index 1afa4043..00000000 --- a/sdc-qrf/src/converter/fceToFhir/questionnaireResponse/processMeta.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { Meta as FHIRMeta } from 'fhir/r4b'; - -import { Meta as FCEMeta } from 'shared/src/contrib/aidbox'; - -export function processMeta(meta: FCEMeta): FHIRMeta { - const { createdAt, ...fhirMeta } = meta; - if (createdAt) { - fhirMeta.extension = [ - { - url: 'ex:createdAt', - valueInstant: meta.createdAt, - }, - ]; - } - return fhirMeta; -} diff --git a/sdc-qrf/src/converter/fceToFhir/questionnaireResponse/processReference.ts b/sdc-qrf/src/converter/fceToFhir/questionnaireResponse/processReference.ts deleted file mode 100644 index fce7b453..00000000 --- a/sdc-qrf/src/converter/fceToFhir/questionnaireResponse/processReference.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { QuestionnaireResponse as FHIRQuestionnaireResponse } from 'fhir/r4b'; - -import { QuestionnaireResponse as FCEQuestionnaireResponse } from 'shared/src/contrib/aidbox'; - -export function processReference(fceQR: FCEQuestionnaireResponse): FHIRQuestionnaireResponse { - const { encounter, source, ...commonProprties } = fceQR; - const fhirQuestionnaireResponse: FHIRQuestionnaireResponse = - commonProprties as FHIRQuestionnaireResponse; - if (encounter && encounter.resourceType && encounter.id) { - const { id, resourceType, ...encounterProperties } = encounter; - fhirQuestionnaireResponse.encounter = { - reference: `${resourceType}/${id}`, - ...encounterProperties, - }; - } - if (source && source.resourceType && source.id) { - const { id, resourceType, ...sourceProperties } = source; - fhirQuestionnaireResponse.source = { - reference: `${resourceType}/${id}`, - ...sourceProperties, - }; - } - return fhirQuestionnaireResponse; -} diff --git a/sdc-qrf/src/converter/fhirToFce/index.ts b/sdc-qrf/src/converter/fhirToFce/index.ts deleted file mode 100644 index 30e30f88..00000000 --- a/sdc-qrf/src/converter/fhirToFce/index.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { - Questionnaire as FHIRQuestionnaire, - QuestionnaireResponse as FHIRQuestionnaireResponse, -} from 'fhir/r4b'; - -import { - Questionnaire as FCEQuestionnaire, - QuestionnaireResponse as FCEQuestionnaireResponse, -} from 'shared/src/contrib/aidbox'; - -import { convertQuestionnaire } from './questionnaire'; -import { convertQuestionnaireResponse } from './questionnaireResponse'; - -export function toFirstClassExtension( - fhirQuestionnaireResponse: FHIRQuestionnaireResponse, -): FCEQuestionnaireResponse; -export function toFirstClassExtension(fhirQuestionnaire: FHIRQuestionnaire): FCEQuestionnaire; -export function toFirstClassExtension( - fhirResource: FHIRQuestionnaire | FHIRQuestionnaireResponse, -): FCEQuestionnaireResponse | FCEQuestionnaire { - switch (fhirResource.resourceType) { - case 'Questionnaire': - return convertQuestionnaire(fhirResource); - case 'QuestionnaireResponse': - return convertQuestionnaireResponse(fhirResource); - } -} diff --git a/sdc-qrf/src/converter/fhirToFce/questionnaire/index.ts b/sdc-qrf/src/converter/fhirToFce/questionnaire/index.ts deleted file mode 100644 index 064026bc..00000000 --- a/sdc-qrf/src/converter/fhirToFce/questionnaire/index.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { Questionnaire as FHIRQuestionnaire } from 'fhir/r4b'; -import cloneDeep from 'lodash/cloneDeep'; - -import { Questionnaire as FCEQuestionnaire } from 'shared/src/contrib/aidbox'; - -import { processExtensions } from './processExtensions'; -import { processItems } from './processItems'; -import { processMeta } from './processMeta'; -import { checkFhirQuestionnaireProfile, trimUndefined } from '../utils'; - -export function convertQuestionnaire(fhirQuestionnaire: FHIRQuestionnaire): FCEQuestionnaire { - checkFhirQuestionnaireProfile(fhirQuestionnaire); - fhirQuestionnaire = cloneDeep(fhirQuestionnaire); - const meta = processMeta(fhirQuestionnaire); - const item = processItems(fhirQuestionnaire); - const extensions = processExtensions(fhirQuestionnaire); - const questionnaire = trimUndefined({ - ...fhirQuestionnaire, - meta, - item, - ...extensions, - extension: undefined, - }); - return questionnaire as unknown as FCEQuestionnaire; -} diff --git a/sdc-qrf/src/converter/fhirToFce/questionnaire/processExtensions.ts b/sdc-qrf/src/converter/fhirToFce/questionnaire/processExtensions.ts deleted file mode 100644 index 2005be11..00000000 --- a/sdc-qrf/src/converter/fhirToFce/questionnaire/processExtensions.ts +++ /dev/null @@ -1,113 +0,0 @@ -import { Questionnaire as FHIRQuestionnaire } from 'fhir/r4b'; - -export function processExtensions(fhirQuestionnaire: FHIRQuestionnaire): { - launchContext?: any[]; - mapping?: any[]; - sourceQueries?: any[]; - targetStructureMap?: any[]; -} { - const launchContext = processLaunchContext(fhirQuestionnaire); - const mapping = processMapping(fhirQuestionnaire); - const sourceQueries = processSourceQueries(fhirQuestionnaire); - const targetStructureMap = processTargetStructureMap(fhirQuestionnaire); - - return { - launchContext: launchContext?.length ? launchContext : undefined, - mapping: mapping?.length ? mapping : undefined, - sourceQueries: sourceQueries?.length ? sourceQueries : undefined, - targetStructureMap: targetStructureMap?.length ? targetStructureMap : undefined, - }; -} - -export function processLaunchContext(fhirQuestionnaire: FHIRQuestionnaire): any[] | undefined { - let launchContextExtensions = fhirQuestionnaire.extension ?? []; - - launchContextExtensions = launchContextExtensions.filter( - (ext) => - ext.url === - 'http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-launchContext', - ); - - if (launchContextExtensions.length === 0) { - return undefined; - } - - const launchContextArray = []; - for (const launchContextExtension of launchContextExtensions) { - const nameExtension = launchContextExtension.extension?.find((ext) => ext.url === 'name'); - const typeExtensions = launchContextExtension.extension?.filter( - (ext) => ext.url === 'type', - ); - const descriptionExtension = launchContextExtension.extension?.find( - (ext) => ext.url === 'description', - ); - - const nameCode = nameExtension?.valueCoding?.code; - const typeCodes = typeExtensions?.map((typeExtension) => typeExtension.valueCode!); - const description = descriptionExtension?.valueString; - - let contextFound = false; - for (const context of launchContextArray) { - if (context.name.code === nameCode) { - context.type.push(...(typeCodes ?? [])); - contextFound = true; - break; - } - } - - if (!contextFound) { - const context: any = { - name: nameExtension?.valueCoding, - type: typeCodes ?? [], - }; - if (description) { - context.description = description; - } - launchContextArray.push(context); - } - } - - return launchContextArray; -} - -function processMapping(fhirQuestionnaire: FHIRQuestionnaire): any[] | undefined { - const mapperExtensions = fhirQuestionnaire.extension?.filter( - (ext: any) => ext.url === 'http://beda.software/fhir-extensions/questionnaire-mapper', - ); - - if (!mapperExtensions) { - return undefined; - } - - return mapperExtensions.map((mapperExtension: any) => ({ - id: mapperExtension.valueReference?.reference?.split('/')[1], - resourceType: 'Mapping', - })); -} - -function processSourceQueries(fhirQuestionnaire: FHIRQuestionnaire): any[] { - const extensions = - fhirQuestionnaire.extension?.filter( - (ext) => - ext.url === - 'http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-sourceQueries', - ) ?? []; - - return extensions.map((ext) => ({ - localRef: ext.valueReference?.reference?.substring(1) ?? '', - })); -} - -function processTargetStructureMap(fhirQuestionnaire: FHIRQuestionnaire): string[] | undefined { - const extensions = fhirQuestionnaire.extension?.filter( - (ext) => - ext.url === - 'http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-targetStructureMap', - ); - - if (!extensions) { - return undefined; - } - - return extensions.map((extension) => extension.valueCanonical!); -} diff --git a/sdc-qrf/src/converter/fhirToFce/questionnaire/processItems.ts b/sdc-qrf/src/converter/fhirToFce/questionnaire/processItems.ts deleted file mode 100644 index d40bb90f..00000000 --- a/sdc-qrf/src/converter/fhirToFce/questionnaire/processItems.ts +++ /dev/null @@ -1,159 +0,0 @@ -import { - QuestionnaireItemEnableWhen as FHIRQuestionnaireItemEnableWhen, - Questionnaire as FHIRQuestionnaire, - QuestionnaireItem as FHIRQuestionnaireItem, - QuestionnaireItemAnswerOption as FHIRQuestionnaireItemAnswerOption, - QuestionnaireItemInitial as FHIRQuestionnaireItemInitial, -} from 'fhir/r4b'; - -import { - QuestionnaireItem as FCEQuestionnaireItem, - QuestionnaireItemEnableWhen as FCEQuestionnaireItemEnableWhen, - QuestionnaireItemEnableWhenAnswer as FCEQuestionnaireItemEnableWhenAnswer, - QuestionnaireItemAnswerOption as FCEQuestionnaireItemAnswerOption, - QuestionnaireItemInitial as FCEQuestionnaireItemInitial, -} from 'shared/src/contrib/aidbox'; - -import { convertFromFHIRExtension, findExtension, fromFHIRReference } from '../../../converter'; -import { ExtensionIdentifier } from '../../../converter/extensions'; - -export function processItems(fhirQuestionnaire: FHIRQuestionnaire) { - return fhirQuestionnaire.item?.map(convertItemProperties); -} - -function convertItemProperties(item: FHIRQuestionnaireItem): FCEQuestionnaireItem { - const updatedProperties = getUpdatedPropertiesFromItem(item); - const newItem = { ...item, ...updatedProperties }; - - newItem.item = item.item?.map((nestedItem) => convertItemProperties(nestedItem)); - - if (newItem.extension) { - delete newItem.extension; - } - - return newItem; -} - -function getUpdatedPropertiesFromItem(item: FHIRQuestionnaireItem) { - let updatedProperties: FCEQuestionnaireItem = { linkId: item.linkId, type: item.type }; - - for (const identifer in ExtensionIdentifier) { - const identifierURI = ExtensionIdentifier[identifer]; - const extension = findExtension(item, identifierURI); - if (extension !== undefined) { - updatedProperties = { - ...updatedProperties, - ...convertFromFHIRExtension(extension), - }; - } - } - - updatedProperties.answerOption = item.answerOption?.map(processItemOption); - updatedProperties.initial = item.initial?.map(processItemOption); - updatedProperties.enableWhen = item.enableWhen?.map(processEnableWhenItem); - - return updatedProperties; -} - -function processEnableWhenItem( - item: FHIRQuestionnaireItemEnableWhen, -): FCEQuestionnaireItemEnableWhen { - return { - question: item.question, - operator: item.operator, - answer: processEnableWhenAnswerOption(item), - }; -} - -function processEnableWhenAnswerOption(item: FHIRQuestionnaireItemEnableWhen) { - const answer: FCEQuestionnaireItemEnableWhenAnswer = {}; - - switch (true) { - case 'answerBoolean' in item: - answer['boolean'] = item.answerBoolean; - break; - case 'answerDecimal' in item: - answer['decimal'] = item.answerDecimal; - break; - case 'answerInteger' in item: - answer['integer'] = item.answerInteger; - break; - case 'answerDate' in item: - answer['date'] = item.answerDate; - break; - case 'answerDateTime' in item: - answer['dateTime'] = item.answerDateTime; - break; - case 'answerTime' in item: - answer['time'] = item.answerTime; - break; - case 'answerString' in item: - answer['string'] = item.answerString; - break; - case 'answerCoding' in item: - answer['Coding'] = item.answerCoding; - break; - case 'answerQuantity' in item: - answer['Quantity'] = item.answerQuantity; - break; - case 'answerReference' in item: - if (item.answerReference) { - answer['Reference'] = fromFHIRReference(item.answerReference); - } else { - throw Error("Can not process 'answerReference' with no reference inside"); - } - break; - default: - break; - } - - return answer; -} - -function processItemOption( - option: FHIRQuestionnaireItemAnswerOption | FHIRQuestionnaireItemInitial, -): FCEQuestionnaireItemAnswerOption | FCEQuestionnaireItemInitial { - if (option.valueString) { - return { - value: { - string: option.valueString, - }, - }; - } - if (option.valueCoding) { - return { - value: { - Coding: option.valueCoding, - }, - }; - } - if (option.valueReference) { - return { - value: { - Reference: fromFHIRReference(option.valueReference), - }, - }; - } - if (option.valueDate) { - return { - value: { - date: option.valueDate, - }, - }; - } - if (option.valueInteger) { - return { - value: { - integer: option.valueInteger, - }, - }; - } - if ('valueBoolean' in option) { - return { - value: { - boolean: option.valueBoolean, - }, - }; - } - return option; -} diff --git a/sdc-qrf/src/converter/fhirToFce/questionnaire/processMeta.ts b/sdc-qrf/src/converter/fhirToFce/questionnaire/processMeta.ts deleted file mode 100644 index 9361f4c0..00000000 --- a/sdc-qrf/src/converter/fhirToFce/questionnaire/processMeta.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { Questionnaire as FHIRQuestionnaire } from 'fhir/r4b'; - -export function processMeta(fhirQuestionnaire: FHIRQuestionnaire) { - const createdAt = getCreatedAt(fhirQuestionnaire); - return { - ...fhirQuestionnaire.meta, - ...createdAt, - extension: undefined, - }; -} - -function getCreatedAt(fhirQuestionnaire: FHIRQuestionnaire) { - const metaExtension = fhirQuestionnaire.meta?.extension?.find( - (ext) => ext.url === 'ex:createdAt', - ); - return metaExtension ? { createdAt: metaExtension.valueInstant } : {}; -} diff --git a/sdc-qrf/src/converter/fhirToFce/questionnaireResponse/index.ts b/sdc-qrf/src/converter/fhirToFce/questionnaireResponse/index.ts deleted file mode 100644 index 43684b4a..00000000 --- a/sdc-qrf/src/converter/fhirToFce/questionnaireResponse/index.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { QuestionnaireResponse as FHIRQuestionnaireResponse } from 'fhir/r4b'; -import cloneDeep from 'lodash/cloneDeep'; - -import { QuestionnaireResponse as FCEQuestionnaireResponse } from 'shared/src/contrib/aidbox'; - -import { processAnswers } from './processAnswers'; -import { processMeta } from './processMeta'; -import { processReference } from './processReference'; - -export function convertQuestionnaireResponse( - questionnaireResponse: FHIRQuestionnaireResponse, -): FCEQuestionnaireResponse { - questionnaireResponse = cloneDeep(questionnaireResponse); - if (questionnaireResponse.item) { - processAnswers(questionnaireResponse.item); - } - if (questionnaireResponse.meta) { - questionnaireResponse.meta = processMeta(questionnaireResponse.meta); - } - return processReference(questionnaireResponse); -} diff --git a/sdc-qrf/src/converter/fhirToFce/questionnaireResponse/processAnswers.ts b/sdc-qrf/src/converter/fhirToFce/questionnaireResponse/processAnswers.ts deleted file mode 100644 index 890eaf43..00000000 --- a/sdc-qrf/src/converter/fhirToFce/questionnaireResponse/processAnswers.ts +++ /dev/null @@ -1,53 +0,0 @@ -import { - Coding as FHIRCoding, - QuestionnaireResponseItem as FHIRQuestionnaireResponseItem, - QuestionnaireResponseItemAnswer as FHIRQuestionnaireResponseItemAnswer, - Reference as FHIRReference, -} from 'fhir/r4b'; -import isEmpty from 'lodash/isEmpty'; - -import { QuestionnaireResponseItemAnswer as FCEQuestionnaireResponseItemAnswer } from 'shared/src/contrib/aidbox'; - -import { fromFHIRReference } from '../../../converter'; - -export function processAnswers(items: FHIRQuestionnaireResponseItem[]) { - if (!items) { - return; - } - for (const item of items) { - if (item.answer) { - item.answer = item.answer.map(processAnswer).filter((answer) => !isEmpty(answer)); - } - if (item.item) { - processAnswers(item.item); - } - } -} - -function processAnswer( - answer: FHIRQuestionnaireResponseItemAnswer, -): FCEQuestionnaireResponseItemAnswer { - const fceAnswer: FCEQuestionnaireResponseItemAnswer = { ...answer }; - const valueHandlers = { - valueString: (value: string) => ({ string: value }), - valueInteger: (value: number) => ({ integer: value }), - valueDecimal: (value: number) => ({ decimal: value }), - valueBoolean: (value: boolean) => ({ boolean: value }), - valueCoding: (value: FHIRCoding) => ({ Coding: value }), - valueDate: (value: string) => ({ date: value }), - valueDateTime: (value: string) => ({ dateTime: value }), - valueReference: (value: FHIRReference) => ({ - Reference: fromFHIRReference(value), - }), - valueTime: (value: string) => ({ time: value }), - }; - - for (const key in valueHandlers) { - if (key in fceAnswer) { - const value = fceAnswer[key]; - delete fceAnswer[key]; - fceAnswer.value = valueHandlers[key]?.(value); - } - } - return fceAnswer; -} diff --git a/sdc-qrf/src/converter/fhirToFce/questionnaireResponse/processMeta.ts b/sdc-qrf/src/converter/fhirToFce/questionnaireResponse/processMeta.ts deleted file mode 100644 index 4b9c1343..00000000 --- a/sdc-qrf/src/converter/fhirToFce/questionnaireResponse/processMeta.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { Meta as FHIRMeta } from 'fhir/r4b'; - -import { Meta as FCEMeta } from 'shared/src/contrib/aidbox'; - -import { extractExtension } from '../../../converter'; - -export function processMeta(meta: FHIRMeta): FCEMeta { - const { extension, ...commonMeta } = meta; - const fceMeta: FCEMeta = { ...commonMeta }; - if (extension) { - fceMeta.createdAt = extractExtension(extension, 'ex:createdAt'); - } - return fceMeta; -} diff --git a/sdc-qrf/src/converter/fhirToFce/questionnaireResponse/processReference.ts b/sdc-qrf/src/converter/fhirToFce/questionnaireResponse/processReference.ts deleted file mode 100644 index 836aec81..00000000 --- a/sdc-qrf/src/converter/fhirToFce/questionnaireResponse/processReference.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { QuestionnaireResponse as FHIRQuestionnaireResponse } from 'fhir/r4b'; - -import { QuestionnaireResponse as FCEQuestionnaireResponse } from 'shared/src/contrib/aidbox'; - -import { fromFHIRReference } from '../../../converter'; - -export function processReference( - fhirQuestionnaireResponse: FHIRQuestionnaireResponse, -): FCEQuestionnaireResponse { - const { encounter, source, ...commonProperties } = fhirQuestionnaireResponse; - const fceQuestionnaireResponse: FCEQuestionnaireResponse = - commonProperties as FCEQuestionnaireResponse; - if (encounter?.reference) { - fceQuestionnaireResponse.encounter = fromFHIRReference(encounter); - } - if (source?.reference) { - fceQuestionnaireResponse.source = fromFHIRReference(source); - } - return fceQuestionnaireResponse; -} diff --git a/sdc-qrf/src/converter/fhirToFce/utils.ts b/sdc-qrf/src/converter/fhirToFce/utils.ts deleted file mode 100644 index cbb26dd4..00000000 --- a/sdc-qrf/src/converter/fhirToFce/utils.ts +++ /dev/null @@ -1,36 +0,0 @@ -import { Questionnaire as FHIRQuestionnaire } from 'fhir/r4b'; - -export function checkFhirQuestionnaireProfile(fhirQuestionnaire: FHIRQuestionnaire): void { - if ( - !( - (fhirQuestionnaire.meta?.profile?.length ?? 0) === 1 && - fhirQuestionnaire.meta?.profile?.[0] === 'https://beda.software/beda-emr-questionnaire' - ) - ) { - throw new Error('Only beda emr questionanire supported'); - } -} - -export function trimUndefined(e: any) { - for (const prop in e) { - // eslint-disable-next-line no-prototype-builtins - if (e.hasOwnProperty(prop)) { - const val = e[prop]; - if (val === undefined) { - delete e[prop]; - } else if (typeof val === 'object') { - if (Array.isArray(val)) { - for (let i = 0; i < val.length; i++) { - if (typeof val[i] === 'object') { - trimUndefined(val[i]); - } - } - } else { - trimUndefined(val); - } - } - } - } - - return e; -} diff --git a/sdc-qrf/src/converter/index.ts b/sdc-qrf/src/converter/index.ts deleted file mode 100644 index 53859433..00000000 --- a/sdc-qrf/src/converter/index.ts +++ /dev/null @@ -1,106 +0,0 @@ -import { - Reference as FHIRReference, - Extension as FHIRExtension, - QuestionnaireItem as FHIRQuestionnaireItem, -} from 'fhir/r4b'; - -import { - Extension as FCEExtension, - QuestionnaireItem as FCEQuestionnaireItem, - InternalReference, -} from 'shared/src/contrib/aidbox'; - -import { ExtensionIdentifier, extensionTransformers } from './extensions'; -import { fromFirstClassExtension } from './fceToFhir'; -import { toFirstClassExtension } from './fhirToFce'; -import { processLaunchContext as processLaunchContextToFce } from './fhirToFce/questionnaire/processExtensions'; - -export function convertFromFHIRExtension( - extension: FHIRExtension, -): Partial | undefined { - const identifier = extension.url; - const transformer = extensionTransformers[identifier as ExtensionIdentifier]; - if (transformer !== undefined) { - if ('transform' in transformer) { - return transformer.transform.fromExtension(extension); - } else { - return { [transformer.path.questionnaire]: extension[transformer.path.extension] }; - } - } -} - -export function convertToFHIRExtension(item: FCEQuestionnaireItem): FHIRExtension[] { - const extensions: FHIRExtension[] = []; - for (const identifer in ExtensionIdentifier) { - const transformer = - extensionTransformers[ExtensionIdentifier[identifer] as ExtensionIdentifier]; - if ('transform' in transformer) { - const extension = transformer.transform.toExtension(item); - if (extension !== undefined) { - extensions.push(extension); - } - } else { - const extensionValue = item[transformer.path.questionnaire]; - if (extensionValue !== undefined) { - const extension: FHIRExtension = { - [transformer.path.extension]: extensionValue, - url: ExtensionIdentifier[identifer], - }; - extensions.push(extension); - } - } - } - return extensions; -} - -export function extractExtension(extension: FCEExtension[] | undefined, url: 'ex:createdAt') { - return extension?.find((e) => e.url === url)?.valueInstant; -} - -export function findExtension(item: FHIRQuestionnaireItem, url: string) { - return item.extension?.find((ext) => ext.url === url); -} - -export function fromFHIRReference(r?: FHIRReference): InternalReference | undefined { - if (!r || !r.reference) { - return undefined; - } - - const { reference: literalReference, ...commonReferenceProperties } = r; - const isHistoryVersionLink = r.reference.split('/').slice(-2, -1)[0] === '_history'; - - if (isHistoryVersionLink) { - const [, , id, resourceType] = r.reference.split('/').reverse(); - - return { - ...commonReferenceProperties, - id: id!, - resourceType, - }; - } else { - const [id, resourceType] = r.reference.split('/').reverse(); - - return { - ...commonReferenceProperties, - id: id!, - resourceType, - }; - } -} - -export function toFHIRReference(r?: InternalReference): FHIRReference | undefined { - if (!r) { - return undefined; - } - - const { id, resourceType, ...commonReferenceProperties } = r; - - delete commonReferenceProperties.resource; - - return { - ...commonReferenceProperties, - reference: `${resourceType}/${id}`, - }; -} - -export { toFirstClassExtension, fromFirstClassExtension, processLaunchContextToFce }; diff --git a/sdc-qrf/src/hooks.ts b/sdc-qrf/src/hooks.ts deleted file mode 100644 index b70914ca..00000000 --- a/sdc-qrf/src/hooks.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { useContext } from 'react'; - -import { QRFContext } from './context'; - -export function useQuestionnaireResponseFormContext() { - return useContext(QRFContext); -} diff --git a/sdc-qrf/src/index.ts b/sdc-qrf/src/index.ts deleted file mode 100644 index 060b4655..00000000 --- a/sdc-qrf/src/index.ts +++ /dev/null @@ -1,5 +0,0 @@ -export * from './types'; -export * from './utils'; -export * from './hooks'; -export * from './components'; -export * from './converter'; diff --git a/sdc-qrf/src/setupTests.ts b/sdc-qrf/src/setupTests.ts deleted file mode 100644 index 666127af..00000000 --- a/sdc-qrf/src/setupTests.ts +++ /dev/null @@ -1 +0,0 @@ -import '@testing-library/jest-dom/extend-expect'; diff --git a/sdc-qrf/src/types.ts b/sdc-qrf/src/types.ts deleted file mode 100644 index ef27526a..00000000 --- a/sdc-qrf/src/types.ts +++ /dev/null @@ -1,105 +0,0 @@ -import { ComponentType } from 'react'; - -import { - Observation, - ParametersParameter, - Questionnaire, - QuestionnaireItem, - QuestionnaireResponse, - QuestionnaireResponseItem, - QuestionnaireResponseItemAnswer, -} from 'shared/src/contrib/aidbox'; - -export type GroupItemComponent = ComponentType; -export type QuestionItemComponent = ComponentType; - -export type CustomWidgetsMapping = { - // [linkId: QuestionnaireItem['linkId']]: QuestionItemComponent; - [linkId: string]: QuestionItemComponent; -}; - -export type QuestionItemComponentMapping = { - // [type: QuestionnaireItem['type']]: QuestionItemComponent; - [type: string]: QuestionItemComponent; -}; - -export type ItemControlQuestionItemComponentMapping = { - [code: string]: QuestionItemComponent; -}; - -export type ItemControlGroupItemComponentMapping = { - [code: string]: GroupItemComponent; -}; - -export type ItemContext = { - resource: QuestionnaireResponse; - questionnaire: Questionnaire; - context: QuestionnaireResponseItem | QuestionnaireResponse; - qitem?: QuestionnaireItem; - [x: string]: any; -}; - -export interface QRFContextData { - questionItemComponents: QuestionItemComponentMapping; - groupItemComponent?: GroupItemComponent; - customWidgets?: CustomWidgetsMapping; - itemControlQuestionItemComponents?: ItemControlQuestionItemComponentMapping; - itemControlGroupItemComponents?: ItemControlGroupItemComponentMapping; - readOnly?: boolean; - - formValues: FormItems; - setFormValues: (values: FormItems, fieldPath: Array, value: any) => void; -} - -export interface QuestionItemsProps { - questionItems: QuestionnaireItem[]; - - context: ItemContext; - parentPath: string[]; -} - -export interface QuestionItemProps { - questionItem: QuestionnaireItem; - - context: ItemContext; - parentPath: string[]; -} - -export interface GroupItemProps { - questionItem: QuestionnaireItem; - - context: ItemContext[]; - parentPath: string[]; -} - -export type AnswerValue = Required['value'] & - Required['value']; - -export interface RepeatableFormGroupItems { - question?: string; - items?: FormItems[]; -} - -interface NotRepeatableFormGroupItems { - question?: string; - items?: FormItems; -} - -export type FormGroupItems = RepeatableFormGroupItems | NotRepeatableFormGroupItems; - -export interface FormAnswerItems { - value: T; - question?: string; - items?: FormItems; -} - -export type FormItems = Record; - -export interface QuestionnaireResponseFormData { - formValues: FormItems; - context: { - questionnaire: Questionnaire; - questionnaireResponse: QuestionnaireResponse; - launchContextParameters: ParametersParameter[]; - }; -} diff --git a/sdc-qrf/src/utils.ts b/sdc-qrf/src/utils.ts deleted file mode 100644 index 025f46aa..00000000 --- a/sdc-qrf/src/utils.ts +++ /dev/null @@ -1,751 +0,0 @@ -import fhirpath from 'fhirpath'; -import _ from 'lodash'; -import isArray from 'lodash/isArray'; -import isPlainObject from 'lodash/isPlainObject'; -import queryString from 'query-string'; - -import { - Questionnaire, - QuestionnaireItem, - QuestionnaireItemInitial, - QuestionnaireResponse, - QuestionnaireResponseItem, - QuestionnaireResponseItemAnswer, -} from 'shared/src/contrib/aidbox'; - -import { - AnswerValue, - FormAnswerItems, - FormGroupItems, - FormItems, - ItemContext, - QuestionnaireResponseFormData, - RepeatableFormGroupItems, -} from './types'; - -export function wrapAnswerValue(type: QuestionnaireItem['type'], answer: any) { - if (type === 'choice') { - if (isPlainObject(answer)) { - return { Coding: answer }; - } else { - return { string: answer }; - } - } - - if (type === 'open-choice') { - if (isPlainObject(answer)) { - return { Coding: answer }; - } else { - return { string: answer }; - } - } - - if (type === 'text') { - return { string: answer }; - } - - if (type === 'attachment') { - return { Attachment: answer }; - } - - if (type === 'reference') { - return { Reference: answer }; - } - - if (type === 'quantity') { - return { Quantity: answer }; - } - - return { [type]: answer }; -} - -export function getBranchItems( - fieldPath: string[], - questionnaire: Questionnaire, - questionnaireResponse: QuestionnaireResponse, -): { qItem: QuestionnaireItem; qrItems: QuestionnaireResponseItem[] } { - let qrItem: QuestionnaireResponseItem | QuestionnaireResponse | undefined = - questionnaireResponse; - let qItem: QuestionnaireItem | Questionnaire = questionnaire; - - // TODO: check for question with sub items - // TODO: check for root - for (let i = 0; i < fieldPath.length; i++) { - qItem = qItem.item!.find((curItem: any) => curItem.linkId === fieldPath[i])!; - - if (qrItem) { - const qrItems: QuestionnaireResponseItem[] = - qrItem.item?.filter((curItem: any) => curItem.linkId === fieldPath[i]) ?? []; - - if (qItem.repeats) { - if (i + 2 < fieldPath.length) { - // In the middle - qrItem = qrItems[parseInt(fieldPath[i + 2]!, 10)]; - } else { - // Leaf - return { qItem, qrItems }; - } - } else { - qrItem = qrItems[0]; - } - } - - if (qItem.repeats || qItem.type !== 'group') { - i += 2; - } else { - i++; - } - } - - return { qItem, qrItems: [qrItem] } as { - qItem: QuestionnaireItem; - qrItems: QuestionnaireResponseItem[]; - }; -} - -export function calcContext( - initialContext: ItemContext, - variables: QuestionnaireItem['variable'], - qItem: QuestionnaireItem, - qrItem: QuestionnaireResponseItem, -): ItemContext { - // TODO: add root variable support - return { - ...(variables || []).reduce( - (acc, curVariable) => ({ - ...acc, - [curVariable.name!]: fhirpath.evaluate(qrItem || {}, curVariable.expression!, acc), - }), - { ...initialContext, context: qrItem, qitem: qItem }, - ), - }; -} - -export function compareValue(firstAnswerValue: AnswerValue, secondAnswerValue: AnswerValue) { - const firstValueType = _.keys(firstAnswerValue)[0] as keyof AnswerValue; - const secondValueType = _.keys(secondAnswerValue)[0] as keyof AnswerValue; - if (firstValueType !== secondValueType) { - throw new Error('Enable when must be used for the same type'); - } - if ( - !_.includes( - ['string', 'date', 'dateTime', 'time', 'uri', 'boolean', 'integer', 'decimal'], - firstValueType, - ) - ) { - throw new Error('Impossible to compare non-primitive type'); - } - - if (firstValueType === 'Quantity') { - throw new Error('Quantity type is not supported yet'); - } - - const firstValue = firstAnswerValue[firstValueType]; - const secondValue = secondAnswerValue[secondValueType]; - - if (firstValue! < secondValue!) { - return -1; - } - if (firstValue! > secondValue!) { - return 1; - } - return 0; -} - -function isGroup(question: QuestionnaireItem) { - return question.type === 'group'; -} - -function isFormGroupItems( - question: QuestionnaireItem, - answers: FormGroupItems | FormAnswerItems[], -): answers is FormGroupItems { - return isGroup(question) && _.isPlainObject(answers); -} - -function isRepeatableFormGroupItems( - question: QuestionnaireItem, - answers: FormGroupItems, -): answers is RepeatableFormGroupItems { - return !!question.repeats && _.isArray(answers.items); -} - -function hasSubAnswerItems(items?: FormItems): items is FormItems { - return !!items && _.some(items, (x) => !_.some(x, _.isEmpty)); -} - -function mapFormToResponseRecursive( - answersItems: FormItems, - questionnaireItems: QuestionnaireItem[], -): QuestionnaireResponseItem[] { - return Object.entries(answersItems).reduce((acc, [linkId, answers]) => { - if (!linkId) { - console.warn('The answer item has no linkId'); - return acc; - } - - if (!answers) { - return acc; - } - - const question = questionnaireItems.filter((qItem) => qItem.linkId === linkId)[0]; - - if (!question) { - return acc; - } - - if (isFormGroupItems(question, answers)) { - const groups = isRepeatableFormGroupItems(question, answers) - ? answers.items || [] - : answers.items - ? [answers.items] - : []; - return groups.reduce((newAcc, group) => { - const items = mapFormToResponseRecursive(group, question.item ?? []); - - return [ - ...newAcc, - { - linkId, - ...(items.length ? { item: items } : {}), - }, - ]; - }, acc); - } - - return [ - ...acc, - { - linkId, - answer: answers.reduce((answersAcc, answer) => { - if (typeof answer === 'undefined') { - return answersAcc; - } - - if (!answer.value) { - return answersAcc; - } - - const items = hasSubAnswerItems(answer.items) - ? mapFormToResponseRecursive(answer.items, question.item ?? []) - : []; - - return [ - ...answersAcc, - { - value: answer.value, - ...(items.length ? { item: items } : {}), - }, - ]; - }, [] as QuestionnaireResponseItemAnswer[]), - }, - ]; - }, [] as QuestionnaireResponseItem[]); -} - -export function mapFormToResponse( - values: FormItems, - questionnaire: Questionnaire, -): Pick { - return { - item: mapFormToResponseRecursive(values, questionnaire.item ?? []), - }; -} - -function mapResponseToFormRecursive( - questionnaireResponseItems: QuestionnaireResponseItem[], - questionnaireItems: QuestionnaireItem[], -): FormItems { - return questionnaireItems.reduce((acc, question) => { - const { linkId, initial, repeats, text } = question; - - if (!linkId) { - console.warn('The question has no linkId'); - return acc; - } - - const qrItems = - questionnaireResponseItems.filter((qrItem) => qrItem.linkId === linkId) ?? []; - - if (qrItems.length && isGroup(question)) { - if (repeats) { - return { - ...acc, - [linkId]: { - question: text, - items: qrItems.map((qrItem) => { - return mapResponseToFormRecursive( - qrItem.item ?? [], - question.item ?? [], - ); - }), - }, - }; - } else { - return { - ...acc, - [linkId]: { - question: text, - items: mapResponseToFormRecursive( - qrItems[0]?.item ?? [], - question.item ?? [], - ), - }, - }; - } - } - - const answers = qrItems?.[0]?.answer?.length - ? qrItems[0].answer - : initialToQuestionnaireResponseItemAnswer(initial); - - if (!answers.length) { - return acc; - } - - return { - ...acc, - [linkId]: answers.map((answer) => ({ - question: text, - value: answer.value, - items: mapResponseToFormRecursive(answer.item ?? [], question.item ?? []), - })), - }; - }, {}); -} - -export function mapResponseToForm(resource: QuestionnaireResponse, questionnaire: Questionnaire) { - return mapResponseToFormRecursive(resource.item ?? [], questionnaire.item ?? []); -} - -function initialToQuestionnaireResponseItemAnswer(initial: QuestionnaireItemInitial[] | undefined) { - return (initial ?? []).map(({ value }) => ({ value }) as QuestionnaireResponseItemAnswer); -} - -export function findAnswersForQuestionsRecursive(linkId: string, values?: FormItems): any | null { - if (values && _.has(values, linkId)) { - return values[linkId]; - } - - return _.reduce( - values, - (acc, v) => { - if (acc) { - return acc; - } - - if (!v) { - return acc; - } - - if (_.isArray(v)) { - return _.reduce( - v, - (acc2, v2) => { - if (acc2) { - return acc2; - } - - return findAnswersForQuestionsRecursive(linkId, v2.items); - }, - null, - ); - } else if (_.isArray(v.items)) { - return _.reduce( - v.items, - (acc2, v2) => { - if (acc2) { - return acc2; - } - - return findAnswersForQuestionsRecursive(linkId, v2); - }, - null, - ); - } else { - return findAnswersForQuestionsRecursive(linkId, v.items); - } - }, - null, - ); -} - -export function findAnswersForQuestion( - linkId: string, - parentPath: string[], - values: FormItems, -): Array> { - const p = _.cloneDeep(parentPath); - - // Go up - while (p.length) { - const part = p.pop()!; - - // Find answers in parent groups (including repeatable) - // They might have either 'items' of the group or number of the repeatable group in path - if (part === 'items' || !isNaN(part as any)) { - const parentGroup = _.get(values, [...p, part]); - - if (typeof parentGroup === 'object' && linkId in parentGroup) { - return parentGroup[linkId]; - } - } - } - - // Go down - const answers = findAnswersForQuestionsRecursive(linkId, values); - - return answers ? answers : []; -} - -export function isValueEqual(firstValue: AnswerValue, secondValue: AnswerValue) { - const firstValueType = _.keys(firstValue)[0]; - const secondValueType = _.keys(secondValue)[0]; - - if (firstValueType !== secondValueType) { - console.error('Enable when must be used for the same type'); - - return false; - } - - if (firstValueType === 'Coding') { - // NOTE: what if undefined === undefined - return firstValue.Coding?.code === secondValue.Coding?.code; - } - - return _.isEqual(firstValue, secondValue); -} - -export function getChecker( - operator: string, -): (values: Array<{ value: any }>, answerValue: any) => boolean { - if (operator === '=') { - return (values, answerValue) => - _.findIndex(values, ({ value }) => isValueEqual(value, answerValue)) !== -1; - } - - if (operator === '!=') { - return (values, answerValue) => - _.findIndex(values, ({ value }) => isValueEqual(value, answerValue)) === -1; - } - - if (operator === 'exists') { - return (values, answerValue) => { - const answersLength = _.reject( - values, - (value) => - isValueEmpty(value.value) || _.every(_.mapValues(value.value, isValueEmpty)), - ).length; - const answer = answerValue?.boolean ?? true; - return answersLength > 0 === answer; - }; - } - - if (operator === '>=') { - return (values, answerValue) => - _.findIndex( - _.reject(values, (value) => _.isEmpty(value.value)), - ({ value }) => compareValue(value, answerValue) >= 0, - ) !== -1; - } - - if (operator === '>') { - return (values, answerValue) => - _.findIndex( - _.reject(values, (value) => _.isEmpty(value.value)), - ({ value }) => compareValue(value, answerValue) > 0, - ) !== -1; - } - - if (operator === '<=') { - return (values, answerValue) => - _.findIndex( - _.reject(values, (value) => _.isEmpty(value.value)), - ({ value }) => compareValue(value, answerValue) <= 0, - ) !== -1; - } - - if (operator === '<') { - return (values, answerValue) => - _.findIndex( - _.reject(values, (value) => _.isEmpty(value.value)), - ({ value }) => compareValue(value, answerValue) < 0, - ) !== -1; - } - - console.error(`Unsupported enableWhen.operator ${operator}`); - - return _.constant(true); -} - -interface IsQuestionEnabledArgs { - qItem: QuestionnaireItem; - parentPath: string[]; - values: FormItems; - context: ItemContext; -} -function isQuestionEnabled(args: IsQuestionEnabledArgs) { - const { enableWhen, enableBehavior, enableWhenExpression } = args.qItem; - - if (enableWhen && enableWhenExpression) { - console.warn(` - linkId: ${args.qItem.linkId} - Both enableWhen and enableWhenExpression are used in the - same QuestionItem. - enableWhenExpression is used as more prioritized - `); - } - - if (!enableWhen && !enableWhenExpression) { - return true; - } - - if (enableWhenExpression && enableWhenExpression.language === 'text/fhirpath') { - const expressionResult = fhirpath.evaluate( - args.context.resource, - enableWhenExpression.expression!, - args.context ?? {}, - )[0]; - - if (typeof expressionResult !== 'boolean') { - throw Error(` - linkId: ${args.qItem.linkId} - Expression result: ${expressionResult} - The result of enableWhenExpression is not a boolean value - `); - } - - return expressionResult; - } - - const iterFn = enableBehavior === 'any' ? _.some : _.every; - - return iterFn(enableWhen, ({ question, answer, operator }) => { - const check = getChecker(operator); - - if (_.includes(args.parentPath, question)) { - // TODO: handle double-nested values - const parentAnswerPath = _.slice(args.parentPath, 0, args.parentPath.length - 1); - const parentAnswer = _.get(args.values, parentAnswerPath); - - return check(parentAnswer ? [parentAnswer] : [], answer); - } - const answers = findAnswersForQuestion(question, args.parentPath, args.values); - - return check(_.compact(answers), answer); - }); -} - -export function removeDisabledAnswers( - questionnaire: Questionnaire, - values: FormItems, - context: ItemContext, -): FormItems { - return removeDisabledAnswersRecursive({ - questionnaireItems: questionnaire.item ?? [], - parentPath: [], - answersItems: values, - initialValues: {}, - context, - }); -} - -interface RemoveDisabledAnswersRecursiveArgs { - questionnaireItems: QuestionnaireItem[]; - parentPath: string[]; - answersItems: FormItems; - initialValues: FormItems; - context: ItemContext; -} -function removeDisabledAnswersRecursive(args: RemoveDisabledAnswersRecursiveArgs): FormItems { - return args.questionnaireItems.reduce((acc, questionnaireItem) => { - const values = args.parentPath.length - ? _.set(_.cloneDeep(args.initialValues), args.parentPath, acc) - : acc; - - const { linkId } = questionnaireItem; - const answers = args.answersItems[linkId!]; - - if (!answers) { - return acc; - } - - if ( - !isQuestionEnabled({ - qItem: questionnaireItem, - parentPath: args.parentPath, - values, - context: args.context, - }) - ) { - return acc; - } - - if (isFormGroupItems(questionnaireItem, answers)) { - if (!answers.items) { - return acc; - } - - if (isRepeatableFormGroupItems(questionnaireItem, answers)) { - return { - ...acc, - [linkId!]: { - ...answers, - items: answers.items.map((group, index) => - removeDisabledAnswersRecursive({ - questionnaireItems: questionnaireItem.item ?? [], - parentPath: [ - ...args.parentPath, - linkId!, - 'items', - index.toString(), - ], - answersItems: group, - initialValues: values, - context: args.context, - }), - ), - }, - }; - } else { - return { - ...acc, - [linkId!]: { - ...answers, - items: removeDisabledAnswersRecursive({ - questionnaireItems: questionnaireItem.item ?? [], - parentPath: [...args.parentPath, linkId!, 'items'], - answersItems: answers.items, - initialValues: values, - context: args.context, - }), - }, - }; - } - } - - return { - ...acc, - [linkId!]: answers.reduce((answersAcc, answer, index) => { - if (typeof answer === 'undefined') { - return answersAcc; - } - - if (!answer.value) { - return answersAcc; - } - - const items = hasSubAnswerItems(answer.items) - ? removeDisabledAnswersRecursive({ - questionnaireItems: questionnaireItem.item ?? [], - parentPath: [...args.parentPath, linkId!, index.toString(), 'items'], - answersItems: answer.items, - initialValues: values, - context: args.context, - }) - : {}; - - return [...answersAcc, { ...answer, items }]; - }, [] as any), - }; - }, {} as any); -} - -export function getEnabledQuestions( - questionnaireItems: QuestionnaireItem[], - parentPath: string[], - values: FormItems, - context: ItemContext, -) { - return _.filter(questionnaireItems, (qItem) => { - const { linkId } = qItem; - - if (!linkId) { - return false; - } - - return isQuestionEnabled({ qItem, parentPath, values, context }); - }); -} - -export function calcInitialContext( - qrfDataContext: QuestionnaireResponseFormData['context'], - values: FormItems, -): ItemContext { - const questionnaireResponse = { - ...qrfDataContext.questionnaireResponse, - ...mapFormToResponse(values, qrfDataContext.questionnaire), - }; - - return { - ...qrfDataContext.launchContextParameters.reduce( - (acc, { name, value, resource }) => ({ - ...acc, - [name]: - value && isPlainObject(value) - ? value[Object.keys(value)[0] as keyof AnswerValue] - : resource, - }), - {}, - ), - - // Vars defined in IG - questionnaire: qrfDataContext.questionnaire, - resource: questionnaireResponse, - context: questionnaireResponse, - - // Vars we use for backward compatibility - Questionnaire: qrfDataContext.questionnaire, - QuestionnaireResponse: questionnaireResponse, - }; -} - -function resolveTemplateExpr(str: string, context: ItemContext) { - const matches = str.match(/{{[^}]+}}/g); - - if (matches) { - return matches.reduce((result, match) => { - const expr = match.replace(/[{}]/g, ''); - - const resolvedVar = fhirpath.evaluate(context.context || {}, expr, context); - - if (resolvedVar?.length) { - return result.replace(match, resolvedVar.join(',')); - } else { - return result.replace(match, ''); - } - }, str); - } - - return str; -} - -export function parseFhirQueryExpression(expression: string, context: ItemContext) { - const [resourceType, paramsQS] = expression.split('?', 2); - const searchParams = Object.fromEntries( - Object.entries(queryString.parse(paramsQS ?? '')).map(([key, value]) => { - if (!value) { - return [key, value]; - } - - return [ - key, - isArray(value) - ? value.map((arrValue) => resolveTemplateExpr(arrValue!, context)) - : resolveTemplateExpr(value, context), - ]; - }), - ); - - return [resourceType, searchParams]; -} - -export function isValueEmpty(value: any) { - if (_.isNaN(value)) { - console.warn( - 'Please be aware that a NaN value has been detected. In the context of an "exist" operator, a NaN value is interpreted as a non-existent value. This may lead to unexpected behavior in your code. Ensure to handle or correct this to maintain the integrity of your application.', - ); - } - - return _.isFinite(value) || _.isBoolean(value) ? false : _.isEmpty(value); -} diff --git a/sdc-qrf/tests/resources/questionnaire.ts b/sdc-qrf/tests/resources/questionnaire.ts deleted file mode 100644 index a07ccc30..00000000 --- a/sdc-qrf/tests/resources/questionnaire.ts +++ /dev/null @@ -1,339 +0,0 @@ -import { Questionnaire } from 'shared/src/contrib/aidbox'; - -export const allergiesQuestionnaire: Questionnaire = { - id: 'allergies', - resourceType: 'Questionnaire', - name: 'Allergies', - status: 'active', - item: [ - { - linkId: 'type', - text: 'Type', - required: true, - type: 'choice', - itemControl: { - coding: [ - { - code: 'inline-choice', - }, - ], - }, - answerOption: [ - { - value: { - Coding: { - system: 'http://snomed.ct', - code: '418634005', - display: 'Drug', - }, - }, - }, - { - value: { - Coding: { - system: 'http://snomed.ct', - code: '414285001', - display: 'Food', - }, - }, - }, - { - value: { - Coding: { - system: 'http://snomed.ct', - code: '426232007', - display: 'Environmental', - }, - }, - }, - ], - }, - { - linkId: 'reaction', - text: 'Reaction', - type: 'choice', - repeats: true, - itemControl: { - coding: [ - { - code: 'inline-choice', - }, - ], - }, - answerOption: [ - { - value: { - Coding: { - system: 'http://snomed.ct', - code: '39579001', - display: 'Anaphylaxis', - }, - }, - }, - { - value: { - Coding: { - system: 'http://snomed.ct', - code: '25064002', - display: 'Headache', - }, - }, - }, - { - value: { - Coding: { - system: 'http://snomed.ct', - code: '247472004', - display: 'Hives (Wheal)', - }, - }, - }, - { - value: { - Coding: { - system: 'http://snomed.ct', - code: '422587007', - display: 'Nausea', - }, - }, - }, - { - value: { - Coding: { - system: 'http://snomed.ct', - code: '422400008', - display: 'Vomiting', - }, - }, - }, - { - value: { - Coding: { - system: 'http://snomed.ct', - code: '782197009', - display: 'Other', - }, - }, - }, - ], - }, - { - linkId: 'substance-drug', - text: 'Substance', - type: 'choice', - itemControl: { - coding: [ - { - code: 'inline-choice', - }, - ], - }, - enableWhen: [ - { - question: 'type', - operator: '=', - answer: { - Coding: { - system: 'http://snomed.ct', - code: '418634005', - }, - }, - }, - ], - answerOption: [ - { - value: { - Coding: { - system: 'http://loinc.org', - code: 'LA26702-3', - display: 'Aspirin', - }, - }, - }, - { - value: { - Coding: { - system: 'http://loinc.org', - code: '\tLA30119-4', - display: 'Iodine', - }, - }, - }, - { - value: { - Coding: { - system: 'http://loinc.org', - code: 'LA14348-9', - display: 'Naproxen, ketoprofen or other non-steroidal', - }, - }, - }, - { - value: { - Coding: { - system: 'http://loinc.org', - code: 'LA28487-9', - display: 'Penicillin', - }, - }, - }, - { - value: { - Coding: { - system: 'http://loinc.org', - code: 'LA30118-6', - display: 'Sulfa drugs', - }, - }, - }, - ], - }, - { - linkId: 'substance-food', - text: 'Substance', - type: 'choice', - itemControl: { - coding: [ - { - code: 'inline-choice', - }, - ], - }, - enableWhen: [ - { - question: 'type', - operator: '=', - answer: { - Coding: { - system: 'http://snomed.ct', - code: '414285001', - }, - }, - }, - ], - answerOption: [ - { - value: { - Coding: { - system: 'http://snomed.ct', - code: '102259006', - display: 'Citrus fruit', - }, - }, - }, - { - value: { - Coding: { - system: 'http://snomed.ct', - code: '102260001', - display: 'Peanut butter', - }, - }, - }, - { - value: { - Coding: { - system: 'http://snomed.ct', - code: '102261002', - display: 'Strawberry', - }, - }, - }, - { - value: { - Coding: { - system: 'http://snomed.ct', - code: '102262009', - display: 'Chocolate', - }, - }, - }, - { - value: { - Coding: { - system: 'http://snomed.ct', - code: '102263004', - display: 'Eggs', - }, - }, - }, - { - value: { - Coding: { - system: 'http://snomed.ct', - code: '102264005', - display: 'Cheese', - }, - }, - }, - ], - }, - { - linkId: 'substance-environmental', - text: 'Substance', - type: 'choice', - itemControl: { - coding: [ - { - code: 'inline-choice', - }, - ], - }, - enableWhen: [ - { - question: 'type', - operator: '=', - answer: { - Coding: { - system: 'http://snomed.ct', - code: '426232007', - }, - }, - }, - ], - answerOption: [ - { - value: { - Coding: { - system: 'http://snomed.ct', - code: '111088007', - display: 'Latex', - }, - }, - }, - { - value: { - Coding: { - system: 'http://snomed.ct', - code: '256259004', - display: 'Pollen', - }, - }, - }, - { - value: { - Coding: { - system: 'http://snomed.ct', - code: '256277009', - display: 'Grass pollen', - }, - }, - }, - { - value: { - Coding: { - system: 'http://snomed.ct', - code: '256417003', - display: 'Horse dander', - }, - }, - }, - ], - }, - { - linkId: 'notes', - text: 'Notes', - type: 'string', - }, - ], -}; diff --git a/sdc-qrf/tests/utils.test.ts b/sdc-qrf/tests/utils.test.ts deleted file mode 100644 index 13322b13..00000000 --- a/sdc-qrf/tests/utils.test.ts +++ /dev/null @@ -1,767 +0,0 @@ -import { Questionnaire, QuestionnaireResponse } from 'shared/src/contrib/aidbox'; - -import { allergiesQuestionnaire } from './resources/questionnaire'; -import { - getEnabledQuestions, - isValueEmpty, - mapFormToResponse, - mapResponseToForm, - removeDisabledAnswers, -} from '../src'; - -test('Transform nested repeatable-groups from new resource to new resource', () => { - const questionnaire: Questionnaire = { - resourceType: 'Questionnaire', - status: 'active', - item: [ - { - linkId: 'root-group', - type: 'group', - text: 'Root group', - item: [ - { - linkId: 'repeatable-group', - type: 'group', - repeats: true, - text: 'Repeatable group', - item: [ - { linkId: 'answer', text: 'Answer', type: 'text', repeats: true }, - { - linkId: 'nested-repeatable-group', - text: 'Nested repeatable group', - repeats: true, - type: 'group', - item: [ - { - linkId: 'nested-answer', - text: 'Nested answer', - type: 'text', - repeats: true, - }, - ], - }, - ], - }, - ], - }, - ], - }; - - const qr: QuestionnaireResponse = { - resourceType: 'QuestionnaireResponse', - status: 'completed', - item: [ - { - linkId: 'root-group', - item: [ - { - linkId: 'repeatable-group', - item: [ - { - linkId: 'answer', - answer: [ - { value: { string: 'answer for the first group 1' } }, - { value: { string: 'answer for the first group 2' } }, - ], - }, - { - linkId: 'nested-repeatable-group', - item: [ - { - linkId: 'nested-answer', - - answer: [ - { - value: { - string: 'nested answer for the first group 1', - }, - }, - { - value: { - string: 'nested answer for the first group 2', - }, - }, - ], - }, - ], - }, - ], - }, - { - linkId: 'repeatable-group', - item: [ - { - linkId: 'answer', - answer: [ - { value: { string: 'answer for the second group 1' } }, - { value: { string: 'answer for the second group 2' } }, - ], - }, - { - linkId: 'nested-repeatable-group', - item: [ - { - linkId: 'nested-answer', - - answer: [ - { - value: { - string: 'nested answer for the second group 1', - }, - }, - { - value: { - string: 'nested answer for the second group 2', - }, - }, - ], - }, - ], - }, - ], - }, - ], - }, - ], - }; - const formItems = mapResponseToForm(qr, questionnaire); - const actualQR = { ...qr, ...mapFormToResponse(formItems, questionnaire) }; - - expect(actualQR).toEqual(qr); -}); - -test('Transform with initial values', () => { - const questionnaire: Questionnaire = { - resourceType: 'Questionnaire', - status: 'active', - item: [ - { - linkId: 'root-group', - type: 'group', - text: 'Root group', - item: [ - { - linkId: 'answer-without-initial', - type: 'text', - }, - { - linkId: 'answer-with-initial', - type: 'text', - initial: [{ value: { string: 'initial' } }], - }, - ], - }, - ], - }; - - const initialQR: QuestionnaireResponse = { - resourceType: 'QuestionnaireResponse', - status: 'completed', - item: [ - { - linkId: 'root-group', - }, - ], - }; - const expectedQR: QuestionnaireResponse = { - resourceType: 'QuestionnaireResponse', - status: 'completed', - item: [ - { - linkId: 'root-group', - item: [ - { linkId: 'answer-with-initial', answer: [{ value: { string: 'initial' } }] }, - ], - }, - ], - }; - const formItems = mapResponseToForm(initialQR, questionnaire); - const actualQR = { ...initialQR, ...mapFormToResponse(formItems, questionnaire) }; - - expect(actualQR).toEqual(expectedQR); -}); - -test('enableWhen logic for non-repeatable groups', () => { - const questionnaire: Questionnaire = { - resourceType: 'Questionnaire', - status: 'active', - item: [ - { - linkId: 'root-group', - type: 'group', - text: 'Root group', - item: [ - { - linkId: 'non-repeatable-group', - type: 'group', - text: 'Non Repeatable group', - item: [ - { linkId: 'condition', text: 'Condition', type: 'boolean' }, - { - linkId: 'question-for-yes', - text: 'Question for yes', - type: 'text', - enableWhen: [ - { - question: 'condition', - operator: '=', - answer: { boolean: true }, - }, - ], - }, - { - linkId: 'question-for-no', - text: 'Question for no', - type: 'text', - enableWhen: [ - { - question: 'condition', - operator: '=', - answer: { boolean: false }, - }, - ], - }, - ], - }, - ], - }, - ], - }; - - const qr: QuestionnaireResponse = { - resourceType: 'QuestionnaireResponse', - status: 'completed', - item: [ - { - linkId: 'root-group', - item: [ - { - linkId: 'non-repeatable-group', - item: [ - { - linkId: 'condition', - answer: [{ value: { boolean: true } }], - }, - { - linkId: 'question-for-yes', - answer: [{ value: { string: 'yes' } }], - }, - { - linkId: 'question-for-no', - answer: [{ value: { string: 'no' } }], - }, - ], - }, - ], - }, - ], - }; - const expectedQR: QuestionnaireResponse = { - resourceType: 'QuestionnaireResponse', - status: 'completed', - item: [ - { - linkId: 'root-group', - item: [ - { - linkId: 'non-repeatable-group', - item: [ - { - linkId: 'condition', - answer: [{ value: { boolean: true } }], - }, - { - linkId: 'question-for-yes', - answer: [{ value: { string: 'yes' } }], - }, - ], - }, - ], - }, - ], - }; - const formItems = mapResponseToForm(qr, questionnaire); - const enabledFormItems = removeDisabledAnswers(questionnaire, formItems, { - questionnaire, - resource: qr, - context: qr, - }); - const actualQR = { ...qr, ...mapFormToResponse(enabledFormItems, questionnaire) }; - - expect(actualQR).toEqual(expectedQR); -}); - -test('enableWhen logic for repeatable groups', () => { - const questionnaire: Questionnaire = { - resourceType: 'Questionnaire', - status: 'active', - item: [ - { - linkId: 'root-group', - type: 'group', - text: 'Root group', - item: [ - { - linkId: 'repeatable-group', - type: 'group', - repeats: true, - text: 'Repeatable group', - item: [ - { linkId: 'condition', text: 'Condition', type: 'boolean' }, - { - linkId: 'question-for-yes', - text: 'Question for yes', - type: 'text', - enableWhen: [ - { - question: 'condition', - operator: '=', - answer: { boolean: true }, - }, - ], - }, - { - linkId: 'question-for-no', - text: 'Question for no', - type: 'text', - enableWhen: [ - { - question: 'condition', - operator: '=', - answer: { boolean: false }, - }, - ], - }, - ], - }, - ], - }, - ], - }; - - const qr: QuestionnaireResponse = { - resourceType: 'QuestionnaireResponse', - status: 'completed', - item: [ - { - linkId: 'root-group', - item: [ - { - linkId: 'repeatable-group', - item: [ - { - linkId: 'condition', - answer: [{ value: { boolean: true } }], - }, - { - linkId: 'question-for-yes', - answer: [{ value: { string: 'yes' } }], - }, - { - linkId: 'question-for-no', - answer: [{ value: { string: 'no' } }], - }, - ], - }, - { - linkId: 'repeatable-group', - item: [ - { - linkId: 'condition', - answer: [{ value: { boolean: false } }], - }, - { - linkId: 'question-for-yes', - answer: [{ value: { string: 'yes' } }], - }, - { - linkId: 'question-for-no', - answer: [{ value: { string: 'no' } }], - }, - ], - }, - ], - }, - ], - }; - const expectedQR: QuestionnaireResponse = { - resourceType: 'QuestionnaireResponse', - status: 'completed', - item: [ - { - linkId: 'root-group', - item: [ - { - linkId: 'repeatable-group', - item: [ - { - linkId: 'condition', - answer: [{ value: { boolean: true } }], - }, - { - linkId: 'question-for-yes', - answer: [{ value: { string: 'yes' } }], - }, - ], - }, - { - linkId: 'repeatable-group', - item: [ - { - linkId: 'condition', - answer: [{ value: { boolean: false } }], - }, - { - linkId: 'question-for-no', - answer: [{ value: { string: 'no' } }], - }, - ], - }, - ], - }, - ], - }; - const formItems = mapResponseToForm(qr, questionnaire); - const enabledFormItems = removeDisabledAnswers(questionnaire, formItems, { - questionnaire, - resource: qr, - context: qr, - }); - const actualQR = { ...qr, ...mapFormToResponse(enabledFormItems, questionnaire) }; - - expect(actualQR).toEqual(expectedQR); -}); - -test('enableWhenExpression logic', () => { - const questionnaire: Questionnaire = { - resourceType: 'Questionnaire', - status: 'active', - item: [ - { - linkId: 'root-group', - type: 'group', - text: 'Root group', - item: [ - { - linkId: 'non-repeatable-group', - type: 'group', - text: 'Non Repeatable group', - item: [ - { linkId: 'condition', text: 'Condition', type: 'boolean' }, - { - linkId: 'question-for-yes', - text: 'Question for yes', - type: 'text', - enableWhenExpression: { - language: 'text/fhirpath', - expression: - "%resource.repeat(item).where(linkId = 'condition').answer.children().boolean = true", - }, - }, - { - linkId: 'question-for-no', - text: 'Question for no', - type: 'text', - enableWhenExpression: { - language: 'text/fhirpath', - expression: - "%resource.repeat(item).where(linkId = 'condition').answer.children().boolean = false", - }, - }, - ], - }, - ], - }, - ], - }; - - const qr: QuestionnaireResponse = { - resourceType: 'QuestionnaireResponse', - status: 'completed', - item: [ - { - linkId: 'root-group', - item: [ - { - linkId: 'non-repeatable-group', - item: [ - { - linkId: 'condition', - answer: [{ value: { boolean: true } }], - }, - { - linkId: 'question-for-yes', - answer: [{ value: { string: 'yes' } }], - }, - { - linkId: 'question-for-no', - answer: [{ value: { string: 'no' } }], - }, - ], - }, - ], - }, - ], - }; - const expectedQR: QuestionnaireResponse = { - resourceType: 'QuestionnaireResponse', - status: 'completed', - item: [ - { - linkId: 'root-group', - item: [ - { - linkId: 'non-repeatable-group', - item: [ - { - linkId: 'condition', - answer: [{ value: { boolean: true } }], - }, - { - linkId: 'question-for-yes', - answer: [{ value: { string: 'yes' } }], - }, - ], - }, - ], - }, - ], - }; - const formItems = mapResponseToForm(qr, questionnaire); - const enabledQuestionsLinkIds = getEnabledQuestions( - questionnaire.item?.[0]?.item?.[0]?.item ?? [], - ['items', 'root-group', 'items'], - formItems, - { - questionnaire, - resource: qr, - context: qr, - }, - ).map((questionnaireItem) => questionnaireItem.linkId); - - expect(enabledQuestionsLinkIds).toStrictEqual(['condition', 'question-for-yes']); - - const enabledFormItems = removeDisabledAnswers(questionnaire, formItems, { - questionnaire, - resource: qr, - context: qr, - }); - const actualQR = { ...qr, ...mapFormToResponse(enabledFormItems, questionnaire) }; - - expect(actualQR).toEqual(expectedQR); -}); - -test('mapFormToResponse cut empty answers', () => { - const formValues = { - type: [ - { - value: { - Coding: { - code: '418634005', - system: 'http://snomed.ct', - display: 'Drug', - }, - }, - }, - ], - reaction: undefined, - notes: [ - { - value: {}, - }, - ], - }; - - const result = mapFormToResponse(formValues, allergiesQuestionnaire); - const answersLinkIds = result.item?.map((answerItem) => answerItem.linkId) ?? []; - expect(answersLinkIds.includes('reaction')).not.toBe(true); - expect(answersLinkIds).toEqual(expect.arrayContaining(['type', 'notes'])); -}); - -describe('enableWhen exists logic for non-repeatable groups primitives', () => { - const testConfigs = [ - { - name: 'boolean exist', - q: { linkId: 'condition', text: 'Condition', type: 'boolean' }, - qr: [ - { - linkId: 'condition', - answer: [{ value: { boolean: true } }], - }, - { - linkId: 'question-for-yes', - answer: [{ value: { string: 'yes' } }], - }, - ], - }, - { - name: 'boolean not exist', - q: { linkId: 'condition', text: 'Condition', type: 'boolean' }, - qr: [ - { - linkId: 'question-for-no', - answer: [{ value: { string: 'no' } }], - }, - ], - }, - { - name: 'integer exist', - q: { linkId: 'condition', text: 'Condition', type: 'integer' }, - qr: [ - { - linkId: 'condition', - answer: [{ value: { integer: 1 } }], - }, - { - linkId: 'question-for-yes', - answer: [{ value: { string: 'yes' } }], - }, - ], - }, - { - name: 'integer not exist', - q: { linkId: 'condition', text: 'Condition', type: 'integer' }, - qr: [ - { - linkId: 'question-for-no', - answer: [{ value: { string: 'no' } }], - }, - ], - }, - { - name: 'decimal exist', - q: { linkId: 'condition', text: 'Condition', type: 'decimal' }, - qr: [ - { - linkId: 'condition', - answer: [{ value: { decimal: 1 } }], - }, - { - linkId: 'question-for-yes', - answer: [{ value: { string: 'yes' } }], - }, - ], - }, - { - name: 'decimal not exist', - q: { linkId: 'condition', text: 'Condition', type: 'decimal' }, - qr: [ - { - linkId: 'question-for-no', - answer: [{ value: { string: 'no' } }], - }, - ], - }, - ]; - - test.each(testConfigs)('enableWhen works correctly', async (testConfig) => { - const questionnaire: Questionnaire = { - resourceType: 'Questionnaire', - status: 'active', - item: [ - { - linkId: 'root-group', - type: 'group', - text: 'Root group', - item: [ - { - linkId: 'non-repeatable-group', - type: 'group', - text: 'Non Repeatable group', - item: [ - testConfig.q, - { - linkId: 'question-for-yes', - text: 'Question for yes', - type: 'text', - enableWhen: [ - { - question: 'condition', - operator: 'exists', - answer: { boolean: true }, - }, - ], - }, - { - linkId: 'question-for-no', - text: 'Question for no', - type: 'text', - enableWhen: [ - { - question: 'condition', - operator: 'exists', - answer: { boolean: false }, - }, - ], - }, - ], - }, - ], - }, - ], - }; - - const qr: QuestionnaireResponse = { - resourceType: 'QuestionnaireResponse', - status: 'completed', - item: [ - { - linkId: 'root-group', - item: [ - { - linkId: 'non-repeatable-group', - item: testConfig.qr, - }, - ], - }, - ], - }; - const expectedQR: QuestionnaireResponse = { - resourceType: 'QuestionnaireResponse', - status: 'completed', - item: [ - { - linkId: 'root-group', - item: [ - { - linkId: 'non-repeatable-group', - item: testConfig.qr, - }, - ], - }, - ], - }; - const formItems = mapResponseToForm(qr, questionnaire); - const enabledFormItems = removeDisabledAnswers(questionnaire, formItems, { - questionnaire, - resource: qr, - context: qr, - }); - const actualQR = { ...qr, ...mapFormToResponse(enabledFormItems, questionnaire) }; - - expect(actualQR).toEqual(expectedQR); - }); -}); - -describe('isValueEmpty method test', () => { - const valueTypeList = [ - { value: 1, expect: false }, - { value: 0, expect: false }, - { value: 1.1, expect: false }, - { value: 'a', expect: false }, - { value: true, expect: false }, - { value: false, expect: false }, - { value: { a: 1 }, expect: false }, - { value: ['a'], expect: false }, - { value: '', expect: true }, - { value: [], expect: true }, - { value: {}, expect: true }, - { value: undefined, expect: true }, - { value: null, expect: true }, - { value: NaN, expect: true }, - ]; - - test.each(valueTypeList)('isValueEmpty works correctly for type %s', async (valueType) => { - expect(isValueEmpty(valueType.value)).toEqual(valueType.expect); - }); -}); diff --git a/sdc-qrf/tsconfig.json b/sdc-qrf/tsconfig.json deleted file mode 100644 index d90857c4..00000000 --- a/sdc-qrf/tsconfig.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "extends": "../tsconfig.json", - "compilerOptions": { - "target": "es6", - "module": "commonjs", - "lib": [ - "DOM", - "ES5", - "DOM.Iterable" - ], - "baseUrl": "./src", - "sourceMap": true, - "outDir": "./lib", - "declaration": true, - "allowJs": true, - "jsx": "react-jsx", - "moduleResolution": "node", - "noEmit": false, - "importHelpers": true, - "noUncheckedIndexedAccess": true, - "allowImportingTsExtensions": false, - }, - "include": [ - "src" - ], - "exclude": [ - "node_modules", - "src/**/*.test.ts", - "src/**/*.test.tsx" - ] -} \ No newline at end of file diff --git a/sdc-qrf/vite.config.ts b/sdc-qrf/vite.config.ts deleted file mode 100644 index b44f7ff8..00000000 --- a/sdc-qrf/vite.config.ts +++ /dev/null @@ -1,14 +0,0 @@ -import * as path from 'path'; - -import { getBaseConfig } from '../vite.config'; - -export default getBaseConfig({ - test: { - globals: true, // To use the Vitest APIs globally like Jest - environment: 'jsdom', // https://vitest.dev/config/#environment - setupFiles: 'src/setupTests.ts', // https://vitest.dev/config/#setupfiles - }, - build: { - outDir: path.resolve(__dirname, 'lib'), - }, -}); diff --git a/web/src/components/BaseQuestionnaireResponseForm/index.tsx b/web/src/components/BaseQuestionnaireResponseForm/index.tsx index 460ec9cd..d391eb89 100644 --- a/web/src/components/BaseQuestionnaireResponseForm/index.tsx +++ b/web/src/components/BaseQuestionnaireResponseForm/index.tsx @@ -3,6 +3,7 @@ import { questionnaireIdWOAssembleLoader, } from '@beda.software/fhir-questionnaire'; import { QuestionnaireResponseFormProps } from '@beda.software/fhir-questionnaire/components/QuestionnaireResponseForm/questionnaire-response-form-data'; +import { ParametersParameter } from '@beda.software/fhir-questionnaire/contrib/aidbox'; import { FormItems, QuestionnaireResponseFormData, @@ -66,7 +67,9 @@ export function BaseQuestionnaireResponseForm({ initialQuestionnaireResponse={ formData.context.questionnaireResponse as QuestionnaireResponse } - launchContextParameters={formData.context.launchContextParameters} + launchContextParameters={ + formData.context.launchContextParameters as ParametersParameter[] + } serviceProvider={serviceProvider} widgetsByQuestionType={{ date: QuestionDate, diff --git a/yarn.lock b/yarn.lock index 5e23cfd9..0a483c9f 100644 --- a/yarn.lock +++ b/yarn.lock @@ -60,7 +60,7 @@ resolved "https://registry.yarnpkg.com/@babel/compat-data/-/compat-data-7.24.6.tgz#b3600217688cabb26e25f8e467019e66d71b7ae2" integrity sha512-aC2DGhBq5eEdyXWqrDInSqQjO0k8xtPRf5YylULqx8MCd6jBtzqfta/3ETMRpuKIc5hyswfO80ObyA1MvkCcUQ== -"@babel/core@^7.1.0", "@babel/core@^7.11.1", "@babel/core@^7.12.3", "@babel/core@^7.14.0", "@babel/core@^7.16.0", "@babel/core@^7.22.9", "@babel/core@^7.7.2", "@babel/core@^7.7.7", "@babel/core@^7.8.0": +"@babel/core@^7.1.0", "@babel/core@^7.11.1", "@babel/core@^7.12.3", "@babel/core@^7.14.0", "@babel/core@^7.16.0", "@babel/core@^7.22.9", "@babel/core@^7.7.2", "@babel/core@^7.8.0": version "7.22.10" resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.22.10.tgz#aad442c7bcd1582252cb4576747ace35bc122f35" integrity sha512-fTmqbbUBAwCcre6zPzNngvsI0aNrPZe77AeqvDxWM9Nm+04RrJ3CAmGHA9f7lJQY6ZMhRztNemy4uslDxTX4Qw== @@ -1154,7 +1154,7 @@ "@babel/helper-create-regexp-features-plugin" "^7.22.5" "@babel/helper-plugin-utils" "^7.22.5" -"@babel/preset-env@^7.11.0", "@babel/preset-env@^7.12.1", "@babel/preset-env@^7.16.0", "@babel/preset-env@^7.16.4", "@babel/preset-env@^7.22.9", "@babel/preset-env@^7.7.7": +"@babel/preset-env@^7.11.0", "@babel/preset-env@^7.12.1", "@babel/preset-env@^7.16.0", "@babel/preset-env@^7.16.4", "@babel/preset-env@^7.22.9": version "7.22.10" resolved "https://registry.yarnpkg.com/@babel/preset-env/-/preset-env-7.22.10.tgz#3263b9fe2c8823d191d28e61eac60a79f9ce8a0f" integrity sha512-riHpLb1drNkpLlocmSyEg4oYJIQFeXAK/d7rI6mbD0XsvoTOOweXDmQPG/ErxsEhWk3rl3Q/3F6RFQlVFS8m0A== @@ -1261,7 +1261,7 @@ "@babel/plugin-transform-react-jsx-development" "^7.22.5" "@babel/plugin-transform-react-pure-annotations" "^7.22.5" -"@babel/preset-typescript@^7.16.0", "@babel/preset-typescript@^7.7.7": +"@babel/preset-typescript@^7.16.0": version "7.22.5" resolved "https://registry.yarnpkg.com/@babel/preset-typescript/-/preset-typescript-7.22.5.tgz#16367d8b01d640e9a507577ed4ee54e0101e51c8" integrity sha512-YbPaal9LxztSGhmndR46FmAbkJ/1fAsw293tSU+I5E5h+cnJ3d4GTwyUgGYmOXJYdGA+uNePle4qbaRzj2NISQ== @@ -3110,7 +3110,7 @@ lodash "^4.17.15" redent "^3.0.0" -"@testing-library/react-hooks@8.0.1", "@testing-library/react-hooks@^8.0.1": +"@testing-library/react-hooks@8.0.1": version "8.0.1" resolved "https://registry.yarnpkg.com/@testing-library/react-hooks/-/react-hooks-8.0.1.tgz#0924bbd5b55e0c0c0502d1754657ada66947ca12" integrity sha512-Aqhl2IVmLt8IovEVarNDFuJDVWVvhnr9/GCU6UUnrYXwgDFF9h2L2o2P9KBni1AST5sT6riAyoukFLyjQUgD/g== @@ -3118,7 +3118,7 @@ "@babel/runtime" "^7.12.5" react-error-boundary "^3.1.0" -"@testing-library/react@^13.2.0", "@testing-library/react@^13.3.0": +"@testing-library/react@^13.2.0": version "13.4.0" resolved "https://registry.yarnpkg.com/@testing-library/react/-/react-13.4.0.tgz#6a31e3bf5951615593ad984e96b9e5e2d9380966" integrity sha512-sXOGON+WNTh3MLE9rve97ftaZukN3oNf2KjDy7YTx6hcTO2uuLHuCGynMDhFwGw/jYf4OJ2Qk0i4i79qMNNkyw== @@ -4185,7 +4185,7 @@ ajv-keywords@^5.1.0: dependencies: fast-deep-equal "^3.1.3" -ajv@^6.12.2, ajv@^6.12.3, ajv@^6.12.4, ajv@^6.12.5, ajv@^6.12.6: +ajv@^6.12.2, ajv@^6.12.4, ajv@^6.12.5, ajv@^6.12.6: version "6.12.6" resolved "https://registry.yarnpkg.com/ajv/-/ajv-6.12.6.tgz#baf5a62e802b07d977034586f8c3baf5adf26df4" integrity sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g== @@ -4454,18 +4454,6 @@ asap@~2.0.6: resolved "https://registry.yarnpkg.com/asap/-/asap-2.0.6.tgz#e50347611d7e690943208bbdafebcbc2fb866d46" integrity sha512-BSHWgDSAiKs50o2Re8ppvp3seVHXSRM44cdSsT9FfNEUUZLOGWVCsiWaRPWM1Znn+mqZ1OfVZ3z3DWEzSp7hRA== -asn1@~0.2.3: - version "0.2.6" - resolved "https://registry.yarnpkg.com/asn1/-/asn1-0.2.6.tgz#0d3a7bb6e64e02a90c0303b31f292868ea09a08d" - integrity sha512-ix/FxPn0MDjeyJ7i/yoHGFt/EX6LyNbxSEhPPXODPL+KB0VPk86UYfL0lMdy+KCnv+fmvIzySwaK5COwqVbWTQ== - dependencies: - safer-buffer "~2.1.0" - -assert-plus@1.0.0, assert-plus@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/assert-plus/-/assert-plus-1.0.0.tgz#f12e0f3c5d77b0b1cdd9146942e4e96c1e4dd525" - integrity sha512-NfJ4UzBCcQGLDlQq7nHxH+tv3kyZ0hHQqF5BO6J7tNJeP5do1llPr8dZ8zHonfhAu0PHAdMkSo+8o0wxg9lZWw== - assertion-error@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/assertion-error/-/assertion-error-1.1.0.tgz#e60b6b0e8f301bd97e5375215bda406c85118c0b" @@ -4515,16 +4503,6 @@ available-typed-arrays@^1.0.5: resolved "https://registry.yarnpkg.com/available-typed-arrays/-/available-typed-arrays-1.0.5.tgz#92f95616501069d07d10edb2fc37d3e1c65123b7" integrity sha512-DMD0KiN46eipeziST1LPP/STfDU0sufISXmjSgvVsoU2tqxctQeASejWcfNtxYKqETM1UxQ8sp2OrSBWpHY6sw== -aws-sign2@~0.7.0: - version "0.7.0" - resolved "https://registry.yarnpkg.com/aws-sign2/-/aws-sign2-0.7.0.tgz#b46e890934a9591f2d2f6f86d7e6a9f1b3fe76a8" - integrity sha512-08kcGqnYf/YmjoRhfxyu+CLxBjUtHLXLXX/vUfx9l2LYzG3c1m61nrpyFUZI6zeS+Li/wWMMidD9KgrqtGq3mA== - -aws4@^1.8.0: - version "1.12.0" - resolved "https://registry.yarnpkg.com/aws4/-/aws4-1.12.0.tgz#ce1c9d143389679e253b314241ea9aa5cec980d3" - integrity sha512-NmWvPnx0F1SfrQbYwOi7OeaNGokp9XhzNioJ/CSBs8Qa4vxug81mhJEAVZwxXuBmYB5KDRfMq/F3RR0BIU7sWg== - axe-core@^4.6.2: version "4.7.2" resolved "https://registry.yarnpkg.com/axe-core/-/axe-core-4.7.2.tgz#040a7342b20765cb18bb50b628394c21bccc17a0" @@ -4762,13 +4740,6 @@ batch@0.6.1: resolved "https://registry.yarnpkg.com/batch/-/batch-0.6.1.tgz#dc34314f4e679318093fc760272525f94bf25c16" integrity sha512-x+VAiMRL6UPkx+kudNvxTl6hB2XNNCG2r+7wixVfIYwu/2HKRXimwQyaumLjMveWvT2Hkd/cAJw+QBMfJ/EKVw== -bcrypt-pbkdf@^1.0.0: - version "1.0.2" - resolved "https://registry.yarnpkg.com/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz#a4301d389b6a43f9b67ff3ca11a3f6637e360e9e" - integrity sha512-qeFIXtP4MSoi6NLqO12WfqARWWuCKi2Rn/9hJLEmtB5yTNr9DqFWkJRCf2qShWzPeAMRnOgCrq0sg/KLv5ES9w== - dependencies: - tweetnacl "^0.14.3" - before-after-hook@^2.2.0: version "2.2.3" resolved "https://registry.yarnpkg.com/before-after-hook/-/before-after-hook-2.2.3.tgz#c51e809c81a4e354084422b9b26bad88249c517c" @@ -5047,11 +5018,6 @@ case-sensitive-paths-webpack-plugin@^2.4.0: resolved "https://registry.yarnpkg.com/case-sensitive-paths-webpack-plugin/-/case-sensitive-paths-webpack-plugin-2.4.0.tgz#db64066c6422eed2e08cc14b986ca43796dbc6d4" integrity sha512-roIFONhcxog0JSSWbvVAh3OocukmSgpqOH6YpMkCvav/ySIV3JKg4Dc8vYtQjYi/UxpNE36r/9v+VqTQqgkYmw== -caseless@~0.12.0: - version "0.12.0" - resolved "https://registry.yarnpkg.com/caseless/-/caseless-0.12.0.tgz#1b681c21ff84033c826543090689420d187151dc" - integrity sha512-4tYFyifaFfGacoiObjJegolkwSU4xQNGbVgUiNYVUxbQ2x2lUsFvY4hVgVzGiIe6WLOPqycWXA40l+PWsxthUw== - chai@^4.3.7: version "4.3.7" resolved "https://registry.yarnpkg.com/chai/-/chai-4.3.7.tgz#ec63f6df01829088e8bf55fca839bcd464a8ec51" @@ -5338,7 +5304,7 @@ columnify@1.6.0: strip-ansi "^6.0.1" wcwidth "^1.0.0" -combined-stream@^1.0.6, combined-stream@^1.0.8, combined-stream@~1.0.6: +combined-stream@^1.0.8: version "1.0.8" resolved "https://registry.yarnpkg.com/combined-stream/-/combined-stream-1.0.8.tgz#c3d45a8b34fd730631a110a8a2520682b31d5a7f" integrity sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg== @@ -5570,11 +5536,6 @@ core-js@^3.19.2: resolved "https://registry.yarnpkg.com/core-js/-/core-js-3.32.0.tgz#7643d353d899747ab1f8b03d2803b0312a0fb3b6" integrity sha512-rd4rYZNlF3WuoYuRIDEmbR/ga9CeuWX9U05umAvgrrZoHY4Z++cp/xwPQMvUpBB4Ag6J8KfD80G0zwCyaSxDww== -core-util-is@1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.2.tgz#b5fd54220aa2bc5ab57aab7140c940754503c1a7" - integrity sha512-3lqz5YjWTYnW6dlDa5TLaTCcShfar1e40rmcJVwCBJC6mWlFuj0eCHIElmG1g5kyuJ/GD+8Wn4FFCcz4gJPfaQ== - core-util-is@~1.0.0: version "1.0.3" resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.3.tgz#a6042d3634c2b27e9328f837b965fac83808db85" @@ -5612,17 +5573,6 @@ cosmiconfig@^8.2.0: parse-json "^5.0.0" path-type "^4.0.0" -coveralls@^3.0.9: - version "3.1.1" - resolved "https://registry.yarnpkg.com/coveralls/-/coveralls-3.1.1.tgz#f5d4431d8b5ae69c5079c8f8ca00d64ac77cf081" - integrity sha512-+dxnG2NHncSD1NrqbSM3dn/lE57O6Qf/koe9+I7c+wzkqRmEvcp0kgJdxKInzYzkICKkFMZsX3Vct3++tsF9ww== - dependencies: - js-yaml "^3.13.1" - lcov-parse "^1.0.0" - log-driver "^1.2.7" - minimist "^1.2.5" - request "^2.88.2" - create-jest@^29.7.0: version "29.7.0" resolved "https://registry.yarnpkg.com/create-jest/-/create-jest-29.7.0.tgz#a355c5b3cb1e1af02ba177fe7afd7feee49a5320" @@ -5867,13 +5817,6 @@ dargs@^7.0.0: resolved "https://registry.yarnpkg.com/dargs/-/dargs-7.0.0.tgz#04015c41de0bcb69ec84050f3d9be0caf8d6d5cc" integrity sha512-2iy1EkLdlBzQGvbweYRFxmFath8+K7+AKB0TlhHWkNuH+TmovaMH/Wp7V7R4u7f4SnX3OgLsU9t1NI9ioDnUpg== -dashdash@^1.12.0: - version "1.14.1" - resolved "https://registry.yarnpkg.com/dashdash/-/dashdash-1.14.1.tgz#853cfa0f7cbe2fed5de20326b8dd581035f6e2f0" - integrity sha512-jRFi8UDGo6j+odZiEpjazZaWqEal3w/basFjQHQEwVtZJGDpxbH1MeYluwCS8Xq5wmLJooDlMgvVarmWfGM44g== - dependencies: - assert-plus "^1.0.0" - data-urls@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/data-urls/-/data-urls-2.0.0.tgz#156485a72963a970f5d5821aaf642bef2bf2db9b" @@ -6254,14 +6197,6 @@ eastasianwidth@^0.2.0: resolved "https://registry.yarnpkg.com/eastasianwidth/-/eastasianwidth-0.2.0.tgz#696ce2ec0aa0e6ea93a397ffcf24aa7840c827cb" integrity sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA== -ecc-jsbn@~0.1.1: - version "0.1.2" - resolved "https://registry.yarnpkg.com/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz#3a83a904e54353287874c564b7549386849a98c9" - integrity sha512-eh9O+hwRHNbG4BLTjEl3nw044CkGm5X6LoaCf7LPp7UU8Qrt47JYNi6nPX8xjW97TKGKm1ouctg0QSpZe9qrnw== - dependencies: - jsbn "~0.1.0" - safer-buffer "^2.1.0" - ee-first@1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/ee-first/-/ee-first-1.1.1.tgz#590c61156b0ae2f4f0255732a158b266bc56b21d" @@ -7195,11 +7130,6 @@ express@^4.17.3: utils-merge "1.0.1" vary "~1.1.2" -extend@~3.0.2: - version "3.0.2" - resolved "https://registry.yarnpkg.com/extend/-/extend-3.0.2.tgz#f8b1136b4071fbd8eb140aff858b1019ec2915fa" - integrity sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g== - external-editor@^3.0.3: version "3.1.0" resolved "https://registry.yarnpkg.com/external-editor/-/external-editor-3.1.0.tgz#cb03f740befae03ea4d283caed2741a83f335495" @@ -7209,16 +7139,6 @@ external-editor@^3.0.3: iconv-lite "^0.4.24" tmp "^0.0.33" -extsprintf@1.3.0: - version "1.3.0" - resolved "https://registry.yarnpkg.com/extsprintf/-/extsprintf-1.3.0.tgz#96918440e3041a7a414f8c52e3c574eb3c3e1e05" - integrity sha512-11Ndz7Nv+mvAC1j0ktTa7fAb0vLyGGX+rMHNBYQviQDGU0Hw7lhctJANqbPhu9nV9/izT/IntTgZ7Im/9LJs9g== - -extsprintf@^1.2.0: - version "1.4.1" - resolved "https://registry.yarnpkg.com/extsprintf/-/extsprintf-1.4.1.tgz#8d172c064867f235c0c84a596806d279bf4bcc07" - integrity sha512-Wrk35e8ydCKDj/ArClo1VrPVmN8zph5V4AtHwIuHhvMXsKf73UT3BOD+azBIW+3wOJ4FhEH7zyaJCFvChjYvMA== - faker@*, faker@^6.6.6: version "6.6.6" resolved "https://registry.yarnpkg.com/faker/-/faker-6.6.6.tgz#e9529da0109dca4c7c5dbfeaadbd9234af943033" @@ -7479,11 +7399,6 @@ foreground-child@^3.1.0: cross-spawn "^7.0.0" signal-exit "^4.0.1" -forever-agent@~0.6.1: - version "0.6.1" - resolved "https://registry.yarnpkg.com/forever-agent/-/forever-agent-0.6.1.tgz#fbc71f0c41adeb37f96c577ad1ed42d8fdacca91" - integrity sha512-j0KLYPhm6zeac4lz3oJ3o65qvgQCcPubiyotZrXqEaG4hNagNYO8qdlUrX5vwqv9ohqeT/Z3j6+yW067yWWdUw== - fork-ts-checker-webpack-plugin@^6.5.0: version "6.5.3" resolved "https://registry.yarnpkg.com/fork-ts-checker-webpack-plugin/-/fork-ts-checker-webpack-plugin-6.5.3.tgz#eda2eff6e22476a2688d10661688c47f611b37f3" @@ -7521,15 +7436,6 @@ form-data@^4.0.0: combined-stream "^1.0.8" mime-types "^2.1.12" -form-data@~2.3.2: - version "2.3.3" - resolved "https://registry.yarnpkg.com/form-data/-/form-data-2.3.3.tgz#dcce52c05f644f298c6a7ab936bd724ceffbf3a6" - integrity sha512-1lLKB2Mu3aGP1Q/2eCOx0fNbRMe7XdwktwOruhfqqd0rIJWwN4Dh+E3hrPSlDCXnSR7UtZ1N38rVXm+6+MEhJQ== - dependencies: - asynckit "^0.4.0" - combined-stream "^1.0.6" - mime-types "^2.1.12" - forwarded@0.2.0: version "0.2.0" resolved "https://registry.yarnpkg.com/forwarded/-/forwarded-0.2.0.tgz#2269936428aad4c15c7ebe9779a84bf0b2a81811" @@ -7719,13 +7625,6 @@ get-symbol-description@^1.0.0: call-bind "^1.0.2" get-intrinsic "^1.1.1" -getpass@^0.1.1: - version "0.1.7" - resolved "https://registry.yarnpkg.com/getpass/-/getpass-0.1.7.tgz#5eff8e3e684d569ae4cb2b1282604e8ba62149fa" - integrity sha512-0fzj9JxOLfJ+XGLhR8ze3unN0KZCgZwiSSDz168VERjK8Wl8kVSdcu2kspd4s4wtAa1y/qrVRiAA0WclVsu0ng== - dependencies: - assert-plus "^1.0.0" - git-raw-commits@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/git-raw-commits/-/git-raw-commits-3.0.0.tgz#5432f053a9744f67e8db03dbc48add81252cfdeb" @@ -7956,19 +7855,6 @@ handlebars@^4.7.7: optionalDependencies: uglify-js "^3.1.4" -har-schema@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/har-schema/-/har-schema-2.0.0.tgz#a94c2224ebcac04782a0d9035521f24735b7ec92" - integrity sha512-Oqluz6zhGX8cyRaTQlFMPw80bSJVG2x/cFb8ZPhUILGgHka9SsokCCOQgpveePerqidZOrT14ipqfJb7ILcW5Q== - -har-validator@~5.1.3: - version "5.1.5" - resolved "https://registry.yarnpkg.com/har-validator/-/har-validator-5.1.5.tgz#1f0803b9f8cb20c0fa13822df1ecddb36bde1efd" - integrity sha512-nmT2T0lljbxdQZfspsno9hgrG3Uir6Ks5afism62poxqBM6sDnMEuPmzTq8XN0OEwqKLLdh1jQI3qyE66Nzb3w== - dependencies: - ajv "^6.12.3" - har-schema "^2.0.0" - hard-rejection@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/hard-rejection/-/hard-rejection-2.1.0.tgz#1c6eda5c1685c63942766d79bb40ae773cecd883" @@ -8208,15 +8094,6 @@ http-proxy@^1.18.1: follow-redirects "^1.0.0" requires-port "^1.0.0" -http-signature@~1.2.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/http-signature/-/http-signature-1.2.0.tgz#9aecd925114772f3d95b65a60abb8f7c18fbace1" - integrity sha512-CAbnr6Rz4CYQkLYUtSNXxQPUH2gK8f3iWexVlsnMeD+GjlsQ0Xsy1cOX+mN3dtxYomRy21CiOzU8Uhw6OwncEQ== - dependencies: - assert-plus "^1.0.0" - jsprim "^1.2.2" - sshpk "^1.7.0" - https-proxy-agent@^5.0.0: version "5.0.1" resolved "https://registry.yarnpkg.com/https-proxy-agent/-/https-proxy-agent-5.0.1.tgz#c59ef224a04fe8b754f3db0063a25ea30d0005d6" @@ -8732,7 +8609,7 @@ is-typed-array@^1.1.10, is-typed-array@^1.1.9: dependencies: which-typed-array "^1.1.11" -is-typedarray@^1.0.0, is-typedarray@~1.0.0: +is-typedarray@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/is-typedarray/-/is-typedarray-1.0.0.tgz#e479c80858df0c1b11ddda6940f96011fcda4a9a" integrity sha512-cyA56iCMHAh5CdzjJIa4aohJyeO1YbwLi3Jc35MmRU6poroFjIGZzUzupGiRPOjgHg9TLu43xbpwXk523fMxKA== @@ -8789,11 +8666,6 @@ isobject@^3.0.1: resolved "https://registry.yarnpkg.com/isobject/-/isobject-3.0.1.tgz#4e431e92b11a9731636aa1f9c8d1ccbcfdab78df" integrity sha512-WhB9zCku7EGTj/HQQRz5aUQEUeoQZH2bWcltRErOpymJ4boYE6wL9Tbr23krRPSZ+C5zqNSrSw+Cc7sZZ4b7vg== -isstream@~0.1.2: - version "0.1.2" - resolved "https://registry.yarnpkg.com/isstream/-/isstream-0.1.2.tgz#47e63f7af55afa6f92e1500e690eb8b8529c099a" - integrity sha512-Yljz7ffyPbrLpLngrMtZ7NduUgVvi6wG9RJ9IUcyCd59YQ911PBJphODUcbOVbqYfxe1wuYf/LJ8PauMRwsM/g== - istanbul-lib-coverage@^3.0.0, istanbul-lib-coverage@^3.2.0: version "3.2.0" resolved "https://registry.yarnpkg.com/istanbul-lib-coverage/-/istanbul-lib-coverage-3.2.0.tgz#189e7909d0a39fa5a3dfad5b03f71947770191d3" @@ -9794,11 +9666,6 @@ js-yaml@^3.10.0, js-yaml@^3.13.1: argparse "^1.0.7" esprima "^4.0.0" -jsbn@~0.1.0: - version "0.1.1" - resolved "https://registry.yarnpkg.com/jsbn/-/jsbn-0.1.1.tgz#a5e654c2e5a2deb5f201d96cefbca80c0ef2f513" - integrity sha512-UVU9dibq2JcFWxQPA6KCqj5O42VOmAY3zQUfEKxU0KpTGXwNoCjkX1e13eHNvw/xPynt6pU0rZ1htjWTNTSXsg== - jsdom@^16.6.0: version "16.7.0" resolved "https://registry.yarnpkg.com/jsdom/-/jsdom-16.7.0.tgz#918ae71965424b197c819f8183a754e18977b710" @@ -9867,7 +9734,7 @@ json-schema-traverse@^1.0.0: resolved "https://registry.yarnpkg.com/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz#ae7bcb3656ab77a73ba5c49bf654f38e6b6860e2" integrity sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug== -json-schema@0.4.0, json-schema@^0.4.0: +json-schema@^0.4.0: version "0.4.0" resolved "https://registry.yarnpkg.com/json-schema/-/json-schema-0.4.0.tgz#f7de4cf6efab838ebaeb3236474cbba5a1930ab5" integrity sha512-es94M3nTIfsEPisRafak+HDLfHXnKBhV3vU5eqPcS3flIWqcxJWgXHXiey3YrpaNsanY5ei1VoYEbOzijuq9BA== @@ -9877,7 +9744,7 @@ json-stable-stringify-without-jsonify@^1.0.1: resolved "https://registry.yarnpkg.com/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz#9db7b59496ad3f3cfef30a75142d2d930ad72651" integrity sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw== -json-stringify-safe@^5.0.1, json-stringify-safe@~5.0.1: +json-stringify-safe@^5.0.1: version "5.0.1" resolved "https://registry.yarnpkg.com/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz#1296a2d58fd45f19a0f6ce01d65701e2c735b6eb" integrity sha512-ZClg6AaYvamvYEE82d3Iyd3vSSIjQ+odgjaTzRuO3s7toCdFKczob2i0zCh7JE8kWn17yvAWhUVxvqGwUalsRA== @@ -9925,16 +9792,6 @@ jsonpointer@^5.0.0: resolved "https://registry.yarnpkg.com/jsonpointer/-/jsonpointer-5.0.1.tgz#2110e0af0900fd37467b5907ecd13a7884a1b559" integrity sha512-p/nXbhSEcu3pZRdkW1OfJhpsVtW1gd4Wa1fnQc9YLiTfAjn0312eMKimbdIQzuZl9aa9xUGaRlP9T/CJE/ditQ== -jsprim@^1.2.2: - version "1.4.2" - resolved "https://registry.yarnpkg.com/jsprim/-/jsprim-1.4.2.tgz#712c65533a15c878ba59e9ed5f0e26d5b77c5feb" - integrity sha512-P2bSOMAc/ciLz6DzgjVlGJP9+BrJWu5UDGK70C2iweC5QBIeFf0ZXRvGjEj2uYgrY2MkAAhsSWHDWlFtEroZWw== - dependencies: - assert-plus "1.0.0" - extsprintf "1.3.0" - json-schema "0.4.0" - verror "1.10.0" - "jsx-ast-utils@^2.4.1 || ^3.0.0", jsx-ast-utils@^3.3.3: version "3.3.5" resolved "https://registry.yarnpkg.com/jsx-ast-utils/-/jsx-ast-utils-3.3.5.tgz#4766bd05a8e2a11af222becd19e15575e52a853a" @@ -9980,11 +9837,6 @@ launch-editor@^2.6.0: picocolors "^1.0.0" shell-quote "^1.7.3" -lcov-parse@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/lcov-parse/-/lcov-parse-1.0.0.tgz#eb0d46b54111ebc561acb4c408ef9363bdc8f7e0" - integrity sha512-aprLII/vPzuQvYZnDRU78Fns9I2Ag3gi4Ipga/hxnVMCZC8DnR2nI7XBqrPoywGfxqIx/DgarGvDJZAD3YBTgQ== - lerna@^7.1.4: version "7.1.5" resolved "https://registry.yarnpkg.com/lerna/-/lerna-7.1.5.tgz#f65bde23d477382a221f9373f82d027825fa8622" @@ -10300,11 +10152,6 @@ lodash@^4.17.15, lodash@^4.17.20, lodash@^4.17.21, lodash@^4.7.0: resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c" integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg== -log-driver@^1.2.7: - version "1.2.7" - resolved "https://registry.yarnpkg.com/log-driver/-/log-driver-1.2.7.tgz#63b95021f0702fedfa2c9bb0a24e7797d71871d8" - integrity sha512-U7KCmLdqsGHBLeWqYlFA0V0Sl6P08EE1ZrmA9cxjUE0WVqT9qnyVDPz1kzpFEP0jdJuFnasWIfSd7fsaNXkpbg== - log-symbols@^4.1.0: version "4.1.0" resolved "https://registry.yarnpkg.com/log-symbols/-/log-symbols-4.1.0.tgz#3fbdbb95b4683ac9fc785111e792e558d4abd503" @@ -10549,7 +10396,7 @@ mime-db@1.52.0, "mime-db@>= 1.43.0 < 2": resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.52.0.tgz#bbabcdc02859f4987301c856e3387ce5ec43bf70" integrity sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg== -mime-types@^2.1.12, mime-types@^2.1.27, mime-types@^2.1.31, mime-types@~2.1.17, mime-types@~2.1.19, mime-types@~2.1.24, mime-types@~2.1.34: +mime-types@^2.1.12, mime-types@^2.1.27, mime-types@^2.1.31, mime-types@~2.1.17, mime-types@~2.1.24, mime-types@~2.1.34: version "2.1.35" resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.35.tgz#381a871b62a734450660ae3deee44813f70d959a" integrity sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw== @@ -11147,11 +10994,6 @@ nx@16.7.1, "nx@>=16.5.1 < 17": "@nx/nx-win32-arm64-msvc" "16.7.1" "@nx/nx-win32-x64-msvc" "16.7.1" -oauth-sign@~0.9.0: - version "0.9.0" - resolved "https://registry.yarnpkg.com/oauth-sign/-/oauth-sign-0.9.0.tgz#47a7b016baa68b5fa0ecf3dee08a85c679ac6455" - integrity sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ== - object-assign@^4.0.1, object-assign@^4.1.1: version "4.1.1" resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863" @@ -12383,7 +12225,7 @@ proxy-from-env@^1.1.0: resolved "https://registry.yarnpkg.com/proxy-from-env/-/proxy-from-env-1.1.0.tgz#e102f16ca355424865755d2c9e8ea4f24d58c3e2" integrity sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg== -psl@^1.1.28, psl@^1.1.33: +psl@^1.1.33: version "1.9.0" resolved "https://registry.yarnpkg.com/psl/-/psl-1.9.0.tgz#d0df2a137f00794565fcaf3b2c00cd09f8d5a5a7" integrity sha512-E/ZsdU4HLs/68gYzgGTkMicWTLPdAftJLfJFlLUAAKZGkStNU72sZjT66SnMDVOfOWY/YAoiD7Jxa9iHvngcag== @@ -12410,11 +12252,6 @@ qs@6.11.0: dependencies: side-channel "^1.0.4" -qs@~6.5.2: - version "6.5.3" - resolved "https://registry.yarnpkg.com/qs/-/qs-6.5.3.tgz#3aeeffc91967ef6e35c0e488ef46fb296ab76aad" - integrity sha512-qxXIEh4pCGfHICj1mAJQ2/2XVZkjCDTcEgfoSQxc/fYivUZxTkk7L3bDBJSoNrEzXI17oUO5Dp07ktqE5KzczA== - query-string@^7.0.1, query-string@^7.1.1: version "7.1.3" resolved "https://registry.yarnpkg.com/query-string/-/query-string-7.1.3.tgz#a1cf90e994abb113a325804a972d98276fe02328" @@ -12564,11 +12401,6 @@ react-hook-form@^7.49.3: resolved "https://registry.yarnpkg.com/react-hook-form/-/react-hook-form-7.51.5.tgz#4afbfb819312db9fea23e8237a3a0d097e128b43" integrity sha512-J2ILT5gWx1XUIJRETiA7M19iXHlG74+6O3KApzvqB/w8S5NQR7AbU8HVZrMALdmDgWpRPYiZJl0zx8Z4L2mP6Q== -"react-is@^16.12.0 || ^17.0.0 || ^18.0.0", react-is@^18.0.0, react-is@^18.2.0: - version "18.2.0" - resolved "https://registry.yarnpkg.com/react-is/-/react-is-18.2.0.tgz#199431eeaaa2e09f86427efbb4f1473edb47609b" - integrity sha512-xWGDIW6x921xtzPkhiULtthJHoJvBbF3q26fzloPCK0hsvxtPVelvftw3zjbHWSkR2km9Z+4uxbDDK/6Zw9B8w== - react-is@^16.13.1, react-is@^16.7.0: version "16.13.1" resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.13.1.tgz#789729a4dc36de2999dc156dd6c1d9c18cea56a4" @@ -12579,6 +12411,11 @@ react-is@^17.0.1: resolved "https://registry.yarnpkg.com/react-is/-/react-is-17.0.2.tgz#e691d4a8e9c789365655539ab372762b0efb54f0" integrity sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w== +react-is@^18.0.0: + version "18.2.0" + resolved "https://registry.yarnpkg.com/react-is/-/react-is-18.2.0.tgz#199431eeaaa2e09f86427efbb4f1473edb47609b" + integrity sha512-xWGDIW6x921xtzPkhiULtthJHoJvBbF3q26fzloPCK0hsvxtPVelvftw3zjbHWSkR2km9Z+4uxbDDK/6Zw9B8w== + react-native-device-info@^8.4.5: version "8.7.1" resolved "https://registry.yarnpkg.com/react-native-device-info/-/react-native-device-info-8.7.1.tgz#fbb06f87dbbc4423abe713874699fb2e6e99fd15" @@ -12679,23 +12516,6 @@ react-select@^5.4.0: react-transition-group "^4.3.0" use-isomorphic-layout-effect "^1.1.2" -react-shallow-renderer@^16.15.0: - version "16.15.0" - resolved "https://registry.yarnpkg.com/react-shallow-renderer/-/react-shallow-renderer-16.15.0.tgz#48fb2cf9b23d23cde96708fe5273a7d3446f4457" - integrity sha512-oScf2FqQ9LFVQgA73vr86xl2NaOIX73rh+YFqcOp68CWj56tSfgtGKrEbyhCj0rSijyG9M1CYprTh39fBi5hzA== - dependencies: - object-assign "^4.1.1" - react-is "^16.12.0 || ^17.0.0 || ^18.0.0" - -react-test-renderer@^18.2.0: - version "18.2.0" - resolved "https://registry.yarnpkg.com/react-test-renderer/-/react-test-renderer-18.2.0.tgz#1dd912bd908ff26da5b9fca4fd1c489b9523d37e" - integrity sha512-JWD+aQ0lh2gvh4NM3bBM42Kx+XybOxCpgYK7F8ugAlpaTSnWsX+39Z4XkOykGZAHrjwwTZT3x3KxswVWxHPUqA== - dependencies: - react-is "^18.2.0" - react-shallow-renderer "^16.15.0" - scheduler "^0.23.0" - react-toastify@*, react-toastify@^9.0.5: version "9.1.3" resolved "https://registry.yarnpkg.com/react-toastify/-/react-toastify-9.1.3.tgz#1e798d260d606f50e0fab5ee31daaae1d628c5ff" @@ -12713,7 +12533,7 @@ react-transition-group@^4.3.0: loose-envify "^1.4.0" prop-types "^15.6.2" -react@18.2.0, react@^18.2.0: +react@18.2.0: version "18.2.0" resolved "https://registry.yarnpkg.com/react/-/react-18.2.0.tgz#555bd98592883255fa00de14f1151a917b5d77d5" integrity sha512-/3IjMdb2L9QbBdWiW5e3P2/npwMBaU9mHCSCUzNln0ZCYbcfTsGbTJrU/kGemdH2IWmB2ioZ+zkxtmq6g09fGQ== @@ -12927,32 +12747,6 @@ renderkid@^3.0.0: lodash "^4.17.21" strip-ansi "^6.0.1" -request@^2.88.2: - version "2.88.2" - resolved "https://registry.yarnpkg.com/request/-/request-2.88.2.tgz#d73c918731cb5a87da047e207234146f664d12b3" - integrity sha512-MsvtOrfG9ZcrOwAW+Qi+F6HbD0CWXEh9ou77uOb7FM2WPhwT7smM833PzanhJLsgXjN89Ir6V2PczXNnMpwKhw== - dependencies: - aws-sign2 "~0.7.0" - aws4 "^1.8.0" - caseless "~0.12.0" - combined-stream "~1.0.6" - extend "~3.0.2" - forever-agent "~0.6.1" - form-data "~2.3.2" - har-validator "~5.1.3" - http-signature "~1.2.0" - is-typedarray "~1.0.0" - isstream "~0.1.2" - json-stringify-safe "~5.0.1" - mime-types "~2.1.19" - oauth-sign "~0.9.0" - performance-now "^2.1.0" - qs "~6.5.2" - safe-buffer "^5.1.2" - tough-cookie "~2.5.0" - tunnel-agent "^0.6.0" - uuid "^3.3.2" - require-directory@^2.1.1: version "2.1.1" resolved "https://registry.yarnpkg.com/require-directory/-/require-directory-2.1.1.tgz#8c64ad5fd30dab1c976e2344ffe7f792a6a6df42" @@ -13144,7 +12938,7 @@ safe-buffer@5.1.2, safe-buffer@~5.1.0, safe-buffer@~5.1.1: resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.2.tgz#991ec69d296e0313747d59bdfd2b745c35f8828d" integrity sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g== -safe-buffer@5.2.1, safe-buffer@>=5.1.0, safe-buffer@^5.0.1, safe-buffer@^5.1.0, safe-buffer@^5.1.2, safe-buffer@~5.2.0: +safe-buffer@5.2.1, safe-buffer@>=5.1.0, safe-buffer@^5.1.0, safe-buffer@~5.2.0: version "5.2.1" resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.2.1.tgz#1eaf9fa9bdb1fdd4ec75f58f9cdb4e6b7827eec6" integrity sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ== @@ -13158,7 +12952,7 @@ safe-regex-test@^1.0.0: get-intrinsic "^1.1.3" is-regex "^1.1.4" -"safer-buffer@>= 2.1.2 < 3", "safer-buffer@>= 2.1.2 < 3.0.0", safer-buffer@^2.0.2, safer-buffer@^2.1.0, safer-buffer@~2.1.0: +"safer-buffer@>= 2.1.2 < 3", "safer-buffer@>= 2.1.2 < 3.0.0": version "2.1.2" resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a" integrity sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg== @@ -13246,6 +13040,17 @@ schema-utils@^4.0.0: ajv-formats "^2.1.1" ajv-keywords "^5.1.0" +sdc-qrf@*: + version "0.3.1" + resolved "https://registry.yarnpkg.com/sdc-qrf/-/sdc-qrf-0.3.1.tgz#6cb1374a6fc913811d4efcdbba2c8c43567016d0" + integrity sha512-rxqhIzNutDoKH4SbhOsqV7PZ93c/NDlSBlUVeDEzq1Frb4Fgx8DK6b3jOJa8zu2C1KvlEpDp5OiViXpOLI4VlQ== + dependencies: + classnames "^2.3.1" + fhirpath "^3.5.0" + lodash "^4.17.15" + query-string "^7.1.1" + tslib "^2.4.0" + select-hose@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/select-hose/-/select-hose-2.0.0.tgz#625d8658f865af43ec962bfc376a37359a4994ca" @@ -13616,21 +13421,6 @@ sprintf-js@~1.0.2: resolved "https://registry.yarnpkg.com/sprintf-js/-/sprintf-js-1.0.3.tgz#04e6926f662895354f3dd015203633b857297e2c" integrity sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g== -sshpk@^1.7.0: - version "1.17.0" - resolved "https://registry.yarnpkg.com/sshpk/-/sshpk-1.17.0.tgz#578082d92d4fe612b13007496e543fa0fbcbe4c5" - integrity sha512-/9HIEs1ZXGhSPE8X6Ccm7Nam1z8KcoCqPdI7ecm1N33EzAetWahvQWVqLZtaZQ+IDKX4IyA2o0gBzqIMkAagHQ== - dependencies: - asn1 "~0.2.3" - assert-plus "^1.0.0" - bcrypt-pbkdf "^1.0.0" - dashdash "^1.12.0" - ecc-jsbn "~0.1.1" - getpass "^0.1.1" - jsbn "~0.1.0" - safer-buffer "^2.0.2" - tweetnacl "~0.14.0" - ssri@^10.0.0, ssri@^10.0.1: version "10.0.5" resolved "https://registry.yarnpkg.com/ssri/-/ssri-10.0.5.tgz#e49efcd6e36385196cb515d3a2ad6c3f0265ef8c" @@ -14249,14 +14039,6 @@ tough-cookie@^4.0.0: universalify "^0.2.0" url-parse "^1.5.3" -tough-cookie@~2.5.0: - version "2.5.0" - resolved "https://registry.yarnpkg.com/tough-cookie/-/tough-cookie-2.5.0.tgz#cd9fb2a0aa1d5a12b473bd9fb96fa3dcff65ade2" - integrity sha512-nlLsUzgm1kfLXSXfRZMc1KLAugd4hqJHDTvc2hDIwS3mZAfMEuMbc03SujMF+GEcpaX/qboeycw6iO8JwVv2+g== - dependencies: - psl "^1.1.28" - punycode "^2.1.1" - tr46@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/tr46/-/tr46-1.0.1.tgz#a8b13fd6bfd2489519674ccde55ba3693b706d09" @@ -14369,18 +14151,6 @@ tuf-js@^1.1.7: debug "^4.3.4" make-fetch-happen "^11.1.1" -tunnel-agent@^0.6.0: - version "0.6.0" - resolved "https://registry.yarnpkg.com/tunnel-agent/-/tunnel-agent-0.6.0.tgz#27a5dea06b36b04a0a9966774b290868f0fc40fd" - integrity sha512-McnNiV1l8RYeY8tBgEpuodCC1mLUdbSN+CYBL7kJsJNInOP8UjDDEwdk6Mw60vdLLrr5NHKZhMAOSrR2NZuQ+w== - dependencies: - safe-buffer "^5.0.1" - -tweetnacl@^0.14.3, tweetnacl@~0.14.0: - version "0.14.5" - resolved "https://registry.yarnpkg.com/tweetnacl/-/tweetnacl-0.14.5.tgz#5ae68177f192d4456269d108afa93ff8743f4f64" - integrity sha512-KXXFFdAbFXY4geFIwoyNK+f5Z1b7swfXABfL7HXCmoIWMKU3dmS26672A4EeQtDzLKy7SXmfBu51JolvEKwtGA== - type-check@^0.4.0, type-check@~0.4.0: version "0.4.0" resolved "https://registry.yarnpkg.com/type-check/-/type-check-0.4.0.tgz#07b8203bfa7056c0657050e3ccd2c37730bab8f1" @@ -14657,11 +14427,6 @@ utils-merge@1.0.1: resolved "https://registry.yarnpkg.com/utils-merge/-/utils-merge-1.0.1.tgz#9f95710f50a267947b2ccc124741c1028427e713" integrity sha512-pMZTvIkT1d+TFGvDOqodOclx0QWkkgi6Tdoa8gC8ffGAAqz9pzPTZWAybbsHHoED/ztMtkv/VoYTYyShUn81hA== -uuid@^3.3.2: - version "3.4.0" - resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.4.0.tgz#b23e4358afa8a202fe7a100af1f5f883f02007ee" - integrity sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A== - uuid@^8.3.2: version "8.3.2" resolved "https://registry.yarnpkg.com/uuid/-/uuid-8.3.2.tgz#80d5b5ced271bb9af6c445f21a1a04c606cefbe2" @@ -14722,15 +14487,6 @@ vary@~1.1.2: resolved "https://registry.yarnpkg.com/vary/-/vary-1.1.2.tgz#2299f02c6ded30d4a5961b0b9f74524a18f634fc" integrity sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg== -verror@1.10.0: - version "1.10.0" - resolved "https://registry.yarnpkg.com/verror/-/verror-1.10.0.tgz#3a105ca17053af55d6e270c1f8288682e18da400" - integrity sha512-ZZKSmDAEFOijERBLkmYfJ+vmk3w+7hOLYDNkRCuRuMJGEmqYNCNLyBBFwWKVMhfwaEF3WOd0Zlw86U/WC/+nYw== - dependencies: - assert-plus "^1.0.0" - core-util-is "1.0.2" - extsprintf "^1.2.0" - vite-node@0.33.0: version "0.33.0" resolved "https://registry.yarnpkg.com/vite-node/-/vite-node-0.33.0.tgz#c6a3a527e0b8090da7436241bc875760ae0eef28" From 7d9bc32bbb186f16877567bf6095c7a1b63e25c4 Mon Sep 17 00:00:00 2001 From: Pavel R Date: Fri, 31 May 2024 13:56:48 +0200 Subject: [PATCH 03/12] WIP: Remove react-final-form from QRFormWrapper Ref: https://github.com/beda-software/sdc-ide/issues/66 --- .../components/choice/hook.ts | 5 +- .../components/choice/index.tsx | 45 +++---- .../components/choice/select.tsx | 14 +- .../components/decimal.tsx | 31 ++--- .../components/reference/index.tsx | 49 +++---- .../components/string.tsx | 31 ++--- .../BaseQuestionnaireResponseForm/index.tsx | 121 +++++++++++++++--- web/src/components/QRFormWrapper/index.tsx | 60 +++++++-- 8 files changed, 247 insertions(+), 109 deletions(-) diff --git a/web/src/components/BaseQuestionnaireResponseForm/components/choice/hook.ts b/web/src/components/BaseQuestionnaireResponseForm/components/choice/hook.ts index 60a2ad7b..ef6b1454 100644 --- a/web/src/components/BaseQuestionnaireResponseForm/components/choice/hook.ts +++ b/web/src/components/BaseQuestionnaireResponseForm/components/choice/hook.ts @@ -1,7 +1,7 @@ import { AnswerValue, QuestionItemProps } from '@beda.software/fhir-questionnaire/vendor/sdc-qrf'; import _ from 'lodash'; -import { isSuccess, RemoteDataResult, success } from 'aidbox-react/lib/libs/remoteData'; +import { RemoteDataResult, isSuccess, success } from 'aidbox-react/lib/libs/remoteData'; import { applyDataTransformer, service } from 'aidbox-react/lib/services/service'; import { @@ -10,6 +10,7 @@ import { ValueSet, } from 'shared/src/contrib/aidbox'; + export function getDisplay(value: AnswerValue): string { const valueType = _.keys(value)[0]; //@ts-ignore @@ -104,5 +105,5 @@ export function useAnswerChoice({ questionItem, parentPath }: QuestionItemProps) const deps = [linkId]; - return { fieldName, loadOptions, validate, deps }; + return { fieldName, loadOptions, validate, deps, fieldPath }; } diff --git a/web/src/components/BaseQuestionnaireResponseForm/components/choice/index.tsx b/web/src/components/BaseQuestionnaireResponseForm/components/choice/index.tsx index 0d88a300..7ea2b685 100644 --- a/web/src/components/BaseQuestionnaireResponseForm/components/choice/index.tsx +++ b/web/src/components/BaseQuestionnaireResponseForm/components/choice/index.tsx @@ -1,3 +1,4 @@ +import { useFieldController } from '@beda.software/fhir-questionnaire/components/QuestionnaireResponseForm'; import { QuestionItemProps, useQuestionnaireResponseFormContext, @@ -13,9 +14,13 @@ import { QuestionLabel } from '../label'; export function QuestionChoice(props: QuestionItemProps) { const { questionItem } = props; - const { fieldName, loadOptions, validate, deps } = useAnswerChoice(props); + const { fieldName, loadOptions, validate, deps, fieldPath } = useAnswerChoice(props); const { text, repeats, readOnly, hidden, linkId } = questionItem; const qrfContext = useQuestionnaireResponseFormContext(); + const { value, onChange, disabled, formItem, onBlur } = useFieldController( + fieldPath, + questionItem, + ); if (hidden) { return null; @@ -24,26 +29,22 @@ export function QuestionChoice(props: QuestionItemProps) { const fieldProps = { validate }; return ( - - {({ input }) => { - return ( - <> - - - key={`answer-choice-${deps.join('-')}`} - data-testid={`choice-${linkId}`} - id={fieldName} - input={input} - label={text} - loadOptions={loadOptions} - isMulti={!!repeats} - getOptionLabel={(option) => getAnswerDisplay(option.value)} - getOptionValue={(option) => getAnswerCode(option.value)} - readOnly={qrfContext.readOnly || readOnly} - /> - - ); - }} - + <> + + + key={`answer-choice-${deps.join('-')}`} + data-testid={`choice-${linkId}`} + id={fieldName} + onChange={onChange} + value={value} + // input={input} + label={text} + loadOptions={loadOptions} + isMulti={!!repeats} + getOptionLabel={(option) => getAnswerDisplay(option.value)} + getOptionValue={(option) => getAnswerCode(option.value)} + readOnly={qrfContext.readOnly || readOnly} + /> + ); } diff --git a/web/src/components/BaseQuestionnaireResponseForm/components/choice/select.tsx b/web/src/components/BaseQuestionnaireResponseForm/components/choice/select.tsx index d3a5cdd6..95a54f14 100644 --- a/web/src/components/BaseQuestionnaireResponseForm/components/choice/select.tsx +++ b/web/src/components/BaseQuestionnaireResponseForm/components/choice/select.tsx @@ -1,15 +1,14 @@ +import { QuestionnaireResponseItemAnswer } from 'fhir/r4b'; import _ from 'lodash'; -// eslint-disable-next-line import/named -import { FieldInputProps } from 'react-final-form'; import { ActionMeta, PropsValue } from 'react-select'; import { AsyncSelect } from 'web/src/components/Select'; +// eslint-disable-next-line import/named interface Props { label?: string; id?: string; placeholder?: string; helpText?: string; - input: FieldInputProps; formItemProps?: any; loadOptions: (searchText: string) => Promise; readOnly?: boolean; @@ -18,12 +17,12 @@ interface Props { getOptionValue: (option: T) => string; isMulti?: boolean; testId?: string; + value?: QuestionnaireResponseItemAnswer[]; } export function AsyncSelectField(props: Props) { const { readOnly, - input, id, placeholder = 'Select...', getOptionLabel, @@ -31,6 +30,7 @@ export function AsyncSelectField(props: Props) { onChange, isMulti, loadOptions, + value, } = props; const debouncedLoadOptions = _.debounce( @@ -42,6 +42,7 @@ export function AsyncSelectField(props: Props) { return ( (props: Props) { getOptionLabel={getOptionLabel} getOptionValue={getOptionValue} id={id} - {...input} onChange={(value, action) => { - input.onChange(value ?? undefined); + // onChange(value ?? undefined); if (onChange) { onChange(value, action); } }} isMulti={isMulti} - styles={{ menuPortal: (base) => ({ ...base, zIndex: 9999 }) }} + // styles={{ menuPortal: (base) => ({ ...base, zIndex: 9999 }) }} menuPortalTarget={document.body} /> ); diff --git a/web/src/components/BaseQuestionnaireResponseForm/components/decimal.tsx b/web/src/components/BaseQuestionnaireResponseForm/components/decimal.tsx index e2c4b75d..86af3b35 100644 --- a/web/src/components/BaseQuestionnaireResponseForm/components/decimal.tsx +++ b/web/src/components/BaseQuestionnaireResponseForm/components/decimal.tsx @@ -1,3 +1,4 @@ +import { useFieldController } from '@beda.software/fhir-questionnaire/components/QuestionnaireResponseForm'; import { QuestionItemProps, useQuestionnaireResponseFormContext, @@ -11,22 +12,22 @@ export function QuestionDecimal({ parentPath, questionItem }: QuestionItemProps) const { linkId, readOnly, hidden } = questionItem; const fieldPath = [...parentPath, linkId, 0, 'value', 'decimal']; const fieldName = fieldPath.join('.'); + const { value, onChange, disabled, formItem, onBlur } = useFieldController( + fieldPath, + questionItem, + ); return ( - - {({ input, meta }) => ( - <> - - input.onChange(parseInt(e.target.value))} - /> - {meta.touched && meta.error && {meta.error}} - - )} - + <> + + onChange(Number(e.target.value))} + /> + ); } diff --git a/web/src/components/BaseQuestionnaireResponseForm/components/reference/index.tsx b/web/src/components/BaseQuestionnaireResponseForm/components/reference/index.tsx index b590b265..4ee4bb1c 100644 --- a/web/src/components/BaseQuestionnaireResponseForm/components/reference/index.tsx +++ b/web/src/components/BaseQuestionnaireResponseForm/components/reference/index.tsx @@ -1,3 +1,4 @@ +import { useFieldController } from '@beda.software/fhir-questionnaire/components/QuestionnaireResponseForm'; import { useQuestionnaireResponseFormContext } from '@beda.software/fhir-questionnaire/vendor/sdc-qrf'; import { getAnswerCode, getAnswerDisplay } from 'web/src/utils/questionnaire'; @@ -8,43 +9,43 @@ import { AsyncSelectField } from '../choice/select'; import { QuestionField } from '../field'; import { QuestionLabel } from '../label'; + function QuestionReferenceUnsafe( props: AnswerReferenceProps, ) { const { questionItem, parentPath } = props; - const { loadOptions, onChange, deps, validate } = useAnswerReference(props); + const { loadOptions, deps, validate } = useAnswerReference(props); const { text, repeats, linkId, helpText, readOnly } = questionItem; const qrfContext = useQuestionnaireResponseFormContext(); const fieldPath = [...parentPath, questionItem.linkId!]; const fieldName = fieldPath.join('.'); + const { value, onChange, disabled, formItem, onBlur } = useFieldController( + fieldPath, + questionItem, + ); + const fieldProps = { validate }; return ( - - {({ input }) => { - return ( - <> - - - key={`answer-choice-${deps.join('-')}`} - input={input} - id={fieldName} - testId={linkId!} - label={text} - loadOptions={loadOptions} - isMulti={!!repeats} - getOptionLabel={(option) => getAnswerDisplay(option.value)} - getOptionValue={(option) => getAnswerCode(option.value)} - onChange={onChange} - readOnly={qrfContext.readOnly || readOnly} - helpText={helpText} - /> - - ); - }} - + <> + + + key={`answer-choice-${deps.join('-')}`} + value={value} + id={fieldName} + testId={linkId!} + label={text} + loadOptions={loadOptions} + isMulti={!!repeats} + getOptionLabel={(option) => getAnswerDisplay(option.value)} + getOptionValue={(option) => getAnswerCode(option.value)} + onChange={onChange} + readOnly={qrfContext.readOnly || readOnly} + helpText={helpText} + /> + ); } diff --git a/web/src/components/BaseQuestionnaireResponseForm/components/string.tsx b/web/src/components/BaseQuestionnaireResponseForm/components/string.tsx index a099ba6c..8f331fed 100644 --- a/web/src/components/BaseQuestionnaireResponseForm/components/string.tsx +++ b/web/src/components/BaseQuestionnaireResponseForm/components/string.tsx @@ -1,3 +1,4 @@ +import { useFieldController } from '@beda.software/fhir-questionnaire/components/QuestionnaireResponseForm'; import { QuestionItemProps, useQuestionnaireResponseFormContext, @@ -11,21 +12,21 @@ export function QuestionString({ parentPath, questionItem }: QuestionItemProps) const { linkId, readOnly, hidden } = questionItem; const fieldPath = [...parentPath, linkId, 0, 'value', 'string']; const fieldName = fieldPath.join('.'); - + const { value, onChange, disabled, formItem, onBlur } = useFieldController( + fieldPath, + questionItem, + ); return ( - - {({ input, meta }) => ( - <> - - - {meta.touched && meta.error && {meta.error}} - - )} - + <> + + onChange(e.target.value)} + /> + ); } diff --git a/web/src/components/BaseQuestionnaireResponseForm/index.tsx b/web/src/components/BaseQuestionnaireResponseForm/index.tsx index d391eb89..832774ca 100644 --- a/web/src/components/BaseQuestionnaireResponseForm/index.tsx +++ b/web/src/components/BaseQuestionnaireResponseForm/index.tsx @@ -1,4 +1,5 @@ import { + FormWrapperProps, QuestionnaireResponseForm, questionnaireIdWOAssembleLoader, } from '@beda.software/fhir-questionnaire'; @@ -7,6 +8,7 @@ import { ParametersParameter } from '@beda.software/fhir-questionnaire/contrib/a import { FormItems, QuestionnaireResponseFormData, + QuestionnaireResponseFormProvider, } from '@beda.software/fhir-questionnaire/vendor/sdc-qrf'; import { QuestionnaireResponse } from 'fhir/r4b'; import _ from 'lodash'; @@ -15,8 +17,8 @@ import { Form, FormSpy } from 'react-final-form'; import { Col, - Group, GTable, + Group, QuestionBoolean, QuestionChoice, QuestionDate, @@ -30,6 +32,7 @@ import { QuestionInteger } from './components/integer'; import { QuestionReference } from './components/reference'; import s from './QuestionnaireResponseForm.module.scss'; + interface Props { formData: QuestionnaireResponseFormData; onSubmit: (formData: QuestionnaireResponseFormData) => Promise; @@ -88,26 +91,112 @@ export function BaseQuestionnaireResponseForm({ }} readOnly={readOnly} FormWrapper={({ handleSubmit, items }) => ( -
onSubmit({ ...formData, formValues: values })} - initialValues={formData.formValues} - render={({ handleSubmit, values, form }) => ( - - { - return onFormChange(formState.values); - }} - /> - {items} - - )} + )} - ItemWrapper={({ children }) => <>{children}} groupItemComponent={Group} widgetsByGroupQuestionItemControl={{ col: Col, row: Row, gtable: GTable }} autosave /> ); } + +interface BaseFormProps extends FormWrapperProps { + formData: QuestionnaireResponseFormData; + onSubmit: (formData: QuestionnaireResponseFormData) => Promise; + onFormChange: (values: FormItems) => void; +} + +function BaseForm(props: BaseFormProps) { + const { handleSubmit, items, formData, onSubmit, onFormChange } = props; + + return ( +
onSubmit({ ...formData, formValues: values })} + initialValues={formData.formValues} + render={({ handleSubmit }) => ( + + { + return onFormChange(formState.values); + }} + /> + {items} + + )} + /> + ); +} + +// interface Props { +// formData: QuestionnaireResponseFormData; +// onSubmit: (formData: QuestionnaireResponseFormData) => Promise; +// readOnly?: boolean; +// onChange?: (data: QuestionnaireResponseFormData) => any; +// } + +// type FormValues = FormItems; + +// export function BaseQuestionnaireResponseForm({ formData, onSubmit, readOnly, onChange }: Props) { +// const previousValues = useRef(null); + +// const onFormChange = (values: FormValues) => { +// if (_.isEqual(values, previousValues.current)) { +// return; +// } + +// onChange?.({ ...formData, formValues: values }); + +// previousValues.current = values; +// }; + +// return ( +//
onSubmit({ ...formData, formValues: values })} +// initialValues={formData.formValues} +// render={({ handleSubmit, values, form }) => ( +// +// { +// return onFormChange(formState.values); +// }} +// /> +// form.change('', newValues)} +// groupItemComponent={Group} +// itemControlGroupItemComponents={{ col: Col, row: Row, gtable: GTable }} +// questionItemComponents={{ +// date: QuestionDate, +// dateTime: QuestionDateTime, +// string: QuestionString, +// text: QuestionString, +// choice: QuestionChoice, +// boolean: QuestionBoolean, +// display: QuestionDisplay, +// decimal: QuestionDecimal, +// reference: QuestionReference, +// integer: QuestionInteger, +// }} +// readOnly={readOnly} +// > +// <> +// +// +// +// +// )} +// /> +// ); +// } diff --git a/web/src/components/QRFormWrapper/index.tsx b/web/src/components/QRFormWrapper/index.tsx index a892fe83..b9b899c6 100644 --- a/web/src/components/QRFormWrapper/index.tsx +++ b/web/src/components/QRFormWrapper/index.tsx @@ -1,3 +1,4 @@ +import { BaseQuestionnaireResponseForm } from '@beda.software/fhir-questionnaire/components/QuestionnaireResponseForm/BaseQuestionnaireResponseForm'; import { fromFirstClassExtension, mapFormToResponse, @@ -11,8 +12,8 @@ import { } from 'fhir/r4b'; import _ from 'lodash'; import { useCallback } from 'react'; +import { useFormContext } from 'react-hook-form'; import { RenderRemoteData } from 'web/src/components/RenderRemoteData'; -import { useFHIRServiceProvider } from 'web/src/services/fhir'; import { RemoteData } from 'fhir-react/lib/libs/remoteData'; import { sequenceMap } from 'fhir-react/lib/services/service'; @@ -20,7 +21,23 @@ import { formatError } from 'fhir-react/lib/utils/error'; import { QuestionnaireResponse as FCEQuestionnaireResponse } from 'shared/src/contrib/aidbox'; -import { BaseQuestionnaireResponseForm } from '../BaseQuestionnaireResponseForm'; +import { + Col, + GTable, + Group, + QuestionBoolean, + QuestionChoice, + QuestionDate, + QuestionDateTime, + QuestionDecimal, + QuestionDisplay, + QuestionString, + Row, +} from '../BaseQuestionnaireResponseForm/components'; +import { QuestionInteger } from '../BaseQuestionnaireResponseForm/components/integer'; +import { QuestionReference } from '../BaseQuestionnaireResponseForm/components/reference'; +import s from '../BaseQuestionnaireResponseForm/QuestionnaireResponseForm.module.scss'; + interface QRFormWrapperProps { questionnaireRD: RemoteData; @@ -39,11 +56,9 @@ export function QRFormWrapper({ const onChange = useCallback(_.debounce(saveQuestionnaireResponse, 1000), [ saveQuestionnaireResponse, ]); - const serviceProvider = useFHIRServiceProvider(); const remoteDataResult = sequenceMap({ questionnaireRD, questionnaireResponseRD, - serviceProvider, }); return ( @@ -56,7 +71,6 @@ export function QRFormWrapper({ {(data) => ( {}} - onChange={(newFormData) => { + widgetsByQuestionType={{ + // date: QuestionDate, + // dateTime: QuestionDateTime, + string: QuestionString, + // text: QuestionString, + // choice: QuestionChoice, + // boolean: QuestionBoolean, + // display: QuestionDisplay, + decimal: QuestionDecimal, + // reference: QuestionReference, + // integer: QuestionInteger, + }} + widgetsByQuestionItemControl={{ + 'inline-choice': QuestionChoice, + }} + onSubmit={(newFormData) => { const fceQR: FCEQuestionnaireResponse = { ...toFirstClassExtension(data.questionnaireResponseRD), ...mapFormToResponse(newFormData.formValues, data.questionnaireRD), }; onChange(fromFirstClassExtension(fceQR)); }} + groupItemComponent={Group} + widgetsByGroupQuestionItemControl={{ col: Col, row: Row, gtable: GTable }} + FormWrapper={FormWrapper} /> )}
); } + +function FormWrapper({ handleSubmit, items }: { handleSubmit: any; items: any }) { + const { watch } = useFormContext(); + + watch(() => { + handleSubmit(); + }); + + return ( +
+ {items} +
+ ); +} From 94bec4230809579f9992abc20736cb0ef04c27e8 Mon Sep 17 00:00:00 2001 From: Pavel R Date: Fri, 31 May 2024 14:08:47 +0200 Subject: [PATCH 04/12] Rename BaseQuestionnaireResponseForm component (prev) Ref https://github.com/beda-software/sdc-ide/issues/66 --- .../BaseQuestionnaireResponseForm/index.tsx | 202 ------------------ .../QuestionnaireResponseForm.module.scss | 0 .../boolean/BooleanField.module.scss | 0 .../components/boolean/index.tsx | 0 .../components/choice/hook.ts | 1 - .../components/choice/index.tsx | 0 .../components/choice/select.tsx | 0 .../components/date.tsx | 0 .../components/decimal.tsx | 0 .../components/display.tsx | 0 .../components/field.tsx | 0 .../group/GTable/GTable.module.scss | 0 .../components/group/GTable/index.tsx | 0 .../components/group/Group.module.scss | 0 .../RepeatableGroups.module.scss | 0 .../group/RepeatableGroups/index.tsx | 0 .../components/group/context.ts | 0 .../components/group/flex.tsx | 0 .../components/group/index.tsx | 0 .../components/group/label.tsx | 0 .../components/index.ts | 0 .../components/integer.tsx | 0 .../components/label.tsx | 0 .../components/questionItems.tsx | 0 .../components/reference/hooks.ts | 0 .../components/reference/index.tsx | 1 - .../components/string.tsx | 0 web/src/components/QRFormWrapper/index.tsx | 9 +- .../containers/Main/MappingEditor/index.tsx | 2 +- web/src/containers/Main/PromptForm/index.tsx | 2 +- .../Main/QuestionnaireEditor/index.tsx | 2 +- 31 files changed, 7 insertions(+), 212 deletions(-) delete mode 100644 web/src/components/BaseQuestionnaireResponseForm/index.tsx rename web/src/components/{BaseQuestionnaireResponseForm => QRFormWrapper}/QuestionnaireResponseForm.module.scss (100%) rename web/src/components/{BaseQuestionnaireResponseForm => QRFormWrapper}/components/boolean/BooleanField.module.scss (100%) rename web/src/components/{BaseQuestionnaireResponseForm => QRFormWrapper}/components/boolean/index.tsx (100%) rename web/src/components/{BaseQuestionnaireResponseForm => QRFormWrapper}/components/choice/hook.ts (99%) rename web/src/components/{BaseQuestionnaireResponseForm => QRFormWrapper}/components/choice/index.tsx (100%) rename web/src/components/{BaseQuestionnaireResponseForm => QRFormWrapper}/components/choice/select.tsx (100%) rename web/src/components/{BaseQuestionnaireResponseForm => QRFormWrapper}/components/date.tsx (100%) rename web/src/components/{BaseQuestionnaireResponseForm => QRFormWrapper}/components/decimal.tsx (100%) rename web/src/components/{BaseQuestionnaireResponseForm => QRFormWrapper}/components/display.tsx (100%) rename web/src/components/{BaseQuestionnaireResponseForm => QRFormWrapper}/components/field.tsx (100%) rename web/src/components/{BaseQuestionnaireResponseForm => QRFormWrapper}/components/group/GTable/GTable.module.scss (100%) rename web/src/components/{BaseQuestionnaireResponseForm => QRFormWrapper}/components/group/GTable/index.tsx (100%) rename web/src/components/{BaseQuestionnaireResponseForm => QRFormWrapper}/components/group/Group.module.scss (100%) rename web/src/components/{BaseQuestionnaireResponseForm => QRFormWrapper}/components/group/RepeatableGroups/RepeatableGroups.module.scss (100%) rename web/src/components/{BaseQuestionnaireResponseForm => QRFormWrapper}/components/group/RepeatableGroups/index.tsx (100%) rename web/src/components/{BaseQuestionnaireResponseForm => QRFormWrapper}/components/group/context.ts (100%) rename web/src/components/{BaseQuestionnaireResponseForm => QRFormWrapper}/components/group/flex.tsx (100%) rename web/src/components/{BaseQuestionnaireResponseForm => QRFormWrapper}/components/group/index.tsx (100%) rename web/src/components/{BaseQuestionnaireResponseForm => QRFormWrapper}/components/group/label.tsx (100%) rename web/src/components/{BaseQuestionnaireResponseForm => QRFormWrapper}/components/index.ts (100%) rename web/src/components/{BaseQuestionnaireResponseForm => QRFormWrapper}/components/integer.tsx (100%) rename web/src/components/{BaseQuestionnaireResponseForm => QRFormWrapper}/components/label.tsx (100%) rename web/src/components/{BaseQuestionnaireResponseForm => QRFormWrapper}/components/questionItems.tsx (100%) rename web/src/components/{BaseQuestionnaireResponseForm => QRFormWrapper}/components/reference/hooks.ts (100%) rename web/src/components/{BaseQuestionnaireResponseForm => QRFormWrapper}/components/reference/index.tsx (99%) rename web/src/components/{BaseQuestionnaireResponseForm => QRFormWrapper}/components/string.tsx (100%) diff --git a/web/src/components/BaseQuestionnaireResponseForm/index.tsx b/web/src/components/BaseQuestionnaireResponseForm/index.tsx deleted file mode 100644 index 832774ca..00000000 --- a/web/src/components/BaseQuestionnaireResponseForm/index.tsx +++ /dev/null @@ -1,202 +0,0 @@ -import { - FormWrapperProps, - QuestionnaireResponseForm, - questionnaireIdWOAssembleLoader, -} from '@beda.software/fhir-questionnaire'; -import { QuestionnaireResponseFormProps } from '@beda.software/fhir-questionnaire/components/QuestionnaireResponseForm/questionnaire-response-form-data'; -import { ParametersParameter } from '@beda.software/fhir-questionnaire/contrib/aidbox'; -import { - FormItems, - QuestionnaireResponseFormData, - QuestionnaireResponseFormProvider, -} from '@beda.software/fhir-questionnaire/vendor/sdc-qrf'; -import { QuestionnaireResponse } from 'fhir/r4b'; -import _ from 'lodash'; -import { useRef } from 'react'; -import { Form, FormSpy } from 'react-final-form'; - -import { - Col, - GTable, - Group, - QuestionBoolean, - QuestionChoice, - QuestionDate, - QuestionDateTime, - QuestionDecimal, - QuestionDisplay, - QuestionString, - Row, -} from './components'; -import { QuestionInteger } from './components/integer'; -import { QuestionReference } from './components/reference'; -import s from './QuestionnaireResponseForm.module.scss'; - - -interface Props { - formData: QuestionnaireResponseFormData; - onSubmit: (formData: QuestionnaireResponseFormData) => Promise; - serviceProvider: QuestionnaireResponseFormProps['serviceProvider']; - readOnly?: boolean; - onChange?: (data: QuestionnaireResponseFormData) => any; -} - -type FormValues = FormItems; - -export function BaseQuestionnaireResponseForm({ - formData, - onSubmit, - readOnly, - onChange, - serviceProvider, -}: Props) { - const previousValues = useRef(null); - - const onFormChange = (values: FormValues) => { - if (_.isEqual(values, previousValues.current)) { - return; - } - - onChange?.({ ...formData, formValues: values }); - - previousValues.current = values; - }; - - return ( - ( - - )} - groupItemComponent={Group} - widgetsByGroupQuestionItemControl={{ col: Col, row: Row, gtable: GTable }} - autosave - /> - ); -} - -interface BaseFormProps extends FormWrapperProps { - formData: QuestionnaireResponseFormData; - onSubmit: (formData: QuestionnaireResponseFormData) => Promise; - onFormChange: (values: FormItems) => void; -} - -function BaseForm(props: BaseFormProps) { - const { handleSubmit, items, formData, onSubmit, onFormChange } = props; - - return ( -
onSubmit({ ...formData, formValues: values })} - initialValues={formData.formValues} - render={({ handleSubmit }) => ( - - { - return onFormChange(formState.values); - }} - /> - {items} - - )} - /> - ); -} - -// interface Props { -// formData: QuestionnaireResponseFormData; -// onSubmit: (formData: QuestionnaireResponseFormData) => Promise; -// readOnly?: boolean; -// onChange?: (data: QuestionnaireResponseFormData) => any; -// } - -// type FormValues = FormItems; - -// export function BaseQuestionnaireResponseForm({ formData, onSubmit, readOnly, onChange }: Props) { -// const previousValues = useRef(null); - -// const onFormChange = (values: FormValues) => { -// if (_.isEqual(values, previousValues.current)) { -// return; -// } - -// onChange?.({ ...formData, formValues: values }); - -// previousValues.current = values; -// }; - -// return ( -//
onSubmit({ ...formData, formValues: values })} -// initialValues={formData.formValues} -// render={({ handleSubmit, values, form }) => ( -// -// { -// return onFormChange(formState.values); -// }} -// /> -// form.change('', newValues)} -// groupItemComponent={Group} -// itemControlGroupItemComponents={{ col: Col, row: Row, gtable: GTable }} -// questionItemComponents={{ -// date: QuestionDate, -// dateTime: QuestionDateTime, -// string: QuestionString, -// text: QuestionString, -// choice: QuestionChoice, -// boolean: QuestionBoolean, -// display: QuestionDisplay, -// decimal: QuestionDecimal, -// reference: QuestionReference, -// integer: QuestionInteger, -// }} -// readOnly={readOnly} -// > -// <> -// -// -// -// -// )} -// /> -// ); -// } diff --git a/web/src/components/BaseQuestionnaireResponseForm/QuestionnaireResponseForm.module.scss b/web/src/components/QRFormWrapper/QuestionnaireResponseForm.module.scss similarity index 100% rename from web/src/components/BaseQuestionnaireResponseForm/QuestionnaireResponseForm.module.scss rename to web/src/components/QRFormWrapper/QuestionnaireResponseForm.module.scss diff --git a/web/src/components/BaseQuestionnaireResponseForm/components/boolean/BooleanField.module.scss b/web/src/components/QRFormWrapper/components/boolean/BooleanField.module.scss similarity index 100% rename from web/src/components/BaseQuestionnaireResponseForm/components/boolean/BooleanField.module.scss rename to web/src/components/QRFormWrapper/components/boolean/BooleanField.module.scss diff --git a/web/src/components/BaseQuestionnaireResponseForm/components/boolean/index.tsx b/web/src/components/QRFormWrapper/components/boolean/index.tsx similarity index 100% rename from web/src/components/BaseQuestionnaireResponseForm/components/boolean/index.tsx rename to web/src/components/QRFormWrapper/components/boolean/index.tsx diff --git a/web/src/components/BaseQuestionnaireResponseForm/components/choice/hook.ts b/web/src/components/QRFormWrapper/components/choice/hook.ts similarity index 99% rename from web/src/components/BaseQuestionnaireResponseForm/components/choice/hook.ts rename to web/src/components/QRFormWrapper/components/choice/hook.ts index ef6b1454..741ed0c6 100644 --- a/web/src/components/BaseQuestionnaireResponseForm/components/choice/hook.ts +++ b/web/src/components/QRFormWrapper/components/choice/hook.ts @@ -10,7 +10,6 @@ import { ValueSet, } from 'shared/src/contrib/aidbox'; - export function getDisplay(value: AnswerValue): string { const valueType = _.keys(value)[0]; //@ts-ignore diff --git a/web/src/components/BaseQuestionnaireResponseForm/components/choice/index.tsx b/web/src/components/QRFormWrapper/components/choice/index.tsx similarity index 100% rename from web/src/components/BaseQuestionnaireResponseForm/components/choice/index.tsx rename to web/src/components/QRFormWrapper/components/choice/index.tsx diff --git a/web/src/components/BaseQuestionnaireResponseForm/components/choice/select.tsx b/web/src/components/QRFormWrapper/components/choice/select.tsx similarity index 100% rename from web/src/components/BaseQuestionnaireResponseForm/components/choice/select.tsx rename to web/src/components/QRFormWrapper/components/choice/select.tsx diff --git a/web/src/components/BaseQuestionnaireResponseForm/components/date.tsx b/web/src/components/QRFormWrapper/components/date.tsx similarity index 100% rename from web/src/components/BaseQuestionnaireResponseForm/components/date.tsx rename to web/src/components/QRFormWrapper/components/date.tsx diff --git a/web/src/components/BaseQuestionnaireResponseForm/components/decimal.tsx b/web/src/components/QRFormWrapper/components/decimal.tsx similarity index 100% rename from web/src/components/BaseQuestionnaireResponseForm/components/decimal.tsx rename to web/src/components/QRFormWrapper/components/decimal.tsx diff --git a/web/src/components/BaseQuestionnaireResponseForm/components/display.tsx b/web/src/components/QRFormWrapper/components/display.tsx similarity index 100% rename from web/src/components/BaseQuestionnaireResponseForm/components/display.tsx rename to web/src/components/QRFormWrapper/components/display.tsx diff --git a/web/src/components/BaseQuestionnaireResponseForm/components/field.tsx b/web/src/components/QRFormWrapper/components/field.tsx similarity index 100% rename from web/src/components/BaseQuestionnaireResponseForm/components/field.tsx rename to web/src/components/QRFormWrapper/components/field.tsx diff --git a/web/src/components/BaseQuestionnaireResponseForm/components/group/GTable/GTable.module.scss b/web/src/components/QRFormWrapper/components/group/GTable/GTable.module.scss similarity index 100% rename from web/src/components/BaseQuestionnaireResponseForm/components/group/GTable/GTable.module.scss rename to web/src/components/QRFormWrapper/components/group/GTable/GTable.module.scss diff --git a/web/src/components/BaseQuestionnaireResponseForm/components/group/GTable/index.tsx b/web/src/components/QRFormWrapper/components/group/GTable/index.tsx similarity index 100% rename from web/src/components/BaseQuestionnaireResponseForm/components/group/GTable/index.tsx rename to web/src/components/QRFormWrapper/components/group/GTable/index.tsx diff --git a/web/src/components/BaseQuestionnaireResponseForm/components/group/Group.module.scss b/web/src/components/QRFormWrapper/components/group/Group.module.scss similarity index 100% rename from web/src/components/BaseQuestionnaireResponseForm/components/group/Group.module.scss rename to web/src/components/QRFormWrapper/components/group/Group.module.scss diff --git a/web/src/components/BaseQuestionnaireResponseForm/components/group/RepeatableGroups/RepeatableGroups.module.scss b/web/src/components/QRFormWrapper/components/group/RepeatableGroups/RepeatableGroups.module.scss similarity index 100% rename from web/src/components/BaseQuestionnaireResponseForm/components/group/RepeatableGroups/RepeatableGroups.module.scss rename to web/src/components/QRFormWrapper/components/group/RepeatableGroups/RepeatableGroups.module.scss diff --git a/web/src/components/BaseQuestionnaireResponseForm/components/group/RepeatableGroups/index.tsx b/web/src/components/QRFormWrapper/components/group/RepeatableGroups/index.tsx similarity index 100% rename from web/src/components/BaseQuestionnaireResponseForm/components/group/RepeatableGroups/index.tsx rename to web/src/components/QRFormWrapper/components/group/RepeatableGroups/index.tsx diff --git a/web/src/components/BaseQuestionnaireResponseForm/components/group/context.ts b/web/src/components/QRFormWrapper/components/group/context.ts similarity index 100% rename from web/src/components/BaseQuestionnaireResponseForm/components/group/context.ts rename to web/src/components/QRFormWrapper/components/group/context.ts diff --git a/web/src/components/BaseQuestionnaireResponseForm/components/group/flex.tsx b/web/src/components/QRFormWrapper/components/group/flex.tsx similarity index 100% rename from web/src/components/BaseQuestionnaireResponseForm/components/group/flex.tsx rename to web/src/components/QRFormWrapper/components/group/flex.tsx diff --git a/web/src/components/BaseQuestionnaireResponseForm/components/group/index.tsx b/web/src/components/QRFormWrapper/components/group/index.tsx similarity index 100% rename from web/src/components/BaseQuestionnaireResponseForm/components/group/index.tsx rename to web/src/components/QRFormWrapper/components/group/index.tsx diff --git a/web/src/components/BaseQuestionnaireResponseForm/components/group/label.tsx b/web/src/components/QRFormWrapper/components/group/label.tsx similarity index 100% rename from web/src/components/BaseQuestionnaireResponseForm/components/group/label.tsx rename to web/src/components/QRFormWrapper/components/group/label.tsx diff --git a/web/src/components/BaseQuestionnaireResponseForm/components/index.ts b/web/src/components/QRFormWrapper/components/index.ts similarity index 100% rename from web/src/components/BaseQuestionnaireResponseForm/components/index.ts rename to web/src/components/QRFormWrapper/components/index.ts diff --git a/web/src/components/BaseQuestionnaireResponseForm/components/integer.tsx b/web/src/components/QRFormWrapper/components/integer.tsx similarity index 100% rename from web/src/components/BaseQuestionnaireResponseForm/components/integer.tsx rename to web/src/components/QRFormWrapper/components/integer.tsx diff --git a/web/src/components/BaseQuestionnaireResponseForm/components/label.tsx b/web/src/components/QRFormWrapper/components/label.tsx similarity index 100% rename from web/src/components/BaseQuestionnaireResponseForm/components/label.tsx rename to web/src/components/QRFormWrapper/components/label.tsx diff --git a/web/src/components/BaseQuestionnaireResponseForm/components/questionItems.tsx b/web/src/components/QRFormWrapper/components/questionItems.tsx similarity index 100% rename from web/src/components/BaseQuestionnaireResponseForm/components/questionItems.tsx rename to web/src/components/QRFormWrapper/components/questionItems.tsx diff --git a/web/src/components/BaseQuestionnaireResponseForm/components/reference/hooks.ts b/web/src/components/QRFormWrapper/components/reference/hooks.ts similarity index 100% rename from web/src/components/BaseQuestionnaireResponseForm/components/reference/hooks.ts rename to web/src/components/QRFormWrapper/components/reference/hooks.ts diff --git a/web/src/components/BaseQuestionnaireResponseForm/components/reference/index.tsx b/web/src/components/QRFormWrapper/components/reference/index.tsx similarity index 99% rename from web/src/components/BaseQuestionnaireResponseForm/components/reference/index.tsx rename to web/src/components/QRFormWrapper/components/reference/index.tsx index 4ee4bb1c..b3912b86 100644 --- a/web/src/components/BaseQuestionnaireResponseForm/components/reference/index.tsx +++ b/web/src/components/QRFormWrapper/components/reference/index.tsx @@ -9,7 +9,6 @@ import { AsyncSelectField } from '../choice/select'; import { QuestionField } from '../field'; import { QuestionLabel } from '../label'; - function QuestionReferenceUnsafe( props: AnswerReferenceProps, ) { diff --git a/web/src/components/BaseQuestionnaireResponseForm/components/string.tsx b/web/src/components/QRFormWrapper/components/string.tsx similarity index 100% rename from web/src/components/BaseQuestionnaireResponseForm/components/string.tsx rename to web/src/components/QRFormWrapper/components/string.tsx diff --git a/web/src/components/QRFormWrapper/index.tsx b/web/src/components/QRFormWrapper/index.tsx index b9b899c6..e4b9d1d8 100644 --- a/web/src/components/QRFormWrapper/index.tsx +++ b/web/src/components/QRFormWrapper/index.tsx @@ -33,11 +33,10 @@ import { QuestionDisplay, QuestionString, Row, -} from '../BaseQuestionnaireResponseForm/components'; -import { QuestionInteger } from '../BaseQuestionnaireResponseForm/components/integer'; -import { QuestionReference } from '../BaseQuestionnaireResponseForm/components/reference'; -import s from '../BaseQuestionnaireResponseForm/QuestionnaireResponseForm.module.scss'; - + QuestionInteger, + QuestionReference, +} from './components'; +import s from './QuestionnaireResponseForm.module.scss'; interface QRFormWrapperProps { questionnaireRD: RemoteData; diff --git a/web/src/containers/Main/MappingEditor/index.tsx b/web/src/containers/Main/MappingEditor/index.tsx index a845c8cc..3db9b4ea 100644 --- a/web/src/containers/Main/MappingEditor/index.tsx +++ b/web/src/containers/Main/MappingEditor/index.tsx @@ -23,7 +23,7 @@ import { Mapping } from 'shared/src/contrib/aidbox'; import s from './MappingEditor.module.scss'; import { useMappingEditor } from './useMappingEditor'; -import formStyles from '../../../components/BaseQuestionnaireResponseForm/QuestionnaireResponseForm.module.scss'; +import formStyles from '../../../components/QRFormWrapper/QuestionnaireResponseForm.module.scss'; import { PromptForm } from '../PromptForm'; interface Props { diff --git a/web/src/containers/Main/PromptForm/index.tsx b/web/src/containers/Main/PromptForm/index.tsx index 75ef9480..adf6c6b3 100644 --- a/web/src/containers/Main/PromptForm/index.tsx +++ b/web/src/containers/Main/PromptForm/index.tsx @@ -4,7 +4,7 @@ import { Button } from 'web/src/components/Button'; import { RemoteDataResult, isFailure, isSuccess } from 'fhir-react/lib/libs/remoteData'; -import s from '../../../components/BaseQuestionnaireResponseForm/QuestionnaireResponseForm.module.scss'; +import s from '../../../components/QRFormWrapper/QuestionnaireResponseForm.module.scss'; interface PromptFormInterface { prompt: string; diff --git a/web/src/containers/Main/QuestionnaireEditor/index.tsx b/web/src/containers/Main/QuestionnaireEditor/index.tsx index 5ae6c829..569d76d5 100644 --- a/web/src/containers/Main/QuestionnaireEditor/index.tsx +++ b/web/src/containers/Main/QuestionnaireEditor/index.tsx @@ -11,7 +11,7 @@ import { RemoteData, RemoteDataResult, isFailure, isLoading } from 'fhir-react/l import s from './QuestionnaireEditor.module.scss'; import { useQuestionnaireEditor } from './useQuestionnaireEditor'; -import formStyles from '../../../components/BaseQuestionnaireResponseForm/QuestionnaireResponseForm.module.scss'; +import formStyles from '../../../components/QRFormWrapper/QuestionnaireResponseForm.module.scss'; import { PromptForm } from '../PromptForm'; interface Props { From 366bde03400b82fe848264f24977427d51cfe019 Mon Sep 17 00:00:00 2001 From: Pavel R Date: Fri, 31 May 2024 16:02:04 +0200 Subject: [PATCH 05/12] Update all imports Ref https://github.com/beda-software/sdc-ide/issues/66 --- .../components/boolean/index.tsx | 29 +++++----- .../QRFormWrapper/components/date.tsx | 54 +++++++++---------- .../QRFormWrapper/components/decimal.tsx | 6 +-- .../QRFormWrapper/components/index.ts | 2 + .../QRFormWrapper/components/integer.tsx | 35 +++++------- .../components/reference/index.tsx | 13 +++-- .../QRFormWrapper/components/string.tsx | 5 +- web/src/components/QRFormWrapper/index.tsx | 20 +++---- 8 files changed, 73 insertions(+), 91 deletions(-) diff --git a/web/src/components/QRFormWrapper/components/boolean/index.tsx b/web/src/components/QRFormWrapper/components/boolean/index.tsx index c50c63aa..c555fae8 100644 --- a/web/src/components/QRFormWrapper/components/boolean/index.tsx +++ b/web/src/components/QRFormWrapper/components/boolean/index.tsx @@ -1,3 +1,4 @@ +import { useFieldController } from '@beda.software/fhir-questionnaire/components/QuestionnaireResponseForm'; import { QuestionItemProps, useQuestionnaireResponseFormContext, @@ -7,27 +8,25 @@ import { Field } from 'react-final-form'; import s from './BooleanField.module.scss'; import { QuestionLabel } from '../label'; + export function QuestionBoolean({ parentPath, questionItem }: QuestionItemProps) { const qrfContext = useQuestionnaireResponseFormContext(); const { linkId, readOnly, hidden } = questionItem; const fieldPath = [...parentPath, linkId, 0, 'value', 'boolean']; const fieldName = fieldPath.join('.'); + const { value, onChange } = useFieldController(fieldPath, questionItem); return ( - - {({ input }) => ( -
- - -
- )} -
+
+ + +
); } diff --git a/web/src/components/QRFormWrapper/components/date.tsx b/web/src/components/QRFormWrapper/components/date.tsx index e74955e2..ea494eaa 100644 --- a/web/src/components/QRFormWrapper/components/date.tsx +++ b/web/src/components/QRFormWrapper/components/date.tsx @@ -1,3 +1,4 @@ +import { useFieldController } from '@beda.software/fhir-questionnaire/components/QuestionnaireResponseForm'; import { QuestionItemProps, useQuestionnaireResponseFormContext, @@ -6,7 +7,6 @@ import moment from 'moment'; import { FHIRDateTimeFormat } from 'fhir-react/lib/utils/date'; -import { QuestionField } from './field'; import { QuestionLabel } from './label'; export function QuestionDate({ parentPath, questionItem }: QuestionItemProps) { @@ -14,22 +14,20 @@ export function QuestionDate({ parentPath, questionItem }: QuestionItemProps) { const { linkId, readOnly, hidden } = questionItem; const fieldPath = [...parentPath, linkId, 0, 'value', 'date']; const fieldName = fieldPath.join('.'); + const { value, onChange } = useFieldController(fieldPath, questionItem); return ( - - {({ input, meta }) => ( - <> - - - {meta.touched && meta.error && {meta.error}} - - )} - + <> + + + {/* {meta.touched && meta.error && {meta.error}} */} + ); } @@ -46,20 +44,18 @@ export function QuestionDateTime({ parentPath, questionItem }: QuestionItemProps ? moment.utc(value, FHIRDateTimeFormat).local().format('YYYY-MM-DDTHH:mm:ss') : ''; }; + const { value, onChange } = useFieldController(fieldPath, questionItem); return ( - - {({ input, meta }) => ( - <> - - - {meta.touched && meta.error && {meta.error}} - - )} - + <> + + + {/* {meta.touched && meta.error && {meta.error}} */} + ); } diff --git a/web/src/components/QRFormWrapper/components/decimal.tsx b/web/src/components/QRFormWrapper/components/decimal.tsx index 86af3b35..707f101e 100644 --- a/web/src/components/QRFormWrapper/components/decimal.tsx +++ b/web/src/components/QRFormWrapper/components/decimal.tsx @@ -4,7 +4,6 @@ import { useQuestionnaireResponseFormContext, } from '@beda.software/fhir-questionnaire/vendor/sdc-qrf'; -import { QuestionField } from './field'; import { QuestionLabel } from './label'; export function QuestionDecimal({ parentPath, questionItem }: QuestionItemProps) { @@ -12,10 +11,7 @@ export function QuestionDecimal({ parentPath, questionItem }: QuestionItemProps) const { linkId, readOnly, hidden } = questionItem; const fieldPath = [...parentPath, linkId, 0, 'value', 'decimal']; const fieldName = fieldPath.join('.'); - const { value, onChange, disabled, formItem, onBlur } = useFieldController( - fieldPath, - questionItem, - ); + const { value, onChange, disabled } = useFieldController(fieldPath, questionItem); return ( <> diff --git a/web/src/components/QRFormWrapper/components/index.ts b/web/src/components/QRFormWrapper/components/index.ts index 427ba83a..9c828cf4 100644 --- a/web/src/components/QRFormWrapper/components/index.ts +++ b/web/src/components/QRFormWrapper/components/index.ts @@ -5,3 +5,5 @@ export * from './date'; export * from './boolean'; export * from './display'; export * from './decimal'; +export * from './integer'; +export * from './reference'; diff --git a/web/src/components/QRFormWrapper/components/integer.tsx b/web/src/components/QRFormWrapper/components/integer.tsx index 3656527a..775b7ac8 100644 --- a/web/src/components/QRFormWrapper/components/integer.tsx +++ b/web/src/components/QRFormWrapper/components/integer.tsx @@ -1,9 +1,9 @@ +import { useFieldController } from '@beda.software/fhir-questionnaire/components/QuestionnaireResponseForm'; import { QuestionItemProps, useQuestionnaireResponseFormContext, } from '@beda.software/fhir-questionnaire/vendor/sdc-qrf'; -import { QuestionField } from './field'; import { QuestionLabel } from './label'; export function QuestionInteger({ parentPath, questionItem }: QuestionItemProps) { @@ -11,27 +11,20 @@ export function QuestionInteger({ parentPath, questionItem }: QuestionItemProps) const { linkId, readOnly, hidden } = questionItem; const fieldPath = [...parentPath, linkId, 0, 'value', 'integer']; const fieldName = fieldPath.join('.'); + const { value, onChange, disabled } = useFieldController(fieldPath, questionItem); return ( - - {({ input, meta }) => ( - <> - - { - const value = e.target.value - ? parseInt(e.target.value, 10) - : e.target.value; - input.onChange(value); - }} - /> - {meta.touched && meta.error && {meta.error}} - - )} - + <> + + + {/* {meta.touched && meta.error && {meta.error}} */} + ); } diff --git a/web/src/components/QRFormWrapper/components/reference/index.tsx b/web/src/components/QRFormWrapper/components/reference/index.tsx index b3912b86..ac0a9308 100644 --- a/web/src/components/QRFormWrapper/components/reference/index.tsx +++ b/web/src/components/QRFormWrapper/components/reference/index.tsx @@ -1,12 +1,12 @@ import { useFieldController } from '@beda.software/fhir-questionnaire/components/QuestionnaireResponseForm'; import { useQuestionnaireResponseFormContext } from '@beda.software/fhir-questionnaire/vendor/sdc-qrf'; +import { useCallback } from 'react'; import { getAnswerCode, getAnswerDisplay } from 'web/src/utils/questionnaire'; import { AidboxResource, QuestionnaireItemAnswerOption, Resource } from 'shared/src/contrib/aidbox'; import { AnswerReferenceProps, useAnswerReference } from './hooks'; import { AsyncSelectField } from '../choice/select'; -import { QuestionField } from '../field'; import { QuestionLabel } from '../label'; function QuestionReferenceUnsafe( @@ -20,10 +20,9 @@ function QuestionReferenceUnsafe onChange([].concat(option)), [onChange]); const fieldProps = { validate }; @@ -32,7 +31,7 @@ function QuestionReferenceUnsafe key={`answer-choice-${deps.join('-')}`} - value={value} + value={repeats ? [value] : value} id={fieldName} testId={linkId!} label={text} @@ -40,7 +39,7 @@ function QuestionReferenceUnsafe getAnswerDisplay(option.value)} getOptionValue={(option) => getAnswerCode(option.value)} - onChange={onChange} + onChange={onSelect} readOnly={qrfContext.readOnly || readOnly} helpText={helpText} /> diff --git a/web/src/components/QRFormWrapper/components/string.tsx b/web/src/components/QRFormWrapper/components/string.tsx index 8f331fed..70e84b11 100644 --- a/web/src/components/QRFormWrapper/components/string.tsx +++ b/web/src/components/QRFormWrapper/components/string.tsx @@ -12,10 +12,7 @@ export function QuestionString({ parentPath, questionItem }: QuestionItemProps) const { linkId, readOnly, hidden } = questionItem; const fieldPath = [...parentPath, linkId, 0, 'value', 'string']; const fieldName = fieldPath.join('.'); - const { value, onChange, disabled, formItem, onBlur } = useFieldController( - fieldPath, - questionItem, - ); + const { value, onChange, disabled } = useFieldController(fieldPath, questionItem); return ( <> diff --git a/web/src/components/QRFormWrapper/index.tsx b/web/src/components/QRFormWrapper/index.tsx index e4b9d1d8..2cc64c66 100644 --- a/web/src/components/QRFormWrapper/index.tsx +++ b/web/src/components/QRFormWrapper/index.tsx @@ -67,7 +67,7 @@ export function QRFormWrapper({ return

{errors.map((e) => formatError(e)).join(',')}

; }} > - {(data) => ( + {(data: QRFormWrapperProps) => ( { + onSubmit={(newFormData: { formValues: any }) => { const fceQR: FCEQuestionnaireResponse = { ...toFirstClassExtension(data.questionnaireResponseRD), ...mapFormToResponse(newFormData.formValues, data.questionnaireRD), From d30416284fbd790e36665a8de0167fe73253fbd2 Mon Sep 17 00:00:00 2001 From: Pavel R Date: Fri, 31 May 2024 16:57:50 +0200 Subject: [PATCH 06/12] WIP: Fix type problems Ref https://github.com/beda-software/sdc-ide/issues/66 --- .../components/boolean/index.tsx | 2 -- .../QRFormWrapper/components/choice/index.tsx | 10 ++------ .../QRFormWrapper/components/date.tsx | 20 ++++++++-------- web/src/components/QRFormWrapper/index.tsx | 23 +++++++++++++++---- 4 files changed, 30 insertions(+), 25 deletions(-) diff --git a/web/src/components/QRFormWrapper/components/boolean/index.tsx b/web/src/components/QRFormWrapper/components/boolean/index.tsx index c555fae8..4fbc9139 100644 --- a/web/src/components/QRFormWrapper/components/boolean/index.tsx +++ b/web/src/components/QRFormWrapper/components/boolean/index.tsx @@ -3,12 +3,10 @@ import { QuestionItemProps, useQuestionnaireResponseFormContext, } from '@beda.software/fhir-questionnaire/vendor/sdc-qrf'; -import { Field } from 'react-final-form'; import s from './BooleanField.module.scss'; import { QuestionLabel } from '../label'; - export function QuestionBoolean({ parentPath, questionItem }: QuestionItemProps) { const qrfContext = useQuestionnaireResponseFormContext(); const { linkId, readOnly, hidden } = questionItem; diff --git a/web/src/components/QRFormWrapper/components/choice/index.tsx b/web/src/components/QRFormWrapper/components/choice/index.tsx index 7ea2b685..5471af90 100644 --- a/web/src/components/QRFormWrapper/components/choice/index.tsx +++ b/web/src/components/QRFormWrapper/components/choice/index.tsx @@ -9,25 +9,19 @@ import { QuestionnaireItemAnswerOption } from 'shared/src/contrib/aidbox'; import { useAnswerChoice } from './hook'; import { AsyncSelectField } from './select'; -import { QuestionField } from '../field'; import { QuestionLabel } from '../label'; export function QuestionChoice(props: QuestionItemProps) { const { questionItem } = props; - const { fieldName, loadOptions, validate, deps, fieldPath } = useAnswerChoice(props); + const { fieldName, loadOptions, deps, fieldPath } = useAnswerChoice(props); const { text, repeats, readOnly, hidden, linkId } = questionItem; const qrfContext = useQuestionnaireResponseFormContext(); - const { value, onChange, disabled, formItem, onBlur } = useFieldController( - fieldPath, - questionItem, - ); + const { value, onChange } = useFieldController(fieldPath, questionItem); if (hidden) { return null; } - const fieldProps = { validate }; - return ( <> diff --git a/web/src/components/QRFormWrapper/components/date.tsx b/web/src/components/QRFormWrapper/components/date.tsx index ea494eaa..e8889d77 100644 --- a/web/src/components/QRFormWrapper/components/date.tsx +++ b/web/src/components/QRFormWrapper/components/date.tsx @@ -3,9 +3,9 @@ import { QuestionItemProps, useQuestionnaireResponseFormContext, } from '@beda.software/fhir-questionnaire/vendor/sdc-qrf'; -import moment from 'moment'; +// import moment from 'moment'; -import { FHIRDateTimeFormat } from 'fhir-react/lib/utils/date'; +// import { FHIRDateTimeFormat } from 'fhir-react/lib/utils/date'; import { QuestionLabel } from './label'; @@ -36,14 +36,14 @@ export function QuestionDateTime({ parentPath, questionItem }: QuestionItemProps const { linkId, readOnly, hidden } = questionItem; const fieldPath = [...parentPath, linkId, 0, 'value', 'dateTime']; const fieldName = fieldPath.join('.'); - const parseValue = (value: string) => { - return moment(value).local().utc().format(FHIRDateTimeFormat); - }; - const formatValue = (value?: string) => { - return value - ? moment.utc(value, FHIRDateTimeFormat).local().format('YYYY-MM-DDTHH:mm:ss') - : ''; - }; + // const parseValue = (value: string) => { + // return moment(value).local().utc().format(FHIRDateTimeFormat); + // }; + // const formatValue = (value?: string) => { + // return value + // ? moment.utc(value, FHIRDateTimeFormat).local().format('YYYY-MM-DDTHH:mm:ss') + // : ''; + // }; const { value, onChange } = useFieldController(fieldPath, questionItem); return ( <> diff --git a/web/src/components/QRFormWrapper/index.tsx b/web/src/components/QRFormWrapper/index.tsx index 2cc64c66..f25d6ce6 100644 --- a/web/src/components/QRFormWrapper/index.tsx +++ b/web/src/components/QRFormWrapper/index.tsx @@ -1,4 +1,8 @@ -import { BaseQuestionnaireResponseForm } from '@beda.software/fhir-questionnaire/components/QuestionnaireResponseForm/BaseQuestionnaireResponseForm'; +import { + BaseQuestionnaireResponseForm, + FormWrapperProps, + QuestionnaireResponseFormData, +} from '@beda.software/fhir-questionnaire/components/QuestionnaireResponseForm/BaseQuestionnaireResponseForm'; import { fromFirstClassExtension, mapFormToResponse, @@ -98,10 +102,18 @@ export function QRFormWrapper({ widgetsByQuestionItemControl={{ 'inline-choice': QuestionChoice, }} - onSubmit={(newFormData: { formValues: any }) => { + onSubmit={(newFormData: QuestionnaireResponseFormData) => { + const firstClassExtension = toFirstClassExtension( + data.questionnaireResponseRD, + ); + const formToResponse = mapFormToResponse( + newFormData.formValues, + data.questionnaireRD, + ); + const fceQR: FCEQuestionnaireResponse = { - ...toFirstClassExtension(data.questionnaireResponseRD), - ...mapFormToResponse(newFormData.formValues, data.questionnaireRD), + ...firstClassExtension, + ...formToResponse, }; onChange(fromFirstClassExtension(fceQR)); }} @@ -114,7 +126,8 @@ export function QRFormWrapper({ ); } -function FormWrapper({ handleSubmit, items }: { handleSubmit: any; items: any }) { +function FormWrapper(props: FormWrapperProps) { + const { handleSubmit, items } = props; const { watch } = useFormContext(); watch(() => { From 8f77ab165fddab2294bf62064da085d75da54138 Mon Sep 17 00:00:00 2001 From: Ilya Beda Date: Sat, 1 Jun 2024 08:43:20 +1000 Subject: [PATCH 07/12] Fix typeerrors --- .../components/QRFormWrapper/components/choice/select.tsx | 4 +--- .../components/QRFormWrapper/components/reference/index.tsx | 4 +--- web/src/components/QRFormWrapper/components/string.tsx | 1 - web/src/components/QRFormWrapper/index.tsx | 6 +++--- 4 files changed, 5 insertions(+), 10 deletions(-) diff --git a/web/src/components/QRFormWrapper/components/choice/select.tsx b/web/src/components/QRFormWrapper/components/choice/select.tsx index 95a54f14..27a9ac48 100644 --- a/web/src/components/QRFormWrapper/components/choice/select.tsx +++ b/web/src/components/QRFormWrapper/components/choice/select.tsx @@ -1,8 +1,6 @@ -import { QuestionnaireResponseItemAnswer } from 'fhir/r4b'; import _ from 'lodash'; import { ActionMeta, PropsValue } from 'react-select'; import { AsyncSelect } from 'web/src/components/Select'; -// eslint-disable-next-line import/named interface Props { label?: string; @@ -17,7 +15,7 @@ interface Props { getOptionValue: (option: T) => string; isMulti?: boolean; testId?: string; - value?: QuestionnaireResponseItemAnswer[]; + value?: any; //TODO better define types for choice on the widget level } export function AsyncSelectField(props: Props) { diff --git a/web/src/components/QRFormWrapper/components/reference/index.tsx b/web/src/components/QRFormWrapper/components/reference/index.tsx index ac0a9308..104b51c6 100644 --- a/web/src/components/QRFormWrapper/components/reference/index.tsx +++ b/web/src/components/QRFormWrapper/components/reference/index.tsx @@ -13,7 +13,7 @@ function QuestionReferenceUnsafe, ) { const { questionItem, parentPath } = props; - const { loadOptions, deps, validate } = useAnswerReference(props); + const { loadOptions, deps } = useAnswerReference(props); const { text, repeats, linkId, helpText, readOnly } = questionItem; const qrfContext = useQuestionnaireResponseFormContext(); @@ -24,8 +24,6 @@ function QuestionReferenceUnsafe onChange([].concat(option)), [onChange]); - const fieldProps = { validate }; - return ( <> diff --git a/web/src/components/QRFormWrapper/components/string.tsx b/web/src/components/QRFormWrapper/components/string.tsx index 70e84b11..0f3fd79e 100644 --- a/web/src/components/QRFormWrapper/components/string.tsx +++ b/web/src/components/QRFormWrapper/components/string.tsx @@ -4,7 +4,6 @@ import { useQuestionnaireResponseFormContext, } from '@beda.software/fhir-questionnaire/vendor/sdc-qrf'; -import { QuestionField } from './field'; import { QuestionLabel } from './label'; export function QuestionString({ parentPath, questionItem }: QuestionItemProps) { diff --git a/web/src/components/QRFormWrapper/index.tsx b/web/src/components/QRFormWrapper/index.tsx index f25d6ce6..1bc7e9a8 100644 --- a/web/src/components/QRFormWrapper/index.tsx +++ b/web/src/components/QRFormWrapper/index.tsx @@ -1,7 +1,6 @@ import { BaseQuestionnaireResponseForm, FormWrapperProps, - QuestionnaireResponseFormData, } from '@beda.software/fhir-questionnaire/components/QuestionnaireResponseForm/BaseQuestionnaireResponseForm'; import { fromFirstClassExtension, @@ -71,7 +70,7 @@ export function QRFormWrapper({ return

{errors.map((e) => formatError(e)).join(',')}

; }} > - {(data: QRFormWrapperProps) => ( + {(data) => ( { + onSubmit={(newFormData) => { const firstClassExtension = toFirstClassExtension( data.questionnaireResponseRD, ); @@ -116,6 +115,7 @@ export function QRFormWrapper({ ...formToResponse, }; onChange(fromFirstClassExtension(fceQR)); + return Promise.resolve(); }} groupItemComponent={Group} widgetsByGroupQuestionItemControl={{ col: Col, row: Row, gtable: GTable }} From 0e50edfdcb97524adf3183d472fd0b34619e027a Mon Sep 17 00:00:00 2001 From: Ilya Beda Date: Sat, 1 Jun 2024 13:03:29 +1000 Subject: [PATCH 08/12] Introduce FormRenderContext --- web/src/components/QRFormWrapper/index.tsx | 14 +------------- web/src/containers/Main/context.ts | 6 ++++++ web/src/containers/Main/index.tsx | 5 ++++- web/src/containers/Main/types.ts | 12 ++++++++++++ 4 files changed, 23 insertions(+), 14 deletions(-) create mode 100644 web/src/containers/Main/context.ts diff --git a/web/src/components/QRFormWrapper/index.tsx b/web/src/components/QRFormWrapper/index.tsx index 1bc7e9a8..7dc80a70 100644 --- a/web/src/components/QRFormWrapper/index.tsx +++ b/web/src/components/QRFormWrapper/index.tsx @@ -8,17 +8,12 @@ import { mapResponseToForm, toFirstClassExtension, } from '@beda.software/fhir-questionnaire/vendor/sdc-qrf'; -import { - Questionnaire as FHIRQuestionnaire, - QuestionnaireResponse as FHIRQuestionnaireResponse, - Parameters, -} from 'fhir/r4b'; import _ from 'lodash'; import { useCallback } from 'react'; import { useFormContext } from 'react-hook-form'; import { RenderRemoteData } from 'web/src/components/RenderRemoteData'; +import { QRFormWrapperProps } from 'web/src/containers/Main/types'; -import { RemoteData } from 'fhir-react/lib/libs/remoteData'; import { sequenceMap } from 'fhir-react/lib/services/service'; import { formatError } from 'fhir-react/lib/utils/error'; @@ -41,13 +36,6 @@ import { } from './components'; import s from './QuestionnaireResponseForm.module.scss'; -interface QRFormWrapperProps { - questionnaireRD: RemoteData; - questionnaireResponseRD: RemoteData; - saveQuestionnaireResponse: (resource: FHIRQuestionnaireResponse) => void; - launchContextParameters: Parameters['parameter']; -} - export function QRFormWrapper({ questionnaireRD, questionnaireResponseRD, diff --git a/web/src/containers/Main/context.ts b/web/src/containers/Main/context.ts new file mode 100644 index 00000000..8f81abf3 --- /dev/null +++ b/web/src/containers/Main/context.ts @@ -0,0 +1,6 @@ +import { createContext } from 'react'; +import { QRFormWrapper } from 'web/src/components/QRFormWrapper'; + +import { QRFWrapper } from './types'; + +export const FormRenderContext = createContext(QRFormWrapper); diff --git a/web/src/containers/Main/index.tsx b/web/src/containers/Main/index.tsx index 500c2128..684293c3 100644 --- a/web/src/containers/Main/index.tsx +++ b/web/src/containers/Main/index.tsx @@ -1,3 +1,4 @@ +import { useContext } from 'react'; import { useParams } from 'react-router-dom'; import { ToastContainer } from 'react-toastify'; import { Button } from 'web/src/components/Button'; @@ -6,13 +7,13 @@ import { ExpandableRow } from 'web/src/components/ExpandableRow'; import { LaunchContextEditor } from 'web/src/components/LaunchContextEditor'; import { Logo } from 'web/src/components/Logo'; import 'react-toastify/dist/ReactToastify.css'; -import { QRFormWrapper } from 'web/src/components/QRFormWrapper'; import { ResourceCodeDisplay } from 'web/src/components/ResourceCodeDisplay'; import { version } from 'web/src/version'; import { RenderRemoteData } from 'fhir-react/lib/components/RenderRemoteData'; import { isSuccess } from 'fhir-react/lib/libs/remoteData'; +import { FormRenderContext } from './context'; import s from './Main.module.scss'; import { MappingEditor } from './MappingEditor'; import { QuestionnaireEditor } from './QuestionnaireEditor'; @@ -30,6 +31,8 @@ export function Main() { manager, } = useMain(questionnaireId!); + const QRFormWrapper = useContext(FormRenderContext); + return ( <>
diff --git a/web/src/containers/Main/types.ts b/web/src/containers/Main/types.ts index cf1dbbe5..7dd7609c 100644 --- a/web/src/containers/Main/types.ts +++ b/web/src/containers/Main/types.ts @@ -1,3 +1,6 @@ +import { Parameters, Questionnaire, QuestionnaireResponse } from 'fhir/r4b'; +import { RemoteData } from 'fhir-react'; + export interface MappingErrorManager { errorCount: number; showError: () => void; @@ -22,3 +25,12 @@ export type Title = | 'QuestionnaireResponse FHIR resource' | 'Patient JUTE Mapping' | 'Patient batch request'; + +export interface QRFormWrapperProps { + questionnaireRD: RemoteData; + questionnaireResponseRD: RemoteData; + saveQuestionnaireResponse: (resource: QuestionnaireResponse) => void; + launchContextParameters: Parameters['parameter']; +} + +export type QRFWrapper = (props: QRFormWrapperProps) => React.JSX.Element; From d929619f74c6d2d424ed7359413c018591c49b7c Mon Sep 17 00:00:00 2001 From: Ilya Beda Date: Mon, 17 Jun 2024 12:15:17 +1000 Subject: [PATCH 09/12] Fix style --- web/src/styles/fonts.scss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/src/styles/fonts.scss b/web/src/styles/fonts.scss index 13dbe65b..351313b5 100644 --- a/web/src/styles/fonts.scss +++ b/web/src/styles/fonts.scss @@ -1,5 +1,5 @@ @import 'src/styles/colors'; -@import url(https://cdn.jsdelivr.net/npm/firacode@6.2.0/distr/fira_code.css); +@import url('https://cdn.jsdelivr.net/npm/firacode@6.2.0/distr/fira_code.css'); @mixin base-text-bold { font-weight: 600; From 7de1056ce601043fb459d6ca4f8a735c840d2540 Mon Sep 17 00:00:00 2001 From: Ilya Beda Date: Mon, 17 Jun 2024 12:16:23 +1000 Subject: [PATCH 10/12] Use @beda.software/remote-data and @beda.software/fhir-react --- web/package.json | 3 ++- .../components/LaunchContextEditor/index.tsx | 2 +- web/src/components/ModalExpression/hooks.ts | 6 +++--- web/src/components/ModalExpression/index.tsx | 2 +- .../components/reference/hooks.ts | 5 ++--- web/src/components/QRFormWrapper/index.tsx | 4 ++-- web/src/components/RenderRemoteData.tsx | 4 ++-- web/src/components/ResourceSelect/index.tsx | 7 +++---- .../components/SourceQueryDebugModal/hooks.ts | 8 +++----- .../SourceQueryDebugModal/index.tsx | 2 +- web/src/containers/App/index.tsx | 5 ++--- .../MappingEditorError/index.tsx | 2 +- .../MappingEditorSelect/index.tsx | 5 ++--- .../containers/Main/MappingEditor/index.tsx | 2 +- .../Main/MappingEditor/useMappingEditor.ts | 7 +++---- web/src/containers/Main/PromptForm/index.tsx | 2 +- .../Main/QuestionnaireEditor/index.tsx | 4 ++-- .../useQuestionnaireEditor.ts | 6 +++--- web/src/containers/Main/index.tsx | 5 +++-- .../containers/Main/useFHIRMappingLanguage.ts | 2 +- web/src/containers/Main/useMain.ts | 11 ++++++----- web/src/services/auth.ts | 6 +++--- web/src/services/builder.ts | 2 +- web/src/services/extract.ts | 2 +- web/src/services/fhir.ts | 19 +++++++++++++++++++ web/src/services/fhirmapping.ts | 2 +- web/src/services/initialize.ts | 3 --- web/src/services/questionnaire.ts | 8 ++++---- 28 files changed, 74 insertions(+), 62 deletions(-) create mode 100644 web/src/services/fhir.ts diff --git a/web/package.json b/web/package.json index 9b86aab9..31795912 100644 --- a/web/package.json +++ b/web/package.json @@ -4,6 +4,8 @@ "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", @@ -36,7 +38,6 @@ "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", diff --git a/web/src/components/LaunchContextEditor/index.tsx b/web/src/components/LaunchContextEditor/index.tsx index f2628f92..841d3626 100644 --- a/web/src/components/LaunchContextEditor/index.tsx +++ b/web/src/components/LaunchContextEditor/index.tsx @@ -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'; diff --git a/web/src/components/ModalExpression/hooks.ts b/web/src/components/ModalExpression/hooks.ts index d8194f5f..416c8bef 100644 --- a/web/src/components/ModalExpression/hooks.ts +++ b/web/src/components/ModalExpression/hooks.ts @@ -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'; diff --git a/web/src/components/ModalExpression/index.tsx b/web/src/components/ModalExpression/index.tsx index 550cab02..11b3aac4 100644 --- a/web/src/components/ModalExpression/index.tsx +++ b/web/src/components/ModalExpression/index.tsx @@ -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'; diff --git a/web/src/components/QRFormWrapper/components/reference/hooks.ts b/web/src/components/QRFormWrapper/components/reference/hooks.ts index 967b77e7..9608f12c 100644 --- a/web/src/components/QRFormWrapper/components/reference/hooks.ts +++ b/web/src/components/QRFormWrapper/components/reference/hooks.ts @@ -6,9 +6,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, diff --git a/web/src/components/QRFormWrapper/index.tsx b/web/src/components/QRFormWrapper/index.tsx index 7dc80a70..69c4cbf3 100644 --- a/web/src/components/QRFormWrapper/index.tsx +++ b/web/src/components/QRFormWrapper/index.tsx @@ -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'; diff --git a/web/src/components/RenderRemoteData.tsx b/web/src/components/RenderRemoteData.tsx index 39f8a92b..3d22ae79 100644 --- a/web/src/components/RenderRemoteData.tsx +++ b/web/src/components/RenderRemoteData.tsx @@ -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 { remoteData: RemoteData; diff --git a/web/src/components/ResourceSelect/index.tsx b/web/src/components/ResourceSelect/index.tsx index 5037ad93..b5c50356 100644 --- a/web/src/components/ResourceSelect/index.tsx +++ b/web/src/components/ResourceSelect/index.tsx @@ -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'; diff --git a/web/src/components/SourceQueryDebugModal/hooks.ts b/web/src/components/SourceQueryDebugModal/hooks.ts index 40743129..b9178268 100644 --- a/web/src/components/SourceQueryDebugModal/hooks.ts +++ b/web/src/components/SourceQueryDebugModal/hooks.ts @@ -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'; diff --git a/web/src/components/SourceQueryDebugModal/index.tsx b/web/src/components/SourceQueryDebugModal/index.tsx index 043f0ee2..215127ab 100644 --- a/web/src/components/SourceQueryDebugModal/index.tsx +++ b/web/src/components/SourceQueryDebugModal/index.tsx @@ -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'; diff --git a/web/src/containers/App/index.tsx b/web/src/containers/App/index.tsx index 7f431b05..0eb16d8a 100644 --- a/web/src/containers/App/index.tsx +++ b/web/src/containers/App/index.tsx @@ -3,9 +3,8 @@ import { useEffect, useRef } from 'react'; import { Route, Routes, useLocation, Navigate } from 'react-router-dom'; import { setData } from 'web/src/services/localStorage'; -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 { RenderRemoteData, useService } from '@beda.software/fhir-react'; +import { success } from '@beda.software/remote-data'; import { User } from 'shared/src/contrib/aidbox'; diff --git a/web/src/containers/Main/MappingEditor/MappingEditorError/index.tsx b/web/src/containers/Main/MappingEditor/MappingEditorError/index.tsx index 1716a0f8..4eb748f4 100644 --- a/web/src/containers/Main/MappingEditor/MappingEditorError/index.tsx +++ b/web/src/containers/Main/MappingEditor/MappingEditorError/index.tsx @@ -1,6 +1,6 @@ import { Button } from 'web/src/components/Button'; -import { formatError } from 'fhir-react/lib/utils/error'; +import { formatError } from '@beda.software/fhir-react'; import { MappingEditorErrorProps } from '../interfaces'; import s from '../MappingEditor.module.scss'; diff --git a/web/src/containers/Main/MappingEditor/MappingEditorSelect/index.tsx b/web/src/containers/Main/MappingEditor/MappingEditorSelect/index.tsx index 54c50d18..ec792626 100644 --- a/web/src/containers/Main/MappingEditor/MappingEditorSelect/index.tsx +++ b/web/src/containers/Main/MappingEditor/MappingEditorSelect/index.tsx @@ -4,9 +4,8 @@ import { Button } from 'web/src/components/Button'; import { ModalCreateMapper } from 'web/src/components/ModalCreateMapper'; import { Select } from 'web/src/components/Select'; -import { RenderRemoteData } from 'fhir-react/lib/components/RenderRemoteData'; -import { isFailure, isSuccess } from 'fhir-react/lib/libs/remoteData'; -import { formatError } from 'fhir-react/lib/utils/error'; +import { RenderRemoteData, formatError } from '@beda.software/fhir-react'; +import { isFailure, isSuccess } from '@beda.software/remote-data'; import formStyles from '../../../../components/QRFormWrapper/QuestionnaireResponseForm.module.scss'; import { PromptForm } from '../../PromptForm'; diff --git a/web/src/containers/Main/MappingEditor/index.tsx b/web/src/containers/Main/MappingEditor/index.tsx index ef0b5625..367b426c 100644 --- a/web/src/containers/Main/MappingEditor/index.tsx +++ b/web/src/containers/Main/MappingEditor/index.tsx @@ -1,4 +1,4 @@ -import { RenderRemoteData } from 'fhir-react/lib/components/RenderRemoteData'; +import { RenderRemoteData } from '@beda.software/fhir-react'; import { MappingEditorProps } from './interfaces'; import s from './MappingEditor.module.scss'; diff --git a/web/src/containers/Main/MappingEditor/useMappingEditor.ts b/web/src/containers/Main/MappingEditor/useMappingEditor.ts index 5bf2414f..61ac2dad 100644 --- a/web/src/containers/Main/MappingEditor/useMappingEditor.ts +++ b/web/src/containers/Main/MappingEditor/useMappingEditor.ts @@ -3,7 +3,7 @@ import { useEffect, useState } from 'react'; import { getFHIRResources as getAidboxFHIRResources } from 'aidbox-react/lib/services/fhir'; -import { useService } from 'fhir-react/lib/hooks/service'; +import { useService, WithId, extractBundleResources} from '@beda.software/fhir-react'; import { RemoteData, RemoteDataResult, @@ -13,9 +13,8 @@ import { isNotAsked, isSuccess, success, -} from 'fhir-react/lib/libs/remoteData'; -import { WithId, extractBundleResources } from 'fhir-react/lib/services/fhir'; -import { mapSuccess } from 'fhir-react/lib/services/service'; + mapSuccess, +} from '@beda.software/remote-data'; import { Mapping } from 'shared/src/contrib/aidbox'; diff --git a/web/src/containers/Main/PromptForm/index.tsx b/web/src/containers/Main/PromptForm/index.tsx index adf6c6b3..962cf38f 100644 --- a/web/src/containers/Main/PromptForm/index.tsx +++ b/web/src/containers/Main/PromptForm/index.tsx @@ -2,7 +2,7 @@ import { useState } from 'react'; import { Field, Form } from 'react-final-form'; import { Button } from 'web/src/components/Button'; -import { RemoteDataResult, isFailure, isSuccess } from 'fhir-react/lib/libs/remoteData'; +import { RemoteDataResult, isFailure, isSuccess } from '@beda.software/remote-data'; import s from '../../../components/QRFormWrapper/QuestionnaireResponseForm.module.scss'; diff --git a/web/src/containers/Main/QuestionnaireEditor/index.tsx b/web/src/containers/Main/QuestionnaireEditor/index.tsx index 569d76d5..1729ede3 100644 --- a/web/src/containers/Main/QuestionnaireEditor/index.tsx +++ b/web/src/containers/Main/QuestionnaireEditor/index.tsx @@ -6,8 +6,8 @@ import { Button } from 'web/src/components/Button'; import { ResourceCodeEditor } from 'web/src/components/ResourceCodeEditor'; import { Select } from 'web/src/components/Select'; -import { RenderRemoteData } from 'fhir-react/lib/components/RenderRemoteData'; -import { RemoteData, RemoteDataResult, isFailure, isLoading } from 'fhir-react/lib/libs/remoteData'; +import { RenderRemoteData } from '@beda.software/fhir-react'; +import { RemoteData, RemoteDataResult, isFailure, isLoading } from '@beda.software/remote-data'; import s from './QuestionnaireEditor.module.scss'; import { useQuestionnaireEditor } from './useQuestionnaireEditor'; diff --git a/web/src/containers/Main/QuestionnaireEditor/useQuestionnaireEditor.ts b/web/src/containers/Main/QuestionnaireEditor/useQuestionnaireEditor.ts index c5409736..e5a3656e 100644 --- a/web/src/containers/Main/QuestionnaireEditor/useQuestionnaireEditor.ts +++ b/web/src/containers/Main/QuestionnaireEditor/useQuestionnaireEditor.ts @@ -1,8 +1,8 @@ import { Questionnaire } from 'fhir/r4b'; -import { useService } from 'fhir-react/lib/hooks/service'; -import { extractBundleResources, getFHIRResources } from 'fhir-react/lib/services/fhir'; -import { mapSuccess } from 'fhir-react/lib/services/service'; +import { useService, extractBundleResources } from '@beda.software/fhir-react'; +import { getFHIRResources } from 'src/services/fhir'; +import { mapSuccess } from '@beda.software/remote-data'; export function useQuestionnaireEditor() { const [questionnairesRD] = useService(async () => diff --git a/web/src/containers/Main/index.tsx b/web/src/containers/Main/index.tsx index bd704dce..75735429 100644 --- a/web/src/containers/Main/index.tsx +++ b/web/src/containers/Main/index.tsx @@ -12,8 +12,9 @@ import 'react-toastify/dist/ReactToastify.css'; import { ResourceCodeDisplay } from 'web/src/components/ResourceCodeDisplay'; import { version } from 'web/src/version'; -import { RenderRemoteData } from 'fhir-react/lib/components/RenderRemoteData'; -import { isSuccess } from 'fhir-react/lib/libs/remoteData'; +import { RenderRemoteData } from '@beda.software/fhir-react'; +import { isSuccess } from '@beda.software/remote-data'; + import { FormRenderContext } from './context'; import s from './Main.module.scss'; diff --git a/web/src/containers/Main/useFHIRMappingLanguage.ts b/web/src/containers/Main/useFHIRMappingLanguage.ts index dc0345d4..fd8ff7b4 100644 --- a/web/src/containers/Main/useFHIRMappingLanguage.ts +++ b/web/src/containers/Main/useFHIRMappingLanguage.ts @@ -2,7 +2,7 @@ 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 { isSuccess } from '@beda.software/remote-data'; export function useFHIRMappingLanguage(questionnaireResponse: QuestionnaireResponse | undefined) { const [fhirMappingLangMode, setFhirMappingLangMode] = useState(false); diff --git a/web/src/containers/Main/useMain.ts b/web/src/containers/Main/useMain.ts index 2a4a41f6..26435146 100644 --- a/web/src/containers/Main/useMain.ts +++ b/web/src/containers/Main/useMain.ts @@ -18,7 +18,7 @@ import { saveFHIRResource as saveAidboxFHIRResource, } from 'aidbox-react/lib/services/fhir'; -import { useService } from 'fhir-react/lib/hooks/service'; +import { useService, WithId } from '@beda.software/fhir-react'; import { RemoteData, RemoteDataResult, @@ -27,10 +27,11 @@ import { isSuccess, notAsked, success, -} from 'fhir-react/lib/libs/remoteData'; -import { WithId, saveFHIRResource } from 'fhir-react/lib/services/fhir'; -import { service } from 'fhir-react/lib/services/service'; -import { formatError } from 'fhir-react/lib/utils/error'; +} 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'; diff --git a/web/src/services/auth.ts b/web/src/services/auth.ts index 254c1db3..369feb34 100644 --- a/web/src/services/auth.ts +++ b/web/src/services/auth.ts @@ -4,12 +4,12 @@ import { } from 'aidbox-react/lib/services/instance'; import { service } from 'aidbox-react/lib/services/service'; -import { isFailure, success } from 'fhir-react/lib/libs/remoteData'; +import { isFailure, success } from '@beda.software/remote-data'; import { resetInstanceToken as resetFHIRInstanceToken, setInstanceToken as setFHIRInstanceToken, -} from 'fhir-react/lib/services/instance'; -import { extractErrorCode } from 'fhir-react/lib/utils/error'; +} from './fhir'; +import { extractErrorCode } from '@beda.software/fhir-react'; import { User } from 'shared/src/contrib/aidbox'; diff --git a/web/src/services/builder.ts b/web/src/services/builder.ts index 90ab4774..2b6ff36d 100644 --- a/web/src/services/builder.ts +++ b/web/src/services/builder.ts @@ -1,4 +1,4 @@ -import { service } from 'fhir-react'; +import { service } from './fhir'; import { aiQuestionnaireBuilderUrl } from 'shared/src/constants'; diff --git a/web/src/services/extract.ts b/web/src/services/extract.ts index 15d523aa..e9f55e07 100644 --- a/web/src/services/extract.ts +++ b/web/src/services/extract.ts @@ -1,7 +1,7 @@ import { Bundle, Questionnaire, QuestionnaireResponse, Parameters, FhirResource } from 'fhir/r4b'; import _ from 'lodash'; -import { service } from 'fhir-react/lib/services/service'; +import { service } from './fhir'; import { Mapping } from 'shared/src/contrib/aidbox'; diff --git a/web/src/services/fhir.ts b/web/src/services/fhir.ts new file mode 100644 index 00000000..6fab21ef --- /dev/null +++ b/web/src/services/fhir.ts @@ -0,0 +1,19 @@ +import { initServices } from '@beda.software/fhir-react'; + +import { baseURL } from 'shared/src/constants'; + +export const { + axiosInstance, + service, + setInstanceToken, + resetInstanceToken, + getFHIRResource, + getFHIRResources, + getAllFHIRResources, + saveFHIRResource, + updateFHIRResource, + createFHIRResource, + forceDeleteFHIRResource, + patchFHIRResource, + setInstanceBaseURL, +} = initServices(baseURL + '/fhir'); diff --git a/web/src/services/fhirmapping.ts b/web/src/services/fhirmapping.ts index 2b9c1f55..81fe1d56 100644 --- a/web/src/services/fhirmapping.ts +++ b/web/src/services/fhirmapping.ts @@ -1,6 +1,6 @@ import { Bundle, QuestionnaireResponse, StructureMap } from 'fhir/r4b'; -import { service } from 'fhir-react/lib/services/service'; +import { service } from './fhir'; import { fhirMappingLanguageUrl } from 'shared/src/constants'; diff --git a/web/src/services/initialize.ts b/web/src/services/initialize.ts index dcc348c1..04bd563d 100644 --- a/web/src/services/initialize.ts +++ b/web/src/services/initialize.ts @@ -1,10 +1,7 @@ import { setInstanceBaseURL as setAidboxInstanceBaseURL } from 'aidbox-react/lib/services/instance'; -import { setInstanceBaseURL as setFHIRInstanceBaseURL } from 'fhir-react/lib/services/instance'; - import { baseURL, juteURL, fhirpathMappingUrl } from 'shared/src/constants'; setAidboxInstanceBaseURL(baseURL); -setFHIRInstanceBaseURL(`${baseURL}/fhir`); export { baseURL, juteURL, fhirpathMappingUrl }; diff --git a/web/src/services/questionnaire.ts b/web/src/services/questionnaire.ts index d6c7dae1..e768d7eb 100644 --- a/web/src/services/questionnaire.ts +++ b/web/src/services/questionnaire.ts @@ -1,11 +1,11 @@ import { extractBundleResources, - getFHIRResources, getReference, ResourcesMap, -} from 'fhir-react/lib/services/fhir'; -import { SearchParams } from 'fhir-react/lib/services/search'; -import { mapSuccess } from 'fhir-react/lib/services/service'; +} from '@beda.software/fhir-react'; +import { getFHIRResources } from './fhir'; +import { SearchParams } from '@beda.software/fhir-react'; +import { mapSuccess } from '@beda.software/remote-data'; import { Resource } from 'shared/src/contrib/aidbox'; From 9324fa2e89fed41aa5aa589996343230f346c839 Mon Sep 17 00:00:00 2001 From: Ilya Beda Date: Tue, 18 Jun 2024 10:24:16 +1000 Subject: [PATCH 11/12] Confguration refactoring --- shared/src/constants.ts | 33 ++++++++++++++++++++------------- web/src/services/auth.ts | 2 ++ web/src/services/builder.ts | 6 +++--- web/src/services/fhir.ts | 4 ++-- web/src/services/fhirmapping.ts | 8 ++++---- web/src/services/initialize.ts | 3 ++- 6 files changed, 33 insertions(+), 23 deletions(-) diff --git a/shared/src/constants.ts b/shared/src/constants.ts index 30777c40..77e7a8de 100644 --- a/shared/src/constants.ts +++ b/shared/src/constants.ts @@ -1,14 +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:8099/' - : (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 fhirMappingLanguageUrl = 'http://localhost:8084/matchboxv3/fhir'; +export const configuration:Record = {} 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) diff --git a/web/src/services/auth.ts b/web/src/services/auth.ts index 369feb34..b612e66e 100644 --- a/web/src/services/auth.ts +++ b/web/src/services/auth.ts @@ -61,6 +61,8 @@ export function getAuthorizeUrl(clientId: string, state?: OAuthState) { connection: { baseUrl }, } = getData(); + console.log(baseUrl); + return `${baseUrl}/auth/authorize?client_id=${clientId}&response_type=token${stateStr}`; } diff --git a/web/src/services/builder.ts b/web/src/services/builder.ts index 2b6ff36d..00dab423 100644 --- a/web/src/services/builder.ts +++ b/web/src/services/builder.ts @@ -1,6 +1,6 @@ import { service } from './fhir'; -import { aiQuestionnaireBuilderUrl } from 'shared/src/constants'; +import { configuration } from 'shared/src/constants'; import { getToken } from './auth'; @@ -8,7 +8,7 @@ export async function generateQuestionnaireService(prompt: string, questionnaire const appToken = getToken(); return await service({ - baseURL: aiQuestionnaireBuilderUrl, + baseURL: configuration.aiQuestionnaireBuilderUrl, url: `/questionnaire`, method: 'POST', data: { prompt: prompt, questionnaire }, @@ -22,7 +22,7 @@ export async function generateMappingService(prompt: string, questionnaire: stri const appToken = getToken(); return await service({ - baseURL: aiQuestionnaireBuilderUrl, + baseURL: configuration.aiQuestionnaireBuilderUrl, url: `/mapper`, method: 'POST', data: { prompt: prompt, questionnaire }, diff --git a/web/src/services/fhir.ts b/web/src/services/fhir.ts index 6fab21ef..f4fce631 100644 --- a/web/src/services/fhir.ts +++ b/web/src/services/fhir.ts @@ -1,6 +1,6 @@ import { initServices } from '@beda.software/fhir-react'; -import { baseURL } from 'shared/src/constants'; +import { configuration } from 'shared/src/constants'; export const { axiosInstance, @@ -16,4 +16,4 @@ export const { forceDeleteFHIRResource, patchFHIRResource, setInstanceBaseURL, -} = initServices(baseURL + '/fhir'); +} = initServices(configuration.baseURL + '/fhir'); diff --git a/web/src/services/fhirmapping.ts b/web/src/services/fhirmapping.ts index 81fe1d56..33654cca 100644 --- a/web/src/services/fhirmapping.ts +++ b/web/src/services/fhirmapping.ts @@ -2,7 +2,7 @@ import { Bundle, QuestionnaireResponse, StructureMap } from 'fhir/r4b'; import { service } from './fhir'; -import { fhirMappingLanguageUrl } from 'shared/src/constants'; +import { configuration } from 'shared/src/constants'; const CONTENT_TYPE_FHIR_MAPPING = 'text/fhir-mapping'; const CONTENT_TYPE_FHIR_JSON = 'application/fhir+json'; @@ -10,7 +10,7 @@ const ACCEPT_FHIR_JSON = 'application/fhir+json'; export async function convert({ mapString }: { mapString: string }) { return await service({ - baseURL: fhirMappingLanguageUrl, + baseURL: configuration.fhirMappingLanguageUrl, url: `/StructureMap/$convert`, method: 'POST', data: mapString, @@ -22,7 +22,7 @@ export async function convert({ mapString }: { mapString: string }) { export async function createStructureMap({ structureMap }: { structureMap: StructureMap }) { return await service({ - baseURL: fhirMappingLanguageUrl, + baseURL: configuration.fhirMappingLanguageUrl, url: `/StructureMap`, method: 'POST', data: structureMap, @@ -37,7 +37,7 @@ export async function transform({ questionnaireResponse: QuestionnaireResponse; }) { return await service({ - baseURL: fhirMappingLanguageUrl, + baseURL: configuration.fhirMappingLanguageUrl, url: `/StructureMap/$transform`, method: 'POST', data: questionnaireResponse, diff --git a/web/src/services/initialize.ts b/web/src/services/initialize.ts index 04bd563d..6c098715 100644 --- a/web/src/services/initialize.ts +++ b/web/src/services/initialize.ts @@ -1,6 +1,7 @@ import { setInstanceBaseURL as setAidboxInstanceBaseURL } from 'aidbox-react/lib/services/instance'; -import { baseURL, juteURL, fhirpathMappingUrl } from 'shared/src/constants'; +import { configuration } from 'shared/src/constants'; +const { baseURL, juteURL, fhirpathMappingUrl } = configuration; setAidboxInstanceBaseURL(baseURL); From 4a51eead5cbb5d6f2adb3af9269d38e26b6e5786 Mon Sep 17 00:00:00 2001 From: Ilya Beda Date: Tue, 18 Jun 2024 10:59:07 +1000 Subject: [PATCH 12/12] Move assemble and populate into services provided by context --- web/src/containers/Main/context.ts | 12 ++++++++++++ web/src/containers/Main/useMain.ts | 28 +++++++++------------------- web/src/services/sdc.ts | 20 ++++++++++++++++++++ 3 files changed, 41 insertions(+), 19 deletions(-) create mode 100644 web/src/services/sdc.ts diff --git a/web/src/containers/Main/context.ts b/web/src/containers/Main/context.ts index 8f81abf3..c91f4178 100644 --- a/web/src/containers/Main/context.ts +++ b/web/src/containers/Main/context.ts @@ -1,6 +1,18 @@ import { createContext } from 'react'; import { QRFormWrapper } from 'web/src/components/QRFormWrapper'; +import { RemoteDataResult } from '@beda.software/remote-data'; +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> + +interface SDCContextType { + assemble: AssembleService + populate: PopulateService +} export const FormRenderContext = createContext(QRFormWrapper); +export const SDCContext = createContext({ assemble, populate }) diff --git a/web/src/containers/Main/useMain.ts b/web/src/containers/Main/useMain.ts index 26435146..109b90c4 100644 --- a/web/src/containers/Main/useMain.ts +++ b/web/src/containers/Main/useMain.ts @@ -1,12 +1,11 @@ import { Questionnaire, - QuestionnaireResponse, Parameters, ParametersParameter, Bundle, FhirResource, } from 'fhir/r4b'; -import { useCallback, useState } from 'react'; +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'; @@ -36,6 +35,7 @@ import { formatError } from '@beda.software/fhir-react'; import { Mapping } from 'shared/src/contrib/aidbox'; import { getMappings, makeMappingExtension } from './utils'; +import { SDCContext } from './context'; export function useLaunchContext() { const [launchContext, setLaunchContext] = useState({ @@ -65,6 +65,7 @@ export function useLaunchContext() { export function useMain(questionnaireId: string) { const navigate = useNavigate(); + const {assemble, populate} = useContext(SDCContext) const { launchContext, setLaunchContext, clearLaunchContext } = useLaunchContext(); const [mappingRD, setMappingRD] = useState>>(notAsked); @@ -104,14 +105,9 @@ export function useMain(questionnaireId: string) { return response; }, [questionnaireId]); - const [assembledQuestionnaireRD, assembledQuestionnaireRDManager] = useService(async () => { - const response = await service({ - method: 'GET', - url: `Questionnaire/${questionnaireId}/$assemble`, - }); - - return response; - }, [questionnaireId]); + const [assembledQuestionnaireRD, assembledQuestionnaireRDManager] = useService( + () => assemble(questionnaireId), + [questionnaireId, assemble]); const reloadQuestionnaire = useCallback(async () => { originalQuestionnaireRDManager.reload(); @@ -180,15 +176,9 @@ export function useMain(questionnaireId: string) { [saveQuestionnaire, navigate], ); - const [questionnaireResponseRD, questionnaireResponseRDManager] = useService(async () => { - const response = await service({ - method: 'POST', - url: '/Questionnaire/$populate', - data: launchContext, - }); - - return response; - }, [launchContext]); + const [questionnaireResponseRD, questionnaireResponseRDManager] = useService( + () => populate(launchContext), + [launchContext, populate]); const createMapping = useCallback( async (mapping: Mapping) => { diff --git a/web/src/services/sdc.ts b/web/src/services/sdc.ts new file mode 100644 index 00000000..934f9b2e --- /dev/null +++ b/web/src/services/sdc.ts @@ -0,0 +1,20 @@ +import { Parameters, Questionnaire, QuestionnaireResponse } from "fhir/r4b"; +import { service } from "./fhir"; + +export async function populate(launchContext:Parameters) { + const response = await service({ + method: 'POST', + url: '/Questionnaire/$populate', + data: launchContext, + }); + return response; +} + +export async function assemble(questionnaireId:string){ + const response = await service({ + method: 'GET', + url: `Questionnaire/${questionnaireId}/$assemble`, + }); + + return response; +}