Skip to content

Commit

Permalink
Merge pull request #1082 from aehrc/alpha-jv
Browse files Browse the repository at this point in the history
Merging alpha-jv into alpha
  • Loading branch information
fongsean authored Dec 22, 2024
2 parents b4bbe37 + 17d8b33 commit ea0341d
Show file tree
Hide file tree
Showing 14 changed files with 2,401 additions and 90 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
node_modules
coverage
changelog_guide.md
#Mac OS .DS_STORE
.DS_STORE
20 changes: 20 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,9 @@ VITE_LAUNCH_CLIENT_ID=smart-forms

In development mode, create a `.env.local` file in the `apps/smart-forms-app` directory and tweak the environment variables as needed.

> Note: in the local development mode, set
VITE_PRESERVE_SYM_LINKS=false so that it allows `tsc -w` to watch the latest changes. If preserveSymLink: true local changes will be ignored.



### Run app locally
Expand All @@ -129,6 +132,23 @@ npm start

5. Follow the instructions [here](https://github.com/aehrc/smart-forms#usage) but replace https://smartforms.csiro.au/launch with http://localhost:5173/launch

### Run Storybook locally


To run the [@aehrc/smart-forms-renderer](https://www.npmjs.com/package/@aehrc/smart-forms-renderer) via the storybook, follow the instruction below:

- On the main directory, go to packages>smart-forms-renderer in a terminal
- run the npm install again in the smart-forms-renderer folder
> npm install
- now you can run the storybook while watching the directory for any file changes.

>npm run storybook-watch





## Feature requests and bug reports

If you find any bugs, feel free to [create an issue](https://github.com/aehrc/smart-forms/issues/new) and we will try our best to get it fixed.
Expand Down
1 change: 1 addition & 0 deletions apps/smart-forms-app/.env
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ VITE_LAUNCH_SCOPE=fhirUser online_access openid profile patient/Condition.rs pat
VITE_LAUNCH_CLIENT_ID=a57d90e3-5f69-4b92-aa2e-2992180863c1

VITE_IN_APP_POPULATE=true
VITE_PRESERVE_SYM_LINKS=true
1 change: 1 addition & 0 deletions apps/smart-forms-app/.env.production
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ VITE_LAUNCH_SCOPE=fhirUser online_access openid profile patient/Condition.rs pat
VITE_LAUNCH_CLIENT_ID=a57d90e3-5f69-4b92-aa2e-2992180863c1

VITE_IN_APP_POPULATE=true
VITE_PRESERVE_SYM_LINKS=true
2 changes: 1 addition & 1 deletion apps/smart-forms-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"dependencies": {
"@aehrc/sdc-assemble": "^1.3.1",
"@aehrc/sdc-populate": "^3.0.0",
"@aehrc/smart-forms-renderer": "^0.44.1",
"@aehrc/smart-forms-renderer": "^1.0.0-alpha.10",
"@emotion/react": "^11.13.0",
"@emotion/styled": "^11.13.0",
"@fontsource/material-icons": "^5.0.18",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,15 +77,15 @@ function usePopulate(spinner: RendererSpinner, onStopSpinner: () => void): void

setIsPopulated(true);
populateQuestionnaire(sourceQuestionnaire, smartClient, patient, user, encounter, fhirPathContext)
.then(({ populateSuccess, populateResult }) => {
.then(async ({ populateSuccess, populateResult }) => {
if (!populateSuccess || !populateResult) {
onStopSpinner();
enqueueSnackbar('Form not populated', { action: <CloseSnackbar />, variant: 'warning' });
return;
}

const { populated, hasWarnings, populatedContext } = populateResult;
const updatedResponse = updatePopulatedProperties(populated, populatedContext);
const updatedResponse = await updatePopulatedProperties(populated, populatedContext);
setUpdatableResponseAsPopulated(updatedResponse);
onStopSpinner();
if (hasWarnings) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ function RepopulateSelectDialog(props: RepopulateSelectDialogProps) {
setCheckedLinkIds(newCheckedIds);
}

function handleConfirmRepopulate() {
async function handleConfirmRepopulate() {
const checkedRepopulatedItems = filterCheckedItemsToRepopulate(
itemsToRepopulate,
checkedLinkIds
Expand All @@ -93,7 +93,7 @@ function RepopulateSelectDialog(props: RepopulateSelectDialogProps) {
});

const repopulatedResponse = repopulateResponse(checkedRepopulatedItems);
const updatedResponse = updatePopulatedProperties(repopulatedResponse, undefined, true);
const updatedResponse = await updatePopulatedProperties(repopulatedResponse, undefined, true);
setUpdatableResponseAsPopulated(updatedResponse);

onCloseDialog();
Expand Down
1 change: 1 addition & 0 deletions apps/smart-forms-app/src/vite-env.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ interface ImportMetaEnv {
readonly VITE_LAUNCH_CLIENT_ID: string;
readonly VITE_IN_APP_POPULATE: boolean;
readonly VITE_SHOW_DEBUG_MODE: string;
readonly VITE_PRESERVE_SYM_LINKS: boolean;
}

interface ImportMeta {
Expand Down
5 changes: 4 additions & 1 deletion apps/smart-forms-app/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
import svgr from 'vite-plugin-svgr';

const preserveSymlinks = process.env.VITE_PRESERVE_SYM_LINKS === 'true';//resolve preserveSymlink to boolean(Explicitly parse the string to a boolean)

// https://vitejs.dev/config/
export default defineConfig({
plugins: [react(), svgr()],
Expand All @@ -13,5 +15,6 @@ export default defineConfig({
include: [/node_modules/, '@aehrc/sdc-assemble', '@aehrc/sdc-populate']
}
},
resolve: { preserveSymlinks: true }
resolve: { preserveSymlinks: preserveSymlinks }
});

Loading

0 comments on commit ea0341d

Please sign in to comment.