Skip to content

Commit 3a01ab3

Browse files
authored
Merge branch 'main' into schedule-notifications-ca-jobs
2 parents cf5e3a0 + 870da05 commit 3a01ab3

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+817
-530
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,7 @@ coverage
3333

3434
# MacOS Finder hidden files
3535
.DS_Store
36+
37+
# Structurizr
38+
.structurizr
39+
workspace.json

Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,8 @@ _clean-docker:
106106
manage_breast_screening/config/.env:
107107
cp manage_breast_screening/config/.env.tpl manage_breast_screening/config/.env
108108

109+
diagrams:
110+
docker run -it --rm -p 8080:8080 -v ${PWD}/docs/diagrams:/usr/local/structurizr structurizr/lite
109111

110112
.DEFAULT_GOAL := help
111113
.PHONY: clean config dependencies build deploy githooks-config githooks-run help test test-unit test-lint test-ui run _install-poetry _clean-docker rebuild-db db migrate seed shell

README.md

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -88,23 +88,19 @@ There is a make task to seed a non-production instance of the service with examp
8888

8989
This command wipes the database entirely before populating it with fictitious data. The data is contained in yaml files in the [data directory](/data) and can be amended etc there as required.
9090

91-
### Django admin
92-
93-
We'll probably remove it before deploying to production, but currently Django admin is enabled.
94-
95-
To use it, first create a superuser
91+
## Design
9692

97-
```sh
98-
poetry run ./manage.py createsuperuser
99-
```
93+
The service will be deployed as a web application, backed by a postgres database with authentication provided by NHS CIS2. In addtion to these elements we will deploy a gateway application to each breast screening unit that uses the service that will be responsible for interop with local hospital systems. The gateway will be developed in a future phase of this project and is not currently under active development.
10094

101-
Then run the app and navigate to `http://localhost:8000/admin`
95+
![](docs/diagrams/svg/structurizr-1-SystemContext-001.svg)
10296

103-
## Design
97+
Display diagrams interactively:
10498

105-
The service will be deployed as a web application, backed by a postgres database with authentication provided by NHS CIS2. In addtion to these elements we will deploy a gateway application to each breast screening unit that uses the service that will be responsible for interop with local hospital systems. The gateway will be developed in a future phase of this project and is not currently under active development.
99+
- Run `make diagrams`
100+
- Open `http://localhost:8080/` in a browser
101+
- Select views from the sidebar or double click on diagram elements
106102

107-
![](docs/diagrams/container-diagram.png)
103+
Alternatively, [view all static diagrams](docs/diagrams/README.md).
108104

109105
### Structure
110106

docs/diagrams/README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Diagrams
2+
3+
![](svg/structurizr-1-SystemContext-001.svg)
4+
![](svg/structurizr-1-Container-001.svg)
5+
![](svg/structurizr-1-Container-002.svg)
6+
![](svg/structurizr-1-Component-002.svg)
7+
![](svg/structurizr-1-Component-001.svg)

docs/diagrams/svg/structurizr-1-Component-001.svg

Lines changed: 1 addition & 0 deletions
Loading

docs/diagrams/svg/structurizr-1-Component-002.svg

Lines changed: 1 addition & 0 deletions
Loading

docs/diagrams/svg/structurizr-1-Container-001.svg

Lines changed: 1 addition & 0 deletions
Loading

docs/diagrams/svg/structurizr-1-Container-002.svg

Lines changed: 1 addition & 0 deletions
Loading

docs/diagrams/svg/structurizr-1-SystemContext-001.svg

Lines changed: 1 addition & 0 deletions
Loading

docs/diagrams/workspace.dsl

Lines changed: 180 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,37 +7,204 @@ workspace {
77

88
cis2 = softwareSystem "CIS2" {
99
description "Central authentication system used to authenticate users"
10-
tags "External system"
10+
tags external
1111
}
1212

13-
hospitalGateway = softwareSystem "Gateway" {
14-
description "VM running within each hospital network"
13+
mesh = softwareSystem "NBSS MESH mailbox" {
14+
description "Events from NBSS in each breast screening office"
15+
tags external
1516
}
1617

17-
breastScreeningSystem = softwareSystem "Breast Screening System" {
18+
notify = softwareSystem "NHS Notify" {
19+
description "Send invitations via NHS app, SMS, post"
20+
tags external
21+
}
22+
23+
azure_arc = softwareSystem "Azure ARC" "Manages external VMs at scale" {
24+
tags azure
25+
}
26+
azure_relay = softwareSystem "Azure relay" "Securely exposes services" {
27+
tags azure
28+
}
29+
azure = group "Azure" {
30+
breastScreeningSystem = softwareSystem "Breast Screening System" {
31+
webApplication = container "Manage Breast Screening" "Allows users to manage breast screening appointments and records" {
32+
technology "Container app Web"
33+
}
34+
azurePostgres = container "Database" "Stores screening data" {
35+
technology "Managed Azure postgres"
36+
tags database azure
37+
}
38+
39+
jobs = container "Functions" "Process events asynchronously" {
40+
technology "Event driven container app jobs"
41+
save_message_status = component "Save message status" {
42+
technology "Event driven container app job"
43+
tags job
44+
}
45+
send_message_batch = component "Send message batch / Retry failed message batch" "2 separate jobs" {
46+
technology "Event driven container app job"
47+
tags job
48+
}
49+
create_appointments = component "Create appointments" {
50+
technology "Event driven container app job"
51+
tags job
52+
}
53+
store_mesh_messages = component "Store Mesh messages" {
54+
technology "Event driven container app job"
55+
tags job
56+
}
57+
create_report = component "Create report" {
58+
technology "Event driven container app job"
59+
tags job
60+
}
1861

19-
manageScreening = container "Manage Breast Screening" "Web Application" "Allows users to manage breast screening appointments and records"
20-
azurePostgres = container "Azure Database for PostgreSQL" "PostgreSQL - Managed Service" "Stores screening data in a managed Azure Postgres instance"
62+
mesh_blob_container = component "MESH data" {
63+
technology "Azure storage blob container"
64+
tags azure
65+
}
66+
reports_blob_container = component "Reports" {
67+
technology "Azure storage blob container"
68+
tags azure
69+
}
70+
queue = component "Message status queue" {
71+
technology "Azure storage queue"
72+
tags azure
73+
}
74+
retry_queue = component "Retry queue" {
75+
technology "Azure storage queue"
76+
tags azure
77+
}
78+
}
2179

22-
user -> cis2 "Authenticates via"
23-
cis2 -> manageScreening "Provides authentication token to"
24-
user -> manageScreening "Uses (once authenticated)"
25-
manageScreening -> azurePostgres "Reads from and writes to"
26-
manageScreening -> hospitalGateway "Communicates with"
80+
webApplication -> azurePostgres "Reads from and writes to"
81+
}
2782
}
83+
84+
hospital_network = group "Hospital network" {
85+
hospital_screening = softwareSystem "Hospital Screening system" "Deployed in each hospital or trust" {
86+
87+
gw = container "Screening gateway" "VM with outbound connection to web application" {
88+
tags "Gateway"
89+
90+
vm = component "Virtual machine" "Managed by hospital"
91+
arc_agent = component "Azure ARC agent" "Outbound connection to receive deployment instructions"
92+
gw_app = component "Gateway application" "Connects to both the API in Azure and devices in the hospital network"
93+
94+
vm -> arc_agent "Runs"
95+
arc_agent -> gw_app "Deploys"
96+
}
97+
modality = container "Modality" {
98+
tags external
99+
}
100+
pacs = container "PACS" {
101+
tags external
102+
}
103+
erp = container "ERP/Hospital referrals" {
104+
tags external
105+
}
106+
labs = container "Labs" {
107+
tags external
108+
}
109+
110+
gw -> modality "Imaging orders and notifications"
111+
gw -> pacs "Images & metadata"
112+
gw -> erp "Family history referrals, imaging reports"
113+
gw -> labs "Pathology orders and results"
114+
}
115+
}
116+
117+
arc_agent -> azure_arc "Receives instructions from"
118+
gw_app -> azure_relay "Creates bidirectional connection to API"
119+
webApplication -> azure_relay "Creates bidirectional connection to gateway"
120+
hospital_screening -> webApplication "Uses outbound connection to communicate back and forth with"
121+
122+
user -> cis2 "Authenticates via"
123+
cis2 -> webApplication "Provides authentication token to"
124+
125+
save_message_status -> queue "Gets updates to save"
126+
store_mesh_messages -> mesh "Fetches appointments from" {
127+
tags store_mesh
128+
}
129+
send_message_batch -> notify "Sends message requests"
130+
send_message_batch -> retry_queue "Sends failed batches" {
131+
tags send_retry
132+
}
133+
create_appointments -> mesh_blob_container "Gets MESH messages"
134+
store_mesh_messages -> mesh_blob_container "Stores MESH messages"
135+
create_report -> reports_blob_container "Stores message status reports"
136+
notify -> webApplication "Sends status updates to"
137+
webApplication -> queue "Save message status"
138+
139+
# Commented to avoid cluttering - Grouped with send_message_batch
140+
# retry_failed_message_batch -> retry_queue "Gets failed batches"
141+
# retry_failed_message_batch -> notify "Retry messages"
142+
143+
# Commented to avoid cluttering - DB connection in view title
144+
# store_mesh_messages -> azurePostgres "Store messages to"
145+
# save_message_status -> azurePostgres "Save message status"
146+
# send_message_batch -> azurePostgres "Gets appointments from"
147+
# create_appointments -> azurePostgres "Converts to appointments and clinic"
148+
# create_report -> azurePostgres "Gets message statuses from"
149+
150+
# Commented to avoid cluttering
151+
# jobs -> azurePostgres "Store data"
28152
}
29153

30154
views {
31155

156+
systemContext breastScreeningSystem {
157+
include * user
158+
exclude azure_relay
159+
autolayout lr
160+
}
161+
32162
container breastScreeningSystem {
163+
include "element.parent==breastScreeningSystem" mesh notify cis2 azure_relay
164+
exclude "webApplication->jobs"
165+
autolayout tb
166+
}
167+
168+
container hospital_screening {
169+
include *
170+
autolayout tb
171+
}
172+
173+
component jobs {
174+
title "Functions [Connections to database are omitted]"
33175
include *
34-
autolayout lr
176+
autolayout tb
177+
}
178+
179+
component gw {
180+
include *
181+
autolayout bt 150
35182
}
36183

37184
styles {
38-
element "External system" {
185+
element external {
39186
background #AAAAAA
40187
}
188+
element database {
189+
shape Cylinder
190+
}
191+
element "Gateway" {
192+
shape Ellipse
193+
}
194+
element job {
195+
background green
196+
colour white
197+
}
198+
element azure {
199+
background blue
200+
colour white
201+
}
202+
relationship store_mesh {
203+
position 60
204+
}
205+
relationship send_retry {
206+
position 20
207+
}
41208
}
42209

43210
theme default

0 commit comments

Comments
 (0)