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

Feature/consent to treatment #17

Merged
merged 10 commits into from
Mar 6, 2024
Merged
Show file tree
Hide file tree
Changes from 9 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
5 changes: 4 additions & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ jobs:
- name: Install Jekyll
run: sudo gem install jekyll jekyll-plantuml

- name: Install Graphvix
run: sudo apt install graphviz

- name: Run FHIR server (TODO - load package from vars and validate - maybe just let the publisher handle that...)
run: docker run -d -p 8080:8080 -e hapi.fhir.daoconfig_client_id_strategy=UUID -e hapi.fhir.client_id_strategy=ANY hapiproject/hapi:latest

Expand Down Expand Up @@ -76,7 +79,7 @@ jobs:
# Add a dependency to the build job
needs: build
# Only deploy on development branch
if: github.ref == 'refs/heads/development'
# if: github.ref == 'refs/heads/development'
# Grant GITHUB_TOKEN the permissions required to make a Pages deployment
permissions:
pages: write # to deploy to Pages
Expand Down
1,759 changes: 1,759 additions & 0 deletions ig-template/package/content/assets/js/mermaid.min.js

Large diffs are not rendered by default.

115 changes: 115 additions & 0 deletions ig-template/package/content/diagram.bpmn
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
<?xml version="1.0" encoding="UTF-8"?>
<bpmn:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="Definitions_149wjti" targetNamespace="http://bpmn.io/schema/bpmn" exporter="bpmn-js (https://demo.bpmn.io)" exporterVersion="16.4.0">
<bpmn:collaboration id="Collaboration_0q56fut">
<bpmn:participant id="Participant_18xshys" name="Consent to Treatment" processRef="Process_0q168hd" />
<bpmn:textAnnotation id="TextAnnotation_009927h">
<bpmn:text>Has capacity to consent?</bpmn:text>
</bpmn:textAnnotation>
<bpmn:association id="Association_171p978" associationDirection="None" sourceRef="Gateway_1ykpua9" targetRef="TextAnnotation_009927h" />
</bpmn:collaboration>
<bpmn:process id="Process_0q168hd">
<bpmn:laneSet id="LaneSet_1s0cwuu">
<bpmn:lane id="Lane_1qewygr" name="API" />
<bpmn:lane id="Lane_0vot896" name="Patient Advocate">
<bpmn:flowNodeRef>Activity_1s5y9xm</bpmn:flowNodeRef>
</bpmn:lane>
<bpmn:lane id="Lane_0s229l6" name="Patient">
<bpmn:flowNodeRef>Gateway_1ykpua9</bpmn:flowNodeRef>
<bpmn:flowNodeRef>Activity_1lxn6f7</bpmn:flowNodeRef>
</bpmn:lane>
<bpmn:lane id="Lane_0jp784q" name="Practitioner">
<bpmn:flowNodeRef>Event_03tz7z4</bpmn:flowNodeRef>
<bpmn:flowNodeRef>Activity_00yhqnr</bpmn:flowNodeRef>
<bpmn:flowNodeRef>Activity_05dlhv6</bpmn:flowNodeRef>
</bpmn:lane>
</bpmn:laneSet>
<bpmn:startEvent id="Event_03tz7z4">
<bpmn:outgoing>Flow_0ws129z</bpmn:outgoing>
</bpmn:startEvent>
<bpmn:task id="Activity_00yhqnr" name="Request Consent">
<bpmn:incoming>Flow_0ws129z</bpmn:incoming>
<bpmn:outgoing>Flow_1ias2ec</bpmn:outgoing>
</bpmn:task>
<bpmn:exclusiveGateway id="Gateway_1ykpua9">
<bpmn:incoming>Flow_1ias2ec</bpmn:incoming>
<bpmn:outgoing>Flow_0c4r6vy</bpmn:outgoing>
</bpmn:exclusiveGateway>
<bpmn:task id="Activity_05dlhv6" name="Record Consent" />
<bpmn:task id="Activity_1lxn6f7" name="Provide Consent">
<bpmn:incoming>Flow_0c4r6vy</bpmn:incoming>
</bpmn:task>
<bpmn:task id="Activity_1s5y9xm" name="Provide Consent" />
<bpmn:sequenceFlow id="Flow_0ws129z" sourceRef="Event_03tz7z4" targetRef="Activity_00yhqnr" />
<bpmn:sequenceFlow id="Flow_1ias2ec" sourceRef="Activity_00yhqnr" targetRef="Gateway_1ykpua9" />
<bpmn:sequenceFlow id="Flow_0c4r6vy" name="Yes" sourceRef="Gateway_1ykpua9" targetRef="Activity_1lxn6f7" />
</bpmn:process>
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Collaboration_0q56fut">
<bpmndi:BPMNShape id="Participant_18xshys_di" bpmnElement="Participant_18xshys" isHorizontal="true">
<dc:Bounds x="160" y="62" width="1370" height="998" />
<bpmndi:BPMNLabel />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Lane_1qewygr_di" bpmnElement="Lane_1qewygr" isHorizontal="true">
<dc:Bounds x="190" y="810" width="1340" height="250" />
<bpmndi:BPMNLabel />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Lane_0vot896_di" bpmnElement="Lane_0vot896" isHorizontal="true">
<dc:Bounds x="190" y="560" width="1340" height="250" />
<bpmndi:BPMNLabel />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Lane_0s229l6_di" bpmnElement="Lane_0s229l6" isHorizontal="true">
<dc:Bounds x="190" y="312" width="1340" height="248" />
<bpmndi:BPMNLabel />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Lane_0jp784q_di" bpmnElement="Lane_0jp784q" isHorizontal="true">
<dc:Bounds x="190" y="62" width="1340" height="250" />
<bpmndi:BPMNLabel />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Event_03tz7z4_di" bpmnElement="Event_03tz7z4">
<dc:Bounds x="262" y="172" width="36" height="36" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Activity_00yhqnr_di" bpmnElement="Activity_00yhqnr">
<dc:Bounds x="420" y="150" width="100" height="80" />
<bpmndi:BPMNLabel />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Gateway_1ykpua9_di" bpmnElement="Gateway_1ykpua9" isMarkerVisible="true">
<dc:Bounds x="445" y="395" width="50" height="50" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Activity_05dlhv6_di" bpmnElement="Activity_05dlhv6">
<dc:Bounds x="900" y="150" width="100" height="80" />
<bpmndi:BPMNLabel />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Activity_1lxn6f7_di" bpmnElement="Activity_1lxn6f7">
<dc:Bounds x="630" y="380" width="100" height="80" />
<bpmndi:BPMNLabel />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Activity_1s5y9xm_di" bpmnElement="Activity_1s5y9xm">
<dc:Bounds x="420" y="640" width="100" height="80" />
<bpmndi:BPMNLabel />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="Flow_1ias2ec_di" bpmnElement="Flow_1ias2ec">
<di:waypoint x="470" y="230" />
<di:waypoint x="470" y="395" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_0ws129z_di" bpmnElement="Flow_0ws129z">
<di:waypoint x="298" y="190" />
<di:waypoint x="420" y="190" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_0c4r6vy_di" bpmnElement="Flow_0c4r6vy">
<di:waypoint x="495" y="420" />
<di:waypoint x="630" y="420" />
<bpmndi:BPMNLabel>
<dc:Bounds x="554" y="402" width="18" height="14" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Association_171p978_di" bpmnElement="Association_171p978">
<di:waypoint x="450" y="415" />
<di:waypoint x="370" y="397" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="TextAnnotation_009927h_di" bpmnElement="TextAnnotation_009927h">
<dc:Bounds x="270" y="370" width="99.99998764470521" height="40.48582995951417" />
<bpmndi:BPMNLabel />
</bpmndi:BPMNShape>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
</bpmn:definitions>
4 changes: 2 additions & 2 deletions ig-template/package/includes/fragment-footer.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
<a style="color: #81BEF7" href="qa.html">QA Report</a>
<a style="color: #81BEF7" rel="license" href="{{site.data.fhir.path}}license.html"><img style="border-style: none;" alt="CC0" src="cc0.png"/></a>
<div>
</div>

</div>
<!--Include mermaid for creating diagrams. Jekyll complains if its not local, possibly configurable...-->
<script type="text/javascript" src="{{site.data.info.assets}}assets/js/mermaid.min.js"> </script>
29 changes: 9 additions & 20 deletions input/fsh/examples/0003-AddConditionTransactionExample1-bundle.fsh
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,27 @@ InstanceOf: Bundle
Usage: #example
* type = #transaction
* entry[0].fullUrl = "urn:uuid:6253c43b-5cc8-4645-93b1-38e41be82a77"
* entry[=].resource = patient-example-1
* entry[=].resource = PatientExample1
* entry[=].request.method = #PUT
* entry[=].request.url = "Patient?identifier=9912003888"
* entry[+].fullUrl = "urn:uuid:959fbc3c-0907-419e-aa3d-ab88f2d90c5e"
* entry[=].resource = consent-example-1
* entry[=].resource = ConsentExample1
* entry[=].request.method = #PUT
* entry[=].request.url = "Consent?patient=urn:uuid:6253c43b-5cc8-4645-93b1-38e41be82a77"
* entry[+].fullUrl = "urn:uuid:41a84a93-1c95-4162-b13c-1c617509e6e2"
* entry[=].resource = condition-example-1
* entry[=].resource = ConditionExample1
* entry[=].request.method = #PUT
* entry[=].request.url = "Condition?patient=urn:uuid:6253c43b-5cc8-4645-93b1-38e41be82a77"
* entry[+].fullUrl = "urn:uuid:fba99f70-fe1d-42e2-b77a-916e44b53c19"
* entry[=].resource = master-flag-example-1
* entry[=].resource = MasterFlagExample1
* entry[=].request.method = #PUT
* entry[=].request.url = "Flag/fba99f70-fe1d-42e2-b77a-916e44b53c19"
* entry[+].fullUrl = "urn:uuid:04adcb5b-3de7-4f67-97f0-b2fdf941ba85"
* entry[=].resource = condition-flag-example-1
* entry[=].resource = ConditionFlagExample1
* entry[=].request.method = #PUT
* entry[=].request.url = "Flag/04adcb5b-3de7-4f67-97f0-b2fdf941ba85"

Instance: patient-example-1
Instance: PatientExample1
InstanceOf: Patient
Usage: #inline
* identifier.system = "https://fhir.nhs.uk/Id/nhs-number"
Expand All @@ -35,26 +35,15 @@ Usage: #inline
* gender = #male
* birthDate = "1970-01-01"

Instance: consent-example-1
InstanceOf: Consent
Usage: #inline
* status = #active
* scope = $consentscope#patient-privacy
* category = RA-FlagCategory#NRAF "National Reasonable Adjustments Flag"
* provision.purpose = $sct#370856009 "Limiting access to confidential patient information"
* patient = Reference(urn:uuid:6253c43b-5cc8-4645-93b1-38e41be82a77)
* policy.authority = "https://www.gov.uk/"
* policy.uri = "https://www.gov.uk/government/uploads/system/uploads/attachment_data/file/535024/data-security-review.pdf"

Instance: condition-example-1
Instance: ConditionExample1
InstanceOf: Condition
Usage: #inline
* clinicalStatus = $condition-clinical#active
* category = RA-ConditionCategory#issue "Issue"
* code = RA-ConditionCode#5 "Learning or understanding or concentrating"
* subject = Reference(urn:uuid:6253c43b-5cc8-4645-93b1-38e41be82a77)

Instance: master-flag-example-1
Instance: MasterFlagExample1
InstanceOf: Flag
Usage: #inline
* status = #active
Expand All @@ -70,7 +59,7 @@ Usage: #inline
* contained.agent.who.reference = "https://sds.spineservices.nhs.uk/STU3/Practitioner/2ee4tr6a9"
* contained.agent.onBehalfOf.reference = "https://directory.spineservices.nhs.uk/STU3/Organization/a3e5i7"

Instance: condition-flag-example-1
Instance: ConditionFlagExample1
InstanceOf: Flag
Usage: #inline
* status = #active
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,43 +3,43 @@ InstanceOf: Bundle
Usage: #example
* type = #transaction
* entry[0].fullUrl = "urn:uuid:6253c43b-5cc8-4645-93b1-38e41be82a77"
* entry[=].resource = patient-example-1
* entry[=].resource = PatientExample1
* entry[=].request.method = #PUT
* entry[=].request.url = "Patient?identifier=9912003888"
* entry[+].fullUrl = "urn:uuid:959fbc3c-0907-419e-aa3d-ab88f2d90c5e"
* entry[=].resource = consent-example-1
* entry[=].resource = ConsentExample1
* entry[=].request.method = #PUT
* entry[=].request.url = "Consent?patient=urn:uuid:6253c43b-5cc8-4645-93b1-38e41be82a77"
* entry[+].fullUrl = "urn:uuid:41a84a93-1c95-4162-b13c-1c617509e6e2"
* entry[=].resource = condition-example-1
* entry[=].resource = ConditionExample1
* entry[=].request.method = #PUT
* entry[=].request.url = "Condition?patient=urn:uuid:6253c43b-5cc8-4645-93b1-38e41be82a77"
* entry[+].fullUrl = "urn:uuid:fba99f70-fe1d-42e2-b77a-916e44b53c19"
* entry[=].resource = master-flag-example-1
* entry[=].resource = MasterFlagExample1
* entry[=].request.method = #PUT
* entry[=].request.url = "Flag/fba99f70-fe1d-42e2-b77a-916e44b53c19"
* entry[+].fullUrl = "urn:uuid:04adcb5b-3de7-4f67-97f0-b2fdf941ba85"
* entry[=].resource = condition-flag-example-1
* entry[=].resource = ConditionFlagExample1
* entry[=].request.method = #PUT
* entry[=].request.url = "Flag/04adcb5b-3de7-4f67-97f0-b2fdf941ba85"
* entry[+].fullUrl = "urn:uuid:b19124e9-f742-49b4-9247-5c2d58ac1ef4"
* entry[=].resource = condition-example-2
* entry[=].resource = ConditionExample2
* entry[=].request.method = #PUT
* entry[=].request.url = "Condition/b19124e9-f742-49b4-9247-5c2d58ac1ef4"
* entry[+].fullUrl = "urn:uuid:212c1018-f52a-4db7-9bc2-59a88622eb4f"
* entry[=].resource = condition-flag-example-2
* entry[=].resource = ConditionFlagExample2
* entry[=].request.method = #PUT
* entry[=].request.url = "Flag/212c1018-f52a-4db7-9bc2-59a88622eb4f"

Instance: condition-example-2
Instance: ConditionExample2
InstanceOf: Condition
Usage: #inline
* clinicalStatus = $condition-clinical#active
* category = RA-ConditionCategory#issue "Issue"
* code = $sct#73618009 "Autistic spectrum disorder with isolated skills"
* subject = Reference(urn:uuid:6253c43b-5cc8-4645-93b1-38e41be82a77)

Instance: condition-flag-example-2
Instance: ConditionFlagExample2
InstanceOf: Flag
Usage: #inline
* status = #active
Expand Down
4 changes: 2 additions & 2 deletions input/fsh/examples/0012-RemoveRARecordExample.fsh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ Usage: #example
* entry[0].request.method = #DELETE
* entry[=].request.url = "Flag/fba99f70-fe1d-42e2-b77a-916e44b53c19"
* entry[+].request.method = #DELETE
* entry[=].request.url = "Consent/consent-example-1"
* entry[=].request.url = "Consent/ConsentExample1"
* entry[+].request.method = #DELETE
* entry[=].request.url = "Condition/condition-example-1"
* entry[=].request.url = "Condition/ConditionExample1"
23 changes: 23 additions & 0 deletions input/fsh/examples/0013-ConsentExample1.fsh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
Instance: ConsentExample1
InstanceOf: Consent
Usage: #example
* extension[0].url = "https://fhir.nhs.uk/England/StructureDefinition/Extension-ConsentCreateSummary"
* extension[=].valueAnnotation.text = "Example of consent create summary extension text"
* extension[+].url = "https://fhir.nhs.uk/England/StructureDefinition/Extension-ConsentRemoveSummary"
* extension[=].valueAnnotation.text = "Example of consent remove summary extension text"
* status = #active
* scope = $consentscope#patient-privacy
* category = RA-FlagCategory#NRAF "National Reasonable Adjustments Flag"
* provision.purpose = $sct#370856009 "Limiting access to confidential patient information"
* patient = Reference(Patient/PatientExample1)
* policy.authority = "https://www.gov.uk/"
* policy.uri = "https://www.gov.uk/government/uploads/system/uploads/attachment_data/file/535024/data-security-review.pdf"
* policyRule = RA-ProxyRole#001
* contained.resourceType = "Provenance"
* contained.id = "4c75ce1f-1ad7-4391-b5f6-104754c7e904"
* contained.target.reference = "#"
* contained.recorded = "2024-01-01T11:00:00+00:00"
* contained.activity = $v3-DataOperation#CREATE "create"
* contained.agent.role = $CareConnect-SDSJobRoleName-1#R0260 "General Medical Practitioner"
* contained.agent.who.reference = "https://sds.spineservices.nhs.uk/STU3/Practitioner/2ee4tr6a9"
* contained.agent.onBehalfOf.reference = "https://directory.spineservices.nhs.uk/STU3/Organization/a3e5i7"
38 changes: 38 additions & 0 deletions input/images-source/consent-activity.plantuml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
@startuml

|<font color=gray><b><u>Practioner</u></b></font>|
start
:Request consent;

|#LightGray|<font color=gray><b><u>Patient</u></b></font>|
if (Capacity to\n consent?) is (Yes) then
:Provide consent;
else (No)

|<font color=gray><b><u>Patient Advocate</u></b></font>|
:Provide consent;
endif

|<font color=gray><b><u>Practioner</u></b></font>|
if (Consent given) is (Yes) then
:Record/confirm\n consent given;
else (No)
: Revoke consent\nand previous records;
endif

|#LightGray|<font color=gray><b><u>API</u></b></font>|
:Update API;
note right
There are vaious
ways this can be
acheived and
examples are
provided
throughout
end note

|<font color=gray><b><u>Practioner</u></b></font>|
:Confirmation;
stop

@enduml
41 changes: 41 additions & 0 deletions input/images-source/consent-sequence.plantuml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
@startuml

skinparam actorStyle hollow

actor "Practitioner" as pra
actor "Patient" as pat
actor "Patient Advocate" as pad
participant "FHIR API" as api
entity "Consent" as con
entity "Master Flag" as mas
entity "Adjustment Flag" as adj
entity "Condition" as cod

alt Patient provides consent
pra -> pat : Request consent
pra <-- pat : Provide consent
else Advocate provides consent
pra -> pad : Request Consent
pra <-- pad : Provide consent
end

alt Consent has been given
pra -> api : Record consent given
api -> con : Create/update resource
con -> con : Validate
api <-- con : return
pra <-- api : OperationOutcome
else Consent has not been given/been revoked
pra -> api : Record consent was not given
api -> con : Delete adjustment consent
api <-- con : return
api -> mas : Delete adjustment master flag
api <-- mas : return
api -> adj : Delete adjustment flag(s)
api <-- adj : return
api -> cod : Delete condition flag(s)
api <-- cod : return
pra <-- api : OperationOutcome
end

@enduml
Loading
Loading