Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merging main into acdc-pilot #885

Merged
merged 47 commits into from
Jun 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
d8cf955
Bump tslib from 2.6.2 to 2.6.3
dependabot[bot] Jun 13, 2024
182e739
Bump moment from 2.29.4 to 2.30.1
dependabot[bot] Jun 13, 2024
307c590
Bump nanoid from 5.0.1 to 5.0.7
dependabot[bot] Jun 14, 2024
e2cc497
Fix initial.valueBoolean parsing
fongsean Jun 17, 2024
d011453
Update package versions
fongsean Jun 17, 2024
468eb36
Merge pull request #864 from aehrc/dependabot/npm_and_yarn/moment-2.30.1
fongsean Jun 17, 2024
dd8d26e
Merge pull request #863 from aehrc/dependabot/npm_and_yarn/tslib-2.6.3
fongsean Jun 17, 2024
683b9a9
Merge pull request #862 from aehrc/dependabot/npm_and_yarn/nanoid-5.0.7
fongsean Jun 17, 2024
bf4fb27
Merge pull request #870 from aehrc/issue/866
fongsean Jun 17, 2024
59140b1
Bump @types/node from 20.12.5 to 20.14.2
dependabot[bot] Jun 17, 2024
2a8f694
Bump @fontsource/material-icons from 5.0.16 to 5.0.18
dependabot[bot] Jun 17, 2024
28d0f9b
Merge pull request #873 from aehrc/dependabot/npm_and_yarn/fontsource…
fongsean Jun 18, 2024
fbf260f
Merge pull request #871 from aehrc/dependabot/npm_and_yarn/types/node…
fongsean Jun 18, 2024
b27529f
Add transform endpoint on ehr proxy deployment
fongsean Jun 20, 2024
7400b31
Merge pull request #878 from aehrc/deploy-transform
fongsean Jun 20, 2024
9e80d8d
Bump constructs from 10.2.70 to 10.3.0
dependabot[bot] Jun 20, 2024
4a9fa70
Add FML BMI calculation test QR and map
fongsean Jun 20, 2024
bb9d405
Add initial commit of extract-express
fongsean Jun 20, 2024
c1c67a9
Refine BMI FML, structureMap and $transform JSON body
fongsean Jun 20, 2024
e4a3468
Return $transform response as $extract response
fongsean Jun 20, 2024
4ce86bd
Update extract-express dockerfile
fongsean Jun 20, 2024
da42d5d
Add extract button
fongsean Jun 20, 2024
f020811
Add extract endpoint to ehr app deployment
fongsean Jun 20, 2024
694df45
Tweak headers to make extract working
fongsean Jun 20, 2024
4ea5edc
Fix linting
fongsean Jun 20, 2024
071d6b5
Merge pull request #876 from aehrc/dependabot/npm_and_yarn/constructs…
fongsean Jun 20, 2024
d66fbc2
Bump ws from 6.2.2 to 6.2.3
dependabot[bot] Jun 20, 2024
72ee25c
Fix tests
fongsean Jun 20, 2024
93e658a
Remove unused SDC IDE
fongsean Jun 20, 2024
f10668c
Update extract package
fongsean Jun 20, 2024
e51ea0d
Merge branch 'refs/heads/main' into feature/extract
fongsean Jun 20, 2024
53999d4
Fix e2e tests
fongsean Jun 20, 2024
09ece41
Add snackbar on extract success
fongsean Jun 20, 2024
48025c7
Bump chokidar from 3.5.3 to 3.6.0
dependabot[bot] Jun 20, 2024
04a5798
Remove empty QR.item array and tweak initialise QR logic to not gener…
fongsean Jun 21, 2024
75b55a5
Dynamically get target structure map to determine if QR is extractable
fongsean Jun 21, 2024
7b4a20d
Add functionality to write extracted resource back to source FHIR server
fongsean Jun 21, 2024
ad43e61
Update package versions and fix linting
fongsean Jun 21, 2024
307fd91
Merge pull request #880 from aehrc/dependabot/npm_and_yarn/chokidar-3…
fongsean Jun 21, 2024
40952bd
Merge pull request #874 from aehrc/dependabot/npm_and_yarn/ws-6.2.3
fongsean Jun 21, 2024
663e00f
Merge pull request #879 from aehrc/feature/extract
fongsean Jun 21, 2024
0f21fc6
Update BMI extract demo resources
fongsean Jun 21, 2024
d283968
Merge pull request #881 from aehrc/feature/extract
fongsean Jun 21, 2024
5551410
Update extracted section to include targetStructureMap
fongsean Jun 21, 2024
b0e0857
Merge pull request #883 from aehrc/feature/extract
fongsean Jun 21, 2024
2b0abab
Update default property in extracted section to be extractedResource
fongsean Jun 21, 2024
9271738
Merge pull request #884 from aehrc/feature/extract
fongsean Jun 21, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions apps/smart-forms-app/e2e/_pre-run.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,12 @@
*/

import { expect, test } from '@playwright/test';
import { PLAYWRIGHT_APP_URL, PLAYWRIGHT_EHR_URL, PLAYWRIGHT_FORMS_SERVER_URL } from './globals';
import {
LAUNCH_PARAM_WITHOUT_Q,
PLAYWRIGHT_APP_URL,
PLAYWRIGHT_EHR_URL,
PLAYWRIGHT_FORMS_SERVER_URL
} from './globals';

test('launch without questionnaire context, select a questionnaire and create a new response', async ({
page
Expand All @@ -25,7 +30,8 @@ test('launch without questionnaire context, select a questionnaire and create a
const fetchQPromise = page.waitForResponse(
`${PLAYWRIGHT_FORMS_SERVER_URL}/Questionnaire?_count=100&_sort=-date&`
);
const launchUrl = `${PLAYWRIGHT_APP_URL}/launch?iss=https%3A%2F%2Fproxy.smartforms.io%2Fv%2Fr4%2Ffhir&launch=WzAsInBhdC1zZiIsInByaW1hcnktcGV0ZXIiLCJBVVRPIiwwLDAsMCwiZmhpclVzZXIgb25saW5lX2FjY2VzcyBvcGVuaWQgcHJvZmlsZSBwYXRpZW50L0NvbmRpdGlvbi5ycyBwYXRpZW50L09ic2VydmF0aW9uLnJzIGxhdW5jaCBwYXRpZW50L0VuY291bnRlci5ycyBwYXRpZW50L1F1ZXN0aW9ubmFpcmVSZXNwb25zZS5jcnVkcyBwYXRpZW50L1BhdGllbnQucnMiLCJodHRwOi8vbG9jYWxob3N0OjQxNzMvIiwiYTU3ZDkwZTMtNWY2OS00YjkyLWFhMmUtMjk5MjE4MDg2M2MxIiwiIiwiIiwiIiwiIiwwLDEsIiIsZmFsc2Vd`;

const launchUrl = `${PLAYWRIGHT_APP_URL}/launch?iss=https%3A%2F%2Fproxy.smartforms.io%2Fv%2Fr4%2Ffhir&launch=${LAUNCH_PARAM_WITHOUT_Q}`;
await page.goto(launchUrl);
expect((await fetchQPromise).status()).toBe(200);

Expand Down
4 changes: 2 additions & 2 deletions apps/smart-forms-app/e2e/dashboard.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
*/

import { expect, test } from '@playwright/test';
import { PLAYWRIGHT_APP_URL, PLAYWRIGHT_FORMS_SERVER_URL } from './globals';
import { LAUNCH_PARAM_WITHOUT_Q, PLAYWRIGHT_APP_URL, PLAYWRIGHT_FORMS_SERVER_URL } from './globals';

const questionnaireTitle = 'Aboriginal and Torres Strait Islander Health Check';

Expand All @@ -25,7 +25,7 @@ test.beforeEach(async ({ page }) => {
const fetchQPromise = page.waitForResponse(
`${PLAYWRIGHT_FORMS_SERVER_URL}/Questionnaire?_count=100&_sort=-date&`
);
const launchUrl = `${PLAYWRIGHT_APP_URL}/launch?iss=https%3A%2F%2Fproxy.smartforms.io%2Fv%2Fr4%2Ffhir&launch=WzAsInBhdC1zZiIsInByaW1hcnktcGV0ZXIiLCJBVVRPIiwwLDAsMCwiZmhpclVzZXIgb25saW5lX2FjY2VzcyBvcGVuaWQgcHJvZmlsZSBwYXRpZW50L0NvbmRpdGlvbi5ycyBwYXRpZW50L09ic2VydmF0aW9uLnJzIGxhdW5jaCBwYXRpZW50L0VuY291bnRlci5ycyBwYXRpZW50L1F1ZXN0aW9ubmFpcmVSZXNwb25zZS5jcnVkcyBwYXRpZW50L1BhdGllbnQucnMiLCJodHRwOi8vbG9jYWxob3N0OjQxNzMvIiwiYTU3ZDkwZTMtNWY2OS00YjkyLWFhMmUtMjk5MjE4MDg2M2MxIiwiIiwiIiwiIiwiIiwwLDEsIiIsZmFsc2Vd`;
const launchUrl = `${PLAYWRIGHT_APP_URL}/launch?iss=https%3A%2F%2Fproxy.smartforms.io%2Fv%2Fr4%2Ffhir&launch=${LAUNCH_PARAM_WITHOUT_Q}`;
await page.goto(launchUrl);
expect((await fetchQPromise).status()).toBe(200);

Expand Down
8 changes: 8 additions & 0 deletions apps/smart-forms-app/e2e/globals.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,11 @@ export const PLAYWRIGHT_FORMS_SERVER_URL = 'https://smartforms.csiro.au/api/fhir
export const PLAYWRIGHT_APP_URL = process.env.CI
? 'http://localhost:4173'
: 'http://localhost:5173';

export const LAUNCH_PARAM_WITHOUT_Q = process.env.CI
? 'WzAsInBhdC1zZiIsInByaW1hcnktcGV0ZXIiLCJBVVRPIiwwLDAsMCwiZmhpclVzZXIgb25saW5lX2FjY2VzcyBvcGVuaWQgcHJvZmlsZSBwYXRpZW50L0NvbmRpdGlvbi5ycyBwYXRpZW50L09ic2VydmF0aW9uLnJzIGxhdW5jaCBwYXRpZW50L0VuY291bnRlci5ycyBwYXRpZW50L1F1ZXN0aW9ubmFpcmVSZXNwb25zZS5jcnVkcyBwYXRpZW50L1BhdGllbnQucnMiLCJodHRwOi8vbG9jYWxob3N0OjQxNzMvIiwiYTU3ZDkwZTMtNWY2OS00YjkyLWFhMmUtMjk5MjE4MDg2M2MxIiwiIiwiIiwiIiwiIiwwLDEsIiIsZmFsc2Vd'
: 'WzAsInBhdC1zZiIsInByaW1hcnktcGV0ZXIiLCJBVVRPIiwwLDAsMCwiZmhpclVzZXIgb25saW5lX2FjY2VzcyBvcGVuaWQgcHJvZmlsZSBwYXRpZW50L0NvbmRpdGlvbi5ycyBwYXRpZW50L09ic2VydmF0aW9uLnJzIGxhdW5jaCBwYXRpZW50L0VuY291bnRlci5ycyBwYXRpZW50L1F1ZXN0aW9ubmFpcmVSZXNwb25zZS5jcnVkcyBwYXRpZW50L1BhdGllbnQucnMiLCJodHRwOi8vbG9jYWxob3N0OjUxNzMvIiwiMWZmN2JkYzItMzZiMi00MzAzLThjMDUtYzU3MzQyYzViMDQzIiwiIiwiIiwiIiwiIiwwLDEsIiIsZmFsc2Vd';

export const LAUNCH_PARAM_WITH_Q = process.env.CI
? 'WzAsInBhdC1zZiIsInByaW1hcnktcGV0ZXIiLCJBVVRPIiwwLDAsMCwiZmhpclVzZXIgb25saW5lX2FjY2VzcyBvcGVuaWQgcHJvZmlsZSBwYXRpZW50L0NvbmRpdGlvbi5ycyBwYXRpZW50L09ic2VydmF0aW9uLnJzIGxhdW5jaCBwYXRpZW50L0VuY291bnRlci5ycyBwYXRpZW50L1F1ZXN0aW9ubmFpcmVSZXNwb25zZS5jcnVkcyBwYXRpZW50L1BhdGllbnQucnMiLCJodHRwOi8vbG9jYWxob3N0OjQxNzMvIiwiYTU3ZDkwZTMtNWY2OS00YjkyLWFhMmUtMjk5MjE4MDg2M2MxIiwiIiwiIiwiIiwiIiwwLDEsIntcInJvbGVcIjpcInF1ZXN0aW9ubmFpcmUtcmVuZGVyLW9uLWxhdW5jaFwiLFwiY2Fub25pY2FsXCI6XCJodHRwOi8vd3d3LmhlYWx0aC5nb3YuYXUvYXNzZXNzbWVudHMvbWJzLzcxNXwwLjEuMC1hc3NlbWJsZWRcIixcInR5cGVcIjpcIlF1ZXN0aW9ubmFpcmVcIn0iLGZhbHNlXQ'
: 'WzAsInBhdC1zZiIsInByaW1hcnktcGV0ZXIiLCJBVVRPIiwwLDAsMCwiZmhpclVzZXIgb25saW5lX2FjY2VzcyBvcGVuaWQgcHJvZmlsZSBwYXRpZW50L0NvbmRpdGlvbi5ycyBwYXRpZW50L09ic2VydmF0aW9uLnJzIGxhdW5jaCBwYXRpZW50L0VuY291bnRlci5ycyBwYXRpZW50L1F1ZXN0aW9ubmFpcmVSZXNwb25zZS5jcnVkcyBwYXRpZW50L1BhdGllbnQucnMiLCJodHRwOi8vbG9jYWxob3N0OjUxNzMvIiwiMWZmN2JkYzItMzZiMi00MzAzLThjMDUtYzU3MzQyYzViMDQzIiwiIiwiIiwiIiwiIiwwLDEsIntcInJvbGVcIjpcInF1ZXN0aW9ubmFpcmUtcmVuZGVyLW9uLWxhdW5jaFwiLFwiY2Fub25pY2FsXCI6XCJodHRwOi8vd3d3LmhlYWx0aC5nb3YuYXUvYXNzZXNzbWVudHMvbWJzLzcxNXwwLjEuMC1hc3NlbWJsZWRcIixcInR5cGVcIjpcIlF1ZXN0aW9ubmFpcmVcIn0iLGZhbHNlXQ';
4 changes: 2 additions & 2 deletions apps/smart-forms-app/e2e/saving.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
*/

import { expect, test } from '@playwright/test';
import { PLAYWRIGHT_APP_URL, PLAYWRIGHT_EHR_URL } from './globals';
import { LAUNCH_PARAM_WITH_Q, PLAYWRIGHT_APP_URL, PLAYWRIGHT_EHR_URL } from './globals';

const questionnaireTitle = 'Aboriginal and Torres Strait Islander Health Check';

Expand All @@ -25,7 +25,7 @@ test.beforeEach(async ({ page }) => {
const populatePromise = page.waitForResponse(
new RegExp(/^https:\/\/proxy\.smartforms\.io\/v\/r4\/fhir\/(Observation|Condition)\?.+$/)
);
const launchUrl = `${PLAYWRIGHT_APP_URL}/launch?iss=https%3A%2F%2Fproxy.smartforms.io%2Fv%2Fr4%2Ffhir&launch=WzAsInBhdC1zZiIsInByaW1hcnktcGV0ZXIiLCJBVVRPIiwwLDAsMCwiZmhpclVzZXIgb25saW5lX2FjY2VzcyBvcGVuaWQgcHJvZmlsZSBwYXRpZW50L0NvbmRpdGlvbi5ycyBwYXRpZW50L09ic2VydmF0aW9uLnJzIGxhdW5jaCBwYXRpZW50L0VuY291bnRlci5ycyBwYXRpZW50L1F1ZXN0aW9ubmFpcmVSZXNwb25zZS5jcnVkcyBwYXRpZW50L1BhdGllbnQucnMiLCJodHRwOi8vbG9jYWxob3N0OjQxNzMvIiwiYTU3ZDkwZTMtNWY2OS00YjkyLWFhMmUtMjk5MjE4MDg2M2MxIiwiIiwiIiwiIiwiIiwwLDEsIntcInJvbGVcIjpcInF1ZXN0aW9ubmFpcmUtcmVuZGVyLW9uLWxhdW5jaFwiLFwiY2Fub25pY2FsXCI6XCJodHRwOi8vd3d3LmhlYWx0aC5nb3YuYXUvYXNzZXNzbWVudHMvbWJzLzcxNXwwLjEuMC1hc3NlbWJsZWRcIixcInR5cGVcIjpcIlF1ZXN0aW9ubmFpcmVcIn0iLGZhbHNlXQ`;
const launchUrl = `${PLAYWRIGHT_APP_URL}/launch?iss=https%3A%2F%2Fproxy.smartforms.io%2Fv%2Fr4%2Ffhir&launch=${LAUNCH_PARAM_WITH_Q}`;
await page.goto(launchUrl);
const populateResponse = await populatePromise;
expect(populateResponse.status()).toBe(200);
Expand Down
12 changes: 6 additions & 6 deletions apps/smart-forms-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@
"homepage": "https://github.com/aehrc/smart-forms#readme",
"dependencies": {
"@aehrc/sdc-assemble": "^1.2.0",
"@aehrc/sdc-populate": "^2.2.2",
"@aehrc/smart-forms-renderer": "^0.35.6",
"@aehrc/sdc-populate": "^2.2.3",
"@aehrc/smart-forms-renderer": "^0.35.8",
"@emotion/react": "^11.11.4",
"@emotion/styled": "^11.11.5",
"@fontsource/material-icons": "^5.0.16",
"@fontsource/material-icons": "^5.0.18",
"@fontsource/roboto": "^5.0.12",
"@iconify/react": "^4.1.1",
"@microlink/react-json-view": "^1.23.0",
Expand All @@ -54,9 +54,9 @@
"lodash.filter": "^4.6.0",
"lodash.isequal": "^4.5.0",
"material-ui-popup-state": "^5.0.10",
"moment": "^2.29.4",
"moment": "^2.30.1",
"monaco-editor": "^0.47.0",
"nanoid": "^5.0.1",
"nanoid": "^5.0.7",
"notistack": "^3.0.1",
"randomcolor": "^0.6.2",
"react": "^18.2.0",
Expand Down Expand Up @@ -96,7 +96,7 @@
"@types/lodash.debounce": "^4.0.7",
"@types/lodash.filter": "^4.6.7",
"@types/lodash.isequal": "^4.5.8",
"@types/node": "^20.12.5",
"@types/node": "^20.14.2",
"@types/randomcolor": "^0.5.9",
"@types/react": "^18.2.37",
"@types/react-dom": "^18.2.22",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ import CreateNewResponseButton from '../Buttons/CreateNewResponseButton.tsx';
import ViewExistingResponsesButton from '../Buttons/ViewExistingResponsesButton.tsx';
import ClearIcon from '@mui/icons-material/Clear';
import useSmartClient from '../../../../../../hooks/useSmartClient.ts';
import useDebugMode from '../../../../../../hooks/useDebugMode.ts';
import GoToSdcIdeButton from '../Buttons/GoToSdcIdeButton.tsx';

interface QuestionnaireListToolbarButtonsProps {
onClearSelection: () => void;
Expand All @@ -31,13 +29,9 @@ function QuestionnaireListToolbarButtons(props: QuestionnaireListToolbarButtonsP
const { onClearSelection } = props;

const { smartClient } = useSmartClient();
const { debugModeEnabled } = useDebugMode();

const isNotLaunched = !smartClient;

return (
<Box display="flex" alignItems="center" columnGap={2}>
{isNotLaunched && debugModeEnabled ? <GoToSdcIdeButton /> : null}
<CreateNewResponseButton />

{smartClient ? <ViewExistingResponsesButton /> : null}
Expand Down
69 changes: 69 additions & 0 deletions apps/smart-forms-app/src/features/playground/api/extract.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
/*
* Copyright 2024 Commonwealth Scientific and Industrial Research
* Organisation (CSIRO) ABN 41 687 119 230.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

import { HEADERS } from '../../../api/headers.ts';
import type { Bundle, Questionnaire, StructureMap } from 'fhir/r4';
import * as FHIR from 'fhirclient';
import { FORMS_SERVER_URL } from '../../../globals.ts';

export async function fetchTargetStructureMap(
questionnaire: Questionnaire
): Promise<StructureMap | null> {
let targetStructureMapCanonical = questionnaire.extension?.find(
(extension) =>
extension.url ===
'http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-targetStructureMap'
)?.valueCanonical;

if (!targetStructureMapCanonical) {
return null;
}

targetStructureMapCanonical = targetStructureMapCanonical.replace('|', '&version=');
const requestUrl = `/StructureMap?url=${targetStructureMapCanonical}&_sort=_lastUpdated`;
const resource = await FHIR.client(FORMS_SERVER_URL).request({
url: requestUrl,
headers: HEADERS
});

// Response isn't a resource, exit early
if (!resource.resourceType) {
return null;
}

if (resource.resourceType === 'Bundle') {
return resource.entry?.find((entry: any) => entry.resource?.resourceType === 'StructureMap')

Check warning on line 49 in apps/smart-forms-app/src/features/playground/api/extract.ts

View workflow job for this annotation

GitHub Actions / Lint

Unexpected any. Specify a different type
?.resource as StructureMap;
}

if (resource.resourceType === 'StructureMap') {
return resource as StructureMap;
}

return null;
}

export function extractedResourceIsBatchBundle(
extractedResource: any

Check warning on line 61 in apps/smart-forms-app/src/features/playground/api/extract.ts

View workflow job for this annotation

GitHub Actions / Lint

Unexpected any. Specify a different type
): extractedResource is Bundle {
return (
!!extractedResource &&
!!extractedResource.resourceType &&
extractedResource.resourceType === 'Bundle' &&
(extractedResource.type === 'transaction' || extractedResource.type === 'batch')
);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
/*
* Copyright 2024 Commonwealth Scientific and Industrial Research
* Organisation (CSIRO) ABN 41 687 119 230.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

// @ts-ignore
import React from 'react';
import { CircularProgress, Fade, IconButton, Tooltip } from '@mui/material';
import Typography from '@mui/material/Typography';
import CloudUploadIcon from '@mui/icons-material/CloudUpload';
import { FORMS_SERVER_URL } from '../../../globals.ts';

interface ExtractForPlaygroundProps {
extractEnabled: boolean;
isExtracting: boolean;
onExtract: () => void;
}

function ExtractButtonForPlayground(props: ExtractForPlaygroundProps) {
const { extractEnabled, isExtracting, onExtract } = props;

const toolTipText = extractEnabled
? 'Perform $extract'
: `The current questionnaire does not have a target StructureMap for $extract, or the target StructureMap cannot be found on ${FORMS_SERVER_URL}`;

return (
<>
<Tooltip title={toolTipText} placement="bottom-end">
<span>
<IconButton
disabled={isExtracting || !extractEnabled}
onClick={onExtract}
size="small"
color="primary"
data-test="extract-button-playground">
{isExtracting ? (
<CircularProgress size={20} color="inherit" sx={{ mb: 0.5 }} />
) : (
<CloudUploadIcon />
)}
</IconButton>
</span>
</Tooltip>
{isExtracting ? (
<Fade in={true} timeout={100}>
<Typography variant="body2" color="text.secondary">
Performing extraction...
</Typography>
</Fade>
) : null}
</>
);
}

export default ExtractButtonForPlayground;
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,20 @@ interface Props {
jsonString: string;
onJsonStringChange: (jsonString: string) => void;
buildingState: 'idle' | 'building' | 'built';
fhirServerUrl: string;
onBuildForm: (jsonString: string) => unknown;
onDestroyForm: () => unknown;
}

function JsonEditor(props: Props) {
const { jsonString, onJsonStringChange, buildingState, onBuildForm, onDestroyForm } = props;
const {
jsonString,
onJsonStringChange,
buildingState,
fhirServerUrl,
onBuildForm,
onDestroyForm
} = props;

const [view, setView] = useState<'editor' | 'storeState'>('editor');
const [selectedStore, setSelectedStore] = useState<StateStore>('questionnaireResponseStore');
Expand Down Expand Up @@ -78,7 +86,7 @@ function JsonEditor(props: Props) {
onClick={() => {
setView('storeState');
}}>
See store state
See advanced properties
</Button>
) : (
<Stack direction="row" alignItems="center" gap={0.55}>
Expand All @@ -99,6 +107,7 @@ function JsonEditor(props: Props) {
<ToggleButton value="questionnaireStore">Q</ToggleButton>
<ToggleButton value="questionnaireResponseStore">QR</ToggleButton>
<ToggleButton value="terminologyServerStore">Terminology</ToggleButton>
<ToggleButton value="extractedResource">Extracted</ToggleButton>
</ToggleButtonGroup>
</Stack>
)}
Expand Down Expand Up @@ -131,7 +140,7 @@ function JsonEditor(props: Props) {
/>
) : (
<Box sx={{ height: '100%', overflow: 'auto' }}>
<StoreStateViewer selectedStore={selectedStore} />
<StoreStateViewer selectedStore={selectedStore} fhirServerUrl={fhirServerUrl} />
</Box>
)}
</Box>
Expand Down
Loading
Loading