Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Fix/docs #905

Merged
merged 4 commits into from
Jul 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion documentation/docs/api/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ sidebar_label: Introduction

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).

It provides a full coverage of the exposed API of [@aehrc/smart-forms-renderer](https://www.npmjs.com/package/@aehrc/smart-forms-renderer) and [@aehrc/sdc-populate](https://www.npmjs.com/package/@aehrc/sdc-populate).
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).
19 changes: 19 additions & 0 deletions documentation/docs/api/sdc-assemble/functions/assemble.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Function: assemble()

> **assemble**(`parameters`, `fetchQuestionnaireCallback`, `fetchQuestionnaireRequestConfig`): `Promise`\<`Questionnaire` \| `OperationOutcome` \| [`OutputParameters`](../interfaces/OutputParameters.md)\>

The $assemble operation - https://build.fhir.org/ig/HL7/sdc/OperationDefinition-Questionnaire-assemble.html

## Parameters

| Parameter | Type | Description |
| :------ | :------ | :------ |
| `parameters` | [`InputParameters`](../interfaces/InputParameters.md) | The input parameters for $assemble |
| `fetchQuestionnaireCallback` | [`FetchQuestionnaireCallback`](../interfaces/FetchQuestionnaireCallback.md) | A callback function defined by the implementer to fetch Questionnaire resources by a canonical url |
| `fetchQuestionnaireRequestConfig` | `any` | A request configuration object to be passed to the callback function |

## Returns

`Promise`\<`Questionnaire` \| `OperationOutcome` \| [`OutputParameters`](../interfaces/OutputParameters.md)\>

A fully assembled questionnaire, an operationOutcome error(if present) or both (if there are warnings)
21 changes: 21 additions & 0 deletions documentation/docs/api/sdc-assemble/functions/isInputParameters.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Function: isInputParameters()

> **isInputParameters**(`parameters`): `parameters is InputParameters`

Check if the given parameters is a valid InputParameters for $assemble

## Parameters

| Parameter | Type | Description |
| :------ | :------ | :------ |
| `parameters` | `Parameters` | a given Parameters resource |

## Returns

`parameters is InputParameters`

boolean value of whether the given parameters is InputParameters

## See

[http://hl7.org/fhir/uv/sdc/OperationDefinition/Questionnaire-assemble](http://hl7.org/fhir/uv/sdc/OperationDefinition/Questionnaire-assemble)
17 changes: 17 additions & 0 deletions documentation/docs/api/sdc-assemble/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# @aehrc/sdc-assemble

## Interfaces

| Interface | Description |
| :------ | :------ |
| [FetchQuestionnaireCallback](interfaces/FetchQuestionnaireCallback.md) | - |
| [InputParameters](interfaces/InputParameters.md) | Input parameters for the $assemble operation |
| [OutcomeParameter](interfaces/OutcomeParameter.md) | Output parameter from $assemble's 'outcome' parameter |
| [OutputParameters](interfaces/OutputParameters.md) | Output parameters for the $assemble operation |

## Functions

| Function | Description |
| :------ | :------ |
| [assemble](functions/assemble.md) | The $assemble operation - https://build.fhir.org/ig/HL7/sdc/OperationDefinition-Questionnaire-assemble.html |
| [isInputParameters](functions/isInputParameters.md) | Check if the given parameters is a valid InputParameters for $assemble |
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# Interface: FetchQuestionnaireCallback()

To define a method to fetch Questionnaire resources from the FHIR server with the given canonical URL

## See

[https://www.hl7.org/fhir/questionnaire.html](https://www.hl7.org/fhir/questionnaire.html)

## Example

```ts
const fetchQuestionnaireCallback: FetchQuestionnaireCallback = async (
canonicalUrl: string,
requestConfig: {url: string, authToken?: string}
) => {
const { url, authToken } = requestConfig;

let requestUrl = url;
if (!requestUrl.endsWith('/')) {
requestUrl += '/';
}
requestUrl += `Questionnaire?url=${canonicalUrl}`;

const headers = authToken ? { ...HEADERS, Authorization: `Bearer ${authToken}` } : HEADERS;

const response = await fetch(requestUrl, {
headers: headers
});

if (!response.ok) {
throw new Error(`HTTP error when performing ${requestUrl}. Status: ${response.status}`);
}

return response.json();
};
```

> **FetchQuestionnaireCallback**(`canonicalUrl`, `requestConfig`?): `Promise`\<`any`\>

## Parameters

| Parameter | Type |
| :------ | :------ |
| `canonicalUrl` | `string` |
| `requestConfig`? | `any` |

## Returns

`Promise`\<`any`\>
111 changes: 111 additions & 0 deletions documentation/docs/api/sdc-assemble/interfaces/InputParameters.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
# Interface: InputParameters

Input parameters for the $assemble operation

## See

[http://hl7.org/fhir/uv/sdc/OperationDefinition/Questionnaire-assemble](http://hl7.org/fhir/uv/sdc/OperationDefinition/Questionnaire-assemble)

## Extends

- `Parameters`

## Properties

### \_id?

> `optional` **\_id**: `Element`

#### Inherited from

`Parameters._id`

***

### \_implicitRules?

> `optional` **\_implicitRules**: `Element`

#### Inherited from

`Parameters._implicitRules`

***

### \_language?

> `optional` **\_language**: `Element`

#### Inherited from

`Parameters._language`

***

### id?

> `optional` **id**: `string`

The only time that a resource does not have an id is when it is being submitted to the server using a create operation.

#### Inherited from

`Parameters.id`

***

### implicitRules?

> `optional` **implicitRules**: `string`

Asserting this rule set restricts the content to be only understood by a limited set of trading partners. This inherently limits the usefulness of the data in the long term. However, the existing health eco-system is highly fractured, and not yet ready to define, collect, and exchange data in a generally computable sense. Wherever possible, implementers and/or specification writers should avoid using this element. Often, when used, the URL is a reference to an implementation guide that defines these special rules as part of it's narrative along with other profiles, value sets, etc.

#### Inherited from

`Parameters.implicitRules`

***

### language?

> `optional` **language**: `string`

Language is provided to support indexing and accessibility (typically, services such as text to speech use the language tag). The html language tag in the narrative applies to the narrative. The language tag on the resource may be used to specify the language of other presentations generated from the data in the resource. Not all the content has to be in the base language. The Resource.language should not be assumed to apply to the narrative automatically. If a language is specified, it should it also be specified on the div element in the html (see rules in HTML5 for information about the relationship between xml:lang and the html lang attribute).

#### Inherited from

`Parameters.language`

***

### meta?

> `optional` **meta**: `Meta`

The metadata about the resource. This is content that is maintained by the infrastructure. Changes to the content might not always be associated with version changes to the resource.

#### Inherited from

`Parameters.meta`

***

### parameter

> **parameter**: [`object`]

#### Overrides

`Parameters.parameter`

***

### resourceType

> `readonly` **resourceType**: `"Parameters"`

Resource Type Name (for serialization)

#### Inherited from

`Parameters.resourceType`
Loading
Loading