14 | );
15 | }
16 |
17 | export default App;
18 |
--------------------------------------------------------------------------------
/apps/demo-renderer-app/src/components/ui/collapsible.tsx:
--------------------------------------------------------------------------------
1 | import * as CollapsiblePrimitive from '@radix-ui/react-collapsible';
2 |
3 | const Collapsible = CollapsiblePrimitive.Root;
4 |
5 | const CollapsibleTrigger = CollapsiblePrimitive.CollapsibleTrigger;
6 |
7 | const CollapsibleContent = CollapsiblePrimitive.CollapsibleContent;
8 |
9 | export { Collapsible, CollapsibleTrigger, CollapsibleContent };
10 |
--------------------------------------------------------------------------------
/apps/demo-renderer-app/src/components/ui/textarea.tsx:
--------------------------------------------------------------------------------
1 | import * as React from 'react';
2 |
3 | import { cn } from '@/lib/utils';
4 |
5 | export interface TextareaProps extends React.TextareaHTMLAttributes {}
6 |
7 | const Textarea = React.forwardRef(
8 | ({ className, ...props }, ref) => {
9 | return (
10 |
18 | );
19 | }
20 | );
21 | Textarea.displayName = 'Textarea';
22 |
23 | export { Textarea };
24 |
--------------------------------------------------------------------------------
/apps/demo-renderer-app/src/lib/utils.ts:
--------------------------------------------------------------------------------
1 | import { clsx, type ClassValue } from "clsx"
2 | import { twMerge } from "tailwind-merge"
3 |
4 | export function cn(...inputs: ClassValue[]) {
5 | return twMerge(clsx(inputs))
6 | }
7 |
--------------------------------------------------------------------------------
/apps/demo-renderer-app/src/main.tsx:
--------------------------------------------------------------------------------
1 | import ReactDOM from 'react-dom/client';
2 | import App from './App.tsx';
3 | import type { DefaultOptions } from '@tanstack/react-query';
4 | import { keepPreviousData, QueryClient, QueryClientProvider } from '@tanstack/react-query';
5 | import '@/styles/globals.css';
6 |
7 | const DEFAULT_QUERY_OPTIONS: DefaultOptions = {
8 | queries: {
9 | refetchOnWindowFocus: false,
10 | placeholderData: keepPreviousData
11 | }
12 | };
13 |
14 | const queryClient = new QueryClient({ defaultOptions: DEFAULT_QUERY_OPTIONS });
15 |
16 | ReactDOM.createRoot(document.getElementById('root')!).render(
17 |
18 |
19 |
20 | );
21 |
--------------------------------------------------------------------------------
/apps/demo-renderer-app/src/vite-env.d.ts:
--------------------------------------------------------------------------------
1 | ///
2 |
--------------------------------------------------------------------------------
/apps/demo-renderer-app/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "target": "ESNext",
4 | "module": "ESNext",
5 | "lib": ["DOM", "DOM.Iterable", "ESNext"],
6 | "allowJs": true,
7 | "skipLibCheck": true,
8 | "esModuleInterop": true,
9 | "allowSyntheticDefaultImports": true,
10 |
11 | /* Bundler mode */
12 | "moduleResolution": "bundler",
13 | "allowImportingTsExtensions": true,
14 | "resolveJsonModule": true,
15 | "isolatedModules": true,
16 | "noEmit": true,
17 | "jsx": "react-jsx",
18 |
19 | /* Linting */
20 | "strict": true,
21 | "noUnusedLocals": true,
22 | "noUnusedParameters": true,
23 | "noFallthroughCasesInSwitch": true,
24 | "noImplicitAny": false,
25 |
26 | /* Paths */
27 | "baseUrl": ".",
28 | "paths": {
29 | "@/*": ["./src/*"]
30 | }
31 | },
32 | "include": ["src"],
33 | "exclude": ["src/components/ui/*.tsx"],
34 | "references": [{ "path": "./tsconfig.node.json" }]
35 | }
36 |
--------------------------------------------------------------------------------
/apps/demo-renderer-app/tsconfig.node.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "composite": true,
4 | "skipLibCheck": true,
5 | "module": "ESNext",
6 | "moduleResolution": "bundler",
7 | "allowSyntheticDefaultImports": true
8 | },
9 | "include": ["vite.config.ts"]
10 | }
11 |
--------------------------------------------------------------------------------
/apps/demo-renderer-app/vite.config.ts:
--------------------------------------------------------------------------------
1 | import path from 'path';
2 | import { defineConfig } from 'vite';
3 | import react from '@vitejs/plugin-react';
4 |
5 | // https://vitejs.dev/config/
6 | export default defineConfig({
7 | plugins: [react()],
8 | resolve: {
9 | alias: {
10 | '@': path.resolve(__dirname, './src')
11 | }
12 | },
13 | server: {
14 | fs: {
15 | // We are trying to access a Questionnaire on a remote forms server and render it, which Vite doesn't allow by default
16 | // See https://vite.dev/config/server-options.html#server-fs-allow
17 | strict: false
18 | }
19 | }
20 | });
21 |
--------------------------------------------------------------------------------
/apps/smart-forms-app/.env:
--------------------------------------------------------------------------------
1 | VITE_ONTOSERVER_URL=https://r4.ontoserver.csiro.au/fhir
2 | VITE_FORMS_SERVER_URL=https://smartforms.csiro.au/api/fhir
3 |
4 | VITE_LAUNCH_SCOPE=fhirUser online_access openid profile patient/Condition.rs patient/Observation.rs launch patient/Encounter.rs patient/QuestionnaireResponse.cruds patient/Patient.rs
5 | VITE_LAUNCH_CLIENT_ID=a57d90e3-5f69-4b92-aa2e-2992180863c1
6 |
7 | VITE_IN_APP_POPULATE=true
8 |
--------------------------------------------------------------------------------
/apps/smart-forms-app/.gitignore:
--------------------------------------------------------------------------------
1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2 |
3 | # dependencies
4 | /node_modules
5 | /.pnp
6 | .pnp.js
7 |
8 | # testing
9 | /coverage
10 |
11 | # production
12 | /build
13 | /dist
14 |
15 | # misc
16 | .DS_Store
17 | .env.local
18 | .env.development.local
19 | .env.test.local
20 | .env.production.local
21 |
22 | npm-debug.log*
23 | yarn-debug.log*
24 | yarn-error.log*
25 |
26 | # cypress non-test files
27 | cypress/screenshots
28 | cypress/videos
29 | temp
30 | /test-results/
31 | /playwright-report/
32 | /blob-report/
33 | /playwright/.cache/
34 |
--------------------------------------------------------------------------------
/apps/smart-forms-app/Dockerfile:
--------------------------------------------------------------------------------
1 | # Dockerfile
2 |
3 | # Step 1: Use a Node.js image to build the app
4 | FROM node:18 AS builder
5 |
6 | # Set working directory inside the container
7 | WORKDIR /app
8 |
9 | # Copy package.json and package-lock.json
10 | COPY package*.json ./
11 |
12 | # Install dependencies
13 | RUN npm install
14 |
15 | # Copy the rest of the app’s source code
16 | COPY . .
17 |
18 | # Build the app
19 | RUN npm run build
20 |
21 |
22 | # Step 2: Use an Nginx image to serve the static files
23 | FROM nginx:alpine
24 |
25 | # Copy the build files from the builder stage to the Nginx web directory
26 | COPY --from=builder /app/dist /usr/share/nginx/html
27 |
28 | # Copy your Nginx configuration file into the container
29 | COPY default.conf /etc/nginx/conf.d/
30 |
31 | # Expose port 80
32 | EXPOSE 80
33 |
34 | # Start Nginx server
35 | CMD ["nginx", "-g", "daemon off;"]
--------------------------------------------------------------------------------
/apps/smart-forms-app/default.conf:
--------------------------------------------------------------------------------
1 | ## nginx/default.conf
2 | server {
3 | # Nginx listens on port 80 by default. You can change this if needed.
4 | listen 80;
5 |
6 | # Specifies your domain. Use "localhost" for local development or your domain name for production.
7 | server_name localhost;
8 |
9 | # The root directory that contains the `dist` folder generated after building your app.
10 | root /usr/share/nginx/html;
11 | index index.html;
12 |
13 | # Serve all routes and pages
14 | # Use the base name to serve all pages. In this case, the base name is "/".
15 | location / {
16 | try_files $uri /index.html =404;
17 | }
18 |
19 | # Example: If your base name is "/example", the location block will look like this:
20 | # location /example {
21 | # rewrite ^/example(/.*) $1 break;
22 | # try_files $uri /index.html =404;
23 | # }
24 | }
--------------------------------------------------------------------------------
/apps/smart-forms-app/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 | Smart Forms
11 |
12 |
13 |
14 |
15 |
16 |
17 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/apps/smart-forms-app/jest.config.js:
--------------------------------------------------------------------------------
1 | /** @type {import('ts-jest').JestConfigWithTsJest} */
2 | module.exports = {
3 | preset: 'ts-jest',
4 | testEnvironment: 'node'
5 | };
6 |
--------------------------------------------------------------------------------
/apps/smart-forms-app/src/api/headers.ts:
--------------------------------------------------------------------------------
1 | export const HEADERS = {
2 | 'Cache-Control': 'no-cache',
3 | 'Content-Type': 'application/fhir+json;charset=utf-8',
4 | Accept: 'application/json;charset=utf-8'
5 | };
6 |
--------------------------------------------------------------------------------
/apps/smart-forms-app/src/api/ontoserver.ts:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aehrc/smart-forms/8f2c2ae79171bd85296e54c6cfe3cb66f17018d6/apps/smart-forms-app/src/api/ontoserver.ts
--------------------------------------------------------------------------------
/apps/smart-forms-app/src/components/Button/Button.styles.tsx:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2024 Commonwealth Scientific and Industrial Research
3 | * Organisation (CSIRO) ABN 41 687 119 230.
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License");
6 | * you may not use this file except in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 |
18 | import { styled, Button } from '@mui/material';
19 |
20 | export const RoundButton = styled(Button)(() => ({
21 | borderRadius: 30
22 | }));
23 |
--------------------------------------------------------------------------------
/apps/smart-forms-app/src/components/Button/ReauthenticateButton.tsx:
--------------------------------------------------------------------------------
1 | import { Button } from '@mui/material';
2 | import { useNavigate } from 'react-router-dom';
3 |
4 | function ReauthenticateButton() {
5 | const navigate = useNavigate();
6 |
7 | return (
8 |
16 | );
17 | }
18 |
19 | export default ReauthenticateButton;
20 |
--------------------------------------------------------------------------------
/apps/smart-forms-app/src/components/Button/UnlaunchedButton.tsx:
--------------------------------------------------------------------------------
1 | import { Button } from '@mui/material';
2 | import { useNavigate } from 'react-router-dom';
3 |
4 | function UnlaunchedButton() {
5 | const navigate = useNavigate();
6 |
7 | return (
8 |
18 | );
19 | }
20 |
21 | export default UnlaunchedButton;
22 |
--------------------------------------------------------------------------------
/apps/smart-forms-app/src/components/Header/Popovers/Popover.styles.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2024 Commonwealth Scientific and Industrial Research
3 | * Organisation (CSIRO) ABN 41 687 119 230.
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License");
6 | * you may not use this file except in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 |
18 | import { styled } from '@mui/material/styles';
19 | import { Box } from '@mui/material';
20 |
21 | export const PopoverMenuWrapper = styled(Box)({
22 | padding: '0 20px 0 20px',
23 | margin: '12px 0 12px 0'
24 | });
25 |
--------------------------------------------------------------------------------
/apps/smart-forms-app/src/data/images/csiro-logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aehrc/smart-forms/8f2c2ae79171bd85296e54c6cfe3cb66f17018d6/apps/smart-forms-app/src/data/images/csiro-logo.png
--------------------------------------------------------------------------------
/apps/smart-forms-app/src/features/dashboard/types/list.interface.ts:
--------------------------------------------------------------------------------
1 | import type { Questionnaire, QuestionnaireResponse } from 'fhir/r4';
2 |
3 | export interface QuestionnaireListItem {
4 | id: string;
5 | title: string;
6 | avatarColor: string;
7 | publisher: string;
8 | date: Date | null;
9 | status: Questionnaire['status'];
10 | }
11 |
12 | export interface ResponseListItem {
13 | id: string;
14 | title: string;
15 | avatarColor: string;
16 | author: string;
17 | authored: Date | null;
18 | status: QuestionnaireResponse['status'];
19 | }
20 |
--------------------------------------------------------------------------------
/apps/smart-forms-app/src/features/easterEgg/hooks/useClickCounter.ts:
--------------------------------------------------------------------------------
1 | import { useEffect, useState } from 'react';
2 |
3 | interface UseClickCounter {
4 | counter: number;
5 | addOneToCounter: () => void;
6 | }
7 |
8 | function useClickCounter(): UseClickCounter {
9 | const [counter, setCounter] = useState(0);
10 |
11 | useEffect(() => {
12 | if (counter === 3) {
13 | const timeoutId = setTimeout(() => {
14 | setCounter(0);
15 | }, 2500);
16 |
17 | return () => clearTimeout(timeoutId);
18 | }
19 | }, [counter]);
20 |
21 | return {
22 | counter,
23 | addOneToCounter: () => setCounter(counter + 1)
24 | };
25 | }
26 |
27 | export default useClickCounter;
28 |
--------------------------------------------------------------------------------
/apps/smart-forms-app/src/features/playground/styles/debugTable.css:
--------------------------------------------------------------------------------
1 | .console-table {
2 | width: 100%;
3 | border-collapse: collapse;
4 | font-family: monospace;
5 | font-size: 10px;
6 | }
7 |
8 | .console-table th,
9 | .console-table td {
10 | border: 1px solid #ddd;
11 | padding: 8px;
12 | text-align: left;
13 | }
14 |
15 | .console-table th {
16 | background-color: #f4f4f4;
17 | color: #333;
18 | font-weight: bold;
19 | }
20 |
21 | .console-table tr:nth-child(even) {
22 | background-color: #f9f9f9;
23 | }
24 |
--------------------------------------------------------------------------------
/apps/smart-forms-app/src/features/playground/typePredicates/isQuestionnaire.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2024 Commonwealth Scientific and Industrial Research
3 | * Organisation (CSIRO) ABN 41 687 119 230.
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License");
6 | * you may not use this file except in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 |
18 | import type { Questionnaire } from 'fhir/r4';
19 |
20 | export function isQuestionnaire(jsonObject: any): jsonObject is Questionnaire {
21 | return jsonObject.resourceType === 'Questionnaire';
22 | }
23 |
--------------------------------------------------------------------------------
/apps/smart-forms-app/src/features/playground/types/buildState.interface.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2024 Commonwealth Scientific and Industrial Research
3 | * Organisation (CSIRO) ABN 41 687 119 230.
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License");
6 | * you may not use this file except in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 |
18 | export type BuildState = 'idle' | 'building' | 'built';
19 |
--------------------------------------------------------------------------------
/apps/smart-forms-app/src/features/prepopulate/typePredicates/isRecord.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2024 Commonwealth Scientific and Industrial Research
3 | * Organisation (CSIRO) ABN 41 687 119 230.
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License");
6 | * you may not use this file except in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 |
18 | export function isRecord(obj: any): obj is Record {
19 | if (!obj) {
20 | return false;
21 | }
22 |
23 | return Object.keys(obj).every((key) => typeof key === 'string');
24 | }
25 |
--------------------------------------------------------------------------------
/apps/smart-forms-app/src/features/renderer/types/rendererSpinner.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2024 Commonwealth Scientific and Industrial Research
3 | * Organisation (CSIRO) ABN 41 687 119 230.
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License");
6 | * you may not use this file except in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 |
18 | export interface RendererSpinner {
19 | isSpinning: boolean;
20 | status:
21 | | 'prepopulate'
22 | | 'repopulate-fetch'
23 | | 'repopulate-cancel'
24 | | 'repopulate-write'
25 | | 'repopulated'
26 | | null;
27 | message: string;
28 | }
29 |
--------------------------------------------------------------------------------
/apps/smart-forms-app/src/features/standalone/data/AddVariablesTestGrid.json:
--------------------------------------------------------------------------------
1 | {
2 | "addVar1": {
3 | "url": "http://hl7.org/fhir/StructureDefinition/variable",
4 | "valueExpression": {
5 | "name": "addVar1",
6 | "language": "text/fhirpath",
7 | "expression": "%resource.item.where(linkId='grid').item.where(linkId='1').item.where(linkId='1.1').item.where(linkId='1.1.1').answer.value"
8 | }
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/apps/smart-forms-app/src/features/standalone/data/R715.json:
--------------------------------------------------------------------------------
1 | {
2 | "resourceType": "QuestionnaireResponse",
3 | "status": "in-progress",
4 | "item": [
5 | {
6 | "linkId": "fd5af92e-c248-497a-8007-ee0952ccd4d9",
7 | "item": [
8 | {
9 | "linkId": "5b224753-9365-44e3-823b-9c17e7394005",
10 | "text": "Patient Details",
11 | "item": [
12 | {
13 | "linkId": "e2a16e4d-2765-4b61-b286-82cfc6356b30",
14 | "text": "Age",
15 | "answer": [
16 | {
17 | "valueInteger": 30
18 | }
19 | ]
20 | }
21 | ]
22 | }
23 | ]
24 | }
25 | ],
26 | "questionnaire": "Questionnaire/AboriginalTorresStraitIslanderHealthCheck"
27 | }
28 |
--------------------------------------------------------------------------------
/apps/smart-forms-app/src/features/standalone/data/RTestGrid.json:
--------------------------------------------------------------------------------
1 | {
2 | "resourceType": "QuestionnaireResponse",
3 | "status": "in-progress",
4 | "item": [
5 | {
6 | "linkId": "grid",
7 | "text": "Grid",
8 | "item": [
9 | {
10 | "linkId": "1",
11 | "text": "Limb Observations",
12 | "item": [
13 | {
14 | "linkId": "1.1",
15 | "text": "Colour",
16 | "item": [
17 | {
18 | "linkId": "1.1.1",
19 | "text": "Left limb",
20 | "answer": [
21 | {
22 | "valueString": "Populated test answer"
23 | }
24 | ]
25 | }
26 | ]
27 | }
28 | ]
29 | }
30 | ]
31 | }
32 | ],
33 | "questionnaire": "Questionnaire/TestGrid"
34 | }
35 |
--------------------------------------------------------------------------------
/apps/smart-forms-app/src/features/tokenTimer/types/autosave.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2024 Commonwealth Scientific and Industrial Research
3 | * Organisation (CSIRO) ABN 41 687 119 230.
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License");
6 | * you may not use this file except in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 |
18 | export type AutoSaveStatus = 'shouldSave' | 'shouldNotSave' | 'saving' | 'saved';
19 |
--------------------------------------------------------------------------------
/apps/smart-forms-app/src/features/viewer/ViewerNav/ViewerOperationItem.tsx:
--------------------------------------------------------------------------------
1 | import { ListItemText } from '@mui/material';
2 | import type { OperationItem } from '../../../types/Nav.interface.ts';
3 | import { NavListItemButton, StyledNavItemIcon } from '../../../components/Nav/Nav.styles.ts';
4 |
5 | function ViewerOperationItem(props: OperationItem) {
6 | const { title, icon, disabled, onClick } = props;
7 |
8 | return (
9 |
14 | {icon}
15 |
16 |
17 |
18 | );
19 | }
20 |
21 | export default ViewerOperationItem;
22 |
--------------------------------------------------------------------------------
/apps/smart-forms-app/src/stores/selector.ts:
--------------------------------------------------------------------------------
1 | import type { StoreApi } from 'zustand';
2 | import { useStore } from 'zustand';
3 |
4 | type WithSelectors = S extends { getState: () => infer T }
5 | ? S & { use: { [K in keyof T]: () => T[K] } }
6 | : never;
7 |
8 | export const createSelectors = >(_store: S) => {
9 | const store = _store as WithSelectors;
10 | store.use = {};
11 | for (const k of Object.keys(store.getState())) {
12 | // eslint-disable-next-line react-hooks/rules-of-hooks
13 | (store.use as any)[k] = () => useStore(_store, (s) => s[k as keyof typeof s]);
14 | }
15 |
16 | return store;
17 | };
18 |
--------------------------------------------------------------------------------
/apps/smart-forms-app/src/types/Nav.interface.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2024 Commonwealth Scientific and Industrial Research
3 | * Organisation (CSIRO) ABN 41 687 119 230.
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License");
6 | * you may not use this file except in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 |
18 | import type { ReactNode } from 'react';
19 |
20 | export interface OperationItem {
21 | title: string;
22 | icon: ReactNode;
23 | disabled?: boolean;
24 | onClick: () => unknown;
25 | }
26 |
--------------------------------------------------------------------------------
/apps/smart-forms-app/src/types/printComponentRefContext.type.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2024 Commonwealth Scientific and Industrial Research
3 | * Organisation (CSIRO) ABN 41 687 119 230.
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License");
6 | * you may not use this file except in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 |
18 | import type { MutableRefObject } from 'react';
19 |
20 | export type PrintComponentRefContextType = {
21 | componentRef: MutableRefObject | null;
22 | };
23 |
--------------------------------------------------------------------------------
/apps/smart-forms-app/src/types/source.interface.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2024 Commonwealth Scientific and Industrial Research
3 | * Organisation (CSIRO) ABN 41 687 119 230.
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License");
6 | * you may not use this file except in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 |
18 | export type Source = 'local' | 'remote';
19 |
--------------------------------------------------------------------------------
/apps/smart-forms-app/src/utils/dayjsExtend.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2024 Commonwealth Scientific and Industrial Research
3 | * Organisation (CSIRO) ABN 41 687 119 230.
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License");
6 | * you may not use this file except in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 |
18 | import dayjs from 'dayjs';
19 | import localizedFormat from 'dayjs/plugin/localizedFormat';
20 | import customParseFormat from 'dayjs/plugin/customParseFormat';
21 |
22 | dayjs.extend(localizedFormat);
23 | dayjs.extend(customParseFormat);
24 |
--------------------------------------------------------------------------------
/apps/smart-forms-app/src/utils/qrItem.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2024 Commonwealth Scientific and Industrial Research
3 | * Organisation (CSIRO) ABN 41 687 119 230.
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License");
6 | * you may not use this file except in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 | import type { QuestionnaireResponse } from 'fhir/r4';
18 |
19 | export const emptyResponse: QuestionnaireResponse = {
20 | resourceType: 'QuestionnaireResponse',
21 | status: 'in-progress'
22 | };
23 |
--------------------------------------------------------------------------------
/apps/smart-forms-app/src/utils/snackbar.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2024 Commonwealth Scientific and Industrial Research
3 | * Organisation (CSIRO) ABN 41 687 119 230.
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License");
6 | * you may not use this file except in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 |
18 | export const saveErrorMessage = 'An error occurred while saving. Try again later.';
19 |
20 | export const saveSuccessMessage = 'Response saved';
21 | export const saveAsFinalSuccessMessage = 'Response saved as final';
22 |
--------------------------------------------------------------------------------
/apps/smart-forms-app/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "target": "ESNext",
4 | "module": "ESNext",
5 | "lib": ["DOM", "DOM.Iterable", "ESNext"],
6 | "allowJs": true,
7 | "skipLibCheck": true,
8 | "esModuleInterop": true,
9 | "allowSyntheticDefaultImports": true,
10 |
11 | /* Bundler mode */
12 | "moduleResolution": "bundler",
13 | "allowImportingTsExtensions": true,
14 | "resolveJsonModule": true,
15 | "isolatedModules": true,
16 | "noEmit": true,
17 | "jsx": "react-jsx",
18 |
19 | /* Linting */
20 | "strict": true,
21 | "noUnusedLocals": true,
22 | "noUnusedParameters": true,
23 | "noFallthroughCasesInSwitch": true,
24 | "forceConsistentCasingInFileNames": true,
25 |
26 | /* Debugging */
27 | "sourceMap": true
28 | },
29 | "include": ["src", "cypress"],
30 | "references": [{ "path": "./tsconfig.node.json" }]
31 | }
32 |
--------------------------------------------------------------------------------
/apps/smart-forms-app/tsconfig.node.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "composite": true,
4 | "skipLibCheck": true,
5 | "module": "ESNext",
6 | "moduleResolution": "bundler",
7 | "allowSyntheticDefaultImports": true
8 | },
9 | "include": ["vite.config.ts"]
10 | }
11 |
--------------------------------------------------------------------------------
/apps/smart-forms-app/vite.config.ts:
--------------------------------------------------------------------------------
1 | import { defineConfig, loadEnv } from 'vite';
2 | import react from '@vitejs/plugin-react';
3 | import svgr from 'vite-plugin-svgr';
4 | // @ts-ignore
5 | import packageJson from './package.json';
6 |
7 | // https://vitejs.dev/config/
8 | export default ({ mode }) => {
9 | process.env = { ...process.env, ...loadEnv(mode, process.cwd()) };
10 |
11 | return defineConfig({
12 | plugins: [react(), svgr()],
13 | define: {
14 | RENDERER_VERSION: JSON.stringify(packageJson.dependencies['@aehrc/smart-forms-renderer'])
15 | }
16 | });
17 | };
18 |
--------------------------------------------------------------------------------
/assets/calculation.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aehrc/smart-forms/8f2c2ae79171bd85296e54c6cfe3cb66f17018d6/assets/calculation.png
--------------------------------------------------------------------------------
/assets/enablewhen-age-groups.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aehrc/smart-forms/8f2c2ae79171bd85296e54c6cfe3cb66f17018d6/assets/enablewhen-age-groups.png
--------------------------------------------------------------------------------
/assets/generic-form.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aehrc/smart-forms/8f2c2ae79171bd85296e54c6cfe3cb66f17018d6/assets/generic-form.png
--------------------------------------------------------------------------------
/assets/ontoserver-expand.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aehrc/smart-forms/8f2c2ae79171bd85296e54c6cfe3cb66f17018d6/assets/ontoserver-expand.png
--------------------------------------------------------------------------------
/assets/population-medical-history.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aehrc/smart-forms/8f2c2ae79171bd85296e54c6cfe3cb66f17018d6/assets/population-medical-history.png
--------------------------------------------------------------------------------
/assets/population-patient-details.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aehrc/smart-forms/8f2c2ae79171bd85296e54c6cfe3cb66f17018d6/assets/population-patient-details.png
--------------------------------------------------------------------------------
/assets/preview.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aehrc/smart-forms/8f2c2ae79171bd85296e54c6cfe3cb66f17018d6/assets/preview.png
--------------------------------------------------------------------------------
/assets/responses.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aehrc/smart-forms/8f2c2ae79171bd85296e54c6cfe3cb66f17018d6/assets/responses.png
--------------------------------------------------------------------------------
/deployment/ehr-proxy/ehr-proxy-app/.gitignore:
--------------------------------------------------------------------------------
1 | *.js
2 | !jest.config.js
3 | *.d.ts
4 | node_modules
5 |
6 | # CDK asset staging directory
7 | .cdk.staging
8 | cdk.out
9 |
--------------------------------------------------------------------------------
/deployment/ehr-proxy/ehr-proxy-app/.npmignore:
--------------------------------------------------------------------------------
1 | *.ts
2 | !*.d.ts
3 |
4 | # CDK asset staging directory
5 | .cdk.staging
6 | cdk.out
7 |
--------------------------------------------------------------------------------
/deployment/ehr-proxy/ehr-proxy-app/README.md:
--------------------------------------------------------------------------------
1 | # Welcome to your CDK TypeScript project
2 |
3 | This is a blank project for CDK development with TypeScript.
4 |
5 | The `cdk.json` file tells the CDK Toolkit how to execute your app.
6 |
7 | ## Useful commands
8 |
9 | * `npm run build` compile typescript to js
10 | * `npm run watch` watch for changes and compile
11 | * `npm run test` perform the jest unit tests
12 | * `cdk deploy` deploy this stack to your default AWS account/region
13 | * `cdk diff` compare deployed stack with current state
14 | * `cdk synth` emits the synthesized CloudFormation template
15 |
--------------------------------------------------------------------------------
/deployment/ehr-proxy/ehr-proxy-app/jest.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | testEnvironment: 'node',
3 | roots: ['/test'],
4 | testMatch: ['**/*.test.ts'],
5 | transform: {
6 | '^.+\\.tsx?$': 'ts-jest'
7 | }
8 | };
9 |
--------------------------------------------------------------------------------
/deployment/ehr-proxy/ehr-proxy-app/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "ehr-proxy-app",
3 | "version": "0.1.0",
4 | "bin": {
5 | "ehr-proxy-app": "bin/ehr-proxy-app.js"
6 | },
7 | "scripts": {
8 | "build": "tsc",
9 | "watch": "tsc -w",
10 | "test": "jest",
11 | "cdk": "cdk"
12 | },
13 | "devDependencies": {
14 | "@types/jest": "^29.5.12",
15 | "@types/node": "22.15.29",
16 | "jest": "^29.7.0",
17 | "ts-jest": "^29.1.1",
18 | "aws-cdk": "2.135.0",
19 | "ts-node": "^10.9.2",
20 | "typescript": "~5.8.3"
21 | },
22 | "dependencies": {
23 | "aws-cdk-lib": "2.193.0",
24 | "constructs": "^10.3.0",
25 | "source-map-support": "^0.5.21",
26 | "ehr-proxy-hapi-endpoint": "^0.1.0",
27 | "ehr-proxy-smart-proxy": "^0.1.0",
28 | "ehr-proxy-transform-endpoint": "^0.1.0",
29 | "ehr-proxy-extract-endpoint": "^0.1.0"
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/deployment/ehr-proxy/ehr-proxy-app/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "target": "ES2020",
4 | "module": "commonjs",
5 | "lib": ["es2020", "dom"],
6 | "declaration": true,
7 | "strict": true,
8 | "noImplicitAny": true,
9 | "strictNullChecks": true,
10 | "noImplicitThis": true,
11 | "alwaysStrict": true,
12 | "noUnusedLocals": false,
13 | "noUnusedParameters": false,
14 | "noImplicitReturns": true,
15 | "noFallthroughCasesInSwitch": false,
16 | "inlineSourceMap": true,
17 | "inlineSources": true,
18 | "experimentalDecorators": true,
19 | "strictPropertyInitialization": false,
20 | "typeRoots": ["./node_modules/@types"]
21 | },
22 | "exclude": ["node_modules", "cdk.out"]
23 | }
24 |
--------------------------------------------------------------------------------
/deployment/ehr-proxy/extract-endpoint/.gitignore:
--------------------------------------------------------------------------------
1 | *.js
2 | !jest.config.js
3 | *.d.ts
4 | node_modules
5 |
6 | # CDK asset staging directory
7 | .cdk.staging
8 | cdk.out
9 |
--------------------------------------------------------------------------------
/deployment/ehr-proxy/extract-endpoint/.npmignore:
--------------------------------------------------------------------------------
1 | *.ts
2 | !*.d.ts
3 |
4 | # CDK asset staging directory
5 | .cdk.staging
6 | cdk.out
7 |
--------------------------------------------------------------------------------
/deployment/ehr-proxy/extract-endpoint/README.md:
--------------------------------------------------------------------------------
1 | # Welcome to your CDK TypeScript project
2 |
3 | This is a blank project for CDK development with TypeScript.
4 |
5 | The `cdk.json` file tells the CDK Toolkit how to execute your app.
6 |
7 | ## Useful commands
8 |
9 | * `npm run build` compile typescript to js
10 | * `npm run watch` watch for changes and compile
11 | * `npm run test` perform the jest unit tests
12 | * `cdk deploy` deploy this stack to your default AWS account/region
13 | * `cdk diff` compare deployed stack with current state
14 | * `cdk synth` emits the synthesized CloudFormation template
15 |
--------------------------------------------------------------------------------
/deployment/ehr-proxy/extract-endpoint/jest.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | testEnvironment: 'node',
3 | roots: ['/test'],
4 | testMatch: ['**/*.test.ts'],
5 | transform: {
6 | '^.+\\.tsx?$': 'ts-jest'
7 | }
8 | };
9 |
--------------------------------------------------------------------------------
/deployment/ehr-proxy/extract-endpoint/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "ehr-proxy-extract-endpoint",
3 | "version": "0.1.0",
4 | "main": "lib/index.js",
5 | "types": "lib/index.d.ts",
6 | "scripts": {
7 | "build": "tsc",
8 | "watch": "tsc -w",
9 | "test": "jest"
10 | },
11 | "devDependencies": {
12 | "@types/jest": "^29.5.5",
13 | "@types/node": "22.15.29",
14 | "aws-cdk-lib": "2.193.0",
15 | "constructs": "^10.0.0",
16 | "jest": "^29.7.0",
17 | "ts-jest": "^29.1.1",
18 | "typescript": "~5.8.3"
19 | },
20 | "dependencies": {
21 | "aws-cdk-lib": "2.193.0",
22 | "constructs": "^10.0.0",
23 | "source-map-support": "^0.5.21"
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/deployment/ehr-proxy/extract-endpoint/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "target": "ES2020",
4 | "module": "commonjs",
5 | "lib": ["es2020", "dom"],
6 | "declaration": true,
7 | "strict": true,
8 | "noImplicitAny": true,
9 | "strictNullChecks": true,
10 | "noImplicitThis": true,
11 | "alwaysStrict": true,
12 | "noUnusedLocals": false,
13 | "noUnusedParameters": false,
14 | "noImplicitReturns": true,
15 | "noFallthroughCasesInSwitch": false,
16 | "inlineSourceMap": true,
17 | "inlineSources": true,
18 | "experimentalDecorators": true,
19 | "strictPropertyInitialization": false,
20 | "typeRoots": ["./node_modules/@types"]
21 | },
22 | "exclude": ["node_modules", "cdk.out"]
23 | }
24 |
--------------------------------------------------------------------------------
/deployment/ehr-proxy/hapi-endpoint/.gitignore:
--------------------------------------------------------------------------------
1 | *.js
2 | !jest.config.js
3 | *.d.ts
4 | node_modules
5 |
6 | # CDK asset staging directory
7 | .cdk.staging
8 | cdk.out
9 |
--------------------------------------------------------------------------------
/deployment/ehr-proxy/hapi-endpoint/.npmignore:
--------------------------------------------------------------------------------
1 | *.ts
2 | !*.d.ts
3 |
4 | # CDK asset staging directory
5 | .cdk.staging
6 | cdk.out
7 |
--------------------------------------------------------------------------------
/deployment/ehr-proxy/hapi-endpoint/README.md:
--------------------------------------------------------------------------------
1 | # Welcome to your CDK TypeScript Construct Library project
2 |
3 | You should explore the contents of this project. It demonstrates a CDK Construct Library that includes a construct (`HapiEndpoint`)
4 | which contains an Amazon SQS queue that is subscribed to an Amazon SNS topic.
5 |
6 | The construct defines an interface (`HapiEndpointProps`) to configure the visibility timeout of the queue.
7 |
8 | ## Useful commands
9 |
10 | * `npm run build` compile typescript to js
11 | * `npm run watch` watch for changes and compile
12 | * `npm run test` perform the jest unit tests
13 |
--------------------------------------------------------------------------------
/deployment/ehr-proxy/hapi-endpoint/jest.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | testEnvironment: 'node',
3 | roots: ['/test'],
4 | testMatch: ['**/*.test.ts'],
5 | transform: {
6 | '^.+\\.tsx?$': 'ts-jest'
7 | }
8 | };
9 |
--------------------------------------------------------------------------------
/deployment/ehr-proxy/hapi-endpoint/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "ehr-proxy-hapi-endpoint",
3 | "version": "0.1.0",
4 | "main": "lib/index.js",
5 | "types": "lib/index.d.ts",
6 | "scripts": {
7 | "build": "tsc",
8 | "watch": "tsc -w",
9 | "test": "jest"
10 | },
11 | "devDependencies": {
12 | "@types/jest": "^29.5.12",
13 | "@types/node": "22.15.29",
14 | "aws-cdk-lib": "2.193.0",
15 | "constructs": "^10.3.0",
16 | "jest": "^29.7.0",
17 | "ts-jest": "^29.1.1",
18 | "typescript": "~5.8.3"
19 | },
20 | "peerDependencies": {
21 | "aws-cdk-lib": "2.193.0",
22 | "constructs": "^10.3.0"
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/deployment/ehr-proxy/hapi-endpoint/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "target": "ES2020",
4 | "module": "commonjs",
5 | "lib": ["es2020", "dom"],
6 | "declaration": true,
7 | "strict": true,
8 | "noImplicitAny": true,
9 | "strictNullChecks": true,
10 | "noImplicitThis": true,
11 | "alwaysStrict": true,
12 | "noUnusedLocals": false,
13 | "noUnusedParameters": false,
14 | "noImplicitReturns": true,
15 | "noFallthroughCasesInSwitch": false,
16 | "inlineSourceMap": true,
17 | "inlineSources": true,
18 | "experimentalDecorators": true,
19 | "strictPropertyInitialization": false,
20 | "typeRoots": ["./node_modules/@types"]
21 | },
22 | "exclude": ["node_modules", "cdk.out"]
23 | }
24 |
--------------------------------------------------------------------------------
/deployment/ehr-proxy/smart-proxy/.gitignore:
--------------------------------------------------------------------------------
1 | *.js
2 | !jest.config.js
3 | *.d.ts
4 | node_modules
5 |
6 | # CDK asset staging directory
7 | .cdk.staging
8 | cdk.out
9 |
--------------------------------------------------------------------------------
/deployment/ehr-proxy/smart-proxy/.npmignore:
--------------------------------------------------------------------------------
1 | *.ts
2 | !*.d.ts
3 |
4 | # CDK asset staging directory
5 | .cdk.staging
6 | cdk.out
7 |
--------------------------------------------------------------------------------
/deployment/ehr-proxy/smart-proxy/README.md:
--------------------------------------------------------------------------------
1 | # Welcome to your CDK TypeScript Construct Library project
2 |
3 | You should explore the contents of this project. It demonstrates a CDK Construct Library that includes a construct (`SmartProxy`)
4 | which contains an Amazon SQS queue that is subscribed to an Amazon SNS topic.
5 |
6 | The construct defines an interface (`SmartProxyProps`) to configure the visibility timeout of the queue.
7 |
8 | ## Useful commands
9 |
10 | * `npm run build` compile typescript to js
11 | * `npm run watch` watch for changes and compile
12 | * `npm run test` perform the jest unit tests
13 |
--------------------------------------------------------------------------------
/deployment/ehr-proxy/smart-proxy/jest.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | testEnvironment: 'node',
3 | roots: ['/test'],
4 | testMatch: ['**/*.test.ts'],
5 | transform: {
6 | '^.+\\.tsx?$': 'ts-jest'
7 | }
8 | };
9 |
--------------------------------------------------------------------------------
/deployment/ehr-proxy/smart-proxy/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "ehr-proxy-smart-proxy",
3 | "version": "0.1.0",
4 | "main": "lib/index.js",
5 | "types": "lib/index.d.ts",
6 | "scripts": {
7 | "build": "tsc",
8 | "watch": "tsc -w",
9 | "test": "jest"
10 | },
11 | "devDependencies": {
12 | "@types/jest": "^29.5.12",
13 | "@types/node": "22.15.29",
14 | "aws-cdk-lib": "2.193.0",
15 | "constructs": "^10.3.0",
16 | "jest": "^29.7.0",
17 | "ts-jest": "^29.1.1",
18 | "typescript": "~5.8.3"
19 | },
20 | "peerDependencies": {
21 | "aws-cdk-lib": "2.193.0",
22 | "constructs": "^10.3.0"
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/deployment/ehr-proxy/smart-proxy/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "target": "ES2020",
4 | "module": "commonjs",
5 | "lib": ["es2020", "dom"],
6 | "declaration": true,
7 | "strict": true,
8 | "noImplicitAny": true,
9 | "strictNullChecks": true,
10 | "noImplicitThis": true,
11 | "alwaysStrict": true,
12 | "noUnusedLocals": false,
13 | "noUnusedParameters": false,
14 | "noImplicitReturns": true,
15 | "noFallthroughCasesInSwitch": false,
16 | "inlineSourceMap": true,
17 | "inlineSources": true,
18 | "experimentalDecorators": true,
19 | "strictPropertyInitialization": false,
20 | "typeRoots": ["./node_modules/@types"]
21 | },
22 | "exclude": ["node_modules", "cdk.out"]
23 | }
24 |
--------------------------------------------------------------------------------
/deployment/ehr-proxy/transform-endpoint/.gitignore:
--------------------------------------------------------------------------------
1 | *.js
2 | !jest.config.js
3 | *.d.ts
4 | node_modules
5 |
6 | # CDK asset staging directory
7 | .cdk.staging
8 | cdk.out
9 |
--------------------------------------------------------------------------------
/deployment/ehr-proxy/transform-endpoint/.npmignore:
--------------------------------------------------------------------------------
1 | *.ts
2 | !*.d.ts
3 |
4 | # CDK asset staging directory
5 | .cdk.staging
6 | cdk.out
7 |
--------------------------------------------------------------------------------
/deployment/ehr-proxy/transform-endpoint/README.md:
--------------------------------------------------------------------------------
1 | # Welcome to your CDK TypeScript project
2 |
3 | This is a blank project for CDK development with TypeScript.
4 |
5 | The `cdk.json` file tells the CDK Toolkit how to execute your app.
6 |
7 | ## Useful commands
8 |
9 | * `npm run build` compile typescript to js
10 | * `npm run watch` watch for changes and compile
11 | * `npm run test` perform the jest unit tests
12 | * `cdk deploy` deploy this stack to your default AWS account/region
13 | * `cdk diff` compare deployed stack with current state
14 | * `cdk synth` emits the synthesized CloudFormation template
15 |
--------------------------------------------------------------------------------
/deployment/ehr-proxy/transform-endpoint/jest.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | testEnvironment: 'node',
3 | roots: ['/test'],
4 | testMatch: ['**/*.test.ts'],
5 | transform: {
6 | '^.+\\.tsx?$': 'ts-jest'
7 | }
8 | };
9 |
--------------------------------------------------------------------------------
/deployment/ehr-proxy/transform-endpoint/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "ehr-proxy-transform-endpoint",
3 | "version": "0.1.0",
4 | "main": "lib/index.js",
5 | "types": "lib/index.d.ts",
6 | "scripts": {
7 | "build": "tsc",
8 | "watch": "tsc -w",
9 | "test": "jest"
10 | },
11 | "devDependencies": {
12 | "@types/jest": "^29.5.5",
13 | "@types/node": "22.15.29",
14 | "aws-cdk-lib": "2.193.0",
15 | "constructs": "^10.3.0",
16 | "jest": "^29.7.0",
17 | "ts-jest": "^29.1.1",
18 | "typescript": "~5.8.3"
19 | },
20 | "dependencies": {
21 | "aws-cdk-lib": "2.193.0",
22 | "constructs": "^10.3.0",
23 | "source-map-support": "^0.5.21"
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/deployment/ehr-proxy/transform-endpoint/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "target": "ES2020",
4 | "module": "commonjs",
5 | "lib": ["es2020", "dom"],
6 | "declaration": true,
7 | "strict": true,
8 | "noImplicitAny": true,
9 | "strictNullChecks": true,
10 | "noImplicitThis": true,
11 | "alwaysStrict": true,
12 | "noUnusedLocals": false,
13 | "noUnusedParameters": false,
14 | "noImplicitReturns": true,
15 | "noFallthroughCasesInSwitch": false,
16 | "inlineSourceMap": true,
17 | "inlineSources": true,
18 | "experimentalDecorators": true,
19 | "strictPropertyInitialization": false,
20 | "typeRoots": ["./node_modules/@types"]
21 | },
22 | "exclude": ["node_modules", "cdk.out"]
23 | }
24 |
--------------------------------------------------------------------------------
/deployment/forms-server/assemble-endpoint/.gitignore:
--------------------------------------------------------------------------------
1 | *.js
2 | !jest.config.js
3 | *.d.ts
4 | node_modules
5 |
6 | # CDK asset staging directory
7 | .cdk.staging
8 | cdk.out
9 |
--------------------------------------------------------------------------------
/deployment/forms-server/assemble-endpoint/.npmignore:
--------------------------------------------------------------------------------
1 | *.ts
2 | !*.d.ts
3 |
4 | # CDK asset staging directory
5 | .cdk.staging
6 | cdk.out
7 |
--------------------------------------------------------------------------------
/deployment/forms-server/assemble-endpoint/README.md:
--------------------------------------------------------------------------------
1 | # Welcome to your CDK TypeScript Construct Library project
2 |
3 | You should explore the contents of this project. It demonstrates a CDK Construct Library that includes a construct (`AssembleEndpoint`)
4 | which contains an Amazon SQS queue that is subscribed to an Amazon SNS topic.
5 |
6 | The construct defines an interface (`AssembleEndpointProps`) to configure the visibility timeout of the queue.
7 |
8 | ## Useful commands
9 |
10 | * `npm run build` compile typescript to js
11 | * `npm run watch` watch for changes and compile
12 | * `npm run test` perform the jest unit tests
13 |
--------------------------------------------------------------------------------
/deployment/forms-server/assemble-endpoint/jest.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | testEnvironment: 'node',
3 | roots: ['/test'],
4 | testMatch: ['**/*.test.ts'],
5 | transform: {
6 | '^.+\\.tsx?$': 'ts-jest'
7 | }
8 | };
9 |
--------------------------------------------------------------------------------
/deployment/forms-server/assemble-endpoint/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "forms-server-assemble-endpoint",
3 | "version": "0.1.0",
4 | "main": "lib/index.js",
5 | "types": "lib/index.d.ts",
6 | "scripts": {
7 | "build": "tsc",
8 | "watch": "tsc -w",
9 | "test": "jest"
10 | },
11 | "devDependencies": {
12 | "@types/jest": "^29.5.12",
13 | "@types/node": "22.15.29",
14 | "aws-cdk-lib": "2.193.0",
15 | "constructs": "^10.3.0",
16 | "jest": "^29.7.0",
17 | "ts-jest": "^29.1.1",
18 | "typescript": "~5.8.3"
19 | },
20 | "peerDependencies": {
21 | "aws-cdk-lib": "2.193.0",
22 | "constructs": "^10.3.0"
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/deployment/forms-server/assemble-endpoint/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "target": "ES2020",
4 | "module": "commonjs",
5 | "lib": ["es2020", "dom"],
6 | "declaration": true,
7 | "strict": true,
8 | "noImplicitAny": true,
9 | "strictNullChecks": true,
10 | "noImplicitThis": true,
11 | "alwaysStrict": true,
12 | "noUnusedLocals": false,
13 | "noUnusedParameters": false,
14 | "noImplicitReturns": true,
15 | "noFallthroughCasesInSwitch": false,
16 | "inlineSourceMap": true,
17 | "inlineSources": true,
18 | "experimentalDecorators": true,
19 | "strictPropertyInitialization": false,
20 | "typeRoots": ["./node_modules/@types"]
21 | },
22 | "exclude": ["node_modules", "cdk.out"]
23 | }
24 |
--------------------------------------------------------------------------------
/deployment/forms-server/forms-server-app/.gitignore:
--------------------------------------------------------------------------------
1 | *.js
2 | !jest.config.js
3 | *.d.ts
4 | node_modules
5 |
6 | # CDK asset staging directory
7 | .cdk.staging
8 | cdk.out
9 |
--------------------------------------------------------------------------------
/deployment/forms-server/forms-server-app/.npmignore:
--------------------------------------------------------------------------------
1 | *.ts
2 | !*.d.ts
3 |
4 | # CDK asset staging directory
5 | .cdk.staging
6 | cdk.out
7 |
--------------------------------------------------------------------------------
/deployment/forms-server/forms-server-app/README.md:
--------------------------------------------------------------------------------
1 | # Welcome to your CDK TypeScript project
2 |
3 | This is a blank project for CDK development with TypeScript.
4 |
5 | The `cdk.json` file tells the CDK Toolkit how to execute your app.
6 |
7 | ## Useful commands
8 |
9 | * `npm run build` compile typescript to js
10 | * `npm run watch` watch for changes and compile
11 | * `npm run test` perform the jest unit tests
12 | * `cdk deploy` deploy this stack to your default AWS account/region
13 | * `cdk diff` compare deployed stack with current state
14 | * `cdk synth` emits the synthesized CloudFormation template
15 |
--------------------------------------------------------------------------------
/deployment/forms-server/forms-server-app/jest.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | testEnvironment: 'node',
3 | roots: ['/test'],
4 | testMatch: ['**/*.test.ts'],
5 | transform: {
6 | '^.+\\.tsx?$': 'ts-jest'
7 | }
8 | };
9 |
--------------------------------------------------------------------------------
/deployment/forms-server/forms-server-app/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "forms-server-app",
3 | "version": "0.1.0",
4 | "bin": {
5 | "forms-server-app": "bin/forms-server-app.js"
6 | },
7 | "scripts": {
8 | "build": "tsc",
9 | "watch": "tsc -w",
10 | "test": "jest",
11 | "cdk": "cdk"
12 | },
13 | "devDependencies": {
14 | "@types/jest": "^29.5.12",
15 | "@types/node": "22.15.29",
16 | "jest": "^29.7.0",
17 | "ts-jest": "^29.1.1",
18 | "aws-cdk": "2.135.0",
19 | "ts-node": "^10.9.2",
20 | "typescript": "~5.8.3"
21 | },
22 | "dependencies": {
23 | "aws-cdk-lib": "2.193.0",
24 | "constructs": "^10.3.0",
25 | "source-map-support": "^0.5.21",
26 | "forms-server-assemble-endpoint": "^0.1.0",
27 | "forms-server-hapi-endpoint": "^0.1.0",
28 | "forms-server-populate-endpoint": "^0.1.0"
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/deployment/forms-server/forms-server-app/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "target": "ES2020",
4 | "module": "commonjs",
5 | "lib": ["es2020", "dom"],
6 | "declaration": true,
7 | "strict": true,
8 | "noImplicitAny": true,
9 | "strictNullChecks": true,
10 | "noImplicitThis": true,
11 | "alwaysStrict": true,
12 | "noUnusedLocals": false,
13 | "noUnusedParameters": false,
14 | "noImplicitReturns": true,
15 | "noFallthroughCasesInSwitch": false,
16 | "inlineSourceMap": true,
17 | "inlineSources": true,
18 | "experimentalDecorators": true,
19 | "strictPropertyInitialization": false,
20 | "typeRoots": ["./node_modules/@types"]
21 | },
22 | "exclude": ["node_modules", "cdk.out"]
23 | }
24 |
--------------------------------------------------------------------------------
/deployment/forms-server/hapi-endpoint/.gitignore:
--------------------------------------------------------------------------------
1 | *.js
2 | !jest.config.js
3 | *.d.ts
4 | node_modules
5 |
6 | # CDK asset staging directory
7 | .cdk.staging
8 | cdk.out
9 |
--------------------------------------------------------------------------------
/deployment/forms-server/hapi-endpoint/.npmignore:
--------------------------------------------------------------------------------
1 | *.ts
2 | !*.d.ts
3 |
4 | # CDK asset staging directory
5 | .cdk.staging
6 | cdk.out
7 |
--------------------------------------------------------------------------------
/deployment/forms-server/hapi-endpoint/README.md:
--------------------------------------------------------------------------------
1 | # Welcome to your CDK TypeScript Construct Library project
2 |
3 | You should explore the contents of this project. It demonstrates a CDK Construct Library that includes a construct (`HapiEndpoint`)
4 | which contains an Amazon SQS queue that is subscribed to an Amazon SNS topic.
5 |
6 | The construct defines an interface (`HapiEndpointProps`) to configure the visibility timeout of the queue.
7 |
8 | ## Useful commands
9 |
10 | * `npm run build` compile typescript to js
11 | * `npm run watch` watch for changes and compile
12 | * `npm run test` perform the jest unit tests
13 |
--------------------------------------------------------------------------------
/deployment/forms-server/hapi-endpoint/jest.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | testEnvironment: 'node',
3 | roots: ['/test'],
4 | testMatch: ['**/*.test.ts'],
5 | transform: {
6 | '^.+\\.tsx?$': 'ts-jest'
7 | }
8 | };
9 |
--------------------------------------------------------------------------------
/deployment/forms-server/hapi-endpoint/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "forms-server-hapi-endpoint",
3 | "version": "0.1.0",
4 | "main": "lib/index.js",
5 | "types": "lib/index.d.ts",
6 | "scripts": {
7 | "build": "tsc",
8 | "watch": "tsc -w",
9 | "test": "jest"
10 | },
11 | "devDependencies": {
12 | "@types/jest": "^29.5.12",
13 | "@types/node": "22.15.29",
14 | "aws-cdk-lib": "2.193.0",
15 | "constructs": "^10.3.0",
16 | "jest": "^29.7.0",
17 | "ts-jest": "^29.1.1",
18 | "typescript": "~5.8.3"
19 | },
20 | "peerDependencies": {
21 | "aws-cdk-lib": "2.193.0",
22 | "constructs": "^10.3.0"
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/deployment/forms-server/hapi-endpoint/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "target": "ES2020",
4 | "module": "commonjs",
5 | "lib": ["es2020", "dom"],
6 | "declaration": true,
7 | "strict": true,
8 | "noImplicitAny": true,
9 | "strictNullChecks": true,
10 | "noImplicitThis": true,
11 | "alwaysStrict": true,
12 | "noUnusedLocals": false,
13 | "noUnusedParameters": false,
14 | "noImplicitReturns": true,
15 | "noFallthroughCasesInSwitch": false,
16 | "inlineSourceMap": true,
17 | "inlineSources": true,
18 | "experimentalDecorators": true,
19 | "strictPropertyInitialization": false,
20 | "typeRoots": ["./node_modules/@types"]
21 | },
22 | "exclude": ["node_modules", "cdk.out"]
23 | }
24 |
--------------------------------------------------------------------------------
/deployment/forms-server/populate-endpoint/.gitignore:
--------------------------------------------------------------------------------
1 | *.js
2 | !jest.config.js
3 | *.d.ts
4 | node_modules
5 |
6 | # CDK asset staging directory
7 | .cdk.staging
8 | cdk.out
9 |
--------------------------------------------------------------------------------
/deployment/forms-server/populate-endpoint/.npmignore:
--------------------------------------------------------------------------------
1 | *.ts
2 | !*.d.ts
3 |
4 | # CDK asset staging directory
5 | .cdk.staging
6 | cdk.out
7 |
--------------------------------------------------------------------------------
/deployment/forms-server/populate-endpoint/README.md:
--------------------------------------------------------------------------------
1 | # Welcome to your CDK TypeScript Construct Library project
2 |
3 | You should explore the contents of this project. It demonstrates a CDK Construct Library that includes a construct (`PopulateEndpoint`)
4 | which contains an Amazon SQS queue that is subscribed to an Amazon SNS topic.
5 |
6 | The construct defines an interface (`PopulateEndpointProps`) to configure the visibility timeout of the queue.
7 |
8 | ## Useful commands
9 |
10 | * `npm run build` compile typescript to js
11 | * `npm run watch` watch for changes and compile
12 | * `npm run test` perform the jest unit tests
13 |
--------------------------------------------------------------------------------
/deployment/forms-server/populate-endpoint/jest.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | testEnvironment: 'node',
3 | roots: ['/test'],
4 | testMatch: ['**/*.test.ts'],
5 | transform: {
6 | '^.+\\.tsx?$': 'ts-jest'
7 | }
8 | };
9 |
--------------------------------------------------------------------------------
/deployment/forms-server/populate-endpoint/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "forms-server-populate-endpoint",
3 | "version": "0.1.0",
4 | "main": "lib/index.js",
5 | "types": "lib/index.d.ts",
6 | "scripts": {
7 | "build": "tsc",
8 | "watch": "tsc -w",
9 | "test": "jest"
10 | },
11 | "devDependencies": {
12 | "@types/jest": "^29.5.12",
13 | "@types/node": "22.15.29",
14 | "aws-cdk-lib": "2.193.0",
15 | "constructs": "^10.3.0",
16 | "jest": "^29.7.0",
17 | "ts-jest": "^29.1.1",
18 | "typescript": "~5.8.3"
19 | },
20 | "peerDependencies": {
21 | "aws-cdk-lib": "2.193.0",
22 | "constructs": "^10.3.0"
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/deployment/forms-server/populate-endpoint/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "target": "ES2020",
4 | "module": "commonjs",
5 | "lib": ["es2020", "dom"],
6 | "declaration": true,
7 | "strict": true,
8 | "noImplicitAny": true,
9 | "strictNullChecks": true,
10 | "noImplicitThis": true,
11 | "alwaysStrict": true,
12 | "noUnusedLocals": false,
13 | "noUnusedParameters": false,
14 | "noImplicitReturns": true,
15 | "noFallthroughCasesInSwitch": false,
16 | "inlineSourceMap": true,
17 | "inlineSources": true,
18 | "experimentalDecorators": true,
19 | "strictPropertyInitialization": false,
20 | "typeRoots": ["./node_modules/@types"]
21 | },
22 | "exclude": ["node_modules", "cdk.out"]
23 | }
24 |
--------------------------------------------------------------------------------
/documentation/.gitignore:
--------------------------------------------------------------------------------
1 | # Dependencies
2 | /node_modules
3 |
4 | # Production
5 | /build
6 |
7 | # Generated files
8 | .docusaurus
9 | .cache-loader
10 |
11 | # Misc
12 | .DS_Store
13 | .env.local
14 | .env.development.local
15 | .env.test.local
16 | .env.production.local
17 |
18 | npm-debug.log*
19 | yarn-debug.log*
20 | yarn-error.log*
21 |
--------------------------------------------------------------------------------
/documentation/README.md:
--------------------------------------------------------------------------------
1 | # Website
2 |
3 | This website is built using [Docusaurus](https://docusaurus.io/), a modern static website generator.
4 |
5 | ### Installation
6 |
7 | ```
8 | $ yarn
9 | ```
10 |
11 | ### Local Development
12 |
13 | ```
14 | $ yarn start
15 | ```
16 |
17 | This command starts a local development server and opens up a browser window. Most changes are reflected live without having to restart the server.
18 |
19 | ### Build
20 |
21 | ```
22 | $ yarn build
23 | ```
24 |
25 | This command generates static content into the `build` directory and can be served using any static contents hosting service.
26 |
27 | ### Deployment
28 |
29 | Using SSH:
30 |
31 | ```
32 | $ USE_SSH=true yarn deploy
33 | ```
34 |
35 | Not using SSH:
36 |
37 | ```
38 | $ GIT_USER= yarn deploy
39 | ```
40 |
41 | If you are using GitHub pages for hosting, this command is a convenient way to build the website and push to the `gh-pages` branch.
42 |
--------------------------------------------------------------------------------
/documentation/babel.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | presets: [require.resolve('@docusaurus/core/lib/babel/preset')]
3 | };
4 |
--------------------------------------------------------------------------------
/documentation/docs/api/index.mdx:
--------------------------------------------------------------------------------
1 | ---
2 | sidebar_position: 1
3 | sidebar_label: Introduction
4 | ---
5 |
6 | # API Reference
7 |
8 | This section is automatically generated from the source code using [TypeDoc and its plugin for Docusaurus](https://github.com/typedoc2md/typedoc-plugin-markdown/tree/main/packages/docusaurus-plugin-typedoc#readme).
9 |
10 | It provides a full coverage of the exposed API of [@aehrc/smart-forms-renderer](https://www.npmjs.com/package/@aehrc/smart-forms-renderer), [@aehrc/sdc-populate](https://www.npmjs.com/package/@aehrc/sdc-populate) and [@aehrc/sdc-assemble](https://www.npmjs.com/package/@aehrc/sdc-assemble).
11 |
--------------------------------------------------------------------------------
/documentation/docs/api/sdc-assemble/functions/isInputParameters.md:
--------------------------------------------------------------------------------
1 | # Function: isInputParameters()
2 |
3 | > **isInputParameters**(`parameters`): `parameters is InputParameters`
4 |
5 | Check if the given parameters is a valid InputParameters for $assemble
6 |
7 | ## Parameters
8 |
9 | | Parameter | Type | Description |
10 | | ------ | ------ | ------ |
11 | | `parameters` | `Parameters` | a given Parameters resource |
12 |
13 | ## Returns
14 |
15 | `parameters is InputParameters`
16 |
17 | boolean value of whether the given parameters is InputParameters
18 |
19 | ## See
20 |
21 | [http://hl7.org/fhir/uv/sdc/OperationDefinition/Questionnaire-assemble](http://hl7.org/fhir/uv/sdc/OperationDefinition/Questionnaire-assemble)
22 |
--------------------------------------------------------------------------------
/documentation/docs/api/sdc-assemble/index.md:
--------------------------------------------------------------------------------
1 | # @aehrc/sdc-assemble
2 |
3 | ## Interfaces
4 |
5 | | Interface | Description |
6 | | ------ | ------ |
7 | | [FetchQuestionnaireCallback](interfaces/FetchQuestionnaireCallback.md) | To define a method to fetch Questionnaire resources from the FHIR server with the given canonical URL |
8 | | [InputParameters](interfaces/InputParameters.md) | Input parameters for the $assemble operation |
9 | | [OutcomeParameter](interfaces/OutcomeParameter.md) | Output parameter from $assemble's 'outcome' parameter |
10 | | [OutputParameters](interfaces/OutputParameters.md) | Output parameters for the $assemble operation |
11 |
12 | ## Functions
13 |
14 | | Function | Description |
15 | | ------ | ------ |
16 | | [assemble](functions/assemble.md) | The $assemble operation - https://build.fhir.org/ig/HL7/sdc/OperationDefinition-Questionnaire-assemble.html |
17 | | [isInputParameters](functions/isInputParameters.md) | Check if the given parameters is a valid InputParameters for $assemble |
18 |
--------------------------------------------------------------------------------
/documentation/docs/api/sdc-populate/functions/isCanonicalParameter.md:
--------------------------------------------------------------------------------
1 | # Function: isCanonicalParameter()
2 |
3 | > **isCanonicalParameter**(`parameter`): `parameter is CanonicalParameter`
4 |
5 | ## Parameters
6 |
7 | | Parameter | Type |
8 | | ------ | ------ |
9 | | `parameter` | `ParametersParameter` |
10 |
11 | ## Returns
12 |
13 | `parameter is CanonicalParameter`
14 |
--------------------------------------------------------------------------------
/documentation/docs/api/sdc-populate/functions/isContextParameter.md:
--------------------------------------------------------------------------------
1 | # Function: isContextParameter()
2 |
3 | > **isContextParameter**(`parameter`): `parameter is ContextParameter`
4 |
5 | ## Parameters
6 |
7 | | Parameter | Type |
8 | | ------ | ------ |
9 | | `parameter` | `ParametersParameter` |
10 |
11 | ## Returns
12 |
13 | `parameter is ContextParameter`
14 |
--------------------------------------------------------------------------------
/documentation/docs/api/sdc-populate/functions/isInputParameters.md:
--------------------------------------------------------------------------------
1 | # Function: isInputParameters()
2 |
3 | > **isInputParameters**(`parameters`): `parameters is InputParameters`
4 |
5 | Checks if the parameters passed satisfies the conditions of populateInputParameters.
6 |
7 | ## Parameters
8 |
9 | | Parameter | Type |
10 | | ------ | ------ |
11 | | `parameters` | `Parameters` |
12 |
13 | ## Returns
14 |
15 | `parameters is InputParameters`
16 |
--------------------------------------------------------------------------------
/documentation/docs/api/sdc-populate/functions/isOutputParameters.md:
--------------------------------------------------------------------------------
1 | # Function: isOutputParameters()
2 |
3 | > **isOutputParameters**(`parameters`): `parameters is OutputParameters`
4 |
5 | ## Parameters
6 |
7 | | Parameter | Type |
8 | | ------ | ------ |
9 | | `parameters` | `Parameters` |
10 |
11 | ## Returns
12 |
13 | `parameters is OutputParameters`
14 |
--------------------------------------------------------------------------------
/documentation/docs/api/sdc-populate/functions/isSubjectParameter.md:
--------------------------------------------------------------------------------
1 | # Function: isSubjectParameter()
2 |
3 | > **isSubjectParameter**(`parameter`): `parameter is SubjectParameter`
4 |
5 | ## Parameters
6 |
7 | | Parameter | Type |
8 | | ------ | ------ |
9 | | `parameter` | `ParametersParameter` |
10 |
11 | ## Returns
12 |
13 | `parameter is SubjectParameter`
14 |
--------------------------------------------------------------------------------
/documentation/docs/api/sdc-populate/interfaces/PopulateResult.md:
--------------------------------------------------------------------------------
1 | # Interface: PopulateResult
2 |
3 | ## Properties
4 |
5 | ### issues?
6 |
7 | > `optional` **issues**: `OperationOutcome`
8 |
9 | ***
10 |
11 | ### populatedContext?
12 |
13 | > `optional` **populatedContext**: `Record`\<`string`, `any`\>
14 |
15 | ***
16 |
17 | ### populatedResponse
18 |
19 | > **populatedResponse**: `QuestionnaireResponse`
20 |
--------------------------------------------------------------------------------
/documentation/docs/api/sdc-populate/interfaces/TerminologyRequestConfig.md:
--------------------------------------------------------------------------------
1 | # Interface: TerminologyRequestConfig
2 |
3 | ## Indexable
4 |
5 | \[`key`: `string`\]: `any`
6 |
7 | ## Properties
8 |
9 | ### terminologyServerUrl
10 |
11 | > **terminologyServerUrl**: `string`
12 |
--------------------------------------------------------------------------------
/documentation/docs/api/smart-forms-renderer/functions/BaseRenderer.md:
--------------------------------------------------------------------------------
1 | # Function: BaseRenderer()
2 |
3 | > **BaseRenderer**(): `Element`
4 |
5 | Main component of the form-rendering engine.
6 | Renders the Questionnaire and QuestionnaireResponse defined in the state management stores QuestionnaireStore and QuestionnaireResponseStore respectively.
7 | Use buildForm() in your wrapping component or in an event handler to initialise the form.
8 |
9 | ## Returns
10 |
11 | `Element`
12 |
--------------------------------------------------------------------------------
/documentation/docs/api/smart-forms-renderer/functions/BooleanField.md:
--------------------------------------------------------------------------------
1 | # Function: BooleanField()
2 |
3 | > **BooleanField**(`props`): `ReactNode`
4 |
5 | **NOTE**: Exotic components are not callable.
6 |
7 | ## Parameters
8 |
9 | | Parameter | Type |
10 | | ------ | ------ |
11 | | `props` | `BooleanFieldProps` |
12 |
13 | ## Returns
14 |
15 | `ReactNode`
16 |
--------------------------------------------------------------------------------
/documentation/docs/api/smart-forms-renderer/functions/ChoiceRadioSingle.md:
--------------------------------------------------------------------------------
1 | # Function: ChoiceRadioSingle()
2 |
3 | > **ChoiceRadioSingle**(`props`): `Element`
4 |
5 | ## Parameters
6 |
7 | | Parameter | Type |
8 | | ------ | ------ |
9 | | `props` | `ChoiceRadioSingleProps` |
10 |
11 | ## Returns
12 |
13 | `Element`
14 |
--------------------------------------------------------------------------------
/documentation/docs/api/smart-forms-renderer/functions/DecimalField.md:
--------------------------------------------------------------------------------
1 | # Function: DecimalField()
2 |
3 | > **DecimalField**(`props`): `Element`
4 |
5 | ## Parameters
6 |
7 | | Parameter | Type |
8 | | ------ | ------ |
9 | | `props` | `DecimalFieldProps` |
10 |
11 | ## Returns
12 |
13 | `Element`
14 |
--------------------------------------------------------------------------------
/documentation/docs/api/smart-forms-renderer/functions/FullWidthFormComponentBox.md:
--------------------------------------------------------------------------------
1 | # Function: FullWidthFormComponentBox()
2 |
3 | > **FullWidthFormComponentBox**(`props`, `context`?): `ReactNode`
4 |
5 | ## Parameters
6 |
7 | | Parameter | Type |
8 | | ------ | ------ |
9 | | `props` | `BoxOwnProps`\<`Theme`\> & `Omit`\<`Omit`\<`DetailedHTMLProps`\<`HTMLAttributes`\<`HTMLDivElement`\>, `HTMLDivElement`\>, `"ref"`\> & `object`, keyof `BoxOwnProps`\<`Theme`\>\> & `MUIStyledCommonProps`\<`Theme`\> |
10 | | `context`? | `any` |
11 |
12 | ## Returns
13 |
14 | `ReactNode`
15 |
--------------------------------------------------------------------------------
/documentation/docs/api/smart-forms-renderer/functions/GridGroup.md:
--------------------------------------------------------------------------------
1 | # Function: GridGroup()
2 |
3 | > **GridGroup**(`props`): `null` \| `Element`
4 |
5 | Main component to render a Group Grid (grid) Questionnaire item.
6 |
7 | ## Parameters
8 |
9 | | Parameter | Type |
10 | | ------ | ------ |
11 | | `props` | `GridGroupProps` |
12 |
13 | ## Returns
14 |
15 | `null` \| `Element`
16 |
17 | ## See
18 |
19 | [https://hl7.org/fhir/extensions/CodeSystem-questionnaire-item-control.html](https://hl7.org/fhir/extensions/CodeSystem-questionnaire-item-control.html)
20 |
--------------------------------------------------------------------------------
/documentation/docs/api/smart-forms-renderer/functions/GroupItem.md:
--------------------------------------------------------------------------------
1 | # Function: GroupItem()
2 |
3 | > **GroupItem**(`props`): `null` \| `Element`
4 |
5 | ## Parameters
6 |
7 | | Parameter | Type |
8 | | ------ | ------ |
9 | | `props` | `GroupItemProps` |
10 |
11 | ## Returns
12 |
13 | `null` \| `Element`
14 |
--------------------------------------------------------------------------------
/documentation/docs/api/smart-forms-renderer/functions/GroupTable.md:
--------------------------------------------------------------------------------
1 | # Function: GroupTable()
2 |
3 | > **GroupTable**(`props`): `null` \| `Element`
4 |
5 | Main component to render a Group Table (gtable) Questionnaire item.
6 |
7 | ## Parameters
8 |
9 | | Parameter | Type |
10 | | ------ | ------ |
11 | | `props` | `GroupTableProps` |
12 |
13 | ## Returns
14 |
15 | `null` \| `Element`
16 |
17 | ## See
18 |
19 | [https://hl7.org/fhir/extensions/CodeSystem-questionnaire-item-control.html](https://hl7.org/fhir/extensions/CodeSystem-questionnaire-item-control.html)
20 |
--------------------------------------------------------------------------------
/documentation/docs/api/smart-forms-renderer/functions/ItemFieldGrid.md:
--------------------------------------------------------------------------------
1 | # Function: ItemFieldGrid()
2 |
3 | > **ItemFieldGrid**(`props`): `Element`
4 |
5 | ## Parameters
6 |
7 | | Parameter | Type |
8 | | ------ | ------ |
9 | | `props` | `ItemFieldGridProps` |
10 |
11 | ## Returns
12 |
13 | `Element`
14 |
--------------------------------------------------------------------------------
/documentation/docs/api/smart-forms-renderer/functions/ItemLabelWrapper.md:
--------------------------------------------------------------------------------
1 | # Function: ItemLabelWrapper()
2 |
3 | > **ItemLabelWrapper**(`props`): `Element`
4 |
5 | ## Parameters
6 |
7 | | Parameter | Type |
8 | | ------ | ------ |
9 | | `props` | `LabelWrapperProps` |
10 |
11 | ## Returns
12 |
13 | `Element`
14 |
--------------------------------------------------------------------------------
/documentation/docs/api/smart-forms-renderer/functions/RendererThemeProvider.md:
--------------------------------------------------------------------------------
1 | # Function: RendererThemeProvider()
2 |
3 | > **RendererThemeProvider**(`__namedParameters`): `Element`
4 |
5 | Default theme used by the renderer using Material UI. You can customise your own theme by defining a new ThemeProvider.
6 |
7 | ## Parameters
8 |
9 | | Parameter | Type |
10 | | ------ | ------ |
11 | | `__namedParameters` | \{ `children`: `ReactNode`; \} |
12 | | `__namedParameters.children` | `ReactNode` |
13 |
14 | ## Returns
15 |
16 | `Element`
17 |
18 | ## See
19 |
20 | [https://mui.com/material-ui/customization/theming/](https://mui.com/material-ui/customization/theming/)
21 |
--------------------------------------------------------------------------------
/documentation/docs/api/smart-forms-renderer/functions/RepeatGroup.md:
--------------------------------------------------------------------------------
1 | # Function: RepeatGroup()
2 |
3 | > **RepeatGroup**(`props`): `Element`
4 |
5 | Main component to render a repeating, group Questionnaire item.
6 | Store and manages the state of multiple instances of GroupItem in a repeating group.
7 |
8 | ## Parameters
9 |
10 | | Parameter | Type |
11 | | ------ | ------ |
12 | | `props` | `RepeatGroupProps` |
13 |
14 | ## Returns
15 |
16 | `Element`
17 |
--------------------------------------------------------------------------------
/documentation/docs/api/smart-forms-renderer/functions/RepeatItem.md:
--------------------------------------------------------------------------------
1 | # Function: RepeatItem()
2 |
3 | > **RepeatItem**(`props`): `Element`
4 |
5 | Main component to render a repeating, non-group Questionnaire item.
6 |
7 | ## Parameters
8 |
9 | | Parameter | Type |
10 | | ------ | ------ |
11 | | `props` | `RepeatItemProps` |
12 |
13 | ## Returns
14 |
15 | `Element`
16 |
--------------------------------------------------------------------------------
/documentation/docs/api/smart-forms-renderer/functions/SingleItem.md:
--------------------------------------------------------------------------------
1 | # Function: SingleItem()
2 |
3 | > **SingleItem**(`props`): `Element`
4 |
5 | Main component to render a repeating, non-group Questionnaire item.
6 | Store and manages the state of multiple instances of SingleItem in a repeating item.
7 |
8 | ## Parameters
9 |
10 | | Parameter | Type |
11 | | ------ | ------ |
12 | | `props` | `SingleItemProps` |
13 |
14 | ## Returns
15 |
16 | `Element`
17 |
--------------------------------------------------------------------------------
/documentation/docs/api/smart-forms-renderer/functions/SmartFormsRenderer.md:
--------------------------------------------------------------------------------
1 | # Function: SmartFormsRenderer()
2 |
3 | > **SmartFormsRenderer**(`props`): `Element`
4 |
5 | A self-initialising wrapper around the BaseRenderer rendering engine.
6 | Will be deprecated in version 1.0.0. For alternative usage, see:
7 | - https://github.com/aehrc/smart-forms/blob/main/packages/smart-forms-renderer/src/stories/storybookWrappers/InitialiseFormWrapperForStorybook.tsx#L40-L57
8 |
9 | ## Parameters
10 |
11 | | Parameter | Type |
12 | | ------ | ------ |
13 | | `props` | [`SmartFormsRendererProps`](../interfaces/SmartFormsRendererProps.md) |
14 |
15 | ## Returns
16 |
17 | `Element`
18 |
19 | ## See
20 |
21 | SmartFormsRendererProps for props.
22 |
--------------------------------------------------------------------------------
/documentation/docs/api/smart-forms-renderer/functions/StringField.md:
--------------------------------------------------------------------------------
1 | # Function: StringField()
2 |
3 | > **StringField**(`props`): `Element`
4 |
5 | ## Parameters
6 |
7 | | Parameter | Type |
8 | | ------ | ------ |
9 | | `props` | `StringFieldProps` |
10 |
11 | ## Returns
12 |
13 | `Element`
14 |
--------------------------------------------------------------------------------
/documentation/docs/api/smart-forms-renderer/functions/createEmptyQrGroup.md:
--------------------------------------------------------------------------------
1 | # Function: createEmptyQrGroup()
2 |
3 | > **createEmptyQrGroup**(`qItem`): `QuestionnaireResponseItem`
4 |
5 | Create an empty group qrItem from a given group qItem
6 |
7 | ## Parameters
8 |
9 | | Parameter | Type |
10 | | ------ | ------ |
11 | | `qItem` | `QuestionnaireItem` |
12 |
13 | ## Returns
14 |
15 | `QuestionnaireResponseItem`
16 |
--------------------------------------------------------------------------------
/documentation/docs/api/smart-forms-renderer/functions/createEmptyQrItem.md:
--------------------------------------------------------------------------------
1 | # Function: createEmptyQrItem()
2 |
3 | > **createEmptyQrItem**(`qItem`, `answerKey`): `QuestionnaireResponseItem`
4 |
5 | Create an empty qrItem from a given qItem, optionally with an answer key
6 |
7 | ## Parameters
8 |
9 | | Parameter | Type |
10 | | ------ | ------ |
11 | | `qItem` | `QuestionnaireItem` |
12 | | `answerKey` | `undefined` \| `string` |
13 |
14 | ## Returns
15 |
16 | `QuestionnaireResponseItem`
17 |
--------------------------------------------------------------------------------
/documentation/docs/api/smart-forms-renderer/functions/destroyForm.md:
--------------------------------------------------------------------------------
1 | # Function: destroyForm()
2 |
3 | > **destroyForm**(): `void`
4 |
5 | Destroy the form to clean up the questionnaire and questionnaireResponse stores.
6 |
7 | ## Returns
8 |
9 | `void`
10 |
--------------------------------------------------------------------------------
/documentation/docs/api/smart-forms-renderer/functions/extractObservationBased.md:
--------------------------------------------------------------------------------
1 | # Function: extractObservationBased()
2 |
3 | > **extractObservationBased**(`questionnaire`, `questionnaireResponse`): `Observation`[]
4 |
5 | Extract an array of Observations from a QuestionnaireResponse and its source Questionnaire.
6 |
7 | ## Parameters
8 |
9 | | Parameter | Type |
10 | | ------ | ------ |
11 | | `questionnaire` | `Questionnaire` |
12 | | `questionnaireResponse` | `QuestionnaireResponse` |
13 |
14 | ## Returns
15 |
16 | `Observation`[]
17 |
18 | ## See
19 |
20 | https://build.fhir.org/ig/HL7/sdc/extraction.html#observation-based-extraction
21 |
--------------------------------------------------------------------------------
/documentation/docs/api/smart-forms-renderer/functions/generateItemsToRepopulate.md:
--------------------------------------------------------------------------------
1 | # Function: generateItemsToRepopulate()
2 |
3 | > **generateItemsToRepopulate**(`populatedResponse`): `Record`\<`string`, [`ItemToRepopulate`](../interfaces/ItemToRepopulate.md)\>
4 |
5 | Compare latest data from the server with the current QuestionnaireResponse and decide items to re-populate
6 |
7 | ## Parameters
8 |
9 | | Parameter | Type |
10 | | ------ | ------ |
11 | | `populatedResponse` | `QuestionnaireResponse` |
12 |
13 | ## Returns
14 |
15 | `Record`\<`string`, [`ItemToRepopulate`](../interfaces/ItemToRepopulate.md)\>
16 |
--------------------------------------------------------------------------------
/documentation/docs/api/smart-forms-renderer/functions/getDecimalPrecision.md:
--------------------------------------------------------------------------------
1 | # Function: getDecimalPrecision()
2 |
3 | > **getDecimalPrecision**(`qItem`): `number` \| `null`
4 |
5 | Check if the decimal value has a quantity precision for the decimal value
6 |
7 | ## Parameters
8 |
9 | | Parameter | Type |
10 | | ------ | ------ |
11 | | `qItem` | `QuestionnaireItem` |
12 |
13 | ## Returns
14 |
15 | `number` \| `null`
16 |
--------------------------------------------------------------------------------
/documentation/docs/api/smart-forms-renderer/functions/getQuestionnaireItem.md:
--------------------------------------------------------------------------------
1 | # Function: getQuestionnaireItem()
2 |
3 | > **getQuestionnaireItem**(`questionnaire`, `targetLinkId`): `QuestionnaireItem` \| `null`
4 |
5 | ## Parameters
6 |
7 | | Parameter | Type |
8 | | ------ | ------ |
9 | | `questionnaire` | `Questionnaire` |
10 | | `targetLinkId` | `string` |
11 |
12 | ## Returns
13 |
14 | `QuestionnaireItem` \| `null`
15 |
--------------------------------------------------------------------------------
/documentation/docs/api/smart-forms-renderer/functions/getResponse.md:
--------------------------------------------------------------------------------
1 | # Function: getResponse()
2 |
3 | > **getResponse**(): `QuestionnaireResponse`
4 |
5 | Get the filled QuestionnaireResponse at its current state.
6 | If no changes have been made to the form, the initial QuestionnaireResponse is returned.
7 |
8 | ## Returns
9 |
10 | `QuestionnaireResponse`
11 |
--------------------------------------------------------------------------------
/documentation/docs/api/smart-forms-renderer/functions/initialiseQuestionnaireResponse.md:
--------------------------------------------------------------------------------
1 | # Function: initialiseQuestionnaireResponse()
2 |
3 | > **initialiseQuestionnaireResponse**(`questionnaire`, `questionnaireResponse`?): `QuestionnaireResponse`
4 |
5 | Initialise a questionnaireResponse from a given questionnaire
6 | optionally takes in an existing questionnaireResponse to be initialised
7 |
8 | ## Parameters
9 |
10 | | Parameter | Type |
11 | | ------ | ------ |
12 | | `questionnaire` | `Questionnaire` |
13 | | `questionnaireResponse`? | `QuestionnaireResponse` |
14 |
15 | ## Returns
16 |
17 | `QuestionnaireResponse`
18 |
--------------------------------------------------------------------------------
/documentation/docs/api/smart-forms-renderer/functions/isHiddenByEnableWhen.md:
--------------------------------------------------------------------------------
1 | # Function: isHiddenByEnableWhen()
2 |
3 | > **isHiddenByEnableWhen**(`params`): `boolean`
4 |
5 | ## Parameters
6 |
7 | | Parameter | Type |
8 | | ------ | ------ |
9 | | `params` | `isHiddenByEnableWhensParams` |
10 |
11 | ## Returns
12 |
13 | `boolean`
14 |
--------------------------------------------------------------------------------
/documentation/docs/api/smart-forms-renderer/functions/isRepeatItemAndNotCheckbox.md:
--------------------------------------------------------------------------------
1 | # Function: isRepeatItemAndNotCheckbox()
2 |
3 | > **isRepeatItemAndNotCheckbox**(`qItem`): `boolean`
4 |
5 | Check if qItem is a repeat item AND if it isn't a checkbox item
6 | Note: repeat checkbox items are rendered as multi-select checkbox instead of being rendered as a traditional repeat item
7 |
8 | ## Parameters
9 |
10 | | Parameter | Type |
11 | | ------ | ------ |
12 | | `qItem` | `QuestionnaireItem` |
13 |
14 | ## Returns
15 |
16 | `boolean`
17 |
--------------------------------------------------------------------------------
/documentation/docs/api/smart-forms-renderer/functions/isSpecificItemControl.md:
--------------------------------------------------------------------------------
1 | # Function: isSpecificItemControl()
2 |
3 | > **isSpecificItemControl**(`qItem`, `itemControlCode`): `boolean`
4 |
5 | Check if the extension has an itemControl code equal to the given itemControlCode
6 |
7 | ## Parameters
8 |
9 | | Parameter | Type |
10 | | ------ | ------ |
11 | | `qItem` | `QuestionnaireItem` |
12 | | `itemControlCode` | `string` |
13 |
14 | ## Returns
15 |
16 | `boolean`
17 |
--------------------------------------------------------------------------------
/documentation/docs/api/smart-forms-renderer/functions/mapQItemsIndex.md:
--------------------------------------------------------------------------------
1 | # Function: mapQItemsIndex()
2 |
3 | > **mapQItemsIndex**(`questionnaireOrQItem`): `Record`\<`string`, `number`\>
4 |
5 | Generate a dictionary of QuestionnaireItems linkIds mapped to their respective array indexes ``
6 | i.e. `{ ee2589d5: 0, f9aaa187: 1, 88cab112: 2 }`
7 | where ee2589d5, f9aaa187 and 88cab112 are linkIds of QItem0, QItem1 and QItem2 respectively
8 |
9 | ## Parameters
10 |
11 | | Parameter | Type |
12 | | ------ | ------ |
13 | | `questionnaireOrQItem` | `Questionnaire` \| `QuestionnaireItem` |
14 |
15 | ## Returns
16 |
17 | `Record`\<`string`, `number`\>
18 |
--------------------------------------------------------------------------------
/documentation/docs/api/smart-forms-renderer/functions/objectIsCoding.md:
--------------------------------------------------------------------------------
1 | # Function: objectIsCoding()
2 |
3 | > **objectIsCoding**(`obj`): `obj is Coding`
4 |
5 | ## Parameters
6 |
7 | | Parameter | Type |
8 | | ------ | ------ |
9 | | `obj` | `any` |
10 |
11 | ## Returns
12 |
13 | `obj is Coding`
14 |
--------------------------------------------------------------------------------
/documentation/docs/api/smart-forms-renderer/functions/parseDecimalStringToFloat.md:
--------------------------------------------------------------------------------
1 | # Function: parseDecimalStringToFloat()
2 |
3 | > **parseDecimalStringToFloat**(`input`, `precision`): `number`
4 |
5 | ## Parameters
6 |
7 | | Parameter | Type |
8 | | ------ | ------ |
9 | | `input` | `string` |
10 | | `precision` | `number` |
11 |
12 | ## Returns
13 |
14 | `number`
15 |
--------------------------------------------------------------------------------
/documentation/docs/api/smart-forms-renderer/functions/parseDecimalStringWithPrecision.md:
--------------------------------------------------------------------------------
1 | # Function: parseDecimalStringWithPrecision()
2 |
3 | > **parseDecimalStringWithPrecision**(`input`, `precision`): `string`
4 |
5 | ## Parameters
6 |
7 | | Parameter | Type |
8 | | ------ | ------ |
9 | | `input` | `string` |
10 | | `precision` | `null` \| `number` |
11 |
12 | ## Returns
13 |
14 | `string`
15 |
--------------------------------------------------------------------------------
/documentation/docs/api/smart-forms-renderer/functions/parseFhirDateToDisplayDate.md:
--------------------------------------------------------------------------------
1 | # Function: parseFhirDateToDisplayDate()
2 |
3 | > **parseFhirDateToDisplayDate**(`fhirDate`): `object`
4 |
5 | Parse a FHIR date string to a date to be consumed and displayed by the DateItem component.
6 |
7 | ## Parameters
8 |
9 | | Parameter | Type |
10 | | ------ | ------ |
11 | | `fhirDate` | `string` |
12 |
13 | ## Returns
14 |
15 | `object`
16 |
17 | ### dateParseFail?
18 |
19 | > `optional` **dateParseFail**: `boolean`
20 |
21 | ### displayDate
22 |
23 | > **displayDate**: `string`
24 |
--------------------------------------------------------------------------------
/documentation/docs/api/smart-forms-renderer/functions/removeEmptyAnswersFromResponse.md:
--------------------------------------------------------------------------------
1 | # Function: removeEmptyAnswersFromResponse()
2 |
3 | > **removeEmptyAnswersFromResponse**(`questionnaire`, `questionnaireResponse`): `QuestionnaireResponse`
4 |
5 | Remove all empty/hidden answers from the filled QuestionnaireResponse.
6 | This takes into account enableWhens, enableWhenExpressions, items without item.answer, empty item.answer arrays and empty strings.
7 | This does not remove items that are hidden by the http://hl7.org/fhir/StructureDefinition/questionnaire-hidden extension.
8 |
9 | ## Parameters
10 |
11 | | Parameter | Type |
12 | | ------ | ------ |
13 | | `questionnaire` | `Questionnaire` |
14 | | `questionnaireResponse` | `QuestionnaireResponse` |
15 |
16 | ## Returns
17 |
18 | `QuestionnaireResponse`
19 |
--------------------------------------------------------------------------------
/documentation/docs/api/smart-forms-renderer/functions/removeInternalIdsFromResponse.md:
--------------------------------------------------------------------------------
1 | # Function: removeInternalIdsFromResponse()
2 |
3 | > **removeInternalIdsFromResponse**(`questionnaire`, `questionnaireResponse`): `QuestionnaireResponse`
4 |
5 | Remove all instances of item.answer.id from the filled QuestionnaireResponse.
6 | These IDs are used internally for rendering repeating items, and can be safely left out of the final response.
7 |
8 | ## Parameters
9 |
10 | | Parameter | Type |
11 | | ------ | ------ |
12 | | `questionnaire` | `Questionnaire` |
13 | | `questionnaireResponse` | `QuestionnaireResponse` |
14 |
15 | ## Returns
16 |
17 | `QuestionnaireResponse`
18 |
--------------------------------------------------------------------------------
/documentation/docs/api/smart-forms-renderer/functions/repopulateResponse.md:
--------------------------------------------------------------------------------
1 | # Function: repopulateResponse()
2 |
3 | > **repopulateResponse**(`checkedItemsToRepopulate`): `QuestionnaireResponse`
4 |
5 | Re-populate checked items in the re-population dialog into the current QuestionnaireResponse
6 |
7 | ## Parameters
8 |
9 | | Parameter | Type |
10 | | ------ | ------ |
11 | | `checkedItemsToRepopulate` | `Record`\<`string`, [`ItemToRepopulate`](../interfaces/ItemToRepopulate.md)\> |
12 |
13 | ## Returns
14 |
15 | `QuestionnaireResponse`
16 |
--------------------------------------------------------------------------------
/documentation/docs/api/smart-forms-renderer/functions/updateQrItemsInGroup.md:
--------------------------------------------------------------------------------
1 | # Function: updateQrItemsInGroup()
2 |
3 | > **updateQrItemsInGroup**(`newQrItem`, `newQrRepeatGroup`, `questionnaireResponseOrQrItem`, `qItemsIndexMap`): `void`
4 |
5 | Updates the QuestionnaireResponseItem group by adding/removing a new/modified child QuestionnaireResponseItem into/from a qrGroup
6 | Takes either a single newQrItem or an array of newQrItems
7 |
8 | ## Parameters
9 |
10 | | Parameter | Type |
11 | | ------ | ------ |
12 | | `newQrItem` | `null` \| `QuestionnaireResponseItem` |
13 | | `newQrRepeatGroup` | `null` \| `QrRepeatGroup` |
14 | | `questionnaireResponseOrQrItem` | `QuestionnaireResponse` \| `QuestionnaireResponseItem` |
15 | | `qItemsIndexMap` | `Record`\<`string`, `number`\> |
16 |
17 | ## Returns
18 |
19 | `void`
20 |
--------------------------------------------------------------------------------
/documentation/docs/api/smart-forms-renderer/functions/useCodingCalculatedExpression.md:
--------------------------------------------------------------------------------
1 | # Function: useCodingCalculatedExpression()
2 |
3 | > **useCodingCalculatedExpression**(`props`): `UseCodingCalculatedExpression`
4 |
5 | ## Parameters
6 |
7 | | Parameter | Type |
8 | | ------ | ------ |
9 | | `props` | `UseCodingCalculatedExpressionProps` |
10 |
11 | ## Returns
12 |
13 | `UseCodingCalculatedExpression`
14 |
--------------------------------------------------------------------------------
/documentation/docs/api/smart-forms-renderer/functions/useDisplayCqfAndCalculatedExpression.md:
--------------------------------------------------------------------------------
1 | # Function: useDisplayCqfAndCalculatedExpression()
2 |
3 | > **useDisplayCqfAndCalculatedExpression**(`qItem`): `string` \| `null`
4 |
5 | ## Parameters
6 |
7 | | Parameter | Type |
8 | | ------ | ------ |
9 | | `qItem` | `QuestionnaireItem` |
10 |
11 | ## Returns
12 |
13 | `string` \| `null`
14 |
--------------------------------------------------------------------------------
/documentation/docs/api/smart-forms-renderer/functions/useHidden.md:
--------------------------------------------------------------------------------
1 | # Function: useHidden()
2 |
3 | > **useHidden**(`qItem`, `parentRepeatGroupIndex`?): `boolean`
4 |
5 | React hook to determine if a QuestionnaireItem is hidden via item.hidden, enableWhens, enableWhenExpressions.
6 | When checking for repeating group enableWhen items, the parentRepeatGroupIndex should be provided.
7 |
8 | ## Parameters
9 |
10 | | Parameter | Type |
11 | | ------ | ------ |
12 | | `qItem` | `QuestionnaireItem` |
13 | | `parentRepeatGroupIndex`? | `number` |
14 |
15 | ## Returns
16 |
17 | `boolean`
18 |
--------------------------------------------------------------------------------
/documentation/docs/api/smart-forms-renderer/functions/useReadOnly.md:
--------------------------------------------------------------------------------
1 | # Function: useReadOnly()
2 |
3 | > **useReadOnly**(`qItem`, `parentIsReadOnly`, `parentRepeatGroupIndex`?): `boolean`
4 |
5 | ## Parameters
6 |
7 | | Parameter | Type |
8 | | ------ | ------ |
9 | | `qItem` | `QuestionnaireItem` |
10 | | `parentIsReadOnly` | `undefined` \| `boolean` |
11 | | `parentRepeatGroupIndex`? | `number` |
12 |
13 | ## Returns
14 |
15 | `boolean`
16 |
--------------------------------------------------------------------------------
/documentation/docs/api/smart-forms-renderer/functions/useRendererQueryClient.md:
--------------------------------------------------------------------------------
1 | # Function: useRendererQueryClient()
2 |
3 | > **useRendererQueryClient**(): `QueryClient`
4 |
5 | Default QueryClient used by the renderer.
6 | You can customise your own QueryClient with your own options, use v4 of @tanstack/react-query.
7 |
8 | ## Returns
9 |
10 | `QueryClient`
11 |
12 | ## See
13 |
14 | [https://tanstack.com/query/v4/docs/reference/QueryClient](https://tanstack.com/query/v4/docs/reference/QueryClient)
15 |
--------------------------------------------------------------------------------
/documentation/docs/api/smart-forms-renderer/functions/useRenderingExtensions.md:
--------------------------------------------------------------------------------
1 | # Function: useRenderingExtensions()
2 |
3 | > **useRenderingExtensions**(`qItem`): `RenderingExtensions`
4 |
5 | ## Parameters
6 |
7 | | Parameter | Type |
8 | | ------ | ------ |
9 | | `qItem` | `QuestionnaireItem` |
10 |
11 | ## Returns
12 |
13 | `RenderingExtensions`
14 |
--------------------------------------------------------------------------------
/documentation/docs/api/smart-forms-renderer/functions/useStringCalculatedExpression.md:
--------------------------------------------------------------------------------
1 | # Function: useStringCalculatedExpression()
2 |
3 | > **useStringCalculatedExpression**(`props`): `UseStringCalculatedExpression`
4 |
5 | ## Parameters
6 |
7 | | Parameter | Type |
8 | | ------ | ------ |
9 | | `props` | `useStringCalculatedExpressionProps` |
10 |
11 | ## Returns
12 |
13 | `UseStringCalculatedExpression`
14 |
--------------------------------------------------------------------------------
/documentation/docs/api/smart-forms-renderer/functions/useValidationFeedback.md:
--------------------------------------------------------------------------------
1 | # Function: useValidationFeedback()
2 |
3 | > **useValidationFeedback**(`qItem`, `input`): `string`
4 |
5 | ## Parameters
6 |
7 | | Parameter | Type |
8 | | ------ | ------ |
9 | | `qItem` | `QuestionnaireItem` |
10 | | `input` | `string` |
11 |
12 | ## Returns
13 |
14 | `string`
15 |
--------------------------------------------------------------------------------
/documentation/docs/api/smart-forms-renderer/functions/useValueSetCodings.md:
--------------------------------------------------------------------------------
1 | # Function: useValueSetCodings()
2 |
3 | > **useValueSetCodings**(`qItem`): `object`
4 |
5 | ## Parameters
6 |
7 | | Parameter | Type |
8 | | ------ | ------ |
9 | | `qItem` | `QuestionnaireItem` |
10 |
11 | ## Returns
12 |
13 | `object`
14 |
15 | ### codings
16 |
17 | > **codings**: `Coding`[]
18 |
19 | ### terminologyError
20 |
21 | > **terminologyError**: `TerminologyError`
22 |
--------------------------------------------------------------------------------
/documentation/docs/api/smart-forms-renderer/interfaces/CalculatedExpression.md:
--------------------------------------------------------------------------------
1 | # Interface: CalculatedExpression
2 |
3 | CalculatedExpression interface
4 |
5 | ## Properties
6 |
7 | ### expression
8 |
9 | > **expression**: `string`
10 |
11 | CalculatedExpression FHIRPath expression
12 |
13 | ***
14 |
15 | ### from
16 |
17 | > **from**: `"item"` \| `"item._text"`
18 |
19 | Whether the expressions is for the item itself or for item._text
20 |
21 | ***
22 |
23 | ### value?
24 |
25 | > `optional` **value**: `null` \| `string` \| `number` \| `boolean` \| `object`
26 |
27 | Evaluated value of the expression via FHIRPath
28 |
--------------------------------------------------------------------------------
/documentation/docs/api/smart-forms-renderer/interfaces/InitialiseFormWrapperProps.md:
--------------------------------------------------------------------------------
1 | # Interface: InitialiseFormWrapperProps
2 |
3 | ## Properties
4 |
5 | ### additionalVariables?
6 |
7 | > `optional` **additionalVariables**: `Record`\<`string`, `object`\>
8 |
9 | ***
10 |
11 | ### fhirClient?
12 |
13 | > `optional` **fhirClient**: `Client`
14 |
15 | ***
16 |
17 | ### questionnaire
18 |
19 | > **questionnaire**: `Questionnaire`
20 |
21 | ***
22 |
23 | ### questionnaireResponse?
24 |
25 | > `optional` **questionnaireResponse**: `QuestionnaireResponse`
26 |
27 | ***
28 |
29 | ### readOnly?
30 |
31 | > `optional` **readOnly**: `boolean`
32 |
33 | ***
34 |
35 | ### terminologyServerUrl?
36 |
37 | > `optional` **terminologyServerUrl**: `string`
38 |
--------------------------------------------------------------------------------
/documentation/docs/api/smart-forms-renderer/interfaces/SdcUiOverrideComponentProps.md:
--------------------------------------------------------------------------------
1 | # Interface: SdcUiOverrideComponentProps
2 |
3 | ## Properties
4 |
5 | ### displayText
6 |
7 | > **displayText**: `string` \| `Element` \| `Element`[]
8 |
9 | ***
10 |
11 | ### readOnly?
12 |
13 | > `optional` **readOnly**: `boolean`
14 |
--------------------------------------------------------------------------------
/documentation/docs/api/smart-forms-renderer/interfaces/TerminologyServerStoreType.md:
--------------------------------------------------------------------------------
1 | # Interface: TerminologyServerStoreType
2 |
3 | TerminologyServerStore properties and methods
4 | Properties can be accessed for fine-grain details.
5 | Methods are usually used internally, using them from an external source is not recommended.
6 |
7 | ## Properties
8 |
9 | ### resetUrl()
10 |
11 | > **resetUrl**: () => `void`
12 |
13 | Reset the terminology server URL to the default
14 |
15 | #### Returns
16 |
17 | `void`
18 |
19 | ***
20 |
21 | ### setUrl()
22 |
23 | > **setUrl**: (`newUrl`) => `void`
24 |
25 | Set the terminology server URL
26 |
27 | #### Parameters
28 |
29 | | Parameter | Type |
30 | | ------ | ------ |
31 | | `newUrl` | `string` |
32 |
33 | #### Returns
34 |
35 | `void`
36 |
37 | ***
38 |
39 | ### url
40 |
41 | > **url**: `string`
42 |
43 | The current terminology server URL
44 |
--------------------------------------------------------------------------------
/documentation/docs/api/smart-forms-renderer/interfaces/VariableXFhirQuery.md:
--------------------------------------------------------------------------------
1 | # Interface: VariableXFhirQuery
2 |
3 | VariableXFhirQuery interface
4 |
5 | ## Properties
6 |
7 | ### result?
8 |
9 | > `optional` **result**: `FhirResource`
10 |
11 | FHIR resource result of the executed query
12 |
13 | ***
14 |
15 | ### valueExpression
16 |
17 | > **valueExpression**: `Expression`
18 |
19 | FHIRPath Expression of the variable
20 |
--------------------------------------------------------------------------------
/documentation/docs/api/smart-forms-renderer/interfaces/Variables.md:
--------------------------------------------------------------------------------
1 | # Interface: Variables
2 |
3 | Variables interface
4 |
5 | ## Properties
6 |
7 | ### fhirPathVariables
8 |
9 | > **fhirPathVariables**: `Record`\<`string`, `Expression`[]\>
10 |
11 | Key-value pair of FHIRPath variable expressions in a Questionnaire item `Record`
12 |
13 | ***
14 |
15 | ### xFhirQueryVariables
16 |
17 | > **xFhirQueryVariables**: `Record`\<`string`, [`VariableXFhirQuery`](VariableXFhirQuery.md)\>
18 |
19 | Key-value pair of x-fhir-query variables `Record`
20 |
--------------------------------------------------------------------------------
/documentation/docs/api/smart-forms-renderer/type-aliases/Tab.md:
--------------------------------------------------------------------------------
1 | # Type Alias: Tab
2 |
3 | > **Tab**: `object`
4 |
5 | Tab interface
6 |
7 | ## Type declaration
8 |
9 | ### isComplete
10 |
11 | > **isComplete**: `boolean`
12 |
13 | ### isHidden
14 |
15 | > **isHidden**: `boolean`
16 |
17 | ### tabIndex
18 |
19 | > **tabIndex**: `number`
20 |
--------------------------------------------------------------------------------
/documentation/docs/api/smart-forms-renderer/type-aliases/Tabs.md:
--------------------------------------------------------------------------------
1 | # Type Alias: Tabs
2 |
3 | > **Tabs**: `Record`\<`string`, [`Tab`](Tab.md)\>
4 |
5 | Key-value pair of tabs `Record`
6 |
--------------------------------------------------------------------------------
/documentation/docs/api/smart-forms-renderer/variables/questionnaireResponseStore.md:
--------------------------------------------------------------------------------
1 | # Variable: questionnaireResponseStore
2 |
3 | > `const` **questionnaireResponseStore**: `StoreApi`\<[`QuestionnaireResponseStoreType`](../interfaces/QuestionnaireResponseStoreType.md)\>
4 |
5 | QuestionnaireResponse state management store which contains all properties and methods to manage the state of the questionnaireResponse.
6 | This is the vanilla version of the store which can be used in non-React environments.
7 |
8 | ## See
9 |
10 | QuestionnaireResponseStoreType for available properties and methods.
11 |
--------------------------------------------------------------------------------
/documentation/docs/api/smart-forms-renderer/variables/questionnaireStore.md:
--------------------------------------------------------------------------------
1 | # Variable: questionnaireStore
2 |
3 | > `const` **questionnaireStore**: `StoreApi`\<[`QuestionnaireStoreType`](../interfaces/QuestionnaireStoreType.md)\>
4 |
5 | Questionnaire state management store which contains all properties and methods to manage the state of the questionnaire.
6 | This is the vanilla version of the store which can be used in non-React environments.
7 |
8 | ## See
9 |
10 | QuestionnaireStoreType for available properties and methods.
11 |
--------------------------------------------------------------------------------
/documentation/docs/api/smart-forms-renderer/variables/rendererStylingStore.md:
--------------------------------------------------------------------------------
1 | # Variable: rendererStylingStore
2 |
3 | > `const` **rendererStylingStore**: `StoreApi`\<[`RendererStylingStoreType`](../interfaces/RendererStylingStoreType.md)\>
4 |
--------------------------------------------------------------------------------
/documentation/docs/api/smart-forms-renderer/variables/smartConfigStore.md:
--------------------------------------------------------------------------------
1 | # Variable: smartConfigStore
2 |
3 | > `const` **smartConfigStore**: `StoreApi`\<[`SmartConfigStoreType`](../interfaces/SmartConfigStoreType.md)\>
4 |
5 | Smart Config state management store. This is only used for answerExpressions.
6 | It is recommended to manage the state of the FHIRClient, patient, user, and encounter in the parent application, since the renderer doesn't provide pre-population capabilities.
7 | Will be deprecated in version 1.0.0.
8 |
9 | This is the vanilla version of the store which can be used in non-React environments.
10 |
11 | ## See
12 |
13 | SmartConfigStoreType for available properties and methods.
14 |
--------------------------------------------------------------------------------
/documentation/docs/api/smart-forms-renderer/variables/terminologyServerStore.md:
--------------------------------------------------------------------------------
1 | # Variable: terminologyServerStore
2 |
3 | > `const` **terminologyServerStore**: `StoreApi`\<[`TerminologyServerStoreType`](../interfaces/TerminologyServerStoreType.md)\>
4 |
5 | Terminology server state management store. This is used for resolving valueSets externally.
6 | Defaults to use https://tx.ontoserver.csiro.au/fhir.
7 | This is the vanilla version of the store which can be used in non-React environments.
8 |
9 | ## See
10 |
11 | TerminologyServerStoreType for available properties and methods.
12 |
--------------------------------------------------------------------------------
/documentation/docs/dev/storehooks/questionnaire-response-store/form-changes-history.mdx:
--------------------------------------------------------------------------------
1 | ---
2 | sidebar_position: 5
3 | ---
4 |
5 | # FormChangesHistory Usage
6 |
7 | The formChangesHistory is an array of all the changes made to the form. It can be really powerful when you are implementing an undo/redo feature.
8 |
9 | It uses the [deep-diff](https://github.com/flitbit/diff) library to calculate changes.
10 |
11 | ```tsx live
12 | function App() {
13 | const formChangesHistory = useQuestionnaireResponseStore.use.formChangesHistory();
14 |
15 | return (
16 | <>
17 |
18 |
19 | >
20 | );
21 | }
22 | ```
23 |
--------------------------------------------------------------------------------
/documentation/docs/dev/storehooks/questionnaire-response-store/invalid-items.mdx:
--------------------------------------------------------------------------------
1 | ---
2 | sidebar_position: 6
3 | ---
4 |
5 | # InvalidItems Usage
6 |
7 | The invalidItems object is a `Record` of the items that has a specified value constraint that is not satisfied.
8 |
9 | For all supported value constraints, refer to the [Value Constraints](/docs/sdc/advanced/constraint) section.
10 |
11 | ```tsx live
12 | function App() {
13 | const invalidItems = useQuestionnaireResponseStore.use.invalidItems();
14 |
15 | return (
16 | <>
17 |
18 |
19 | >
20 | );
21 | }
22 | ```
23 |
--------------------------------------------------------------------------------
/documentation/docs/dev/storehooks/questionnaire-response-store/response-is-valid.mdx:
--------------------------------------------------------------------------------
1 | ---
2 | sidebar_position: 7
3 | ---
4 |
5 | # ResponseIsValid Usage
6 |
7 | The responseIsValid property checks if any `invalidItems` are present and returns a boolean value.
8 |
9 | ```tsx live
10 | function App() {
11 | const responseIsValid = useQuestionnaireResponseStore.use.responseIsValid();
12 |
13 | return (
14 | <>
15 |
16 |
17 | >
18 | );
19 | }
20 | ```
21 |
--------------------------------------------------------------------------------
/documentation/docs/dev/storehooks/questionnaire-response-store/source-response.mdx:
--------------------------------------------------------------------------------
1 | ---
2 | sidebar_position: 2
3 | ---
4 |
5 | # SourceResponse Usage
6 |
7 | The sourceResponse is the first QuestionnaireResponse being passed into the renderer. If no response is passed in, an empty sourceResponse will be initialized by the renderer.
8 |
9 | The sourceResponse does not change when the form gets edited - that is where the [`updatableResponse`](/docs/dev/storehooks/questionnaire-response-store/updatable-response) comes in.
10 |
11 | ```tsx live
12 | function App() {
13 | const sourceResponse = useQuestionnaireResponseStore.use.sourceResponse();
14 |
15 | return (
16 | <>
17 |
18 |
19 | >
20 | );
21 | }
22 | ```
23 |
--------------------------------------------------------------------------------
/documentation/docs/dev/storehooks/questionnaire-response-store/updatable-response-items.mdx:
--------------------------------------------------------------------------------
1 | ---
2 | sidebar_position: 4
3 | ---
4 |
5 | # UpdatableResponseItems Usage
6 |
7 | The updatableResponseItems object is a `Record`.
8 |
9 | While this might seem slightly redundant with the `updatableResponse`, it is useful when debugging a specific linkId.
10 |
11 | ```tsx live
12 | function App() {
13 | const updatableResponseItems = useQuestionnaireResponseStore.use.updatableResponseItems();
14 |
15 | return (
16 | <>
17 |
18 |
19 | >
20 | );
21 | }
22 | ```
23 |
--------------------------------------------------------------------------------
/documentation/docs/dev/storehooks/questionnaire-response-store/updatable-response.mdx:
--------------------------------------------------------------------------------
1 | ---
2 | sidebar_position: 3
3 | ---
4 |
5 | # UpdatableResponse Usage
6 |
7 | The updatableResponse is the current state of the response while the form is filled.
8 |
9 | Try filling in the form to see the updatableResponse change.
10 |
11 | ```tsx live
12 | function App() {
13 | const updatableResponse = useQuestionnaireResponseStore.use.updatableResponse();
14 |
15 | return (
16 | <>
17 |
18 |
19 | >
20 | );
21 | }
22 | ```
23 |
--------------------------------------------------------------------------------
/documentation/docs/dev/storehooks/questionnaire-store/calculated-expressions.mdx:
--------------------------------------------------------------------------------
1 | ---
2 | sidebar_position: 5
3 | ---
4 |
5 | # CalculatedExpressions Usage
6 |
7 | The calculatedExpressions object is a `Record`.
8 |
9 | It contains the expression string itself, a `from` identifier to determine where the expression is coming from, and the result of the expression.
10 |
11 | ```tsx live
12 | function App() {
13 | const calculatedExpressions = useQuestionnaireStore.use.calculatedExpressions();
14 |
15 | return (
16 | <>
17 |
18 |
19 | >
20 | );
21 | }
22 | ```
23 |
--------------------------------------------------------------------------------
/documentation/docs/dev/storehooks/questionnaire-store/fhirpath-context.mdx:
--------------------------------------------------------------------------------
1 | ---
2 | sidebar_position: 6
3 | ---
4 |
5 | # FhirPathContext Usage
6 |
7 | The fhirPathContext object contains all the FHIRPath variables and their evaluated values. On top of that, it also contains [`%resource`](https://hl7.org/fhir/fhirpath.html#variables) as the resource containing the original code in the context.
8 |
9 | Refer to the [FHIRPath](https://hl7.org/fhir/fhirpath.html) spec for more information on FHIRPath.
10 |
11 | ```tsx live
12 | function App() {
13 | const fhirPathContext = useQuestionnaireStore.use.fhirPathContext();
14 |
15 | return (
16 | <>
17 |
18 |
19 | >
20 | );
21 | }
22 | ```
23 |
--------------------------------------------------------------------------------
/documentation/docs/dev/storehooks/questionnaire-store/focused-linkid.mdx:
--------------------------------------------------------------------------------
1 | ---
2 | sidebar_position: 7
3 | ---
4 |
5 | # FocusedLinkId Usage
6 |
7 | The focusedLinkId is the linkId of the item that is currently focused on.
8 |
9 | Try clicking anywhere on an item to see the focusedLinkId change.
10 |
11 | ```tsx live
12 | function App() {
13 | const focusedLinkId = useQuestionnaireStore.use.focusedLinkId();
14 |
15 | return (
16 | <>
17 |
18 |
19 | >
20 | );
21 | }
22 | ```
23 |
--------------------------------------------------------------------------------
/documentation/docs/dev/storehooks/questionnaire-store/item-types.mdx:
--------------------------------------------------------------------------------
1 | ---
2 | sidebar_position: 3
3 | ---
4 |
5 | # ItemTypes Usage
6 |
7 | There are three items in this questionnaire, therefore the itemTypes `Record` will have three items and their respective item types.
8 |
9 | ```tsx live
10 | function App() {
11 | const itemTypes = useQuestionnaireStore.use.itemTypes();
12 |
13 | return (
14 | <>
15 |
16 |
17 | >
18 | );
19 | }
20 | ```
21 |
--------------------------------------------------------------------------------
/documentation/docs/dev/storehooks/questionnaire-store/source-questionnaire.mdx:
--------------------------------------------------------------------------------
1 | ---
2 | sidebar_position: 2
3 | ---
4 |
5 | # SourceQuestionnaire Usage
6 |
7 | The sourceQuestionnaire is the input questionnaire passed to the renderer.
8 |
9 | ```tsx live
10 | function App() {
11 | const sourceQuestionnaire = useQuestionnaireStore.use.sourceQuestionnaire();
12 |
13 | return (
14 | <>
15 |
16 |
17 | >
18 | );
19 | }
20 | ```
21 |
--------------------------------------------------------------------------------
/documentation/docs/dev/storehooks/questionnaire-store/variables.mdx:
--------------------------------------------------------------------------------
1 | ---
2 | sidebar_position: 4
3 | ---
4 |
5 | # Variables Usage
6 |
7 | Smart Forms supports the `fhirpath` and `x-fhir-query` variable extensions. Each key contains a `Record`.
8 |
9 | Since the root level (the Questionnaire itself) does not have a linkId, extensions at the root level have a key of `QuestionnaireLevel`.
10 |
11 | :::warning
12 |
13 | Smart Forms having the `QuestionnaireLevel` key for root-level extensions might actually clash with items that have the same linkId. This is a known issue and will be addressed in the future.
14 |
15 | :::
16 |
17 | ```tsx live
18 | function App() {
19 | const variables = useQuestionnaireStore.use.variables();
20 |
21 | return (
22 | <>
23 |
24 |
25 | >
26 | );
27 | }
28 | ```
29 |
--------------------------------------------------------------------------------
/documentation/docs/dev/storehooks/terminology-server-store/index.mdx:
--------------------------------------------------------------------------------
1 | ---
2 | sidebar_position: 5
3 | ---
4 |
5 | # Terminology Server Store
6 |
7 | The TerminologyServerStore exposes the following properties:
8 |
9 | - **url**
10 |
11 | Here's how you use the store hook in your React functional component:
12 |
13 | ```
14 | import { useTerminologyStore } from '@aehrc/smart-forms-renderer';
15 |
16 | function App() {
17 | const storeProperty = useTerminologyStore.use.{insert_property_name_here}();
18 |
19 | return (
20 |
{storeProperty}
21 | );
22 | }
23 | ```
24 |
25 | There are some live examples on the following pages that demonstrate how to use the hooks.
26 |
27 | Refer to the [API Reference](/docs/api/smart-forms-renderer/interfaces/TerminologyServerStoreType) for more information on each property.
28 |
--------------------------------------------------------------------------------
/documentation/docs/dev/storehooks/terminology-server-store/url.mdx:
--------------------------------------------------------------------------------
1 | ---
2 | sidebar_position: 2
3 | ---
4 |
5 | # Url Usage
6 |
7 | This hook is used to get the url of the terminology server.
8 | The `YourBaseRendererWrapper` wraper passes the `terminologyServerUrl` alongside the questionnaire to the `buildForm()` function, which initialises the terminology server store with the provided url.
9 |
10 | Try removing the `terminologyServerUrl` prop from the `YourBaseRendererWrapper` and see the `url` value revert to the renderer's default terminology server url.
11 |
12 | ```tsx live
13 | function App() {
14 | const url = useTerminologyServerStore.use.url();
15 |
16 | return (
17 | <>
18 |
22 |
23 | >
24 | );
25 | }
26 | ```
27 |
--------------------------------------------------------------------------------
/documentation/sidebars.ts:
--------------------------------------------------------------------------------
1 | import type { SidebarsConfig } from '@docusaurus/plugin-content-docs';
2 |
3 | /**
4 | * Creating a sidebar enables you to:
5 | - create an ordered group of docs
6 | - render a sidebar for each doc of that group
7 | - provide next/previous navigation
8 |
9 | The sidebars can be generated from the filesystem, or explicitly defined here.
10 |
11 | Create as many sidebars as you want.
12 | */
13 | const sidebars: SidebarsConfig = {
14 | // By default, Docusaurus generates a sidebar from the docs folder structure
15 | componentsSidebar: [{ type: 'autogenerated', dirName: 'components' }],
16 | sdcSidebar: [{ type: 'autogenerated', dirName: 'sdc' }],
17 | devSidebar: [
18 | { type: 'autogenerated', dirName: 'dev' },
19 | { type: 'link', label: 'Playground', href: 'https://smartforms.csiro.au/playground' }
20 | ],
21 | operationsSidebar: [{ type: 'autogenerated', dirName: 'operations' }],
22 | apiSidebar: [{ type: 'autogenerated', dirName: 'api' }]
23 | };
24 |
25 | export default sidebars;
26 |
--------------------------------------------------------------------------------
/documentation/src/react/OpenInStorybook.tsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import Iconify from '@site/src/react/Iconify';
3 | import { IconButton, Tooltip } from '@mui/material';
4 |
5 | interface OpenInStorybookProps {
6 | storyUrl: string;
7 | }
8 |
9 | function OpenInStorybook(props: OpenInStorybookProps) {
10 | const { storyUrl } = props;
11 |
12 | return (
13 |
22 | );
23 | }
24 |
25 | export default OpenInStorybook;
26 |
--------------------------------------------------------------------------------
/documentation/static/.nojekyll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aehrc/smart-forms/8f2c2ae79171bd85296e54c6cfe3cb66f17018d6/documentation/static/.nojekyll
--------------------------------------------------------------------------------
/documentation/static/img/docusaurus-social-card.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aehrc/smart-forms/8f2c2ae79171bd85296e54c6cfe3cb66f17018d6/documentation/static/img/docusaurus-social-card.jpg
--------------------------------------------------------------------------------
/documentation/static/img/docusaurus.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aehrc/smart-forms/8f2c2ae79171bd85296e54c6cfe3cb66f17018d6/documentation/static/img/docusaurus.png
--------------------------------------------------------------------------------
/documentation/static/img/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aehrc/smart-forms/8f2c2ae79171bd85296e54c6cfe3cb66f17018d6/documentation/static/img/favicon.ico
--------------------------------------------------------------------------------
/documentation/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | // This file is not used in compilation. It is here just for a nice editor experience.
3 | "extends": "@docusaurus/tsconfig",
4 | "compilerOptions": {
5 | "baseUrl": "."
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/documentation/tsdoc.json:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "https://developer.microsoft.com/json-schemas/tsdoc/v0/tsdoc.schema.json",
3 | "extends": ["typedoc/tsdoc.json"],
4 | "tagDefinitions": [
5 | {
6 | "tagName": "@author",
7 | "syntaxKind": "block"
8 | }
9 | ]
10 | }
11 |
--------------------------------------------------------------------------------
/launch-with-questionnaire.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aehrc/smart-forms/8f2c2ae79171bd85296e54c6cfe3cb66f17018d6/launch-with-questionnaire.png
--------------------------------------------------------------------------------
/launch.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aehrc/smart-forms/8f2c2ae79171bd85296e54c6cfe3cb66f17018d6/launch.png
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "smart-forms",
3 | "scripts": {
4 | "lint": "eslint -c .eslintrc.json .",
5 | "lint-fix": "eslint -c .eslintrc.json --fix .",
6 | "lint-fix-errors": "eslint -c .eslintrc.json --fix --quiet .",
7 | "prettier": "prettier --check .",
8 | "prettier-fix": "prettier --write .",
9 | "clean-folders": "find . -type d \\( -name \"node_modules\" -o -name \"dist\" -o -name \"lib\" \\) -exec rm -rf {} +"
10 | },
11 | "workspaces": [
12 | "apps/smart-forms-app",
13 | "packages/*",
14 | "services/*",
15 | "deployment/forms-server/*",
16 | "deployment/ehr-proxy/*",
17 | "documentation"
18 | ],
19 | "devDependencies": {
20 | "@typescript-eslint/eslint-plugin": "^7.8.0",
21 | "eslint-config-prettier": "^9.1.0",
22 | "eslint-plugin-prettier": "^5.2.1",
23 | "eslint-plugin-react-refresh": "^0.4.20"
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/packages/sdc-assemble/.gitignore:
--------------------------------------------------------------------------------
1 | node_modules
2 | lib
3 | dist
4 |
--------------------------------------------------------------------------------
/packages/sdc-assemble/.npmignore:
--------------------------------------------------------------------------------
1 | # Don't ignore dist folder
2 | !dist/
3 |
4 | # Ignore lib folder if mistakenly ran tsc
5 | lib/
6 |
--------------------------------------------------------------------------------
/packages/sdc-assemble/src/index.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2024 Commonwealth Scientific and Industrial Research
3 | * Organisation (CSIRO) ABN 41 687 119 230.
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License");
6 | * you may not use this file except in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 |
18 | export * from './interfaces';
19 | export * from './utils';
20 |
--------------------------------------------------------------------------------
/packages/sdc-assemble/src/interfaces/index.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2024 Commonwealth Scientific and Industrial Research
3 | * Organisation (CSIRO) ABN 41 687 119 230.
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License");
6 | * you may not use this file except in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 |
18 | export { InputParameters, OutputParameters, OutcomeParameter } from './parameters.interface';
19 | export { FetchQuestionnaireCallback } from './callback.interface';
20 |
--------------------------------------------------------------------------------
/packages/sdc-assemble/src/utils/index.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2024 Commonwealth Scientific and Industrial Research
3 | * Organisation (CSIRO) ABN 41 687 119 230.
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License");
6 | * you may not use this file except in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 |
18 | export { isInputParameters } from './typePredicates';
19 | export { assemble } from './assemble';
20 |
--------------------------------------------------------------------------------
/packages/sdc-assemble/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "target": "ES6",
4 | "module": "ES6",
5 | "allowSyntheticDefaultImports": true,
6 | "esModuleInterop": true,
7 | "moduleResolution": "node",
8 | "forceConsistentCasingInFileNames": true,
9 | "strict": true,
10 | "skipLibCheck": true,
11 | "jsx": "react",
12 | "sourceMap": true,
13 | "allowJs": true,
14 | "outDir": "lib",
15 | "declaration": true,
16 | "checkJs": true,
17 | "resolveJsonModule": true,
18 |
19 | "allowUnusedLabels": false,
20 | "allowUnreachableCode": false,
21 | "exactOptionalPropertyTypes": true,
22 | "noFallthroughCasesInSwitch": true,
23 | "noImplicitOverride": true,
24 | "noImplicitReturns": true,
25 | "noUncheckedIndexedAccess": true,
26 | "noUnusedParameters": true
27 | },
28 | "include": ["src"],
29 | "exclude": ["src/**/*.test.ts", "lib", "dist"]
30 | }
31 |
--------------------------------------------------------------------------------
/packages/sdc-populate/.gitignore:
--------------------------------------------------------------------------------
1 | node_modules
2 | lib
3 | dist
4 |
--------------------------------------------------------------------------------
/packages/sdc-populate/.npmignore:
--------------------------------------------------------------------------------
1 | # Don't ignore dist folder
2 | !dist/
3 |
4 | # Ignore lib folder if mistakenly ran tsc
5 | lib/
6 |
7 |
--------------------------------------------------------------------------------
/packages/sdc-populate/src/SDCPopulateQuestionnaireOperation/index.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2024 Commonwealth Scientific and Industrial Research
3 | * Organisation (CSIRO) ABN 41 687 119 230.
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License");
6 | * you may not use this file except in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 |
18 | // Export interfaces
19 | export * from './interfaces';
20 |
21 | // Export utils
22 | export * from './utils';
23 |
--------------------------------------------------------------------------------
/packages/sdc-populate/src/SDCPopulateQuestionnaireOperation/utils/codingProperties.ts:
--------------------------------------------------------------------------------
1 | import type { Coding } from 'fhir/r4';
2 |
3 | /**
4 | * Retrieves only the relevant properties of a Coding object.
5 | * Reason: https://tx.ontoserver.csiro.au/fhir returns a Coding with designation element, which is not in the FHIR spec, causing QRs with it to fail validation.
6 | *
7 | * @author Sean Fong
8 | */
9 | export function getRelevantCodingProperties(coding: Coding): Coding {
10 | return {
11 | system: coding.system,
12 | code: coding.code,
13 | display: coding.display,
14 | ...(coding.extension && { extension: coding.extension })
15 | };
16 | }
17 |
--------------------------------------------------------------------------------
/packages/sdc-populate/src/SDCPopulateQuestionnaireOperation/utils/emptyResource.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2025 Commonwealth Scientific and Industrial Research
3 | * Organisation (CSIRO) ABN 41 687 119 230.
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License");
6 | * you may not use this file except in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 |
18 | import type { QuestionnaireResponse } from 'fhir/r4';
19 |
20 | export const emptyResponse: QuestionnaireResponse = {
21 | resourceType: 'QuestionnaireResponse',
22 | status: 'in-progress'
23 | };
24 |
--------------------------------------------------------------------------------
/packages/sdc-populate/src/SDCPopulateQuestionnaireOperation/utils/index.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2024 Commonwealth Scientific and Industrial Research
3 | * Organisation (CSIRO) ABN 41 687 119 230.
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License");
6 | * you may not use this file except in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 |
18 | export {
19 | isInputParameters,
20 | isCanonicalParameter,
21 | isContextParameter,
22 | isSubjectParameter,
23 | isOutputParameters
24 | } from './typePredicates';
25 | export { populate } from './populate';
26 |
--------------------------------------------------------------------------------
/packages/sdc-populate/src/globals.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2024 Commonwealth Scientific and Industrial Research
3 | * Organisation (CSIRO) ABN 41 687 119 230.
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License");
6 | * you may not use this file except in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 |
18 | export const TERMINOLOGY_SERVER_URL = 'https://tx.ontoserver.csiro.au/fhir';
19 |
--------------------------------------------------------------------------------
/packages/sdc-populate/src/inAppPopulation/index.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2024 Commonwealth Scientific and Industrial Research
3 | * Organisation (CSIRO) ABN 41 687 119 230.
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License");
6 | * you may not use this file except in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 |
18 | export * from './utils';
19 |
--------------------------------------------------------------------------------
/packages/sdc-populate/src/inAppPopulation/utils/index.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2024 Commonwealth Scientific and Industrial Research
3 | * Organisation (CSIRO) ABN 41 687 119 230.
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License");
6 | * you may not use this file except in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 |
18 | export type { PopulateResult, PopulateQuestionnaireParams } from './populateQuestionnaire';
19 | export { populateQuestionnaire } from './populateQuestionnaire';
20 |
--------------------------------------------------------------------------------
/packages/sdc-populate/src/index.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2024 Commonwealth Scientific and Industrial Research
3 | * Organisation (CSIRO) ABN 41 687 119 230.
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License");
6 | * you may not use this file except in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 |
18 | export * from './SDCPopulateQuestionnaireOperation';
19 | export * from './inAppPopulation';
20 |
--------------------------------------------------------------------------------
/packages/sdc-populate/src/test/resources/initial-expressions-sample.json:
--------------------------------------------------------------------------------
1 | {
2 | "age": {
3 | "expression": "today().toString().substring(0,4).toInteger() - %patient.birthDate.toString().substring(0,4).toInteger()"
4 | },
5 | "29644716-433e-45ec-a805-8043f35a85e1": {
6 | "expression": "%PrePopQuery2.entry.resource.value.value"
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/packages/sdc-populate/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "target": "ES6",
4 | "module": "ES6",
5 | "allowSyntheticDefaultImports": true,
6 | "esModuleInterop": true,
7 | "moduleResolution": "node",
8 | "forceConsistentCasingInFileNames": true,
9 | "strict": true,
10 | "skipLibCheck": true,
11 | "jsx": "react",
12 | "sourceMap": true,
13 | "outDir": "lib",
14 | "declaration": true,
15 | "resolveJsonModule": true,
16 |
17 | "allowUnusedLabels": false,
18 | "allowUnreachableCode": false,
19 | "noFallthroughCasesInSwitch": true,
20 | "noImplicitOverride": true,
21 | "noImplicitReturns": true,
22 | "noUncheckedIndexedAccess": true,
23 | "noUnusedParameters": true
24 | },
25 | "include": ["src"],
26 | "exclude": ["src/test", "src/**/*.test.ts", "lib", "dist"]
27 | }
28 |
--------------------------------------------------------------------------------
/packages/sdc-template-extract/.gitignore:
--------------------------------------------------------------------------------
1 | node_modules
2 | lib
3 | dist
4 |
--------------------------------------------------------------------------------
/packages/sdc-template-extract/.npmignore:
--------------------------------------------------------------------------------
1 | # Don't ignore dist folder
2 | !dist/
3 |
4 | # Ignore lib folder if mistakenly ran tsc
5 | lib/
6 |
7 | # Ignore tests
8 | tests/
9 |
--------------------------------------------------------------------------------
/packages/sdc-template-extract/README.md:
--------------------------------------------------------------------------------
1 | # SDC-Template-based Extract
2 |
3 | A Typescript reference implementation of the [$extract](https://build.fhir.org/ig/HL7/sdc/OperationDefinition-QuestionnaireResponse-extract.html) operation from the [HL7 FHIR Structured Data Capture Specification](http://hl7.org/fhir/uv/sdc/ImplementationGuide/hl7.fhir.uv.sdc) and is designed for [Modular Questionnaires](http://hl7.org/fhir/uv/sdc/modular.html#modular-questionnaires).
4 |
5 | ### Local development notes
6 | It's recommended to run this library within a web app or a service if you're doing local development.
7 | This library compiles to both CommonJS and ES Modules, so there is no problems in using it across web frameworks and Node-based backends.
8 |
9 | To compile the code, use `npm run compile`.
10 | To watch for changes, use `npm run watch`.
11 |
12 | Note: Do not use `tsc` or `tsc -w` as it will only compile to ES Modules, which means it will not work with CommonJS-based implementations.
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/packages/sdc-template-extract/src/SDCExtractQuestionnaireResponseOperation/interfaces/bundle.interface.ts:
--------------------------------------------------------------------------------
1 | export type BundleRequestType = 'POST' | 'PUT' | 'PATCH';
2 |
--------------------------------------------------------------------------------
/packages/sdc-template-extract/src/SDCExtractQuestionnaireResponseOperation/interfaces/customDebugInfo.interface.ts:
--------------------------------------------------------------------------------
1 | import type { TemplateExtractPathJsObjectTuple } from './templateExtractPath.interface';
2 |
3 | export interface TemplateExtractDebugInfo {
4 | templateIdToExtractPathTuples: Record;
5 | }
6 |
--------------------------------------------------------------------------------
/packages/sdc-template-extract/src/SDCExtractQuestionnaireResponseOperation/interfaces/entryPathPosition.interface.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Tracks where a bunch of evaluated values are inserted into a template entry path.
3 | */
4 | export interface EntryPathPosition {
5 | entryPath: string;
6 | startIndex: number;
7 | count: number;
8 | }
9 |
--------------------------------------------------------------------------------
/packages/sdc-template-extract/src/SDCExtractQuestionnaireResponseOperation/interfaces/fhirpatch.interface.ts:
--------------------------------------------------------------------------------
1 | import type { Parameters, ParametersParameter } from 'fhir/r4';
2 |
3 | /**
4 | * Interface representing a https://build.fhir.org/fhirpatch.html
5 | */
6 | export interface FhirPatchParameters extends Parameters {
7 | resourceType: 'Parameters';
8 | parameter: FhirPatchParameterEntry[];
9 | }
10 |
11 | export type FhirPatchOperationType = 'add' | 'insert' | 'delete' | 'replace' | 'move';
12 |
13 | export type FhirPatchPart =
14 | | { name: 'type'; valueCode: FhirPatchOperationType }
15 | | { name: 'path'; valueString: string }
16 | | { name: 'name'; valueString: string }
17 | | { name: 'value'; [key: string]: unknown } // value[x], e.g., valueString, valueInteger, etc.
18 | | { name: 'index'; valueInteger: number }
19 | | { name: 'source'; valueInteger: number }
20 | | { name: 'destination'; valueInteger: number };
21 |
22 | export interface FhirPatchParameterEntry extends ParametersParameter {
23 | part: FhirPatchPart[];
24 | }
25 |
--------------------------------------------------------------------------------
/packages/sdc-template-extract/src/SDCExtractQuestionnaireResponseOperation/utils/createFhirPathContext.ts:
--------------------------------------------------------------------------------
1 | import type { QuestionnaireResponse } from 'fhir/r4';
2 |
3 | /**
4 | * Builds a FHIRPath context with the response and allocated IDs.
5 | *
6 | * @param questionnaireResponse - The QuestionnaireResponse resource.
7 | * @param extractAllocateIds - Map of variable names to allocated IDs.
8 | * @returns FHIRPath context object.
9 | */
10 | export function createFhirPathContext(
11 | questionnaireResponse: QuestionnaireResponse,
12 | extractAllocateIds: Record
13 | ): Record {
14 | return {
15 | resource: questionnaireResponse,
16 | rootResource: questionnaireResponse,
17 | ...extractAllocateIds
18 | };
19 | }
20 |
--------------------------------------------------------------------------------
/packages/sdc-template-extract/src/SDCExtractQuestionnaireResponseOperation/utils/mapToRecord.ts:
--------------------------------------------------------------------------------
1 | import type {
2 | TemplateExtractPath,
3 | TemplateExtractPathJsObject
4 | } from '../interfaces/templateExtractPath.interface';
5 |
6 | /**
7 | * Converts a Map to a Record,
8 | * Converting any nested valuePathMap from Map to plain object.
9 | */
10 | export function templateExtractPathMapToRecord(
11 | templateExtractPathMap: Map
12 | ): Record {
13 | const templateExtractPaths: Record = {};
14 |
15 | for (const [entryPath, templateExtractPath] of templateExtractPathMap.entries()) {
16 | templateExtractPaths[entryPath] = {
17 | contextPathTuple: templateExtractPath.contextPathTuple,
18 | valuePathMap: Object.fromEntries(templateExtractPath.valuePathMap) // convert inner Map to plain object
19 | };
20 | }
21 |
22 | return templateExtractPaths;
23 | }
24 |
--------------------------------------------------------------------------------
/packages/sdc-template-extract/src/inAppExtraction/interfaces/index.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2024 Commonwealth Scientific and Industrial Research
3 | * Organisation (CSIRO) ABN 41 687 119 230.
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License");
6 | * you may not use this file except in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 |
18 | export type {
19 | QuestionnaireOrCallback,
20 | FetchQuestionnaireResolver,
21 | ExtractResult,
22 | InAppExtractOutput
23 | } from './extract.interface';
24 |
--------------------------------------------------------------------------------
/packages/sdc-template-extract/src/inAppExtraction/utils/index.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2024 Commonwealth Scientific and Industrial Research
3 | * Organisation (CSIRO) ABN 41 687 119 230.
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License");
6 | * you may not use this file except in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 |
18 | export { inAppExtract } from './extract';
19 | export { extractResultIsOperationOutcome, objIsTemplateExtractDebugInfo } from './typePredicates';
20 |
--------------------------------------------------------------------------------
/packages/sdc-template-extract/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "target": "ES6",
4 | "module": "ES6",
5 | "allowSyntheticDefaultImports": true,
6 | "esModuleInterop": true,
7 | "moduleResolution": "node",
8 | "forceConsistentCasingInFileNames": true,
9 | "strict": true,
10 | "skipLibCheck": true,
11 | "jsx": "react",
12 | "sourceMap": true,
13 | "allowJs": true,
14 | "outDir": "lib",
15 | "declaration": true,
16 | "checkJs": true,
17 | "resolveJsonModule": true,
18 |
19 | "allowUnusedLabels": false,
20 | "allowUnreachableCode": false,
21 | "exactOptionalPropertyTypes": true,
22 | "noFallthroughCasesInSwitch": true,
23 | "noImplicitOverride": true,
24 | "noImplicitReturns": true,
25 | "noUncheckedIndexedAccess": true,
26 | "noUnusedParameters": true
27 | },
28 | "include": ["src"],
29 | "exclude": ["src/**/*.test.ts", "lib", "dist"]
30 | }
31 |
--------------------------------------------------------------------------------
/packages/smart-forms-renderer/.gitignore:
--------------------------------------------------------------------------------
1 | node_modules
2 | lib
3 | dist
4 | temp
5 | storybook-static
6 |
7 | storybook.log
8 | doctor-storybook.log
9 | build-storybook.log
10 |
--------------------------------------------------------------------------------
/packages/smart-forms-renderer/.npmignore:
--------------------------------------------------------------------------------
1 | # Ignore stories
2 | .storybook
3 | src/stories
4 |
5 | # Ignore temp file if present
6 | temp
7 |
8 | # Ignore storybook build
9 | storybook-static
10 | storybook.log
11 | doctor-storybook.log
12 | build-storybook.log
13 |
--------------------------------------------------------------------------------
/packages/smart-forms-renderer/README.md:
--------------------------------------------------------------------------------
1 | # Smart Forms Renderer
2 |
3 | A React-based library that contains the Questionnaire renderer used in the Smart Forms app.
4 | It acts as a reference implementation for the [SDC Form Filler](https://hl7.org/fhir/uv/sdc/CapabilityStatement-sdc-form-filler.html).
5 |
6 |
6 |
--------------------------------------------------------------------------------
/packages/smart-forms-renderer/src/components/FormComponents/BooleanItem/index.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2024 Commonwealth Scientific and Industrial Research
3 | * Organisation (CSIRO) ABN 41 687 119 230.
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License");
6 | * you may not use this file except in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 |
18 | export { default as BooleanField } from './BooleanField';
19 |
--------------------------------------------------------------------------------
/packages/smart-forms-renderer/src/components/FormComponents/Button.styles.ts:
--------------------------------------------------------------------------------
1 | import { styled } from '@mui/material/styles';
2 | import Fab from '@mui/material/Fab';
3 |
4 | export const SecondaryFab = styled(Fab)(({ theme }) => ({
5 | color: '#fff',
6 | background: theme.palette.secondary.main,
7 | '&:hover': {
8 | background: theme.palette.secondary.dark
9 | }
10 | }));
11 |
--------------------------------------------------------------------------------
/packages/smart-forms-renderer/src/components/FormComponents/ChoiceItems/index.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2024 Commonwealth Scientific and Industrial Research
3 | * Organisation (CSIRO) ABN 41 687 119 230.
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License");
6 | * you may not use this file except in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 |
18 | export { default as ChoiceRadioSingle } from './ChoiceRadioSingle';
19 |
--------------------------------------------------------------------------------
/packages/smart-forms-renderer/src/components/FormComponents/DateTimeItems/CustomDateItem/MuiDatePicker.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2024 Commonwealth Scientific and Industrial Research
3 | * Organisation (CSIRO) ABN 41 687 119 230.
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License");
6 | * you may not use this file except in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 |
18 | import { DatePicker } from '@mui/x-date-pickers/DatePicker';
19 |
20 | const MuiDatePicker = DatePicker;
21 |
22 | export default MuiDatePicker;
23 |
--------------------------------------------------------------------------------
/packages/smart-forms-renderer/src/components/FormComponents/DateTimeItems/index.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2024 Commonwealth Scientific and Industrial Research
3 | * Organisation (CSIRO) ABN 41 687 119 230.
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License");
6 | * you may not use this file except in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 |
18 | export { parseFhirDateToDisplayDate } from './utils';
19 |
--------------------------------------------------------------------------------
/packages/smart-forms-renderer/src/components/FormComponents/DateTimeItems/utils/index.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2024 Commonwealth Scientific and Industrial Research
3 | * Organisation (CSIRO) ABN 41 687 119 230.
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License");
6 | * you may not use this file except in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 |
18 | export { parseFhirDateToDisplayDate } from './parseDate';
19 |
--------------------------------------------------------------------------------
/packages/smart-forms-renderer/src/components/FormComponents/DecimalItem/index.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2024 Commonwealth Scientific and Industrial Research
3 | * Organisation (CSIRO) ABN 41 687 119 230.
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License");
6 | * you may not use this file except in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 |
18 | export { default as DecimalField } from './DecimalField';
19 |
--------------------------------------------------------------------------------
/packages/smart-forms-renderer/src/components/FormComponents/GridGroup/index.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2024 Commonwealth Scientific and Industrial Research
3 | * Organisation (CSIRO) ABN 41 687 119 230.
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License");
6 | * you may not use this file except in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 |
18 | export { default as GridGroup } from './GridGroup';
19 |
--------------------------------------------------------------------------------
/packages/smart-forms-renderer/src/components/FormComponents/GroupItem/GroupAccordion.styles.ts:
--------------------------------------------------------------------------------
1 | import { styled } from '@mui/material/styles';
2 | import Accordion from '@mui/material/Accordion';
3 |
4 | export const GroupAccordion = styled(Accordion, {
5 | shouldForwardProp: (prop) => prop !== 'elevation'
6 | })<{ elevation: number }>(({ elevation }) => ({
7 | paddingTop: '8px',
8 | paddingBottom: '4px',
9 | paddingLeft: elevation === 1 ? '10px' : '8px',
10 | paddingRight: elevation === 1 ? '10px' : '8px',
11 | marginBottom: '28px'
12 | }));
13 |
--------------------------------------------------------------------------------
/packages/smart-forms-renderer/src/components/FormComponents/GroupItem/index.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2024 Commonwealth Scientific and Industrial Research
3 | * Organisation (CSIRO) ABN 41 687 119 230.
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License");
6 | * you may not use this file except in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 |
18 | export { default as GroupItem } from './GroupItem';
19 |
--------------------------------------------------------------------------------
/packages/smart-forms-renderer/src/components/FormComponents/ItemParts/DisplayUnitText.tsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import Typography from '@mui/material/Typography';
3 | import { useRendererStylingStore } from '../../../stores';
4 |
5 | interface DisplayUnitTextProps {
6 | readOnly: boolean;
7 | children: string;
8 | }
9 |
10 | function DisplayUnitText(props: DisplayUnitTextProps) {
11 | const { readOnly, children } = props;
12 |
13 | const readOnlyVisualStyle = useRendererStylingStore.use.readOnlyVisualStyle();
14 |
15 | const readOnlyTextColor = readOnlyVisualStyle === 'disabled' ? 'text.disabled' : 'text.secondary';
16 |
17 | return (
18 |
22 | {children}
23 |
24 | );
25 | }
26 |
27 | export default DisplayUnitText;
28 |
--------------------------------------------------------------------------------
/packages/smart-forms-renderer/src/components/FormComponents/ItemParts/index.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2024 Commonwealth Scientific and Industrial Research
3 | * Organisation (CSIRO) ABN 41 687 119 230.
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License");
6 | * you may not use this file except in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 |
18 | export { default as ItemFieldGrid } from './ItemFieldGrid';
19 | export { default as ItemLabel } from './ItemLabel';
20 |
--------------------------------------------------------------------------------
/packages/smart-forms-renderer/src/components/FormComponents/RepeatGroup/index.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2024 Commonwealth Scientific and Industrial Research
3 | * Organisation (CSIRO) ABN 41 687 119 230.
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License");
6 | * you may not use this file except in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 |
18 | export { default as RepeatGroup } from './RepeatGroup';
19 |
--------------------------------------------------------------------------------
/packages/smart-forms-renderer/src/components/FormComponents/RepeatItem/index.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2024 Commonwealth Scientific and Industrial Research
3 | * Organisation (CSIRO) ABN 41 687 119 230.
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License");
6 | * you may not use this file except in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 |
18 | export { default as RepeatItem } from './RepeatItem';
19 |
--------------------------------------------------------------------------------
/packages/smart-forms-renderer/src/components/FormComponents/SingleItem/index.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2024 Commonwealth Scientific and Industrial Research
3 | * Organisation (CSIRO) ABN 41 687 119 230.
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License");
6 | * you may not use this file except in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 |
18 | export { default as SingleItem } from './SingleItem';
19 |
--------------------------------------------------------------------------------
/packages/smart-forms-renderer/src/components/FormComponents/StringItem/index.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2024 Commonwealth Scientific and Industrial Research
3 | * Organisation (CSIRO) ABN 41 687 119 230.
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License");
6 | * you may not use this file except in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 |
18 | export { default as StringField } from './StringField';
19 |
--------------------------------------------------------------------------------
/packages/smart-forms-renderer/src/components/FormComponents/Tables/index.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2024 Commonwealth Scientific and Industrial Research
3 | * Organisation (CSIRO) ABN 41 687 119 230.
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License");
6 | * you may not use this file except in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 |
18 | export { default as GroupTable } from './GroupTable';
19 |
--------------------------------------------------------------------------------
/packages/smart-forms-renderer/src/components/FormComponents/TextItem/MuiTextField.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2024 Commonwealth Scientific and Industrial Research
3 | * Organisation (CSIRO) ABN 41 687 119 230.
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License");
6 | * you may not use this file except in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 |
18 | import TextField from '@mui/material/TextField';
19 |
20 | const MuiTextField = TextField;
21 |
22 | export default MuiTextField;
23 |
--------------------------------------------------------------------------------
/packages/smart-forms-renderer/src/components/Renderer/index.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2024 Commonwealth Scientific and Industrial Research
3 | * Organisation (CSIRO) ABN 41 687 119 230.
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License");
6 | * you may not use this file except in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 |
18 | export type { SmartFormsRendererProps } from './SmartFormsRenderer';
19 | export { default as SmartFormsRenderer } from './SmartFormsRenderer';
20 | export { default as BaseRenderer } from './BaseRenderer';
21 |
--------------------------------------------------------------------------------
/packages/smart-forms-renderer/src/globals.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2024 Commonwealth Scientific and Industrial Research
3 | * Organisation (CSIRO) ABN 41 687 119 230.
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License");
6 | * you may not use this file except in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 |
18 | export const TERMINOLOGY_SERVER_URL = 'https://tx.ontoserver.csiro.au/fhir';
19 |
--------------------------------------------------------------------------------
/packages/smart-forms-renderer/src/hooks/useAttachmentUrlValidation.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2024 Commonwealth Scientific and Industrial Research
3 | * Organisation (CSIRO) ABN 41 687 119 230.
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License");
6 | * you may not use this file except in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 |
18 | function useAttachmentUrlValidation(url: string): boolean {
19 | try {
20 | new URL(url);
21 | return true;
22 | } catch (error) {
23 | return false;
24 | }
25 | }
26 |
27 | export default useAttachmentUrlValidation;
28 |
--------------------------------------------------------------------------------
/packages/smart-forms-renderer/src/hooks/useFocusTabHeading.ts:
--------------------------------------------------------------------------------
1 | import { useCallback } from 'react';
2 |
3 | export function useFocusTabHeading() {
4 | return useCallback((tabPanelId: string) => {
5 | // Find the first heading in the tab panel that was just activated
6 | const tabPanel = document.getElementById(tabPanelId);
7 | if (!tabPanel) return;
8 |
9 | // Look for the first heading element within the tab panel
10 | const firstHeading = tabPanel.querySelector('h1, h2, h3, h4, h5, h6');
11 | if (!firstHeading) return;
12 |
13 | // If heading doesn't have tabindex=-1, add it
14 | if (!firstHeading.hasAttribute('tabindex')) {
15 | firstHeading.setAttribute('tabindex', '-1');
16 | }
17 |
18 | // Focus the heading
19 | (firstHeading as HTMLElement).focus();
20 | }, []);
21 | }
22 |
--------------------------------------------------------------------------------
/packages/smart-forms-renderer/src/interfaces/answerExpression.interface.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2024 Commonwealth Scientific and Industrial Research
3 | * Organisation (CSIRO) ABN 41 687 119 230.
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License");
6 | * you may not use this file except in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 |
18 | import type { QuestionnaireItemAnswerOption } from 'fhir/r4';
19 |
20 | export interface AnswerExpression {
21 | expression: string;
22 | value?: QuestionnaireItemAnswerOption;
23 | }
24 |
--------------------------------------------------------------------------------
/packages/smart-forms-renderer/src/interfaces/answerOptionsToggleExpression.interface.ts:
--------------------------------------------------------------------------------
1 | import type { Expression, QuestionnaireItemAnswerOption } from 'fhir/r4';
2 |
3 | export interface AnswerOptionsToggleExpression {
4 | linkId: string;
5 | options: RestrictedAnswerOption[];
6 | valueExpression: Expression;
7 | isEnabled?: boolean;
8 | }
9 |
10 | export interface RestrictedAnswerOption
11 | extends Omit<
12 | QuestionnaireItemAnswerOption,
13 | | 'initialSelected'
14 | | '_initialSelected'
15 | | 'valueDate'
16 | | '_valueDate'
17 | | 'valueTime'
18 | | '_valueTime'
19 | | 'valueReference'
20 | > {}
21 |
--------------------------------------------------------------------------------
/packages/smart-forms-renderer/src/interfaces/computedUpdates.interface.ts:
--------------------------------------------------------------------------------
1 | import type { QuestionnaireResponseItem, QuestionnaireResponseItemAnswer } from 'fhir/r4';
2 |
3 | export type ComputedQRItemUpdates = Record;
4 |
5 | export type ComputedNewAnswers = Record;
6 |
--------------------------------------------------------------------------------
/packages/smart-forms-renderer/src/interfaces/groupTable.interface.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2024 Commonwealth Scientific and Industrial Research
3 | * Organisation (CSIRO) ABN 41 687 119 230.
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License");
6 | * you may not use this file except in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 |
18 | import type { QuestionnaireResponseItem } from 'fhir/r4';
19 |
20 | export interface GroupTableRowModel {
21 | id: string;
22 | qrItem: QuestionnaireResponseItem | null;
23 | }
24 |
--------------------------------------------------------------------------------
/packages/smart-forms-renderer/src/interfaces/initialExpression.interface.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2024 Commonwealth Scientific and Industrial Research
3 | * Organisation (CSIRO) ABN 41 687 119 230.
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License");
6 | * you may not use this file except in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 |
18 | /**
19 | * InitialExpression interface
20 | *
21 | * @property expression - InitialExpression FHIRPath expression
22 | */
23 | export interface InitialExpression {
24 | expression: string;
25 | }
26 |
--------------------------------------------------------------------------------
/packages/smart-forms-renderer/src/interfaces/lookup.interface.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2024 Commonwealth Scientific and Industrial Research
3 | * Organisation (CSIRO) ABN 41 687 119 230.
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License");
6 | * you may not use this file except in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 |
18 | import type { Coding } from 'fhir/r4';
19 |
20 | export interface CodeSystemLookupPromise {
21 | promise: Promise>;
22 | oldCoding: Coding;
23 | newCoding?: Coding;
24 | }
25 |
--------------------------------------------------------------------------------
/packages/smart-forms-renderer/src/interfaces/page.interface.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Page interface
3 | *
4 | * @property pageIndex - The index of the page
5 | * @property isComplete - Whether the page is marked as complete
6 | * @property isHidden - Whether the page is hidden
7 | */
8 | export type Page = { pageIndex: number; isComplete: boolean; isHidden: boolean };
9 |
10 | /**
11 | * Key-value pair of pages `Record`
12 | */
13 | export type Pages = Record;
14 |
--------------------------------------------------------------------------------
/packages/smart-forms-renderer/src/interfaces/regex.interface.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2024 Commonwealth Scientific and Industrial Research
3 | * Organisation (CSIRO) ABN 41 687 119 230.
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License");
6 | * you may not use this file except in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 |
18 | export interface RegexValidation {
19 | expression: RegExp;
20 | feedback: string | null;
21 | }
22 |
--------------------------------------------------------------------------------
/packages/smart-forms-renderer/src/interfaces/targetConstraint.interface.ts:
--------------------------------------------------------------------------------
1 | import type { Expression, Extension } from 'fhir/r4';
2 |
3 | export interface TargetConstraint {
4 | key: string;
5 | severityCode: 'error' | 'warning';
6 | valueExpression: Expression;
7 | human: string;
8 | location?: string;
9 | linkId?: string;
10 | isEnabled?: boolean;
11 | }
12 |
13 | export interface TargetConstraintKey extends Extension {
14 | url: 'key';
15 | valueId: string;
16 | }
17 |
18 | export interface TargetConstraintSeverity extends Extension {
19 | url: 'severity';
20 | valueCode: 'error' | 'warning';
21 | }
22 |
23 | export interface TargetConstraintExpression extends Extension {
24 | url: 'expression';
25 | valueExpression: Expression;
26 | }
27 |
28 | export interface TargetConstraintHuman extends Extension {
29 | url: 'human';
30 | valueString: string;
31 | }
32 |
33 | export interface TargetConstraintLocation extends Extension {
34 | url: 'location';
35 | valueString: string;
36 | }
37 |
--------------------------------------------------------------------------------
/packages/smart-forms-renderer/src/setup-jest.ts:
--------------------------------------------------------------------------------
1 | import '@testing-library/jest-dom';
2 |
--------------------------------------------------------------------------------
/packages/smart-forms-renderer/src/stores/index.ts:
--------------------------------------------------------------------------------
1 | export * from './questionnaireStore';
2 | export * from './questionnaireResponseStore';
3 | export * from './smartConfigStore';
4 | export * from './terminologyServerStore';
5 | export * from './rendererStylingStore';
6 |
7 | export type { QuestionnaireStoreType } from './questionnaireStore';
8 |
9 | export type { QuestionnaireResponseStoreType } from './questionnaireResponseStore';
10 |
11 | export type { SmartConfigStoreType } from './smartConfigStore';
12 |
13 | export type { TerminologyServerStoreType } from './terminologyServerStore';
14 |
15 | export type { RendererStyling, RendererStylingStoreType } from './rendererStylingStore';
16 |
17 | export { smartConfigStore, useSmartConfigStore } from './smartConfigStore';
18 | export { terminologyServerStore, useTerminologyServerStore } from './terminologyServerStore';
19 | export { rendererStylingStore, useRendererStylingStore } from './rendererStylingStore';
20 |
--------------------------------------------------------------------------------
/packages/smart-forms-renderer/src/stores/selector.ts:
--------------------------------------------------------------------------------
1 | import type { StoreApi } from 'zustand';
2 | import { useStore } from 'zustand';
3 |
4 | type WithSelectors = S extends { getState: () => infer T }
5 | ? S & { use: { [K in keyof T]: () => T[K] } }
6 | : never;
7 |
8 | export const createSelectors = >(_store: S) => {
9 | const store = _store as WithSelectors;
10 | store.use = {};
11 | for (const k of Object.keys(store.getState())) {
12 | // eslint-disable-next-line react-hooks/rules-of-hooks
13 | (store.use as any)[k] = () => useStore(_store, (s) => s[k as keyof typeof s]);
14 | }
15 |
16 | return store;
17 | };
18 |
--------------------------------------------------------------------------------
/packages/smart-forms-renderer/src/stories/storybookWrappers/TestCssSheet.css:
--------------------------------------------------------------------------------
1 | /* This stylesheet is using for testing the RenderingXhtmlGroupPropagationClassStyles story, it has no other use outside of this.
2 | * It works by having a class defined in the XHTML, where the class references external styles from a stylesheet.
3 | * Please import the stylesheet where you call the component.
4 | *
5 | * NOTE before using:
6 | * The renderer support this, but it is recommended to define the styles inline in the XHTML.
7 | * Using external styles means that the Questionnaire itself is not self-contained and the stylings are almost guaranteed to not work in other SDC implementations.
8 | * For accurate guidance, see https://hl7.org/fhir/R4/narrative.html#:~:text=Authoring%20systems%20may,approach%20with%20care.
9 | */
10 |
11 | .group-custom-bg {
12 | background-color: #e9f2ff;
13 | }
14 |
15 | .bold {
16 | font-weight: bold;
17 | }
18 |
--------------------------------------------------------------------------------
/packages/smart-forms-renderer/src/stories/storybookWrappers/globals.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2024 Commonwealth Scientific and Industrial Research
3 | * Organisation (CSIRO) ABN 41 687 119 230.
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License");
6 | * you may not use this file except in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 |
18 | export const STORYBOOK_TERMINOLOGY_SERVER_URL = 'https://r4.ontoserver.csiro.au/fhir';
19 |
--------------------------------------------------------------------------------
/packages/smart-forms-renderer/src/stories/storybookWrappers/index.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2024 Commonwealth Scientific and Industrial Research
3 | * Organisation (CSIRO) ABN 41 687 119 230.
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License");
6 | * you may not use this file except in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 |
18 | export type { InitialiseFormWrapperProps } from './InitialiseFormWrapperForStorybook';
19 | export { default as InitialiseFormWrapperForStorybook } from './InitialiseFormWrapperForStorybook';
20 |
--------------------------------------------------------------------------------
/packages/smart-forms-renderer/src/tests/test-data/initial-answers-sample.json:
--------------------------------------------------------------------------------
1 | {
2 | "e2a16e4d-2765-4b61-b286-82cfc6356b30": [
3 | {
4 | "valueInteger": 87
5 | }
6 | ],
7 | "b639a3a8-f476-4cc8-b5c7-f5d2abb23511": [
8 | {
9 | "valueCoding": {
10 | "system": "http://snomed.info/sct",
11 | "code": "8517006",
12 | "display": "Former smoker"
13 | }
14 | }
15 | ]
16 | }
17 |
--------------------------------------------------------------------------------
/packages/smart-forms-renderer/src/theme/index.ts:
--------------------------------------------------------------------------------
1 | // Export whole RendererThemeProvider
2 | export { RendererThemeProvider } from './RendererThemeProvider';
3 |
4 | // Export whole component overrides
5 | export { rendererThemeComponentOverrides } from './overrides/rendererThemeComponentOverrides';
6 |
7 | // Export individual component overrides
8 | export { accordionOverride } from './overrides/accordionOverride';
9 | export { autocompleteOverride } from './overrides/autocompleteOverride';
10 | export { buttonOverride } from './overrides/buttonOverride';
11 | export { cardOverride } from './overrides/cardOverride';
12 | export { inputOverride } from './overrides/inputOverride';
13 | export { paperOverride } from './overrides/paperOverride';
14 | export { speedDialOverride } from './overrides/speedDialOverride';
15 | export { tableOverride } from './overrides/tableOverride';
16 |
17 | // Export themeOptions
18 | export { rendererThemeOptions } from './rendererThemeOptions';
19 |
--------------------------------------------------------------------------------
/packages/smart-forms-renderer/src/utils/checkbox.ts:
--------------------------------------------------------------------------------
1 | export type AriaCheckedAttributes = 'true' | 'false' | 'mixed';
2 |
3 | export const ariaCheckedMap: Map = new Map([
4 | ['true', 'true'],
5 | ['false', 'false'],
6 | ['intermediate', 'mixed']
7 | ]);
8 |
--------------------------------------------------------------------------------
/packages/smart-forms-renderer/src/utils/dayjsExtend.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2024 Commonwealth Scientific and Industrial Research
3 | * Organisation (CSIRO) ABN 41 687 119 230.
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License");
6 | * you may not use this file except in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 |
18 | import dayjs from 'dayjs';
19 | import localizedFormat from 'dayjs/plugin/localizedFormat';
20 | import customParseFormat from 'dayjs/plugin/customParseFormat';
21 |
22 | dayjs.extend(localizedFormat);
23 | dayjs.extend(customParseFormat);
24 |
--------------------------------------------------------------------------------
/packages/smart-forms-renderer/src/utils/debounce.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2024 Commonwealth Scientific and Industrial Research
3 | * Organisation (CSIRO) ABN 41 687 119 230.
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License");
6 | * you may not use this file except in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 |
18 | export const DEBOUNCE_DURATION = 300;
19 |
20 | export const AUTOCOMPLETE_DEBOUNCE_DURATION = 300;
21 |
--------------------------------------------------------------------------------
/packages/smart-forms-renderer/src/utils/questionnaireStoreUtils/extractAnswerOptionsToggleExpressions.ts:
--------------------------------------------------------------------------------
1 | import type { Extension } from 'fhir/r4';
2 | import type { RestrictedAnswerOption } from '../../interfaces/answerOptionsToggleExpression.interface';
3 |
4 | export function optionIsAnswerOptionsToggleExpressionOption(
5 | optionExtension: Extension
6 | ): optionExtension is Extension & RestrictedAnswerOption {
7 | return (
8 | optionExtension.valueCoding !== undefined ||
9 | optionExtension.valueString !== undefined ||
10 | optionExtension.valueInteger !== undefined
11 | );
12 | }
13 |
--------------------------------------------------------------------------------
/packages/smart-forms-renderer/src/utils/questionnaireStoreUtils/extractLaunchContext.ts:
--------------------------------------------------------------------------------
1 | import type { Questionnaire } from 'fhir/r4';
2 | import type { LaunchContext } from '../../interfaces/populate.interface';
3 | import { isLaunchContext } from '../populateContexts';
4 |
5 | export function extractLaunchContexts(questionnaire: Questionnaire): Record {
6 | if (!questionnaire.extension || questionnaire.extension.length === 0) {
7 | return {};
8 | }
9 |
10 | const launchContexts: Record = {};
11 | for (const ext of questionnaire.extension) {
12 | if (isLaunchContext(ext)) {
13 | const launchContextName = ext.extension[0].valueId ?? ext.extension[0].valueCoding?.code;
14 | if (launchContextName) {
15 | launchContexts[launchContextName] = ext;
16 | }
17 | }
18 | }
19 |
20 | return launchContexts;
21 | }
22 |
--------------------------------------------------------------------------------
/packages/smart-forms-renderer/src/vite-env.d.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2023 Commonwealth Scientific and Industrial Research
3 | * Organisation (CSIRO) ABN 41 687 119 230.
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License");
6 | * you may not use this file except in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 |
18 | ///
19 | // Vite is only used for Storybook
20 |
21 | interface ImportMetaEnv {
22 | readonly VITE_RENDERER_VERSION: string;
23 | }
24 |
25 | interface ImportMeta {
26 | readonly env: ImportMetaEnv;
27 | }
28 |
--------------------------------------------------------------------------------
/packages/smart-forms-renderer/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "target": "ES6",
4 | "module": "ES6",
5 | "allowSyntheticDefaultImports": true,
6 | "esModuleInterop": true,
7 | "moduleResolution": "node",
8 | "forceConsistentCasingInFileNames": true,
9 | "useUnknownInCatchVariables": false,
10 | "strict": true,
11 | "skipLibCheck": true,
12 | "jsx": "react-jsx",
13 | "sourceMap": true,
14 | "allowJs": true,
15 | "outDir": "lib",
16 | "declaration": true,
17 | "checkJs": true,
18 | "resolveJsonModule": true
19 | },
20 | "include": ["src"],
21 | "exclude": ["src/**/*.test.ts", "src/stories/**/*", "src/setup-jest.*", "lib", "dist"]
22 | }
23 |
--------------------------------------------------------------------------------
/scripts/FhirMappingLanguage/blood-pressure/questionnaire-response.json:
--------------------------------------------------------------------------------
1 | {
2 | "resourceType": "QuestionnaireResponse",
3 | "id": "bp-response-1",
4 | "questionnaire": "https://smartforms.csiro.au/docs/Questionnaire/blood-pressure",
5 | "status": "completed",
6 | "subject": {
7 | "reference": "Patient/123",
8 | "display": "John Doe"
9 | },
10 | "authored": "2024-03-20T10:00:00Z",
11 | "item": [
12 | {
13 | "linkId": "blood-pressure",
14 | "text": "Blood Pressure Measurement",
15 | "item": [
16 | {
17 | "linkId": "systolic",
18 | "text": "Systolic Blood Pressure",
19 | "answer": [
20 | {
21 | "valueInteger": 120
22 | }
23 | ]
24 | },
25 | {
26 | "linkId": "diastolic",
27 | "text": "Diastolic Blood Pressure",
28 | "answer": [
29 | {
30 | "valueInteger": 80
31 | }
32 | ]
33 | }
34 | ]
35 | }
36 | ]
37 | }
38 |
--------------------------------------------------------------------------------
/scripts/FhirMappingLanguage/blood-pressure/questionnaireResponse.json:
--------------------------------------------------------------------------------
1 | {
2 | "resourceType": "QuestionnaireResponse",
3 | "status": "completed",
4 | "subject": {
5 | "reference": "Patient/123"
6 | },
7 | "item": [
8 | {
9 | "linkId": "systolic",
10 | "answer": [
11 | {
12 | "valueQuantity": {
13 | "value": 18,
14 | "unit": "mmHg",
15 | "system": "http://unitsofmeasure.org",
16 | "code": "mm[Hg]"
17 | }
18 | }
19 | ]
20 | },
21 | {
22 | "linkId": "diastolic",
23 | "answer": [
24 | {
25 | "valueQuantity": {
26 | "value": 9,
27 | "unit": "mmHg",
28 | "system": "http://unitsofmeasure.org",
29 | "code": "mm[Hg]"
30 | }
31 | }
32 | ]
33 | }
34 | ]
35 | }
36 |
--------------------------------------------------------------------------------
/services/assemble-express/.gitignore:
--------------------------------------------------------------------------------
1 | node_modules
2 | lib
3 | .env
4 |
--------------------------------------------------------------------------------
/services/assemble-express/Dockerfile:
--------------------------------------------------------------------------------
1 | # Builder stage
2 | FROM node:19-alpine AS builder
3 |
4 | WORKDIR /usr/share/app
5 |
6 | COPY packages/sdc-assemble packages/sdc-assemble
7 | COPY services/assemble-express services/assemble-express
8 | COPY package*.json .
9 |
10 | RUN npm ci
11 |
12 | # Create image stage
13 | FROM node:19-alpine
14 |
15 | COPY --from=builder /usr/share/app/services/assemble-express/lib /usr/share/app
16 | COPY --from=builder /usr/share/app/packages/sdc-assemble /usr/share/app/packages/sdc-assemble
17 | COPY --from=builder /usr/share/app/node_modules /usr/share/app/node_modules
18 |
19 | # Define environment variables
20 | # Or you can choose to copy the entire env file to the docker image's root dir to be read by dotenv (not best practice)
21 | # i.e. COPY --from=builder /usr/share/app/services/assemble-express/.env .
22 |
23 | CMD ["node", "/usr/share/app/index.js"]
24 |
25 | EXPOSE 3002
26 |
--------------------------------------------------------------------------------
/services/assemble-express/example.env:
--------------------------------------------------------------------------------
1 | # Copy this file to .env and update the values to match your environment
2 |
3 | # By default, the service will use the request endpoint as the forms server
4 | # i.e. Deploying this service on http://localhost:3002 will result in http://localhost:3002 as the forms server URL
5 | # If you want to use a different Forms server, update the following values
6 | FORMS_SERVER_URL=
7 | FORMS_SERVER_AUTH_TOKEN=
8 |
--------------------------------------------------------------------------------
/services/assemble-express/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "assemble-express",
3 | "version": "2.0.0",
4 | "description": "",
5 | "main": "lib/index.js",
6 | "scripts": {
7 | "compile": "tsc",
8 | "start": "node --inspect lib/index.js",
9 | "start:watch": "node --inspect --watch lib/index.js",
10 | "test": "echo \"Error: no test specified\" && exit 1"
11 | },
12 | "author": "Sean Fong",
13 | "license": "Apache-2.0",
14 | "dependencies": {
15 | "express": "^4.21.0",
16 | "@aehrc/sdc-assemble": "^2.0.0",
17 | "dotenv": "^16.4.5",
18 | "cors": "^2.8.5"
19 | },
20 | "devDependencies": {
21 | "@types/express": "^4.17.21",
22 | "@types/cors": "^2.8.17",
23 | "@types/fhir": "^0.0.38",
24 | "@types/node": "^22.15.29",
25 | "typescript": "^5.8.3"
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/services/assemble-express/src/globals.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2024 Commonwealth Scientific and Industrial Research
3 | * Organisation (CSIRO) ABN 41 687 119 230.
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License");
6 | * you may not use this file except in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 |
18 | export const HEADERS = {
19 | 'Cache-Control': 'no-cache',
20 | 'Content-Type': 'application/fhir+json;charset=utf-8',
21 | Accept: 'application/json;charset=utf-8'
22 | };
23 |
--------------------------------------------------------------------------------
/services/assemble-express/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "target": "ES6",
4 | "module": "CommonJS",
5 | "allowSyntheticDefaultImports": true,
6 | "esModuleInterop": true,
7 | "moduleResolution": "node",
8 | "forceConsistentCasingInFileNames": true,
9 | "strict": true,
10 | "skipLibCheck": true,
11 | "jsx": "react",
12 | "sourceMap": true,
13 | "allowJs": true,
14 | "outDir": "lib",
15 | "declaration": true,
16 | "checkJs": true,
17 | "resolveJsonModule": true,
18 |
19 | "allowUnusedLabels": false,
20 | "allowUnreachableCode": false,
21 | "exactOptionalPropertyTypes": true,
22 | "noFallthroughCasesInSwitch": true,
23 | "noImplicitOverride": true,
24 | "noImplicitReturns": true,
25 | "noPropertyAccessFromIndexSignature": true,
26 | "noUncheckedIndexedAccess": true,
27 | "noUnusedLocals": true,
28 | "noUnusedParameters": true
29 | },
30 | "include": ["src"],
31 | "exclude": ["src/**/*.test.ts", "lib"]
32 | }
33 |
--------------------------------------------------------------------------------
/services/extract-express/.gitignore:
--------------------------------------------------------------------------------
1 | node_modules
2 | lib
3 | .env
4 |
--------------------------------------------------------------------------------
/services/extract-express/Dockerfile:
--------------------------------------------------------------------------------
1 | # Builder stage
2 | FROM node:19-alpine AS builder
3 |
4 | WORKDIR /usr/share/app
5 |
6 | COPY services/extract-express services/extract-express
7 | COPY package*.json .
8 |
9 | RUN npm ci
10 |
11 | # Create image stage
12 | FROM node:19-alpine
13 |
14 | COPY --from=builder /usr/share/app/services/extract-express/lib /usr/share/app
15 | COPY --from=builder /usr/share/app/node_modules /usr/share/app/node_modules
16 |
17 | # Define environment variables
18 | # Or you can choose to copy the entire env file to the docker image's root dir to be read by dotenv (not best practice)
19 | # i.e. COPY --from=builder /usr/share/app/services/extract-express/.env .
20 | ENV FORMS_SERVER_URL='https://smartforms.csiro.au/api/fhir'
21 |
22 | CMD ["node", "/usr/share/app/index.js"]
23 |
24 | EXPOSE 3003
25 |
--------------------------------------------------------------------------------
/services/extract-express/docker_run_sample.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | docker run \
3 | -p 3003:3003 \
4 | -d \
5 | -e EHR_SERVER_URL=https://proxy.smartforms.io/fhir \
6 | aehrc/smart-forms-extract:latest
7 |
--------------------------------------------------------------------------------
/services/extract-express/example.env:
--------------------------------------------------------------------------------
1 | # Copy this file to .env and update the values to match your environment
2 |
3 | # By default, the service will use the request endpoint as the EHR server
4 | # i.e. Deploying this service on http://localhost:3003 will result in http://localhost:3003 as the EHR server URL
5 | # If you want to use a different EHR server, update the following values
6 | EHR_SERVER_URL=
7 | EHR_SERVER_AUTH_TOKEN=
8 |
9 | # Default Forms Server is a public server, no authentication required
10 | FORMS_SERVER_URL=https://smartforms.csiro.au/api/fhir
11 | FORMS_SERVER_AUTH_TOKEN=
12 |
--------------------------------------------------------------------------------
/services/extract-express/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "extract-express",
3 | "version": "0.4.0",
4 | "description": "",
5 | "main": "lib/index.js",
6 | "scripts": {
7 | "compile": "tsc",
8 | "start": "node --inspect lib/index.js",
9 | "start:watch": "node --inspect --watch lib/index.js",
10 | "test": "echo \"Error: no test specified\" && exit 1"
11 | },
12 | "author": "Sean Fong",
13 | "license": "Apache-2.0",
14 | "dependencies": {
15 | "express": "^4.21.0",
16 | "cors": "^2.8.5",
17 | "dotenv": "^16.4.5"
18 | },
19 | "devDependencies": {
20 | "@types/express": "^4.17.21",
21 | "@types/cors": "^2.8.17",
22 | "@types/fhir": "^0.0.38",
23 | "@types/node": "^22.15.29",
24 | "typescript": "^5.8.3"
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/services/extract-express/src/fhirMappingLanguage.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2024 Commonwealth Scientific and Industrial Research
3 | * Organisation (CSIRO) ABN 41 687 119 230.
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License");
6 | * you may not use this file except in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 |
18 | export function getFhirMappingLanguageMap(body: any): string | null {
19 | if (typeof body === 'string' && body.includes('map')) {
20 | return body;
21 | }
22 |
23 | return null;
24 | }
25 |
--------------------------------------------------------------------------------
/services/extract-express/src/globals.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2024 Commonwealth Scientific and Industrial Research
3 | * Organisation (CSIRO) ABN 41 687 119 230.
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License");
6 | * you may not use this file except in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 |
18 | export const HEADERS = {
19 | 'Cache-Control': 'no-cache',
20 | 'Content-Type': 'application/fhir+json;charset=utf-8',
21 | Accept: 'application/json;charset=utf-8'
22 | };
23 |
--------------------------------------------------------------------------------
/services/extract-express/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "target": "ES6",
4 | "module": "CommonJS",
5 | "allowSyntheticDefaultImports": true,
6 | "esModuleInterop": true,
7 | "moduleResolution": "node",
8 | "forceConsistentCasingInFileNames": true,
9 | "strict": true,
10 | "skipLibCheck": true,
11 | "jsx": "react",
12 | "sourceMap": true,
13 | "allowJs": true,
14 | "outDir": "lib",
15 | "declaration": true,
16 | "checkJs": true,
17 | "resolveJsonModule": true,
18 |
19 | "allowUnusedLabels": false,
20 | "allowUnreachableCode": false,
21 | "exactOptionalPropertyTypes": true,
22 | "noFallthroughCasesInSwitch": true,
23 | "noImplicitOverride": true,
24 | "noImplicitReturns": true,
25 | "noPropertyAccessFromIndexSignature": true,
26 | "noUncheckedIndexedAccess": true,
27 | "noUnusedLocals": true,
28 | "noUnusedParameters": true
29 | },
30 | "include": ["src"],
31 | "exclude": ["src/**/*.test.ts", "lib"]
32 | }
33 |
--------------------------------------------------------------------------------
/services/populate-express/.gitignore:
--------------------------------------------------------------------------------
1 | node_modules
2 | lib
3 | .env
4 |
--------------------------------------------------------------------------------
/services/populate-express/Dockerfile:
--------------------------------------------------------------------------------
1 | # Builder stage
2 | FROM node:19-alpine AS builder
3 |
4 | WORKDIR /usr/share/app
5 |
6 | COPY packages/sdc-populate packages/sdc-populate
7 | COPY services/populate-express services/populate-express
8 | COPY package*.json .
9 |
10 | RUN npm ci
11 |
12 | # Create image stage
13 | FROM node:19-alpine
14 |
15 | COPY --from=builder /usr/share/app/services/populate-express/lib /usr/share/app
16 | COPY --from=0 /usr/share/app/packages/sdc-populate /usr/share/app/packages/sdc-populate
17 | COPY --from=builder /usr/share/app/node_modules /usr/share/app/node_modules
18 |
19 | # Define environment variables
20 | # Or you can choose to copy the entire env file to the docker image's root dir to be read by dotenv (not best practice)
21 | # i.e. COPY --from=builder /usr/share/app/services/populate-express/.env .
22 |
23 | CMD ["node", "/usr/share/app/index.js"]
24 |
25 | EXPOSE 3001
26 |
--------------------------------------------------------------------------------
/services/populate-express/example.env:
--------------------------------------------------------------------------------
1 | # Copy this file to .env and update the values to match your environment
2 |
3 | # By default, the service will use the request endpoint as the EHR server
4 | # i.e. Deploying this service on http://localhost:3001 will result in http://localhost:3001 as the EHR server URL
5 | # If you want to use a different EHR server, update the following values
6 | EHR_SERVER_URL=
7 | EHR_SERVER_AUTH_TOKEN=
8 |
9 | TERMINOLOGY_SERVER_URL=https://r4.ontoserver.csiro.au/fhir
10 | TERMINOLOGY_SERVER_AUTH_TOKEN=
11 |
--------------------------------------------------------------------------------
/services/populate-express/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "populate-express",
3 | "version": "4.0.0",
4 | "description": "",
5 | "main": "lib/index.js",
6 | "scripts": {
7 | "compile": "tsc",
8 | "start": "node --inspect lib/index.js",
9 | "start:watch": "node --inspect --watch lib/index.js",
10 | "test": "echo \"Error: no test specified\" && exit 1"
11 | },
12 | "author": "Sean Fong",
13 | "license": "Apache-2.0",
14 | "dependencies": {
15 | "express": "^4.21.0",
16 | "@aehrc/sdc-populate": "^4.0.0",
17 | "dotenv": "^16.4.5",
18 | "cors": "^2.8.5"
19 | },
20 | "devDependencies": {
21 | "@types/express": "^4.17.21",
22 | "@types/cors": "^2.8.17",
23 | "@types/fhir": "^0.0.38",
24 | "@types/node": "^22.15.29",
25 | "typescript": "^5.8.3"
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/services/populate-express/src/globals.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2024 Commonwealth Scientific and Industrial Research
3 | * Organisation (CSIRO) ABN 41 687 119 230.
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License");
6 | * you may not use this file except in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 |
18 | export const HEADERS = {
19 | 'Cache-Control': 'no-cache',
20 | 'Content-Type': 'application/fhir+json;charset=utf-8',
21 | Accept: 'application/json;charset=utf-8'
22 | };
23 |
--------------------------------------------------------------------------------
/services/populate-express/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "target": "ES6",
4 | "module": "CommonJS",
5 | "allowSyntheticDefaultImports": true,
6 | "esModuleInterop": true,
7 | "moduleResolution": "node",
8 | "forceConsistentCasingInFileNames": true,
9 | "strict": true,
10 | "skipLibCheck": true,
11 | "jsx": "react",
12 | "sourceMap": true,
13 | "allowJs": true,
14 | "outDir": "lib",
15 | "declaration": true,
16 | "checkJs": true,
17 | "resolveJsonModule": true,
18 |
19 | "allowUnusedLabels": false,
20 | "allowUnreachableCode": false,
21 | "exactOptionalPropertyTypes": true,
22 | "noFallthroughCasesInSwitch": true,
23 | "noImplicitOverride": true,
24 | "noImplicitReturns": true,
25 | "noPropertyAccessFromIndexSignature": true,
26 | "noUncheckedIndexedAccess": true,
27 | "noUnusedLocals": true,
28 | "noUnusedParameters": true
29 | },
30 | "include": ["src"],
31 | "exclude": ["src/**/*.test.ts", "lib"]
32 | }
33 |
--------------------------------------------------------------------------------