You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* first review pass
* add information on how to run tests
* increment version of internal/events/package.json
* include information on setting the api key in main and for TestSupplier1
* correct the proxy_name format
---------
Co-authored-by: Vlasis-Perdikidis <vlasis.perdikidis1@nhs.net>
Copy file name to clipboardExpand all lines: CONTRIBUTING.md
+11-1Lines changed: 11 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,4 +1,6 @@
1
-
## Contributing to NHS Notify Supplier API
1
+
<!-- vale off -->
2
+
3
+
# Contributing to NHS Notify Supplier API
2
4
3
5
## Feature Branches
4
6
@@ -45,3 +47,11 @@ GitHooks **must** be configured and run on commits before pushing to remote. Ref
45
47
## Testing Your Branch
46
48
47
49
You can test your branch in a dynamic environment prior to merging to `main`. These are created as part of the `cicd-1-pull-request.yaml` workflow, triggered when a PR is created or updated.
50
+
51
+
## Function Documentation
52
+
53
+
Each Lambda and internal package has a `README.md` alongside the source describing its purpose, flow, integration points, and peculiarities. These are bundled into the docs site via `docs/generate-includes.sh`.
54
+
55
+
When making changes to a Lambda or internal package, check whether the corresponding README needs updating. Function documentation is not auto-generated and can become stale if not maintained alongside code changes.
Static JSON configuration files that define the supplier allocation rules for the Supplier API. These are loaded into DynamoDB by infrastructure tooling and are queried at runtime by the `supplier-allocator` Lambda. Check relevant repositories (nhs-notify-internal, nhs-notify-supplier-config) as they orchestrate supplier config data ingress depending on target account, environment, etc.
|**Supplier**|`supplier/`| Print supplier definitions with ID, name, channel type, daily capacity, and status (PROD/DRAFT) |
14
+
|**Letter Variant**|`letter-variant/`| Letter type definitions with physical constraints (sheets, sides, ink coverage, delivery days), associated pack specification IDs, and volume group assignment |
15
+
|**Volume Group**|`volume-group/`| Groupings of letter variants for allocation purposes, with status and date range validity |
16
+
|**Supplier Allocation**|`supplier-allocation/`| Maps a supplier to a volume group with a target `allocationPercentage` and status |
17
+
|**Pack Specification**|`pack-specification/`| Detailed print assembly specs (paper, envelope, print colour, duplex) with constraints and billing ID |
18
+
|**Supplier Pack**|`supplier-pack/`| Links a supplier to a pack specification with approval status |
19
+
20
+
## Allocation Lookup Chain
21
+
22
+
When the `supplier-allocator` Lambda processes a `LetterRequestPreparedEvent`:
23
+
24
+
1. The event's `letterVariantId` identifies the **Letter Variant**.
25
+
2. The variant's `volumeGroupId` identifies the **Volume Group** (must be `PROD` status and within date range).
26
+
3.**Supplier Allocations** for that volume group determine which suppliers are eligible and their target allocation percentages (must sum to 100).
27
+
4. The variant's `packSpecificationIds` are filtered by the letter's physical constraints.
28
+
5.**Supplier Packs** confirm which eligible suppliers support the selected pack specification.
29
+
6. The supplier with the lowest weighted allocation factor (furthest below their target share) is selected.
30
+
31
+
## Nuances and Peculiarities
32
+
33
+
- These files are the source of truth for the supplier config DynamoDB table (`SUPPLIER_CONFIG_TABLE_NAME`). Changes here flow into DynamoDB via infrastructure deployment.
34
+
- Runtime persistence is event-driven: supplier-config events are routed through SQS to the `supplier-config-ingress` Lambda, which upserts records into the config table.
35
+
-`status: "PROD"` is required at multiple levels (supplier, volume group, allocation) for an allocation to be active.
36
+
- Volume groups have `startDate` (and optional `endDate`) fields. Allocations are only valid when the current date falls within this range (evaluated in London timezone).
37
+
- Supplier `dailyCapacity` is tracked separately in `SUPPLIER_QUOTAS_TABLE` and resets at midnight London time. It is not stored in these config files.
0 commit comments