Skip to content

Commit 7bb25f3

Browse files
authored
Merge pull request #83 from NHSDigital/docs/context-diagram-in-README
Add context diagram to README
2 parents b8a9319 + ddbe5e4 commit 7bb25f3

File tree

1 file changed

+84
-19
lines changed

1 file changed

+84
-19
lines changed

README.md

Lines changed: 84 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,13 @@ The software will only be used for signposting an individual to an appropriate s
2424
- [Creating a Postman collection](#creating-a-postman-collection)
2525
- [Design](#design)
2626
- [Diagrams](#diagrams)
27-
- [Modularity](#modularity)
2827
- [Contributing](#contributing)
2928
- [Contacts](#contacts)
3029
- [Licence](#licence)
3130

3231
## Setup
3332

34-
First, ensure [Pprerequisites](#prerequisites) are met. Then clone the repository, and install dependencies.
33+
First, ensure [Prerequisites](#prerequisites) are met. Then clone the repository, and install dependencies.
3534

3635
```shell
3736
git clone https://github.com/NHSDigital/eligibility-signposting-api.git
@@ -128,25 +127,91 @@ Local tests will use [localstack](https://www.localstack.cloud/), started & stop
128127

129128
### Diagrams
130129

131-
The [C4 model](https://c4model.com/) is a simple and intuitive way to create software architecture diagrams that are clear, consistent, scalable and most importantly collaborative. This should result in documenting all the system interfaces, external dependencies and integration points.
132-
133-
![Repository Template](./docs/diagrams/Repository_Template_GitHub_Generic.png)
134-
135-
The source for diagrams should be in Git for change control and review purposes. Recommendations are [draw.io](https://app.diagrams.net/) (example above in [docs](.docs/diagrams/) folder) and [Mermaids](https://github.com/mermaid-js/mermaid). Here is an example Mermaids sequence diagram:
136-
137130
```mermaid
138-
sequenceDiagram
139-
User->>+Service: GET /users?params=...
140-
Service->>Service: auth request
141-
Service->>Database: get all users
142-
Database-->>Service: list of users
143-
Service->>Service: filter users
144-
Service-->>-User: list[User]
145-
```
146-
147-
### Modularity
131+
graph TB
132+
subgraph "System Context"
133+
direction TB
134+
Client["NHS App / Client"]
135+
Consumer["Postman / Consumer"]
136+
API["Eligibility Signposting API"]
137+
AWS["AWS"]
138+
end
139+
140+
Client -->|"HTTP Request"| API
141+
Consumer -->|"HTTP Request"| API
142+
API -->|"Deployed on"| AWS
143+
144+
subgraph "Container Diagram"
145+
direction TB
146+
subgraph "AWS Infrastructure"
147+
direction TB
148+
APIGW["API Gateway"]
149+
Lambda["Python Lambda (app.py)"]
150+
DynamoDB["DynamoDB Table"]
151+
S3Bucket["S3 Bucket (rules)"]
152+
IAM["IAM Roles & Policies"]
153+
end
154+
subgraph "CI/CD Pipeline"
155+
direction TB
156+
GH["GitHub Actions"]
157+
TF["Terraform"]
158+
end
159+
end
160+
161+
Client -->|"HTTPS POST /eligibility"| APIGW
162+
APIGW -->|"Invoke"| Lambda
163+
Lambda -->|"GetItem/PutItem"| DynamoDB
164+
Lambda -->|"GetObject"| S3Bucket
165+
Lambda -->|"Uses"| IAM
166+
167+
GH -->|"runs pipelines"| TF
168+
TF -->|"provisions"| APIGW
169+
TF -->|"provisions"| DynamoDB
170+
TF -->|"provisions"| S3Bucket
171+
TF -->|"provisions"| IAM
172+
173+
subgraph "Eligibility Lambda Function - Components"
174+
direction TB
175+
App["app.py (WireUp DI)"]
176+
Config["config.py, error_handler.py"]
177+
subgraph "Presentation Layer"
178+
direction TB
179+
View["views/eligibility.py"]
180+
ResponseModel["views/response_model/eligibility.py"]
181+
end
182+
subgraph "Business Logic Layer"
183+
direction TB
184+
Service["services/eligibility_services.py"]
185+
Operators["services/rules/operators.py"]
186+
end
187+
subgraph "Data Access Layer"
188+
direction TB
189+
RepoElig["repos/eligibility_repo.py"]
190+
RepoRules["repos/rules_repo.py"]
191+
Factory["repos/factory.py, exceptions.py"]
192+
end
193+
subgraph "Models"
194+
direction TB
195+
ModelElig["model/eligibility.py"]
196+
ModelRules["model/rules.py"]
197+
end
198+
end
199+
200+
Lambda -->|"loads"| App
201+
App -->|injects| View
202+
View -->|calls| Service
203+
Service -->|calls| Operators
204+
Service -->|calls| RepoElig
205+
Service -->|calls| RepoRules
206+
RepoElig -->|uses| DynamoDB
207+
RepoRules -->|uses| S3Bucket
208+
View -->|uses| ResponseModel
209+
App -->|reads| Config
210+
Service -->|uses| ModelElig
211+
Operators -->|uses| ModelRules
212+
App -->|wires| Factory
148213
149-
Most of the projects are built with customisability and extendability in mind. At a minimum, this can be achieved by implementing service level configuration options and settings. The intention of this section is to show how this can be used. If the system processes data, you could mention here for example how the input is prepared for testing - anonymised, synthetic or live data.
214+
```
150215

151216
## Contributing
152217

0 commit comments

Comments
 (0)