Skip to content

Commit bc486bb

Browse files
authored
FHIR-Eswatini docs (#744)
* first pass at docs * note on generation * update fhir-4 bundle docs * tweaks * more tweaks
1 parent 1b4a822 commit bc486bb

File tree

3 files changed

+449
-21
lines changed

3 files changed

+449
-21
lines changed

adaptors/fhir-4.md

Lines changed: 31 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,8 @@ written to the new resource
6565

6666
## Bundles
6767

68-
The FHIR-4 adaptor provides support for bundles.
68+
The FHIR-4 adaptor provides support for creating, updating and uploading
69+
bundles.
6970

7071
You can create resources and add them to a bundle:
7172

@@ -76,25 +77,13 @@ addToBundle($.resource);
7677
Where `$.resource` is a FHIR resource, or an array of resources, on the state
7778
object.
7879

79-
This will add the resources to a bundle resource, under the `entry` key, on
80-
state under a key called `bundle`. To save the bundle under a different key,
81-
pass a string as the second argument:
80+
`addToBundle` actually does two things:
8281

83-
```js
84-
addToBundle($.resource, 'patients-bundle');
85-
```
82+
- First it creates a bundle object on state, setting some defaults
83+
- Secondly it wraps your resource into an entry object, and add it to the
84+
bundle.
8685

87-
Each item in the bundle will be given a `request` object with the `PUT` method
88-
and a URL. For example:
89-
90-
```js
91-
addToBundle({
92-
id: 'x',
93-
resourceType: 'Patient',
94-
});
95-
```
96-
97-
Will create a state object like this:
86+
The code `addToBundle($.resource)` will give you a state object like this:
9887

9988
```json
10089
{
@@ -103,6 +92,7 @@ Will create a state object like this:
10392
"entry": [
10493
{
10594
"resource": {
95+
// This object is the resource you passed in
10696
"id": "x",
10797
"resourceType": "Patient"
10898
},
@@ -116,8 +106,24 @@ Will create a state object like this:
116106
}
117107
```
118108

109+
To save the bundle under a different key, pass a string key name as the second
110+
argument:
111+
112+
```js
113+
addToBundle($.resource, 'patients-bundle');
114+
```
115+
116+
You can customize the bundle by calling the `createBundle()` function yourself.
117+
This can be useful for setting the bundle type or other keys.
118+
119+
```
120+
createBundle({ name: 'upload', type: 'batch' })
121+
```
122+
119123
To send the Bundle to the FHIR server defined in `state.configuration.baseURL`,
120-
call `uploadBundle()`.
124+
call `uploadBundle()`. This operation will sort the bundle according to the
125+
dependencies of its contents: so resources that reference other resources will
126+
appear later in the bundle.
121127

122128
You can pass the name of a key on state to upload a specific bundle:
123129

@@ -722,6 +728,10 @@ b.patient({
722728

723729
### I've noticed a problem with this Adaptor, or something is out of date, what can I do?
724730

725-
Thanks for asking! We are a fully Open Source Digital Public Good, and we welcome contributions from our community. Check out our [Adaptors Wiki](https://github.com/OpenFn/adaptors/blob/main/wiki/index.md) for more information on how you can update Adaptors!
731+
Thanks for asking! We are a fully Open Source Digital Public Good, and we
732+
welcome contributions from our community. Check out our
733+
[Adaptors Wiki](https://github.com/OpenFn/adaptors/blob/main/wiki/index.md) for
734+
more information on how you can update Adaptors!
726735

727-
Or, you can always reach out to the Community through our [Community Forum here](https://community.openfn.org/).
736+
Or, you can always reach out to the Community through our
737+
[Community Forum here](https://community.openfn.org/).

0 commit comments

Comments
 (0)