Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
cefa6f8
Feature: Add initial schemas and events for supplier configuration
m-houston Nov 14, 2025
550cf6d
Fix: dependencies
m-houston Nov 14, 2025
8bc340b
Remove domain prefix from subject in event envelope
m-houston Nov 14, 2025
9a6caf0
Remove documentation examples
m-houston Nov 20, 2025
1cc5b99
Merge branch 'main' into CCM-12869-supplier-config-events
m-houston Nov 20, 2025
94afeb4
Remove generated files from git
m-houston Nov 20, 2025
3512e44
Add contract events
m-houston Nov 20, 2025
c9a9894
Remove stray readme
m-houston Nov 20, 2025
5c440bf
Add supplier model events
m-houston Nov 20, 2025
21f3557
Refactor contract references to volume group in schemas and events
m-houston Nov 26, 2025
3aaf40d
Add volume group events and update JSON generation
m-houston Nov 26, 2025
7977cad
Refactor status handling to use $EnvironmentStatus across configurations
m-houston Jan 15, 2026
da25b97
Update tests
m-houston Jan 15, 2026
1ac2fdd
Add approval status validation and update enums in specifications
m-houston Jan 18, 2026
32ab2da
Update deliverySLA to deliveryDays and change status references to PROD
m-houston Jan 18, 2026
e1e9bfd
Refactor colour property to restrict to WHITE and update description
m-houston Jan 18, 2026
e1a0f42
Add DISABLED status to various entities and update related schemas
m-houston Jan 19, 2026
4386d92
Add optional description to PackSpecification and update tests
m-houston Jan 20, 2026
41ddd2d
Add duplex field validation to PackSpecification and update tests
m-houston Jan 21, 2026
437e88c
Add ATTACHMENT type to PackSpecification $Insert schema
m-houston Jan 21, 2026
72af2fa
Add constraints validation to PackSpecification and related tests
m-houston Feb 2, 2026
31710cd
Event Builder: tools for constructing valid config events from payloa…
m-houston Nov 14, 2025
0151ff9
Remove content that lives on other branches
m-houston Feb 2, 2026
66f7ef5
Refactor event builder tests to remove unnecessary imports and use st…
m-houston Feb 2, 2026
e1ca80d
Refactor: Excel to config model parser tooling
m-houston Feb 2, 2026
261a594
Enhance Excel parsing: update constraints structure and add CLI for p…
m-houston Feb 3, 2026
21b2499
Merge branch 'main' into CCM-12869-excel-parser
m-houston Apr 14, 2026
6a289d8
Refactor: Generate HTML report detailing each supplier's configuration
m-houston Feb 2, 2026
72d7135
Refactor: Update constraints structure in supplier reports and enhanc…
m-houston Feb 3, 2026
1713e53
Fix formatting
m-houston Feb 3, 2026
41310f8
Enhance supplier report generation: add variant mapping CSV output wi…
m-houston Feb 3, 2026
d461e4c
Enhance supplier report: convert Table of Contents to a structured ta…
m-houston Feb 4, 2026
fab1527
Enhance supplier report: add billing ID to pack specification details
m-houston Mar 23, 2026
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
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,5 @@ dist

.env
/.envrc
/specifications.xlsx
~*
1 change: 1 addition & 0 deletions packages/cli-supplier-reports/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
supplier-reports/
4 changes: 4 additions & 0 deletions packages/cli-supplier-reports/AGENTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# CLI Supplier Reports - instructions for agents

* These reports are for suppliers and should contain just the details needed for implementing a pack.
* Supplier Pack ID is not required in the report since that is our internal mapping of the pack to a supplier
88 changes: 88 additions & 0 deletions packages/cli-supplier-reports/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
# Supplier Reports CLI

A command-line tool for generating HTML reports for NHS Notify suppliers showing their assigned pack specifications.

## Installation

This package is part of the nhs-notify-supplier-config monorepo. Install dependencies from the root:

```bash
npm install
```

## Usage

```bash
# Generate HTML reports for all suppliers
npm run cli -- report -f specs.xlsx -o ./reports

# Exclude draft packs from reports
npm run cli -- report -f specs.xlsx -o ./reports --exclude-drafts

# Generate a blank Excel template
npm run cli -- template -o specs.template.xlsx

# Force overwrite existing template
npm run cli -- template -o specs.template.xlsx --force
```

### Commands

#### `report`

Generate HTML reports per supplier showing assigned pack specifications.

| Option | Alias | Description | Default |
|--------|-------|-------------|---------|
| `--file` | `-f` | Excel file path | specifications.xlsx |
| `--out` | `-o` | Output directory for HTML reports | ./supplier-reports |
| `--exclude-drafts` | | Exclude supplier packs with DRAFT approval status | false |

#### `template`

Generate a blank Excel template with all required sheets and columns.

| Option | Alias | Description | Default |
|--------|-------|-------------|---------|
| `--out` | `-o` | Output .xlsx file path | specifications.template.xlsx |
| `--force` | `-F` | Overwrite existing file if present | false |

## Report Features

Each supplier report includes:

- Supplier information (ID, name, channel type, daily capacity, status)
- Volume group allocations with percentages
- Summary cards showing pack counts by status
- Table of contents with quick navigation
- Detailed pack specifications including:
- Basic information
- Postage details
- Constraints
- Assembly specifications
- Paper details

Additionally, a **variant-mapping.csv** file is generated containing the complete mapping from letter variants through pack specifications, supplier packs, to suppliers. This CSV only includes records where the status is INT or PROD, providing a clean view of active production configurations.

### Variant Mapping CSV

The variant mapping CSV includes the following columns:

- `variant_id` - Letter variant ID
- `variant_name` - Letter variant name
- `variant_status` - Letter variant environment status (INT/PROD)
- `pack_specification_id` - Pack specification ID
- `pack_specification_name` - Pack specification name
- `pack_specification_status` - Pack specification environment status (INT/PROD)
- `pack_specification_version` - Pack specification version number
- `supplier_pack_id` - Supplier pack ID
- `supplier_pack_approval` - Supplier pack approval status
- `supplier_pack_status` - Supplier pack environment status (INT/PROD)
- `supplier_id` - Supplier ID
- `supplier_name` - Supplier name

This CSV provides a flattened view of the relationships, making it easy to analyze and query the complete configuration in tools like Excel or databases.

## Dependencies

- `@nhs-notify/excel-parser` - For parsing Excel files
26 changes: 26 additions & 0 deletions packages/cli-supplier-reports/jest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import type { Config } from "jest";

const config: Config = {
moduleNameMapper: {
"^@supplier-config/cli-supplier-reports/(.*)$": "<rootDir>/src/$1",
},
preset: "ts-jest",
testEnvironment: "node",
testPathIgnorePatterns: ["/node_modules/", "/dist/"],
transform: {
"^.+\\.tsx?$": [
"@swc/jest",
{
jsc: {
parser: {
syntax: "typescript",
tsx: false,
},
target: "es2022",
},
},
],
},
};

export default config;
32 changes: 32 additions & 0 deletions packages/cli-supplier-reports/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"bin": {
"supplier-reports": "dist/cli.js"
},
"dependencies": {
"@nhsdigital/nhs-notify-event-schemas-supplier-config": "*",
"@supplier-config/excel-parser": "*",
"yargs": "^17.7.2"
},
"devDependencies": {
"@swc/core": "^1.11.13",
"@swc/jest": "^0.2.37",
"@tsconfig/node22": "^22.0.2",
"@types/jest": "^29.5.14",
"@types/yargs": "^17.0.32",
"jest": "^29.7.0",
"jest-mock-extended": "^3.0.7",
"typescript": "^5.9.3"
},
"name": "@supplier-config/cli-supplier-reports",
"private": true,
"scripts": {
"build": "tsc",
"cli": "ts-node src/cli.ts",
"lint": "eslint .",
"lint:fix": "eslint . --fix",
"test": "jest",
"test:unit": "jest",
"typecheck": "tsc --noEmit"
},
"version": "0.0.1"
}
Loading
Loading