Skip to content

Commit

Permalink
Merge pull request #816 from aehrc/issue/692
Browse files Browse the repository at this point in the history
Update READMEs
  • Loading branch information
fongsean authored May 24, 2024
2 parents 0b6c820 + fc9e530 commit b8a298f
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 120 deletions.
17 changes: 5 additions & 12 deletions Conformance.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Smart Forms Questionnaire & SDC conformance
# Questionnaire & SDC conformance

Smart Forms is based on FHIR R4.
Smart Forms is based on FHIR R4. The checklist below is a summary of the Questionnaire item types and SDC extensions supported by Smart Forms.

For specific details of each item types/extensions, refer to the [docs](https://smartforms.csiro.au/docs).

## Supported item types
The list can be found here: http://hl7.org/fhir/R4/valueset-item-type.html
Expand Down Expand Up @@ -157,16 +159,7 @@ View the source here: http://hl7.org/fhir/uv/sdc/behavior.html
- [x] initialExpression
- [x] calculatedExpression
- [ ] cqf-calculatedValue
- [ ] cqf-expression

| Item types that support calculations <br/>(refer https://www.hl7.org/fhir/r4/codesystem-item-type.html) |
|---------------------------------------------------------------------------------------------------------|
| integer |
| decimal |
| string |
| text |
| boolean |
| choice (limited to the below) <br/>- radio item control <br/> - dropdown item control |
- [x] cqf-expression

#### [Other Control](http://hl7.org/fhir/uv/sdc/behavior.html#other-control)

Expand Down
11 changes: 6 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
<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://smartforms.csiro.au">Show me the app ➡️</a></h3>
<h4><a href="https://smartforms.csiro.au">Show me the app ➡️</a></h4>

<h4><a href="https://smartforms.csiro.au/docs">Check out the documentation 📚</a></h4>

---
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.
Expand All @@ -13,8 +15,7 @@ The web app is intended to demonstrate the use of [HL7 FHIR](https://hl7.org/fhi
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).**

**If you are interested in using the form renderer in your React app, a standalone package is published on NPM as [@aehrc/smart-forms-renderer](https://www.npmjs.com/package/@aehrc/smart-forms-renderer).**

## Functionalities

Expand Down Expand Up @@ -46,7 +47,7 @@ NOTE: The patients featured in the screenshots are synthetic and do not represen
2. Implemented operations from the [Structured Data Capture (SDC)](http://hl7.org/fhir/uv/sdc/) specification:
- [$populate](https://hl7.org/fhir/uv/sdc/OperationDefinition/Questionnaire-populate)
- [$assemble](https://hl7.org/fhir/uv/sdc/OperationDefinition/Questionnaire-assemble)
3. A standalone component of the questionnaire-rendering engine published on NPM as [@aehrc/smart-forms-renderer](https://www.npmjs.com/package/@aehrc/smart-forms-renderer).
3. A standalone component of the questionnaire renderer published on NPM as [@aehrc/smart-forms-renderer](https://www.npmjs.com/package/@aehrc/smart-forms-renderer).

## Conformance

Expand Down Expand Up @@ -134,7 +135,7 @@ We are also accepting contributions to make the product better! Please read [CON

## Discussions

We encourage having discussions on [chat.fhir.org](chat.fhir.org).
We encourage having discussions on [chat.fhir.org](https://chat.fhir.org/).

Smart Forms-related discussions can be raised in the Smart Forms's stream: https://chat.fhir.org/#narrow/stream/425534-smart-forms.

Expand Down
3 changes: 1 addition & 2 deletions packages/sdc-populate/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@

A Typescript reference implementation of the [$populate](http://hl7.org/fhir/uv/sdc/OperationDefinition-Questionnaire-populate.html) operation from the [HL7 FHIR Structured Data Capture Specification](http://hl7.org/fhir/uv/sdc/ImplementationGuide/hl7.fhir.uv.sdc) designed for [Form Population](http://hl7.org/fhir/uv/sdc/populate.html).

## Usage
Not written yet...
Check out the [API Reference](https://smartforms.csiro.au/docs/api/sdc-populate) for technical specifications.

### Note for Vite users (or if you facing CommonJS/ESM issues)
If you are using Vite, you might need to add the following to your ```vite.config.ts``` file:
Expand Down
104 changes: 3 additions & 101 deletions packages/smart-forms-renderer/README.md
Original file line number Diff line number Diff line change
@@ -1,108 +1,10 @@
# Smart Forms Renderer
This React-based package acts as the rendering engine for the [Smart Forms app](https://github.com/aehrc/smart-forms).

Try out a minimal demo here: https://smartforms.csiro.au/standalone.
A React-based library that contains the Questionnaire renderer used in the Smart Forms app.
It acts as a reference implementation for the [SDC Form Filler](https://hl7.org/fhir/uv/sdc/CapabilityStatement-sdc-form-filler.html).

## Installation
```bash
npm install @aehrc/smart-forms-renderer
```
<h4><a href="https://smartforms.csiro.au/docs/devUsage">Check out the documentation 📚</a></h4>

## Basic Usage

```typescript jsx
import React from 'react';
import { SmartFormsRenderer, getResponse } from '@aehrc/smart-forms-renderer';

export default function App () {
const questionnaire = {...} // FHIR R4.Questionnaire

return (
<div>
<SmartFormsRenderer questionnaire={questionnaire}/>
<button onClick={() => {
const response = getResponse()
// Do something with the questionnaire response
}}/>
</div>
)
}
```
Note: The SmartFormsRenderer component trades customisability for simplicity. If you need more control over the rendering engine, refer to the Advanced Usage section.


### SmartFormsRenderer Props


| Name | Type | Description | Required? |
|-----------------------|-------------------------------|---------------------------------------------------------------------------------------------------------------------|-----------|
| questionnaire | FHIR R4.Questionnaire | Questionnaire to be rendered | Required |
| questionnaireResponse | FHIR R4.QuestionnaireResponse | Pre-populated QuestionnaireResponse to be rendered | Optional |
| additionalVariables | `Record<string, Extension>` | Key-value pair of [SDC variables](http://hl7.org/fhir/R4/extension-variable.html) `Record<name, variable extension>` | Optional |
| terminologyServerUrl | string | Terminology server url to fetch terminology | Optional |

The below props are not supported at the moment, but will be in the future.

| Name | Type | Description |
|----------------------|------------------------------------------------------|---------------------------------------------|
| fhirClient | [Client](https://github.com/smart-on-fhir/client-js) | FhirClient to perform further FHIR calls |

### Functions

```javascript
/**
* Get the filled QuestionnaireResponse at its current state.
* If no changes have been made to the form, the initial or an empty QuestionnaireResponse is returned.
*
* @returns {FHIR R4.QuestionnaireResponse} The filled QuestionnaireResponse
*/
function getResponse() {}
```


## Advanced Usage (If basic usage does not suffice)

```typescript
/* Components */
// A self-initialising wrapper around the rendering engine. This is sufficient for most use cases.

function SmartFormsRenderer(props: {
questionnaire: Questionnaire,
questionnaireResponse?: QuestionnaireResponse,
additionalVariables?: Record<string, Extension>,
terminologyServerUrl?: string,
}): JSX.Element {}

// BaseRenderer underneath the SmartFormsRenderer wrapper. Requires buildForm() to initialise form.
function BaseRenderer(): JSX.Element {}

/* Functions */
// Get the filled QuestionnaireResponse at its current state.
// If no changes have been made to the form, the initial QuestionnaireResponse is returned.
function getResponse(): QuestionnaireResponse {}

// Build the form with an initial Questionnaire and an optional filled QuestionnaireResponse.
// If a QuestionnaireResponse is not provided, an empty QuestionnaireResponse is set as the initial QuestionnaireResponse.
async function buildForm(
questionnaire: Questionnaire,
questionnaireResponse?: QuestionnaireResponse
): Promise<void> {}

// Destroy the form to clean up the questionnaire and questionnaireResponse stores.
function destroyForm(): void {}

// Remove all hidden answers from the filled QuestionnaireResponse.
// This takes into account the questionnaire-hidden extension, enableWhens and enableWhenExpressions.
function removeHiddenAnswersFromResponse(
questionnaire: Questionnaire,
questionnaireResponse: QuestionnaireResponse
): QuestionnaireResponse {}
```

The Smart Forms app uses a even finer-grained control which directly interacts with the state management stores.

At the moment there are no plans to document state management methods, but happy to do so if there is demand for it.
Raise a request in https://github.com/aehrc/smart-forms/issues if you want to see it happen!

---

Expand Down

0 comments on commit b8a298f

Please sign in to comment.