@pdtf/schemas 0.6.15 → 0.7.2

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.
package/index.js CHANGED
@@ -3,18 +3,18 @@ const Ajv = require("ajv");
3
3
  const addFormats = require("ajv-formats");
4
4
 
5
5
  const pdtfTransaction = require("./src/schemas/pdtf-transaction.json");
6
- const baspiMaterialFacts = require("./src/schemas/baspi-a-material-facts.json");
7
- const baspiLegalInformation = require("./src/schemas/baspi-b-legal-information.json");
6
+ const materialFacts = require("./src/schemas/material-facts.json");
7
+ const legalInformation = require("./src/schemas/legal-information.json");
8
8
  const energyPerformanceCertificate = require("./src/schemas/energy-performance-certificate.json");
9
9
  const titleDeed = require("./src/schemas/title-deed.json");
10
10
  const geoJson = require("./src/schemas/GeoJSON.json");
11
11
  const verifiedClaimsSchema = require("./src/schemas/pdtf-verified-claims.json");
12
12
 
13
13
  const subSchemas = {
14
- "https://raw.githubusercontent.com/Property-Data-Trust-Framework/schemas/master/src/schemas/baspi-a-material-facts.json":
15
- baspiMaterialFacts,
16
- "https://raw.githubusercontent.com/Property-Data-Trust-Framework/schemas/master/src/schemas/baspi-b-legal-information.json":
17
- baspiLegalInformation,
14
+ "https://raw.githubusercontent.com/Property-Data-Trust-Framework/schemas/master/src/schemas/material-facts.json":
15
+ materialFacts,
16
+ "https://raw.githubusercontent.com/Property-Data-Trust-Framework/schemas/master/src/schemas/legal-information.json":
17
+ legalInformation,
18
18
  "https://raw.githubusercontent.com/Property-Data-Trust-Framework/schemas/master/src/schemas/energy-performance-certificate.json":
19
19
  energyPerformanceCertificate,
20
20
  "https://geojson.org/schema/GeoJSON.json": geoJson,
@@ -39,6 +39,7 @@ const getSubschema = (path) => {
39
39
  if (pathArray.length < 1) {
40
40
  return transactionSchema;
41
41
  }
42
+
42
43
  return pathArray.reduce((schema, pathElement) => {
43
44
  if (schema.type === "array") return schema.items;
44
45
  if (schema.properties[pathElement]) return schema.properties[pathElement];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pdtf/schemas",
3
- "version": "0.6.15",
3
+ "version": "0.7.2",
4
4
  "description": "Property Data Trust Framework Schemas and Utilities",
5
5
  "main": "index.js",
6
6
  "directories": {
@@ -82,12 +82,10 @@
82
82
  "yesNo": "Yes"
83
83
  },
84
84
  "listedBuildingConsent": {
85
- "yesNo": "Not required",
86
- "reasons": "Not listed building\n"
85
+ "yesNo": "Not required"
87
86
  },
88
87
  "deedRestrictionConsent": {
89
- "yesNo": "Not required",
90
- "reasons": "Retrospective consent obtained from leasehold provider but property now freehold"
88
+ "yesNo": "Not required"
91
89
  },
92
90
  "unfinished": {
93
91
  "yesNo": "No"
@@ -97,20 +95,16 @@
97
95
  },
98
96
  "windowReplacementsSince2002": {
99
97
  "buildingRegApproval": {
100
- "yesNo": "Not required",
101
- "reasons": "Not required"
98
+ "yesNo": "Not required"
102
99
  },
103
100
  "planningPermission": {
104
- "yesNo": "Not required",
105
- "reasons": "Not required"
101
+ "yesNo": "Not required"
106
102
  },
107
103
  "listedBuildingConsent": {
108
- "yesNo": "Not required",
109
- "reasons": "Not listed building"
104
+ "yesNo": "Not required"
110
105
  },
111
106
  "deedRestrictionConsent": {
112
- "yesNo": "Not required",
113
- "reasons": "None required"
107
+ "yesNo": "Not required"
114
108
  },
115
109
  "unfinished": {
116
110
  "yesNo": "No"
@@ -120,20 +114,17 @@
120
114
  },
121
115
  "hasAddedConservatory": {
122
116
  "buildingRegApproval": {
123
- "yesNo": "Not required",
124
- "reasons": "Added as part of initial build"
117
+ "yesNo": "Not required"
125
118
  },
126
119
  "planningPermission": {
127
- "yesNo": "Not required",
128
- "reasons": "Added as part of initial build"
120
+ "yesNo": "Not required"
129
121
  },
130
122
  "listedBuildingConsent": {
131
- "yesNo": "Not required",
132
- "reasons": "Not listed building"
123
+ "yesNo": "Not required"
133
124
  },
134
125
  "deedRestrictionConsent": {
135
- "yesNo": "Not required",
136
- "reasons": "Added as part of initial build and deeds"
126
+ "yesNo": "No",
127
+ "details": "Added as part of initial build and deeds"
137
128
  },
138
129
  "unfinished": {
139
130
  "yesNo": "No"
@@ -212,11 +203,21 @@
212
203
  "yesNo": "Yes"
213
204
  },
214
205
  "mainsFoulDrainage": {
215
- "maintenanceAgreements": {
216
- "yesNo": "No"
206
+ "yesNo": "No",
207
+ "sustainableDrainageSystem": { "yesNo": "No" },
208
+ "septicTank": {
209
+ "yesNo": "Yes",
210
+ "details": "Last emptied on 1 Jan 2022"
217
211
  },
218
- "yesNo": "Yes",
219
- "supplier": "Northumbria Water"
212
+ "cesspit": { "yesNo": "No" },
213
+ "sewerageTreatmentPlant": { "yesNo": "No" },
214
+ "otherConnectedProperties": { "yesNo": "No" },
215
+ "plantOnOtherLand": { "yesNo": "No" },
216
+ "plantRegistered": { "yesNo": "No" },
217
+ "plantDrainsIntoWaterway": {
218
+ "yesNo": "Yes",
219
+ "dischargeCompliesWithGBR": "Yes"
220
+ }
220
221
  }
221
222
  },
222
223
  "utilities": {
@@ -283,7 +284,7 @@
283
284
  "heatingInGoodWorkingOrder": {
284
285
  "yesNo": "Yes"
285
286
  },
286
- "centralHeatingFuel": "Gas boiler",
287
+ "centralHeatingFuel": { "centralHeatingFuelType": "Gas" },
287
288
  "centralHeatingInstalled": "2016-04-20",
288
289
  "heatingLastServiced": "2021-03-26"
289
290
  }
@@ -325,7 +326,7 @@
325
326
  "publicRightOfWay": {
326
327
  "yesNo": "No"
327
328
  },
328
- "rightsofLightOrSupport": {
329
+ "rightsOfLightOrSupport": {
329
330
  "yesNo": "No"
330
331
  },
331
332
  "rightsCreatedThroughCustom": {
@@ -357,8 +358,7 @@
357
358
  },
358
359
  "failedTransactionsInLast12Months": {
359
360
  "yesNo": "No"
360
- },
361
- "comments": "Not applicable"
361
+ }
362
362
  },
363
363
  "additionalInformation": {
364
364
  "restrictionsOnUseNotCompliedWith": {
@@ -379,14 +379,6 @@
379
379
  "lastName": "Hetherington-Smythe"
380
380
  }
381
381
  ],
382
- "sellersConveyancer": {
383
- "firstName": "John",
384
- "lastName": "Lawson",
385
- "address": { "line1": "66 Railway Ave", "postcode": "SL12 1AA" },
386
- "email": "john@bodgit.co.uk",
387
- "organisation": "Bodgit, Leggit and Run Partners",
388
- "reference": "12345"
389
- },
390
382
  "sellersCapacity": { "capacity": "Legal Owner" },
391
383
  "legalBoundaries": {
392
384
  "left": "Seller",
@@ -0,0 +1,198 @@
1
+ const PROPERTY_TYPES = {
2
+ 0: "Not Specified",
3
+ 1: "Terraced House",
4
+ 2: "End of terrace house",
5
+ 3: "Semi-detached house",
6
+ 4: "Detached house",
7
+ 5: "Mews house",
8
+ 6: "Cluster house",
9
+ 7: "Ground floor flat",
10
+ 8: "Flat",
11
+ 9: "Studio flat",
12
+ 10: "Ground floor maisonette",
13
+ 11: "Maisonette",
14
+ 12: "Bungalow",
15
+ 13: "Terraced bungalow",
16
+ 14: "Semi-detached bungalow",
17
+ 15: "Detached bungalow",
18
+ 16: "Mobile home",
19
+ 20: "Land (Residential)",
20
+ 21: "Link detached house",
21
+ 22: "Town house",
22
+ 23: "Cottage",
23
+ 24: "Chalet",
24
+ 25: "Character Property",
25
+ 26: "House (unspecified)",
26
+ 27: "Villa",
27
+ 28: "Apartment",
28
+ 29: "Penthouse",
29
+ 30: "Finca",
30
+ 43: "Barn Conversion",
31
+ 44: "Serviced apartment",
32
+ 45: "Parking",
33
+ 46: "Sheltered Housing",
34
+ 47: "Reteirment property",
35
+ 48: "House share",
36
+ 49: "Flat share",
37
+ 50: "Park home",
38
+ 51: "Garages",
39
+ 52: "Farm House",
40
+ 53: "Equestrian facility",
41
+ 56: "Duplex",
42
+ 59: "Triplex",
43
+ 62: "Longere",
44
+ 65: "Gite",
45
+ 68: "Barn",
46
+ 71: "Trulli",
47
+ 74: "Mill",
48
+ 77: "Ruins",
49
+ 80: "Restaurant",
50
+ 83: "Cafe",
51
+ 86: "Mill",
52
+ 92: "Castle",
53
+ 95: "Village House",
54
+ 101: "Cave House",
55
+ 104: "Cortijo",
56
+ 107: "Farm Land",
57
+ 110: "Plot",
58
+ 113: "Country House",
59
+ 116: "Stone House",
60
+ 117: "Caravan",
61
+ 118: "Lodge",
62
+ 119: "Log Cabin",
63
+ 120: "Manor House",
64
+ 121: "Stately Home",
65
+ 125: "Off-Plan",
66
+ 128: "Semi-detached Villa",
67
+ 131: "Detached Villa",
68
+ 134: "Bar/Nightclub",
69
+ 137: "Shop",
70
+ 140: "Riad",
71
+ 141: "House Boat",
72
+ 142: "Hotel Room",
73
+ 143: "Block of Apartments",
74
+ 144: "Private Halls",
75
+ 178: "Office",
76
+ 181: "Business Park",
77
+ 184: "Serviced Office",
78
+ 187: "Retail Property (High Street)",
79
+ 190: "Retail Property (Out of Town)",
80
+ 193: "Convenience Store",
81
+ 196: "Garages",
82
+ 199: "Hairdresser/Barber Shop",
83
+ 202: "Hotel",
84
+ 205: "Petrol Station",
85
+ 208: "Post Office",
86
+ 211: "Pub",
87
+ 214: "Workshop & Retail Space",
88
+ 217: "Distribution Warehouse",
89
+ 220: "Factory",
90
+ 223: "Heavy Industrial",
91
+ 226: "Industrial Park",
92
+ 229: "Light Industrial",
93
+ 232: "Storage",
94
+ 235: "Showroom",
95
+ 238: "Warehouse",
96
+ 241: "Land (Commercial)",
97
+ 244: "Commercial Development",
98
+ 247: "Industrial Development",
99
+ 250: "Residential Development",
100
+ 253: "Commercial Property",
101
+ 256: "Data Centre",
102
+ 259: "Farm",
103
+ 262: "Healthcare Facility",
104
+ 265: "Marine Property",
105
+ 268: "Mixed Use",
106
+ 271: "Research & Development Facility",
107
+ 274: "Science Park",
108
+ 277: "Guest House",
109
+ 280: "Hospitality",
110
+ 283: "Leisure Facility",
111
+ 298: "Takeaway",
112
+ 301: "Childcare Facility",
113
+ 304: "Smallholding",
114
+ 307: "Place of Worship",
115
+ 310: "Trade Counter",
116
+ 511: "Coach House",
117
+ 512: "House of Multiple Occupation",
118
+ 535: "Sports facilities",
119
+ 538: "Spa",
120
+ 541: "Campsite & Holiday Village",
121
+ };
122
+
123
+ const PRICE_QUALIFIER_TYPES = {
124
+ 0: "Default",
125
+ 1: "POA",
126
+ 2: "Guide Price",
127
+ 3: "Fixed Price",
128
+ 4: "Offers in excess of",
129
+ 5: "OIRO",
130
+ 6: "Sale by Tender",
131
+ 7: "From",
132
+ 9: "Shared Ownership",
133
+ 10: "Offers over",
134
+ 11: "Part Buy, Part Rent",
135
+ 12: "Shared Equity",
136
+ 15: "Offers Invited",
137
+ 16: "Coming Soon",
138
+ };
139
+
140
+ const TENURE_TYPES = {
141
+ 1: "Freehold",
142
+ 2: "Leasehold",
143
+ 3: "Feudal",
144
+ 4: "Commonhold",
145
+ 5: "Share of Freehold",
146
+ };
147
+
148
+ const FREQUENCY_TYPES = {
149
+ 1: "Yearly",
150
+ 4: "Quarterly",
151
+ 12: "Monthly",
152
+ 52: "Weekly",
153
+ 365: "Daily",
154
+ };
155
+
156
+ export const adfProperty = (pdtfTransaction) => {
157
+ const materialFacts = pdtfTransaction.propertyPack?.materialFacts;
158
+ return {
159
+ property_type:
160
+ Object.keys(PROPERTY_TYPES).find(
161
+ (key) => PROPERTY_TYPES(key) === materialFacts?.propertyType
162
+ ) || 0,
163
+ new_home: materialFacts?.isNewBuild,
164
+ address: {
165
+ house_name_number: materialFacts?.address?.line1,
166
+ address_2: materialFacts?.address?.line2,
167
+ town: materialFacts?.address?.town,
168
+ postcode_1: materialFacts?.address?.postcode.split(" ")[0],
169
+ postcode_2: materialFacts?.address?.postcode.split(" ")[1],
170
+ display_address: materialFacts?.address?.line1,
171
+ latitude: materialFacts?.location?.latitude,
172
+ longitude: materialFacts?.location?.longitude,
173
+ },
174
+ price_information: {
175
+ price: materialFacts?.price_information?.price,
176
+ price_qualifier: materialFacts?.price_information?.priceQualifier,
177
+ },
178
+ };
179
+ };
180
+
181
+ export const pdtfClaims = (adfProperty) => {
182
+ return {
183
+ "/propertyPack/materialFacts/address": {
184
+ line1: adfProperty?.address?.house_name_number,
185
+ line2: adfProperty?.address?.line2,
186
+ town: adfProperty?.address?.town,
187
+ postcode: `${adfProperty?.address?.postcode_1} ${adfProperty?.address?.postcode_2}`,
188
+ },
189
+ "/propertyPack/materialFacts/location": {
190
+ latitude: adfProperty?.address?.latitude,
191
+ longitude: adfProperty?.address?.longitude,
192
+ },
193
+ "/propertyPack/materialFacts/priceInformation": {
194
+ price: adfProperty?.price_information?.price,
195
+ priceQualifier: adfProperty?.price_information?.price_qualifier,
196
+ },
197
+ };
198
+ };
@@ -7,7 +7,6 @@
7
7
  "baspiRef": "B",
8
8
  "required": [
9
9
  "namesOfLegalOwners",
10
- "sellersConveyancer",
11
10
  "sellersCapacity",
12
11
  "legalBoundaries",
13
12
  "servicesCrossing",
@@ -33,7 +32,8 @@
33
32
  "firstName": {
34
33
  "baspiRef": "B1.1.1",
35
34
  "title": "First name",
36
- "type": "string"
35
+ "type": "string",
36
+ "minLength": 1
37
37
  },
38
38
  "middleNames": {
39
39
  "baspiRef": "B1.1.2",
@@ -43,53 +43,12 @@
43
43
  "lastName": {
44
44
  "baspiRef": "B1.1.3",
45
45
  "title": "Last name",
46
- "type": "string"
46
+ "type": "string",
47
+ "minLength": 1
47
48
  }
48
49
  }
49
50
  }
50
51
  },
51
- "sellersConveyancer": {
52
- "baspiRef": "B1.2",
53
- "RDSRef": "Participants/description=?,Participants/ActingFor/Participants/Role",
54
- "title": "Sellers Conveyancer",
55
- "type": "object",
56
- "required": [
57
- "firstName",
58
- "lastName",
59
- "address",
60
- "email",
61
- "organisation",
62
- "reference"
63
- ],
64
- "properties": {
65
- "firstName": {
66
- "title": "First name",
67
- "type": "string"
68
- },
69
- "lastName": {
70
- "title": "Last name",
71
- "type": "string"
72
- },
73
- "email": {
74
- "title": "Email address",
75
- "type": "string",
76
- "format": "email"
77
- },
78
- "organisation": {
79
- "title": "Organisation",
80
- "type": "string"
81
- },
82
- "address": {
83
- "title": "Address",
84
- "$ref": "#/$defs/address"
85
- },
86
-
87
- "reference": {
88
- "title": "Reference",
89
- "type": "string"
90
- }
91
- }
92
- },
93
52
  "sellersCapacity": {
94
53
  "baspiRef": "B1.3",
95
54
  "RDSRef": "Participants/description=?,Participants/ActingFor/Participants/Role",
@@ -106,7 +65,7 @@
106
65
  "Personal Representative for a Deceased Owner",
107
66
  "Under Power of Attorney",
108
67
  "Mortgagee in Possession",
109
- "Other (please give details)"
68
+ "Other"
110
69
  ]
111
70
  }
112
71
  },
@@ -118,7 +77,8 @@
118
77
  "capacity": {
119
78
  "enum": ["Legal Owner", "Mortgagee in Possession"]
120
79
  }
121
- }
80
+ },
81
+ "additionalProperties": false
122
82
  },
123
83
  {
124
84
  "properties": {
@@ -126,17 +86,17 @@
126
86
  "enum": [
127
87
  "Personal Representative for a Deceased Owner",
128
88
  "Under Power of Attorney",
129
- "Other (please give details)"
89
+ "Other"
130
90
  ]
131
91
  },
132
- "probateOrPowerOfAttorney": {
92
+ "sellersCapacityDetails": {
133
93
  "baspiRef": "B1.4",
134
94
  "RDSRef": "Participants/OtherDocumentation",
135
- "title": "Please provide details.",
95
+ "title": "Please provide details and provide any probate, grant of representation or power of attorney ",
136
96
  "type": "string"
137
97
  }
138
98
  },
139
- "required": ["probateOrPowerOfAttorney"]
99
+ "required": ["sellersCapacityDetails"]
140
100
  }
141
101
  ]
142
102
  }
@@ -301,6 +261,7 @@
301
261
  "enum": ["Yes", "No"]
302
262
  }
303
263
  },
264
+ "required": ["hasSolarPanels"],
304
265
  "dependencies": {
305
266
  "hasSolarPanels": {
306
267
  "oneOf": [
@@ -309,7 +270,8 @@
309
270
  "hasSolarPanels": {
310
271
  "enum": ["No"]
311
272
  }
312
- }
273
+ },
274
+ "additionalProperties": false
313
275
  },
314
276
  {
315
277
  "properties": {
@@ -347,7 +309,7 @@
347
309
  "baspiRef": "B4.3.5",
348
310
  "RDSRef": "Objects/isNotWorking=yes|no|true|false",
349
311
  "title": "Is the system in good working order to your satisfaction?",
350
- "$ref": "#/$defs/yesNoDetailIfYes"
312
+ "$ref": "#/$defs/yesNoDetailIfNo"
351
313
  },
352
314
  "isConnectedToNationalGrid": {
353
315
  "baspiRef": "B4.3.6",
@@ -356,7 +318,15 @@
356
318
  "type": "string",
357
319
  "enum": ["Yes (FiT)", "Yes (SEG)", "No"]
358
320
  }
359
- }
321
+ },
322
+ "required": [
323
+ "yearInstalled",
324
+ "panelsOwnedOutright",
325
+ "panelProviderLease",
326
+ "lastMaintained",
327
+ "inGoodWorkingOrder",
328
+ "isConnectedToNationalGrid"
329
+ ]
360
330
  }
361
331
  ]
362
332
  }
@@ -598,7 +568,6 @@
598
568
  "type": "object",
599
569
  "required": [
600
570
  "sellerLivesAtProperty",
601
- "otherOver17sAtProperty",
602
571
  "over17sWillSignToConfirmWillVacate"
603
572
  ],
604
573
  "properties": {
@@ -628,7 +597,7 @@
628
597
  "type": "string"
629
598
  },
630
599
  "lastName": {
631
- "title": "LastName",
600
+ "title": "Last Name",
632
601
  "type": "string",
633
602
  "minLength": 1
634
603
  },
@@ -722,8 +691,8 @@
722
691
  "baspiRef": "B7.3",
723
692
  "RDSRef": "RightsHolders/Text",
724
693
  "lawSocietyRef": "TA6/14.2",
725
- "title": "Are there any dates on which you cannot move? [Note: The moving date will not be fixed until contracts are exchanged i.e. have become binding. Until then you should only make provisional removal arrangements.]",
726
- "description": "If yes, please give details of dates on which the seller cannot complete/move [Note: you do not need to be physically present on the day of Completion so long as the property is cleared]. Note: Timescales to completion vary depending on the complexity of the transaction, length of the chain and requirements of the people involved.",
694
+ "title": "Are there any dates on which you cannot move? ",
695
+ "description": "If yes, please provide the dates. Note that: the moving date will not be fixed until contracts are exchanged i.e. have become binding, until then you should only make provisional removal arrangements; you do not need to be physically present on the day of completion so long as the property is cleared; timescales to completion vary depending on the complexity of the transaction, length of the chain and requirements of the people involved.",
727
696
  "type": "object",
728
697
  "properties": {
729
698
  "yesNo": {
@@ -963,7 +932,8 @@
963
932
  "properties": {
964
933
  "line1": {
965
934
  "title": "Address 1",
966
- "type": "string"
935
+ "type": "string",
936
+ "minLength": 1
967
937
  },
968
938
  "line2": {
969
939
  "title": "Address 2",
@@ -979,7 +949,8 @@
979
949
  },
980
950
  "postcode": {
981
951
  "title": "Postcode",
982
- "type": "string"
952
+ "type": "string",
953
+ "minLength": 1
983
954
  }
984
955
  },
985
956
  "required": ["line1", "postcode"]