Skip to content

Commit

Permalink
Merge pull request #424 from aehrc/fix/packages
Browse files Browse the repository at this point in the history
Fix/packages
  • Loading branch information
fongsean authored Sep 1, 2023
2 parents dfbce57 + 4fc86cb commit 8c7ff37
Show file tree
Hide file tree
Showing 23 changed files with 564 additions and 103 deletions.
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
<div>
<h1>Smart Forms</h1>
<h3>An open source FHIR powered forms app built in React</h3>
<h4>
Powered by SMART on FHIR and Structured Data Capture, Smart Forms allow you to easily integrate forms into your existing healthcare system.
</h4>
<h3><a href="https://www.smartforms.io">Show me the app ➡️</a></h3>
<br/>
</div>

---
Smart Forms is a Typescript-based [React](https://reactjs.org/) forms web application currently ongoing development by [CSIRO's Australian e-Health Research Centre](https://aehrc.csiro.au/) as part of the Primary Care Data Quality project funded by the Australian Government Department of Health.

The web app is intended to demonstrate the use of [HL7 FHIR](https://hl7.org/fhir/) specifications, such as the [Questionnaire](https://hl7.org/fhir/questionnaire.html) and [QuestionnaireResponse](https://hl7.org/fhir/questionnaireresponse.html) resources, the Structured Data Capture (SDC) implementation guide, and most notably it leverages [SMART on FHIR capabilities](https://hl7.org/fhir/smart-app-launch/index.html) that allows the app to be launched by a primary care Clinical Management System (CMS) and capture standardised health check information for healthcare clients.

This project was bootstrapped with [Vite](https://vitejs.dev/).
<br/>

**If you are interested in using the rendering engine in your projects, a standalone package is published on NPM as [@aehrc/smart-forms-renderer](https://www.npmjs.com/package/@aehrc/smart-forms-renderer).**
**Try out the standalone package here: https://www.smartforms.io/standalone**


## Functionalities
Expand Down
21 changes: 16 additions & 5 deletions apps/smart-forms-app/package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
{
"name": "smart-forms-app",
"name": "@aehrc/smart-forms-app",
"private": true,
"version": "0.1.0",
"version": "0.2.0",
"type": "module",
"description": "Typescript-based React web application implementing FHIR Structured Data Captured (SDC) specification",
"scripts": {
"dev": "vite",
"start": "vite",
Expand All @@ -13,8 +14,18 @@
"storybook": "storybook dev -p 6006",
"build-storybook": "storybook build"
},
"repository": {
"type": "git",
"url": "git+https://github.com/aehrc/smart-forms.git"
},
"author": "Sean Fong",
"license": "Apache-2.0",
"bugs": {
"url": "https://github.com/aehrc/smart-forms/issues"
},
"homepage": "https://github.com/aehrc/smart-forms#readme",
"dependencies": {
"@aehrc/smart-forms-renderer": "^0.6.1",
"@aehrc/smart-forms-renderer": "^0.6.6",
"@emotion/react": "^11.11.1",
"@emotion/styled": "^11.10.8",
"@fontsource/material-icons": "^5.0.7",
Expand Down Expand Up @@ -55,8 +66,8 @@
"react-router-dom": "6.15.0",
"react-spinners": "^0.13.8",
"react-to-print": "^2.14.13",
"sdc-assemble": "^1.0.1",
"sdc-populate": "^1.0.2",
"@aehrc/sdc-assemble": "^1.0.2",
"@aehrc/sdc-populate": "^1.0.3",
"simplebar-react": "^3.2.4",
"usehooks-ts": "^2.9.1",
"zustand": "^4.4.1"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
*/

import { IS_IN_APP_POPULATE } from '../../../utils/env.ts';
import type { InputParameters, OutputParameters } from 'sdc-populate';
import { isOutputParameters, populate } from 'sdc-populate';
import type { InputParameters, OutputParameters } from '@aehrc/sdc-populate';
import { isOutputParameters, populate } from '@aehrc/sdc-populate';
import type { RequestConfig } from '../utils/callback.ts';
import { fetchResourceCallback } from '../utils/callback.ts';
import { HEADERS } from '../../../api/headers.ts';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* limitations under the License.
*/

import type { FetchResourceCallback } from 'sdc-populate';
import type { FetchResourceCallback } from '@aehrc/sdc-populate';
import axios from 'axios';

const ABSOLUTE_URL_REGEX = /^(https?|ftp):\/\/[^\s/$.?#].[^\s]*$/;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ import {
getQuestionnaireLevelXFhirQueryVariables,
getSourceQueries
} from './getExtensions.ts';
import type { IssuesParameter, ResponseParameter } from 'sdc-populate';
import { isInputParameters } from 'sdc-populate';
import type { IssuesParameter, ResponseParameter } from '@aehrc/sdc-populate';
import { isInputParameters } from '@aehrc/sdc-populate';
import type Client from 'fhirclient/lib/Client';
import { createPopulateInputParameters } from './createInputParameters.ts';
import { requestPopulate } from '../api/requestPopulate.ts';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ import QCVDRiskJson from '../data/QCVDRisk.json';
import RCVDRiskJson from '../data/RCVDRisk.json';
import type { Questionnaire, QuestionnaireResponse } from 'fhir/r4';
import {
Box,
Button,
Checkbox,
Container,
FormControl,
Expand All @@ -39,7 +41,7 @@ import type {
RendererPropsActions,
RendererPropsState
} from '../interfaces/standalone.interface.ts';
import { SmartFormsRenderer } from '@aehrc/smart-forms-renderer';
import { getResponse, SmartFormsRenderer } from '@aehrc/smart-forms-renderer';

const rendererPropsReducer = (state: RendererPropsState, action: RendererPropsActions) => {
switch (action.type) {
Expand Down Expand Up @@ -124,46 +126,49 @@ function Standalone() {

return (
<Stack key={resource.id} rowGap={1}>
<FormControl>
<FormGroup row>
<FormControlLabel
disabled
required
control={<Checkbox defaultChecked />}
label="Questionnaire"
/>
<FormControlLabel
control={
<Checkbox
checked={state.response !== null}
onChange={() => {
dispatch({
type: 'SET_RESPONSE',
payload: state.response ? null : resource.response
});
}}
/>
}
label="Questionnaire response"
/>
{resource.additionalVars ? (
<Box display="flex" justifyContent="space-between">
<FormControl>
<FormGroup row>
<FormControlLabel
disabled
required
control={<Checkbox defaultChecked />}
label="Questionnaire"
/>
<FormControlLabel
control={
<Checkbox
checked={state.additionalVars !== null}
checked={state.response !== null}
onChange={() => {
dispatch({
type: 'SET_ADDITIONAL_VARS',
payload: state.additionalVars ? null : resource.additionalVars
type: 'SET_RESPONSE',
payload: state.response ? null : resource.response
});
}}
/>
}
label="Additional variables"
label="Questionnaire response"
/>
) : null}
</FormGroup>
</FormControl>
{resource.additionalVars ? (
<FormControlLabel
control={
<Checkbox
checked={state.additionalVars !== null}
onChange={() => {
dispatch({
type: 'SET_ADDITIONAL_VARS',
payload: state.additionalVars ? null : resource.additionalVars
});
}}
/>
}
label="Additional variables"
/>
) : null}
</FormGroup>
</FormControl>
<Button onClick={() => console.log(getResponse())}>Log response to console</Button>
</Box>
<SmartFormsRenderer
questionnaire={state.questionnaire}
questionnaireResponse={state.response ?? undefined}
Expand Down
2 changes: 1 addition & 1 deletion apps/smart-forms-app/src/utils/assemble.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
*/

import type { Extension, OperationOutcome, Parameters, Questionnaire } from 'fhir/r4';
import { isInputParameters } from 'sdc-assemble';
import { isInputParameters } from '@aehrc/sdc-assemble';
import * as FHIR from 'fhirclient';
import { HEADERS } from '../api/headers.ts';
import { getFormsServerAssembledBundlePromise } from '../features/dashboard/utils/dashboard.ts';
Expand Down
2 changes: 1 addition & 1 deletion deployment/csiro/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"cdk": "cdk"
},
"dependencies": {
"sdc-assemble": "^1.0.1",
"@aehrc/sdc-assemble": "^1.0.2",
"aws-cdk-lib": "^2.86.0",
"constructs": "^10.2.52",
"forms-server": "^0.1.0",
Expand Down
Loading

0 comments on commit 8c7ff37

Please sign in to comment.