@pdtf/schemas 0.7.0 → 0.7.3
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 +7 -6
- package/package.json +1 -1
- package/src/examples/exampleAddParticipantVouch.json +32 -0
- package/src/examples/exampleDocumentedVouch.json +2 -1
- package/src/mappings/adf.js +198 -0
- package/src/schemas/{baspi-b-legal-information.json → legal-information.json} +18 -10
- package/src/schemas/{baspi-a-material-facts.json → material-facts.json} +434 -140
- package/src/schemas/pdtf-transaction.json +2 -2
- package/src/schemas/pdtf-verified-claims.json +7 -11
- package/src/tests/pdtfVerifiedClaims.test.js +9 -9
- package/src/tests/transactionSchema.test.js +4 -4
- package/src/tests/verifiedClaimsValidator.test.js +5 -5
- package/src/schemas/verified_claims-12.json +0 -621
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
|
|
7
|
-
const
|
|
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/
|
|
15
|
-
|
|
16
|
-
"https://raw.githubusercontent.com/Property-Data-Trust-Framework/schemas/master/src/schemas/
|
|
17
|
-
|
|
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
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
{
|
|
2
|
+
"verification": {
|
|
3
|
+
"trust_framework": "uk_pdtf",
|
|
4
|
+
"time": "2022-01-25T13:05:03.108Z",
|
|
5
|
+
"evidence": [
|
|
6
|
+
{
|
|
7
|
+
"type": "vouch",
|
|
8
|
+
"attestation": {
|
|
9
|
+
"type": "digital_attestation",
|
|
10
|
+
"voucher": {
|
|
11
|
+
"name": "Martin Abode"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"verification_method": {
|
|
15
|
+
"type": "auth"
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
]
|
|
19
|
+
},
|
|
20
|
+
"claims": {
|
|
21
|
+
"/participants/-": {
|
|
22
|
+
"name": {
|
|
23
|
+
"firstName": "Martin",
|
|
24
|
+
"lastName": "Abode"
|
|
25
|
+
},
|
|
26
|
+
"email": "martin@abode.co.uk",
|
|
27
|
+
"organisation": "Abode and Floggit Estate Agents",
|
|
28
|
+
"organisationReference": "MAR/12243/22",
|
|
29
|
+
"role": "Estate Agent"
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -12,7 +12,8 @@
|
|
|
12
12
|
"value": "randomHashValue"
|
|
13
13
|
},
|
|
14
14
|
"url": "https://fakeFileStore.com/some/kind/of/file",
|
|
15
|
-
"desc": "proofOfAddress.pdf"
|
|
15
|
+
"desc": "proofOfAddress.pdf",
|
|
16
|
+
"pdtfSchemaPath": "/propertyPack/materialFacts/councilTax/councilTaxAffectingAlterations/details"
|
|
16
17
|
}
|
|
17
18
|
],
|
|
18
19
|
"verification_method": {
|
|
@@ -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
|
+
};
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
"Personal Representative for a Deceased Owner",
|
|
66
66
|
"Under Power of Attorney",
|
|
67
67
|
"Mortgagee in Possession",
|
|
68
|
-
"Other
|
|
68
|
+
"Other"
|
|
69
69
|
]
|
|
70
70
|
}
|
|
71
71
|
},
|
|
@@ -86,17 +86,17 @@
|
|
|
86
86
|
"enum": [
|
|
87
87
|
"Personal Representative for a Deceased Owner",
|
|
88
88
|
"Under Power of Attorney",
|
|
89
|
-
"Other
|
|
89
|
+
"Other"
|
|
90
90
|
]
|
|
91
91
|
},
|
|
92
|
-
"
|
|
92
|
+
"sellersCapacityDetails": {
|
|
93
93
|
"baspiRef": "B1.4",
|
|
94
94
|
"RDSRef": "Participants/OtherDocumentation",
|
|
95
|
-
"title": "Please provide details
|
|
95
|
+
"title": "Please provide details and provide any probate, grant of representation or power of attorney ",
|
|
96
96
|
"type": "string"
|
|
97
97
|
}
|
|
98
98
|
},
|
|
99
|
-
"required": ["
|
|
99
|
+
"required": ["sellersCapacityDetails"]
|
|
100
100
|
}
|
|
101
101
|
]
|
|
102
102
|
}
|
|
@@ -309,7 +309,7 @@
|
|
|
309
309
|
"baspiRef": "B4.3.5",
|
|
310
310
|
"RDSRef": "Objects/isNotWorking=yes|no|true|false",
|
|
311
311
|
"title": "Is the system in good working order to your satisfaction?",
|
|
312
|
-
"$ref": "#/$defs/
|
|
312
|
+
"$ref": "#/$defs/yesNoDetailIfNo"
|
|
313
313
|
},
|
|
314
314
|
"isConnectedToNationalGrid": {
|
|
315
315
|
"baspiRef": "B4.3.6",
|
|
@@ -318,7 +318,15 @@
|
|
|
318
318
|
"type": "string",
|
|
319
319
|
"enum": ["Yes (FiT)", "Yes (SEG)", "No"]
|
|
320
320
|
}
|
|
321
|
-
}
|
|
321
|
+
},
|
|
322
|
+
"required": [
|
|
323
|
+
"yearInstalled",
|
|
324
|
+
"panelsOwnedOutright",
|
|
325
|
+
"panelProviderLease",
|
|
326
|
+
"lastMaintained",
|
|
327
|
+
"inGoodWorkingOrder",
|
|
328
|
+
"isConnectedToNationalGrid"
|
|
329
|
+
]
|
|
322
330
|
}
|
|
323
331
|
]
|
|
324
332
|
}
|
|
@@ -589,7 +597,7 @@
|
|
|
589
597
|
"type": "string"
|
|
590
598
|
},
|
|
591
599
|
"lastName": {
|
|
592
|
-
"title": "
|
|
600
|
+
"title": "Last Name",
|
|
593
601
|
"type": "string",
|
|
594
602
|
"minLength": 1
|
|
595
603
|
},
|
|
@@ -683,8 +691,8 @@
|
|
|
683
691
|
"baspiRef": "B7.3",
|
|
684
692
|
"RDSRef": "RightsHolders/Text",
|
|
685
693
|
"lawSocietyRef": "TA6/14.2",
|
|
686
|
-
"title": "Are there any dates on which you cannot move?
|
|
687
|
-
"description": "If yes, please
|
|
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.",
|
|
688
696
|
"type": "object",
|
|
689
697
|
"properties": {
|
|
690
698
|
"yesNo": {
|