Skip to content

Commit

Permalink
Add server examples and data model.
Browse files Browse the repository at this point in the history
  • Loading branch information
declankieran committed Jan 28, 2024
1 parent b7ea674 commit e8d9117
Show file tree
Hide file tree
Showing 9 changed files with 97 additions and 754 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,11 @@ jobs:

- name: Load and query add-condition-transaction-example-1
run: curl -X POST -H "Content-type:application/fhir+json;fhirVersion=4.0" -d @fsh-generated/resources/Bundle-add-condition-transaction-example-1.json http://localhost:8080/fhir; \
curl $(cat input/queries/get-flags-associated-with-patient.md) | jq '.id = "QUERY-OUTPUT_add-condition-transaction-example-1"' > input/resources/QUERY-OUTPUT_add-condition-transaction-example-1.json
curl $(cat input/queries/get-flags-associated-with-patient.md) | jq '.id = "QUERY-OUTPUT--add-condition-transaction-example-1"' > input/resources/QUERY-OUTPUT_add-condition-transaction-example-1.json

- name: Load and query add-condition-transaction-example-2
run: curl -X POST -H "Content-type:application/fhir+json;fhirVersion=4.0" -d @fsh-generated/resources/Bundle-add-condition-transaction-example-2.json http://localhost:8080/fhir; \
curl $(cat input/queries/get-flags-associated-with-patient.md) | jq '.id = "QUERY-OUTPUT_add-condition-transaction-example-2"' > input/resources/QUERY-OUTPUT_add-condition-transaction-example-2.json
curl $(cat input/queries/get-flags-associated-with-patient.md) | jq '.id = "QUERY-OUTPUT--add-condition-transaction-example-2"' > input/resources/QUERY-OUTPUT_add-condition-transaction-example-2.json

- name: Build IG
run: ./_genonce.sh
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ temp
template
font-awesome*
fsh-generated
input/resources/QUERY-OUTPUT*
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions input/pagecontent/data-model.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
### Summary

The RA record is made up of Consent, Condition, Flag and Provenances resources. The Consent, Condition and Flag resources are linked via a Patient resource. The Provenace resource is only scoped to a sinle Flag and has no lifetime outside of the Flag (specific version) resource.

### Data Model

<div>
<img style="max-width: 70%" alt="RA Record Data Model" src="data-model-contained-provenance.drawio.png"/>
</div>
37 changes: 37 additions & 0 deletions input/pagecontent/server-example-add-ra-record.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
### Summary

The [HAPI FHIR Starter Server](https://github.com/hapifhir/hapi-fhir-jpaserver-starter) is used to demostrate some basic REST capabilities in FHIR using examples within this implementation guide.

#### Docker invocation of the HAPI Starter Project

This command starts the server on port 8080 and use UUID (as opposed to sequential numbers) for resource ID's.

```
docker run -p 8080:8080 -e hapi.fhir.daoconfig_client_id_strategy=UUID -e hapi.fhir.client_id_strategy=ANY hapiproject/hapi:latest
```

To pull the latest image, run

```
docker pull hapiproject/hapi:latest
```

#### CI Build

These examples are loaded into a running FHIR server during the IG build. Some resources (queries) are dynamically generated and added to the IG at build time. (TODO add a list of dynamically generated resources somewhere).

### Examples

The examples here describe the API options related to the workflow given in the use case [Add RA Record](add-ra-record.html#workflow).

#### Example 1

TODO

#### Example 2

The first [example transaction](Bundle-add-condition-transaction-example-1.html) adds an RA record consisting of a Consent resource from the patient, a master Flag resource (is this really needed?), a Condition resource and an associated condition Flag resource using a transaction Bundle, which provides atomicity as well as more network efficent call. Each Flag resource has a Provenance resource embedded in it. (TODO maybe a futher discussion section somewhere on options for provenance, i.e. linking to versions, _history and transaction considerations, options to use etag or X-provenance).

The second [example transaction](Bundle-add-condition-transaction-example-1.html) simply modifies the first transaction by adding additional resources for another Condition and adjustment (Flag). The transactions are using PUT's and as FHIR does defined (upsert)[https://hl7.org/fhir/http.html#upsert] as an option, and the HAPI Starter Server has implemented this, this example has been constructed to demostrate this.

Details of querying the resulting data from these transaction is given in the [Retrieve RA Record](server-example-add-ra-record.html) server example.
45 changes: 45 additions & 0 deletions input/pagecontent/server-example-retrieve-ra-record.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
### Summary

The [HAPI FHIR Starter Server](https://github.com/hapifhir/hapi-fhir-jpaserver-starter) is used to demostrate some basic REST capabilities in FHIR using examples within this implementation guide.

#### Docker invocation of the HAPI Starter Project

This command starts the server on port 8080 and use UUID (as opposed to sequential numbers) for resource ID's.

```
docker run -p 8080:8080 -e hapi.fhir.daoconfig_client_id_strategy=UUID -e hapi.fhir.client_id_strategy=ANY hapiproject/hapi:latest
```

To pull the latest image, run

```
docker pull hapiproject/hapi:latest
```

#### CI Build

These examples are loaded into a running FHIR server during the IG build. Some resources (queries) are dynamically generated and added to the IG at build time. (TODO add a list of dynamically generated resources somewhere).

### Examples

The examples here describe search options for the workflow given in [Retrieve RA Record](todo.html). This follows on from the data entered in the workflow given in the use case [Add RA Record](add-ra-record.html#workflow).

#### Example 1

Based on the example transaction Bundles given in the use case [Add RA Record](add-ra-record.html#workflow), for each transaction, the following query will performed (dynamically during the IG build)

```
<base>/Patient?identifier=9912003888&_revinclude=Consent:patient&_revinclude=Flag:patient&_revinclude=Condition:patient
```

This query will return the Patient resource using the patients NHS number (TODO will be profiled to check for this, reference this later). The assocaited resources that make up the RA are also returned, which are all using default Patient SearchParameters define in the base specification for each resource.

For the [first transaction example](Bundle-add-condition-transaction-example-1.html), this is the [output of the query](Bundle-QUERY-OUTPUT--add-condition-transaction-example-1.html).

For the [second transaction example](Bundle-add-condition-transaction-example-2.html), where a Condition and adjustment (Flag) is added, this is the [output of the query](Bundle-QUERY-OUTPUT--add-condition-transaction-example-2.html).

See the [Data Model](data-model.html) for details on the relationships between the resources.

#### Example #

TODO?
Loading

0 comments on commit e8d9117

Please sign in to comment.