@pdtf/schemas 3.6.0-dev.7 → 3.6.0-dev.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (130) hide show
  1. package/busy-spence-79c6bf/CLAUDE.md +101 -0
  2. package/busy-spence-79c6bf/LICENSE +21 -0
  3. package/busy-spence-79c6bf/README.md +435 -0
  4. package/busy-spence-79c6bf/docs/branch-release-workflow.md +138 -0
  5. package/busy-spence-79c6bf/docs/sef25-extensions-ui-spec.md +355 -0
  6. package/busy-spence-79c6bf/index.js +654 -0
  7. package/busy-spence-79c6bf/package-lock.json +7299 -0
  8. package/busy-spence-79c6bf/package.json +44 -0
  9. package/busy-spence-79c6bf/scripts/ta6ed6-titles.js +403 -0
  10. package/busy-spence-79c6bf/scripts/ta7ed5-titles.js +183 -0
  11. package/busy-spence-79c6bf/src/examples/v1/exampleAddParticipantVouch.json +32 -0
  12. package/busy-spence-79c6bf/src/examples/v1/exampleDocumentedVouch.json +40 -0
  13. package/busy-spence-79c6bf/src/examples/v1/exampleElectronicRecord.json +30 -0
  14. package/busy-spence-79c6bf/src/examples/v1/exampleTransaction.json +878 -0
  15. package/busy-spence-79c6bf/src/examples/v1/exampleVouch.json +25 -0
  16. package/busy-spence-79c6bf/src/examples/v2/exampleTransaction.json +901 -0
  17. package/busy-spence-79c6bf/src/examples/v3/exampleAddParticipantVouch.json +38 -0
  18. package/busy-spence-79c6bf/src/examples/v3/exampleCustomOverlay.json +55 -0
  19. package/busy-spence-79c6bf/src/examples/v3/exampleCustomOverlay2.json +93 -0
  20. package/busy-spence-79c6bf/src/examples/v3/exampleDocumentedVouch.json +47 -0
  21. package/busy-spence-79c6bf/src/examples/v3/exampleElectronicRecord.json +36 -0
  22. package/busy-spence-79c6bf/src/examples/v3/exampleTransaction.json +1038 -0
  23. package/busy-spence-79c6bf/src/examples/v3/exampleVouch.json +32 -0
  24. package/busy-spence-79c6bf/src/mappings/SendPropertyDetailsRequestSchema.json +1588 -0
  25. package/busy-spence-79c6bf/src/mappings/adf.js +198 -0
  26. package/busy-spence-79c6bf/src/schemas/v1/GeoJSON.json +1279 -0
  27. package/busy-spence-79c6bf/src/schemas/v1/baspiNotes.html +102 -0
  28. package/busy-spence-79c6bf/src/schemas/v1/energy-performance-certificate.json +124 -0
  29. package/busy-spence-79c6bf/src/schemas/v1/freehold-information.json +2051 -0
  30. package/busy-spence-79c6bf/src/schemas/v1/leasehold-information.json +2064 -0
  31. package/busy-spence-79c6bf/src/schemas/v1/legal-information.json +1045 -0
  32. package/busy-spence-79c6bf/src/schemas/v1/material-facts.json +2109 -0
  33. package/busy-spence-79c6bf/src/schemas/v1/pdtf-transaction-search-results.json +40 -0
  34. package/busy-spence-79c6bf/src/schemas/v1/pdtf-transaction.json +191 -0
  35. package/busy-spence-79c6bf/src/schemas/v1/searches/drainage-and-water.json +261 -0
  36. package/busy-spence-79c6bf/src/schemas/v1/searches/local-land-charges.json +69 -0
  37. package/busy-spence-79c6bf/src/schemas/v1/searches/local-searches-required.json +857 -0
  38. package/busy-spence-79c6bf/src/schemas/v1/searches.json +237 -0
  39. package/busy-spence-79c6bf/src/schemas/v1/title-deed.json +841 -0
  40. package/busy-spence-79c6bf/src/schemas/v2/baspiNotes.html +102 -0
  41. package/busy-spence-79c6bf/src/schemas/v2/combined.json +37731 -0
  42. package/busy-spence-79c6bf/src/schemas/v2/overlays/baspi.json +8132 -0
  43. package/busy-spence-79c6bf/src/schemas/v2/overlays/con29DW.json +705 -0
  44. package/busy-spence-79c6bf/src/schemas/v2/overlays/con29R.json +2956 -0
  45. package/busy-spence-79c6bf/src/schemas/v2/overlays/fme1.json +1259 -0
  46. package/busy-spence-79c6bf/src/schemas/v2/overlays/llc1.json +25 -0
  47. package/busy-spence-79c6bf/src/schemas/v2/overlays/lpe1.json +2171 -0
  48. package/busy-spence-79c6bf/src/schemas/v2/overlays/nts.json +326 -0
  49. package/busy-spence-79c6bf/src/schemas/v2/overlays/oc1.json +2799 -0
  50. package/busy-spence-79c6bf/src/schemas/v2/overlays/piq.json +3419 -0
  51. package/busy-spence-79c6bf/src/schemas/v2/overlays/rds.json +3736 -0
  52. package/busy-spence-79c6bf/src/schemas/v2/overlays/ta10.json +5306 -0
  53. package/busy-spence-79c6bf/src/schemas/v2/overlays/ta6.json +4533 -0
  54. package/busy-spence-79c6bf/src/schemas/v2/overlays/ta7.json +1045 -0
  55. package/busy-spence-79c6bf/src/schemas/v2/pdtf-transaction.json +34351 -0
  56. package/busy-spence-79c6bf/src/schemas/v2/skeleton.json +3973 -0
  57. package/busy-spence-79c6bf/src/schemas/v3/combined.json +48643 -0
  58. package/busy-spence-79c6bf/src/schemas/v3/compactSkeleton.txt +4519 -0
  59. package/busy-spence-79c6bf/src/schemas/v3/overlays/README.md +299 -0
  60. package/busy-spence-79c6bf/src/schemas/v3/overlays/baspi4.json +8030 -0
  61. package/busy-spence-79c6bf/src/schemas/v3/overlays/baspi5.json +8180 -0
  62. package/busy-spence-79c6bf/src/schemas/v3/overlays/con29DW.json +716 -0
  63. package/busy-spence-79c6bf/src/schemas/v3/overlays/con29R.json +2981 -0
  64. package/busy-spence-79c6bf/src/schemas/v3/overlays/extensions/ac.json +334 -0
  65. package/busy-spence-79c6bf/src/schemas/v3/overlays/extensions/as.json +74 -0
  66. package/busy-spence-79c6bf/src/schemas/v3/overlays/extensions/dk.json +33 -0
  67. package/busy-spence-79c6bf/src/schemas/v3/overlays/extensions/dr.json +73 -0
  68. package/busy-spence-79c6bf/src/schemas/v3/overlays/extensions/er.json +85 -0
  69. package/busy-spence-79c6bf/src/schemas/v3/overlays/extensions/fd.json +75 -0
  70. package/busy-spence-79c6bf/src/schemas/v3/overlays/extensions/hi.json +51 -0
  71. package/busy-spence-79c6bf/src/schemas/v3/overlays/extensions/hs.json +73 -0
  72. package/busy-spence-79c6bf/src/schemas/v3/overlays/extensions/ic.json +94 -0
  73. package/busy-spence-79c6bf/src/schemas/v3/overlays/extensions/jk.json +96 -0
  74. package/busy-spence-79c6bf/src/schemas/v3/overlays/extensions/la.json +85 -0
  75. package/busy-spence-79c6bf/src/schemas/v3/overlays/extensions/lc.json +76 -0
  76. package/busy-spence-79c6bf/src/schemas/v3/overlays/extensions/ma.json +90 -0
  77. package/busy-spence-79c6bf/src/schemas/v3/overlays/extensions/mc.json +38 -0
  78. package/busy-spence-79c6bf/src/schemas/v3/overlays/extensions/mi.json +70 -0
  79. package/busy-spence-79c6bf/src/schemas/v3/overlays/extensions/nd.json +44 -0
  80. package/busy-spence-79c6bf/src/schemas/v3/overlays/extensions/oa.json +24 -0
  81. package/busy-spence-79c6bf/src/schemas/v3/overlays/extensions/oc.json +57 -0
  82. package/busy-spence-79c6bf/src/schemas/v3/overlays/extensions/pc.json +38 -0
  83. package/busy-spence-79c6bf/src/schemas/v3/overlays/extensions/ph.json +195 -0
  84. package/busy-spence-79c6bf/src/schemas/v3/overlays/extensions/rw.json +69 -0
  85. package/busy-spence-79c6bf/src/schemas/v3/overlays/extensions/sb.json +73 -0
  86. package/busy-spence-79c6bf/src/schemas/v3/overlays/extensions/sc.json +133 -0
  87. package/busy-spence-79c6bf/src/schemas/v3/overlays/extensions/sd.json +64 -0
  88. package/busy-spence-79c6bf/src/schemas/v3/overlays/extensions/sf.json +74 -0
  89. package/busy-spence-79c6bf/src/schemas/v3/overlays/extensions/sl.json +68 -0
  90. package/busy-spence-79c6bf/src/schemas/v3/overlays/extensions/ta.json +204 -0
  91. package/busy-spence-79c6bf/src/schemas/v3/overlays/extensions/tf.json +103 -0
  92. package/busy-spence-79c6bf/src/schemas/v3/overlays/extensions/tr.json +74 -0
  93. package/busy-spence-79c6bf/src/schemas/v3/overlays/extensions/wg.json +351 -0
  94. package/busy-spence-79c6bf/src/schemas/v3/overlays/fme1.json +1266 -0
  95. package/busy-spence-79c6bf/src/schemas/v3/overlays/llc1.json +25 -0
  96. package/busy-spence-79c6bf/src/schemas/v3/overlays/lpe1.json +2199 -0
  97. package/busy-spence-79c6bf/src/schemas/v3/overlays/nts.json +2159 -0
  98. package/busy-spence-79c6bf/src/schemas/v3/overlays/nts2.json +2744 -0
  99. package/busy-spence-79c6bf/src/schemas/v3/overlays/ntsl.json +1815 -0
  100. package/busy-spence-79c6bf/src/schemas/v3/overlays/ntsl2.json +2219 -0
  101. package/busy-spence-79c6bf/src/schemas/v3/overlays/oc1.json +2817 -0
  102. package/busy-spence-79c6bf/src/schemas/v3/overlays/piq.json +3324 -0
  103. package/busy-spence-79c6bf/src/schemas/v3/overlays/rds.json +3668 -0
  104. package/busy-spence-79c6bf/src/schemas/v3/overlays/sef25.json +1653 -0
  105. package/busy-spence-79c6bf/src/schemas/v3/overlays/sr24.json +38 -0
  106. package/busy-spence-79c6bf/src/schemas/v3/overlays/ta10.json +4645 -0
  107. package/busy-spence-79c6bf/src/schemas/v3/overlays/ta6.json +4572 -0
  108. package/busy-spence-79c6bf/src/schemas/v3/overlays/ta6ed6.json +6665 -0
  109. package/busy-spence-79c6bf/src/schemas/v3/overlays/ta7.json +1537 -0
  110. package/busy-spence-79c6bf/src/schemas/v3/overlays/ta7ed5.json +1585 -0
  111. package/busy-spence-79c6bf/src/schemas/v3/pdtf-transaction.json +41570 -0
  112. package/busy-spence-79c6bf/src/schemas/v3/skeleton.json +5767 -0
  113. package/busy-spence-79c6bf/src/schemas/verifiedClaims/README.md +21 -0
  114. package/busy-spence-79c6bf/src/schemas/verifiedClaims/pdtf-verified-claims.json +447 -0
  115. package/busy-spence-79c6bf/src/utils/compactSkeleton.js +84 -0
  116. package/busy-spence-79c6bf/src/utils/countTokens.js +67 -0
  117. package/busy-spence-79c6bf/src/utils/extractExtensionOverlays.js +633 -0
  118. package/busy-spence-79c6bf/src/utils/extractOverlay.js +381 -0
  119. package/busy-spence-79c6bf/src/utils/extractProperties.js +44 -0
  120. package/busy-spence-79c6bf/src/utils/listPathTitles.js +36 -0
  121. package/busy-spence-79c6bf/src/utils/minimalSkeleton.js +85 -0
  122. package/busy-spence-79c6bf/src/utils/pathList.csv +903 -0
  123. package/busy-spence-79c6bf/src/utils/pathSkeleton.js +181 -0
  124. package/busy-spence-79c6bf/ta6ed6-titles-plan.md +118 -0
  125. package/busy-spence-79c6bf/ta7ed5-titles-spec.md +89 -0
  126. package/package.json +1 -1
  127. package/src/schemas/v3/combined.json +225 -47
  128. package/src/schemas/v3/overlays/llc1.json +1 -2
  129. package/src/schemas/v3/overlays/ta6ed6.json +204 -75
  130. package/src/schemas/v3/overlays/ta7ed5.json +54 -20
@@ -0,0 +1,101 @@
1
+ # CLAUDE.md
2
+
3
+ This file provides guidance for AI coding agents when working with code in this repository.
4
+
5
+ ## Overview
6
+
7
+ This repository contains the Property Data Trust Framework (PDTF) schemas - JSON Schema-based definitions for digital residential property data exchange in England and Wales. The framework enables frictionless exchange of property data between software products and services.
8
+
9
+ ## Commands
10
+
11
+ ### Testing
12
+ ```bash
13
+ npm test # Run all tests
14
+ npm run test:watch # Run tests in watch mode
15
+ ```
16
+
17
+ ### Development
18
+ ```bash
19
+ npm install # Install dependencies
20
+ npm run extract-overlays # Regenerate v3 schemas and overlays from combined.json
21
+ npm run extract-extension-overlays # Regenerate v3 extension overlays from combined.json
22
+ npm run publish:dev # Publish the dev branch package to npm tag dev
23
+ npm run publish:next # Publish the next branch package to npm tag next
24
+ npm run publish:latest # Publish the main branch package to npm tag latest
25
+ ```
26
+
27
+ **Important**: `src/schemas/v3/combined.json` is the source of truth for v3 schema changes. Never edit generated schema artifacts directly; there are no exceptions. Utility/source files may be edited normally. After changing `combined.json`, always run both overlay extraction commands so derived files stay in sync.
28
+
29
+ ## Architecture
30
+
31
+ ### Schema System
32
+ The PDTF uses a flexible overlay system where a base transaction schema can be extended with form-specific overlays:
33
+
34
+ - **Base Schema**: Core transaction schema at `/src/schemas/v3/pdtf-transaction.json`
35
+ - **Overlays**: Form-specific extensions in `/src/schemas/v3/overlays/` (e.g., baspi5.json, ta6.json)
36
+ - **Merging**: Overlays are merged with the base schema using deepmerge with custom merge strategies
37
+ - **Generated Files**: `pdtf-transaction.json`, `skeleton.json`, `compactSkeleton.txt`, `src/schemas/v3/overlays/*.json`, and `src/schemas/v3/overlays/extensions/*.json` are generated from `combined.json`
38
+
39
+ ### Key Components
40
+
41
+ 1. **index.js**: Main module exposing schema utilities
42
+ - `getTransactionSchema(schemaId, overlays)`: Merges base schema with overlays
43
+ - `getValidator(schemaId, overlays)`: Returns AJV validator for schema
44
+ - `validateVerifiedClaims()`: Validates verified claims structure
45
+
46
+ 2. **Schema Versions**: Currently on v3, with v2 still supported
47
+ - Use `https://trust.propdata.org.uk/schemas/v3/pdtf-transaction.json` for v3
48
+
49
+ 3. **Overlay System**: Supports multiple UK property forms
50
+ - BASPI (v4 and v5)
51
+ - Law Society TA forms (TA6, TA7, TA10)
52
+ - NTS forms (2023 and 2025 versions)
53
+ - CON29R, PIQ, RDS, and others
54
+
55
+ ### Testing Approach
56
+ Tests in `/src/tests/` validate:
57
+ - Schema structure with different overlay combinations
58
+ - Path validation for nested properties
59
+ - Custom overlay merging
60
+ - Verified claims validation
61
+
62
+ Use existing test patterns when adding new tests.
63
+
64
+ ## Branch And Release Workflow
65
+
66
+ This repository publishes `@pdtf/schemas` through three branches and npm
67
+ dist-tags:
68
+
69
+ - `main` -> npm `latest`: stable PDTF releases for broad industry use.
70
+ - `next` -> npm `next`: tested capabilities proposed for the next managed PDTF
71
+ point release.
72
+ - `dev` -> npm `dev`: the unstable coal face for faster-moving integration work
73
+ and early adopters.
74
+
75
+ PRs may be merged into `dev` to prove out work before it is ready for the managed
76
+ release path. Once a `dev` PR has been tested and is suitable for standards
77
+ review, promote the same change into `next` via a focused PR. Do not treat `dev`
78
+ as the standard, and do not publish `dev` or `next` builds to npm `latest`.
79
+
80
+ Promotion is automatic by default: after a PR is merged into `dev`,
81
+ `.github/workflows/promote-dev-to-next.yml` creates a matching PR into `next` by
82
+ cherry-picking the merged dev PR. Add the `no-promote-next` label before merging
83
+ a dev PR only when it should stay out of the `next` review queue. Reviewers
84
+ should still inspect the promotion PR, resolve conflicts, and adjust
85
+ release/version metadata if needed before merging to `next`.
86
+
87
+ Each npm publish needs a unique semver version. Use `-dev.N` versions on `dev`,
88
+ prerelease versions on `next`, and normal release versions on `main`.
89
+
90
+ Consumer-specific compatibility profiles belong in the consuming application or
91
+ service unless the capability becomes generic PDTF package functionality.
92
+ Consumers should pin/hash supplied schemas and use their own target-profile
93
+ configuration for API calls and webhooks.
94
+
95
+ See `docs/branch-release-workflow.md` for the full workflow.
96
+
97
+ ## Important Notes
98
+
99
+ - All schemas use JSON Schema Draft 07
100
+ - The repository publishes to npm as `@pdtf/schemas`
101
+ - Overlays may contain fields from licensed forms (BASPI, PIQ, Law Society) - ensure compliance when rendering data
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 Property Data Trust Framework
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,435 @@
1
+ # PDTF Schemas
2
+
3
+ [![npm version](https://badge.fury.io/js/%40pdtf%2Fschemas.svg)](https://badge.fury.io/js/%40pdtf%2Fschemas)
4
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
5
+
6
+ The Property Data Trust Framework (PDTF) Schemas provide standardized JSON Schema definitions for digital residential property data exchange in England and Wales. This package enables frictionless property data exchange between software products and services while maintaining trusted information about data provenance.
7
+
8
+ ## Project Goals & Status
9
+
10
+ **Current Version:** 3.5.0 on `main` / npm `latest`.
11
+
12
+ Additional release channels are available for earlier adoption:
13
+
14
+ - `next` branch / npm `next`: tested capabilities proposed for the next PDTF release.
15
+ - `dev` branch / npm `dev`: fast-moving integration work for Moverly and other early adopters. This channel may include changes that are not yet accepted as PDTF standard capability.
16
+
17
+ This schema framework aims to support the [Home Buying and Selling Group](https://homebuyingandsellinggroup.co.uk) 'Property Pack' initiative, encompassing all requirements starting with the Buyers and Sellers Property Information set ([BASPI v4.0](https://homebuyingandsellinggroup.co.uk/baspi/)).
18
+
19
+ **Key Objectives:**
20
+
21
+ - 🏠 **Standardize** residential property data exchange across England and Wales
22
+ - 🔗 **Enable** frictionless data sharing between software products and services
23
+ - 🛡️ **Maintain** trusted information about data provenance and verification
24
+ - 📋 **Support** industry-standard forms (BASPI, NTS, Law Society TA forms)
25
+ - 🧩 **Provide** modular components for flexible implementation
26
+
27
+ **Related Projects:**
28
+
29
+ - [API Specifications](https://github.com/Property-Data-Trust-Framework/api) - OpenAPI specs for data exchange protocols
30
+ - [PDTF Website](https://trust.propdata.org.uk) - Official framework documentation
31
+
32
+ This repository is a living document, with schemas evolving as framework requirements are refined and extended. Semantic versioning ensures backward compatibility while enabling schema evolution.
33
+
34
+ ## Quick Start
35
+
36
+ ### Installation
37
+
38
+ ```bash
39
+ npm install @pdtf/schemas
40
+ ```
41
+
42
+ ### Basic Usage
43
+
44
+ ```javascript
45
+ const { getTransactionSchema, getValidator } = require("@pdtf/schemas");
46
+
47
+ // Get a schema with BASPI v5 overlay
48
+ const schema = getTransactionSchema(
49
+ "https://trust.propdata.org.uk/schemas/v3/pdtf-transaction.json",
50
+ ["baspiV5"]
51
+ );
52
+
53
+ // Create a validator
54
+ const validator = getValidator(
55
+ "https://trust.propdata.org.uk/schemas/v3/pdtf-transaction.json",
56
+ ["baspiV5"]
57
+ );
58
+
59
+ // Validate data
60
+ const isValid = validator(propertyData);
61
+ if (!isValid) {
62
+ console.log("Validation errors:", validator.errors);
63
+ }
64
+ ```
65
+
66
+ ## Features
67
+
68
+ - **🏗️ Modular Schema System** - Base schemas with flexible overlay composition
69
+ - **📋 Multiple Form Support** - BASPI, NTS, Law Society TA forms, and more
70
+ - **🧩 Extension Overlays** - Granular NTS2 and SEF25 features as individual modules
71
+ - **✅ JSON Schema Validation** - Full JSON Schema Draft 07 support with AJV
72
+ - **🔗 Verified Claims** - Support for verified data provenance tracking
73
+ - **📚 Comprehensive Documentation** - Detailed usage guides and examples
74
+
75
+ ## Package Structure
76
+
77
+ ```
78
+ @pdtf/schemas/
79
+ ├── src/
80
+ │ ├── schemas/
81
+ │ │ ├── v3/ # Current schema version
82
+ │ │ │ ├── pdtf-transaction.json # Base transaction schema
83
+ │ │ │ ├── overlays/ # Form-specific overlays
84
+ │ │ │ │ ├── baspi5.json # BASPI v5 overlay
85
+ │ │ │ │ ├── nts.json # National Trading Standards
86
+ │ │ │ │ ├── ta6.json # Law Society forms
87
+ │ │ │ │ └── extensions/ # Modular NTS2 extensions
88
+ │ │ │ │ ├── jk.json # Japanese Knotweed
89
+ │ │ │ │ ├── tf.json # Transfer Fees
90
+ │ │ │ │ └── ... # NTS2 + SEF25 extensions
91
+ │ │ │ └── combined.json # Master schema for generation
92
+ │ │ ├── v2/ # Legacy schema version
93
+ │ │ ├── verifiedClaims/ # Verified claims schemas
94
+ │ │ └── examples/ # Example data files
95
+ │ ├── tests/ # Jest test suite
96
+ │ └── utils/ # Build and extraction tools
97
+ ├── index.js # Main API entry point
98
+ └── package.json
99
+ ```
100
+
101
+ ## Core Concepts
102
+
103
+ ### Base Schema + Overlays
104
+
105
+ PDTF uses a **base transaction schema** combined with **overlays** to create form-specific schemas:
106
+
107
+ - **Base Schema**: Core property transaction structure
108
+ - **Overlays**: Form-specific fields, references, and validation rules
109
+ - **Extensions**: Modular components for selective feature adoption
110
+
111
+ ### Schema Versions
112
+
113
+ - **v3** (Current): Full feature set with extension support
114
+ - **v2** (Legacy): Maintained for backward compatibility
115
+
116
+ ## API Reference
117
+
118
+ ### Core Functions
119
+
120
+ #### `getTransactionSchema(schemaId, overlays)`
121
+
122
+ Creates a merged schema from base schema and overlays.
123
+
124
+ ```javascript
125
+ const schema = getTransactionSchema(
126
+ "https://trust.propdata.org.uk/schemas/v3/pdtf-transaction.json",
127
+ ["baspiV5", "ta6ed4"]
128
+ );
129
+ ```
130
+
131
+ **Parameters:**
132
+
133
+ - `schemaId` (string): Schema version URL
134
+ - `overlays` (array): Array of overlay names or objects
135
+
136
+ #### `getValidator(schemaId, overlays)`
137
+
138
+ Returns an AJV validator function for the specified schema combination.
139
+
140
+ ```javascript
141
+ const validator = getValidator(schemaId, ["baspiV5"]);
142
+ const isValid = validator(data);
143
+ ```
144
+
145
+ #### `validateVerifiedClaims(claims, schemaId, overlays)`
146
+
147
+ Validates verified claims against schema paths.
148
+
149
+ ```javascript
150
+ const errors = validateVerifiedClaims(verifiedClaims, schemaId, ["nts2023"]);
151
+ ```
152
+
153
+ ### Available Overlays
154
+
155
+ #### Main Form Overlays
156
+
157
+ | Overlay | Description | Version |
158
+ | --------- | --------------------------------------- | --------- |
159
+ | `baspiV4` | Buyers and Sellers Property Information | v4.0 |
160
+ | `baspiV5` | Buyers and Sellers Property Information | v5.0 |
161
+ | `nts2023` | National Trading Standards | 2023 |
162
+ | `nts2025` | National Trading Standards | 2025 |
163
+ | `ta6ed4` | Law Society Property Information Form | Edition 4 |
164
+ | `ta7ed3` | Law Society Leasehold Information Form | Edition 3 |
165
+ | `ta10ed3` | Law Society Fittings and Contents Form | Edition 3 |
166
+
167
+ [View all overlays →](src/schemas/v3/overlays/README.md)
168
+
169
+ #### Extension Overlays
170
+
171
+ Modular features for selective adoption. Extensions are merged on top of an NTS base overlay.
172
+
173
+ ```javascript
174
+ // NTS2 extensions
175
+ const schema = getTransactionSchema(schemaId, ["nts2023", "jk", "tf", "ma"]);
176
+
177
+ // SEF25 extensions (Seller Enquiry Form)
178
+ const sef25 = ["sc", "pc", "ph", "dk", "rw", "sd", "lc", "wg", "ic", "nd", "mi", "tr"];
179
+ const schema = getTransactionSchema(schemaId, ["nts2023", ...sef25]);
180
+ ```
181
+
182
+ **NTS2 Extensions:**
183
+
184
+ | Extension | Code | Description |
185
+ | --- | --- | --- |
186
+ | Japanese Knotweed | `jk` | Knotweed presence and management |
187
+ | Asbestos | `as` | Asbestos presence and management |
188
+ | Dry Rot | `dr` | Dry rot treatment |
189
+ | Subsidence | `sb` | Subsidence or structural fault |
190
+ | Health & Safety | `hs` | Ongoing health or safety issues |
191
+ | Outside Areas | `oa` | Outside areas details |
192
+ | Main Construction | `mc` | Construction type if standard form |
193
+ | Loft Access | `la` | Loft access and details |
194
+ | Spray Foam | `sf` | Spray foam insulation |
195
+ | Solar Panels | `sl` | Solar panel ownership details |
196
+ | Heating Installed | `hi` | Central heating installation date |
197
+ | Flood Defences | `fd` | Flood defence information |
198
+ | Estate Rentcharges | `er` | Estate rentcharges for freehold |
199
+ | Managing Agent | `ma` | Leasehold managing agent details |
200
+ | Transfer Fees | `tf` | Additional leasehold fees |
201
+ | Onward Chain | `oc` | Other property in chain |
202
+
203
+ **SEF25 Extensions (Seller Enquiry Form):**
204
+
205
+ | Extension | Code | Description |
206
+ | --- | --- | --- |
207
+ | Supply Costs | `sc` | Private water/sewerage costs |
208
+ | Parking Permit Cost | `pc` | Parking permit frequency |
209
+ | Property Hazards | `ph` | 4 hazard Yes/No questions |
210
+ | Dropped Kerb | `dk` | Dropped kerb access to parking |
211
+ | Private Right of Way | `rw` | Private right of way |
212
+ | Storm/Fire/Flood Damage | `sd` | Storm, fire or flood damage |
213
+ | Solar Lease Costs | `lc` | Solar panel lease costs |
214
+ | Warranties & Guarantees | `wg` | 7 warranty categories upfront |
215
+ | Insurance Claims | `ic` | Insurance claims upfront |
216
+ | Neighbour Development | `nd` | Neighbour development |
217
+ | Material Issue | `mi` | Other material issue upfront |
218
+ | Title Restrictions | `tr` | Title restrictions for freehold |
219
+
220
+ [View full SEF25 UI spec →](docs/sef25-extensions-ui-spec.md) | [View all extensions →](src/schemas/v3/overlays/README.md#extension-overlays)
221
+
222
+ ## Usage Examples
223
+
224
+ ### Form-Specific Schemas
225
+
226
+ ```javascript
227
+ // BASPI v5 for estate agents
228
+ const baspiSchema = getTransactionSchema(schemaId, ["baspiV5"]);
229
+
230
+ // Law Society conveyancing forms
231
+ const legalSchema = getTransactionSchema(schemaId, ["ta6ed4", "ta7ed3"]);
232
+
233
+ // National Trading Standards compliance
234
+ const ntsSchema = getTransactionSchema(schemaId, ["nts2023"]);
235
+ ```
236
+
237
+ ### Modular Extension Features
238
+
239
+ ```javascript
240
+ // Selective NTS2 adoption
241
+ const partialNts2 = getTransactionSchema(schemaId, [
242
+ "nts2023", // Base NTS
243
+ "jk", // Japanese Knotweed
244
+ "tf", // Transfer Fees
245
+ "ma", // Managing Agent
246
+ ]);
247
+
248
+ // SEF25 Seller Enquiry Form extensions
249
+ const sef25 = ["sc", "pc", "ph", "dk", "rw", "sd", "lc", "wg", "ic", "nd", "mi", "tr"];
250
+ const sellerEnquiry = getTransactionSchema(schemaId, ["nts2023", ...sef25]);
251
+ ```
252
+
253
+ ### Data Validation
254
+
255
+ ```javascript
256
+ const { getValidator } = require("@pdtf/schemas");
257
+
258
+ const validator = getValidator(schemaId, ["baspiV5"]);
259
+
260
+ const propertyData = {
261
+ propertyPack: {
262
+ priceInformation: {
263
+ price: 350000,
264
+ priceQualifier: "Freehold",
265
+ },
266
+ // ... more property data
267
+ },
268
+ };
269
+
270
+ if (validator(propertyData)) {
271
+ console.log("✅ Data is valid");
272
+ } else {
273
+ console.log("❌ Validation errors:", validator.errors);
274
+ }
275
+ ```
276
+
277
+ ### Verified Claims & Data Provenance
278
+
279
+ PDTF supports verified claims to maintain data provenance and trust throughout property transactions. Claims package specific property data with verification evidence, enabling traceability back to authoritative sources.
280
+
281
+ ```javascript
282
+ const { validateVerifiedClaims } = require("@pdtf/schemas");
283
+
284
+ // Current verified claims format
285
+ const verifiedClaims = [
286
+ {
287
+ id: "claim-12345",
288
+ transactionId: "txn-67890",
289
+ schemaVersion: "3.4.0",
290
+ verification: {
291
+ trust_framework: "uk_pdtf",
292
+ time: "2024-07-01T10:30:00Z",
293
+ evidence: [
294
+ {
295
+ type: "vouch",
296
+ attestation: {
297
+ type: "digital_attestation",
298
+ voucher: { name: "Estate Agent Ltd" },
299
+ },
300
+ verification_method: { type: "auth" },
301
+ },
302
+ ],
303
+ },
304
+ terms_of_use: {
305
+ confidentiality_level: "public",
306
+ },
307
+ claims: {
308
+ "/propertyPack/priceInformation/price": 350000,
309
+ "/propertyPack/energyEfficiency/epcRating": "C",
310
+ },
311
+ },
312
+ ];
313
+
314
+ // Validate claims against schema
315
+ const errors = validateVerifiedClaims(verifiedClaims, schemaId, ["baspiV5"]);
316
+ if (errors.length === 0) {
317
+ console.log("✅ Verified claims are valid");
318
+ }
319
+ ```
320
+
321
+ **Key Features:**
322
+
323
+ - **Schema Path Validation** - Claims reference specific schema paths (e.g., `/propertyPack/priceInformation/price`)
324
+ - **Provenance Tracking** - Each claim includes verification evidence and source attribution
325
+ - **Trust Framework Integration** - Claims operate within the UK PDTF trust framework
326
+ - **Attachment Support** - Supporting documents can be cryptographically linked to claims
327
+ - **Confidentiality Controls** - Terms of use define access levels and permitted recipients
328
+
329
+ #### Confidentiality Levels
330
+
331
+ Verified claims support three confidentiality levels through a pdtf-specific extension: a `terms_of_use` field, enabling fine-grained access control:
332
+
333
+ **Public Data** - Freely accessible data from official sources or public listing information:
334
+
335
+ ```javascript
336
+ {
337
+ terms_of_use: {
338
+ confidentiality_level: "public";
339
+ }
340
+ }
341
+ ```
342
+
343
+ Examples: Land Registry data, Energy Performance Certificates, planning records, council tax information
344
+
345
+ **Restricted Data** - Limited to transaction participants:
346
+
347
+ ```javascript
348
+ {
349
+ terms_of_use: {
350
+ confidentiality_level: "restricted";
351
+ }
352
+ }
353
+ ```
354
+
355
+ Examples: Commercial property reports, contents of legal forms
356
+
357
+ **Confidential Data** - Role-based access with explicit authorization:
358
+
359
+ ```javascript
360
+ {
361
+ terms_of_use: {
362
+ confidentiality_level: "confidential",
363
+ allowed_roles: [
364
+ "Estate Agent",
365
+ "Seller's Conveyancer",
366
+ "Buyer's Conveyancer",
367
+ "Mortgage Broker",
368
+ "Lender"
369
+ ]
370
+ }
371
+ }
372
+ ```
373
+
374
+ Examples: Identity verification reports, anti-money laundering checks, sensitive personal information
375
+
376
+ **Guidelines:**
377
+
378
+ - Use **public** for government/official data sources
379
+ - Use **restricted** for commercial data providers and processed information
380
+ - Use **confidential** for sensitive personal data requiring explicit role authorization
381
+ - Always consider data source and sensitivity when assigning levels
382
+
383
+ **Roadmap - W3C Verifiable Credentials:**
384
+ The next version of the PDTF framework will migrate to [W3C Verifiable Credentials](https://www.w3.org/TR/vc-data-model/) to provide:
385
+
386
+ - **Enhanced Security** - Cryptographically signed claims with tamper detection
387
+ - **Granular Permissions** - Fine-grained access control over claim data
388
+ - **Interoperability** - Standards-based approach for broader ecosystem compatibility
389
+ - **Selective Disclosure** - Share only necessary claim data for each transaction context
390
+
391
+ ## Development
392
+
393
+ ### Building Schemas
394
+
395
+ Schemas are generated from a master `combined.json` file:
396
+
397
+ ```bash
398
+ # Extract overlays and base schema
399
+ node src/utils/extractOverlay.js
400
+
401
+ # Generate extension overlays
402
+ node src/utils/extractExtensionOverlays.js
403
+ ```
404
+
405
+ ### Testing
406
+
407
+ ```bash
408
+ # Run all tests
409
+ npm test
410
+
411
+ # Test specific functionality
412
+ npm test -- --testPathPattern=extensionOverlays
413
+ npm test -- --testPathPattern=transactionSchema
414
+ ```
415
+
416
+ ## Versioning
417
+
418
+ The schema follows semantic versioning:
419
+
420
+ - **Patch** (3.4.x): Bug fixes, no breaking changes
421
+ - **Minor** (3.x.0): New fields, backward compatible
422
+ - **Major** (x.0.0): Breaking changes, migration required
423
+
424
+ ## Licensing
425
+
426
+ Licensed under the [MIT License](https://opensource.org/licenses/MIT).
427
+
428
+ **Important:** Overlays contain fields from licensed forms ([BASPI](https://homebuyingsellingcouncil.co.uk/wp-content/uploads/2021/03/Terms-of-Licence-mandatory-download-for-use-of-BASPI.pdf), [PIQ](https://www.propertymark.co.uk/static/14e7c154-98de-4230-957f09bd8d5ddeec/f542b10a-7710-4c37-b3958ccaeec25d4b/property-information-questionnaire-residential-sales.pdf), [Law Society TA](https://www.lawsociety.org.uk/topics/property/transaction-forms)). When rendering data into these forms, ensure compliance with their respective license terms.
429
+
430
+ ## Support
431
+
432
+ - 📖 [Overlay Documentation](src/schemas/v3/overlays/README.md)
433
+ - 📁 [Example Files](src/examples/)
434
+ - 🐛 [Issue Tracker](https://github.com/Property-Data-Trust-Framework/schemas/issues)
435
+ - 🌐 [PDTF Website](https://trust.propdata.org.uk)
@@ -0,0 +1,138 @@
1
+ # Branch And Release Workflow
2
+
3
+ This repository uses three long-lived release channels for `@pdtf/schemas`.
4
+
5
+ ## Branches And npm Tags
6
+
7
+ | Branch | npm dist-tag | Purpose |
8
+ | --- | --- | --- |
9
+ | `main` | `latest` | Stable PDTF releases for broad industry use. |
10
+ | `next` | `next` | Tested capabilities intended for the next managed PDTF point release. |
11
+ | `dev` | `dev` | Unstable coal face for faster-moving integration work and early adopters. |
12
+
13
+ `dev` is not the standard. It is a proving ground for changes that may later be
14
+ promoted to `next` through focused PRs. Consumers who need the stable standard
15
+ should use `@pdtf/schemas` from `latest`/`main`.
16
+
17
+ ## Versioning
18
+
19
+ Every npm publish must have a unique semver version.
20
+
21
+ - `main` publishes normal release versions, for example `3.5.0`, on `latest`.
22
+ - `next` publishes prerelease versions on the `next` tag.
23
+ - `dev` publishes prerelease versions on the `dev` tag, using a `-dev.N`
24
+ suffix, for example `3.6.0-dev.0`.
25
+
26
+ Do not publish `dev` or `next` builds to `latest`.
27
+
28
+ ## Dev Fast-Path Workflow
29
+
30
+ Use this workflow when work needs to move faster than the managed PDTF release
31
+ cycle, or when a change needs practical integration testing before it is proposed
32
+ for the standards-track path.
33
+
34
+ 1. Open a PR against `dev`.
35
+ 2. Treat `dev` as the unstable coal face. Keep the change reviewable and, where
36
+ possible, structured so that accepted parts can later be promoted to `next`.
37
+ 3. Change `src/schemas/v3/combined.json` for schema changes, then run both
38
+ extraction scripts:
39
+
40
+ ```bash
41
+ npm run extract-overlays
42
+ npm run extract-extension-overlays
43
+ ```
44
+
45
+ 4. Add or update tests for schema, overlay, path-validation, and utility
46
+ behaviour.
47
+ 5. Bump the package version to the next unique `-dev.N` version if the PR will
48
+ be published from `dev`.
49
+ 6. If the change should not enter the `next` review queue after it has landed in
50
+ `dev`, add the `no-promote-next` label before merging.
51
+ 7. Merge to `dev`.
52
+ 8. If publishing the dev channel, publish from `dev`:
53
+
54
+ ```bash
55
+ npm run publish:dev
56
+ ```
57
+
58
+ 9. Consumers can use `@pdtf/schemas@dev`, or pin the exact dev version in
59
+ lockfiles when deterministic rollout is required.
60
+
61
+ ## Automated Promotion To next
62
+
63
+ The `.github/workflows/promote-dev-to-next.yml` workflow can open the matching
64
+ `next` PR automatically.
65
+
66
+ Trigger:
67
+
68
+ - A PR is merged into `dev`.
69
+ - The merged PR does not have the `no-promote-next` label.
70
+
71
+ Behaviour:
72
+
73
+ 1. Check out `next`.
74
+ 2. Create a branch named `promote/dev-pr-<number>-to-next`.
75
+ 3. Cherry-pick the merged dev PR's effective diff onto that branch.
76
+ 4. Open a PR into `next` with a title and body referencing the original dev PR.
77
+
78
+ If the cherry-pick conflicts, the workflow creates an issue instead of a PR so a
79
+ maintainer can promote the change manually.
80
+
81
+ The promotion PR is intentionally still reviewed. Before merging to `next`,
82
+ maintainers should:
83
+
84
+ - confirm the change is appropriate for the managed release path;
85
+ - remove any dev-only scaffolding;
86
+ - adjust package version metadata from `-dev.N` to the correct `next`
87
+ prerelease version where needed;
88
+ - run tests and schema extraction checks.
89
+
90
+ ## Manual Promotion To next
91
+
92
+ If automation is not used, or if the automated cherry-pick conflicts:
93
+
94
+ 1. Branch from `next`.
95
+ 2. Cherry-pick the merged dev PR commit or recreate the focused diff.
96
+ 3. Remove dev-only changes.
97
+ 4. Bump to the next unique `next` prerelease version if the PR will be published
98
+ from `next`.
99
+ 5. Open a PR into `next` that links back to the original dev PR.
100
+ 6. Merge to `next` after review.
101
+ 7. Publish from `next`:
102
+
103
+ ```bash
104
+ npm run publish:next
105
+ ```
106
+
107
+ The `next` channel should remain tested and coherent. It can be ahead of
108
+ `main`, but it should not contain unrelated experimental work merely because it
109
+ exists on `dev`.
110
+
111
+ ## Promotion To main
112
+
113
+ When the PDTF point-release cycle is ready:
114
+
115
+ 1. Select accepted `next` changes for the point release.
116
+ 2. Merge or cherry-pick the accepted changes into `main`.
117
+ 3. Bump to the release version, for example `3.6.0`.
118
+ 4. Publish from `main`:
119
+
120
+ ```bash
121
+ npm run publish:latest
122
+ ```
123
+
124
+ Long-running `dev` work should not be merged wholesale into `main` unless the
125
+ full contents have been reviewed and accepted for the PDTF release.
126
+
127
+ ## Consumer Compatibility Profiles
128
+
129
+ Consumer-specific compatibility profiles are owned by the consuming application
130
+ or service unless and until they become a reusable PDTF capability.
131
+
132
+ Consumers may pin exact supplied schemas, hash them, and filter outbound API
133
+ calls or webhooks accordingly. That code should not be added to this schema
134
+ package unless the capability is generic and appropriate for PDTF consumers.
135
+
136
+ If a consumer later supports an official PDTF release, its target profile should
137
+ move from the consumer-specific schema to the relevant published
138
+ `@pdtf/schemas` release or prerelease.