Skip to content

Commit

Permalink
add scenarios, tidied a few other things (#24)
Browse files Browse the repository at this point in the history
Co-authored-by: Declan Kieran <[email protected]>
  • Loading branch information
declankieran-nhsd and declankieran-nhsd authored Mar 27, 2024
1 parent 297acab commit ede7fab
Show file tree
Hide file tree
Showing 7 changed files with 89 additions and 31 deletions.
4 changes: 2 additions & 2 deletions input/fsh/valuesets/FlagConsentPurpose.fsh
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ Description: "A ValueSet to identify the purpose of a consent given for an NHS E
* ^expansion.contains[=].code = #RACONSENT
* ^expansion.contains[=].display = "Reasonable Adjustments - Consent to record Reasonable Adjustments"

* ^expansion.contains[0].system = "https://fhir.nhs.uk/England/CodeSystem/CPIS-ConsentPurpose"
* ^expansion.contains[+].system = "https://fhir.nhs.uk/England/CodeSystem/CPIS-ConsentPurpose"
* ^expansion.contains[=].code = #CPISCONSENT
* ^expansion.contains[=].display = "CPIS - Consent to record CPIS flags"

* ^expansion.contains[0].system = "https://fhir.nhs.uk/England/CodeSystem/FGM-ConsentPurpose"
* ^expansion.contains[+].system = "https://fhir.nhs.uk/England/CodeSystem/FGM-ConsentPurpose"
* ^expansion.contains[=].code = #FGMCONSENT
* ^expansion.contains[=].display = "FGM - Consent to record FGM flags"
3 changes: 1 addition & 2 deletions input/images-source/consent-sequence.plantuml
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,7 @@ else Consent has not been given/been revoked
api <-- con : return
alt Validation failed
api -> api : rollback
else
api -> con : Delete adjustment consent
else Consent updated
api -> pfg : Delete adjustment patient flag
api -> adj : Delete adjustment flag(s)
api -> cod : Delete condition flag(s)
Expand Down
30 changes: 27 additions & 3 deletions input/images-source/retrieve-record-sequence.plantuml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,35 @@ skinparam actorStyle hollow
actor "Practitioner" as pra
actor "Patient" as pat
participant "FHIR API" as api
entity "Consent" as con
entity "Patient Flag" as pfg
entity "Adjustment Flag" as adj
entity "Condition" as cod

pra -> pat : Request confirmation\n of consent to\n access information
pra <-- pat : Provide consent\nto share information

pra -> api : Application GET /<query>
pra <-- api : SearchSet Bundle
alt Consent provided
pra <-- pat : Provide consent

pra -> api : Query for records
pra <-- api : SearchSet Bundle
else Consent not provided
pra <-- pat : No consent provided
else Consent revoked
pra <-- pat : Previous consent is revoked

pra -> api : Record consent was revoked
api -> con : Update resource
con -> con : Validate
api <-- con : return
alt Validation failed
api -> api : rollback
else Consent updated
api -> pfg : Delete adjustment patient flag
api -> adj : Delete adjustment flag(s)
api -> cod : Delete condition flag(s)
end
pra <-- api : OperationOutcome
end

@enduml
6 changes: 3 additions & 3 deletions input/pagecontent/add-reasonable-adjustment-record.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,6 @@ The following set of examples are for the same patient, and constitute an additi

### Relevant Documentation

[Bundles](https://hl7.org/fhir/r4/bundle.html)
[Transactions](https://hl7.org/fhir/r4/http.html#transaction)
[Upsert](https://hl7.org/fhir/r4/http.html#upsert)
* [Bundle](https://hl7.org/fhir/r4/bundle.html)
* [Transaction](https://hl7.org/fhir/r4/http.html#transaction)
* [Upsert](https://hl7.org/fhir/r4/http.html#upsert)
4 changes: 4 additions & 0 deletions input/pagecontent/consent-to-share-information.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,3 +78,7 @@ If consent has not been previously given, then this means the Consent resource m

* [Consent is not given](Consent-RAConsentExampleDissent.html)
* [Consent is revoked](Consent-RAConsentExampleRevoked.html)

### Relevant Documentation

* FHIR [ReSTful API](https://www.hl7.org/fhir/R4/http.html)
4 changes: 2 additions & 2 deletions input/pagecontent/remove-reasonable-adjustment-record.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,5 +63,5 @@ Multiple resources can be deleted using a transaction bundle. This [example del

### Relevant Documentation

[Bundles](https://hl7.org/fhir/r4/bundle.html)
[Transactions](https://hl7.org/fhir/r4/http.html#transaction)
* [Bundle](https://hl7.org/fhir/r4/bundle.html)
* [Transaction](https://hl7.org/fhir/r4/http.html#transaction)
69 changes: 50 additions & 19 deletions input/pagecontent/retrieve-reasonable-adjustment-record.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,25 @@ After obtaining consent from a patient, a Reasonable Adjustment Record may be re

</div>

#### Scenarios

```gherkin
Given a practitioner must access a patients reasonable adjustment records
And consent has been provided
When the practitioner retrieves the reasonable adjustment records
Then all resources associated with reasonable adjustment records will be returned
Given a practitioner must access a patients reasonable adjustment records
And no consent has been provided
When the practitioner attempts to retrieve the reasonable adjustment records
Then no resources will be returned
Given a practitioner must access a patients reasonable adjustment records
And consent is revoked
When the practitioner updates the Consent resource to revoked
Then all other resources associated with reasonable adjustment records will be removed
```

### Workflow

A practitioner confirms that a patient consents to share information about Reasonable Adjustment records. A patient may revoke consent to share information about Reasonable Adjustment records and if they do, all records must be removed.
Expand All @@ -22,30 +41,23 @@ A practitioner confirms that a patient consents to share information about Reaso
<img style="max-width: 70%" alt="Retrieve record workflow BPMN diagram." src="retrieve-record-workflow.svg"/>
</div>

### System Interactions

Using [FHIR search](https://www.hl7.org/fhir/search.html) capabilities, it is possible to retrieve the reasonable adjustment records in several ways.

#### General query interaction
### System Interaction

<div style="text-align: left;">

{%include retrieve-record-sequence.svg%}

</div>

The following queries will return all or some of the resources constituing a Reasonable Adjustments record, i.e.
### Queries

* [Flag Consent](StructureDefinition-FlagConsent.html) resource
* [Patient Flag](StructureDefinition-PatientFlag.html) resources
* [Programme Flag](StructureDefinition-ProgrammeFlag.html) resources
* [Flag Condition](StructureDefinition-FlagCondition.html) resources

All queries rely on the [FlagCategory](SearchParameter-FlagCategory.html) and [FlagCode](SearchParameter-FlagCode.html) SearchParameters.
Using [FHIR search](https://www.hl7.org/fhir/search.html) capabilities, it is possible to retrieve the reasonable adjustment records in several ways.

#### Patient endpoint search

This will return all resources associated flag resources for a patient
This section describes how to query from the [Patient](http://www.hl7.org/fhir/R4/patient.html#search) endpoint using [FHIR search](https://www.hl7.org/fhir/search.html)

This will return all associated flag resources for Reasonable Adjustments.

```
GET /Patient?identifier=9912003888&_has:Flag:patient:code=NRAF&_has:Flag:patient:category=NRAF&_revinclude=Flag:patient&_has:Consent:patient:category=NRAF&_revinclude=Consent:patient&_has:Condition:patient:category=NRAF&_revinclude=Condition:patient
Expand Down Expand Up @@ -81,15 +93,30 @@ This limits the search to patients that have Condition resources linked via pati
&_has:Condition:patient:category=NRAF&_revinclude=Condition:patient
```

#### Flag endpoint search using flag-detail extension
The following queries will return all or some of the resources constituing a Reasonable Adjustments record, i.e.

If the [flag-detail extension](http://hl7.org/fhir/StructureDefinition/flag-detail) is used, then references to all Reasonable Adjustment resources can be included the [Patient Flag](StructureDefinition-PatientFlag.html) resource.
* [Flag Consent](StructureDefinition-FlagConsent.html) resource
* [Patient Flag](StructureDefinition-PatientFlag.html) resources
* [Programme Flag](StructureDefinition-ProgrammeFlag.html) resources
* [Flag Condition](StructureDefinition-FlagCondition.html) resources

This query relies on the [FlagCategory](SearchParameter-FlagCategory.html) and [FlagCode](SearchParameter-FlagCode.html) SearchParameters.

**NOTE:** For every additional record/resource added, the flag-detail element in the Patient Flag resource will need updated.
#### Flag endpoint search

**TODO:** add this into the add record interaction diagram :(
This section describes how to query from the [Flag](http://www.hl7.org/fhir/R4/flag.html#search) endpoint using [FHIR search](https://www.hl7.org/fhir/search.html)

The following query relies on the [FlagDetail](SearchParameter-FlagDetail.html) SearchParameter.
**NOTE:** For every additional record/resource added, the flag-detail element in the Patient Flag resource will need updated. See **TODO -- link to add interaction diagram**.

<div id="todo-notice" markdown="span" class="alert alert-danger" role="alert">
<i class="fa fa-tasks"></i>
<b>TODO: </b>
<i>Update all interaction diagrams that either add or remove records. Also add new specific diagrams for adding an additional record or removing a single record from a set, where the flag extension then needs updated :(</i>
</div>

If the [flag-detail extension](http://hl7.org/fhir/StructureDefinition/flag-detail) is used, then references to all Reasonable Adjustment resources can be included the [Patient Flag](StructureDefinition-PatientFlag.html) resource.

This will return all associated flag resources for Reasonable Adjustments.

```
http://localhost:8080/fhir/Flag?patient.identifier=9912003888&_include=Flag:detail&_include=Flag:patient
Expand All @@ -113,6 +140,10 @@ This includes the associated patient resource.
&_include=Flag:patient
```

This query relies on the [FlagCategory](SearchParameter-FlagCategory.html), [FlagCode](SearchParameter-FlagCode.html) and [FlagDetail](SearchParameter-FlagDetail.html) SearchParameters.


### Relevant Documentation

[FHIR Search](http://www.hl7.org/fhir/R4/search.html)
* FHIR [Search](http://www.hl7.org/fhir/R4/search.html)
* [SearchParameters](https://www.hl7.org/fhir/R4/searchparameter.html)

0 comments on commit ede7fab

Please sign in to comment.